Polygon Sponsored slots available. Book your slot here!
More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 1,671 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Approve | 65832947 | 53 days ago | IN | 0 POL | 0.01059787 | ||||
Approve | 65451506 | 62 days ago | IN | 0 POL | 0.00090546 | ||||
Approve | 64383854 | 89 days ago | IN | 0 POL | 0.00110225 | ||||
Approve | 63398527 | 114 days ago | IN | 0 POL | 0.00151901 | ||||
Approve | 60329437 | 190 days ago | IN | 0 POL | 0.00090546 | ||||
Approve | 59814870 | 203 days ago | IN | 0 POL | 0.00090548 | ||||
Approve | 55264801 | 320 days ago | IN | 0 POL | 0.00137722 | ||||
Approve | 54527566 | 340 days ago | IN | 0 POL | 0.00303011 | ||||
Withdraw | 51984831 | 405 days ago | IN | 0 POL | 0.00599428 | ||||
Withdraw | 51650577 | 414 days ago | IN | 0 POL | 0.03941034 | ||||
Withdraw | 51650468 | 414 days ago | IN | 0 POL | 0.04749447 | ||||
Approve | 51407302 | 420 days ago | IN | 0 POL | 0.01234443 | ||||
Approve | 51407298 | 420 days ago | IN | 0 POL | 0.01234443 | ||||
Withdraw | 51397004 | 421 days ago | IN | 0 POL | 0.02353257 | ||||
Approve | 49329117 | 473 days ago | IN | 0 POL | 0.00264308 | ||||
Approve | 48472436 | 495 days ago | IN | 0 POL | 0.00239869 | ||||
Approve | 44929983 | 584 days ago | IN | 0 POL | 0.00350095 | ||||
Approve | 44929967 | 584 days ago | IN | 0 POL | 0.00351518 | ||||
Withdraw | 44853197 | 586 days ago | IN | 0 POL | 0.01783093 | ||||
Approve | 44694769 | 590 days ago | IN | 0 POL | 0.00364811 | ||||
Approve | 44692063 | 590 days ago | IN | 0 POL | 0.00403727 | ||||
Approve | 42839376 | 638 days ago | IN | 0 POL | 0.00473516 | ||||
Approve | 42837654 | 638 days ago | IN | 0 POL | 0.00380887 | ||||
Approve | 42837651 | 638 days ago | IN | 0 POL | 0.00369521 | ||||
Withdraw | 42222947 | 654 days ago | IN | 0 POL | 0.05505046 |
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16908169 | 1309 days ago | Contract Creation | 0 POL |
Loading...
Loading
This contract contains unverified libraries: Curves, Orchestrator, ProportionalLiquidity, Swaps, ViewLiquidity
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Curve
Compiler Version
v0.7.3+commit.9bfce1f6
Contract Source Code (Solidity Multiple files 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.7.3; import "./ABDKMath64x64.sol"; import "./Orchestrator.sol"; import "./ProportionalLiquidity.sol"; import "./Swaps.sol"; import "./ViewLiquidity.sol"; import "./Storage.sol"; import "./IFreeFromUpTo.sol"; library Curves { using ABDKMath64x64 for int128; event Approval(address indexed _owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); function add( uint256 x, uint256 y, string memory errorMessage ) private pure returns (uint256 z) { require((z = x + y) >= x, errorMessage); } function sub( uint256 x, uint256 y, string memory errorMessage ) private pure returns (uint256 z) { require((z = x - y) <= x, errorMessage); } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer( Storage.Curve storage curve, address recipient, uint256 amount ) external returns (bool) { _transfer(curve, msg.sender, recipient, amount); return true; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve( Storage.Curve storage curve, address spender, uint256 amount ) external returns (bool) { _approve(curve, msg.sender, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`'s tokens of at least * `amount` */ function transferFrom( Storage.Curve storage curve, address sender, address recipient, uint256 amount ) external returns (bool) { _transfer(curve, sender, recipient, amount); _approve( curve, sender, msg.sender, sub(curve.allowances[sender][msg.sender], amount, "Curve/insufficient-allowance") ); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance( Storage.Curve storage curve, address spender, uint256 addedValue ) external returns (bool) { _approve( curve, msg.sender, spender, add(curve.allowances[msg.sender][spender], addedValue, "Curve/approval-overflow") ); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance( Storage.Curve storage curve, address spender, uint256 subtractedValue ) external returns (bool) { _approve( curve, msg.sender, spender, sub(curve.allowances[msg.sender][spender], subtractedValue, "Curve/allowance-decrease-underflow") ); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is public function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( Storage.Curve storage curve, address sender, address recipient, uint256 amount ) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); curve.balances[sender] = sub(curve.balances[sender], amount, "Curve/insufficient-balance"); curve.balances[recipient] = add(curve.balances[recipient], amount, "Curve/transfer-overflow"); emit Transfer(sender, recipient, amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `_owner`s tokens. * * This is public function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `_owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( Storage.Curve storage curve, address _owner, address spender, uint256 amount ) private { require(_owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); curve.allowances[_owner][spender] = amount; emit Approval(_owner, spender, amount); } } contract Curve is Storage { using SafeMath for uint256; event Approval(address indexed _owner, address indexed spender, uint256 value); event ParametersSet(uint256 alpha, uint256 beta, uint256 delta, uint256 epsilon, uint256 lambda); event AssetIncluded(address indexed numeraire, address indexed reserve, uint256 weight); event AssimilatorIncluded( address indexed derivative, address indexed numeraire, address indexed reserve, address assimilator ); event PartitionRedeemed(address indexed token, address indexed redeemer, uint256 value); event OwnershipTransfered(address indexed previousOwner, address indexed newOwner); event FrozenSet(bool isFrozen); event EmergencyAlarm(bool isEmergency); event Trade( address indexed trader, address indexed origin, address indexed target, uint256 originAmount, uint256 targetAmount ); event Transfer(address indexed from, address indexed to, uint256 value); modifier onlyOwner() { require(msg.sender == owner, "Curve/caller-is-not-owner"); _; } modifier nonReentrant() { require(notEntered, "Curve/re-entered"); notEntered = false; _; notEntered = true; } modifier transactable() { require(!frozen, "Curve/frozen-only-allowing-proportional-withdraw"); _; } modifier isEmergency() { require(emergency, "Curve/emergency-only-allowing-emergency-proportional-withdraw"); _; } modifier deadline(uint256 _deadline) { require(block.timestamp < _deadline, "Curve/tx-deadline-passed"); _; } constructor( string memory _name, string memory _symbol, address[] memory _assets, uint256[] memory _assetWeights ) { owner = msg.sender; name = _name; symbol = _symbol; emit OwnershipTransfered(address(0), msg.sender); Orchestrator.initialize(curve, numeraires, reserves, derivatives, _assets, _assetWeights); } /// @notice sets the parameters for the pool /// @param _alpha the value for alpha (halt threshold) must be less than or equal to 1 and greater than 0 /// @param _beta the value for beta must be less than alpha and greater than 0 /// @param _feeAtHalt the maximum value for the fee at the halt point /// @param _epsilon the base fee for the pool /// @param _lambda the value for lambda must be less than or equal to 1 and greater than zero function setParams( uint256 _alpha, uint256 _beta, uint256 _feeAtHalt, uint256 _epsilon, uint256 _lambda ) external onlyOwner { Orchestrator.setParams(curve, _alpha, _beta, _feeAtHalt, _epsilon, _lambda); } /// @notice excludes an assimilator from the curve /// @param _derivative the address of the assimilator to exclude function excludeDerivative(address _derivative) external onlyOwner { for (uint256 i = 0; i < numeraires.length; i++) { if (_derivative == numeraires[i]) revert("Curve/cannot-delete-numeraire"); if (_derivative == reserves[i]) revert("Curve/cannot-delete-reserve"); } delete curve.assimilators[_derivative]; } /// @notice view the current parameters of the curve /// @return alpha_ the current alpha value /// beta_ the current beta value /// delta_ the current delta value /// epsilon_ the current epsilon value /// lambda_ the current lambda value /// omega_ the current omega value function viewCurve() external view returns ( uint256 alpha_, uint256 beta_, uint256 delta_, uint256 epsilon_, uint256 lambda_ ) { return Orchestrator.viewCurve(curve); } function setEmergency(bool _emergency) external onlyOwner { emit EmergencyAlarm(_emergency); emergency = _emergency; } function setFrozen(bool _toFreezeOrNotToFreeze) external onlyOwner { emit FrozenSet(_toFreezeOrNotToFreeze); frozen = _toFreezeOrNotToFreeze; } function transferOwnership(address _newOwner) external onlyOwner { require(_newOwner != address(0), "Curve/new-owner-cannot-be-zeroth-address"); emit OwnershipTransfered(owner, _newOwner); owner = _newOwner; } /// @notice swap a dynamic origin amount for a fixed target amount /// @param _origin the address of the origin /// @param _target the address of the target /// @param _originAmount the origin amount /// @param _minTargetAmount the minimum target amount /// @param _deadline deadline in block number after which the trade will not execute /// @return targetAmount_ the amount of target that has been swapped for the origin amount function originSwap( address _origin, address _target, uint256 _originAmount, uint256 _minTargetAmount, uint256 _deadline ) external deadline(_deadline) transactable nonReentrant returns (uint256 targetAmount_) { targetAmount_ = Swaps.originSwap(curve, _origin, _target, _originAmount, msg.sender); require(targetAmount_ >= _minTargetAmount, "Curve/below-min-target-amount"); } /// @notice view how much target amount a fixed origin amount will swap for /// @param _origin the address of the origin /// @param _target the address of the target /// @param _originAmount the origin amount /// @return targetAmount_ the target amount that would have been swapped for the origin amount function viewOriginSwap( address _origin, address _target, uint256 _originAmount ) external view transactable returns (uint256 targetAmount_) { targetAmount_ = Swaps.viewOriginSwap(curve, _origin, _target, _originAmount); } /// @notice swap a dynamic origin amount for a fixed target amount /// @param _origin the address of the origin /// @param _target the address of the target /// @param _maxOriginAmount the maximum origin amount /// @param _targetAmount the target amount /// @param _deadline deadline in block number after which the trade will not execute /// @return originAmount_ the amount of origin that has been swapped for the target function targetSwap( address _origin, address _target, uint256 _maxOriginAmount, uint256 _targetAmount, uint256 _deadline ) external deadline(_deadline) transactable nonReentrant returns (uint256 originAmount_) { originAmount_ = Swaps.targetSwap(curve, _origin, _target, _targetAmount, msg.sender); require(originAmount_ <= _maxOriginAmount, "Curve/above-max-origin-amount"); } /// @notice view how much of the origin currency the target currency will take /// @param _origin the address of the origin /// @param _target the address of the target /// @param _targetAmount the target amount /// @return originAmount_ the amount of target that has been swapped for the origin function viewTargetSwap( address _origin, address _target, uint256 _targetAmount ) external view transactable returns (uint256 originAmount_) { originAmount_ = Swaps.viewTargetSwap(curve, _origin, _target, _targetAmount); } /// @notice deposit into the pool with no slippage from the numeraire assets the pool supports /// @param _deposit the full amount you want to deposit into the pool which will be divided up evenly amongst /// the numeraire assets of the pool /// @return (the amount of curves you receive in return for your deposit, /// the amount deposited for each numeraire) function deposit(uint256 _deposit, uint256 _deadline) external deadline(_deadline) transactable nonReentrant returns (uint256, uint256[] memory) { // (curvesMinted_, deposits_) return ProportionalLiquidity.proportionalDeposit(curve, _deposit); } /// @notice view deposits and curves minted a given deposit would return /// @param _deposit the full amount of stablecoins you want to deposit. Divided evenly according to the /// prevailing proportions of the numeraire assets of the pool /// @return (the amount of curves you receive in return for your deposit, /// the amount deposited for each numeraire) function viewDeposit(uint256 _deposit) external view transactable returns (uint256, uint256[] memory) { // curvesToMint_, depositsToMake_ return ProportionalLiquidity.viewProportionalDeposit(curve, _deposit); } /// @notice Emergency withdraw tokens in the event that the oracle somehow bugs out /// and no one is able to withdraw due to the invariant check /// @param _curvesToBurn the full amount you want to withdraw from the pool which will be withdrawn from evenly amongst the /// numeraire assets of the pool /// @return withdrawals_ the amonts of numeraire assets withdrawn from the pool function emergencyWithdraw(uint256 _curvesToBurn, uint256 _deadline) external isEmergency deadline(_deadline) nonReentrant returns (uint256[] memory withdrawals_) { return ProportionalLiquidity.emergencyProportionalWithdraw(curve, _curvesToBurn); } /// @notice withdrawas amount of curve tokens from the the pool equally from the numeraire assets of the pool with no slippage /// @param _curvesToBurn the full amount you want to withdraw from the pool which will be withdrawn from evenly amongst the /// numeraire assets of the pool /// @return withdrawals_ the amonts of numeraire assets withdrawn from the pool function withdraw(uint256 _curvesToBurn, uint256 _deadline) external deadline(_deadline) nonReentrant returns (uint256[] memory withdrawals_) { return ProportionalLiquidity.proportionalWithdraw(curve, _curvesToBurn); } /// @notice views the withdrawal information from the pool /// @param _curvesToBurn the full amount you want to withdraw from the pool which will be withdrawn from evenly amongst the /// numeraire assets of the pool /// @return the amonnts of numeraire assets withdrawn from the pool function viewWithdraw(uint256 _curvesToBurn) external view transactable returns (uint256[] memory) { return ProportionalLiquidity.viewProportionalWithdraw(curve, _curvesToBurn); } function supportsInterface(bytes4 _interface) public pure returns (bool supports_) { supports_ = this.supportsInterface.selector == _interface || // erc165 bytes4(0x7f5828d0) == _interface || // eip173 bytes4(0x36372b07) == _interface; // erc20 } /// @notice transfers curve tokens /// @param _recipient the address of where to send the curve tokens /// @param _amount the amount of curve tokens to send /// @return success_ the success bool of the call function transfer(address _recipient, uint256 _amount) public nonReentrant returns (bool success_) { success_ = Curves.transfer(curve, _recipient, _amount); } /// @notice transfers curve tokens from one address to another address /// @param _sender the account from which the curve tokens will be sent /// @param _recipient the account to which the curve tokens will be sent /// @param _amount the amount of curve tokens to transfer /// @return success_ the success bool of the call function transferFrom( address _sender, address _recipient, uint256 _amount ) public nonReentrant returns (bool success_) { success_ = Curves.transferFrom(curve, _sender, _recipient, _amount); } /// @notice approves a user to spend curve tokens on their behalf /// @param _spender the account to allow to spend from msg.sender /// @param _amount the amount to specify the spender can spend /// @return success_ the success bool of this call function approve(address _spender, uint256 _amount) public nonReentrant returns (bool success_) { success_ = Curves.approve(curve, _spender, _amount); } /// @notice view the curve token balance of a given account /// @param _account the account to view the balance of /// @return balance_ the curve token ballance of the given account function balanceOf(address _account) public view returns (uint256 balance_) { balance_ = curve.balances[_account]; } /// @notice views the total curve supply of the pool /// @return totalSupply_ the total supply of curve tokens function totalSupply() public view returns (uint256 totalSupply_) { totalSupply_ = curve.totalSupply; } /// @notice views the total allowance one address has to spend from another address /// @param _owner the address of the owner /// @param _spender the address of the spender /// @return allowance_ the amount the owner has allotted the spender function allowance(address _owner, address _spender) public view returns (uint256 allowance_) { allowance_ = curve.allowances[_owner][_spender]; } /// @notice views the total amount of liquidity in the curve in numeraire value and format - 18 decimals /// @return total_ the total value in the curve /// @return individual_ the individual values in the curve function liquidity() public view returns (uint256 total_, uint256[] memory individual_) { return ViewLiquidity.viewLiquidity(curve); } /// @notice view the assimilator address for a derivative /// @return assimilator_ the assimilator address function assimilator(address _derivative) public view returns (address assimilator_) { assimilator_ = curve.assimilators[_derivative].addr; } }
// 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.7.0; /** * 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) { 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) { 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) { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (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) { require (x >= 0); return uint64 (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) { 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) { 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) { 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) { 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) { 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) { 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) { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (x) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { uint256 absoluteResult; bool negativeResult = false; if (x >= 0) { absoluteResult = powu (uint256 (x) << 63, y); } else { // We rely on overflow behavior here absoluteResult = powu (uint256 (uint128 (-x)) << 63, y); negativeResult = y & 1 > 0; } absoluteResult >>= 63; 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 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) { require (x >= 0); return int128 (sqrtu (uint256 (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) { 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 (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) { require (x > 0); return int128 ( uint256 (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) { 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 (63 - (x >> 64)); require (result <= uint256 (MAX_64x64)); return int128 (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) { 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) { 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 x^y assuming 0^0 is 1, where x is unsigned 129.127 fixed point * number and y is unsigned 256-bit integer number. Revert on overflow. * * @param x unsigned 129.127-bit fixed point number * @param y uint256 value * @return unsigned 129.127-bit fixed point number */ function powu (uint256 x, uint256 y) private pure returns (uint256) { if (y == 0) return 0x80000000000000000000000000000000; else if (x == 0) return 0; else { int256 msb = 0; uint256 xc = x; if (xc >= 0x100000000000000000000000000000000) { xc >>= 128; msb += 128; } 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 xe = msb - 127; if (xe > 0) x >>= uint256 (xe); else x <<= uint256 (-xe); uint256 result = 0x80000000000000000000000000000000; int256 re = 0; while (y > 0) { if (y & 1 > 0) { result = result * x; y -= 1; re += xe; if (result >= 0x8000000000000000000000000000000000000000000000000000000000000000) { result >>= 128; re += 1; } else result >>= 127; if (re < -127) return 0; // Underflow require (re < 128); // Overflow } else { x = x * x; y >>= 1; xe <<= 1; if (x >= 0x8000000000000000000000000000000000000000000000000000000000000000) { x >>= 128; xe += 1; } else x >>= 127; if (xe < -127) return 0; // Underflow require (xe < 128); // Overflow } } if (re > 0) result <<= uint256 (re); else if (re < 0) result >>= uint256 (-re); return 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) { 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); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 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://diligence.consensys.net/posts/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"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// 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.7.3; import "./Address.sol"; import "./IAssimilator.sol"; import "./ABDKMath64x64.sol"; library Assimilators { using ABDKMath64x64 for int128; using Address for address; IAssimilator public constant iAsmltr = IAssimilator(address(0)); function delegate(address _callee, bytes memory _data) internal returns (bytes memory) { require(_callee.isContract(), "Assimilators/callee-is-not-a-contract"); // solhint-disable-next-line (bool _success, bytes memory returnData_) = _callee.delegatecall(_data); // solhint-disable-next-line assembly { if eq(_success, 0) { revert(add(returnData_, 0x20), returndatasize()) } } return returnData_; } function getRate(address _assim) internal view returns (uint256 amount_) { amount_ = IAssimilator(_assim).getRate(); } function viewRawAmount(address _assim, int128 _amt) internal view returns (uint256 amount_) { amount_ = IAssimilator(_assim).viewRawAmount(_amt); } function viewRawAmountLPRatio( address _assim, uint256 _baseWeight, uint256 _quoteWeight, int128 _amount ) internal view returns (uint256 amount_) { amount_ = IAssimilator(_assim).viewRawAmountLPRatio(_baseWeight, _quoteWeight, address(this), _amount); } function viewNumeraireAmount(address _assim, uint256 _amt) internal view returns (int128 amt_) { amt_ = IAssimilator(_assim).viewNumeraireAmount(_amt); } function viewNumeraireAmountAndBalance(address _assim, uint256 _amt) internal view returns (int128 amt_, int128 bal_) { (amt_, bal_) = IAssimilator(_assim).viewNumeraireAmountAndBalance(address(this), _amt); } function viewNumeraireBalance(address _assim) internal view returns (int128 bal_) { bal_ = IAssimilator(_assim).viewNumeraireBalance(address(this)); } function viewNumeraireBalanceLPRatio( uint256 _baseWeight, uint256 _quoteWeight, address _assim ) internal view returns (int128 bal_) { bal_ = IAssimilator(_assim).viewNumeraireBalanceLPRatio(_baseWeight, _quoteWeight, address(this)); } function intakeRaw(address _assim, uint256 _amt) internal returns (int128 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.intakeRaw.selector, _amt); amt_ = abi.decode(delegate(_assim, data), (int128)); } function intakeRawAndGetBalance(address _assim, uint256 _amt) internal returns (int128 amt_, int128 bal_) { bytes memory data = abi.encodeWithSelector(iAsmltr.intakeRawAndGetBalance.selector, _amt); (amt_, bal_) = abi.decode(delegate(_assim, data), (int128, int128)); } function intakeNumeraire(address _assim, int128 _amt) internal returns (uint256 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.intakeNumeraire.selector, _amt); amt_ = abi.decode(delegate(_assim, data), (uint256)); } function intakeNumeraireLPRatio( address _assim, uint256 _baseWeight, uint256 _quoteWeight, int128 _amount ) internal returns (uint256 amt_) { bytes memory data = abi.encodeWithSelector( iAsmltr.intakeNumeraireLPRatio.selector, _baseWeight, _quoteWeight, address(this), _amount ); amt_ = abi.decode(delegate(_assim, data), (uint256)); } function outputRaw( address _assim, address _dst, uint256 _amt ) internal returns (int128 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.outputRaw.selector, _dst, _amt); amt_ = abi.decode(delegate(_assim, data), (int128)); amt_ = amt_.neg(); } function outputRawAndGetBalance( address _assim, address _dst, uint256 _amt ) internal returns (int128 amt_, int128 bal_) { bytes memory data = abi.encodeWithSelector(iAsmltr.outputRawAndGetBalance.selector, _dst, _amt); (amt_, bal_) = abi.decode(delegate(_assim, data), (int128, int128)); amt_ = amt_.neg(); } function outputNumeraire( address _assim, address _dst, int128 _amt ) internal returns (uint256 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.outputNumeraire.selector, _dst, _amt.abs()); amt_ = abi.decode(delegate(_assim, data), (uint256)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// 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 disstributed 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.7.3; // Finds new Curves! logs their addresses and provides `isCurve(address) -> (bool)` import "./Curve.sol"; import "./IFreeFromUpTo.sol"; import "./Ownable.sol"; contract CurveFactory is Ownable { event NewCurve(address indexed caller, bytes32 indexed id, address indexed curve); mapping(bytes32 => address) public curves; function getCurve(address _baseCurrency, address _quoteCurrency) external view returns (address) { bytes32 curveId = keccak256(abi.encode(_baseCurrency, _quoteCurrency)); return (curves[curveId]); } function newCurve( string memory _name, string memory _symbol, address _baseCurrency, address _quoteCurrency, uint256 _baseWeight, uint256 _quoteWeight, address _baseAssimilator, address _quoteAssimilator ) public onlyOwner returns (Curve) { bytes32 curveId = keccak256(abi.encode(_baseCurrency, _quoteCurrency)); if (curves[curveId] != address(0)) revert("CurveFactory/currency-pair-already-exists"); address[] memory _assets = new address[](10); uint256[] memory _assetWeights = new uint256[](2); // Base Currency _assets[0] = _baseCurrency; _assets[1] = _baseAssimilator; _assets[2] = _baseCurrency; _assets[3] = _baseAssimilator; _assets[4] = _baseCurrency; // Quote Currency (typically USDC) _assets[5] = _quoteCurrency; _assets[6] = _quoteAssimilator; _assets[7] = _quoteCurrency; _assets[8] = _quoteAssimilator; _assets[9] = _quoteCurrency; // Weights _assetWeights[0] = _baseWeight; _assetWeights[1] = _quoteWeight; // New curve Curve curve = new Curve(_name, _symbol, _assets, _assetWeights); curve.transferOwnership(msg.sender); curves[curveId] = address(curve); emit NewCurve(msg.sender, curveId, address(curve)); return curve; } }
// 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.7.3; import "./Storage.sol"; import "./UnsafeMath64x64.sol"; import "./ABDKMath64x64.sol"; library CurveMath { int128 private constant ONE = 0x10000000000000000; int128 private constant MAX = 0x4000000000000000; // .25 in layman's terms int128 private constant MAX_DIFF = -0x10C6F7A0B5EE; int128 private constant ONE_WEI = 0x12; using ABDKMath64x64 for int128; using UnsafeMath64x64 for int128; using ABDKMath64x64 for uint256; // This is used to prevent stack too deep errors function calculateFee( int128 _gLiq, int128[] memory _bals, Storage.Curve storage curve, int128[] memory _weights ) internal view returns (int128 psi_) { int128 _beta = curve.beta; int128 _delta = curve.delta; psi_ = calculateFee(_gLiq, _bals, _beta, _delta, _weights); } function calculateFee( int128 _gLiq, int128[] memory _bals, int128 _beta, int128 _delta, int128[] memory _weights ) internal pure returns (int128 psi_) { uint256 _length = _bals.length; for (uint256 i = 0; i < _length; i++) { int128 _ideal = _gLiq.mul(_weights[i]); psi_ += calculateMicroFee(_bals[i], _ideal, _beta, _delta); } } function calculateMicroFee( int128 _bal, int128 _ideal, int128 _beta, int128 _delta ) private pure returns (int128 fee_) { if (_bal < _ideal) { int128 _threshold = _ideal.mul(ONE - _beta); if (_bal < _threshold) { int128 _feeMargin = _threshold - _bal; fee_ = _feeMargin.div(_ideal); fee_ = fee_.mul(_delta); if (fee_ > MAX) fee_ = MAX; fee_ = fee_.mul(_feeMargin); } else fee_ = 0; } else { int128 _threshold = _ideal.mul(ONE + _beta); if (_bal > _threshold) { int128 _feeMargin = _bal - _threshold; fee_ = _feeMargin.div(_ideal); fee_ = fee_.mul(_delta); if (fee_ > MAX) fee_ = MAX; fee_ = fee_.mul(_feeMargin); } else fee_ = 0; } } function calculateTrade( Storage.Curve storage curve, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals, int128 _inputAmt, uint256 _outputIndex ) internal view returns (int128 outputAmt_) { outputAmt_ = -_inputAmt; int128 _lambda = curve.lambda; int128[] memory _weights = curve.weights; int128 _omega = calculateFee(_oGLiq, _oBals, curve, _weights); int128 _psi; for (uint256 i = 0; i < 32; i++) { _psi = calculateFee(_nGLiq, _nBals, curve, _weights); int128 prevAmount; { prevAmount = outputAmt_; outputAmt_ = _omega < _psi ? -(_inputAmt + _omega - _psi) : -(_inputAmt + _lambda.mul(_omega - _psi)); } if (outputAmt_ / 1e13 == prevAmount / 1e13) { _nGLiq = _oGLiq + _inputAmt + outputAmt_; _nBals[_outputIndex] = _oBals[_outputIndex] + outputAmt_; enforceHalts(curve, _oGLiq, _nGLiq, _oBals, _nBals, _weights); enforceSwapInvariant(_oGLiq, _omega, _nGLiq, _psi); return outputAmt_; } else { _nGLiq = _oGLiq + _inputAmt + outputAmt_; _nBals[_outputIndex] = _oBals[_outputIndex].add(outputAmt_); } } revert("Curve/swap-convergence-failed"); } function calculateLiquidityMembrane( Storage.Curve storage curve, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals ) internal view returns (int128 curves_) { enforceHalts(curve, _oGLiq, _nGLiq, _oBals, _nBals, curve.weights); int128 _omega; int128 _psi; { int128 _beta = curve.beta; int128 _delta = curve.delta; int128[] memory _weights = curve.weights; _omega = calculateFee(_oGLiq, _oBals, _beta, _delta, _weights); _psi = calculateFee(_nGLiq, _nBals, _beta, _delta, _weights); } int128 _feeDiff = _psi.sub(_omega); int128 _liqDiff = _nGLiq.sub(_oGLiq); int128 _oUtil = _oGLiq.sub(_omega); int128 _totalShells = curve.totalSupply.divu(1e18); int128 _curveMultiplier; if (_totalShells == 0) { curves_ = _nGLiq.sub(_psi); } else if (_feeDiff >= 0) { _curveMultiplier = _liqDiff.sub(_feeDiff).div(_oUtil); } else { _curveMultiplier = _liqDiff.sub(curve.lambda.mul(_feeDiff)); _curveMultiplier = _curveMultiplier.div(_oUtil); } if (_totalShells != 0) { curves_ = _totalShells.mul(_curveMultiplier); enforceLiquidityInvariant(_totalShells, curves_, _oGLiq, _nGLiq, _omega, _psi); } } function enforceSwapInvariant( int128 _oGLiq, int128 _omega, int128 _nGLiq, int128 _psi ) private pure { int128 _nextUtil = _nGLiq - _psi; int128 _prevUtil = _oGLiq - _omega; int128 _diff = _nextUtil - _prevUtil; require(0 < _diff || _diff >= MAX_DIFF, "Curve/swap-invariant-violation"); } function enforceLiquidityInvariant( int128 _totalShells, int128 _newShells, int128 _oGLiq, int128 _nGLiq, int128 _omega, int128 _psi ) internal pure { if (_totalShells == 0 || 0 == _totalShells + _newShells) return; int128 _prevUtilPerShell = _oGLiq.sub(_omega).div(_totalShells); int128 _nextUtilPerShell = _nGLiq.sub(_psi).div(_totalShells.add(_newShells)); int128 _diff = _nextUtilPerShell - _prevUtilPerShell; require(0 < _diff || _diff >= MAX_DIFF, "Curve/liquidity-invariant-violation"); } function enforceHalts( Storage.Curve storage curve, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals, int128[] memory _weights ) private view { uint256 _length = _nBals.length; int128 _alpha = curve.alpha; for (uint256 i = 0; i < _length; i++) { int128 _nIdeal = _nGLiq.mul(_weights[i]); if (_nBals[i] > _nIdeal) { int128 _upperAlpha = ONE + _alpha; int128 _nHalt = _nIdeal.mul(_upperAlpha); if (_nBals[i] > _nHalt) { int128 _oHalt = _oGLiq.mul(_weights[i]).mul(_upperAlpha); if (_oBals[i] < _oHalt) revert("Curve/upper-halt"); if (_nBals[i] - _nHalt > _oBals[i] - _oHalt) revert("Curve/upper-halt"); } } else { int128 _lowerAlpha = ONE - _alpha; int128 _nHalt = _nIdeal.mul(_lowerAlpha); if (_nBals[i] < _nHalt) { int128 _oHalt = _oGLiq.mul(_weights[i]); _oHalt = _oHalt.mul(_lowerAlpha); if (_oBals[i] > _oHalt) revert("Curve/lower-halt"); if (_nHalt - _nBals[i] > _oHalt - _oBals[i]) revert("Curve/lower-halt"); } } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Context.sol"; import "./IERC20.sol"; import "./SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// 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.7.3; interface IAssimilator { 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, 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); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
// 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.7.3; interface IFreeFromUpTo { function freeFromUpTo(address from, uint256 value) external returns (uint256 freed); }
// 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.7.3; 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: 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.7.3; import "./ERC20.sol"; import "./SafeERC20.sol"; import "./ABDKMath64x64.sol"; import "./Storage.sol"; import "./CurveMath.sol"; library Orchestrator { using SafeERC20 for IERC20; using ABDKMath64x64 for int128; using ABDKMath64x64 for uint256; int128 private constant ONE_WEI = 0x12; event ParametersSet(uint256 alpha, uint256 beta, uint256 delta, uint256 epsilon, uint256 lambda); event AssetIncluded(address indexed numeraire, address indexed reserve, uint256 weight); event AssimilatorIncluded( address indexed derivative, address indexed numeraire, address indexed reserve, address assimilator ); function setParams( Storage.Curve storage curve, uint256 _alpha, uint256 _beta, uint256 _feeAtHalt, uint256 _epsilon, uint256 _lambda ) external { require(0 < _alpha && _alpha < 1e18, "Curve/parameter-invalid-alpha"); require(_beta < _alpha, "Curve/parameter-invalid-beta"); require(_feeAtHalt <= 5e17, "Curve/parameter-invalid-max"); require(_epsilon <= 1e16, "Curve/parameter-invalid-epsilon"); require(_lambda <= 1e18, "Curve/parameter-invalid-lambda"); int128 _omega = getFee(curve); curve.alpha = (_alpha + 1).divu(1e18); curve.beta = (_beta + 1).divu(1e18); curve.delta = (_feeAtHalt).divu(1e18).div(uint256(2).fromUInt().mul(curve.alpha.sub(curve.beta))) + ONE_WEI; curve.epsilon = (_epsilon + 1).divu(1e18); curve.lambda = (_lambda + 1).divu(1e18); int128 _psi = getFee(curve); require(_omega >= _psi, "Curve/parameters-increase-fee"); emit ParametersSet(_alpha, _beta, curve.delta.mulu(1e18), _epsilon, _lambda); } function getFee(Storage.Curve storage curve) private view returns (int128 fee_) { int128 _gLiq; // Always pairs int128[] memory _bals = new int128[](2); for (uint256 i = 0; i < _bals.length; i++) { int128 _bal = Assimilators.viewNumeraireBalance(curve.assets[i].addr); _bals[i] = _bal; _gLiq += _bal; } fee_ = CurveMath.calculateFee(_gLiq, _bals, curve.beta, curve.delta, curve.weights); } function initialize( Storage.Curve storage curve, address[] storage numeraires, address[] storage reserves, address[] storage derivatives, address[] calldata _assets, uint256[] calldata _assetWeights ) external { require(_assetWeights.length == 2, "Curve/assetWeights-must-be-length-two"); require(_assets.length % 5 == 0, "Curve/assets-must-be-divisible-by-five"); for (uint256 i = 0; i < _assetWeights.length; i++) { uint256 ix = i * 5; numeraires.push(_assets[ix]); derivatives.push(_assets[ix]); reserves.push(_assets[2 + ix]); if (_assets[ix] != _assets[2 + ix]) derivatives.push(_assets[2 + ix]); includeAsset( curve, _assets[ix], // numeraire _assets[1 + ix], // numeraire assimilator _assets[2 + ix], // reserve _assets[3 + ix], // reserve assimilator _assets[4 + ix], // reserve approve to _assetWeights[i] ); } } function includeAsset( Storage.Curve storage curve, address _numeraire, address _numeraireAssim, address _reserve, address _reserveAssim, address _reserveApproveTo, uint256 _weight ) private { require(_numeraire != address(0), "Curve/numeraire-cannot-be-zeroth-address"); require(_numeraireAssim != address(0), "Curve/numeraire-assimilator-cannot-be-zeroth-address"); require(_reserve != address(0), "Curve/reserve-cannot-be-zeroth-address"); require(_reserveAssim != address(0), "Curve/reserve-assimilator-cannot-be-zeroth-address"); require(_weight < 1e18, "Curve/weight-must-be-less-than-one"); if (_numeraire != _reserve) IERC20(_numeraire).safeApprove(_reserveApproveTo, uint256(-1)); Storage.Assimilator storage _numeraireAssimilator = curve.assimilators[_numeraire]; _numeraireAssimilator.addr = _numeraireAssim; _numeraireAssimilator.ix = uint8(curve.assets.length); Storage.Assimilator storage _reserveAssimilator = curve.assimilators[_reserve]; _reserveAssimilator.addr = _reserveAssim; _reserveAssimilator.ix = uint8(curve.assets.length); int128 __weight = _weight.divu(1e18).add(uint256(1).divu(1e18)); curve.weights.push(__weight); curve.assets.push(_numeraireAssimilator); emit AssetIncluded(_numeraire, _reserve, _weight); emit AssimilatorIncluded(_numeraire, _numeraire, _reserve, _numeraireAssim); if (_numeraireAssim != _reserveAssim) { emit AssimilatorIncluded(_reserve, _numeraire, _reserve, _reserveAssim); } } function includeAssimilator( Storage.Curve storage curve, address _derivative, address _numeraire, address _reserve, address _assimilator, address _derivativeApproveTo ) private { require(_derivative != address(0), "Curve/derivative-cannot-be-zeroth-address"); require(_numeraire != address(0), "Curve/numeraire-cannot-be-zeroth-address"); require(_reserve != address(0), "Curve/numeraire-cannot-be-zeroth-address"); require(_assimilator != address(0), "Curve/assimilator-cannot-be-zeroth-address"); IERC20(_numeraire).safeApprove(_derivativeApproveTo, uint256(-1)); Storage.Assimilator storage _numeraireAssim = curve.assimilators[_numeraire]; curve.assimilators[_derivative] = Storage.Assimilator(_assimilator, _numeraireAssim.ix); emit AssimilatorIncluded(_derivative, _numeraire, _reserve, _assimilator); } function viewCurve(Storage.Curve storage curve) external view returns ( uint256 alpha_, uint256 beta_, uint256 delta_, uint256 epsilon_, uint256 lambda_ ) { alpha_ = curve.alpha.mulu(1e18); beta_ = curve.beta.mulu(1e18); delta_ = curve.delta.mulu(1e18); epsilon_ = curve.epsilon.mulu(1e18); lambda_ = curve.lambda.mulu(1e18); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; import "./Assimilators.sol"; import "./Storage.sol"; import "./UnsafeMath64x64.sol"; import "./ABDKMath64x64.sol"; import "./CurveMath.sol"; library ProportionalLiquidity { using ABDKMath64x64 for uint256; using ABDKMath64x64 for int128; using UnsafeMath64x64 for int128; event Transfer(address indexed from, address indexed to, uint256 value); int128 public constant ONE = 0x10000000000000000; int128 public constant ONE_WEI = 0x12; function proportionalDeposit(Storage.Curve storage curve, uint256 _deposit) external returns (uint256 curves_, uint256[] memory) { int128 __deposit = _deposit.divu(1e18); uint256 _length = curve.assets.length; uint256[] memory deposits_ = new uint256[](_length); (int128 _oGLiq, int128[] memory _oBals) = getGrossLiquidityAndBalancesForDeposit(curve); // Needed to calculate liquidity invariant (int128 _oGLiqProp, int128[] memory _oBalsProp) = getGrossLiquidityAndBalances(curve); // No liquidity, oracle sets the ratio if (_oGLiq == 0) { for (uint256 i = 0; i < _length; i++) { // Variable here to avoid stack-too-deep errors int128 _d = __deposit.mul(curve.weights[i]); deposits_[i] = Assimilators.intakeNumeraire(curve.assets[i].addr, _d.add(ONE_WEI)); } } else { // We already have an existing pool ratio // which must be respected int128 _multiplier = __deposit.div(_oGLiq); uint256 _baseWeight = curve.weights[0].mulu(1e18); uint256 _quoteWeight = curve.weights[1].mulu(1e18); for (uint256 i = 0; i < _length; i++) { deposits_[i] = Assimilators.intakeNumeraireLPRatio( curve.assets[i].addr, _baseWeight, _quoteWeight, _oBals[i].mul(_multiplier).add(ONE_WEI) ); } } int128 _totalShells = curve.totalSupply.divu(1e18); int128 _newShells = __deposit; if (_totalShells > 0) { _newShells = __deposit.div(_oGLiq); _newShells = _newShells.mul(_totalShells); } requireLiquidityInvariant(curve, _totalShells, _newShells, _oGLiqProp, _oBalsProp); mint(curve, msg.sender, curves_ = _newShells.mulu(1e18)); return (curves_, deposits_); } function viewProportionalDeposit(Storage.Curve storage curve, uint256 _deposit) external view returns (uint256 curves_, uint256[] memory) { int128 __deposit = _deposit.divu(1e18); uint256 _length = curve.assets.length; (int128 _oGLiq, int128[] memory _oBals) = getGrossLiquidityAndBalancesForDeposit(curve); uint256[] memory deposits_ = new uint256[](_length); // No liquidity if (_oGLiq == 0) { for (uint256 i = 0; i < _length; i++) { deposits_[i] = Assimilators.viewRawAmount( curve.assets[i].addr, __deposit.mul(curve.weights[i]).add(ONE_WEI) ); } } else { // We already have an existing pool ratio // this must be respected int128 _multiplier = __deposit.div(_oGLiq); uint256 _baseWeight = curve.weights[0].mulu(1e18); uint256 _quoteWeight = curve.weights[1].mulu(1e18); // Deposits into the pool is determined by existing LP ratio for (uint256 i = 0; i < _length; i++) { deposits_[i] = Assimilators.viewRawAmountLPRatio( curve.assets[i].addr, _baseWeight, _quoteWeight, _oBals[i].mul(_multiplier).add(ONE_WEI) ); } } int128 _totalShells = curve.totalSupply.divu(1e18); int128 _newShells = __deposit; if (_totalShells > 0) { _newShells = __deposit.div(_oGLiq); _newShells = _newShells.mul(_totalShells); } curves_ = _newShells.mulu(1e18); return (curves_, deposits_); } function emergencyProportionalWithdraw(Storage.Curve storage curve, uint256 _withdrawal) external returns (uint256[] memory) { uint256 _length = curve.assets.length; (, int128[] memory _oBals) = getGrossLiquidityAndBalances(curve); uint256[] memory withdrawals_ = new uint256[](_length); int128 _totalShells = curve.totalSupply.divu(1e18); int128 __withdrawal = _withdrawal.divu(1e18); int128 _multiplier = __withdrawal.div(_totalShells); for (uint256 i = 0; i < _length; i++) { withdrawals_[i] = Assimilators.outputNumeraire( curve.assets[i].addr, msg.sender, _oBals[i].mul(_multiplier) ); } burn(curve, msg.sender, _withdrawal); return withdrawals_; } function proportionalWithdraw(Storage.Curve storage curve, uint256 _withdrawal) external returns (uint256[] memory) { uint256 _length = curve.assets.length; (int128 _oGLiq, int128[] memory _oBals) = getGrossLiquidityAndBalances(curve); uint256[] memory withdrawals_ = new uint256[](_length); int128 _totalShells = curve.totalSupply.divu(1e18); int128 __withdrawal = _withdrawal.divu(1e18); int128 _multiplier = __withdrawal.div(_totalShells); for (uint256 i = 0; i < _length; i++) { withdrawals_[i] = Assimilators.outputNumeraire( curve.assets[i].addr, msg.sender, _oBals[i].mul(_multiplier) ); } requireLiquidityInvariant(curve, _totalShells, __withdrawal.neg(), _oGLiq, _oBals); burn(curve, msg.sender, _withdrawal); return withdrawals_; } function viewProportionalWithdraw(Storage.Curve storage curve, uint256 _withdrawal) external view returns (uint256[] memory) { uint256 _length = curve.assets.length; (, int128[] memory _oBals) = getGrossLiquidityAndBalances(curve); uint256[] memory withdrawals_ = new uint256[](_length); int128 _multiplier = _withdrawal.divu(1e18).div(curve.totalSupply.divu(1e18)); for (uint256 i = 0; i < _length; i++) { withdrawals_[i] = Assimilators.viewRawAmount(curve.assets[i].addr, _oBals[i].mul(_multiplier)); } return withdrawals_; } function getGrossLiquidityAndBalancesForDeposit(Storage.Curve storage curve) internal view returns (int128 grossLiquidity_, int128[] memory) { uint256 _length = curve.assets.length; int128[] memory balances_ = new int128[](_length); uint256 _baseWeight = curve.weights[0].mulu(1e18); uint256 _quoteWeight = curve.weights[1].mulu(1e18); for (uint256 i = 0; i < _length; i++) { int128 _bal = Assimilators.viewNumeraireBalanceLPRatio(_baseWeight, _quoteWeight, curve.assets[i].addr); balances_[i] = _bal; grossLiquidity_ += _bal; } return (grossLiquidity_, balances_); } function getGrossLiquidityAndBalances(Storage.Curve storage curve) internal view returns (int128 grossLiquidity_, int128[] memory) { uint256 _length = curve.assets.length; int128[] memory balances_ = new int128[](_length); for (uint256 i = 0; i < _length; i++) { int128 _bal = Assimilators.viewNumeraireBalance(curve.assets[i].addr); balances_[i] = _bal; grossLiquidity_ += _bal; } return (grossLiquidity_, balances_); } function requireLiquidityInvariant( Storage.Curve storage curve, int128 _curves, int128 _newShells, int128 _oGLiq, int128[] memory _oBals ) private view { (int128 _nGLiq, int128[] memory _nBals) = getGrossLiquidityAndBalances(curve); int128 _beta = curve.beta; int128 _delta = curve.delta; int128[] memory _weights = curve.weights; int128 _omega = CurveMath.calculateFee(_oGLiq, _oBals, _beta, _delta, _weights); int128 _psi = CurveMath.calculateFee(_nGLiq, _nBals, _beta, _delta, _weights); CurveMath.enforceLiquidityInvariant(_curves, _newShells, _oGLiq, _nGLiq, _omega, _psi); } function burn( Storage.Curve storage curve, address account, uint256 amount ) private { curve.balances[account] = burnSub(curve.balances[account], amount); curve.totalSupply = burnSub(curve.totalSupply, amount); emit Transfer(msg.sender, address(0), amount); } function mint( Storage.Curve storage curve, address account, uint256 amount ) private { curve.totalSupply = mintAdd(curve.totalSupply, amount); curve.balances[account] = mintAdd(curve.balances[account], amount); emit Transfer(address(0), msg.sender, amount); } function mintAdd(uint256 x, uint256 y) private pure returns (uint256 z) { require((z = x + y) >= x, "Curve/mint-overflow"); } function burnSub(uint256 x, uint256 y) private pure returns (uint256 z) { require((z = x - y) <= x, "Curve/burn-underflow"); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "./SafeMath.sol"; import "./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 SafeMath for uint256; 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' // solhint-disable-next-line max-line-length 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).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @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 // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @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) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @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 sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @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) { // 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 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts 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) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts 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) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts 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 mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) { 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.7.3; import "./IOracle.sol"; import "./Assimilators.sol"; contract Storage { struct Curve { // Curve parameters int128 alpha; int128 beta; int128 delta; int128 epsilon; int128 lambda; int128[] weights; // Assets and their assimilators Assimilator[] assets; mapping(address => Assimilator) assimilators; // Oracles to determine the price // Note that 0'th index should always be USDC 1e18 // Oracle's pricing should be denominated in Currency/USDC mapping(address => IOracle) oracles; // ERC20 Interface uint256 totalSupply; mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowances; } struct Assimilator { address addr; uint8 ix; } // Curve parameters Curve public curve; // Ownable address public owner; string public name; string public symbol; uint8 public constant decimals = 18; address[] public derivatives; address[] public numeraires; address[] public reserves; // Curve operational state bool public frozen = false; bool public emergency = false; bool public whitelistingStage = true; bool internal notEntered = true; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; import "./Assimilators.sol"; import "./Storage.sol"; import "./CurveMath.sol"; import "./UnsafeMath64x64.sol"; import "./ABDKMath64x64.sol"; import "./SafeMath.sol"; library Swaps { using ABDKMath64x64 for int128; using UnsafeMath64x64 for int128; using ABDKMath64x64 for uint256; using SafeMath for uint256; event Trade( address indexed trader, address indexed origin, address indexed target, uint256 originAmount, uint256 targetAmount ); int128 public constant ONE = 0x10000000000000000; function getOriginAndTarget( Storage.Curve storage curve, address _o, address _t ) private view returns (Storage.Assimilator memory, Storage.Assimilator memory) { Storage.Assimilator memory o_ = curve.assimilators[_o]; Storage.Assimilator memory t_ = curve.assimilators[_t]; require(o_.addr != address(0), "Curve/origin-not-supported"); require(t_.addr != address(0), "Curve/target-not-supported"); return (o_, t_); } function originSwap( Storage.Curve storage curve, address _origin, address _target, uint256 _originAmount, address _recipient ) external returns (uint256 tAmt_) { (Storage.Assimilator memory _o, Storage.Assimilator memory _t) = getOriginAndTarget(curve, _origin, _target); if (_o.ix == _t.ix) return Assimilators.outputNumeraire(_t.addr, _recipient, Assimilators.intakeRaw(_o.addr, _originAmount)); (int128 _amt, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals) = getOriginSwapData(curve, _o.ix, _t.ix, _o.addr, _originAmount); _amt = CurveMath.calculateTrade(curve, _oGLiq, _nGLiq, _oBals, _nBals, _amt, _t.ix); _amt = _amt.us_mul(ONE - curve.epsilon); tAmt_ = Assimilators.outputNumeraire(_t.addr, _recipient, _amt); emit Trade(msg.sender, _origin, _target, _originAmount, tAmt_); } function viewOriginSwap( Storage.Curve storage curve, address _origin, address _target, uint256 _originAmount ) external view returns (uint256 tAmt_) { (Storage.Assimilator memory _o, Storage.Assimilator memory _t) = getOriginAndTarget(curve, _origin, _target); if (_o.ix == _t.ix) return Assimilators.viewRawAmount(_t.addr, Assimilators.viewNumeraireAmount(_o.addr, _originAmount)); (int128 _amt, int128 _oGLiq, int128 _nGLiq, int128[] memory _nBals, int128[] memory _oBals) = viewOriginSwapData(curve, _o.ix, _t.ix, _originAmount, _o.addr); _amt = CurveMath.calculateTrade(curve, _oGLiq, _nGLiq, _oBals, _nBals, _amt, _t.ix); _amt = _amt.us_mul(ONE - curve.epsilon); tAmt_ = Assimilators.viewRawAmount(_t.addr, _amt.abs()); } function targetSwap( Storage.Curve storage curve, address _origin, address _target, uint256 _targetAmount, address _recipient ) external returns (uint256 oAmt_) { (Storage.Assimilator memory _o, Storage.Assimilator memory _t) = getOriginAndTarget(curve, _origin, _target); if (_o.ix == _t.ix) return Assimilators.intakeNumeraire(_o.addr, Assimilators.outputRaw(_t.addr, _recipient, _targetAmount)); // If the origin is the quote currency (i.e. usdc) // we need to make sure to massage the _targetAmount // by dividing it by the exchange rate (so it gets // multiplied later to reach the same target amount). // Inelegant solution, but this way we don't need to // re-write large chunks of the code-base // curve.assets[1].addr = quoteCurrency // no variable assignment due to stack too deep if (curve.assets[1].addr == _o.addr) { _targetAmount = _targetAmount.mul(1e8).div(Assimilators.getRate(_t.addr)); } (int128 _amt, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals) = getTargetSwapData(curve, _t.ix, _o.ix, _t.addr, _recipient, _targetAmount); _amt = CurveMath.calculateTrade(curve, _oGLiq, _nGLiq, _oBals, _nBals, _amt, _o.ix); // If the origin is the quote currency (i.e. usdc) // we need to make sure to massage the _amt too // curve.assets[1].addr = quoteCurrency if (curve.assets[1].addr == _o.addr) { _amt = _amt.mul(Assimilators.getRate(_t.addr).divu(1e8)); } _amt = _amt.us_mul(ONE + curve.epsilon); oAmt_ = Assimilators.intakeNumeraire(_o.addr, _amt); emit Trade(msg.sender, _origin, _target, oAmt_, _targetAmount); } function viewTargetSwap( Storage.Curve storage curve, address _origin, address _target, uint256 _targetAmount ) external view returns (uint256 oAmt_) { (Storage.Assimilator memory _o, Storage.Assimilator memory _t) = getOriginAndTarget(curve, _origin, _target); if (_o.ix == _t.ix) return Assimilators.viewRawAmount(_o.addr, Assimilators.viewNumeraireAmount(_t.addr, _targetAmount)); // If the origin is the quote currency (i.e. usdc) // we need to make sure to massage the _targetAmount // by dividing it by the exchange rate (so it gets // multiplied later to reach the same target amount). // Inelegant solution, but this way we don't need to // re-write large chunks of the code-base // curve.assets[1].addr = quoteCurrency // no variable assignment due to stack too deep if (curve.assets[1].addr == _o.addr) { _targetAmount = _targetAmount.mul(1e8).div(Assimilators.getRate(_t.addr)); } (int128 _amt, int128 _oGLiq, int128 _nGLiq, int128[] memory _nBals, int128[] memory _oBals) = viewTargetSwapData(curve, _t.ix, _o.ix, _targetAmount, _t.addr); _amt = CurveMath.calculateTrade(curve, _oGLiq, _nGLiq, _oBals, _nBals, _amt, _o.ix); // If the origin is the quote currency (i.e. usdc) // we need to make sure to massage the _amt too // curve.assets[1].addr = quoteCurrency if (curve.assets[1].addr == _o.addr) { _amt = _amt.mul(Assimilators.getRate(_t.addr).divu(1e8)); } _amt = _amt.us_mul(ONE + curve.epsilon); oAmt_ = Assimilators.viewRawAmount(_o.addr, _amt); } function getOriginSwapData( Storage.Curve storage curve, uint256 _inputIx, uint256 _outputIx, address _assim, uint256 _amt ) private returns ( int128 amt_, int128 oGLiq_, int128 nGLiq_, int128[] memory, int128[] memory ) { uint256 _length = curve.assets.length; int128[] memory oBals_ = new int128[](_length); int128[] memory nBals_ = new int128[](_length); Storage.Assimilator[] memory _reserves = curve.assets; for (uint256 i = 0; i < _length; i++) { if (i != _inputIx) nBals_[i] = oBals_[i] = Assimilators.viewNumeraireBalance(_reserves[i].addr); else { int128 _bal; (amt_, _bal) = Assimilators.intakeRawAndGetBalance(_assim, _amt); oBals_[i] = _bal.sub(amt_); nBals_[i] = _bal; } oGLiq_ += oBals_[i]; nGLiq_ += nBals_[i]; } nGLiq_ = nGLiq_.sub(amt_); nBals_[_outputIx] = ABDKMath64x64.sub(nBals_[_outputIx], amt_); return (amt_, oGLiq_, nGLiq_, oBals_, nBals_); } function getTargetSwapData( Storage.Curve storage curve, uint256 _inputIx, uint256 _outputIx, address _assim, address _recipient, uint256 _amt ) private returns ( int128 amt_, int128 oGLiq_, int128 nGLiq_, int128[] memory, int128[] memory ) { uint256 _length = curve.assets.length; int128[] memory oBals_ = new int128[](_length); int128[] memory nBals_ = new int128[](_length); Storage.Assimilator[] memory _reserves = curve.assets; for (uint256 i = 0; i < _length; i++) { if (i != _inputIx) nBals_[i] = oBals_[i] = Assimilators.viewNumeraireBalance(_reserves[i].addr); else { int128 _bal; (amt_, _bal) = Assimilators.outputRawAndGetBalance(_assim, _recipient, _amt); oBals_[i] = _bal.sub(amt_); nBals_[i] = _bal; } oGLiq_ += oBals_[i]; nGLiq_ += nBals_[i]; } nGLiq_ = nGLiq_.sub(amt_); nBals_[_outputIx] = ABDKMath64x64.sub(nBals_[_outputIx], amt_); return (amt_, oGLiq_, nGLiq_, oBals_, nBals_); } function viewOriginSwapData( Storage.Curve storage curve, uint256 _inputIx, uint256 _outputIx, uint256 _amt, address _assim ) private view returns ( int128 amt_, int128 oGLiq_, int128 nGLiq_, int128[] memory, int128[] memory ) { uint256 _length = curve.assets.length; int128[] memory nBals_ = new int128[](_length); int128[] memory oBals_ = new int128[](_length); for (uint256 i = 0; i < _length; i++) { if (i != _inputIx) nBals_[i] = oBals_[i] = Assimilators.viewNumeraireBalance(curve.assets[i].addr); else { int128 _bal; (amt_, _bal) = Assimilators.viewNumeraireAmountAndBalance(_assim, _amt); oBals_[i] = _bal; nBals_[i] = _bal.add(amt_); } oGLiq_ += oBals_[i]; nGLiq_ += nBals_[i]; } nGLiq_ = nGLiq_.sub(amt_); nBals_[_outputIx] = ABDKMath64x64.sub(nBals_[_outputIx], amt_); return (amt_, oGLiq_, nGLiq_, nBals_, oBals_); } function viewTargetSwapData( Storage.Curve storage curve, uint256 _inputIx, uint256 _outputIx, uint256 _amt, address _assim ) private view returns ( int128 amt_, int128 oGLiq_, int128 nGLiq_, int128[] memory, int128[] memory ) { uint256 _length = curve.assets.length; int128[] memory nBals_ = new int128[](_length); int128[] memory oBals_ = new int128[](_length); for (uint256 i = 0; i < _length; i++) { if (i != _inputIx) nBals_[i] = oBals_[i] = Assimilators.viewNumeraireBalance(curve.assets[i].addr); else { int128 _bal; (amt_, _bal) = Assimilators.viewNumeraireAmountAndBalance(_assim, _amt); amt_ = amt_.neg(); oBals_[i] = _bal; nBals_[i] = _bal.add(amt_); } oGLiq_ += oBals_[i]; nGLiq_ += nBals_[i]; } nGLiq_ = nGLiq_.sub(amt_); nBals_[_outputIx] = ABDKMath64x64.sub(nBals_[_outputIx], amt_); return (amt_, oGLiq_, nGLiq_, nBals_, oBals_); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; library UnsafeMath64x64 { /** * Calculate x * y 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 us_mul (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) * y >> 64; return int128 (result); } /** * 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 us_div (int128 x, int128 y) internal pure returns (int128) { int256 result = (int256 (x) << 64) / y; return int128 (result); } }
// 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.7.3; import "./Storage.sol"; import "./Assimilators.sol"; import "./ABDKMath64x64.sol"; library ViewLiquidity { using ABDKMath64x64 for int128; function viewLiquidity(Storage.Curve storage curve) external view returns (uint256 total_, uint256[] memory individual_) { uint256 _length = curve.assets.length; individual_ = new uint256[](_length); for (uint256 i = 0; i < _length; i++) { uint256 _liquidity = Assimilators.viewNumeraireBalance(curve.assets[i].addr).mulu(1e18); total_ += _liquidity; individual_[i] = _liquidity; } return (total_, individual_); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"uint256[]","name":"_assetWeights","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"numeraire","type":"address"},{"indexed":true,"internalType":"address","name":"reserve","type":"address"},{"indexed":false,"internalType":"uint256","name":"weight","type":"uint256"}],"name":"AssetIncluded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"derivative","type":"address"},{"indexed":true,"internalType":"address","name":"numeraire","type":"address"},{"indexed":true,"internalType":"address","name":"reserve","type":"address"},{"indexed":false,"internalType":"address","name":"assimilator","type":"address"}],"name":"AssimilatorIncluded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isEmergency","type":"bool"}],"name":"EmergencyAlarm","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isFrozen","type":"bool"}],"name":"FrozenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransfered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"alpha","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"beta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"delta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"epsilon","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lambda","type":"uint256"}],"name":"ParametersSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"PartitionRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"originAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"targetAmount","type":"uint256"}],"name":"Trade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"allowance_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"success_","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_derivative","type":"address"}],"name":"assimilator","outputs":[{"internalType":"address","name":"assimilator_","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curve","outputs":[{"internalType":"int128","name":"alpha","type":"int128"},{"internalType":"int128","name":"beta","type":"int128"},{"internalType":"int128","name":"delta","type":"int128"},{"internalType":"int128","name":"epsilon","type":"int128"},{"internalType":"int128","name":"lambda","type":"int128"},{"internalType":"uint256","name":"totalSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deposit","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"derivatives","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergency","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_curvesToBurn","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"emergencyWithdraw","outputs":[{"internalType":"uint256[]","name":"withdrawals_","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_derivative","type":"address"}],"name":"excludeDerivative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"frozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidity","outputs":[{"internalType":"uint256","name":"total_","type":"uint256"},{"internalType":"uint256[]","name":"individual_","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"numeraires","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_origin","type":"address"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_originAmount","type":"uint256"},{"internalType":"uint256","name":"_minTargetAmount","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"originSwap","outputs":[{"internalType":"uint256","name":"targetAmount_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"reserves","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_emergency","type":"bool"}],"name":"setEmergency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_toFreezeOrNotToFreeze","type":"bool"}],"name":"setFrozen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_alpha","type":"uint256"},{"internalType":"uint256","name":"_beta","type":"uint256"},{"internalType":"uint256","name":"_feeAtHalt","type":"uint256"},{"internalType":"uint256","name":"_epsilon","type":"uint256"},{"internalType":"uint256","name":"_lambda","type":"uint256"}],"name":"setParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interface","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"supports_","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_origin","type":"address"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_maxOriginAmount","type":"uint256"},{"internalType":"uint256","name":"_targetAmount","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"targetSwap","outputs":[{"internalType":"uint256","name":"originAmount_","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"totalSupply_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"success_","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"success_","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"viewCurve","outputs":[{"internalType":"uint256","name":"alpha_","type":"uint256"},{"internalType":"uint256","name":"beta_","type":"uint256"},{"internalType":"uint256","name":"delta_","type":"uint256"},{"internalType":"uint256","name":"epsilon_","type":"uint256"},{"internalType":"uint256","name":"lambda_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deposit","type":"uint256"}],"name":"viewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_origin","type":"address"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_originAmount","type":"uint256"}],"name":"viewOriginSwap","outputs":[{"internalType":"uint256","name":"targetAmount_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_origin","type":"address"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"uint256","name":"_targetAmount","type":"uint256"}],"name":"viewTargetSwap","outputs":[{"internalType":"uint256","name":"originAmount_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_curvesToBurn","type":"uint256"}],"name":"viewWithdraw","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistingStage","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_curvesToBurn","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256[]","name":"withdrawals_","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526010805463ff0000001962ffffff1990911662010000171663010000001790553480156200003157600080fd5b506040516200277338038062002773833981810160405260808110156200005757600080fd5b81019080805160405193929190846401000000008211156200007857600080fd5b9083019060208201858111156200008e57600080fd5b8251640100000000811182820188101715620000a957600080fd5b82525081516020918201929091019080838360005b83811015620000d8578181015183820152602001620000be565b50505050905090810190601f168015620001065780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200012a57600080fd5b9083019060208201858111156200014057600080fd5b82516401000000008111828201881017156200015b57600080fd5b82525081516020918201929091019080838360005b838110156200018a57818101518382015260200162000170565b50505050905090810190601f168015620001b85780820380516001836020036101000a031916815260200191505b5060405260200180516040519392919084640100000000821115620001dc57600080fd5b908301906020820185811115620001f257600080fd5b82518660208202830111640100000000821117156200021057600080fd5b82525081516020918201928201910280838360005b838110156200023f57818101518382015260200162000225565b50505050905001604052602001805160405193929190846401000000008211156200026957600080fd5b9083019060208201858111156200027f57600080fd5b82518660208202830111640100000000821117156200029d57600080fd5b82525081516020918201928201910280838360005b83811015620002cc578181015183820152602001620002b2565b50505050919091016040525050600a80546001600160a01b03191633179055505083516200030290600b90602087019062000465565b5082516200031890600c90602086019062000465565b5060405133906000907f0d18b5fd22306e373229b9439188228edca81207d1667f604daf6cef8aa3ee67908290a3732b2bfe80547f50e1a67bbf0d52c24e0683f67b6d63b263dde26000600e600f600d87876040518763ffffffff1660e01b8152600401808781526020018681526020018581526020018481526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015620003d7578181015183820152602001620003bd565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101562000418578181015183820152602001620003fe565b505050509050019850505050505050505060006040518083038186803b1580156200044257600080fd5b505af415801562000457573d6000803e3d6000fd5b505050505050505062000501565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620004a857805160ff1916838001178555620004d8565b82800160010185558215620004d8579182015b82811115620004d8578251825591602001919060010190620004bb565b50620004e6929150620004ea565b5090565b5b80821115620004e65760008155600101620004eb565b61226280620005116000396000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c80637165485d11610125578063a9059cbb116100ad578063d828bb881161007c578063d828bb8814610760578063dd62ed3e14610795578063e2bbb158146107c3578063e5cf8a5c146107e6578063f2fde38b1461080357610211565b8063a9059cbb146106e9578063c0046e3914610715578063c912ff7a14610732578063caa6fea41461075857610211565b8063838e6a22116100f4578063838e6a221461067e5780638da5cb5b146106b457806395d89b41146106bc5780639d1dd428146106c4578063a8e9d528146106cc57610211565b80637165485d146105ba57806372b4129a146106005780637e932d32146106425780638334278d1461066157610211565b80631f276b6e116101a8578063441a3e7011610177578063441a3e70146104eb578063525d0da71461050e578063595520c7146105445780636f2ef95b1461057757806370a082311461059457610211565b80631f276b6e146103e257806323b872dd14610455578063313ce5671461048b5780633cae77f7146104a957610211565b8063095ea7b3116101e4578063095ea7b3146102f75780630b2583c81461032357806318160ddd146103775780631a6865021461037f57610211565b806301ffc9a7146102165780630501d55614610251578063054f7d9c1461027257806306fdde031461027a575b600080fd5b61023d6004803603602081101561022c57600080fd5b50356001600160e01b031916610829565b604080519115158252519081900360200190f35b6102706004803603602081101561026757600080fd5b5035151561087b565b005b61023d610917565b610282610920565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bc5781810151838201526020016102a4565b50505050905090810190601f1680156102e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023d6004803603604081101561030d57600080fd5b506001600160a01b0381351690602001356109ae565b610365600480360360a081101561033957600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060800135610abd565b60408051918252519081900360200190f35b610365610cb8565b610387610cbe565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156103cd5781810151838201526020016103b5565b50505050905001935050505060405180910390f35b610405600480360360408110156103f857600080fd5b5080359060200135610de8565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610441578181015183820152602001610429565b505050509050019250505060405180910390f35b61023d6004803603606081101561046b57600080fd5b506001600160a01b0381358116916020810135909116906040013561100c565b610493611124565b6040805160ff9092168252519081900360200190f35b6104cf600480360360208110156104bf57600080fd5b50356001600160a01b0316611129565b604080516001600160a01b039092168252519081900360200190f35b6104056004803603604081101561050157600080fd5b5080359060200135611147565b6103656004803603606081101561052457600080fd5b506001600160a01b03813581169160208101359091169060400135611241565b61054c61132a565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6103876004803603602081101561058d57600080fd5b50356113d4565b610365600480360360208110156105aa57600080fd5b50356001600160a01b031661154a565b6105c2611565565b60408051600f97880b815295870b602087015293860b8585015291850b606085015290930b608083015260a082019290925290519081900360c00190f35b610365600480360360a081101561061657600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060800135611593565b6102706004803603602081101561065857600080fd5b50351515611771565b6104cf6004803603602081101561067757600080fd5b5035611806565b6103656004803603606081101561069457600080fd5b506001600160a01b0381358116916020810135909116906040013561182d565b6104cf6118e2565b6102826118f1565b61023d61194c565b6104cf600480360360208110156106e257600080fd5b503561195b565b61023d600480360360408110156106ff57600080fd5b506001600160a01b038135169060200135611968565b6104cf6004803603602081101561072b57600080fd5b5035611a31565b6102706004803603602081101561074857600080fd5b50356001600160a01b0316611a3e565b61023d611bba565b610270600480360360a081101561077657600080fd5b5080359060208101359060408101359060608101359060800135611bc8565b610365600480360360408110156107ab57600080fd5b506001600160a01b0381358116916020013516611ca7565b610387600480360360408110156107d957600080fd5b5080359060200135611cd2565b610405600480360360208110156107fc57600080fd5b5035611eff565b6102706004803603602081101561081957600080fd5b50356001600160a01b0316612069565b60006301ffc9a760e01b6001600160e01b03198316148061085a57506307f5828d60e41b6001600160e01b03198316145b8061087557506336372b0760e01b6001600160e01b03198316145b92915050565b600a546001600160a01b031633146108c8576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b60408051821515815290517fa44450e52bea871e50cfee059fbe027c26ff43fd7534c06b7de61d90b58ab3c19181900360200190a1601080549115156101000261ff0019909216919091179055565b60105460ff1681565b600b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109a65780601f1061097b576101008083540402835291602001916109a6565b820191906000526020600020905b81548152906001019060200180831161098957829003601f168201915b505050505081565b6010546000906301000000900460ff16610a02576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163e60ac42960e01b8152600060048201526001600160a01b038516602482015260448101849052905173c706884898f9ffd13c204dc8d9af2a87c647c13b9163e60ac429916064808301926020929190829003018186803b158015610a7757600080fd5b505af4158015610a8b573d6000803e3d6000fd5b505050506040513d6020811015610aa157600080fd5b50516010805463ff000000191663010000001790559392505050565b600081804210610b02576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b60105460ff1615610b445760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6010546301000000900460ff16610b95576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff00000019169055604080516327bacd0160e21b8152600060048201526001600160a01b03808a166024830152881660448201526064810187905233608482015290517317118d149ce6f891aad1d7a66cadaa6837b386ef91639eeb34049160a4808301926020929190829003018186803b158015610c1857600080fd5b505af4158015610c2c573d6000803e3d6000fd5b505050506040513d6020811015610c4257600080fd5b5051915083821015610c9b576040805162461bcd60e51b815260206004820152601d60248201527f43757276652f62656c6f772d6d696e2d7461726765742d616d6f756e74000000604482015290519081900360640190fd5b506010805463ff0000001916630100000017905595945050505050565b60075490565b600060607312310b7726eae2d2438361fd126a25d8381fe891636e8af27260006040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015610d1257600080fd5b505af4158015610d26573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040908152811015610d4f57600080fd5b815160208301805160405192949293830192919084600160201b821115610d7557600080fd5b908301906020820185811115610d8a57600080fd5b82518660208202830111600160201b82111715610da657600080fd5b82525081516020918201928201910280838360005b83811015610dd3578181015183820152602001610dbb565b50505050905001604052505050915091509091565b601054606090610100900460ff16610e315760405162461bcd60e51b815260040180806020018281038252603d815260200180612178603d913960400191505060405180910390fd5b81804210610e74576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b6010546301000000900460ff16610ec5576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff0000001916905560408051636a7173b160e11b815260006004820181905260248201879052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb9263d4e2e7629260448082019391829003018186803b158015610f2957600080fd5b505af4158015610f3d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610f6657600080fd5b8101908080516040519392919084600160201b821115610f8557600080fd5b908301906020820185811115610f9a57600080fd5b82518660208202830111600160201b82111715610fb657600080fd5b82525081516020918201928201910280838360005b83811015610fe3578181015183820152602001610fcb565b505050509050016040525050509150506010805463ff0000001916630100000017905592915050565b6010546000906301000000900460ff16611060576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff00000019169055604080516303a90f6960e31b8152600060048201526001600160a01b0380871660248301528516604482015260648101849052905173c706884898f9ffd13c204dc8d9af2a87c647c13b91631d487b48916084808301926020929190829003018186803b1580156110dd57600080fd5b505af41580156110f1573d6000803e3d6000fd5b505050506040513d602081101561110757600080fd5b50516010805463ff00000019166301000000179055949350505050565b601281565b6001600160a01b039081166000908152600560205260409020541690565b60608180421061118c576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b6010546301000000900460ff166111dd576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163044fd3db60e41b815260006004820181905260248201879052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb926344fd3db09260448082019391829003018186803b158015610f2957600080fd5b60105460009060ff16156112865760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b604080516315be82e960e21b8152600060048201526001600160a01b038087166024830152851660448201526064810184905290517317118d149ce6f891aad1d7a66cadaa6837b386ef916356fa0ba4916084808301926020929190829003018186803b1580156112f657600080fd5b505af415801561130a573d6000803e3d6000fd5b505050506040513d602081101561132057600080fd5b5051949350505050565b6000806000806000732b2bfe80547f50e1a67bbf0d52c24e0683f67b6d63faa50b5d60006040518263ffffffff1660e01b81526004018082815260200191505060a06040518083038186803b15801561138257600080fd5b505af4158015611396573d6000803e3d6000fd5b505050506040513d60a08110156113ac57600080fd5b5080516020820151604083015160608401516080909401519299919850965091945092509050565b60105460009060609060ff161561141c5760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6040805163822f39d560e01b815260006004820181905260248201869052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb9263822f39d59260448082019391829003018186803b15801561147357600080fd5b505af4158015611487573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160409081528110156114b057600080fd5b815160208301805160405192949293830192919084600160201b8211156114d657600080fd5b9083019060208201858111156114eb57600080fd5b82518660208202830111600160201b8211171561150757600080fd5b82525081516020918201928201910280838360005b8381101561153457818101518382015260200161151c565b5050505090500160405250505091509150915091565b6001600160a01b031660009081526008602052604090205490565b600054600154600254600754600f84810b94600160801b90819004820b9480830b94919004820b92910b9086565b6000818042106115d8576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b60105460ff161561161a5760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6010546301000000900460ff1661166b576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163cc3b6a7360e01b8152600060048201526001600160a01b03808a166024830152881660448201526064810186905233608482015290517317118d149ce6f891aad1d7a66cadaa6837b386ef9163cc3b6a739160a4808301926020929190829003018186803b1580156116ee57600080fd5b505af4158015611702573d6000803e3d6000fd5b505050506040513d602081101561171857600080fd5b5051915084821115610c9b576040805162461bcd60e51b815260206004820152601d60248201527f43757276652f61626f76652d6d61782d6f726967696e2d616d6f756e74000000604482015290519081900360640190fd5b600a546001600160a01b031633146117be576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b60408051821515815290517f7c029deaca9b6c66abb68e5f874a812822f0fcaa52a890f980a7ab1afb5edba69181900360200190a16010805460ff1916911515919091179055565b600f818154811061181357fe5b6000918252602090912001546001600160a01b0316905081565b60105460009060ff16156118725760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b60408051637dba2aed60e11b8152600060048201526001600160a01b038087166024830152851660448201526064810184905290517317118d149ce6f891aad1d7a66cadaa6837b386ef9163fb7455da916084808301926020929190829003018186803b1580156112f657600080fd5b600a546001600160a01b031681565b600c805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109a65780601f1061097b576101008083540402835291602001916109a6565b60105462010000900460ff1681565b600e818154811061181357fe5b6010546000906301000000900460ff166119bc576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163a4bcd45960e01b8152600060048201526001600160a01b038516602482015260448101849052905173c706884898f9ffd13c204dc8d9af2a87c647c13b9163a4bcd459916064808301926020929190829003018186803b158015610a7757600080fd5b600d818154811061181357fe5b600a546001600160a01b03163314611a8b576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b60005b600e54811015611b9257600e8181548110611aa557fe5b6000918252602090912001546001600160a01b0383811691161415611b11576040805162461bcd60e51b815260206004820152601d60248201527f43757276652f63616e6e6f742d64656c6574652d6e756d657261697265000000604482015290519081900360640190fd5b600f8181548110611b1e57fe5b6000918252602090912001546001600160a01b0383811691161415611b8a576040805162461bcd60e51b815260206004820152601b60248201527f43757276652f63616e6e6f742d64656c6574652d726573657276650000000000604482015290519081900360640190fd5b600101611a8e565b506001600160a01b0316600090815260056020526040902080546001600160a81b0319169055565b601054610100900460ff1681565b600a546001600160a01b03163314611c15576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b6040805163231888b760e01b81526000600482018190526024820188905260448201879052606482018690526084820185905260a482018490529151732b2bfe80547f50e1a67bbf0d52c24e0683f67b6d9263231888b79260c48082019391829003018186803b158015611c8857600080fd5b505af4158015611c9c573d6000803e3d6000fd5b505050505050505050565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b6000606082804210611d19576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b60105460ff1615611d5b5760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6010546301000000900460ff16611dac576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163445cc62b60e01b815260006004820181905260248201889052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb9263445cc62b9260448082019391829003018186803b158015611e1057600080fd5b505af4158015611e24573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040908152811015611e4d57600080fd5b815160208301805160405192949293830192919084600160201b821115611e7357600080fd5b908301906020820185811115611e8857600080fd5b82518660208202830111600160201b82111715611ea457600080fd5b82525081516020918201928201910280838360005b83811015611ed1578181015183820152602001611eb9565b5050505090500160405250505092509250506010805463ff0000001916630100000017905590939092509050565b60105460609060ff1615611f445760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b604080516330771ac760e11b815260006004820181905260248201859052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb926360ee358e9260448082019391829003018186803b158015611f9b57600080fd5b505af4158015611faf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015611fd857600080fd5b8101908080516040519392919084600160201b821115611ff757600080fd5b90830190602082018581111561200c57600080fd5b82518660208202830111600160201b8211171561202857600080fd5b82525081516020918201928201910280838360005b8381101561205557818101518382015260200161203d565b505050509050016040525050509050919050565b600a546001600160a01b031633146120b6576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b6001600160a01b0381166120fb5760405162461bcd60e51b81526004018080602001828103825260288152602001806121d56028913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f0d18b5fd22306e373229b9439188228edca81207d1667f604daf6cef8aa3ee6790600090a3600a80546001600160a01b0319166001600160a01b039290921691909117905556fe43757276652f74782d646561646c696e652d706173736564000000000000000043757276652f656d657267656e63792d6f6e6c792d616c6c6f77696e672d656d657267656e63792d70726f706f7274696f6e616c2d776974686472617743757276652f63616c6c65722d69732d6e6f742d6f776e65720000000000000043757276652f6e65772d6f776e65722d63616e6e6f742d62652d7a65726f74682d6164647265737343757276652f66726f7a656e2d6f6e6c792d616c6c6f77696e672d70726f706f7274696f6e616c2d7769746864726177a264697066735822122096953aa5f8b7e163e4053dfd7dc4dc9358ed06e9ddee073d8f14cf054a06bbb464736f6c63430007030033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000f6466782d636164632d757364632d610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a6466782d636164632d6100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf57000000000000000000000000e36ded0af2929870977f05a1f017bab6cf8190f80000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf57000000000000000000000000e36ded0af2929870977f05a1f017bab6cf8190f80000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf570000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f022c3e9f8f915fd99c0e307059acd2b908d8e10000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f022c3e9f8f915fd99c0e307059acd2b908d8e10000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000006f05b59d3b2000000000000000000000000000000000000000000000000000006f05b59d3b20000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102115760003560e01c80637165485d11610125578063a9059cbb116100ad578063d828bb881161007c578063d828bb8814610760578063dd62ed3e14610795578063e2bbb158146107c3578063e5cf8a5c146107e6578063f2fde38b1461080357610211565b8063a9059cbb146106e9578063c0046e3914610715578063c912ff7a14610732578063caa6fea41461075857610211565b8063838e6a22116100f4578063838e6a221461067e5780638da5cb5b146106b457806395d89b41146106bc5780639d1dd428146106c4578063a8e9d528146106cc57610211565b80637165485d146105ba57806372b4129a146106005780637e932d32146106425780638334278d1461066157610211565b80631f276b6e116101a8578063441a3e7011610177578063441a3e70146104eb578063525d0da71461050e578063595520c7146105445780636f2ef95b1461057757806370a082311461059457610211565b80631f276b6e146103e257806323b872dd14610455578063313ce5671461048b5780633cae77f7146104a957610211565b8063095ea7b3116101e4578063095ea7b3146102f75780630b2583c81461032357806318160ddd146103775780631a6865021461037f57610211565b806301ffc9a7146102165780630501d55614610251578063054f7d9c1461027257806306fdde031461027a575b600080fd5b61023d6004803603602081101561022c57600080fd5b50356001600160e01b031916610829565b604080519115158252519081900360200190f35b6102706004803603602081101561026757600080fd5b5035151561087b565b005b61023d610917565b610282610920565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102bc5781810151838201526020016102a4565b50505050905090810190601f1680156102e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61023d6004803603604081101561030d57600080fd5b506001600160a01b0381351690602001356109ae565b610365600480360360a081101561033957600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060800135610abd565b60408051918252519081900360200190f35b610365610cb8565b610387610cbe565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156103cd5781810151838201526020016103b5565b50505050905001935050505060405180910390f35b610405600480360360408110156103f857600080fd5b5080359060200135610de8565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610441578181015183820152602001610429565b505050509050019250505060405180910390f35b61023d6004803603606081101561046b57600080fd5b506001600160a01b0381358116916020810135909116906040013561100c565b610493611124565b6040805160ff9092168252519081900360200190f35b6104cf600480360360208110156104bf57600080fd5b50356001600160a01b0316611129565b604080516001600160a01b039092168252519081900360200190f35b6104056004803603604081101561050157600080fd5b5080359060200135611147565b6103656004803603606081101561052457600080fd5b506001600160a01b03813581169160208101359091169060400135611241565b61054c61132a565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6103876004803603602081101561058d57600080fd5b50356113d4565b610365600480360360208110156105aa57600080fd5b50356001600160a01b031661154a565b6105c2611565565b60408051600f97880b815295870b602087015293860b8585015291850b606085015290930b608083015260a082019290925290519081900360c00190f35b610365600480360360a081101561061657600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060800135611593565b6102706004803603602081101561065857600080fd5b50351515611771565b6104cf6004803603602081101561067757600080fd5b5035611806565b6103656004803603606081101561069457600080fd5b506001600160a01b0381358116916020810135909116906040013561182d565b6104cf6118e2565b6102826118f1565b61023d61194c565b6104cf600480360360208110156106e257600080fd5b503561195b565b61023d600480360360408110156106ff57600080fd5b506001600160a01b038135169060200135611968565b6104cf6004803603602081101561072b57600080fd5b5035611a31565b6102706004803603602081101561074857600080fd5b50356001600160a01b0316611a3e565b61023d611bba565b610270600480360360a081101561077657600080fd5b5080359060208101359060408101359060608101359060800135611bc8565b610365600480360360408110156107ab57600080fd5b506001600160a01b0381358116916020013516611ca7565b610387600480360360408110156107d957600080fd5b5080359060200135611cd2565b610405600480360360208110156107fc57600080fd5b5035611eff565b6102706004803603602081101561081957600080fd5b50356001600160a01b0316612069565b60006301ffc9a760e01b6001600160e01b03198316148061085a57506307f5828d60e41b6001600160e01b03198316145b8061087557506336372b0760e01b6001600160e01b03198316145b92915050565b600a546001600160a01b031633146108c8576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b60408051821515815290517fa44450e52bea871e50cfee059fbe027c26ff43fd7534c06b7de61d90b58ab3c19181900360200190a1601080549115156101000261ff0019909216919091179055565b60105460ff1681565b600b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109a65780601f1061097b576101008083540402835291602001916109a6565b820191906000526020600020905b81548152906001019060200180831161098957829003601f168201915b505050505081565b6010546000906301000000900460ff16610a02576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163e60ac42960e01b8152600060048201526001600160a01b038516602482015260448101849052905173c706884898f9ffd13c204dc8d9af2a87c647c13b9163e60ac429916064808301926020929190829003018186803b158015610a7757600080fd5b505af4158015610a8b573d6000803e3d6000fd5b505050506040513d6020811015610aa157600080fd5b50516010805463ff000000191663010000001790559392505050565b600081804210610b02576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b60105460ff1615610b445760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6010546301000000900460ff16610b95576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff00000019169055604080516327bacd0160e21b8152600060048201526001600160a01b03808a166024830152881660448201526064810187905233608482015290517317118d149ce6f891aad1d7a66cadaa6837b386ef91639eeb34049160a4808301926020929190829003018186803b158015610c1857600080fd5b505af4158015610c2c573d6000803e3d6000fd5b505050506040513d6020811015610c4257600080fd5b5051915083821015610c9b576040805162461bcd60e51b815260206004820152601d60248201527f43757276652f62656c6f772d6d696e2d7461726765742d616d6f756e74000000604482015290519081900360640190fd5b506010805463ff0000001916630100000017905595945050505050565b60075490565b600060607312310b7726eae2d2438361fd126a25d8381fe891636e8af27260006040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b158015610d1257600080fd5b505af4158015610d26573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040908152811015610d4f57600080fd5b815160208301805160405192949293830192919084600160201b821115610d7557600080fd5b908301906020820185811115610d8a57600080fd5b82518660208202830111600160201b82111715610da657600080fd5b82525081516020918201928201910280838360005b83811015610dd3578181015183820152602001610dbb565b50505050905001604052505050915091509091565b601054606090610100900460ff16610e315760405162461bcd60e51b815260040180806020018281038252603d815260200180612178603d913960400191505060405180910390fd5b81804210610e74576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b6010546301000000900460ff16610ec5576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff0000001916905560408051636a7173b160e11b815260006004820181905260248201879052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb9263d4e2e7629260448082019391829003018186803b158015610f2957600080fd5b505af4158015610f3d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610f6657600080fd5b8101908080516040519392919084600160201b821115610f8557600080fd5b908301906020820185811115610f9a57600080fd5b82518660208202830111600160201b82111715610fb657600080fd5b82525081516020918201928201910280838360005b83811015610fe3578181015183820152602001610fcb565b505050509050016040525050509150506010805463ff0000001916630100000017905592915050565b6010546000906301000000900460ff16611060576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff00000019169055604080516303a90f6960e31b8152600060048201526001600160a01b0380871660248301528516604482015260648101849052905173c706884898f9ffd13c204dc8d9af2a87c647c13b91631d487b48916084808301926020929190829003018186803b1580156110dd57600080fd5b505af41580156110f1573d6000803e3d6000fd5b505050506040513d602081101561110757600080fd5b50516010805463ff00000019166301000000179055949350505050565b601281565b6001600160a01b039081166000908152600560205260409020541690565b60608180421061118c576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b6010546301000000900460ff166111dd576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163044fd3db60e41b815260006004820181905260248201879052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb926344fd3db09260448082019391829003018186803b158015610f2957600080fd5b60105460009060ff16156112865760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b604080516315be82e960e21b8152600060048201526001600160a01b038087166024830152851660448201526064810184905290517317118d149ce6f891aad1d7a66cadaa6837b386ef916356fa0ba4916084808301926020929190829003018186803b1580156112f657600080fd5b505af415801561130a573d6000803e3d6000fd5b505050506040513d602081101561132057600080fd5b5051949350505050565b6000806000806000732b2bfe80547f50e1a67bbf0d52c24e0683f67b6d63faa50b5d60006040518263ffffffff1660e01b81526004018082815260200191505060a06040518083038186803b15801561138257600080fd5b505af4158015611396573d6000803e3d6000fd5b505050506040513d60a08110156113ac57600080fd5b5080516020820151604083015160608401516080909401519299919850965091945092509050565b60105460009060609060ff161561141c5760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6040805163822f39d560e01b815260006004820181905260248201869052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb9263822f39d59260448082019391829003018186803b15801561147357600080fd5b505af4158015611487573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160409081528110156114b057600080fd5b815160208301805160405192949293830192919084600160201b8211156114d657600080fd5b9083019060208201858111156114eb57600080fd5b82518660208202830111600160201b8211171561150757600080fd5b82525081516020918201928201910280838360005b8381101561153457818101518382015260200161151c565b5050505090500160405250505091509150915091565b6001600160a01b031660009081526008602052604090205490565b600054600154600254600754600f84810b94600160801b90819004820b9480830b94919004820b92910b9086565b6000818042106115d8576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b60105460ff161561161a5760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6010546301000000900460ff1661166b576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163cc3b6a7360e01b8152600060048201526001600160a01b03808a166024830152881660448201526064810186905233608482015290517317118d149ce6f891aad1d7a66cadaa6837b386ef9163cc3b6a739160a4808301926020929190829003018186803b1580156116ee57600080fd5b505af4158015611702573d6000803e3d6000fd5b505050506040513d602081101561171857600080fd5b5051915084821115610c9b576040805162461bcd60e51b815260206004820152601d60248201527f43757276652f61626f76652d6d61782d6f726967696e2d616d6f756e74000000604482015290519081900360640190fd5b600a546001600160a01b031633146117be576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b60408051821515815290517f7c029deaca9b6c66abb68e5f874a812822f0fcaa52a890f980a7ab1afb5edba69181900360200190a16010805460ff1916911515919091179055565b600f818154811061181357fe5b6000918252602090912001546001600160a01b0316905081565b60105460009060ff16156118725760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b60408051637dba2aed60e11b8152600060048201526001600160a01b038087166024830152851660448201526064810184905290517317118d149ce6f891aad1d7a66cadaa6837b386ef9163fb7455da916084808301926020929190829003018186803b1580156112f657600080fd5b600a546001600160a01b031681565b600c805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109a65780601f1061097b576101008083540402835291602001916109a6565b60105462010000900460ff1681565b600e818154811061181357fe5b6010546000906301000000900460ff166119bc576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163a4bcd45960e01b8152600060048201526001600160a01b038516602482015260448101849052905173c706884898f9ffd13c204dc8d9af2a87c647c13b9163a4bcd459916064808301926020929190829003018186803b158015610a7757600080fd5b600d818154811061181357fe5b600a546001600160a01b03163314611a8b576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b60005b600e54811015611b9257600e8181548110611aa557fe5b6000918252602090912001546001600160a01b0383811691161415611b11576040805162461bcd60e51b815260206004820152601d60248201527f43757276652f63616e6e6f742d64656c6574652d6e756d657261697265000000604482015290519081900360640190fd5b600f8181548110611b1e57fe5b6000918252602090912001546001600160a01b0383811691161415611b8a576040805162461bcd60e51b815260206004820152601b60248201527f43757276652f63616e6e6f742d64656c6574652d726573657276650000000000604482015290519081900360640190fd5b600101611a8e565b506001600160a01b0316600090815260056020526040902080546001600160a81b0319169055565b601054610100900460ff1681565b600a546001600160a01b03163314611c15576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b6040805163231888b760e01b81526000600482018190526024820188905260448201879052606482018690526084820185905260a482018490529151732b2bfe80547f50e1a67bbf0d52c24e0683f67b6d9263231888b79260c48082019391829003018186803b158015611c8857600080fd5b505af4158015611c9c573d6000803e3d6000fd5b505050505050505050565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b6000606082804210611d19576040805162461bcd60e51b81526020600482015260186024820152600080516020612158833981519152604482015290519081900360640190fd5b60105460ff1615611d5b5760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b6010546301000000900460ff16611dac576040805162461bcd60e51b815260206004820152601060248201526f10dd5c9d994bdc994b595b9d195c995960821b604482015290519081900360640190fd5b6010805463ff000000191690556040805163445cc62b60e01b815260006004820181905260248201889052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb9263445cc62b9260448082019391829003018186803b158015611e1057600080fd5b505af4158015611e24573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040908152811015611e4d57600080fd5b815160208301805160405192949293830192919084600160201b821115611e7357600080fd5b908301906020820185811115611e8857600080fd5b82518660208202830111600160201b82111715611ea457600080fd5b82525081516020918201928201910280838360005b83811015611ed1578181015183820152602001611eb9565b5050505090500160405250505092509250506010805463ff0000001916630100000017905590939092509050565b60105460609060ff1615611f445760405162461bcd60e51b81526004018080602001828103825260308152602001806121fd6030913960400191505060405180910390fd5b604080516330771ac760e11b815260006004820181905260248201859052915173e553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbb926360ee358e9260448082019391829003018186803b158015611f9b57600080fd5b505af4158015611faf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015611fd857600080fd5b8101908080516040519392919084600160201b821115611ff757600080fd5b90830190602082018581111561200c57600080fd5b82518660208202830111600160201b8211171561202857600080fd5b82525081516020918201928201910280838360005b8381101561205557818101518382015260200161203d565b505050509050016040525050509050919050565b600a546001600160a01b031633146120b6576040805162461bcd60e51b815260206004820152601960248201526000805160206121b5833981519152604482015290519081900360640190fd5b6001600160a01b0381166120fb5760405162461bcd60e51b81526004018080602001828103825260288152602001806121d56028913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f0d18b5fd22306e373229b9439188228edca81207d1667f604daf6cef8aa3ee6790600090a3600a80546001600160a01b0319166001600160a01b039290921691909117905556fe43757276652f74782d646561646c696e652d706173736564000000000000000043757276652f656d657267656e63792d6f6e6c792d616c6c6f77696e672d656d657267656e63792d70726f706f7274696f6e616c2d776974686472617743757276652f63616c6c65722d69732d6e6f742d6f776e65720000000000000043757276652f6e65772d6f776e65722d63616e6e6f742d62652d7a65726f74682d6164647265737343757276652f66726f7a656e2d6f6e6c792d616c6c6f77696e672d70726f706f7274696f6e616c2d7769746864726177a264697066735822122096953aa5f8b7e163e4053dfd7dc4dc9358ed06e9ddee073d8f14cf054a06bbb464736f6c63430007030033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000f6466782d636164632d757364632d610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a6466782d636164632d6100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf57000000000000000000000000e36ded0af2929870977f05a1f017bab6cf8190f80000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf57000000000000000000000000e36ded0af2929870977f05a1f017bab6cf8190f80000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf570000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f022c3e9f8f915fd99c0e307059acd2b908d8e10000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f022c3e9f8f915fd99c0e307059acd2b908d8e10000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000006f05b59d3b2000000000000000000000000000000000000000000000000000006f05b59d3b20000
-----Decoded View---------------
Arg [0] : _name (string): dfx-cadc-usdc-a
Arg [1] : _symbol (string): dfx-cadc-a
Arg [2] : _assets (address[]): 0x5d146d8B1dACb1EBBA5cb005ae1059DA8a1FbF57,0xe36DeD0aF2929870977F05A1f017BAB6CF8190f8,0x5d146d8B1dACb1EBBA5cb005ae1059DA8a1FbF57,0xe36DeD0aF2929870977F05A1f017BAB6CF8190f8,0x5d146d8B1dACb1EBBA5cb005ae1059DA8a1FbF57,0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174,0x8F022C3e9f8F915Fd99c0E307059acD2B908D8E1,0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174,0x8F022C3e9f8F915Fd99c0E307059acD2B908D8E1,0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
Arg [3] : _assetWeights (uint256[]): 500000000000000000,500000000000000000
-----Encoded View---------------
22 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [5] : 6466782d636164632d757364632d610000000000000000000000000000000000
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [7] : 6466782d636164632d6100000000000000000000000000000000000000000000
Arg [8] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [9] : 0000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf57
Arg [10] : 000000000000000000000000e36ded0af2929870977f05a1f017bab6cf8190f8
Arg [11] : 0000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf57
Arg [12] : 000000000000000000000000e36ded0af2929870977f05a1f017bab6cf8190f8
Arg [13] : 0000000000000000000000005d146d8b1dacb1ebba5cb005ae1059da8a1fbf57
Arg [14] : 0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
Arg [15] : 0000000000000000000000008f022c3e9f8f915fd99c0e307059acd2b908d8e1
Arg [16] : 0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
Arg [17] : 0000000000000000000000008f022c3e9f8f915fd99c0e307059acd2b908d8e1
Arg [18] : 0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [20] : 00000000000000000000000000000000000000000000000006f05b59d3b20000
Arg [21] : 00000000000000000000000000000000000000000000000006f05b59d3b20000
Library Used
Curves : 0xc706884898f9ffd13c204dc8d9af2a87c647c13bUnverifiedOrchestrator : 0x2b2bfe80547f50e1a67bbf0d52c24e0683f67b6dUnverifiedProportionalLiquidity : 0xe553c6c9e3c8bf66f396a3bfe88e4ff4c8ef2fbbUnverifiedSwaps : 0x17118d149ce6f891aad1d7a66cadaa6837b386efUnverifiedViewLiquidity : 0x12310b7726eae2d2438361fd126a25d8381fe891Unverified
Deployed Bytecode Sourcemap
6668:14127:4:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17443:294;;;;;;;;;;;;;;;;-1:-1:-1;17443:294:4;-1:-1:-1;;;;;;17443:294:4;;:::i;:::-;;;;;;;;;;;;;;;;;;10587:139;;;;;;;;;;;;;;;;-1:-1:-1;10587:139:4;;;;:::i;:::-;;1863:26:17;;;:::i;1641:18::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18988:164:4;;;;;;;;;;;;;;;;-1:-1:-1;18988:164:4;;-1:-1:-1;;;;;18988:164:4;;;;;;:::i;11605:442::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;11605:442:4;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;19605:115;;;:::i;20373:146::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15932:304;;;;;;;;;;;;;;;;-1:-1:-1;15932:304:4;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18486:234;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;18486:234:4;;;;;;;;;;;;;;;;;:::i;1691:35:17:-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;20640:153:4;;;;;;;;;;;;;;;;-1:-1:-1;20640:153:4;-1:-1:-1;;;;;20640:153:4;;:::i;:::-;;;;-1:-1:-1;;;;;20640:153:4;;;;;;;;;;;;;;16648:266;;;;;;;;;;;;;;;;-1:-1:-1;16648:266:4;;;;;;;:::i;13861:263::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;13861:263:4;;;;;;;;;;;;;;;;;:::i;10304:277::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15258:230;;;;;;;;;;;;;;;;-1:-1:-1;15258:230:4;;:::i;19352:128::-;;;;;;;;;;;;;;;;-1:-1:-1;19352:128:4;-1:-1:-1;;;;;19352:128:4;;:::i;1574:18:17:-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13097:442:4;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;13097:442:4;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;10732:164::-;;;;;;;;;;;;;;;;-1:-1:-1;10732:164:4;;;;:::i;1800:25:17:-;;;;;;;;;;;;;;;;-1:-1:-1;1800:25:17;;:::i;12377:263:4:-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;12377:263:4;;;;;;;;;;;;;;;;;:::i;1614:20:17:-;;;:::i;1665:::-;;;:::i;1930:36::-;;;:::i;1767:27::-;;;;;;;;;;;;;;;;-1:-1:-1;1767:27:17;;:::i;17966:170:4:-;;;;;;;;;;;;;;;;-1:-1:-1;17966:170:4;;-1:-1:-1;;;;;17966:170:4;;;;;;:::i;1733:28:17:-;;;;;;;;;;;;;;;;-1:-1:-1;1733:28:17;;:::i;9629:361:4:-;;;;;;;;;;;;;;;;-1:-1:-1;9629:361:4;-1:-1:-1;;;;;9629:361:4;;:::i;1895:29:17:-;;;:::i;9237:262:4:-;;;;;;;;;;;;;;;;-1:-1:-1;9237:262:4;;;;;;;;;;;;;;;;;;;;;;:::i;19985:158::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;19985:158:4;;;;;;;;;;:::i;14538:310::-;;;;;;;;;;;;;;;;-1:-1:-1;14538:310:4;;;;;;;:::i;17246:191::-;;;;;;;;;;;;;;;;-1:-1:-1;17246:191:4;;:::i;10902:239::-;;;;;;;;;;;;;;;;-1:-1:-1;10902:239:4;-1:-1:-1;;;;;10902:239:4;;:::i;17443:294::-;17510:14;-1:-1:-1;;;;;;17560:45:4;;-1:-1:-1;;;17560:45:4;;:103;;-1:-1:-1;;;;;;;17631:32:4;;-1:-1:-1;;;17631:32:4;17560:103;:161;;;-1:-1:-1;;;;;;;17689:32:4;;-1:-1:-1;;;17689:32:4;17560:161;17536:185;17443:294;-1:-1:-1;;17443:294:4:o;10587:139::-;7762:5;;-1:-1:-1;;;;;7762:5:4;7748:10;:19;7740:57;;;;;-1:-1:-1;;;7740:57:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;7740:57:4;;;;;;;;;;;;;;;10660:26:::1;::::0;;;::::1;;::::0;;;;::::1;::::0;;;;::::1;::::0;;::::1;10697:9;:22:::0;;;::::1;;;;-1:-1:-1::0;;10697:22:4;;::::1;::::0;;;::::1;::::0;;10587:139::o;1863:26:17:-;;;;;;:::o;1641:18::-;;;;;;;;;;;;;;;-1:-1:-1;;1641:18:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;18988:164:4:-;7863:10;;19069:13;;7863:10;;;;;7855:39;;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;;;7904:10;:18;;-1:-1:-1;;7904:18:4;;;19105:40:::1;::::0;;-1:-1:-1;;;19105:40:4;;-1:-1:-1;19105:40:4::1;::::0;::::1;::::0;-1:-1:-1;;;;;19105:40:4;::::1;::::0;;;;;;;;;;;;:6:::1;::::0;-1:-1:-1;;19105:40:4;;;;;::::1;::::0;;;;;;;;:6;:40;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;19105:40:4;7943:10;:17;;-1:-1:-1;;7943:17:4;;;;;19105:40;18988:164;-1:-1:-1;;;18988:164:4:o;11605:442::-;11837:21;11791:9;8312;8294:15;:27;8286:64;;;;;-1:-1:-1;;;8286:64:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;8286:64:4;;;;;;;;;;;;;;;8016:6:::1;::::0;::::1;;8015:7;8007:68;;;;-1:-1:-1::0;;;8007:68:4::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7863:10:::2;::::0;;;::::2;;;7855:39;;;::::0;;-1:-1:-1;;;7855:39:4;;::::2;;::::0;::::2;::::0;::::2;::::0;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;::::2;;7904:10;:18:::0;;-1:-1:-1;;7904:18:4::2;::::0;;11886:68:::3;::::0;;-1:-1:-1;;;11886:68:4;;-1:-1:-1;11886:68:4::3;::::0;::::3;::::0;-1:-1:-1;;;;;11886:68:4;;::::3;::::0;;;;;::::3;::::0;;;;;;;;;;11943:10:::3;11886:68:::0;;;;;;:5:::3;::::0;:16:::3;::::0;:68;;;;;::::3;::::0;;;;;;;;:5;:68;::::3;;::::0;::::3;;;;::::0;::::3;;;;;;;;;;;;::::0;::::3;;;;;;;;;;;;;;;;;;;::::0;::::3;;-1:-1:-1::0;11886:68:4;;-1:-1:-1;11973:33:4;;::::3;;11965:75;;;::::0;;-1:-1:-1;;;11965:75:4;;::::3;;::::0;::::3;::::0;::::3;::::0;;;;::::3;::::0;;;;;;;;;;;;;::::3;;-1:-1:-1::0;7943:10:4::2;:17:::0;;-1:-1:-1;;7943:17:4::2;::::0;::::2;::::0;;11605:442;;-1:-1:-1;;;;;11605:442:4:o;19605:115::-;19696:17;;;19605:115::o;20373:146::-;20415:14;20431:28;20478:13;:27;20506:5;20478:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;20478:34:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;20478:34:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;20478:34:4;;;;;;;;-1:-1:-1;20478:34:4;;;;;;;;;;-1:-1:-1;20478:34:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;20471:41;;;;20373:146;;:::o;15932:304::-;8140:9;;16104:29;;8140:9;;;;;8132:83;;;;-1:-1:-1;;;8132:83:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;16055:9:::1;8312;8294:15;:27;8286:64;;;::::0;;-1:-1:-1;;;8286:64:4;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;;;;;;;;;8286:64:4;;;;;;;;;;;;;::::1;;7863:10:::2;::::0;;;::::2;;;7855:39;;;::::0;;-1:-1:-1;;;7855:39:4;;::::2;;::::0;::::2;::::0;::::2;::::0;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;::::2;;7904:10;:18:::0;;-1:-1:-1;;7904:18:4::2;::::0;;16156:73:::3;::::0;;-1:-1:-1;;;16156:73:4;;-1:-1:-1;16156:73:4::3;::::0;::::3;::::0;;;;;;;;;;;:21:::3;::::0;:51:::3;::::0;:73;;;;;;;;;;;:21;:73;::::3;;::::0;::::3;;;;::::0;::::3;;;;;;;;;;;;::::0;::::3;;;;;;;;;;;;;;;;;::::0;;::::3;-1:-1:-1::0;;16156:73:4::3;::::0;::::3;;::::0;::::3;::::0;::::3;;;;;::::0;::::3;;::::0;;::::3;::::0;;;;::::3;::::0;;;;;-1:-1:-1;;;16156:73:4;::::3;;;;;::::0;::::3;;::::0;;::::3;::::0;::::3;::::0;::::3;::::0;;::::3;;;;;::::0;::::3;;::::0;;-1:-1:-1;;;16156:73:4;::::3;;::::0;::::3;::::0;::::3;::::0;-1:-1:-1;16156:73:4::3;;;;;::::0;::::3;;::::0;;-1:-1:-1;16156:73:4;;::::3;::::0;;::::3;::::0;;::::3;::::0;::::3;::::0;;;::::3;;;;;;;;::::0;;::::3;::::0;;;::::3;::::0;::::3;;;;;;;;;;;;;;::::0;::::3;;16149:80;;-1:-1:-1::0;7943:10:4::2;:17:::0;;-1:-1:-1;;7943:17:4::2;::::0;::::2;::::0;;15932:304;;-1:-1:-1;;15932:304:4:o;18486:234::-;7863:10;;18621:13;;7863:10;;;;;7855:39;;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;;;7904:10;:18;;-1:-1:-1;;7904:18:4;;;18657:56:::1;::::0;;-1:-1:-1;;;18657:56:4;;-1:-1:-1;18657:56:4::1;::::0;::::1;::::0;-1:-1:-1;;;;;18657:56:4;;::::1;::::0;;;;;::::1;::::0;;;;;;;;;;;;:6:::1;::::0;:19:::1;::::0;:56;;;;;::::1;::::0;;;;;;;;:6;:56;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;18657:56:4;7943:10;:17;;-1:-1:-1;;7943:17:4;;;;;18657:56;18486:234;-1:-1:-1;;;;18486:234:4:o;1691:35:17:-;1724:2;1691:35;:::o;20640:153:4:-;-1:-1:-1;;;;;20750:31:4;;;20703:20;20750:31;;;:18;:31;;;;;:36;;;20640:153::o;16648:266::-;16791:29;16742:9;8312;8294:15;:27;8286:64;;;;;-1:-1:-1;;;8286:64:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;8286:64:4;;;;;;;;;;;;;;;7863:10:::1;::::0;;;::::1;;;7855:39;;;::::0;;-1:-1:-1;;;7855:39:4;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;::::1;;7904:10;:18:::0;;-1:-1:-1;;7904:18:4::1;::::0;;16843:64:::2;::::0;;-1:-1:-1;;;16843:64:4;;-1:-1:-1;16843:64:4::2;::::0;::::2;::::0;;;;;;;;;;;:21:::2;::::0;:42:::2;::::0;:64;;;;;;;;;;;:21;:64;::::2;;::::0;::::2;;;;::::0;::::2;13861:263:::0;8016:6;;14008:21;;8016:6;;8015:7;8007:68;;;;-1:-1:-1;;;8007:68:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14057:60:::1;::::0;;-1:-1:-1;;;14057:60:4;;14078:5:::1;14057:60;::::0;::::1;::::0;-1:-1:-1;;;;;14057:60:4;;::::1;::::0;;;;;::::1;::::0;;;;;;;;;;;;:5:::1;::::0;:20:::1;::::0;:60;;;;;::::1;::::0;;;;;;;;:5;:60;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;14057:60:4;;13861:263;-1:-1:-1;;;;13861:263:4:o;10304:277::-;10385:14;10413:13;10440:14;10468:16;10498:15;10545:12;:22;10568:5;10545:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10545:29:4;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10545:29:4;-1:-1:-1;10545:29:4;;-1:-1:-1;10545:29:4;-1:-1:-1;10304:277:4;-1:-1:-1;10304:277:4:o;15258:230::-;8016:6;;15333:7;;15342:16;;8016:6;;8015:7;8007:68;;;;-1:-1:-1;;;8007:68:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15419:62:::1;::::0;;-1:-1:-1;;;15419:62:4;;15465:5:::1;15419:62;::::0;::::1;::::0;;;;;;;;;;;:21:::1;::::0;-1:-1:-1;;15419:62:4;;;;;;;;;;;:21;:62;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;::::0;;::::1;-1:-1:-1::0;;15419:62:4::1;::::0;::::1;;::::0;;;;::::1;;;;;::::0;::::1;;::::0;;::::1;::::0;::::1;::::0;;::::1;::::0;;;;;;::::1;::::0;;;;-1:-1:-1;;;15419:62:4;::::1;;;;;::::0;::::1;;::::0;;::::1;::::0;::::1;::::0;::::1;::::0;;::::1;;;;;::::0;::::1;;::::0;;-1:-1:-1;;;15419:62:4;::::1;;::::0;::::1;::::0;::::1;::::0;-1:-1:-1;15419:62:4::1;;;;;::::0;::::1;;::::0;;-1:-1:-1;15419:62:4;;::::1;::::0;;::::1;::::0;;::::1;::::0;::::1;::::0;;;::::1;;;;;;;;::::0;;::::1;::::0;;;::::1;::::0;::::1;;;;;;;;;;;;;;::::0;::::1;;15412:69;;;;15258:230:::0;;;:::o;19352:128::-;-1:-1:-1;;;;;19449:24:4;19410:16;19449:24;;;:14;:24;;;;;;;19352:128::o;1574:18:17:-;;;;;;;;;;;;;;-1:-1:-1;;;1574:18:17;;;;;;;;;;;;;;;;;;;;;:::o;13097:442:4:-;13329:21;13283:9;8312;8294:15;:27;8286:64;;;;;-1:-1:-1;;;8286:64:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;8286:64:4;;;;;;;;;;;;;;;8016:6:::1;::::0;::::1;;8015:7;8007:68;;;;-1:-1:-1::0;;;8007:68:4::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7863:10:::2;::::0;;;::::2;;;7855:39;;;::::0;;-1:-1:-1;;;7855:39:4;;::::2;;::::0;::::2;::::0;::::2;::::0;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;::::2;;7904:10;:18:::0;;-1:-1:-1;;7904:18:4::2;::::0;;13378:68:::3;::::0;;-1:-1:-1;;;13378:68:4;;-1:-1:-1;13378:68:4::3;::::0;::::3;::::0;-1:-1:-1;;;;;13378:68:4;;::::3;::::0;;;;;::::3;::::0;;;;;;;;;;13435:10:::3;13378:68:::0;;;;;;:5:::3;::::0;-1:-1:-1;;13378:68:4;;;;;::::3;::::0;;;;;;;;:5;:68;::::3;;::::0;::::3;;;;::::0;::::3;;;;;;;;;;;;::::0;::::3;;;;;;;;;;;;;;;;;;;::::0;::::3;;-1:-1:-1::0;13378:68:4;;-1:-1:-1;13465:33:4;;::::3;;13457:75;;;::::0;;-1:-1:-1;;;13457:75:4;;::::3;;::::0;::::3;::::0;::::3;::::0;;;;::::3;::::0;;;;;;;;;;;;;::::3;10732:164:::0;7762:5;;-1:-1:-1;;;;;7762:5:4;7748:10;:19;7740:57;;;;;-1:-1:-1;;;7740:57:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;7740:57:4;;;;;;;;;;;;;;;10814:33:::1;::::0;;;::::1;;::::0;;;;::::1;::::0;;;;::::1;::::0;;::::1;10858:6;:31:::0;;-1:-1:-1;;10858:31:4::1;::::0;::::1;;::::0;;;::::1;::::0;;10732:164::o;1800:25:17:-;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1800:25:17;;-1:-1:-1;1800:25:17;:::o;12377:263:4:-;8016:6;;12524:21;;8016:6;;8015:7;8007:68;;;;-1:-1:-1;;;8007:68:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12573:60:::1;::::0;;-1:-1:-1;;;12573:60:4;;12594:5:::1;12573:60;::::0;::::1;::::0;-1:-1:-1;;;;;12573:60:4;;::::1;::::0;;;;;::::1;::::0;;;;;;;;;;;;:5:::1;::::0;:20:::1;::::0;:60;;;;;::::1;::::0;;;;;;;;:5;:60;::::1;;::::0;::::1;;;;::::0;::::1;1614:20:17::0;;;-1:-1:-1;;;;;1614:20:17;;:::o;1665:::-;;;;;;;;;;;;;;;-1:-1:-1;;1665:20:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1930:36;;;;;;;;;:::o;1767:27::-;;;;;;;;;;17966:170:4;7863:10;;18050:13;;7863:10;;;;;7855:39;;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;;;7904:10;:18;;-1:-1:-1;;7904:18:4;;;18086:43:::1;::::0;;-1:-1:-1;;;18086:43:4;;-1:-1:-1;18086:43:4::1;::::0;::::1;::::0;-1:-1:-1;;;;;18086:43:4;::::1;::::0;;;;;;;;;;;;:6:::1;::::0;-1:-1:-1;;18086:43:4;;;;;::::1;::::0;;;;;;;;:6;:43;::::1;;::::0;::::1;;;;::::0;::::1;1733:28:17::0;;;;;;;;;;9629:361:4;7762:5;;-1:-1:-1;;;;;7762:5:4;7748:10;:19;7740:57;;;;;-1:-1:-1;;;7740:57:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;7740:57:4;;;;;;;;;;;;;;;9711:9:::1;9706:229;9730:10;:17:::0;9726:21;::::1;9706:229;;;9787:10;9798:1;9787:13;;;;;;;;;::::0;;;::::1;::::0;;;::::1;::::0;-1:-1:-1;;;;;9772:28:4;;::::1;9787:13:::0;::::1;9772:28;9768:73;;;9802:39;::::0;;-1:-1:-1;;;9802:39:4;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;::::1;::::0;;;;;;;;;;;;;::::1;9768:73;9874:8;9883:1;9874:11;;;;;;;;;::::0;;;::::1;::::0;;;::::1;::::0;-1:-1:-1;;;;;9859:26:4;;::::1;9874:11:::0;::::1;9859:26;9855:69;;;9887:37;::::0;;-1:-1:-1;;;9887:37:4;;::::1;;::::0;::::1;::::0;::::1;::::0;;;;::::1;::::0;;;;;;;;;;;;;::::1;9855:69;9749:3;;9706:229;;;-1:-1:-1::0;;;;;;9952:31:4::1;:5;:31:::0;;;:18:::1;:31;::::0;;;;9945:38;;-1:-1:-1;;;;;;9945:38:4;;;9629:361::o;1895:29:17:-;;;;;;;;;:::o;9237:262:4:-;7762:5;;-1:-1:-1;;;;;7762:5:4;7748:10;:19;7740:57;;;;;-1:-1:-1;;;7740:57:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;7740:57:4;;;;;;;;;;;;;;;9417:75:::1;::::0;;-1:-1:-1;;;9417:75:4;;9440:5:::1;9417:75;::::0;::::1;::::0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:12:::1;::::0;-1:-1:-1;;9417:75:4;;;;;;;;;;;:12;:75;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;9237:262:::0;;;;;:::o;19985:158::-;-1:-1:-1;;;;;20102:24:4;;;20059:18;20102:24;;;:16;:24;;;;;;;;:34;;;;;;;;;;;;;19985:158::o;14538:310::-;14696:7;14705:16;14626:9;8312;8294:15;:27;8286:64;;;;;-1:-1:-1;;;8286:64:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;8286:64:4;;;;;;;;;;;;;;;8016:6:::1;::::0;::::1;;8015:7;8007:68;;;;-1:-1:-1::0;;;8007:68:4::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7863:10:::2;::::0;;;::::2;;;7855:39;;;::::0;;-1:-1:-1;;;7855:39:4;;::::2;;::::0;::::2;::::0;::::2;::::0;;;;-1:-1:-1;;;7855:39:4;;;;;;;;;;;;;::::2;;7904:10;:18:::0;;-1:-1:-1;;7904:18:4::2;::::0;;14783:58:::3;::::0;;-1:-1:-1;;;14783:58:4;;-1:-1:-1;14783:58:4::3;::::0;::::3;::::0;;;;;;;;;;;:21:::3;::::0;-1:-1:-1;;14783:58:4;;;;;;;;;;;:21;:58;::::3;;::::0;::::3;;;;::::0;::::3;;;;;;;;;;;;::::0;::::3;;;;;;;;;;;;;;;;;::::0;;::::3;-1:-1:-1::0;;14783:58:4::3;::::0;::::3;;::::0;;;;::::3;;;;;::::0;::::3;;::::0;;::::3;::::0;::::3;::::0;;::::3;::::0;;;;;;::::3;::::0;;;;-1:-1:-1;;;14783:58:4;::::3;;;;;::::0;::::3;;::::0;;::::3;::::0;::::3;::::0;::::3;::::0;;::::3;;;;;::::0;::::3;;::::0;;-1:-1:-1;;;14783:58:4;::::3;;::::0;::::3;::::0;::::3;::::0;-1:-1:-1;14783:58:4::3;;;;;::::0;::::3;;::::0;;-1:-1:-1;14783:58:4;;::::3;::::0;;::::3;::::0;;::::3;::::0;::::3;::::0;;;::::3;;;;;;;;::::0;;::::3;::::0;;;::::3;::::0;::::3;;;;;;;;;;;;;;::::0;::::3;;14776:65;;;;-1:-1:-1::0;7943:10:4::2;:17:::0;;-1:-1:-1;;7943:17:4::2;::::0;::::2;::::0;;14538:310;;;;-1:-1:-1;14538:310:4;-1:-1:-1;14538:310:4:o;17246:191::-;8016:6;;17327:16;;8016:6;;8015:7;8007:68;;;;-1:-1:-1;;;8007:68:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17362::::1;::::0;;-1:-1:-1;;;17362:68:4;;17409:5:::1;17362:68;::::0;::::1;::::0;;;;;;;;;;;:21:::1;::::0;:46:::1;::::0;:68;;;;;;;;;;;:21;:68;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;::::0;;::::1;-1:-1:-1::0;;17362:68:4::1;::::0;::::1;;::::0;::::1;::::0;::::1;;;;;::::0;::::1;;::::0;;::::1;::::0;;;;::::1;::::0;;;;;-1:-1:-1;;;17362:68:4;::::1;;;;;::::0;::::1;;::::0;;::::1;::::0;::::1;::::0;::::1;::::0;;::::1;;;;;::::0;::::1;;::::0;;-1:-1:-1;;;17362:68:4;::::1;;::::0;::::1;::::0;::::1;::::0;-1:-1:-1;17362:68:4::1;;;;;::::0;::::1;;::::0;;-1:-1:-1;17362:68:4;;::::1;::::0;;::::1;::::0;;::::1;::::0;::::1;::::0;;;::::1;;;;;;;;::::0;;::::1;::::0;;;::::1;::::0;::::1;;;;;;;;;;;;;;::::0;::::1;;17355:75;;17246:191:::0;;;:::o;10902:239::-;7762:5;;-1:-1:-1;;;;;7762:5:4;7748:10;:19;7740:57;;;;;-1:-1:-1;;;7740:57:4;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;7740:57:4;;;;;;;;;;;;;;;-1:-1:-1;;;;;10985:23:4;::::1;10977:76;;;;-1:-1:-1::0;;;10977:76:4::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11089:5;::::0;11069:37:::1;::::0;-1:-1:-1;;;;;11069:37:4;;::::1;::::0;11089:5:::1;::::0;11069:37:::1;::::0;11089:5:::1;::::0;11069:37:::1;11117:5;:17:::0;;-1:-1:-1;;;;;;11117:17:4::1;-1:-1:-1::0;;;;;11117:17:4;;;::::1;::::0;;;::::1;::::0;;10902:239::o
Swarm Source
ipfs://96953aa5f8b7e163e4053dfd7dc4dc9358ed06e9ddee073d8f14cf054a06bbb4
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | 100.00% | $0.999807 | 216.3292 | $216.29 |
[ Download: CSV Export ]
[ 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.