Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
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:
Treasury
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; // Contracts import { SafeTransferLib, ERC20 } from "solmate/utils/SafeTransferLib.sol"; import { UUPSUpgradeable } from "../proxy/UUPSUpgradeable.sol"; import { Ownable } from "../common/utils/Ownable.sol"; // Interfaces import { ICurve3Pool } from "./interfaces/ICurve3Pool.sol"; import { IBooster } from "./interfaces/IBooster.sol"; import { IBaseRewardPool } from "./interfaces/IBaseRewardPool.sol"; import { ICvxRewardPool } from "./interfaces/ICvxRewardPool.sol"; import { ICrvDepositor } from "./interfaces/ICrvDepositor.sol"; import { ITreasury } from "./interfaces/ITreasury.sol"; import { IERC20 } from "../common/interfaces/IERC20.sol"; import { IUSXAdmin } from "../common/interfaces/IUSXAdmin.sol"; contract Treasury is Ownable, UUPSUpgradeable, ITreasury { // Private Constants: no SLOAD to save users gas address private constant BACKING_TOKEN = 0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490; // 3CRV address private constant CURVE_3POOL = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7; address private constant CRV = 0xD533a949740bb3306d119CC777fa900bA034cd52; address private constant CVX = 0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B; address private constant BOOSTER = 0xF403C135812408BFbE8713b5A23a04b3D48AAE31; address private constant CRV_DEPOSITOR = 0x8014595F2AB54cD7c604B00E9fb932176fDc86Ae; address private constant CVX3CRV_BASE_REWARD_POOL = 0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8; address private constant CVXCRV_BASE_REWARD_POOL = 0x3Fe65692bfCD0e6CF84cB1E7d24108E434A7587e; address private constant CVX_REWARD_POOL = 0xCF50b810E57Ac33B91dCF525C6ddd9881B139332; address private constant DEPLOYER = 0xd3e7A213D97D8C9630Cef49e715E1156B0385603; uint8 private constant PID_3POOL = 9; // Storage Variables: follow storage slot restrictions struct SupportedStable { bool supported; int128 curveIndex; } mapping(address => SupportedStable) public supportedStables; address public usx; uint256 public previousLpTokenPrice; uint256 public totalSupply; // Events event Mint(address indexed account, uint256 amount); event Redemption(address indexed account, uint256 amount); function initialize(address _usx) public initializer { /// @dev No constructor, so initialize Ownable explicitly. require(msg.sender == DEPLOYER, "Invalid caller."); __Ownable_init(); usx = _usx; } /// @dev Required by the UUPS module. function _authorizeUpgrade(address) internal override onlyOwner { } /** * @dev This function deposits any one of the supported stablecoins to Curve, * receives 3CRV tokens in exchange, and mints the USX token, such that it's * valued at approximately one US dollar. * @param _stable The address of the input token used to mint USX. * @param _amount The amount of the input token used to mint USX. */ function mint(address _stable, uint256 _amount) public { require(_amount != 0, "Amount cannot be zero."); require(supportedStables[_stable].supported || _stable == BACKING_TOKEN, "Unsupported stable."); SafeTransferLib.safeTransferFrom(ERC20(_stable), msg.sender, address(this), _amount); uint256 lpTokenAmount; if (_stable != BACKING_TOKEN) { lpTokenAmount = __provideLiquidity(_stable, _amount); } else { lpTokenAmount = _amount; } __stakeLpTokens(lpTokenAmount); uint256 mintAmount = __getMintAmount(lpTokenAmount); totalSupply += mintAmount; IUSXAdmin(usx).mint(msg.sender, mintAmount); emit Mint(msg.sender, mintAmount); } /** * @dev This function facilitates redeeming a single supported stablecoin, in * exchange for USX tokens, such that USX is valued at approximately one US dollar. * @param _stable The address of the token to withdraw. * @param _amount The amount of USX tokens to burn upon redemption. */ function redeem(address _stable, uint256 _amount) public { require(_amount != 0, "Amount cannot be zero."); require(supportedStables[_stable].supported || _stable == BACKING_TOKEN, "Unsupported stable."); uint256 lpTokenAmount = __getLpTokenAmount(_amount); __unstakeLpTokens(lpTokenAmount); uint256 redeemAmount; if (_stable != BACKING_TOKEN) { redeemAmount = __removeLiquidity(_stable, lpTokenAmount); } else { redeemAmount = lpTokenAmount; } SafeTransferLib.safeTransfer(ERC20(_stable), msg.sender, redeemAmount); totalSupply -= _amount; IUSXAdmin(usx).burn(msg.sender, _amount); emit Redemption(msg.sender, _amount); } function __provideLiquidity(address _stable, uint256 _amount) private returns (uint256 lpTokenAmount) { // Obtain contract's LP token balance before adding liquidity uint256 preBalance = IERC20(BACKING_TOKEN).balanceOf(address(this)); // Add liquidity to Curve SafeTransferLib.safeApprove(ERC20(_stable), CURVE_3POOL, _amount); uint256[3] memory amounts; amounts[uint256(uint128(supportedStables[_stable].curveIndex))] = _amount; ICurve3Pool(CURVE_3POOL).add_liquidity(amounts, 0); // Calculate the amount of LP tokens received from adding liquidity lpTokenAmount = IERC20(BACKING_TOKEN).balanceOf(address(this)) - preBalance; } function __removeLiquidity(address _stable, uint256 _lpTokenAmount) private returns (uint256 redeemAmount) { // Obtain contract's withdrawal token balance before removing liquidity uint256 preBalance = IERC20(_stable).balanceOf(address(this)); // Remove liquidity from Curve ICurve3Pool(CURVE_3POOL).remove_liquidity_one_coin(_lpTokenAmount, supportedStables[_stable].curveIndex, 0); // Calculate the amount of stablecoin received from removing liquidity redeemAmount = IERC20(_stable).balanceOf(address(this)) - preBalance; } function __stakeLpTokens(uint256 _amount) private { // Approve Booster to spend Treasury's 3CRV SafeTransferLib.safeApprove(ERC20(BACKING_TOKEN), BOOSTER, _amount); // Deposit 3CRV into Booster and have it stake cvx3CRV into BaseRewardPool on Treasury's behalf IBooster(BOOSTER).deposit(PID_3POOL, _amount, true); } function __unstakeLpTokens(uint256 _amount) private { // Unstake cvx3CRV, unwrap it into 3RCV, and claim all rewards IBaseRewardPool(CVX3CRV_BASE_REWARD_POOL).withdrawAndUnwrap(_amount, true); } function __getMintAmount(uint256 _lpTokenAmount) private returns (uint256 mintAmount) { // Call reentrancy-guarded function ICurve3Pool(CURVE_3POOL).remove_liquidity(0, [uint256(0), uint256(0), uint256(0)]); uint256 lpTokenPrice = ICurve3Pool(CURVE_3POOL).get_virtual_price(); // Curve invariant dictates that lpTokenPrice should consistently increase over time. require(lpTokenPrice >= previousLpTokenPrice, "Curve invariant violation."); previousLpTokenPrice = lpTokenPrice; mintAmount = (_lpTokenAmount * lpTokenPrice) / 1e18; } function __getLpTokenAmount(uint256 _amount) private returns (uint256 lpTokenAmount) { // Call reentrancy-guarded function ICurve3Pool(CURVE_3POOL).remove_liquidity(0, [uint256(0), uint256(0), uint256(0)]); uint256 lpTokenPrice = ICurve3Pool(CURVE_3POOL).get_virtual_price(); // Curve invariant dictates that lpTokenPrice should consistently increase over time. // If invariant is ever violated, USX will decrease in price, but holders will still // be able to redeem. if (lpTokenPrice < previousLpTokenPrice) { lpTokenPrice = previousLpTokenPrice; } else { previousLpTokenPrice = lpTokenPrice; } uint256 conversionFactor = (1e18 * 1e18 / lpTokenPrice); lpTokenAmount = (_amount * conversionFactor) / 1e18; } /* **************************************************************************** ** ** Admin Functions ** ******************************************************************************/ /** * @dev Allow contract admins to add supported stablecoins. * @param _stable The address of stablecoin to add. * @param _curveIndex The stablecoin's Curve-assigned index. */ function addSupportedStable(address _stable, int128 _curveIndex) public onlyOwner { supportedStables[_stable] = SupportedStable(true, _curveIndex); } /** * @dev Allow contract admins to remove supported stablecoins. * @param _stable The address of stablecoin to remove. */ function removeSupportedStable(address _stable) public onlyOwner { delete supportedStables[_stable]; } /** * @dev Allow contract admins to swap the backing token to a supported stable, in an emergency. * For example, if the Curve invariant is violated, admins may need to swap the backing token to * protect the USX peg to the US dollar. */ function emergencySwapBacking(address _newBackingToken) public onlyOwner { require(supportedStables[_newBackingToken].supported, "Token not supported."); // Withdraw all staked 3CRV uint256 totalStaked = IBaseRewardPool(CVX3CRV_BASE_REWARD_POOL).balanceOf(address(this)); __unstakeLpTokens(totalStaked); // Remove liquidity from Curve, receiving _newBackingToken ICurve3Pool(CURVE_3POOL).remove_liquidity_one_coin( totalStaked, supportedStables[_newBackingToken].curveIndex, 0 ); // Pause minting and redeeming IUSXAdmin(usx).treasuryKillSwitch(); // This contract is now backed by _newBackingToken, but BACKING_TOKEN was not updated, because it's a constant. // Admins may need to update BACKING_TOKEN via proxy upgrade, depending on the post-emergency-swap resolution. } /** * @dev Allow contract admins to extract any non-backing ERC20 token. * @param _token The address of token to remove. */ function extractERC20(address _token) public onlyOwner { uint256 balance = IERC20(_token).balanceOf(address(this)); SafeTransferLib.safeTransfer(ERC20(_token), msg.sender, balance); } /** * @dev Allow contract admins to extract native token. */ function extractNative() public onlyOwner { payable(msg.sender).transfer(address(this).balance); } /** * @dev Allow contract admins to stake CVX into CVX_REWARD_POOL contract. This will * accumulate cvxCRV rewards proportionate to the amount staked. * @param _amount The amount of CVX to stake. */ function stakeCvx(uint256 _amount) public onlyOwner { uint256 balance = IERC20(CVX).balanceOf(address(this)); require(balance != 0 && balance >= _amount, "Insufficient CVX balance."); SafeTransferLib.safeApprove(ERC20(CVX), CVX_REWARD_POOL, _amount); ICvxRewardPool(CVX_REWARD_POOL).stake(_amount); } /** * @dev Allow contract admins to withdraw CVX from CVX_REWARD_POOL contract and claim all * unclaimed cvxCRV rewards. * @param _amount The amount of CVX to withdraw. */ function unstakeCvx(uint256 _amount) public onlyOwner { uint256 stakedAmount = ICvxRewardPool(CVX_REWARD_POOL).balanceOf(address(this)); require(stakedAmount != 0 && stakedAmount >= _amount, "Amount exceeds staked balance."); ICvxRewardPool(CVX_REWARD_POOL).withdraw(_amount, true); } /** * @dev Allow contract admins to claim all unclaimed cvxCRV rewards from CVX_REWARD_POOL contract. * @param _stake If true, all claimed cvxCRV rewards will be staked into CVXCRV_BASE_REWARD_POOL. */ function claimRewardCvx(bool _stake) public onlyOwner { require(ICvxRewardPool(CVX_REWARD_POOL).earned(address(this)) != 0, "No rewards to claim."); ICvxRewardPool(CVX_REWARD_POOL).getReward(_stake); } /** * @dev Allow contract admins to deposit CRV into CrvDepositor, convert it to cvxCRV, and stake the * corresponding cvxCRV into CVXCRV_BASE_REWARD_POOL. This will accumulate CVX, CRV, and 3CRV * rewards proportionate to the amount staked. * @param _amount The amount of CRV to deposit, convert, and stake. */ function stakeCrv(uint256 _amount) public onlyOwner { require(_amount != 0, "Amount cannot be zero."); require(IERC20(CRV).balanceOf(address(this)) >= _amount, "Insufficient CRV balance."); SafeTransferLib.safeApprove(ERC20(CRV), CRV_DEPOSITOR, _amount); ICrvDepositor(CRV_DEPOSITOR).deposit(_amount, true, CVXCRV_BASE_REWARD_POOL); } /** * @dev Allow contract admins to withdraw cvxCRV from CVXCRV_BASE_REWARD_POOL and claim all * unclaimed CVX, CRV, and 3CRV rewards. * @param _amount The amount of cvxCRV to withdraw. */ function unstakeCvxCrv(uint256 _amount) public onlyOwner { uint256 stakedAmount = IBaseRewardPool(CVXCRV_BASE_REWARD_POOL).balanceOf(address(this)); require(stakedAmount != 0 && stakedAmount >= _amount, "Amount exceeds staked balance."); IBaseRewardPool(CVXCRV_BASE_REWARD_POOL).withdraw(_amount, true); } /** * @dev Allow contract admins to claim all unclaimed CVX, CRV, and 3CRV rewards from CVXCRV_BASE_REWARD_POOL. */ function claimRewardCvxCrv() public onlyOwner { require(IBaseRewardPool(CVXCRV_BASE_REWARD_POOL).earned(address(this)) != 0, "No rewards to claim."); IBaseRewardPool(CVXCRV_BASE_REWARD_POOL).getReward(); } /** * @dev Allow contract admins to deposit 3CRV into Booster, convert it to cvx3CRV, and * stake the corresponding cvx3CRV into CVX3CRV_BASE_REWARD_POOL. This will accumulate * CVX and CRV rewards proportionate to the amount staked. * @param _amount The amount of 3CRV to deposit, convert, and stake. */ function stake3Crv(uint256 _amount) public onlyOwner { uint256 balance = IERC20(BACKING_TOKEN).balanceOf(address(this)); require(balance != 0 && balance >= _amount, "Insufficient 3CRV balance."); __stakeLpTokens(_amount); } /** * @dev Allow contract admins to withdraw cvx3CRV from CVX3CRV_BASE_REWARD_POOL, unwrap it into 3CRV, * and claim all unclaimed CVX and CRV rewards. * @param _amount The amount of cvx3CRV to withdraw. */ function unstake3Crv(uint256 _amount) public onlyOwner { uint256 balanceCvx3Crv = IBaseRewardPool(CVX3CRV_BASE_REWARD_POOL).balanceOf(address(this)); uint256 backingAmount = __getLpTokenAmount(totalSupply); require(_amount <= balanceCvx3Crv - backingAmount, "Cannot withdraw backing cvx3CRV."); __unstakeLpTokens(_amount); } /** * @dev Allow contract admins to claim all unclaimed CVX and CRV rewards from CVX3CRV_BASE_REWARD_POOL. */ function claimRewardCvx3Crv() public onlyOwner { require(IBaseRewardPool(CVX3CRV_BASE_REWARD_POOL).earned(address(this)) != 0, "No rewards to claim."); IBaseRewardPool(CVX3CRV_BASE_REWARD_POOL).getReward(); } receive() external payable { } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage slots in the inheritance chain. * Storage slot management is necessary, as we're using an upgradable proxy contract. * For details, see: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument. mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IERC165 { /// @notice Query if a contract implements an interface /// @param interfaceID The interface identifier, as specified in ERC-165 /// @dev Interface identification is specified in ERC-165. This function /// uses less than 30,000 gas. /// @return `true` if the contract implements `interfaceID` and /// `interfaceID` is not 0xffffffff, `false` otherwise function supportsInterface(bytes4 interfaceID) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { IERC20 } from "./IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import { IERC165 } from "./IERC165.sol"; import { IERC20Metadata } from "../../common/interfaces/IERC20Metadata.sol"; /** * @dev Interface of the Omnichain ERC20 standard */ interface IOERC20 is IERC165, IERC20Metadata { /** * @dev send _amount amount of token to (`_dstChainId`, `_toAddress`) from `_from` * @param _bridgeAddress - the Ax-assigned bridge ID, which dictates the message passing protocol to use * @param _from - the owner of token * @param _dstChainId - the destination chain identifier * @param _toAddress - can be any size depending on the `dstChainId` * @param _amount - the quantity of tokens in wei */ function sendFrom( address _bridgeAddress, address payable _from, uint16 _dstChainId, bytes memory _toAddress, uint256 _amount ) external payable returns (uint64 sequence); /** * @dev returns the circulating amount of tokens on current chain */ function circulatingSupply() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { IERC20 } from "./IERC20.sol"; /** * @dev Extends IERC20 to include permit functionality */ interface IUERC20 is IERC20 { /** * @dev nonces is mapping given for replay protection. * * Returns a boolean value indicating whether the operation succeeded. */ function nonces(address owner) external returns (uint256); /** * @dev Hash of a structed defined in EIP-712; it's used for replay protection. * * Returns the hash. */ function DOMAIN_SEPARATOR() external returns (bytes32); /** * @dev Allows abstraction of ERC-20 approval method. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; import { IOERC20 } from "./IOERC20.sol"; interface IUSX is IOERC20 { function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; import { IUSX } from "./IUSX.sol"; import { IUERC20 } from "./IUERC20.sol"; interface IUSXAdmin is IUSX, IUERC20 { error Paused(); function treasuryKillSwitch() external; function upgradeTo(address newImplementation) external; function manageTreasuries(address _treasury, bool _mint, bool _burn) external; function treasuries(address _treasury) external returns (bool mint, bool burn); function manageCrossChainTransfers(address[2] calldata _bridgeAddresses, bool[2] calldata _privileges) external; function transferPrivileges(address _bridge) external returns (bool); function extractERC20(address _token) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./Initializable.sol"; /** * @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 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 is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage slots in the inheritance chain. * Storage slot management is necessary, as we're using an upgradable proxy contract. * For details, see: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "../../libraries/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private __initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private __initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !__initializing; require( (isTopLevelCall && __initialized < 1) || (!Address._isContract(address(this)) && __initialized == 1), "Initializable: contract is already initialized" ); __initialized = 1; if (isTopLevelCall) { __initializing = true; } _; if (isTopLevelCall) { __initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!__initializing && __initialized < version, "Initializable: contract is already initialized"); __initialized = version; __initializing = true; _; __initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(__initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!__initializing, "Initializable: contract is initializing"); if (__initialized < type(uint8).max) { __initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `__initialized` */ function _getInitializedVersion() internal view returns (uint8) { return __initialized; } /** * @dev Internal function that returns the initialized version. Returns `__initializing` */ function _isInitializing() internal view returns (bool) { return __initializing; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage slots in the inheritance chain. * Storage slot management is necessary, as we're using an upgradable proxy contract. * For details, see: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./Initializable.sol"; 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 Initializable, Context { address private __owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return __owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = __owner; __owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage slots in the inheritance chain. * Storage slot management is necessary, as we're using an upgradable proxy contract. * For details, see: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `_isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function _isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {_sendValue} removes this limitation. * * https://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"); (bool success,) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function _functionCall(address target, bytes memory data) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function _functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function _functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return _functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function _functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function _functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return _functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function _functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return _functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function _verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check _isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(_isContract(target), "Address: call to non-contract"); } return returndata; } else { __revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) internal pure returns (bytes memory) { if (success) { return returndata; } else { __revert(returndata, errorMessage); } } function __revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function _getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function _getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function _getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function _getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./interfaces/IBeacon.sol"; import "../libraries/Address.sol"; import "../libraries/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant __ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot._getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function __setImplementation(address newImplementation) private { require(Address._isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot._getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { __setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address._functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure(address newImplementation, bytes memory data, bool forceCall) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call __setImplementation(newImplementation); if (data.length > 0 || forceCall) { Address._functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot._getBooleanSlot(__ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; Address._functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot._getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function __setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot._getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); __setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot._getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function __setBeacon(address newBeacon) private { require(Address._isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address._isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot._getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-__setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { __setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address._functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage slots in the inheritance chain. * Storage slot management is necessary, as we're using an upgradable proxy contract. * For details, see: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./ERC1967Upgrade.sol"; import "./interfaces/IERC1822.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade { address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage slots in the inheritance chain. * Storage slot management is necessary, as we're using an upgradable proxy contract. * For details, see: https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; interface IBaseRewardPool { /** * @dev withdrawAndUnwrap() only works for a BaseRewardPool address where stakingToken * corresponds to a Curve pool (i.e., cvx3CRV can unrwap to 3CRV). This function * will not work for the BaseRewardPool address that corresponds to cvxCRV, because * it cannot be unwrapped to CRV. */ function withdrawAndUnwrap(uint256 _amount, bool _claim) external returns (bool); function withdraw(uint256 _amount, bool _claim) external returns (bool); function stake(uint256 _amount) external returns (bool); function getReward() external returns (bool); function balanceOf(address _account) external returns (uint256); function earned(address _account) external returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; interface IBooster { function deposit(uint256 _pid, uint256 _amount, bool _stake) external returns (bool); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; interface ICrvDepositor { function deposit(uint256 _amount, bool _lock, address _stakeAddress) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; interface ICurve3Pool { function calc_token_amount(uint256[3] calldata _amounts, bool _is_deposit) external returns (uint256); function add_liquidity(uint256[3] calldata _amounts, uint256 _min_mint_amount) external; function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external returns (uint256); function remove_liquidity_one_coin(uint256 _token_amount, int128 i, uint256 _min_amount) external; function remove_liquidity(uint256 _amount, uint256[3] calldata _min_amounts) external; function get_virtual_price() external returns (uint256); function coins(uint256 i) external returns (address); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; interface ICvxRewardPool { function stake(uint256 _amount) external; function getReward(bool _stake) external; function withdraw(uint256 _amount, bool claim) external; function balanceOf(address _account) external returns (uint256); function earned(address _account) external returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; interface ITreasury { function mint(address _stable, uint256 _amount) external; function redeem(address _stable, uint256 _amount) external; }
{ "remappings": [ "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Redemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[{"internalType":"address","name":"_stable","type":"address"},{"internalType":"int128","name":"_curveIndex","type":"int128"}],"name":"addSupportedStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_stake","type":"bool"}],"name":"claimRewardCvx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimRewardCvx3Crv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimRewardCvxCrv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newBackingToken","type":"address"}],"name":"emergencySwapBacking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"extractERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"extractNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_usx","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stable","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previousLpTokenPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stable","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stable","type":"address"}],"name":"removeSupportedStable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stake3Crv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeCrv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stakeCvx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supportedStables","outputs":[{"internalType":"bool","name":"supported","type":"bool"},{"internalType":"int128","name":"curveIndex","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unstake3Crv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unstakeCvx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unstakeCvxCrv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"usx","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523060805234801561001457600080fd5b50608051612c8461004c600039600081816108230152818161086301528181610e2c01528181610e6c0152610ffa0152612c846000f3fe6080604052600436106101a05760003560e01c8063715018a6116100ec578063c5c0da1a1161008a578063f10e29d611610064578063f10e29d61461048f578063f2fde38b146104af578063f5ffcdb3146104cf578063f6ce3155146104ef57600080fd5b8063c5c0da1a1461043a578063ce533dbe1461045a578063d56be3821461046f57600080fd5b80638da5cb5b116100c65780638da5cb5b146103b3578063ac059c4a146103e5578063bc07345114610405578063c4d66de81461041a57600080fd5b8063715018a61461032a57806378db08731461033f5780637cbf5fb51461035f57600080fd5b8063445e2477116101595780634f1ef286116101335780634f1ef286146102cd57806351f97475146102e057806352d1902d146102f55780636a7e92101461030a57600080fd5b8063445e24771461026d5780634aa6ebe71461028d5780634d1fb7ab146102ad57600080fd5b806315d4951e146101ac57806317f1ded6146101d557806318160ddd146101f75780631e9a69501461020d5780633659cfe61461022d57806340c10f191461024d57600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b506101c260fe5481565b6040519081526020015b60405180910390f35b3480156101e157600080fd5b506101f56101f03660046127a6565b61050f565b005b34801561020357600080fd5b506101c260ff5481565b34801561021957600080fd5b506101f56102283660046127db565b610662565b34801561023957600080fd5b506101f5610248366004612805565b610819565b34801561025957600080fd5b506101f56102683660046127db565b6108e1565b34801561027957600080fd5b506101f5610288366004612805565b610a8f565b34801561029957600080fd5b506101f56102a8366004612820565b610c5d565b3480156102b957600080fd5b506101f56102c83660046127a6565b610cdc565b6101f56102db366004612873565b610e22565b3480156102ec57600080fd5b506101f5610edb565b34801561030157600080fd5b506101c2610fed565b34801561031657600080fd5b506101f56103253660046127a6565b6110b2565b34801561033657600080fd5b506101f561125a565b34801561034b57600080fd5b506101f561035a3660046127a6565b61126e565b34801561036b57600080fd5b5061039961037a366004612805565b60fc6020526000908152604090205460ff8116906101009004600f0b82565b604080519215158352600f9190910b6020830152016101cc565b3480156103bf57600080fd5b506065546001600160a01b03165b6040516001600160a01b0390911681526020016101cc565b3480156103f157600080fd5b506101f56104003660046127a6565b611366565b34801561041157600080fd5b506101f561144a565b34801561042657600080fd5b506101f5610435366004612805565b611538565b34801561044657600080fd5b506101f5610455366004612805565b6116b9565b34801561046657600080fd5b506101f5611739565b34801561047b57600080fd5b5060fd546103cd906001600160a01b031681565b34801561049b57600080fd5b506101f56104aa366004612805565b61176d565b3480156104bb57600080fd5b506101f56104ca366004612805565b61179c565b3480156104db57600080fd5b506101f56104ea3660046127a6565b611812565b3480156104fb57600080fd5b506101f561050a366004612943565b61196c565b610517611a3f565b6040516370a0823160e01b815230600482015260009073cf50b810e57ac33b91dcf525c6ddd9881b139332906370a08231906024016020604051808303816000875af115801561056b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058f9190612960565b905080158015906105a05750818110155b6105f15760405162461bcd60e51b815260206004820152601e60248201527f416d6f756e742065786365656473207374616b65642062616c616e63652e000060448201526064015b60405180910390fd5b604051631c683a1b60e11b8152600481018390526001602482015273cf50b810e57ac33b91dcf525c6ddd9881b139332906338d07436906044015b600060405180830381600087803b15801561064657600080fd5b505af115801561065a573d6000803e3d6000fd5b505050505050565b806000036106825760405162461bcd60e51b81526004016105e890612979565b6001600160a01b038216600090815260fc602052604090205460ff16806106c557506001600160a01b038216736c3f90f043a72fa612cbac8115ee7e52bde6e490145b6107075760405162461bcd60e51b81526020600482015260136024820152722ab739bab83837b93a32b21039ba30b136329760691b60448201526064016105e8565b600061071282611a99565b905061071d81611bf4565b60006001600160a01b038416736c3f90f043a72fa612cbac8115ee7e52bde6e490146107545761074d8483611c72565b9050610757565b50805b610762843383611dea565b8260ff600082825461077491906129bf565b909155505060fd54604051632770a7eb60e21b8152336004820152602481018590526001600160a01b0390911690639dc29fac90604401600060405180830381600087803b1580156107c557600080fd5b505af11580156107d9573d6000803e3d6000fd5b50506040518581523392507fe6c82503aaaa3db78b70f183901ae8668918f895b3982b2c851cf2ffe0c6c63991506020015b60405180910390a250505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036108615760405162461bcd60e51b81526004016105e8906129d2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610893611e68565b6001600160a01b0316146108b95760405162461bcd60e51b81526004016105e890612a1e565b6108c281611e96565b604080516000808252602082019092526108de91839190611e9e565b50565b806000036109015760405162461bcd60e51b81526004016105e890612979565b6001600160a01b038216600090815260fc602052604090205460ff168061094457506001600160a01b038216736c3f90f043a72fa612cbac8115ee7e52bde6e490145b6109865760405162461bcd60e51b81526020600482015260136024820152722ab739bab83837b93a32b21039ba30b136329760691b60448201526064016105e8565b61099282333084611fe2565b60006001600160a01b038316736c3f90f043a72fa612cbac8115ee7e52bde6e490146109c9576109c28383612065565b90506109cc565b50805b6109d58161223a565b60006109e0826122b3565b90508060ff60008282546109f49190612a6a565b909155505060fd546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610a4557600080fd5b505af1158015610a59573d6000803e3d6000fd5b50506040518381523392507f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885915060200161080b565b610a97611a3f565b6001600160a01b038116600090815260fc602052604090205460ff16610af65760405162461bcd60e51b81526020600482015260146024820152732a37b5b2b7103737ba1039bab83837b93a32b21760611b60448201526064016105e8565b6040516370a0823160e01b815230600482015260009073689440f2ff927e1f24c72f1087e1faf471ece1c8906370a08231906024016020604051808303816000875af1158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190612960565b9050610b7981611bf4565b6001600160a01b038216600090815260fc6020526040808220549051630d2680e960e11b815260048101849052610100909104600f0b6024820152604481019190915273bebc44782c7db0a1a60cb6fe97d0b483032ff1c790631a4d01d290606401600060405180830381600087803b158015610bf557600080fd5b505af1158015610c09573d6000803e3d6000fd5b5050505060fd60009054906101000a90046001600160a01b03166001600160a01b031663769461986040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561064657600080fd5b610c65611a3f565b60408051808201825260018152600f9290920b60208084019182526001600160a01b03909416600090815260fc90945292209051815492516001600160801b03166101000270ffffffffffffffffffffffffffffffff0019911515919091166001600160881b031990931692909217919091179055565b610ce4611a3f565b6040516370a0823160e01b8152306004820152600090734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190612960565b90508015801590610d6b5750818110155b610db75760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e74204356582062616c616e63652e0000000000000060448201526064016105e8565b610dea734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b73cf50b810e57ac33b91dcf525c6ddd9881b1393328461242e565b60405163534a7e1d60e11b81526004810183905273cf50b810e57ac33b91dcf525c6ddd9881b1393329063a694fc3a9060240161062c565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003610e6a5760405162461bcd60e51b81526004016105e8906129d2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610e9c611e68565b6001600160a01b031614610ec25760405162461bcd60e51b81526004016105e890612a1e565b610ecb82611e96565b610ed782826001611e9e565b5050565b610ee3611a3f565b6040516246613160e11b8152306004820152733fe65692bfcd0e6cf84cb1e7d24108e434a7587e90628cc262906024016020604051808303816000875af1158015610f32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f569190612960565b600003610f755760405162461bcd60e51b81526004016105e890612a7d565b733fe65692bfcd0e6cf84cb1e7d24108e434a7587e6001600160a01b0316633d18b9126040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610fc9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108de9190612aab565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461108d5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016105e8565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b6110ba611a3f565b806000036110da5760405162461bcd60e51b81526004016105e890612979565b6040516370a0823160e01b8152306004820152819073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa15801561112b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114f9190612960565b101561119d5760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e74204352562062616c616e63652e0000000000000060448201526064016105e8565b6111d073d533a949740bb3306d119cc777fa900ba034cd52738014595f2ab54cd7c604b00e9fb932176fdc86ae8361242e565b60405163203b5c7960e21b81526004810182905260016024820152733fe65692bfcd0e6cf84cb1e7d24108e434a7587e6044820152738014595f2ab54cd7c604b00e9fb932176fdc86ae906380ed71e4906064015b600060405180830381600087803b15801561123f57600080fd5b505af1158015611253573d6000803e3d6000fd5b5050505050565b611262611a3f565b61126c60006124a5565b565b611276611a3f565b6040516370a0823160e01b815230600482015260009073689440f2ff927e1f24c72f1087e1faf471ece1c8906370a08231906024016020604051808303816000875af11580156112ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ee9190612960565b905060006112fd60ff54611a99565b905061130981836129bf565b8311156113585760405162461bcd60e51b815260206004820181905260248201527f43616e6e6f74207769746864726177206261636b696e6720637678334352562e60448201526064016105e8565b61136183611bf4565b505050565b61136e611a3f565b6040516370a0823160e01b8152306004820152600090736c3f90f043a72fa612cbac8115ee7e52bde6e490906370a0823190602401602060405180830381865afa1580156113c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e49190612960565b905080158015906113f55750818110155b6114415760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420334352562062616c616e63652e00000000000060448201526064016105e8565b610ed78261223a565b611452611a3f565b6040516246613160e11b815230600482015273689440f2ff927e1f24c72f1087e1faf471ece1c890628cc262906024016020604051808303816000875af11580156114a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c59190612960565b6000036114e45760405162461bcd60e51b81526004016105e890612a7d565b73689440f2ff927e1f24c72f1087e1faf471ece1c86001600160a01b0316633d18b9126040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610fc9573d6000803e3d6000fd5b600054610100900460ff16158080156115585750600054600160ff909116105b806115725750303b158015611572575060005460ff166001145b6115d55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105e8565b6000805460ff1916600117905580156115f8576000805461ff0019166101001790555b3373d3e7a213d97d8c9630cef49e715e1156b03856031461164d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21031b0b63632b91760891b60448201526064016105e8565b6116556124f7565b60fd80546001600160a01b0319166001600160a01b0384161790558015610ed7576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6116c1611a3f565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611708573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172c9190612960565b9050610ed7823383611dea565b611741611a3f565b60405133904780156108fc02916000818181858888f193505050501580156108de573d6000803e3d6000fd5b611775611a3f565b6001600160a01b0316600090815260fc6020526040902080546001600160881b0319169055565b6117a4611a3f565b6001600160a01b0381166118095760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e8565b6108de816124a5565b61181a611a3f565b6040516370a0823160e01b8152306004820152600090733fe65692bfcd0e6cf84cb1e7d24108e434a7587e906370a08231906024016020604051808303816000875af115801561186e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118929190612960565b905080158015906118a35750818110155b6118ef5760405162461bcd60e51b815260206004820152601e60248201527f416d6f756e742065786365656473207374616b65642062616c616e63652e000060448201526064016105e8565b604051631c683a1b60e11b81526004810183905260016024820152733fe65692bfcd0e6cf84cb1e7d24108e434a7587e906338d07436906044016020604051808303816000875af1158015611948573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113619190612aab565b611974611a3f565b6040516246613160e11b815230600482015273cf50b810e57ac33b91dcf525c6ddd9881b13933290628cc262906024016020604051808303816000875af11580156119c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e79190612960565b600003611a065760405162461bcd60e51b81526004016105e890612a7d565b60405163a4698feb60e01b8152811515600482015273cf50b810e57ac33b91dcf525c6ddd9881b1393329063a4698feb90602401611225565b6065546001600160a01b0316331461126c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e8565b60408051606081018252600080825260208201819052818301819052915163ecb586a560e01b815273bebc44782c7db0a1a60cb6fe97d0b483032ff1c79163ecb586a591611aeb918591600401612aeb565b600060405180830381600087803b158015611b0557600080fd5b505af1158015611b19573d6000803e3d6000fd5b50505050600073bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b979190612960565b905060fe54811015611bac575060fe54611bb2565b60fe8190555b6000611bcd826ec097ce7bc90715b34b9f1000000000612aff565b9050670de0b6b3a7640000611be28286612b21565b611bec9190612aff565b949350505050565b604051636197390160e11b8152600481018290526001602482015273689440f2ff927e1f24c72f1087e1faf471ece1c89063c32e7202906044015b6020604051808303816000875af1158015611c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed79190612aab565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015611cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdf9190612960565b6001600160a01b038516600090815260fc6020526040808220549051630d2680e960e11b815260048101879052610100909104600f0b6024820152604481019190915290915073bebc44782c7db0a1a60cb6fe97d0b483032ff1c790631a4d01d290606401600060405180830381600087803b158015611d5e57600080fd5b505af1158015611d72573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201528392506001600160a01b03871691506370a0823190602401602060405180830381865afa158015611dbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de09190612960565b611bec91906129bf565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080611e625760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b60448201526064016105e8565b50505050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6108de611a3f565b6000611ea8611e68565b9050611eb384612526565b600083511180611ec05750815b15611ed157611ecf84846125d4565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff1661125357805460ff191660011781556040516001600160a01b0383166024820152611f5090869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b1790526125d4565b50805460ff19168155611f61611e68565b6001600160a01b0316826001600160a01b031614611fd95760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b60648201526084016105e8565b61125385612602565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806112535760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b60448201526064016105e8565b6040516370a0823160e01b81523060048201526000908190736c3f90f043a72fa612cbac8115ee7e52bde6e490906370a0823190602401602060405180830381865afa1580156120b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120dd9190612960565b90506120fe8473bebc44782c7db0a1a60cb6fe97d0b483032ff1c78561242e565b612106612788565b6001600160a01b038516600090815260fc60205260409020548490829061010090046001600160801b03166003811061214157612141612b38565b6020020152604051634515cef360e01b815273bebc44782c7db0a1a60cb6fe97d0b483032ff1c790634515cef390612180908490600090600401612b4e565b600060405180830381600087803b15801561219a57600080fd5b505af11580156121ae573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152849250736c3f90f043a72fa612cbac8115ee7e52bde6e49091506370a0823190602401602060405180830381865afa158015612203573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122279190612960565b61223191906129bf565b95945050505050565b61226d736c3f90f043a72fa612cbac8115ee7e52bde6e49073f403c135812408bfbe8713b5a23a04b3d48aae318361242e565b6040516321d0683360e11b815260096004820152602481018290526001604482015273f403c135812408bfbe8713b5a23a04b3d48aae31906343a0d06690606401611c2f565b60408051606081018252600080825260208201819052818301819052915163ecb586a560e01b815273bebc44782c7db0a1a60cb6fe97d0b483032ff1c79163ecb586a591612305918591600401612aeb565b600060405180830381600087803b15801561231f57600080fd5b505af1158015612333573d6000803e3d6000fd5b50505050600073bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b81526004016020604051808303816000875af115801561238d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b19190612960565b905060fe548110156124055760405162461bcd60e51b815260206004820152601a60248201527f437572766520696e76617269616e742076696f6c6174696f6e2e00000000000060448201526064016105e8565b60fe819055670de0b6b3a764000061241d8285612b21565b6124279190612aff565b9392505050565b600060405163095ea7b360e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080611e625760405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b60448201526064016105e8565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661251e5760405162461bcd60e51b81526004016105e890612b69565b61126c612642565b6001600160a01b0381163b6125935760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016105e8565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60606125f98383604051806060016040528060278152602001612c2860279139612672565b90505b92915050565b61260b81612526565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600054610100900460ff166126695760405162461bcd60e51b81526004016105e890612b69565b61126c336124a5565b6060600080856001600160a01b03168560405161268f9190612bd8565b600060405180830381855af49150503d80600081146126ca576040519150601f19603f3d011682016040523d82523d6000602084013e6126cf565b606091505b50915091506126e0868383876126ea565b9695505050505050565b60608315612759578251600003612752576001600160a01b0385163b6127525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e8565b5081611bec565b611bec838381511561276e5781518083602001fd5b8060405162461bcd60e51b81526004016105e89190612bf4565b60405180606001604052806003906020820280368337509192915050565b6000602082840312156127b857600080fd5b5035919050565b80356001600160a01b03811681146127d657600080fd5b919050565b600080604083850312156127ee57600080fd5b6127f7836127bf565b946020939093013593505050565b60006020828403121561281757600080fd5b6125f9826127bf565b6000806040838503121561283357600080fd5b61283c836127bf565b9150602083013580600f0b811461285257600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561288657600080fd5b61288f836127bf565b9150602083013567ffffffffffffffff808211156128ac57600080fd5b818501915085601f8301126128c057600080fd5b8135818111156128d2576128d261285d565b604051601f8201601f19908116603f011681019083821181831017156128fa576128fa61285d565b8160405282815288602084870101111561291357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b80151581146108de57600080fd5b60006020828403121561295557600080fd5b813561242781612935565b60006020828403121561297257600080fd5b5051919050565b60208082526016908201527520b6b7bab73a1031b0b73737ba103132903d32b9379760511b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b818103818111156125fc576125fc6129a9565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b808201808211156125fc576125fc6129a9565b6020808252601490820152732737903932bbb0b93239903a379031b630b4b69760611b604082015260600190565b600060208284031215612abd57600080fd5b815161242781612935565b8060005b6003811015611e62578151845260209384019390910190600101612acc565b828152608081016124276020830184612ac8565b600082612b1c57634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176125fc576125fc6129a9565b634e487b7160e01b600052603260045260246000fd5b60808101612b5c8285612ac8565b8260608301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612bcf578181015183820152602001612bb7565b50506000910152565b60008251612bea818460208701612bb4565b9190910192915050565b6020815260008251806020840152612c13816040850160208701612bb4565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012a1f72c9e3cc2cbef15e1723d1d81bf097839b5e3c84beb9e6276b4cbb226fb64736f6c63430008130033
Deployed Bytecode
0x6080604052600436106101a05760003560e01c8063715018a6116100ec578063c5c0da1a1161008a578063f10e29d611610064578063f10e29d61461048f578063f2fde38b146104af578063f5ffcdb3146104cf578063f6ce3155146104ef57600080fd5b8063c5c0da1a1461043a578063ce533dbe1461045a578063d56be3821461046f57600080fd5b80638da5cb5b116100c65780638da5cb5b146103b3578063ac059c4a146103e5578063bc07345114610405578063c4d66de81461041a57600080fd5b8063715018a61461032a57806378db08731461033f5780637cbf5fb51461035f57600080fd5b8063445e2477116101595780634f1ef286116101335780634f1ef286146102cd57806351f97475146102e057806352d1902d146102f55780636a7e92101461030a57600080fd5b8063445e24771461026d5780634aa6ebe71461028d5780634d1fb7ab146102ad57600080fd5b806315d4951e146101ac57806317f1ded6146101d557806318160ddd146101f75780631e9a69501461020d5780633659cfe61461022d57806340c10f191461024d57600080fd5b366101a757005b600080fd5b3480156101b857600080fd5b506101c260fe5481565b6040519081526020015b60405180910390f35b3480156101e157600080fd5b506101f56101f03660046127a6565b61050f565b005b34801561020357600080fd5b506101c260ff5481565b34801561021957600080fd5b506101f56102283660046127db565b610662565b34801561023957600080fd5b506101f5610248366004612805565b610819565b34801561025957600080fd5b506101f56102683660046127db565b6108e1565b34801561027957600080fd5b506101f5610288366004612805565b610a8f565b34801561029957600080fd5b506101f56102a8366004612820565b610c5d565b3480156102b957600080fd5b506101f56102c83660046127a6565b610cdc565b6101f56102db366004612873565b610e22565b3480156102ec57600080fd5b506101f5610edb565b34801561030157600080fd5b506101c2610fed565b34801561031657600080fd5b506101f56103253660046127a6565b6110b2565b34801561033657600080fd5b506101f561125a565b34801561034b57600080fd5b506101f561035a3660046127a6565b61126e565b34801561036b57600080fd5b5061039961037a366004612805565b60fc6020526000908152604090205460ff8116906101009004600f0b82565b604080519215158352600f9190910b6020830152016101cc565b3480156103bf57600080fd5b506065546001600160a01b03165b6040516001600160a01b0390911681526020016101cc565b3480156103f157600080fd5b506101f56104003660046127a6565b611366565b34801561041157600080fd5b506101f561144a565b34801561042657600080fd5b506101f5610435366004612805565b611538565b34801561044657600080fd5b506101f5610455366004612805565b6116b9565b34801561046657600080fd5b506101f5611739565b34801561047b57600080fd5b5060fd546103cd906001600160a01b031681565b34801561049b57600080fd5b506101f56104aa366004612805565b61176d565b3480156104bb57600080fd5b506101f56104ca366004612805565b61179c565b3480156104db57600080fd5b506101f56104ea3660046127a6565b611812565b3480156104fb57600080fd5b506101f561050a366004612943565b61196c565b610517611a3f565b6040516370a0823160e01b815230600482015260009073cf50b810e57ac33b91dcf525c6ddd9881b139332906370a08231906024016020604051808303816000875af115801561056b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058f9190612960565b905080158015906105a05750818110155b6105f15760405162461bcd60e51b815260206004820152601e60248201527f416d6f756e742065786365656473207374616b65642062616c616e63652e000060448201526064015b60405180910390fd5b604051631c683a1b60e11b8152600481018390526001602482015273cf50b810e57ac33b91dcf525c6ddd9881b139332906338d07436906044015b600060405180830381600087803b15801561064657600080fd5b505af115801561065a573d6000803e3d6000fd5b505050505050565b806000036106825760405162461bcd60e51b81526004016105e890612979565b6001600160a01b038216600090815260fc602052604090205460ff16806106c557506001600160a01b038216736c3f90f043a72fa612cbac8115ee7e52bde6e490145b6107075760405162461bcd60e51b81526020600482015260136024820152722ab739bab83837b93a32b21039ba30b136329760691b60448201526064016105e8565b600061071282611a99565b905061071d81611bf4565b60006001600160a01b038416736c3f90f043a72fa612cbac8115ee7e52bde6e490146107545761074d8483611c72565b9050610757565b50805b610762843383611dea565b8260ff600082825461077491906129bf565b909155505060fd54604051632770a7eb60e21b8152336004820152602481018590526001600160a01b0390911690639dc29fac90604401600060405180830381600087803b1580156107c557600080fd5b505af11580156107d9573d6000803e3d6000fd5b50506040518581523392507fe6c82503aaaa3db78b70f183901ae8668918f895b3982b2c851cf2ffe0c6c63991506020015b60405180910390a250505050565b6001600160a01b037f00000000000000000000000031153f94242de2204a27d9d0e470f70ad7def7f51630036108615760405162461bcd60e51b81526004016105e8906129d2565b7f00000000000000000000000031153f94242de2204a27d9d0e470f70ad7def7f56001600160a01b0316610893611e68565b6001600160a01b0316146108b95760405162461bcd60e51b81526004016105e890612a1e565b6108c281611e96565b604080516000808252602082019092526108de91839190611e9e565b50565b806000036109015760405162461bcd60e51b81526004016105e890612979565b6001600160a01b038216600090815260fc602052604090205460ff168061094457506001600160a01b038216736c3f90f043a72fa612cbac8115ee7e52bde6e490145b6109865760405162461bcd60e51b81526020600482015260136024820152722ab739bab83837b93a32b21039ba30b136329760691b60448201526064016105e8565b61099282333084611fe2565b60006001600160a01b038316736c3f90f043a72fa612cbac8115ee7e52bde6e490146109c9576109c28383612065565b90506109cc565b50805b6109d58161223a565b60006109e0826122b3565b90508060ff60008282546109f49190612a6a565b909155505060fd546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610a4557600080fd5b505af1158015610a59573d6000803e3d6000fd5b50506040518381523392507f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885915060200161080b565b610a97611a3f565b6001600160a01b038116600090815260fc602052604090205460ff16610af65760405162461bcd60e51b81526020600482015260146024820152732a37b5b2b7103737ba1039bab83837b93a32b21760611b60448201526064016105e8565b6040516370a0823160e01b815230600482015260009073689440f2ff927e1f24c72f1087e1faf471ece1c8906370a08231906024016020604051808303816000875af1158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190612960565b9050610b7981611bf4565b6001600160a01b038216600090815260fc6020526040808220549051630d2680e960e11b815260048101849052610100909104600f0b6024820152604481019190915273bebc44782c7db0a1a60cb6fe97d0b483032ff1c790631a4d01d290606401600060405180830381600087803b158015610bf557600080fd5b505af1158015610c09573d6000803e3d6000fd5b5050505060fd60009054906101000a90046001600160a01b03166001600160a01b031663769461986040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561064657600080fd5b610c65611a3f565b60408051808201825260018152600f9290920b60208084019182526001600160a01b03909416600090815260fc90945292209051815492516001600160801b03166101000270ffffffffffffffffffffffffffffffff0019911515919091166001600160881b031990931692909217919091179055565b610ce4611a3f565b6040516370a0823160e01b8152306004820152600090734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b906370a0823190602401602060405180830381865afa158015610d36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5a9190612960565b90508015801590610d6b5750818110155b610db75760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e74204356582062616c616e63652e0000000000000060448201526064016105e8565b610dea734e3fbd56cd56c3e72c1403e103b45db9da5b9d2b73cf50b810e57ac33b91dcf525c6ddd9881b1393328461242e565b60405163534a7e1d60e11b81526004810183905273cf50b810e57ac33b91dcf525c6ddd9881b1393329063a694fc3a9060240161062c565b6001600160a01b037f00000000000000000000000031153f94242de2204a27d9d0e470f70ad7def7f5163003610e6a5760405162461bcd60e51b81526004016105e8906129d2565b7f00000000000000000000000031153f94242de2204a27d9d0e470f70ad7def7f56001600160a01b0316610e9c611e68565b6001600160a01b031614610ec25760405162461bcd60e51b81526004016105e890612a1e565b610ecb82611e96565b610ed782826001611e9e565b5050565b610ee3611a3f565b6040516246613160e11b8152306004820152733fe65692bfcd0e6cf84cb1e7d24108e434a7587e90628cc262906024016020604051808303816000875af1158015610f32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f569190612960565b600003610f755760405162461bcd60e51b81526004016105e890612a7d565b733fe65692bfcd0e6cf84cb1e7d24108e434a7587e6001600160a01b0316633d18b9126040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610fc9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108de9190612aab565b6000306001600160a01b037f00000000000000000000000031153f94242de2204a27d9d0e470f70ad7def7f5161461108d5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016105e8565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b6110ba611a3f565b806000036110da5760405162461bcd60e51b81526004016105e890612979565b6040516370a0823160e01b8152306004820152819073d533a949740bb3306d119cc777fa900ba034cd52906370a0823190602401602060405180830381865afa15801561112b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114f9190612960565b101561119d5760405162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e74204352562062616c616e63652e0000000000000060448201526064016105e8565b6111d073d533a949740bb3306d119cc777fa900ba034cd52738014595f2ab54cd7c604b00e9fb932176fdc86ae8361242e565b60405163203b5c7960e21b81526004810182905260016024820152733fe65692bfcd0e6cf84cb1e7d24108e434a7587e6044820152738014595f2ab54cd7c604b00e9fb932176fdc86ae906380ed71e4906064015b600060405180830381600087803b15801561123f57600080fd5b505af1158015611253573d6000803e3d6000fd5b5050505050565b611262611a3f565b61126c60006124a5565b565b611276611a3f565b6040516370a0823160e01b815230600482015260009073689440f2ff927e1f24c72f1087e1faf471ece1c8906370a08231906024016020604051808303816000875af11580156112ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ee9190612960565b905060006112fd60ff54611a99565b905061130981836129bf565b8311156113585760405162461bcd60e51b815260206004820181905260248201527f43616e6e6f74207769746864726177206261636b696e6720637678334352562e60448201526064016105e8565b61136183611bf4565b505050565b61136e611a3f565b6040516370a0823160e01b8152306004820152600090736c3f90f043a72fa612cbac8115ee7e52bde6e490906370a0823190602401602060405180830381865afa1580156113c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e49190612960565b905080158015906113f55750818110155b6114415760405162461bcd60e51b815260206004820152601a60248201527f496e73756666696369656e7420334352562062616c616e63652e00000000000060448201526064016105e8565b610ed78261223a565b611452611a3f565b6040516246613160e11b815230600482015273689440f2ff927e1f24c72f1087e1faf471ece1c890628cc262906024016020604051808303816000875af11580156114a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c59190612960565b6000036114e45760405162461bcd60e51b81526004016105e890612a7d565b73689440f2ff927e1f24c72f1087e1faf471ece1c86001600160a01b0316633d18b9126040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610fc9573d6000803e3d6000fd5b600054610100900460ff16158080156115585750600054600160ff909116105b806115725750303b158015611572575060005460ff166001145b6115d55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105e8565b6000805460ff1916600117905580156115f8576000805461ff0019166101001790555b3373d3e7a213d97d8c9630cef49e715e1156b03856031461164d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b21031b0b63632b91760891b60448201526064016105e8565b6116556124f7565b60fd80546001600160a01b0319166001600160a01b0384161790558015610ed7576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6116c1611a3f565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611708573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061172c9190612960565b9050610ed7823383611dea565b611741611a3f565b60405133904780156108fc02916000818181858888f193505050501580156108de573d6000803e3d6000fd5b611775611a3f565b6001600160a01b0316600090815260fc6020526040902080546001600160881b0319169055565b6117a4611a3f565b6001600160a01b0381166118095760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e8565b6108de816124a5565b61181a611a3f565b6040516370a0823160e01b8152306004820152600090733fe65692bfcd0e6cf84cb1e7d24108e434a7587e906370a08231906024016020604051808303816000875af115801561186e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118929190612960565b905080158015906118a35750818110155b6118ef5760405162461bcd60e51b815260206004820152601e60248201527f416d6f756e742065786365656473207374616b65642062616c616e63652e000060448201526064016105e8565b604051631c683a1b60e11b81526004810183905260016024820152733fe65692bfcd0e6cf84cb1e7d24108e434a7587e906338d07436906044016020604051808303816000875af1158015611948573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113619190612aab565b611974611a3f565b6040516246613160e11b815230600482015273cf50b810e57ac33b91dcf525c6ddd9881b13933290628cc262906024016020604051808303816000875af11580156119c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e79190612960565b600003611a065760405162461bcd60e51b81526004016105e890612a7d565b60405163a4698feb60e01b8152811515600482015273cf50b810e57ac33b91dcf525c6ddd9881b1393329063a4698feb90602401611225565b6065546001600160a01b0316331461126c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e8565b60408051606081018252600080825260208201819052818301819052915163ecb586a560e01b815273bebc44782c7db0a1a60cb6fe97d0b483032ff1c79163ecb586a591611aeb918591600401612aeb565b600060405180830381600087803b158015611b0557600080fd5b505af1158015611b19573d6000803e3d6000fd5b50505050600073bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b979190612960565b905060fe54811015611bac575060fe54611bb2565b60fe8190555b6000611bcd826ec097ce7bc90715b34b9f1000000000612aff565b9050670de0b6b3a7640000611be28286612b21565b611bec9190612aff565b949350505050565b604051636197390160e11b8152600481018290526001602482015273689440f2ff927e1f24c72f1087e1faf471ece1c89063c32e7202906044015b6020604051808303816000875af1158015611c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed79190612aab565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa158015611cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdf9190612960565b6001600160a01b038516600090815260fc6020526040808220549051630d2680e960e11b815260048101879052610100909104600f0b6024820152604481019190915290915073bebc44782c7db0a1a60cb6fe97d0b483032ff1c790631a4d01d290606401600060405180830381600087803b158015611d5e57600080fd5b505af1158015611d72573d6000803e3d6000fd5b50506040516370a0823160e01b81523060048201528392506001600160a01b03871691506370a0823190602401602060405180830381865afa158015611dbc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611de09190612960565b611bec91906129bf565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080611e625760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b60448201526064016105e8565b50505050565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6108de611a3f565b6000611ea8611e68565b9050611eb384612526565b600083511180611ec05750815b15611ed157611ecf84846125d4565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff1661125357805460ff191660011781556040516001600160a01b0383166024820152611f5090869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b1790526125d4565b50805460ff19168155611f61611e68565b6001600160a01b0316826001600160a01b031614611fd95760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b60648201526084016105e8565b61125385612602565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d11600160005114161716915050806112535760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b60448201526064016105e8565b6040516370a0823160e01b81523060048201526000908190736c3f90f043a72fa612cbac8115ee7e52bde6e490906370a0823190602401602060405180830381865afa1580156120b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120dd9190612960565b90506120fe8473bebc44782c7db0a1a60cb6fe97d0b483032ff1c78561242e565b612106612788565b6001600160a01b038516600090815260fc60205260409020548490829061010090046001600160801b03166003811061214157612141612b38565b6020020152604051634515cef360e01b815273bebc44782c7db0a1a60cb6fe97d0b483032ff1c790634515cef390612180908490600090600401612b4e565b600060405180830381600087803b15801561219a57600080fd5b505af11580156121ae573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152849250736c3f90f043a72fa612cbac8115ee7e52bde6e49091506370a0823190602401602060405180830381865afa158015612203573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122279190612960565b61223191906129bf565b95945050505050565b61226d736c3f90f043a72fa612cbac8115ee7e52bde6e49073f403c135812408bfbe8713b5a23a04b3d48aae318361242e565b6040516321d0683360e11b815260096004820152602481018290526001604482015273f403c135812408bfbe8713b5a23a04b3d48aae31906343a0d06690606401611c2f565b60408051606081018252600080825260208201819052818301819052915163ecb586a560e01b815273bebc44782c7db0a1a60cb6fe97d0b483032ff1c79163ecb586a591612305918591600401612aeb565b600060405180830381600087803b15801561231f57600080fd5b505af1158015612333573d6000803e3d6000fd5b50505050600073bebc44782c7db0a1a60cb6fe97d0b483032ff1c76001600160a01b031663bb7b8b806040518163ffffffff1660e01b81526004016020604051808303816000875af115801561238d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b19190612960565b905060fe548110156124055760405162461bcd60e51b815260206004820152601a60248201527f437572766520696e76617269616e742076696f6c6174696f6e2e00000000000060448201526064016105e8565b60fe819055670de0b6b3a764000061241d8285612b21565b6124279190612aff565b9392505050565b600060405163095ea7b360e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080611e625760405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b60448201526064016105e8565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff1661251e5760405162461bcd60e51b81526004016105e890612b69565b61126c612642565b6001600160a01b0381163b6125935760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016105e8565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60606125f98383604051806060016040528060278152602001612c2860279139612672565b90505b92915050565b61260b81612526565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600054610100900460ff166126695760405162461bcd60e51b81526004016105e890612b69565b61126c336124a5565b6060600080856001600160a01b03168560405161268f9190612bd8565b600060405180830381855af49150503d80600081146126ca576040519150601f19603f3d011682016040523d82523d6000602084013e6126cf565b606091505b50915091506126e0868383876126ea565b9695505050505050565b60608315612759578251600003612752576001600160a01b0385163b6127525760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105e8565b5081611bec565b611bec838381511561276e5781518083602001fd5b8060405162461bcd60e51b81526004016105e89190612bf4565b60405180606001604052806003906020820280368337509192915050565b6000602082840312156127b857600080fd5b5035919050565b80356001600160a01b03811681146127d657600080fd5b919050565b600080604083850312156127ee57600080fd5b6127f7836127bf565b946020939093013593505050565b60006020828403121561281757600080fd5b6125f9826127bf565b6000806040838503121561283357600080fd5b61283c836127bf565b9150602083013580600f0b811461285257600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561288657600080fd5b61288f836127bf565b9150602083013567ffffffffffffffff808211156128ac57600080fd5b818501915085601f8301126128c057600080fd5b8135818111156128d2576128d261285d565b604051601f8201601f19908116603f011681019083821181831017156128fa576128fa61285d565b8160405282815288602084870101111561291357600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b80151581146108de57600080fd5b60006020828403121561295557600080fd5b813561242781612935565b60006020828403121561297257600080fd5b5051919050565b60208082526016908201527520b6b7bab73a1031b0b73737ba103132903d32b9379760511b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b818103818111156125fc576125fc6129a9565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b808201808211156125fc576125fc6129a9565b6020808252601490820152732737903932bbb0b93239903a379031b630b4b69760611b604082015260600190565b600060208284031215612abd57600080fd5b815161242781612935565b8060005b6003811015611e62578151845260209384019390910190600101612acc565b828152608081016124276020830184612ac8565b600082612b1c57634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176125fc576125fc6129a9565b634e487b7160e01b600052603260045260246000fd5b60808101612b5c8285612ac8565b8260608301529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015612bcf578181015183820152602001612bb7565b50506000910152565b60008251612bea818460208701612bb4565b9190910192915050565b6020815260008251806020840152612c13816040850160208701612bb4565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012a1f72c9e3cc2cbef15e1723d1d81bf097839b5e3c84beb9e6276b4cbb226fb64736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.