Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Cross-Chain Transactions
Loading...
Loading
Contract Name:
AssimilatorV2
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity ^0.8.13;
import "../../lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import "../../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import "../../lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol";
import "../../lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol";
import "../lib/ABDKMath64x64.sol";
import "../interfaces/IAssimilator.sol";
import "../interfaces/IOracle.sol";
contract AssimilatorV2 is IAssimilator, ReentrancyGuard {
using ABDKMath64x64 for int128;
using ABDKMath64x64 for uint256;
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 public immutable usdc;
IOracle public immutable oracle;
IERC20 public immutable token;
uint256 public immutable oracleDecimals;
uint256 public immutable tokenDecimals;
// solhint-disable-next-line
constructor(
IOracle _oracle,
address _token,
uint256 _tokenDecimals,
uint256 _oracleDecimals
) {
oracle = _oracle;
token = IERC20(_token);
oracleDecimals = _oracleDecimals;
tokenDecimals = _tokenDecimals;
usdc = IERC20(quoteAddress());
}
function quoteAddress () internal view returns (address) {
uint256 chainID;
assembly {
chainID := chainid()
}
if(chainID == 1) {
return 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
}else if (chainID == 137) {
return 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;
} else if (chainID == 42161) {
return 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8;
}else{
return address(0);
}
}
function getRate() public view override returns (uint256) {
(, int256 price, , , ) = oracle.latestRoundData();
return uint256(price);
}
// takes raw eurs amount, transfers it in, calculates corresponding numeraire amount and returns it
function intakeRawAndGetBalance(uint256 _amount)
external
override
returns (int128 amount_, int128 balance_)
{
token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 _balance = token.balanceOf(address(this));
uint256 _rate = getRate();
balance_ = ((_balance * _rate) / 10**oracleDecimals).divu(10**tokenDecimals);
amount_ = ((_amount * _rate) / 10**oracleDecimals).divu(
10**tokenDecimals
);
}
// takes raw eurs amount, transfers it in, calculates corresponding numeraire amount and returns it
function intakeRaw(uint256 _amount)
external
override
returns (int128 amount_)
{
token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 _rate = getRate();
amount_ = ((_amount * _rate) / 10**oracleDecimals).divu(
10**tokenDecimals
);
}
// takes a numeraire amount, calculates the raw amount of eurs, transfers it in and returns the corresponding raw amount
function intakeNumeraire(int128 _amount)
external
override
returns (uint256 amount_)
{
uint256 _rate = getRate();
amount_ = (_amount.mulu(10**tokenDecimals) * 10**oracleDecimals) / _rate;
token.safeTransferFrom(msg.sender, address(this), amount_);
}
// takes a numeraire amount, calculates the raw amount of eurs, transfers it in and returns the corresponding raw amount
function intakeNumeraireLPRatio(
uint256 _baseWeight,
uint256 _minBaseAmount,
uint256 _maxBaseAmount,
uint256 _quoteWeight,
uint256 _minQuoteAmount,
uint256 _maxQuoteAmount,
address _addr,
int128 _amount
) external override returns (uint256 amount_) {
uint256 _tokenBal = token.balanceOf(_addr);
if (_tokenBal <= 0) return 0;
_tokenBal = _tokenBal.mul(1e18).div(_baseWeight);
uint256 _usdcBal = usdc.balanceOf(_addr).mul(1e18).div(_quoteWeight);
// Rate is in 1e6
uint256 _rate = _usdcBal.mul(10**tokenDecimals).div(_tokenBal);
amount_ = (_amount.mulu(10**tokenDecimals) * 1e6) / _rate;
if (address(token) == address(usdc)) {
require(amount_ >= _minQuoteAmount && amount_ <= _maxQuoteAmount, "Assimilator/LP Ratio imbalanced!");
} else {
require(amount_ >= _minBaseAmount && amount_ <= _maxBaseAmount, "Assimilator/LP Ratio imbalanced!");
}
token.safeTransferFrom(msg.sender, address(this), amount_);
}
// takes a raw amount of eurs and transfers it out, returns numeraire value of the raw amount
function outputRawAndGetBalance(address _dst, uint256 _amount) external override returns (int128 amount_, int128 balance_){
uint256 _rate = getRate();
token.safeTransfer(_dst, _amount);
uint256 _balance = token.balanceOf(address(this));
amount_ = ((_amount * _rate) / 10**oracleDecimals).divu(10**tokenDecimals);
balance_ = ((_balance * _rate) / 10**oracleDecimals).divu(
10**tokenDecimals
);
}
// takes a raw amount of eurs and transfers it out, returns numeraire value of the raw amount
function outputRaw(address _dst, uint256 _amount)
external
override
returns (int128 amount_)
{
uint256 _rate = getRate();
token.safeTransfer(_dst, _amount);
amount_ = ((_amount * _rate) / 10**oracleDecimals).divu(10**tokenDecimals);
}
// takes a numeraire value of eurs, figures out the raw amount, transfers raw amount out, and returns raw amount
function outputNumeraire(address _dst, int128 _amount)
external
override
returns (uint256 amount_)
{
uint256 _rate = getRate();
amount_ =
(_amount.mulu(10**tokenDecimals) * 10**oracleDecimals) /
_rate;
token.safeTransfer(_dst, amount_);
}
// takes a numeraire amount and returns the raw amount
function viewRawAmount(int128 _amount)
external
view
override
returns (uint256 amount_)
{
uint256 _rate = getRate();
amount_ =
(_amount.mulu(10**tokenDecimals) * 10**oracleDecimals) /
_rate;
}
function viewRawAmountLPRatio(
uint256 _baseWeight,
uint256 _quoteWeight,
address _addr,
int128 _amount
) external view override returns (uint256 amount_) {
uint256 _tokenBal = token.balanceOf(_addr);
if (_tokenBal <= 0) return 0;
// 1e2
_tokenBal = _tokenBal.mul(1e18).div(_baseWeight);
// 1e6
uint256 _usdcBal = usdc.balanceOf(_addr).mul(1e18).div(_quoteWeight);
// Rate is in 1e6
uint256 _rate = _usdcBal.mul(10**tokenDecimals).div(_tokenBal);
amount_ = (_amount.mulu(10**tokenDecimals) * 1e6) / _rate;
}
// takes a raw amount and returns the numeraire amount
function viewNumeraireAmount(uint256 _amount)
external
view
override
returns (int128 amount_)
{
uint256 _rate = getRate();
amount_ = ((_amount * _rate) / 10**oracleDecimals).divu(
10**tokenDecimals
);
}
// views the numeraire value of the current balance of the reserve, in this case eurs
function viewNumeraireBalance(address _addr)
external
view
override
returns (int128 balance_)
{
uint256 _rate = getRate();
uint256 _balance = token.balanceOf(_addr);
if (_balance <= 0) return ABDKMath64x64.fromUInt(0);
balance_ = ((_balance * _rate) / 10**oracleDecimals).divu(
10**tokenDecimals
);
}
// views the numeraire value of the current balance of the reserve, in this case eurs
function viewNumeraireAmountAndBalance(address _addr, uint256 _amount)
external
view
override
returns (int128 amount_, int128 balance_)
{
uint256 _rate = getRate();
amount_ = ((_amount * _rate) / 10**oracleDecimals).divu(
10**tokenDecimals
);
uint256 _balance = token.balanceOf(_addr);
balance_ = ((_balance * _rate) / 10**oracleDecimals).divu(
10**tokenDecimals
);
}
// views the numeraire value of the current balance of the reserve, in this case eurs
// instead of calculating with chainlink's "rate" it'll be determined by the existing
// token ratio. This is in here to prevent LPs from losing out on future oracle price updates
function viewNumeraireBalanceLPRatio(
uint256 _baseWeight,
uint256 _quoteWeight,
address _addr
) external view override returns (int128 balance_) {
uint256 _tokenBal = token.balanceOf(_addr);
if (_tokenBal <= 0) return ABDKMath64x64.fromUInt(0);
uint256 _usdcBal = usdc.balanceOf(_addr).mul(1e18).div(_quoteWeight);
// Rate is in 1e6
uint256 _rate = _usdcBal.mul(1e18).div(
_tokenBal.mul(1e18).div(_baseWeight)
);
balance_ = ((_tokenBal * _rate) / 1e6).divu(1e18);
}
function transferFee(int128 _amount, address _treasury) external override {
uint256 _rate = getRate();
if (_amount < 0) _amount = -(_amount);
uint256 amount = (_amount.mulu(10**tokenDecimals) *
10**oracleDecimals) / _rate;
token.safeTransfer(_treasury, amount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity ^0.8.13;
interface IAssimilator {
function oracleDecimals() external view returns(uint256);
function tokenDecimals() external view returns(uint256);
function getRate() external view returns (uint256);
function intakeRaw(uint256 amount) external returns (int128);
function intakeRawAndGetBalance(uint256 amount)
external
returns (int128, int128);
function intakeNumeraire(int128 amount) external returns (uint256);
function intakeNumeraireLPRatio(
uint256,
uint256,
uint256,
uint256,
uint256,
uint256,
address,
int128
) external returns (uint256);
function outputRaw(address dst, uint256 amount) external returns (int128);
function outputRawAndGetBalance(address dst, uint256 amount)
external
returns (int128, int128);
function outputNumeraire(address dst, int128 amount)
external
returns (uint256);
function viewRawAmount(int128) external view returns (uint256);
function viewRawAmountLPRatio(
uint256,
uint256,
address,
int128
) external view returns (uint256);
function viewNumeraireAmount(uint256) external view returns (int128);
function viewNumeraireBalanceLPRatio(
uint256,
uint256,
address
) external view returns (int128);
function viewNumeraireBalance(address) external view returns (int128);
function viewNumeraireAmountAndBalance(address, uint256)
external
view
returns (int128, int128);
function transferFee(int128, address) external;
}// SPDX-License-Identifier: MIT
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity ^0.8.13;
interface IOracle {
function acceptOwnership() external;
function accessController() external view returns (address);
function aggregator() external view returns (address);
function confirmAggregator(address _aggregator) external;
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function getAnswer(uint256 _roundId) external view returns (int256);
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function getTimestamp(uint256 _roundId) external view returns (uint256);
function latestAnswer() external view returns (int256);
function latestRound() external view returns (uint256);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestTimestamp() external view returns (uint256);
function owner() external view returns (address);
function phaseAggregators(uint16) external view returns (address);
function phaseId() external view returns (uint16);
function proposeAggregator(address _aggregator) external;
function proposedAggregator() external view returns (address);
function proposedGetRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function proposedLatestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function setController(address _accessController) external;
function transferOwnership(address _to) external;
function version() external view returns (uint256);
}// SPDX-License-Identifier: BSD-4-Clause /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity ^0.8.13; /** * Smart contract library of mathematical functions operating with signed * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is * basically a simple fraction whose numerator is signed 128-bit integer and * denominator is 2^64. As long as denominator is always the same, there is no * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are * represented by int128 type holding only the numerator. */ library ABDKMath64x64 { /* * Minimum value signed 64.64-bit fixed point number may have. */ int128 private constant MIN_64x64 = -0x80000000000000000000000000000000; /* * Maximum value signed 64.64-bit fixed point number may have. */ int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Convert signed 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromInt (int256 x) internal pure returns (int128) { unchecked { require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); } } /** * Convert signed 64.64 fixed point number into signed 64-bit integer number * rounding down. * * @param x signed 64.64-bit fixed point number * @return signed 64-bit integer number */ function toInt (int128 x) internal pure returns (int64) { unchecked { return int64 (x >> 64); } } /** * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromUInt (uint256 x) internal pure returns (int128) { unchecked { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (int256 (x << 64)); } } /** * Convert signed 64.64 fixed point number into unsigned 64-bit integer * number rounding down. Revert on underflow. * * @param x signed 64.64-bit fixed point number * @return unsigned 64-bit integer number */ function toUInt (int128 x) internal pure returns (uint64) { unchecked { require (x >= 0); return uint64 (uint128 (x >> 64)); } } /** * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point * number rounding down. Revert on overflow. * * @param x signed 128.128-bin fixed point number * @return signed 64.64-bit fixed point number */ function from128x128 (int256 x) internal pure returns (int128) { unchecked { int256 result = x >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Convert signed 64.64 fixed point number into signed 128.128 fixed point * number. * * @param x signed 64.64-bit fixed point number * @return signed 128.128 fixed point number */ function to128x128 (int128 x) internal pure returns (int256) { unchecked { return int256 (x) << 64; } } /** * Calculate x + y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function add (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) + y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x - y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sub (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) - y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x * y rounding down. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function mul (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 result = int256(x) * y >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point * number and y is signed 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y signed 256-bit integer number * @return signed 256-bit integer number */ function muli (int128 x, int256 y) internal pure returns (int256) { unchecked { if (x == MIN_64x64) { require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu (x, uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000); return -int256 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int256 (absoluteResult); } } } } /** * Calculate x * y rounding down, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y unsigned 256-bit integer number * @return unsigned 256-bit integer number */ function mulu (int128 x, uint256 y) internal pure returns (uint256) { unchecked { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (int256 (x)) * (y >> 128); require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); hi <<= 64; require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo); return hi + lo; } } /** * Calculate x / y rounding towards zero. Revert on overflow or when y is * zero. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function div (int128 x, int128 y) internal pure returns (int128) { unchecked { require (y != 0); int256 result = (int256 (x) << 64) / y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate x / y rounding towards zero, where x and y are signed 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x signed 256-bit integer number * @param y signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function divi (int256 x, int256 y) internal pure returns (int128) { unchecked { require (y != 0); bool negativeResult = false; if (x < 0) { x = -x; // We rely on overflow behavior here negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint128 absoluteResult = divuu (uint256 (x), uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x80000000000000000000000000000000); return -int128 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128 (absoluteResult); // We rely on overflow behavior here } } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function divu (uint256 x, uint256 y) internal pure returns (int128) { unchecked { require (y != 0); uint128 result = divuu (x, y); require (result <= uint128 (MAX_64x64)); return int128 (result); } } /** * Calculate -x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function neg (int128 x) internal pure returns (int128) { unchecked { require (x != MIN_64x64); return -x; } } /** * Calculate |x|. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function abs (int128 x) internal pure returns (int128) { unchecked { require (x != MIN_64x64); return x < 0 ? -x : x; } } /** * Calculate 1 / x rounding towards zero. Revert on overflow or when x is * zero. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function inv (int128 x) internal pure returns (int128) { unchecked { require (x != 0); int256 result = int256 (0x100000000000000000000000000000000) / x; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function avg (int128 x, int128 y) internal pure returns (int128) { unchecked { return int128 ((int256 (x) + int256 (y)) >> 1); } } /** * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down. * Revert on overflow or in case x * y is negative. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function gavg (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); } } /** * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y uint256 value * @return signed 64.64-bit fixed point number */ function pow (int128 x, uint256 y) internal pure returns (int128) { unchecked { bool negative = x < 0 && y & 1 == 1; uint256 absX = uint128 (x < 0 ? -x : x); uint256 absResult; absResult = 0x100000000000000000000000000000000; if (absX <= 0x10000000000000000) { absX <<= 63; while (y != 0) { if (y & 0x1 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x2 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x4 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x8 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; y >>= 4; } absResult >>= 64; } else { uint256 absXShift = 63; if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; } if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; } if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; } if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; } if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; } if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; } uint256 resultShift = 0; while (y != 0) { require (absXShift < 64); if (y & 0x1 != 0) { absResult = absResult * absX >> 127; resultShift += absXShift; if (absResult > 0x100000000000000000000000000000000) { absResult >>= 1; resultShift += 1; } } absX = absX * absX >> 127; absXShift <<= 1; if (absX >= 0x100000000000000000000000000000000) { absX >>= 1; absXShift += 1; } y >>= 1; } require (resultShift < 64); absResult >>= 64 - resultShift; } int256 result = negative ? -int256 (absResult) : int256 (absResult); require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * Calculate sqrt (x) rounding down. Revert if x < 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sqrt (int128 x) internal pure returns (int128) { unchecked { require (x >= 0); return int128 (sqrtu (uint256 (int256 (x)) << 64)); } } /** * Calculate binary logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function log_2 (int128 x) internal pure returns (int128) { unchecked { require (x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 result = msb - 64 << 64; uint256 ux = uint256 (int256 (x)) << uint256 (127 - msb); for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) { ux *= ux; uint256 b = ux >> 255; ux >>= 127 + b; result += bit * int256 (b); } return int128 (result); } } /** * Calculate natural logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function ln (int128 x) internal pure returns (int128) { unchecked { require (x > 0); return int128 (int256 ( uint256 (int256 (log_2 (x))) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128)); } } /** * Calculate binary exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp_2 (int128 x) internal pure returns (int128) { unchecked { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128; if (x & 0x4000000000000000 > 0) result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128; if (x & 0x2000000000000000 > 0) result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128; if (x & 0x1000000000000000 > 0) result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128; if (x & 0x800000000000000 > 0) result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128; if (x & 0x400000000000000 > 0) result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128; if (x & 0x200000000000000 > 0) result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128; if (x & 0x100000000000000 > 0) result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128; if (x & 0x80000000000000 > 0) result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128; if (x & 0x40000000000000 > 0) result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128; if (x & 0x20000000000000 > 0) result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128; if (x & 0x10000000000000 > 0) result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128; if (x & 0x8000000000000 > 0) result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128; if (x & 0x4000000000000 > 0) result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128; if (x & 0x2000000000000 > 0) result = result * 0x1000162E525EE054754457D5995292026 >> 128; if (x & 0x1000000000000 > 0) result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128; if (x & 0x800000000000 > 0) result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128; if (x & 0x400000000000 > 0) result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128; if (x & 0x200000000000 > 0) result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128; if (x & 0x100000000000 > 0) result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128; if (x & 0x80000000000 > 0) result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128; if (x & 0x40000000000 > 0) result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128; if (x & 0x20000000000 > 0) result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128; if (x & 0x10000000000 > 0) result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128; if (x & 0x8000000000 > 0) result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128; if (x & 0x4000000000 > 0) result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128; if (x & 0x2000000000 > 0) result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128; if (x & 0x1000000000 > 0) result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128; if (x & 0x800000000 > 0) result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128; if (x & 0x400000000 > 0) result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128; if (x & 0x200000000 > 0) result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128; if (x & 0x100000000 > 0) result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128; if (x & 0x80000000 > 0) result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128; if (x & 0x40000000 > 0) result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128; if (x & 0x20000000 > 0) result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128; if (x & 0x10000000 > 0) result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128; if (x & 0x8000000 > 0) result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128; if (x & 0x4000000 > 0) result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128; if (x & 0x2000000 > 0) result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128; if (x & 0x1000000 > 0) result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128; if (x & 0x800000 > 0) result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128; if (x & 0x400000 > 0) result = result * 0x100000000002C5C85FDF477B662B26945 >> 128; if (x & 0x200000 > 0) result = result * 0x10000000000162E42FEFA3AE53369388C >> 128; if (x & 0x100000 > 0) result = result * 0x100000000000B17217F7D1D351A389D40 >> 128; if (x & 0x80000 > 0) result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128; if (x & 0x40000 > 0) result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128; if (x & 0x20000 > 0) result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128; if (x & 0x10000 > 0) result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128; if (x & 0x8000 > 0) result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128; if (x & 0x4000 > 0) result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128; if (x & 0x2000 > 0) result = result * 0x1000000000000162E42FEFA39F02B772C >> 128; if (x & 0x1000 > 0) result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128; if (x & 0x800 > 0) result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128; if (x & 0x400 > 0) result = result * 0x100000000000002C5C85FDF473DEA871F >> 128; if (x & 0x200 > 0) result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128; if (x & 0x100 > 0) result = result * 0x100000000000000B17217F7D1CF79E949 >> 128; if (x & 0x80 > 0) result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128; if (x & 0x40 > 0) result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128; if (x & 0x20 > 0) result = result * 0x100000000000000162E42FEFA39EF366F >> 128; if (x & 0x10 > 0) result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128; if (x & 0x8 > 0) result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128; if (x & 0x4 > 0) result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128; if (x & 0x2 > 0) result = result * 0x1000000000000000162E42FEFA39EF358 >> 128; if (x & 0x1 > 0) result = result * 0x10000000000000000B17217F7D1CF79AB >> 128; result >>= uint256 (int256 (63 - (x >> 64))); require (result <= uint256 (int256 (MAX_64x64))); return int128 (int256 (result)); } } /** * Calculate natural exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp (int128 x) internal pure returns (int128) { unchecked { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow return exp_2 ( int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128)); } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return unsigned 64.64-bit fixed point number */ function divuu (uint256 x, uint256 y) private pure returns (uint128) { unchecked { require (y != 0); uint256 result; if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) result = (x << 64) / y; else { uint256 msb = 192; uint256 xc = x >> 192; if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1); require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 hi = result * (y >> 128); uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 xh = x >> 192; uint256 xl = x << 64; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here lo = hi << 128; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here assert (xh == hi >> 128); result += xl / y; } require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return uint128 (result); } } /** * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer * number. * * @param x unsigned 256-bit integer number * @return unsigned 128-bit integer number */ function sqrtu (uint256 x) private pure returns (uint128) { unchecked { if (x == 0) return 0; else { uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x8) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return uint128 (r < r1 ? r : r1); } } } }
{
"remappings": [
"@forge-std/=lib/forge-std/src/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"bytecodeHash": "ipfs"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "london",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IOracle","name":"_oracle","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenDecimals","type":"uint256"},{"internalType":"uint256","name":"_oracleDecimals","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int128","name":"_amount","type":"int128"}],"name":"intakeNumeraire","outputs":[{"internalType":"uint256","name":"amount_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseWeight","type":"uint256"},{"internalType":"uint256","name":"_minBaseAmount","type":"uint256"},{"internalType":"uint256","name":"_maxBaseAmount","type":"uint256"},{"internalType":"uint256","name":"_quoteWeight","type":"uint256"},{"internalType":"uint256","name":"_minQuoteAmount","type":"uint256"},{"internalType":"uint256","name":"_maxQuoteAmount","type":"uint256"},{"internalType":"address","name":"_addr","type":"address"},{"internalType":"int128","name":"_amount","type":"int128"}],"name":"intakeNumeraireLPRatio","outputs":[{"internalType":"uint256","name":"amount_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"intakeRaw","outputs":[{"internalType":"int128","name":"amount_","type":"int128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"intakeRawAndGetBalance","outputs":[{"internalType":"int128","name":"amount_","type":"int128"},{"internalType":"int128","name":"balance_","type":"int128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_dst","type":"address"},{"internalType":"int128","name":"_amount","type":"int128"}],"name":"outputNumeraire","outputs":[{"internalType":"uint256","name":"amount_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dst","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"outputRaw","outputs":[{"internalType":"int128","name":"amount_","type":"int128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dst","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"outputRawAndGetBalance","outputs":[{"internalType":"int128","name":"amount_","type":"int128"},{"internalType":"int128","name":"balance_","type":"int128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int128","name":"_amount","type":"int128"},{"internalType":"address","name":"_treasury","type":"address"}],"name":"transferFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"viewNumeraireAmount","outputs":[{"internalType":"int128","name":"amount_","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"viewNumeraireAmountAndBalance","outputs":[{"internalType":"int128","name":"amount_","type":"int128"},{"internalType":"int128","name":"balance_","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"viewNumeraireBalance","outputs":[{"internalType":"int128","name":"balance_","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseWeight","type":"uint256"},{"internalType":"uint256","name":"_quoteWeight","type":"uint256"},{"internalType":"address","name":"_addr","type":"address"}],"name":"viewNumeraireBalanceLPRatio","outputs":[{"internalType":"int128","name":"balance_","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int128","name":"_amount","type":"int128"}],"name":"viewRawAmount","outputs":[{"internalType":"uint256","name":"amount_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseWeight","type":"uint256"},{"internalType":"uint256","name":"_quoteWeight","type":"uint256"},{"internalType":"address","name":"_addr","type":"address"},{"internalType":"int128","name":"_amount","type":"int128"}],"name":"viewRawAmountLPRatio","outputs":[{"internalType":"uint256","name":"amount_","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6101206040523480156200001257600080fd5b50604051620020493803806200204983398101604081905262000035916200010b565b60016000556001600160a01b0380851660a052831660c05260e08190526101008290526200006262000079565b6001600160a01b0316608052506200015892505050565b6000466001819003620000a15773a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4891505090565b80608903620000c557732791bca1f2de4661ed88a30c99a7a9449aa8417491505090565b8061a4b103620000ea5773ff970a61a04b1ca14834a43f5de4533ebddb5cc891505090565b600091505090565b6001600160a01b03811681146200010857600080fd5b50565b600080600080608085870312156200012257600080fd5b84516200012f81620000f2565b60208601519094506200014281620000f2565b6040860151606090960151949790965092505050565b60805160a05160c05160e05161010051611d5c620002ed600039600081816101c2015281816104da01528181610512015281816105a9015281816107c2015281816108b70152818161097701528181610ac501528181610b2a01528181610c8101528181610cb201528181610f2201528181610f9d015281816110ed015281816111520152818161126d015281816112dc015261134c0152600081816102de0152818161057b015281816107ed015281816108e20152818161094901528181610af001528181610ef401528181610f6f015281816111180152818161117d015261130701526000818161033e01528181610384015281816105fd0152818161064f01528181610842015281816109c001528181610a0901528181610a4801528181610b7401528181610d1d01528181610e1901528181610fe60152818161102401528181611064015281816111e6015281816112ad01526113810152600081816102910152610e560152600081816101e901528181610458015281816106ea01528181610c420152610cf30152611d5c6000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80636b677a8f116100ad578063e68b52e711610071578063e68b52e7146102d9578063f09a3fc314610300578063f5e6c0ca14610313578063fa00102a14610326578063fc0c546a1461033957600080fd5b80636b677a8f146102665780636fc39052146102795780637dc0d1d01461028c5780637f328ecc146102b3578063ac969a73146102c657600080fd5b80633e413bee116100f45780633e413bee146101e4578063459d5a0614610223578063523bf2571461023857806352bf92451461024b578063679aefce1461025e57600080fd5b8063011847a0146101315780630271c3c81461015757806305cf7bb41461016a5780631e9b2cba146101905780633b97e856146101bd575b600080fd5b61014461013f3660046118bf565b610360565b6040519081526020015b60405180910390f35b610144610165366004611905565b610568565b61017d610178366004611920565b61062b565b604051600f9190910b815260200161014e565b6101a361019e366004611955565b6107ab565b60408051600f93840b81529190920b60208201520161014e565b6101447f000000000000000000000000000000000000000000000000000000000000000081565b61020b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161014e565b61023661023136600461197f565b61091d565b005b6101a3610246366004611955565b6109ed565b6101446102593660046119b2565b610b50565b610144610e51565b610144610274366004611905565b610ee1565b610144610287366004611a1f565b610f5c565b61020b7f000000000000000000000000000000000000000000000000000000000000000081565b6101a36102c1366004611a49565b611014565b61017d6102d4366004611a62565b6111b6565b6101447f000000000000000000000000000000000000000000000000000000000000000081565b61017d61030e366004611955565b611293565b61017d610321366004611a49565b611337565b61017d610334366004611a49565b611372565b61020b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516370a0823160e01b81526001600160a01b03838116600483015260009182917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156103cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ef9190611a7d565b905060008111610403576000915050610560565b61041f8661041983670de0b6b3a76400006113b3565b906113c8565b6040516370a0823160e01b81526001600160a01b0386811660048301529192506000916104ca91889161041991670de0b6b3a7640000917f000000000000000000000000000000000000000000000000000000000000000016906370a08231906024015b602060405180830381865afa1580156104a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c49190611a7d565b906113b3565b90506000610507836104196105007f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b85906113b3565b9050806105436105387f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b600f88900b906113d4565b61055090620f4240611b9c565b61055a9190611bc9565b93505050505b949350505050565b600080610573610e51565b9050806105a17f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b6105da6105cf7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b600f87900b906113d4565b6105e49190611b9c565b6105ee9190611bc9565b91506106256001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308561143f565b50919050565b6040516370a0823160e01b81526001600160a01b03828116600483015260009182917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610696573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ba9190611a7d565b9050600081116106d6576106ce60006114aa565b9150506107a4565b600061074385610419670de0b6b3a76400007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231896040518263ffffffff1660e01b815260040161048391906001600160a01b0391909116815260200190565b905060006107726107608861041986670de0b6b3a76400006113b3565b61041984670de0b6b3a76400006113b3565b905061079e670de0b6b3a7640000620f424061078e8487611b9c565b6107989190611bc9565b906114c8565b93505050505b9392505050565b60008060006107b8610e51565b905061081d6107e87f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b6108137f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61078e8488611b9c565b6040516370a0823160e01b81526001600160a01b0387811660048301529194506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ad9190611a7d565b90506109126108dd7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b6109087f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61078e8585611b9c565b925050509250929050565b6000610927610e51565b9050600083600f0b12156109415761093e83611beb565b92505b60008161096f7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61099d6105387f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b6109a79190611b9c565b6109b19190611bc9565b90506109e76001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483611502565b50505050565b60008060006109fa610e51565b9050610a306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168686611502565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abb9190611a7d565b9050610b20610aeb7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b610b167f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61078e8589611b9c565b93506109126108dd7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b6040516370a0823160e01b81526001600160a01b03838116600483015260009182917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610bbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdf9190611a7d565b905060008111610bf3576000915050610e45565b610c098a61041983670de0b6b3a76400006113b3565b6040516370a0823160e01b81526001600160a01b038681166004830152919250600091610c71918a9161041991670de0b6b3a7640000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401610483565b90506000610ca7836104196105007f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b905080610cd86105387f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b610ce590620f4240611b9c565b610cef9190611bc9565b93507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603610db057878410158015610d5a5750868411155b610dab5760405162461bcd60e51b815260206004820181905260248201527f417373696d696c61746f722f4c5020526174696f20696d62616c616e6365642160448201526064015b60405180910390fd5b610e0c565b8a8410158015610dc05750898411155b610e0c5760405162461bcd60e51b815260206004820181905260248201527f417373696d696c61746f722f4c5020526174696f20696d62616c616e636564216044820152606401610da2565b610e416001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308761143f565b5050505b98975050505050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed69190611c2b565b509195945050505050565b600080610eec610e51565b905080610f1a7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b610f486105cf7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b610f529190611b9c565b6107a49190611bc9565b600080610f67610e51565b905080610f957f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b610fc36105cf7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b610fcd9190611b9c565b610fd79190611bc9565b915061100d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168584611502565b5092915050565b60008061104c6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308661143f565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156110b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d79190611a7d565b905060006110e3610e51565b90506111486111137f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61113e7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61078e8486611b9c565b92506111ad6111787f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b6111a37f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61078e8489611b9c565b93505050915091565b6000806111c1610e51565b6040516370a0823160e01b81526001600160a01b0385811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561122d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112519190611a7d565b9050600081116112655761056060006114aa565b6105606108dd7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b60008061129e610e51565b90506112d46001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168585611502565b6105606113027f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61132d7f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b61078e8487611b9c565b600080611342610e51565b90506107a46113027f0000000000000000000000000000000000000000000000000000000000000000600a611b90565b60006113a96001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308561143f565b6000611342610e51565b60006113bf8284611b9c565b90505b92915050565b60006113bf8284611bc9565b6000816000036113e6575060006113c2565b600083600f0b12156113f757600080fd5b600f83900b6001600160801b038316810260401c90608084901c026001600160c01b0381111561142657600080fd5b60401b811981111561143757600080fd5b019392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526109e79085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611537565b6000677fffffffffffffff8211156114c157600080fd5b5060401b90565b6000816000036114d757600080fd5b60006114e38484611609565b905060016001607f1b036001600160801b03821611156113bf57600080fd5b6040516001600160a01b03831660248201526044810182905261153290849063a9059cbb60e01b90606401611473565b505050565b600061158c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661176e9092919063ffffffff16565b80519091501561153257808060200190518101906115aa9190611c7b565b6115325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610da2565b60008160000361161857600080fd5b60006001600160c01b0384116116435782604085901b8161163b5761163b611bb3565b04905061175a565b60c084811c640100000000811061165c576020918201911c5b62010000811061166e576010918201911c5b610100811061167f576008918201911c5b6010811061168f576004918201911c5b6004811061169f576002918201911c5b600281106116ae576001820191505b60bf820360018603901c6001018260ff0387901b816116cf576116cf611bb3565b0492506001600160801b038311156116e657600080fd5b608085901c83026001600160801b038616840260c088901c604089901b82811015611712576001820391505b608084901b92900382811015611729576001820391505b829003608084901c821461173f5761173f611c9d565b88818161174e5761174e611bb3565b04870196505050505050505b6001600160801b038111156113bf57600080fd5b6060610560848460008585600080866001600160a01b031685876040516117959190611cd7565b60006040518083038185875af1925050503d80600081146117d2576040519150601f19603f3d011682016040523d82523d6000602084013e6117d7565b606091505b50915091506117e8878383876117f3565b979650505050505050565b6060831561186257825160000361185b576001600160a01b0385163b61185b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610da2565b5081610560565b61056083838151156118775781518083602001fd5b8060405162461bcd60e51b8152600401610da29190611cf3565b80356001600160a01b03811681146118a857600080fd5b919050565b8035600f81900b81146118a857600080fd5b600080600080608085870312156118d557600080fd5b84359350602085013592506118ec60408601611891565b91506118fa606086016118ad565b905092959194509250565b60006020828403121561191757600080fd5b6113bf826118ad565b60008060006060848603121561193557600080fd5b833592506020840135915061194c60408501611891565b90509250925092565b6000806040838503121561196857600080fd5b61197183611891565b946020939093013593505050565b6000806040838503121561199257600080fd5b61199b836118ad565b91506119a960208401611891565b90509250929050565b600080600080600080600080610100898b0312156119cf57600080fd5b883597506020890135965060408901359550606089013594506080890135935060a08901359250611a0260c08a01611891565b9150611a1060e08a016118ad565b90509295985092959890939650565b60008060408385031215611a3257600080fd5b611a3b83611891565b91506119a9602084016118ad565b600060208284031215611a5b57600080fd5b5035919050565b600060208284031215611a7457600080fd5b6113bf82611891565b600060208284031215611a8f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115611ae7578160001904821115611acd57611acd611a96565b80851615611ada57918102915b93841c9390800290611ab1565b509250929050565b600082611afe575060016113c2565b81611b0b575060006113c2565b8160018114611b215760028114611b2b57611b47565b60019150506113c2565b60ff841115611b3c57611b3c611a96565b50506001821b6113c2565b5060208310610133831016604e8410600b8410161715611b6a575081810a6113c2565b611b748383611aac565b8060001904821115611b8857611b88611a96565b029392505050565b60006113bf8383611aef565b80820281158282048414176113c2576113c2611a96565b634e487b7160e01b600052601260045260246000fd5b600082611be657634e487b7160e01b600052601260045260246000fd5b500490565b600081600f0b60016001607f1b03198103611c0857611c08611a96565b60000392915050565b805169ffffffffffffffffffff811681146118a857600080fd5b600080600080600060a08688031215611c4357600080fd5b611c4c86611c11565b9450602086015193506040860151925060608601519150611c6f60808701611c11565b90509295509295909350565b600060208284031215611c8d57600080fd5b815180151581146113bf57600080fd5b634e487b7160e01b600052600160045260246000fd5b60005b83811015611cce578181015183820152602001611cb6565b50506000910152565b60008251611ce9818460208701611cb3565b9190910192915050565b6020815260008251806020840152611d12816040850160208701611cb3565b601f01601f1916919091016040019291505056fea264697066735822122039037ceb6b4d9aabe3ce53a0b66446bb5097efca489dc1da8fbb80951f61495f64736f6c634300081100330000000000000000000000003dd6e51cb9cae717d5a8778cf79a04029f9cfdf8000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80636b677a8f116100ad578063e68b52e711610071578063e68b52e7146102d9578063f09a3fc314610300578063f5e6c0ca14610313578063fa00102a14610326578063fc0c546a1461033957600080fd5b80636b677a8f146102665780636fc39052146102795780637dc0d1d01461028c5780637f328ecc146102b3578063ac969a73146102c657600080fd5b80633e413bee116100f45780633e413bee146101e4578063459d5a0614610223578063523bf2571461023857806352bf92451461024b578063679aefce1461025e57600080fd5b8063011847a0146101315780630271c3c81461015757806305cf7bb41461016a5780631e9b2cba146101905780633b97e856146101bd575b600080fd5b61014461013f3660046118bf565b610360565b6040519081526020015b60405180910390f35b610144610165366004611905565b610568565b61017d610178366004611920565b61062b565b604051600f9190910b815260200161014e565b6101a361019e366004611955565b6107ab565b60408051600f93840b81529190920b60208201520161014e565b6101447f000000000000000000000000000000000000000000000000000000000000000681565b61020b7f000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc881565b6040516001600160a01b03909116815260200161014e565b61023661023136600461197f565b61091d565b005b6101a3610246366004611955565b6109ed565b6101446102593660046119b2565b610b50565b610144610e51565b610144610274366004611905565b610ee1565b610144610287366004611a1f565b610f5c565b61020b7f0000000000000000000000003dd6e51cb9cae717d5a8778cf79a04029f9cfdf881565b6101a36102c1366004611a49565b611014565b61017d6102d4366004611a62565b6111b6565b6101447f000000000000000000000000000000000000000000000000000000000000000881565b61017d61030e366004611955565b611293565b61017d610321366004611a49565b611337565b61017d610334366004611a49565b611372565b61020b7f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f781565b6040516370a0823160e01b81526001600160a01b03838116600483015260009182917f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f716906370a0823190602401602060405180830381865afa1580156103cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ef9190611a7d565b905060008111610403576000915050610560565b61041f8661041983670de0b6b3a76400006113b3565b906113c8565b6040516370a0823160e01b81526001600160a01b0386811660048301529192506000916104ca91889161041991670de0b6b3a7640000917f000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc816906370a08231906024015b602060405180830381865afa1580156104a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c49190611a7d565b906113b3565b90506000610507836104196105007f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b85906113b3565b9050806105436105387f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b600f88900b906113d4565b61055090620f4240611b9c565b61055a9190611bc9565b93505050505b949350505050565b600080610573610e51565b9050806105a17f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b6105da6105cf7f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b600f87900b906113d4565b6105e49190611b9c565b6105ee9190611bc9565b91506106256001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f71633308561143f565b50919050565b6040516370a0823160e01b81526001600160a01b03828116600483015260009182917f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f716906370a0823190602401602060405180830381865afa158015610696573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ba9190611a7d565b9050600081116106d6576106ce60006114aa565b9150506107a4565b600061074385610419670de0b6b3a76400007f000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc86001600160a01b03166370a08231896040518263ffffffff1660e01b815260040161048391906001600160a01b0391909116815260200190565b905060006107726107608861041986670de0b6b3a76400006113b3565b61041984670de0b6b3a76400006113b3565b905061079e670de0b6b3a7640000620f424061078e8487611b9c565b6107989190611bc9565b906114c8565b93505050505b9392505050565b60008060006107b8610e51565b905061081d6107e87f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b6108137f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b61078e8488611b9c565b6040516370a0823160e01b81526001600160a01b0387811660048301529194506000917f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f716906370a0823190602401602060405180830381865afa158015610889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ad9190611a7d565b90506109126108dd7f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b6109087f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b61078e8585611b9c565b925050509250929050565b6000610927610e51565b9050600083600f0b12156109415761093e83611beb565b92505b60008161096f7f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b61099d6105387f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b6109a79190611b9c565b6109b19190611bc9565b90506109e76001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f7168483611502565b50505050565b60008060006109fa610e51565b9050610a306001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f7168686611502565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f76001600160a01b0316906370a0823190602401602060405180830381865afa158015610a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abb9190611a7d565b9050610b20610aeb7f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b610b167f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b61078e8589611b9c565b93506109126108dd7f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b6040516370a0823160e01b81526001600160a01b03838116600483015260009182917f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f716906370a0823190602401602060405180830381865afa158015610bbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdf9190611a7d565b905060008111610bf3576000915050610e45565b610c098a61041983670de0b6b3a76400006113b3565b6040516370a0823160e01b81526001600160a01b038681166004830152919250600091610c71918a9161041991670de0b6b3a7640000917f000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc816906370a0823190602401610483565b90506000610ca7836104196105007f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b905080610cd86105387f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b610ce590620f4240611b9c565b610cef9190611bc9565b93507f000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc86001600160a01b03167f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f76001600160a01b031603610db057878410158015610d5a5750868411155b610dab5760405162461bcd60e51b815260206004820181905260248201527f417373696d696c61746f722f4c5020526174696f20696d62616c616e6365642160448201526064015b60405180910390fd5b610e0c565b8a8410158015610dc05750898411155b610e0c5760405162461bcd60e51b815260206004820181905260248201527f417373696d696c61746f722f4c5020526174696f20696d62616c616e636564216044820152606401610da2565b610e416001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f71633308761143f565b5050505b98975050505050505050565b6000807f0000000000000000000000003dd6e51cb9cae717d5a8778cf79a04029f9cfdf86001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed69190611c2b565b509195945050505050565b600080610eec610e51565b905080610f1a7f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b610f486105cf7f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b610f529190611b9c565b6107a49190611bc9565b600080610f67610e51565b905080610f957f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b610fc36105cf7f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b610fcd9190611b9c565b610fd79190611bc9565b915061100d6001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f7168584611502565b5092915050565b60008061104c6001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f71633308661143f565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f76001600160a01b0316906370a0823190602401602060405180830381865afa1580156110b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d79190611a7d565b905060006110e3610e51565b90506111486111137f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b61113e7f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b61078e8486611b9c565b92506111ad6111787f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b6111a37f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b61078e8489611b9c565b93505050915091565b6000806111c1610e51565b6040516370a0823160e01b81526001600160a01b0385811660048301529192506000917f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f716906370a0823190602401602060405180830381865afa15801561122d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112519190611a7d565b9050600081116112655761056060006114aa565b6105606108dd7f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b60008061129e610e51565b90506112d46001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f7168585611502565b6105606113027f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b61132d7f0000000000000000000000000000000000000000000000000000000000000008600a611b90565b61078e8487611b9c565b600080611342610e51565b90506107a46113027f0000000000000000000000000000000000000000000000000000000000000006600a611b90565b60006113a96001600160a01b037f000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f71633308561143f565b6000611342610e51565b60006113bf8284611b9c565b90505b92915050565b60006113bf8284611bc9565b6000816000036113e6575060006113c2565b600083600f0b12156113f757600080fd5b600f83900b6001600160801b038316810260401c90608084901c026001600160c01b0381111561142657600080fd5b60401b811981111561143757600080fd5b019392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526109e79085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611537565b6000677fffffffffffffff8211156114c157600080fd5b5060401b90565b6000816000036114d757600080fd5b60006114e38484611609565b905060016001607f1b036001600160801b03821611156113bf57600080fd5b6040516001600160a01b03831660248201526044810182905261153290849063a9059cbb60e01b90606401611473565b505050565b600061158c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661176e9092919063ffffffff16565b80519091501561153257808060200190518101906115aa9190611c7b565b6115325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610da2565b60008160000361161857600080fd5b60006001600160c01b0384116116435782604085901b8161163b5761163b611bb3565b04905061175a565b60c084811c640100000000811061165c576020918201911c5b62010000811061166e576010918201911c5b610100811061167f576008918201911c5b6010811061168f576004918201911c5b6004811061169f576002918201911c5b600281106116ae576001820191505b60bf820360018603901c6001018260ff0387901b816116cf576116cf611bb3565b0492506001600160801b038311156116e657600080fd5b608085901c83026001600160801b038616840260c088901c604089901b82811015611712576001820391505b608084901b92900382811015611729576001820391505b829003608084901c821461173f5761173f611c9d565b88818161174e5761174e611bb3565b04870196505050505050505b6001600160801b038111156113bf57600080fd5b6060610560848460008585600080866001600160a01b031685876040516117959190611cd7565b60006040518083038185875af1925050503d80600081146117d2576040519150601f19603f3d011682016040523d82523d6000602084013e6117d7565b606091505b50915091506117e8878383876117f3565b979650505050505050565b6060831561186257825160000361185b576001600160a01b0385163b61185b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610da2565b5081610560565b61056083838151156118775781518083602001fd5b8060405162461bcd60e51b8152600401610da29190611cf3565b80356001600160a01b03811681146118a857600080fd5b919050565b8035600f81900b81146118a857600080fd5b600080600080608085870312156118d557600080fd5b84359350602085013592506118ec60408601611891565b91506118fa606086016118ad565b905092959194509250565b60006020828403121561191757600080fd5b6113bf826118ad565b60008060006060848603121561193557600080fd5b833592506020840135915061194c60408501611891565b90509250925092565b6000806040838503121561196857600080fd5b61197183611891565b946020939093013593505050565b6000806040838503121561199257600080fd5b61199b836118ad565b91506119a960208401611891565b90509250929050565b600080600080600080600080610100898b0312156119cf57600080fd5b883597506020890135965060408901359550606089013594506080890135935060a08901359250611a0260c08a01611891565b9150611a1060e08a016118ad565b90509295985092959890939650565b60008060408385031215611a3257600080fd5b611a3b83611891565b91506119a9602084016118ad565b600060208284031215611a5b57600080fd5b5035919050565b600060208284031215611a7457600080fd5b6113bf82611891565b600060208284031215611a8f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115611ae7578160001904821115611acd57611acd611a96565b80851615611ada57918102915b93841c9390800290611ab1565b509250929050565b600082611afe575060016113c2565b81611b0b575060006113c2565b8160018114611b215760028114611b2b57611b47565b60019150506113c2565b60ff841115611b3c57611b3c611a96565b50506001821b6113c2565b5060208310610133831016604e8410600b8410161715611b6a575081810a6113c2565b611b748383611aac565b8060001904821115611b8857611b88611a96565b029392505050565b60006113bf8383611aef565b80820281158282048414176113c2576113c2611a96565b634e487b7160e01b600052601260045260246000fd5b600082611be657634e487b7160e01b600052601260045260246000fd5b500490565b600081600f0b60016001607f1b03198103611c0857611c08611a96565b60000392915050565b805169ffffffffffffffffffff811681146118a857600080fd5b600080600080600060a08688031215611c4357600080fd5b611c4c86611c11565b9450602086015193506040860151925060608601519150611c6f60808701611c11565b90509295509295909350565b600060208284031215611c8d57600080fd5b815180151581146113bf57600080fd5b634e487b7160e01b600052600160045260246000fd5b60005b83811015611cce578181015183820152602001611cb6565b50506000910152565b60008251611ce9818460208701611cb3565b9190910192915050565b6020815260008251806020840152611d12816040850160208701611cb3565b601f01601f1916919091016040019291505056fea264697066735822122039037ceb6b4d9aabe3ce53a0b66446bb5097efca489dc1da8fbb80951f61495f64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000003dd6e51cb9cae717d5a8778cf79a04029f9cfdf8000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f700000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008
-----Decoded View---------------
Arg [0] : _oracle (address): 0x3dD6e51CB9caE717d5a8778CF79A04029f9cFDF8
Arg [1] : _token (address): 0x589d35656641d6aB57A545F08cf473eCD9B6D5F7
Arg [2] : _tokenDecimals (uint256): 6
Arg [3] : _oracleDecimals (uint256): 8
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000003dd6e51cb9cae717d5a8778cf79a04029f9cfdf8
Arg [1] : 000000000000000000000000589d35656641d6ab57a545f08cf473ecd9b6d5f7
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000008
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.