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
Contract Name:
BendNftPool
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import {IERC20Upgradeable, SafeERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import {IERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import {INftVault} from "./interfaces/INftVault.sol"; import {IStakeManager} from "./interfaces/IStakeManager.sol"; import {INftPool, IStakedNft, IApeCoinStaking} from "./interfaces/INftPool.sol"; import {ICoinPool} from "./interfaces/ICoinPool.sol"; import {IBNFTRegistry} from "./interfaces/IBNFTRegistry.sol"; import {IAddressProviderV2, IPoolLensV2} from "./interfaces/IBendV2Interfaces.sol"; contract BendNftPool is INftPool, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeERC20Upgradeable for ICoinPool; uint256 private constant APE_COIN_PRECISION = 1e18; uint private constant MODULEID__POOL_LENS = 4; IApeCoinStaking public apeCoinStaking; IERC20Upgradeable public apeCoin; mapping(address => PoolState) public poolStates; IStakeManager public override staker; ICoinPool public coinPool; address public bayc; address public mayc; address public bakc; IBNFTRegistry public bnftRegistry; IAddressProviderV2 public v2AddressProvider; address public v2PoolManager; IPoolLensV2 public v2PoolLens; modifier onlyApe(address nft_) { require(bayc == nft_ || mayc == nft_ || bakc == nft_, "BendNftPool: not ape"); _; } modifier onlyApes(address[] calldata nfts_) { address nft_; for (uint256 i = 0; i < nfts_.length; i++) { nft_ = nfts_[i]; require(bayc == nft_ || mayc == nft_ || bakc == nft_, "BendNftPool: not ape"); } _; } modifier onlyStaker() { require(msg.sender == address(staker), "BendNftPool: caller is not staker"); _; } function initialize( IBNFTRegistry bnftRegistry_, IApeCoinStaking apeStaking_, ICoinPool coinPool_, IStakeManager staker_, IStakedNft stBayc_, IStakedNft stMayc_, IStakedNft stBakc_ ) external initializer { __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); apeCoinStaking = apeStaking_; staker = staker_; coinPool = coinPool_; bnftRegistry = bnftRegistry_; bayc = stBayc_.underlyingAsset(); mayc = stMayc_.underlyingAsset(); bakc = stBakc_.underlyingAsset(); poolStates[bayc].stakedNft = stBayc_; poolStates[mayc].stakedNft = stMayc_; poolStates[bakc].stakedNft = stBakc_; apeCoin = IERC20Upgradeable(apeCoinStaking.apeCoin()); apeCoin.approve(address(coinPool), type(uint256).max); } function deposit( address[] calldata nfts_, uint256[][] calldata tokenIds_ ) external override onlyApes(nfts_) nonReentrant whenNotPaused { address nft_; uint256 tokenId_; PoolState storage pool_; _checkDuplicateNfts(nfts_); _checkDuplicateTokenIds(tokenIds_); for (uint256 i = 0; i < nfts_.length; i++) { nft_ = nfts_[i]; pool_ = poolStates[nft_]; _compoundApeCoin(pool_); require(tokenIds_[i].length > 0, "BendNftPool: empty tokenIds"); for (uint256 j = 0; j < tokenIds_[i].length; j++) { tokenId_ = tokenIds_[i][j]; IERC721Upgradeable(nft_).safeTransferFrom(msg.sender, address(staker), tokenId_); pool_.rewardsDebt[tokenId_] = pool_.accumulatedRewardsPerNft; } staker.mintStNft(pool_.stakedNft, msg.sender, tokenIds_[i]); emit NftDeposited(nft_, tokenIds_[i], msg.sender); } } function withdraw( address[] calldata nfts_, uint256[][] calldata tokenIds_ ) external override onlyApes(nfts_) nonReentrant whenNotPaused { _checkDuplicateNfts(nfts_); _checkDuplicateTokenIds(tokenIds_); uint32[][] memory v2PoolIds_ = new uint32[][](0); _claim(msg.sender, msg.sender, nfts_, tokenIds_, v2PoolIds_); PoolState storage pool_; uint256 tokenId_; address nft_; for (uint256 i = 0; i < nfts_.length; i++) { require(tokenIds_[i].length > 0, "BendNftPool: empty tokenIds"); nft_ = nfts_[i]; pool_ = poolStates[nft_]; for (uint256 j = 0; j < tokenIds_[i].length; j++) { tokenId_ = tokenIds_[i][j]; pool_.stakedNft.safeTransferFrom(msg.sender, address(this), tokenId_); } pool_.stakedNft.burn(tokenIds_[i]); for (uint256 j = 0; j < tokenIds_[i].length; j++) { tokenId_ = tokenIds_[i][j]; IERC721Upgradeable(pool_.stakedNft.underlyingAsset()).safeTransferFrom( address(this), msg.sender, tokenId_ ); delete pool_.rewardsDebt[tokenId_]; } emit NftWithdrawn(nft_, tokenIds_[i], msg.sender); } } function _claim( address owner_, address receiver_, address[] calldata nfts_, uint256[][] calldata tokenIds_, uint32[][] memory v2PoolIds_ ) internal { address nft_; PoolState storage pool_; uint256 tokenId_; uint256 claimableShares; uint256 totalClaimableShares; address tokenOwner_; for (uint256 i = 0; i < nfts_.length; i++) { require(tokenIds_[i].length > 0, "BendNftPool: empty tokenIds"); if (v2PoolIds_.length > 0) { require(v2PoolIds_[i].length == tokenIds_[i].length, "BendNftPool: invalid v2PoolIds"); } nft_ = nfts_[i]; pool_ = poolStates[nft_]; (address bnftProxy, ) = bnftRegistry.getBNFTAddresses(address(pool_.stakedNft)); claimableShares = 0; _compoundApeCoin(pool_); for (uint256 j = 0; j < tokenIds_[i].length; j++) { tokenId_ = tokenIds_[i][j]; tokenOwner_ = pool_.stakedNft.ownerOf(tokenId_); if (tokenOwner_ != owner_ && bnftProxy != address(0) && tokenOwner_ == bnftProxy) { tokenOwner_ = IERC721Upgradeable(bnftProxy).ownerOf(tokenId_); } // special case for stNFT deposited in v2 protocol if (v2PoolIds_.length > 0) { if ( tokenOwner_ != owner_ && address(v2PoolManager) != address(0) && tokenOwner_ == address(v2PoolManager) ) { (tokenOwner_, , ) = v2PoolLens.getERC721TokenData( v2PoolIds_[i][j], address(pool_.stakedNft), tokenId_ ); } } require(tokenOwner_ == owner_, "BendNftPool: invalid token owner"); require(pool_.stakedNft.stakerOf(tokenId_) == address(staker), "BendNftPool: invalid token staker"); claimableShares += _calculateRewards(pool_.accumulatedRewardsPerNft, pool_.rewardsDebt[tokenId_]); // set token rewards debt with pool index pool_.rewardsDebt[tokenId_] = pool_.accumulatedRewardsPerNft; } if (claimableShares > 0) { emit NftRewardClaimed( nft_, tokenIds_[i], receiver_, coinPool.previewRedeem(claimableShares), pool_.accumulatedRewardsPerNft ); } totalClaimableShares += claimableShares; } if (totalClaimableShares > 0) { coinPool.redeem(totalClaimableShares, receiver_, address(this)); } } function claim( address[] calldata nfts_, uint256[][] calldata tokenIds_ ) external override onlyApes(nfts_) nonReentrant whenNotPaused { _checkDuplicateNfts(nfts_); _checkDuplicateTokenIds(tokenIds_); uint32[][] memory v2PoolIds_ = new uint32[][](0); _claim(msg.sender, msg.sender, nfts_, tokenIds_, v2PoolIds_); } function claimForBendV2( address[] calldata nfts_, uint256[][] calldata tokenIds_, uint32[][] calldata v2PoolIds_ ) external onlyApes(nfts_) nonReentrant whenNotPaused { _checkDuplicateNfts(nfts_); _checkDuplicateTokenIds(tokenIds_); _claim(msg.sender, msg.sender, nfts_, tokenIds_, v2PoolIds_); } function receiveApeCoin(address nft_, uint256 rewardsAmount_) external override onlyApe(nft_) onlyStaker { apeCoin.safeTransferFrom(msg.sender, address(this), rewardsAmount_); poolStates[nft_].pendingApeCoin += rewardsAmount_; if (rewardsAmount_ > 0) { emit NftRewardDistributed(nft_, rewardsAmount_); } } function _compoundApeCoin(PoolState storage pool_) internal { uint256 rewardsAmount_ = pool_.pendingApeCoin; if (rewardsAmount_ == 0) { return; } uint256 supply = pool_.stakedNft.totalStaked(address(staker)); uint256 accumulatedShare = coinPool.deposit(rewardsAmount_, address(this)); pool_.pendingApeCoin = 0; // In extreme cases all nft give up the earned rewards and exit if (supply > 0) { pool_.accumulatedRewardsPerNft = _calculatePoolIndex( pool_.accumulatedRewardsPerNft, accumulatedShare, supply ); } } function compoundApeCoin(address nft_) external override onlyApe(nft_) onlyStaker { _compoundApeCoin(poolStates[nft_]); } function pendingApeCoin(address nft_) external view returns (uint256) { return poolStates[nft_].pendingApeCoin; } function claimable( address[] calldata nfts_, uint256[][] calldata tokenIds_ ) external view override onlyApes(nfts_) returns (uint256 amount) { PoolState storage pool_; address nft_; uint256 accumulatedRewardsPerNft_; _checkDuplicateNfts(nfts_); _checkDuplicateTokenIds(tokenIds_); for (uint256 i = 0; i < nfts_.length; i++) { nft_ = nfts_[i]; pool_ = poolStates[nft_]; accumulatedRewardsPerNft_ = pool_.accumulatedRewardsPerNft; if (pool_.stakedNft.totalStaked(address(staker)) > 0) { accumulatedRewardsPerNft_ = _calculatePoolIndex( accumulatedRewardsPerNft_, coinPool.previewDeposit(pool_.pendingApeCoin), pool_.stakedNft.totalStaked(address(staker)) ); } for (uint256 j = 0; j < tokenIds_[i].length; j++) { amount += _calculateRewards(accumulatedRewardsPerNft_, pool_.rewardsDebt[tokenIds_[i][j]]); } } if (amount != 0) { amount = coinPool.previewRedeem(amount); } } function _calculateRewards( uint256 accumulatedRewardsPerNft, uint256 rewardDebt ) internal pure returns (uint256 rewards) { if (accumulatedRewardsPerNft > rewardDebt) { rewards = (accumulatedRewardsPerNft - rewardDebt) / APE_COIN_PRECISION; } } function _calculatePoolIndex( uint256 accumulatedRewardsPerNft, uint256 accumulatedShare, uint256 nftSupply ) internal pure returns (uint256 rewards) { return accumulatedRewardsPerNft + ((accumulatedShare * APE_COIN_PRECISION) / nftSupply); } function _checkDuplicateNfts(address[] calldata nfts_) internal pure { for (uint256 i = 0; i < nfts_.length; i++) { for (uint256 j = i + 1; j < nfts_.length; j++) { require(nfts_[i] != nfts_[j], "BendNftPool: duplicate nfts"); } } } function _checkDuplicateTokenIds(uint256[][] calldata tokenIds_) internal pure { for (uint256 i = 0; i < tokenIds_.length; i++) { for (uint256 j = 0; j < tokenIds_[i].length; j++) { for (uint256 k = j + 1; k < tokenIds_[i].length; k++) { require(tokenIds_[i][j] != tokenIds_[i][k], "BendNftPool: duplicate tokenIds"); } } } } function getPoolStateUI(address nft_) external view returns (PoolUI memory poolUI) { PoolState storage pool = poolStates[nft_]; poolUI.totalStakedNft = pool.stakedNft.totalStaked(address(staker)); poolUI.accumulatedRewardsPerNft = pool.accumulatedRewardsPerNft; poolUI.pendingApeCoin = pool.pendingApeCoin; } function getNftStateUI(address nft_, uint256 tokenId) external view returns (uint256 rewardsDebt) { PoolState storage pool = poolStates[nft_]; rewardsDebt = pool.rewardsDebt[tokenId]; } function onERC721Received( address /*operator*/, address /*from*/, uint256 /*tokenId*/, bytes calldata /*data*/ ) external view returns (bytes4) { bool isValidNFT = (bayc == msg.sender || mayc == msg.sender || bakc == msg.sender); if (!isValidNFT) { isValidNFT = (address(poolStates[bayc].stakedNft) == msg.sender || address(poolStates[mayc].stakedNft) == msg.sender || address(poolStates[bakc].stakedNft) == msg.sender); } require(isValidNFT, "BendNftPool: not ape nft"); return this.onERC721Received.selector; } function setPause(bool flag) public onlyOwner { if (flag) { _pause(); } else { _unpause(); } } function setV2AddressProvider(address v2Provider_) public onlyOwner { v2AddressProvider = IAddressProviderV2(v2Provider_); v2PoolManager = v2AddressProvider.getPoolManager(); v2PoolLens = IPoolLensV2(v2AddressProvider.getPoolModuleProxy(MODULEID__POOL_LENS)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { 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 in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (interfaces/IERC4626.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20Upgradeable.sol"; import "../token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; /** * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626]. * * _Available since v4.7._ */ interface IERC4626Upgradeable is IERC20Upgradeable, IERC20MetadataUpgradeable { event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares); event Withdraw( address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares ); /** * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. * * - MUST be an ERC-20 token contract. * - MUST NOT revert. */ function asset() external view returns (address assetTokenAddress); /** * @dev Returns the total amount of the underlying asset that is “managed” by Vault. * * - SHOULD include any compounding that occurs from yield. * - MUST be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT revert. */ function totalAssets() external view returns (uint256 totalManagedAssets); /** * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToShares(uint256 assets) external view returns (uint256 shares); /** * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal * scenario where all the conditions are met. * * - MUST NOT be inclusive of any fees that are charged against assets in the Vault. * - MUST NOT show any variations depending on the caller. * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. * - MUST NOT revert. * * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and * from. */ function convertToAssets(uint256 shares) external view returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, * through a deposit call. * * - MUST return a limited value if receiver is subject to some deposit limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited. * - MUST NOT revert. */ function maxDeposit(address receiver) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given * current on-chain conditions. * * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called * in the same transaction. * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the * deposit would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewDeposit(uint256 assets) external view returns (uint256 shares); /** * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * deposit execution, and are accounted for during deposit. * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function deposit(uint256 assets, address receiver) external returns (uint256 shares); /** * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call. * - MUST return a limited value if receiver is subject to some mint limit. * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted. * - MUST NOT revert. */ function maxMint(address receiver) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given * current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the * same transaction. * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint * would be accepted, regardless if the user has enough tokens approved, etc. * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by minting. */ function previewMint(uint256 shares) external view returns (uint256 assets); /** * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens. * * - MUST emit the Deposit event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint * execution, and are accounted for during mint. * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not * approving enough underlying tokens to the Vault contract, etc). * * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token. */ function mint(uint256 shares, address receiver) external returns (uint256 assets); /** * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the * Vault, through a withdraw call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST NOT revert. */ function maxWithdraw(address owner) external view returns (uint256 maxAssets); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block, * given current on-chain conditions. * * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if * called * in the same transaction. * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though * the withdrawal would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by depositing. */ function previewWithdraw(uint256 assets) external view returns (uint256 shares); /** * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * withdraw execution, and are accounted for during withdraw. * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function withdraw( uint256 assets, address receiver, address owner ) external returns (uint256 shares); /** * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, * through a redeem call. * * - MUST return a limited value if owner is subject to some withdrawal limit or timelock. * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock. * - MUST NOT revert. */ function maxRedeem(address owner) external view returns (uint256 maxShares); /** * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block, * given current on-chain conditions. * * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the * same transaction. * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the * redemption would be accepted, regardless if the user has enough shares, etc. * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees. * - MUST NOT revert. * * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in * share price or some other type of condition, meaning the depositor will lose assets by redeeming. */ function previewRedeem(uint256 shares) external view returns (uint256 assets); /** * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. * * - MUST emit the Withdraw event. * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the * redeem execution, and are accounted for during redeem. * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner * not having enough shares, etc). * * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. * Those methods should be performed separately. */ function redeem( uint256 shares, address receiver, address owner ) external returns (uint256 assets); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../token/ERC721/extensions/IERC721MetadataUpgradeable.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Receiver.sol) pragma solidity ^0.8.0; import "../token/ERC721/IERC721ReceiverUpgradeable.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.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) || (!AddressUpgradeable.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 Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @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 // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20PermitUpgradeable token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/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 ContextUpgradeable 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 in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; interface IApeCoinStaking { struct SingleNft { uint32 tokenId; uint224 amount; } struct PairNft { uint128 mainTokenId; uint128 bakcTokenId; } struct PairNftDepositWithAmount { uint32 mainTokenId; uint32 bakcTokenId; uint184 amount; } struct PairNftWithdrawWithAmount { uint32 mainTokenId; uint32 bakcTokenId; uint184 amount; bool isUncommit; } struct Position { uint256 stakedAmount; int256 rewardsDebt; } struct Pool { uint48 lastRewardedTimestampHour; uint16 lastRewardsRangeIndex; uint96 stakedAmount; uint96 accumulatedRewardsPerShare; TimeRange[] timeRanges; } struct TimeRange { uint48 startTimestampHour; uint48 endTimestampHour; uint96 rewardsPerHour; uint96 capPerPosition; } struct PoolWithoutTimeRange { uint48 lastRewardedTimestampHour; uint16 lastRewardsRangeIndex; uint96 stakedAmount; uint96 accumulatedRewardsPerShare; } struct DashboardStake { uint256 poolId; uint256 tokenId; uint256 deposited; uint256 unclaimed; uint256 rewards24hr; DashboardPair pair; } struct DashboardPair { uint256 mainTokenId; uint256 mainTypePoolId; } struct PoolUI { uint256 poolId; uint256 stakedAmount; TimeRange currentTimeRange; } struct PairingStatus { uint248 tokenId; bool isPaired; } function mainToBakc(uint256 poolId_, uint256 mainTokenId_) external view returns (PairingStatus memory); function bakcToMain(uint256 poolId_, uint256 bakcTokenId_) external view returns (PairingStatus memory); function nftContracts(uint256 poolId_) external view returns (address); function rewardsBy(uint256 poolId_, uint256 from_, uint256 to_) external view returns (uint256, uint256); function apeCoin() external view returns (address); function getCurrentTimeRangeIndex(Pool memory pool_) external view returns (uint256); function getTimeRangeBy(uint256 poolId_, uint256 index_) external view returns (TimeRange memory); function getPoolsUI() external view returns (PoolUI memory, PoolUI memory, PoolUI memory, PoolUI memory); function getSplitStakes(address address_) external view returns (DashboardStake[] memory); function stakedTotal(address addr_) external view returns (uint256); function pools(uint256 poolId_) external view returns (PoolWithoutTimeRange memory); function nftPosition(uint256 poolId_, uint256 tokenId_) external view returns (Position memory); function addressPosition(address addr_) external view returns (Position memory); function pendingRewards(uint256 poolId_, address address_, uint256 tokenId_) external view returns (uint256); function depositBAYC(SingleNft[] calldata nfts_) external; function depositMAYC(SingleNft[] calldata nfts_) external; function depositBAKC( PairNftDepositWithAmount[] calldata baycPairs_, PairNftDepositWithAmount[] calldata maycPairs_ ) external; function depositSelfApeCoin(uint256 amount_) external; function claimSelfApeCoin() external; function claimBAYC(uint256[] calldata nfts_, address recipient_) external; function claimMAYC(uint256[] calldata nfts_, address recipient_) external; function claimBAKC(PairNft[] calldata baycPairs_, PairNft[] calldata maycPairs_, address recipient_) external; function withdrawBAYC(SingleNft[] calldata nfts_, address recipient_) external; function withdrawMAYC(SingleNft[] calldata nfts_, address recipient_) external; function withdrawBAKC( PairNftWithdrawWithAmount[] calldata baycPairs_, PairNftWithdrawWithAmount[] calldata maycPairs_ ) external; function withdrawSelfApeCoin(uint256 amount_) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; interface IAddressProviderV2 { function getPoolManager() external view returns (address); function getPoolModuleProxy(uint moduleId) external view returns (address); } interface IPoolLensV2 { function getUserAssetData( address user, uint32 poolId, address asset ) external view returns ( uint256 totalCrossSupply, uint256 totalIsolateSupply, uint256 totalCrossBorrow, uint256 totalIsolateBorrow ); function getERC721TokenData( uint32 poolId, address asset, uint256 tokenId ) external view returns (address, uint8, address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; interface IBNFTRegistry { function getBNFTAddresses(address nftAsset) external view returns (address bNftProxy, address bNftImpl); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import {IERC4626Upgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC4626Upgradeable.sol"; interface ICoinPool is IERC4626Upgradeable { event RewardDistributed(uint256 rewardAmount); function mintSelf(uint256 shares) external returns (uint256); function depositSelf(uint256 assets) external returns (uint256); function withdrawSelf(uint256 assets) external returns (uint256); function redeemSelf(uint256 shares) external returns (uint256); function pendingApeCoin() external view returns (uint256); function assetBalanceOf(address account_) external view returns (uint256); function pullApeCoin(uint256 amount_) external; function receiveApeCoin(uint256 principalAmount, uint256 rewardsAmount_) external; }
// SPDX-License-Identifier: CC0-1.0 pragma solidity 0.8.18; /** * @title IDelegateRegistryV2 * @custom:version 2.0 * @custom:author foobar (0xfoobar) * @notice A standalone immutable registry storing delegated permissions from one address to another */ interface IDelegateRegistryV2 { /// @notice Delegation type, NONE is used when a delegation does not exist or is revoked enum DelegationType { NONE, ALL, CONTRACT, ERC721, ERC20, ERC1155 } /// @notice Struct for returning delegations struct Delegation { DelegationType type_; address to; address from; bytes32 rights; address contract_; uint256 tokenId; uint256 amount; } /** * ----------- WRITE ----------- */ /** * @notice Allow the delegate to act on behalf of `msg.sender` for a specific ERC721 token * @param to The address to act as delegate * @param contract_ The contract whose rights are being delegated * @param tokenId The token id to delegate * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights * @param enable Whether to enable or disable this delegation, true delegates and false revokes * @return delegationHash The unique identifier of the delegation */ function delegateERC721( address to, address contract_, uint256 tokenId, bytes32 rights, bool enable ) external payable returns (bytes32 delegationHash); /** * ----------- ENUMERATIONS ----------- */ /** * @notice Returns all enabled delegations an address has given out * @param from The address to retrieve delegations for * @return delegations Array of Delegation structs */ function getOutgoingDelegations(address from) external view returns (Delegation[] memory delegations); /** * @notice Returns the delegations for a given array of delegation hashes * @param delegationHashes is an array of hashes that correspond to delegations * @return delegations Array of Delegation structs, return empty structs for nonexistent or revoked delegations */ function getDelegationsFromHashes( bytes32[] calldata delegationHashes ) external view returns (Delegation[] memory delegations); }
// SPDX-License-Identifier: CC0-1.0 pragma solidity 0.8.18; /** * @title An immutable registry contract to be deployed as a standalone primitive * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations * from here and integrate those permissions into their flow */ interface IDelegationRegistry { /// @notice Delegation type enum DelegationType { NONE, ALL, CONTRACT, TOKEN } /// @notice Info about a single delegation, used for onchain enumeration struct DelegationInfo { DelegationType type_; address vault; address delegate; address contract_; uint256 tokenId; } /// @notice Info about a single contract-level delegation struct ContractDelegation { address contract_; address delegate; } /// @notice Info about a single token-level delegation struct TokenDelegation { address contract_; uint256 tokenId; address delegate; } /// @notice Emitted when a user delegates their entire wallet event DelegateForAll(address vault, address delegate, bool value); /// @notice Emitted when a user delegates a specific contract event DelegateForContract(address vault, address delegate, address contract_, bool value); /// @notice Emitted when a user delegates a specific token event DelegateForToken(address vault, address delegate, address contract_, uint256 tokenId, bool value); /// @notice Emitted when a user revokes all delegations event RevokeAllDelegates(address vault); /// @notice Emitted when a user revoes all delegations for a given delegate event RevokeDelegate(address vault, address delegate); /** * ----------- WRITE ----------- */ /** * @notice Allow the delegate to act on your behalf for all contracts * @param delegate The hotwallet to act on your behalf * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForAll(address delegate, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific contract * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForContract(address delegate, address contract_, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific token * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external; /** * @notice Revoke all delegates */ function revokeAllDelegates() external; /** * @notice Revoke a specific delegate for all their permissions * @param delegate The hotwallet to revoke */ function revokeDelegate(address delegate) external; /** * @notice Remove yourself as a delegate for a specific vault * @param vault The vault which delegated to the msg.sender, and should be removed */ function revokeSelf(address vault) external; /** * ----------- READ ----------- */ /** * @notice Returns all active delegations a given delegate is able to claim on behalf of * @param delegate The delegate that you would like to retrieve delegations for * @return info Array of DelegationInfo structs */ function getDelegationsByDelegate(address delegate) external view returns (DelegationInfo[] memory); /** * @notice Returns an array of wallet-level delegates for a given vault * @param vault The cold wallet who issued the delegation * @return addresses Array of wallet-level delegates for a given vault */ function getDelegatesForAll(address vault) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault and contract * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract you're delegating * @return addresses Array of contract-level delegates for a given vault and contract */ function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault's token * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract holding the token * @param tokenId The token id for the token you're delegating * @return addresses Array of contract-level delegates for a given vault's token */ function getDelegatesForToken( address vault, address contract_, uint256 tokenId ) external view returns (address[] memory); /** * @notice Returns all contract-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of ContractDelegation structs */ function getContractLevelDelegations(address vault) external view returns (ContractDelegation[] memory delegations); /** * @notice Returns all token-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of TokenDelegation structs */ function getTokenLevelDelegations(address vault) external view returns (TokenDelegation[] memory delegations); /** * @notice Returns true if the address is delegated to act on the entire vault * @param delegate The hotwallet to act on your behalf * @param vault The cold wallet who issued the delegation */ function checkDelegateForAll(address delegate, address vault) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForContract(address delegate, address vault, address contract_) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForToken( address delegate, address vault, address contract_, uint256 tokenId ) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import {IApeCoinStaking} from "./IApeCoinStaking.sol"; import {IStakeManager} from "./IStakeManager.sol"; import {IStakedNft} from "./IStakedNft.sol"; interface INftPool { event NftRewardDistributed(address indexed nft, uint256 rewardAmount); event NftRewardClaimed( address indexed nft, uint256[] tokenIds, address indexed receiver, uint256 amount, uint256 rewardsDebt ); event NftDeposited(address indexed nft, uint256[] tokenIds, address indexed owner); event NftWithdrawn(address indexed nft, uint256[] tokenIds, address indexed owner); struct PoolState { IStakedNft stakedNft; uint256 accumulatedRewardsPerNft; mapping(uint256 => uint256) rewardsDebt; uint256 pendingApeCoin; } struct PoolUI { uint256 totalStakedNft; uint256 accumulatedRewardsPerNft; uint256 pendingApeCoin; } function claimable(address[] calldata nfts_, uint256[][] calldata tokenIds_) external view returns (uint256); function staker() external view returns (IStakeManager); function deposit(address[] calldata nfts_, uint256[][] calldata tokenIds_) external; function withdraw(address[] calldata nfts_, uint256[][] calldata tokenIds_) external; function claim(address[] calldata nfts_, uint256[][] calldata tokenIds_) external; function receiveApeCoin(address nft_, uint256 rewardsAmount_) external; function compoundApeCoin(address nft_) external; function pendingApeCoin(address nft_) external view returns (uint256); function getPoolStateUI(address nft_) external view returns (PoolUI memory); function getNftStateUI(address nft_, uint256 tokenId) external view returns (uint256 rewardsDebt); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import {EnumerableSetUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol"; import {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import {IERC721ReceiverUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol"; import {IApeCoinStaking} from "./IApeCoinStaking.sol"; import {IDelegationRegistry} from "../interfaces/IDelegationRegistry.sol"; import {IDelegateRegistryV2} from "../interfaces/IDelegateRegistryV2.sol"; interface INftVault is IERC721ReceiverUpgradeable { event NftDeposited(address indexed nft, address indexed owner, address indexed staker, uint256[] tokenIds); event NftWithdrawn(address indexed nft, address indexed owner, address indexed staker, uint256[] tokenIds); event SingleNftStaked(address indexed nft, address indexed staker, IApeCoinStaking.SingleNft[] nfts); event PairedNftStaked( address indexed staker, IApeCoinStaking.PairNftDepositWithAmount[] baycPairs, IApeCoinStaking.PairNftDepositWithAmount[] maycPairs ); event SingleNftUnstaked(address indexed nft, address indexed staker, IApeCoinStaking.SingleNft[] nfts); event PairedNftUnstaked( address indexed staker, IApeCoinStaking.PairNftWithdrawWithAmount[] baycPairs, IApeCoinStaking.PairNftWithdrawWithAmount[] maycPairs ); event SingleNftClaimed(address indexed nft, address indexed staker, uint256[] tokenIds, uint256 rewards); event PairedNftClaimed( address indexed staker, IApeCoinStaking.PairNft[] baycPairs, IApeCoinStaking.PairNft[] maycPairs, uint256 rewards ); struct NftStatus { address owner; address staker; } struct VaultStorage { // nft address => nft tokenId => nftStatus mapping(address => mapping(uint256 => NftStatus)) nfts; // nft address => staker address => refund mapping(address => mapping(address => Refund)) refunds; // nft address => staker address => position mapping(address => mapping(address => Position)) positions; // nft address => staker address => staking nft tokenId array mapping(address => mapping(address => EnumerableSetUpgradeable.UintSet)) stakingTokenIds; IApeCoinStaking apeCoinStaking; IERC20Upgradeable apeCoin; address bayc; address mayc; address bakc; IDelegationRegistry delegationRegistry; mapping(address => bool) authorized; IDelegateRegistryV2 delegationRegistryV2; } struct Refund { uint256 principal; uint256 reward; } struct Position { uint256 stakedAmount; int256 rewardsDebt; } function authorise(address addr_, bool authorized_) external; function stakerOf(address nft_, uint256 tokenId_) external view returns (address); function ownerOf(address nft_, uint256 tokenId_) external view returns (address); function refundOf(address nft_, address staker_) external view returns (Refund memory); function positionOf(address nft_, address staker_) external view returns (Position memory); function pendingRewards(address nft_, address staker_) external view returns (uint256); function totalStakingNft(address nft_, address staker_) external view returns (uint256); function stakingNftIdByIndex(address nft_, address staker_, uint256 index_) external view returns (uint256); function isStaking(address nft_, address staker_, uint256 tokenId_) external view returns (bool); // delegate.cash V1 function setDelegateCash(address delegate_, address nft_, uint256[] calldata tokenIds, bool value) external; function getDelegateCashForToken( address nft_, uint256[] calldata tokenIds_ ) external view returns (address[][] memory); // delegate.cash V2 function setDelegateCashV2(address delegate_, address nft_, uint256[] calldata tokenIds, bool value) external; function getDelegateCashForTokenV2( address nft_, uint256[] calldata tokenIds_ ) external view returns (address[][] memory); // deposit nft function depositNft(address nft_, uint256[] calldata tokenIds_, address staker_) external; // withdraw nft function withdrawNft(address nft_, uint256[] calldata tokenIds_) external; // staker withdraw ape coin function withdrawRefunds(address nft_) external; // stake function stakeBaycPool(IApeCoinStaking.SingleNft[] calldata nfts_) external; function stakeMaycPool(IApeCoinStaking.SingleNft[] calldata nfts_) external; function stakeBakcPool( IApeCoinStaking.PairNftDepositWithAmount[] calldata baycPairs_, IApeCoinStaking.PairNftDepositWithAmount[] calldata maycPairs_ ) external; // unstake function unstakeBaycPool( IApeCoinStaking.SingleNft[] calldata nfts_, address recipient_ ) external returns (uint256 principal, uint256 rewards); function unstakeMaycPool( IApeCoinStaking.SingleNft[] calldata nfts_, address recipient_ ) external returns (uint256 principal, uint256 rewards); function unstakeBakcPool( IApeCoinStaking.PairNftWithdrawWithAmount[] calldata baycPairs_, IApeCoinStaking.PairNftWithdrawWithAmount[] calldata maycPairs_, address recipient_ ) external returns (uint256 principal, uint256 rewards); // claim rewards function claimBaycPool(uint256[] calldata tokenIds_, address recipient_) external returns (uint256 rewards); function claimMaycPool(uint256[] calldata tokenIds_, address recipient_) external returns (uint256 rewards); function claimBakcPool( IApeCoinStaking.PairNft[] calldata baycPairs_, IApeCoinStaking.PairNft[] calldata maycPairs_, address recipient_ ) external returns (uint256 rewards); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; interface IRewardsStrategy { function getNftRewardsShare() external view returns (uint256 nftShare); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import {IERC721MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol"; import {IERC721ReceiverUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC721ReceiverUpgradeable.sol"; import {IERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC721EnumerableUpgradeable.sol"; interface IStakedNft is IERC721MetadataUpgradeable, IERC721ReceiverUpgradeable, IERC721EnumerableUpgradeable { event Minted(address indexed to, uint256[] tokenId); event Burned(address indexed from, uint256[] tokenId); function authorise(address addr_, bool authorized_) external; function mint(address to, uint256[] calldata tokenIds) external; function burn(uint256[] calldata tokenIds) external; /** * @dev Returns the staker of the `tokenId` token. */ function stakerOf(uint256 tokenId) external view returns (address); /** * @dev Returns a token ID owned by `staker` at a given `index` of its token list. * Use along with {totalStaked} to enumerate all of ``staker``'s tokens. */ function tokenOfStakerByIndex(address staker, uint256 index) external view returns (uint256); /** * @dev Returns the total staked amount of tokens for staker. */ function totalStaked(address staker) external view returns (uint256); function underlyingAsset() external view returns (address); function setBnftRegistry(address bnftRegistry_) external; function setDelegateCash(address delegate, uint256[] calldata tokenIds, bool value) external; function getDelegateCashForToken(uint256[] calldata tokenIds_) external view returns (address[][] memory); function setDelegateCashV2(address delegate, uint256[] calldata tokenIds, bool value) external; function getDelegateCashForTokenV2(uint256[] calldata tokenIds_) external view returns (address[][] memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; import {IApeCoinStaking} from "./IApeCoinStaking.sol"; import {IRewardsStrategy} from "./IRewardsStrategy.sol"; import {IWithdrawStrategy} from "./IWithdrawStrategy.sol"; import {IStakedNft} from "./IStakedNft.sol"; interface IStakeManager { event FeeRatioChanged(uint256 newRatio); event FeeRecipientChanged(address newRecipient); event BotAdminChanged(address newAdmin); event RewardsStrategyChanged(address nft, address newStrategy); event WithdrawStrategyChanged(address newStrategy); event Compounded(bool isClaimCoinPool, uint256 claimedNfts); function stBayc() external view returns (IStakedNft); function stMayc() external view returns (IStakedNft); function stBakc() external view returns (IStakedNft); function totalStakedApeCoin() external view returns (uint256); function totalPendingRewards() external view returns (uint256); function totalRefund() external view returns (uint256 principal, uint256 reward); function refundOf(address nft_) external view returns (uint256 principal, uint256 reward); function stakedApeCoin(uint256 poolId_) external view returns (uint256); function pendingRewards(uint256 poolId_) external view returns (uint256); function pendingFeeAmount() external view returns (uint256); function fee() external view returns (uint256); function feeRecipient() external view returns (address); function updateFee(uint256 fee_) external; function updateFeeRecipient(address recipient_) external; // bot function updateBotAdmin(address bot_) external; // strategy function updateRewardsStrategy(address nft_, IRewardsStrategy rewardsStrategy_) external; function rewardsStrategies(address nft_) external view returns (IRewardsStrategy); function getNftRewardsShare(address nft_) external view returns (uint256 nftShare); function updateWithdrawStrategy(IWithdrawStrategy withdrawStrategy_) external; function withdrawApeCoin(uint256 required) external returns (uint256); function mintStNft(IStakedNft stNft_, address to_, uint256[] calldata tokenIds_) external; // staking function calculateFee(uint256 rewardsAmount_) external view returns (uint256 feeAmount); function stakeApeCoin(uint256 amount_) external; function unstakeApeCoin(uint256 amount_) external; function claimApeCoin() external; function stakeBayc(uint256[] calldata tokenIds_) external; function unstakeBayc(uint256[] calldata tokenIds_) external; function claimBayc(uint256[] calldata tokenIds_) external; function stakeMayc(uint256[] calldata tokenIds_) external; function unstakeMayc(uint256[] calldata tokenIds_) external; function claimMayc(uint256[] calldata tokenIds_) external; function stakeBakc( IApeCoinStaking.PairNft[] calldata baycPairs_, IApeCoinStaking.PairNft[] calldata maycPairs_ ) external; function unstakeBakc( IApeCoinStaking.PairNft[] calldata baycPairs_, IApeCoinStaking.PairNft[] calldata maycPairs_ ) external; function claimBakc( IApeCoinStaking.PairNft[] calldata baycPairs_, IApeCoinStaking.PairNft[] calldata maycPairs_ ) external; function withdrawRefund(address nft_) external; function withdrawTotalRefund() external; struct NftArgs { uint256[] bayc; uint256[] mayc; IApeCoinStaking.PairNft[] baycPairs; IApeCoinStaking.PairNft[] maycPairs; } struct CompoundArgs { bool claimCoinPool; NftArgs claim; NftArgs unstake; NftArgs stake; uint256 coinStakeThreshold; } function compound(CompoundArgs calldata args_) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.18; interface IWithdrawStrategy { function withdrawApeCoin(uint256 required) external returns (uint256 withdrawn); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"NftDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardsDebt","type":"uint256"}],"name":"NftRewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"NftRewardDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"NftWithdrawn","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"apeCoin","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"apeCoinStaking","outputs":[{"internalType":"contract IApeCoinStaking","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bakc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bayc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bnftRegistry","outputs":[{"internalType":"contract IBNFTRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"nfts_","type":"address[]"},{"internalType":"uint256[][]","name":"tokenIds_","type":"uint256[][]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"nfts_","type":"address[]"},{"internalType":"uint256[][]","name":"tokenIds_","type":"uint256[][]"},{"internalType":"uint32[][]","name":"v2PoolIds_","type":"uint32[][]"}],"name":"claimForBendV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"nfts_","type":"address[]"},{"internalType":"uint256[][]","name":"tokenIds_","type":"uint256[][]"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coinPool","outputs":[{"internalType":"contract ICoinPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft_","type":"address"}],"name":"compoundApeCoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"nfts_","type":"address[]"},{"internalType":"uint256[][]","name":"tokenIds_","type":"uint256[][]"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nft_","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getNftStateUI","outputs":[{"internalType":"uint256","name":"rewardsDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft_","type":"address"}],"name":"getPoolStateUI","outputs":[{"components":[{"internalType":"uint256","name":"totalStakedNft","type":"uint256"},{"internalType":"uint256","name":"accumulatedRewardsPerNft","type":"uint256"},{"internalType":"uint256","name":"pendingApeCoin","type":"uint256"}],"internalType":"struct INftPool.PoolUI","name":"poolUI","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBNFTRegistry","name":"bnftRegistry_","type":"address"},{"internalType":"contract IApeCoinStaking","name":"apeStaking_","type":"address"},{"internalType":"contract ICoinPool","name":"coinPool_","type":"address"},{"internalType":"contract IStakeManager","name":"staker_","type":"address"},{"internalType":"contract IStakedNft","name":"stBayc_","type":"address"},{"internalType":"contract IStakedNft","name":"stMayc_","type":"address"},{"internalType":"contract IStakedNft","name":"stBakc_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mayc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft_","type":"address"}],"name":"pendingApeCoin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolStates","outputs":[{"internalType":"contract IStakedNft","name":"stakedNft","type":"address"},{"internalType":"uint256","name":"accumulatedRewardsPerNft","type":"uint256"},{"internalType":"uint256","name":"pendingApeCoin","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft_","type":"address"},{"internalType":"uint256","name":"rewardsAmount_","type":"uint256"}],"name":"receiveApeCoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"flag","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"v2Provider_","type":"address"}],"name":"setV2AddressProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"staker","outputs":[{"internalType":"contract IStakeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"v2AddressProvider","outputs":[{"internalType":"contract IAddressProviderV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2PoolLens","outputs":[{"internalType":"contract IPoolLensV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"v2PoolManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"nfts_","type":"address[]"},{"internalType":"uint256[][]","name":"tokenIds_","type":"uint256[][]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061369d806100206000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c8063a80679c311610104578063c9112a77116100a2578063f2fde38b11610071578063f2fde38b14610493578063f4ea77f3146104a6578063fa5f81e4146104b9578063ff5e653e146104ee57600080fd5b8063c9112a77146103fc578063d234173d1461040f578063dc047a6a14610422578063de5222841461043557600080fd5b8063b8e851a3116100de578063b8e851a3146103b0578063bedb86fb146103c3578063c09e5cc2146103d6578063c85423d3146103e957600080fd5b8063a80679c314610377578063ac7ad9ba1461038a578063ae4ae1c01461039d57600080fd5b80636b4ad1421161017c57806388ad544a1161014b57806388ad544a1461032d5780638da5cb5b1461034057806390672ad8146103515780639b00f5521461036457600080fd5b80636b4ad142146102d3578063715018a6146102ff5780637685807d146103075780637c367f921461031a57600080fd5b8063365c1031116101b8578063365c1031146102505780635bcd9b07146102635780635c975abb146102aa5780635ebaf1db146102c057600080fd5b8063150b7a02146101df5780631ab95b9d14610210578063358764761461023b575b600080fd5b6101f26101ed366004612e22565b610501565b6040516001600160e01b031990911681526020015b60405180910390f35b60d054610223906001600160a01b031681565b6040516001600160a01b039091168152602001610207565b61024e610249366004612ec1565b61061b565b005b61024e61025e366004612f57565b610a50565b61029c610271366004612f7b565b6001600160a01b03909116600090815260cb6020908152604080832093835260029093019052205490565b604051908152602001610207565b60655460ff166040519015158152602001610207565b60cc54610223906001600160a01b031681565b61029c6102e1366004612f57565b6001600160a01b0316600090815260cb602052604090206003015490565b61024e610afe565b60ce54610223906001600160a01b031681565b61024e610328366004612ff3565b610b12565b60d254610223906001600160a01b031681565b6033546001600160a01b0316610223565b61024e61035f366004612ff3565b61100b565b60d354610223906001600160a01b031681565b61029c610385366004612ff3565b61111f565b60ca54610223906001600160a01b031681565b61024e6103ab366004612ff3565b6114de565b60d154610223906001600160a01b031681565b61024e6103d136600461306d565b611864565b61024e6103e4366004612f7b565b611885565b60d454610223906001600160a01b031681565b60c954610223906001600160a01b031681565b61024e61041d36600461308a565b6119a5565b61024e610430366004612f57565b611a9e565b61046e610443366004612f57565b60cb602052600090815260409020805460018201546003909201546001600160a01b03909116919083565b604080516001600160a01b039094168452602084019290925290820152606001610207565b61024e6104a1366004612f57565b611bc5565b60cd54610223906001600160a01b031681565b6104cc6104c7366004612f57565b611c3b565b6040805182518152602080840151908201529181015190820152606001610207565b60cf54610223906001600160a01b031681565b60ce5460009081906001600160a01b0316331480610529575060cf546001600160a01b031633145b8061053e575060d0546001600160a01b031633145b9050806105b65760ce546001600160a01b03908116600090815260cb60205260409020541633148061058c575060cf546001600160a01b03908116600090815260cb60205260409020541633145b806105b3575060d0546001600160a01b03908116600090815260cb60205260409020541633145b90505b806106085760405162461bcd60e51b815260206004820152601860248201527f42656e644e6674506f6f6c3a206e6f7420617065206e6674000000000000000060448201526064015b60405180910390fd5b50630a85bd0160e11b9695505050505050565b600054610100900460ff161580801561063b5750600054600160ff909116105b806106555750303b158015610655575060005460ff166001145b6106b85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ff565b6000805460ff1916600117905580156106db576000805461ff0019166101001790555b6106e3611cfb565b6106eb611d2a565b6106f3611d59565b60c980546001600160a01b03199081166001600160a01b038a81169190911790925560cc8054821688841617905560cd8054821689841617905560d180549091168a831617905560408051631c56369f60e21b8152905191861691637158da7c916004808201926020929091908290030181865afa158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d9190613124565b60ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550826001600160a01b0316637158da7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108259190613124565b60cf60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b0316637158da7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ad9190613124565b60d080546001600160a01b03199081166001600160a01b0393841617825560ce548316600090815260cb60209081526040808320805485168b881617905560cf5486168352808320805485168a88161790559354851682529083902080549092168685161790915560c954825163563d6cdd60e11b8152925193169263ac7ad9ba9260048082019392918290030181865afa158015610950573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109749190613124565b60ca80546001600160a01b0319166001600160a01b0392831690811790915560cd5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af11580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff9190613141565b508015610a46576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b60ce5481906001600160a01b0380831691161480610a7b575060cf546001600160a01b038281169116145b80610a93575060d0546001600160a01b038281169116145b610aaf5760405162461bcd60e51b81526004016105ff9061315e565b60cc546001600160a01b03163314610ad95760405162461bcd60e51b81526004016105ff9061318c565b6001600160a01b038216600090815260cb60205260409020610afa90611d88565b5050565b610b06611eb3565b610b106000611f0d565b565b83836000805b82811015610bb957838382818110610b3257610b326131cd565b9050602002016020810190610b479190612f57565b60ce549092506001600160a01b0380841691161480610b73575060cf546001600160a01b038381169116145b80610b8b575060d0546001600160a01b038381169116145b610ba75760405162461bcd60e51b81526004016105ff9061315e565b80610bb1816131f9565b915050610b18565b50610bc2611f5f565b610bca611fb8565b610bd48787611ffe565b610bde85856120f3565b6040805160008082526020820190925281610c09565b6060815260200190600190039081610bf45790505b509050610c1b33338a8a8a8a87612266565b60008080805b8a811015610ff35760008a8a83818110610c3d57610c3d6131cd565b9050602002810190610c4f9190613228565b905011610c6e5760405162461bcd60e51b81526004016105ff90613272565b8b8b82818110610c8057610c806131cd565b9050602002016020810190610c959190612f57565b6001600160a01b038116600090815260cb6020526040812095509092505b8a8a83818110610cc557610cc56131cd565b9050602002810190610cd79190613228565b9050811015610d99578a8a83818110610cf257610cf26131cd565b9050602002810190610d049190613228565b82818110610d1457610d146131cd565b8754604051632142170760e11b81526020909202939093013596506001600160a01b03909216916342842e0e9150610d54903390309089906004016132a9565b600060405180830381600087803b158015610d6e57600080fd5b505af1158015610d82573d6000803e3d6000fd5b505050508080610d91906131f9565b915050610cb3565b5083546001600160a01b031663b80f55c98b8b84818110610dbc57610dbc6131cd565b9050602002810190610dce9190613228565b6040518363ffffffff1660e01b8152600401610deb9291906132ff565b600060405180830381600087803b158015610e0557600080fd5b505af1158015610e19573d6000803e3d6000fd5b5050505060005b8a8a83818110610e3257610e326131cd565b9050602002810190610e449190613228565b9050811015610f7a578a8a83818110610e5f57610e5f6131cd565b9050602002810190610e719190613228565b82818110610e8157610e816131cd565b875460408051631c56369f60e21b815290516020938402959095013598506001600160a01b0390911693637158da7c9350600480830193928290030181865afa158015610ed2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef69190613124565b6001600160a01b03166342842e0e3033876040518463ffffffff1660e01b8152600401610f25939291906132a9565b600060405180830381600087803b158015610f3f57600080fd5b505af1158015610f53573d6000803e3d6000fd5b50505060008581526002870160205260408120555080610f72816131f9565b915050610e20565b50336001600160a01b0383167f4b394698f2be8b63be065dcab6df5ffe0e5591903cc0ee5902dcb41d6b4edf688c8c85818110610fb957610fb96131cd565b9050602002810190610fcb9190613228565b604051610fd99291906132ff565b60405180910390a380610feb816131f9565b915050610c21565b50505050506110026001609755565b50505050505050565b83836000805b828110156110b25783838281811061102b5761102b6131cd565b90506020020160208101906110409190612f57565b60ce549092506001600160a01b038084169116148061106c575060cf546001600160a01b038381169116145b80611084575060d0546001600160a01b038381169116145b6110a05760405162461bcd60e51b81526004016105ff9061315e565b806110aa816131f9565b915050611011565b506110bb611f5f565b6110c3611fb8565b6110cd8787611ffe565b6110d785856120f3565b6040805160008082526020820190925281611102565b60608152602001906001900390816110ed5790505b50905061111433338a8a8a8a87612266565b506110026001609755565b6000848482805b828110156111c757838382818110611140576111406131cd565b90506020020160208101906111559190612f57565b60ce549092506001600160a01b0380841691161480611181575060cf546001600160a01b038381169116145b80611199575060d0546001600160a01b038381169116145b6111b55760405162461bcd60e51b81526004016105ff9061315e565b806111bf816131f9565b915050611126565b5060008060006111d78b8b611ffe565b6111e189896120f3565b60005b8a811015611459578b8b828181106111fe576111fe6131cd565b90506020020160208101906112139190612f57565b6001600160a01b03818116600090815260cb60205260408082206001810154815460cc549351639bfd8d6160e01b81529386166004850152919950949750939550909290911690639bfd8d6190602401602060405180830381865afa158015611280573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a49190613313565b111561139f5760cd54600385015460405163ef8b30f760e01b815261139c9285926001600160a01b039091169163ef8b30f7916112e79160040190815260200190565b602060405180830381865afa158015611304573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113289190613313565b865460cc54604051639bfd8d6160e01b81526001600160a01b039182166004820152911690639bfd8d6190602401602060405180830381865afa158015611373573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113979190613313565b6129f9565b91505b60005b8a8a838181106113b4576113b46131cd565b90506020028101906113c69190613228565b905081101561144657611428838660020160008e8e878181106113eb576113eb6131cd565b90506020028101906113fd9190613228565b8681811061140d5761140d6131cd565b90506020020135815260200190815260200160002054612a2a565b611432908a61332c565b98508061143e816131f9565b9150506113a2565b5080611451816131f9565b9150506111e4565b5086156114d05760cd5460405163266d6a8360e11b8152600481018990526001600160a01b0390911690634cdad50690602401602060405180830381865afa1580156114a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cd9190613313565b96505b505050505050949350505050565b83836000805b82811015611585578383828181106114fe576114fe6131cd565b90506020020160208101906115139190612f57565b60ce549092506001600160a01b038084169116148061153f575060cf546001600160a01b038381169116145b80611557575060d0546001600160a01b038381169116145b6115735760405162461bcd60e51b81526004016105ff9061315e565b8061157d816131f9565b9150506114e4565b5061158e611f5f565b611596611fb8565b60008060006115a58a8a611ffe565b6115af88886120f3565b60005b89811015611856578a8a828181106115cc576115cc6131cd565b90506020020160208101906115e19190612f57565b6001600160a01b038116600090815260cb60205260409020909450915061160782611d88565b600089898381811061161b5761161b6131cd565b905060200281019061162d9190613228565b90501161164c5760405162461bcd60e51b81526004016105ff90613272565b60005b898983818110611661576116616131cd565b90506020028101906116739190613228565b905081101561174e5789898381811061168e5761168e6131cd565b90506020028101906116a09190613228565b828181106116b0576116b06131cd565b60cc54604051632142170760e11b81526020909202939093013596506001600160a01b03808916936342842e0e93506116f4923392919091169089906004016132a9565b600060405180830381600087803b15801561170e57600080fd5b505af1158015611722573d6000803e3d6000fd5b505050600184015460008681526002860160205260409020555080611746816131f9565b91505061164f565b5060cc5482546001600160a01b0391821691633d6f43349116338c8c8681811061177a5761177a6131cd565b905060200281019061178c9190613228565b6040518563ffffffff1660e01b81526004016117ab949392919061333f565b600060405180830381600087803b1580156117c557600080fd5b505af11580156117d9573d6000803e3d6000fd5b5033925050506001600160a01b0385167fdb6d35979e943a3a34892e2a1ada2a2583e9f361a3d7807438e77402d3625ca98b8b8581811061181c5761181c6131cd565b905060200281019061182e9190613228565b60405161183c9291906132ff565b60405180910390a38061184e816131f9565b9150506115b2565b505050506110026001609755565b61186c611eb3565b801561187d5761187a612a5a565b50565b61187a612ab4565b60ce5482906001600160a01b03808316911614806118b0575060cf546001600160a01b038281169116145b806118c8575060d0546001600160a01b038281169116145b6118e45760405162461bcd60e51b81526004016105ff9061315e565b60cc546001600160a01b0316331461190e5760405162461bcd60e51b81526004016105ff9061318c565b60ca54611926906001600160a01b0316333085612aed565b6001600160a01b038316600090815260cb60205260408120600301805484929061195190849061332c565b909155505081156119a057826001600160a01b03167fd1028b5116c51cc56c30771e8270d6ab7ea36e9be200d2fcba1c13343ad0abdc8360405161199791815260200190565b60405180910390a25b505050565b85856000805b82811015611a4c578383828181106119c5576119c56131cd565b90506020020160208101906119da9190612f57565b60ce549092506001600160a01b0380841691161480611a06575060cf546001600160a01b038381169116145b80611a1e575060d0546001600160a01b038381169116145b611a3a5760405162461bcd60e51b81526004016105ff9061315e565b80611a44816131f9565b9150506119ab565b50611a55611f5f565b611a5d611fb8565b611a678989611ffe565b611a7187876120f3565b611a8933808b8b8b8b611a848b8d6133cb565b612266565b611a936001609755565b505050505050505050565b611aa6611eb3565b60d280546001600160a01b0319166001600160a01b038316908117909155604080516378d84da360e01b815290516378d84da3916004808201926020929091908290030181865afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190613124565b60d380546001600160a01b0319166001600160a01b0392831617905560d254604051631bc6a98160e01b8152600480820152911690631bc6a98190602401602060405180830381865afa158015611b7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba29190613124565b60d480546001600160a01b0319166001600160a01b039290921691909117905550565b611bcd611eb3565b6001600160a01b038116611c325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ff565b61187a81611f0d565b611c5f60405180606001604052806000815260200160008152602001600081525090565b6001600160a01b03828116600090815260cb602052604090819020805460cc549251639bfd8d6160e01b8152928416600484015290921690639bfd8d6190602401602060405180830381865afa158015611cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce19190613313565b825260018101546020830152600301546040820152919050565b600054610100900460ff16611d225760405162461bcd60e51b81526004016105ff906134a9565b610b10612b45565b600054610100900460ff16611d515760405162461bcd60e51b81526004016105ff906134a9565b610b10612b75565b600054610100900460ff16611d805760405162461bcd60e51b81526004016105ff906134a9565b610b10612ba8565b60038101546000819003611d9a575050565b815460cc54604051639bfd8d6160e01b81526001600160a01b0391821660048201526000929190911690639bfd8d6190602401602060405180830381865afa158015611dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0e9190613313565b60cd54604051636e553f6560e01b8152600481018590523060248201529192506000916001600160a01b0390911690636e553f65906044016020604051808303816000875af1158015611e65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e899190613313565b6000600386015590508115611ead57611ea7846001015482846129f9565b60018501555b50505050565b6033546001600160a01b03163314610b105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105ff565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600260975403611fb15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ff565b6002609755565b60655460ff1615610b105760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ff565b60005b818110156119a057600061201682600161332c565b90505b828110156120e057838382818110612033576120336131cd565b90506020020160208101906120489190612f57565b6001600160a01b0316848484818110612063576120636131cd565b90506020020160208101906120789190612f57565b6001600160a01b0316036120ce5760405162461bcd60e51b815260206004820152601b60248201527f42656e644e6674506f6f6c3a206475706c6963617465206e667473000000000060448201526064016105ff565b806120d8816131f9565b915050612019565b50806120eb816131f9565b915050612001565b60005b818110156119a05760005b838383818110612113576121136131cd565b90506020028101906121259190613228565b905081101561225357600061213b82600161332c565b90505b848484818110612150576121506131cd565b90506020028101906121629190613228565b90508110156122405784848481811061217d5761217d6131cd565b905060200281019061218f9190613228565b8281811061219f5761219f6131cd565b905060200201358585858181106121b8576121b86131cd565b90506020028101906121ca9190613228565b848181106121da576121da6131cd565b905060200201350361222e5760405162461bcd60e51b815260206004820152601f60248201527f42656e644e6674506f6f6c3a206475706c696361746520746f6b656e4964730060448201526064016105ff565b80612238816131f9565b91505061213e565b508061224b816131f9565b915050612101565b508061225e816131f9565b9150506120f6565b60008060008060008060005b8a81101561295d5760008a8a8381811061228e5761228e6131cd565b90506020028101906122a09190613228565b9050116122bf5760405162461bcd60e51b81526004016105ff90613272565b875115612354578989828181106122d8576122d86131cd565b90506020028101906122ea9190613228565b90508882815181106122fe576122fe6131cd565b602002602001015151146123545760405162461bcd60e51b815260206004820152601e60248201527f42656e644e6674506f6f6c3a20696e76616c6964207632506f6f6c496473000060448201526064016105ff565b8b8b82818110612366576123666131cd565b905060200201602081019061237b9190612f57565b6001600160a01b03818116600090815260cb602052604080822060d15481549251632cf98ebd60e11b81529285166004840152949b5099509092909116906359f31d7a906024016040805180830381865afa1580156123de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240291906134f4565b5090506000945061241287611d88565b60005b8b8b84818110612427576124276131cd565b90506020028101906124399190613228565b9050811015612852578b8b84818110612454576124546131cd565b90506020028101906124669190613228565b82818110612476576124766131cd565b8a546040516331a9108f60e11b815260209290920293909301356004820181905299506001600160a01b0390921691636352211e9150602401602060405180830381865afa1580156124cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f09190613124565b93508f6001600160a01b0316846001600160a01b03161415801561251c57506001600160a01b03821615155b80156125395750816001600160a01b0316846001600160a01b0316145b156125aa576040516331a9108f60e11b8152600481018890526001600160a01b03831690636352211e90602401602060405180830381865afa158015612583573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a79190613124565b93505b8951156126ca578f6001600160a01b0316846001600160a01b0316141580156125dd575060d3546001600160a01b031615155b80156125f6575060d3546001600160a01b038581169116145b156126ca5760d4548a516001600160a01b0390911690635da3a158908c9086908110612624576126246131cd565b6020026020010151838151811061263d5761263d6131cd565b60209081029190910101518a5460405160e084901b6001600160e01b031916815263ffffffff90921660048301526001600160a01b03166024820152604481018a9052606401606060405180830381865afa1580156126a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126c4919061352e565b50909450505b8f6001600160a01b0316846001600160a01b03161461272b5760405162461bcd60e51b815260206004820181905260248201527f42656e644e6674506f6f6c3a20696e76616c696420746f6b656e206f776e657260448201526064016105ff565b60cc54885460405163564370c360e11b8152600481018a90526001600160a01b03928316929091169063ac86e18690602401602060405180830381865afa15801561277a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279e9190613124565b6001600160a01b0316146127fe5760405162461bcd60e51b815260206004820152602160248201527f42656e644e6674506f6f6c3a20696e76616c696420746f6b656e207374616b656044820152603960f91b60648201526084016105ff565b6001880154600088815260028a01602052604090205461281e9190612a2a565b612828908761332c565b6001890154600089815260028b01602052604090205595508061284a816131f9565b915050612415565b50841561293d578d6001600160a01b0316886001600160a01b03167faf8c97f043b1a7f3c8d7490203d9851d7bc3c504ce73389ae77baea617b7ca838d8d868181106128a0576128a06131cd565b90506020028101906128b29190613228565b60cd5460405163266d6a8360e11b8152600481018c90526001600160a01b0390911690634cdad50690602401602060405180830381865afa1580156128fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291f9190613313565b8c600101546040516129349493929190613581565b60405180910390a35b612947858561332c565b9350508080612955906131f9565b915050612272565b5081156129e35760cd54604051635d043b2960e11b8152600481018490526001600160a01b038e811660248301523060448301529091169063ba087652906064016020604051808303816000875af11580156129bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129e19190613313565b505b50505050505050505050505050565b6001609755565b600081612a0e670de0b6b3a7640000856135a8565b612a1891906135bf565b612a22908561332c565b949350505050565b600081831115612a5457670de0b6b3a7640000612a4783856135e1565b612a5191906135bf565b90505b92915050565b612a62611fb8565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612a973390565b6040516001600160a01b03909116815260200160405180910390a1565b612abc612bcf565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612a97565b611ead846323b872dd60e01b858585604051602401612b0e939291906132a9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612c18565b600054610100900460ff16612b6c5760405162461bcd60e51b81526004016105ff906134a9565b610b1033611f0d565b600054610100900460ff16612b9c5760405162461bcd60e51b81526004016105ff906134a9565b6065805460ff19169055565b600054610100900460ff166129f25760405162461bcd60e51b81526004016105ff906134a9565b60655460ff16610b105760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105ff565b6000612c6d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612cea9092919063ffffffff16565b8051909150156119a05780806020019051810190612c8b9190613141565b6119a05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105ff565b6060612a22848460008585600080866001600160a01b03168587604051612d119190613618565b60006040518083038185875af1925050503d8060008114612d4e576040519150601f19603f3d011682016040523d82523d6000602084013e612d53565b606091505b5091509150612d6487838387612d6f565b979650505050505050565b60608315612dde578251600003612dd7576001600160a01b0385163b612dd75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ff565b5081612a22565b612a228383815115612df35781518083602001fd5b8060405162461bcd60e51b81526004016105ff9190613634565b6001600160a01b038116811461187a57600080fd5b600080600080600060808688031215612e3a57600080fd5b8535612e4581612e0d565b94506020860135612e5581612e0d565b935060408601359250606086013567ffffffffffffffff80821115612e7957600080fd5b818801915088601f830112612e8d57600080fd5b813581811115612e9c57600080fd5b896020828501011115612eae57600080fd5b9699959850939650602001949392505050565b600080600080600080600060e0888a031215612edc57600080fd5b8735612ee781612e0d565b96506020880135612ef781612e0d565b95506040880135612f0781612e0d565b94506060880135612f1781612e0d565b93506080880135612f2781612e0d565b925060a0880135612f3781612e0d565b915060c0880135612f4781612e0d565b8091505092959891949750929550565b600060208284031215612f6957600080fd5b8135612f7481612e0d565b9392505050565b60008060408385031215612f8e57600080fd5b8235612f9981612e0d565b946020939093013593505050565b60008083601f840112612fb957600080fd5b50813567ffffffffffffffff811115612fd157600080fd5b6020830191508360208260051b8501011115612fec57600080fd5b9250929050565b6000806000806040858703121561300957600080fd5b843567ffffffffffffffff8082111561302157600080fd5b61302d88838901612fa7565b9096509450602087013591508082111561304657600080fd5b5061305387828801612fa7565b95989497509550505050565b801515811461187a57600080fd5b60006020828403121561307f57600080fd5b8135612f748161305f565b600080600080600080606087890312156130a357600080fd5b863567ffffffffffffffff808211156130bb57600080fd5b6130c78a838b01612fa7565b909850965060208901359150808211156130e057600080fd5b6130ec8a838b01612fa7565b9096509450604089013591508082111561310557600080fd5b5061311289828a01612fa7565b979a9699509497509295939492505050565b60006020828403121561313657600080fd5b8151612f7481612e0d565b60006020828403121561315357600080fd5b8151612f748161305f565b60208082526014908201527342656e644e6674506f6f6c3a206e6f742061706560601b604082015260600190565b60208082526021908201527f42656e644e6674506f6f6c3a2063616c6c6572206973206e6f74207374616b656040820152603960f91b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161320b5761320b6131e3565b5060010190565b634e487b7160e01b600052604160045260246000fd5b6000808335601e1984360301811261323f57600080fd5b83018035915067ffffffffffffffff82111561325a57600080fd5b6020019150600581901b3603821315612fec57600080fd5b6020808252601b908201527f42656e644e6674506f6f6c3a20656d70747920746f6b656e4964730000000000604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b81835260006001600160fb1b038311156132e657600080fd5b8260051b80836020870137939093016020019392505050565b602081526000612a226020830184866132cd565b60006020828403121561332557600080fd5b5051919050565b80820180821115612a5457612a546131e3565b6001600160a01b0385811682528416602082015260606040820181905260009061336c90830184866132cd565b9695505050505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561339f5761339f613212565b604052919050565b600067ffffffffffffffff8211156133c1576133c1613212565b5060051b60200190565b60006133de6133d9846133a7565b613376565b83815260208082019190600586811b8601368111156133fc57600080fd5b865b8181101561349c57803567ffffffffffffffff81111561341e5760008081fd5b880136601f8201126134305760008081fd5b803561343e6133d9826133a7565b81815290851b8201860190868101903683111561345b5760008081fd5b928701925b8284101561348c57833563ffffffff8116811461347d5760008081fd5b82529287019290870190613460565b89525050509483019483016133fe565b5092979650505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000806040838503121561350757600080fd5b825161351281612e0d565b602084015190925061352381612e0d565b809150509250929050565b60008060006060848603121561354357600080fd5b835161354e81612e0d565b602085015190935060ff8116811461356557600080fd5b604085015190925061357681612e0d565b809150509250925092565b6060815260006135956060830186886132cd565b6020830194909452506040015292915050565b8082028115828204841417612a5457612a546131e3565b6000826135dc57634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115612a5457612a546131e3565b60005b8381101561360f5781810151838201526020016135f7565b50506000910152565b6000825161362a8184602087016135f4565b9190910192915050565b60208152600082518060208401526136538160408501602087016135f4565b601f01601f1916919091016040019291505056fea2646970667358221220a9255fe0b2866f3ef856eaaa5a55ea8e0b0ea6b7cc4d71eb4c6e1db7084673bf64736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c8063a80679c311610104578063c9112a77116100a2578063f2fde38b11610071578063f2fde38b14610493578063f4ea77f3146104a6578063fa5f81e4146104b9578063ff5e653e146104ee57600080fd5b8063c9112a77146103fc578063d234173d1461040f578063dc047a6a14610422578063de5222841461043557600080fd5b8063b8e851a3116100de578063b8e851a3146103b0578063bedb86fb146103c3578063c09e5cc2146103d6578063c85423d3146103e957600080fd5b8063a80679c314610377578063ac7ad9ba1461038a578063ae4ae1c01461039d57600080fd5b80636b4ad1421161017c57806388ad544a1161014b57806388ad544a1461032d5780638da5cb5b1461034057806390672ad8146103515780639b00f5521461036457600080fd5b80636b4ad142146102d3578063715018a6146102ff5780637685807d146103075780637c367f921461031a57600080fd5b8063365c1031116101b8578063365c1031146102505780635bcd9b07146102635780635c975abb146102aa5780635ebaf1db146102c057600080fd5b8063150b7a02146101df5780631ab95b9d14610210578063358764761461023b575b600080fd5b6101f26101ed366004612e22565b610501565b6040516001600160e01b031990911681526020015b60405180910390f35b60d054610223906001600160a01b031681565b6040516001600160a01b039091168152602001610207565b61024e610249366004612ec1565b61061b565b005b61024e61025e366004612f57565b610a50565b61029c610271366004612f7b565b6001600160a01b03909116600090815260cb6020908152604080832093835260029093019052205490565b604051908152602001610207565b60655460ff166040519015158152602001610207565b60cc54610223906001600160a01b031681565b61029c6102e1366004612f57565b6001600160a01b0316600090815260cb602052604090206003015490565b61024e610afe565b60ce54610223906001600160a01b031681565b61024e610328366004612ff3565b610b12565b60d254610223906001600160a01b031681565b6033546001600160a01b0316610223565b61024e61035f366004612ff3565b61100b565b60d354610223906001600160a01b031681565b61029c610385366004612ff3565b61111f565b60ca54610223906001600160a01b031681565b61024e6103ab366004612ff3565b6114de565b60d154610223906001600160a01b031681565b61024e6103d136600461306d565b611864565b61024e6103e4366004612f7b565b611885565b60d454610223906001600160a01b031681565b60c954610223906001600160a01b031681565b61024e61041d36600461308a565b6119a5565b61024e610430366004612f57565b611a9e565b61046e610443366004612f57565b60cb602052600090815260409020805460018201546003909201546001600160a01b03909116919083565b604080516001600160a01b039094168452602084019290925290820152606001610207565b61024e6104a1366004612f57565b611bc5565b60cd54610223906001600160a01b031681565b6104cc6104c7366004612f57565b611c3b565b6040805182518152602080840151908201529181015190820152606001610207565b60cf54610223906001600160a01b031681565b60ce5460009081906001600160a01b0316331480610529575060cf546001600160a01b031633145b8061053e575060d0546001600160a01b031633145b9050806105b65760ce546001600160a01b03908116600090815260cb60205260409020541633148061058c575060cf546001600160a01b03908116600090815260cb60205260409020541633145b806105b3575060d0546001600160a01b03908116600090815260cb60205260409020541633145b90505b806106085760405162461bcd60e51b815260206004820152601860248201527f42656e644e6674506f6f6c3a206e6f7420617065206e6674000000000000000060448201526064015b60405180910390fd5b50630a85bd0160e11b9695505050505050565b600054610100900460ff161580801561063b5750600054600160ff909116105b806106555750303b158015610655575060005460ff166001145b6106b85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105ff565b6000805460ff1916600117905580156106db576000805461ff0019166101001790555b6106e3611cfb565b6106eb611d2a565b6106f3611d59565b60c980546001600160a01b03199081166001600160a01b038a81169190911790925560cc8054821688841617905560cd8054821689841617905560d180549091168a831617905560408051631c56369f60e21b8152905191861691637158da7c916004808201926020929091908290030181865afa158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d9190613124565b60ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550826001600160a01b0316637158da7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108259190613124565b60cf60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b0316637158da7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610889573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ad9190613124565b60d080546001600160a01b03199081166001600160a01b0393841617825560ce548316600090815260cb60209081526040808320805485168b881617905560cf5486168352808320805485168a88161790559354851682529083902080549092168685161790915560c954825163563d6cdd60e11b8152925193169263ac7ad9ba9260048082019392918290030181865afa158015610950573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109749190613124565b60ca80546001600160a01b0319166001600160a01b0392831690811790915560cd5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af11580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff9190613141565b508015610a46576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b60ce5481906001600160a01b0380831691161480610a7b575060cf546001600160a01b038281169116145b80610a93575060d0546001600160a01b038281169116145b610aaf5760405162461bcd60e51b81526004016105ff9061315e565b60cc546001600160a01b03163314610ad95760405162461bcd60e51b81526004016105ff9061318c565b6001600160a01b038216600090815260cb60205260409020610afa90611d88565b5050565b610b06611eb3565b610b106000611f0d565b565b83836000805b82811015610bb957838382818110610b3257610b326131cd565b9050602002016020810190610b479190612f57565b60ce549092506001600160a01b0380841691161480610b73575060cf546001600160a01b038381169116145b80610b8b575060d0546001600160a01b038381169116145b610ba75760405162461bcd60e51b81526004016105ff9061315e565b80610bb1816131f9565b915050610b18565b50610bc2611f5f565b610bca611fb8565b610bd48787611ffe565b610bde85856120f3565b6040805160008082526020820190925281610c09565b6060815260200190600190039081610bf45790505b509050610c1b33338a8a8a8a87612266565b60008080805b8a811015610ff35760008a8a83818110610c3d57610c3d6131cd565b9050602002810190610c4f9190613228565b905011610c6e5760405162461bcd60e51b81526004016105ff90613272565b8b8b82818110610c8057610c806131cd565b9050602002016020810190610c959190612f57565b6001600160a01b038116600090815260cb6020526040812095509092505b8a8a83818110610cc557610cc56131cd565b9050602002810190610cd79190613228565b9050811015610d99578a8a83818110610cf257610cf26131cd565b9050602002810190610d049190613228565b82818110610d1457610d146131cd565b8754604051632142170760e11b81526020909202939093013596506001600160a01b03909216916342842e0e9150610d54903390309089906004016132a9565b600060405180830381600087803b158015610d6e57600080fd5b505af1158015610d82573d6000803e3d6000fd5b505050508080610d91906131f9565b915050610cb3565b5083546001600160a01b031663b80f55c98b8b84818110610dbc57610dbc6131cd565b9050602002810190610dce9190613228565b6040518363ffffffff1660e01b8152600401610deb9291906132ff565b600060405180830381600087803b158015610e0557600080fd5b505af1158015610e19573d6000803e3d6000fd5b5050505060005b8a8a83818110610e3257610e326131cd565b9050602002810190610e449190613228565b9050811015610f7a578a8a83818110610e5f57610e5f6131cd565b9050602002810190610e719190613228565b82818110610e8157610e816131cd565b875460408051631c56369f60e21b815290516020938402959095013598506001600160a01b0390911693637158da7c9350600480830193928290030181865afa158015610ed2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef69190613124565b6001600160a01b03166342842e0e3033876040518463ffffffff1660e01b8152600401610f25939291906132a9565b600060405180830381600087803b158015610f3f57600080fd5b505af1158015610f53573d6000803e3d6000fd5b50505060008581526002870160205260408120555080610f72816131f9565b915050610e20565b50336001600160a01b0383167f4b394698f2be8b63be065dcab6df5ffe0e5591903cc0ee5902dcb41d6b4edf688c8c85818110610fb957610fb96131cd565b9050602002810190610fcb9190613228565b604051610fd99291906132ff565b60405180910390a380610feb816131f9565b915050610c21565b50505050506110026001609755565b50505050505050565b83836000805b828110156110b25783838281811061102b5761102b6131cd565b90506020020160208101906110409190612f57565b60ce549092506001600160a01b038084169116148061106c575060cf546001600160a01b038381169116145b80611084575060d0546001600160a01b038381169116145b6110a05760405162461bcd60e51b81526004016105ff9061315e565b806110aa816131f9565b915050611011565b506110bb611f5f565b6110c3611fb8565b6110cd8787611ffe565b6110d785856120f3565b6040805160008082526020820190925281611102565b60608152602001906001900390816110ed5790505b50905061111433338a8a8a8a87612266565b506110026001609755565b6000848482805b828110156111c757838382818110611140576111406131cd565b90506020020160208101906111559190612f57565b60ce549092506001600160a01b0380841691161480611181575060cf546001600160a01b038381169116145b80611199575060d0546001600160a01b038381169116145b6111b55760405162461bcd60e51b81526004016105ff9061315e565b806111bf816131f9565b915050611126565b5060008060006111d78b8b611ffe565b6111e189896120f3565b60005b8a811015611459578b8b828181106111fe576111fe6131cd565b90506020020160208101906112139190612f57565b6001600160a01b03818116600090815260cb60205260408082206001810154815460cc549351639bfd8d6160e01b81529386166004850152919950949750939550909290911690639bfd8d6190602401602060405180830381865afa158015611280573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a49190613313565b111561139f5760cd54600385015460405163ef8b30f760e01b815261139c9285926001600160a01b039091169163ef8b30f7916112e79160040190815260200190565b602060405180830381865afa158015611304573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113289190613313565b865460cc54604051639bfd8d6160e01b81526001600160a01b039182166004820152911690639bfd8d6190602401602060405180830381865afa158015611373573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113979190613313565b6129f9565b91505b60005b8a8a838181106113b4576113b46131cd565b90506020028101906113c69190613228565b905081101561144657611428838660020160008e8e878181106113eb576113eb6131cd565b90506020028101906113fd9190613228565b8681811061140d5761140d6131cd565b90506020020135815260200190815260200160002054612a2a565b611432908a61332c565b98508061143e816131f9565b9150506113a2565b5080611451816131f9565b9150506111e4565b5086156114d05760cd5460405163266d6a8360e11b8152600481018990526001600160a01b0390911690634cdad50690602401602060405180830381865afa1580156114a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cd9190613313565b96505b505050505050949350505050565b83836000805b82811015611585578383828181106114fe576114fe6131cd565b90506020020160208101906115139190612f57565b60ce549092506001600160a01b038084169116148061153f575060cf546001600160a01b038381169116145b80611557575060d0546001600160a01b038381169116145b6115735760405162461bcd60e51b81526004016105ff9061315e565b8061157d816131f9565b9150506114e4565b5061158e611f5f565b611596611fb8565b60008060006115a58a8a611ffe565b6115af88886120f3565b60005b89811015611856578a8a828181106115cc576115cc6131cd565b90506020020160208101906115e19190612f57565b6001600160a01b038116600090815260cb60205260409020909450915061160782611d88565b600089898381811061161b5761161b6131cd565b905060200281019061162d9190613228565b90501161164c5760405162461bcd60e51b81526004016105ff90613272565b60005b898983818110611661576116616131cd565b90506020028101906116739190613228565b905081101561174e5789898381811061168e5761168e6131cd565b90506020028101906116a09190613228565b828181106116b0576116b06131cd565b60cc54604051632142170760e11b81526020909202939093013596506001600160a01b03808916936342842e0e93506116f4923392919091169089906004016132a9565b600060405180830381600087803b15801561170e57600080fd5b505af1158015611722573d6000803e3d6000fd5b505050600184015460008681526002860160205260409020555080611746816131f9565b91505061164f565b5060cc5482546001600160a01b0391821691633d6f43349116338c8c8681811061177a5761177a6131cd565b905060200281019061178c9190613228565b6040518563ffffffff1660e01b81526004016117ab949392919061333f565b600060405180830381600087803b1580156117c557600080fd5b505af11580156117d9573d6000803e3d6000fd5b5033925050506001600160a01b0385167fdb6d35979e943a3a34892e2a1ada2a2583e9f361a3d7807438e77402d3625ca98b8b8581811061181c5761181c6131cd565b905060200281019061182e9190613228565b60405161183c9291906132ff565b60405180910390a38061184e816131f9565b9150506115b2565b505050506110026001609755565b61186c611eb3565b801561187d5761187a612a5a565b50565b61187a612ab4565b60ce5482906001600160a01b03808316911614806118b0575060cf546001600160a01b038281169116145b806118c8575060d0546001600160a01b038281169116145b6118e45760405162461bcd60e51b81526004016105ff9061315e565b60cc546001600160a01b0316331461190e5760405162461bcd60e51b81526004016105ff9061318c565b60ca54611926906001600160a01b0316333085612aed565b6001600160a01b038316600090815260cb60205260408120600301805484929061195190849061332c565b909155505081156119a057826001600160a01b03167fd1028b5116c51cc56c30771e8270d6ab7ea36e9be200d2fcba1c13343ad0abdc8360405161199791815260200190565b60405180910390a25b505050565b85856000805b82811015611a4c578383828181106119c5576119c56131cd565b90506020020160208101906119da9190612f57565b60ce549092506001600160a01b0380841691161480611a06575060cf546001600160a01b038381169116145b80611a1e575060d0546001600160a01b038381169116145b611a3a5760405162461bcd60e51b81526004016105ff9061315e565b80611a44816131f9565b9150506119ab565b50611a55611f5f565b611a5d611fb8565b611a678989611ffe565b611a7187876120f3565b611a8933808b8b8b8b611a848b8d6133cb565b612266565b611a936001609755565b505050505050505050565b611aa6611eb3565b60d280546001600160a01b0319166001600160a01b038316908117909155604080516378d84da360e01b815290516378d84da3916004808201926020929091908290030181865afa158015611aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b239190613124565b60d380546001600160a01b0319166001600160a01b0392831617905560d254604051631bc6a98160e01b8152600480820152911690631bc6a98190602401602060405180830381865afa158015611b7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba29190613124565b60d480546001600160a01b0319166001600160a01b039290921691909117905550565b611bcd611eb3565b6001600160a01b038116611c325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ff565b61187a81611f0d565b611c5f60405180606001604052806000815260200160008152602001600081525090565b6001600160a01b03828116600090815260cb602052604090819020805460cc549251639bfd8d6160e01b8152928416600484015290921690639bfd8d6190602401602060405180830381865afa158015611cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ce19190613313565b825260018101546020830152600301546040820152919050565b600054610100900460ff16611d225760405162461bcd60e51b81526004016105ff906134a9565b610b10612b45565b600054610100900460ff16611d515760405162461bcd60e51b81526004016105ff906134a9565b610b10612b75565b600054610100900460ff16611d805760405162461bcd60e51b81526004016105ff906134a9565b610b10612ba8565b60038101546000819003611d9a575050565b815460cc54604051639bfd8d6160e01b81526001600160a01b0391821660048201526000929190911690639bfd8d6190602401602060405180830381865afa158015611dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0e9190613313565b60cd54604051636e553f6560e01b8152600481018590523060248201529192506000916001600160a01b0390911690636e553f65906044016020604051808303816000875af1158015611e65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e899190613313565b6000600386015590508115611ead57611ea7846001015482846129f9565b60018501555b50505050565b6033546001600160a01b03163314610b105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105ff565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600260975403611fb15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ff565b6002609755565b60655460ff1615610b105760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105ff565b60005b818110156119a057600061201682600161332c565b90505b828110156120e057838382818110612033576120336131cd565b90506020020160208101906120489190612f57565b6001600160a01b0316848484818110612063576120636131cd565b90506020020160208101906120789190612f57565b6001600160a01b0316036120ce5760405162461bcd60e51b815260206004820152601b60248201527f42656e644e6674506f6f6c3a206475706c6963617465206e667473000000000060448201526064016105ff565b806120d8816131f9565b915050612019565b50806120eb816131f9565b915050612001565b60005b818110156119a05760005b838383818110612113576121136131cd565b90506020028101906121259190613228565b905081101561225357600061213b82600161332c565b90505b848484818110612150576121506131cd565b90506020028101906121629190613228565b90508110156122405784848481811061217d5761217d6131cd565b905060200281019061218f9190613228565b8281811061219f5761219f6131cd565b905060200201358585858181106121b8576121b86131cd565b90506020028101906121ca9190613228565b848181106121da576121da6131cd565b905060200201350361222e5760405162461bcd60e51b815260206004820152601f60248201527f42656e644e6674506f6f6c3a206475706c696361746520746f6b656e4964730060448201526064016105ff565b80612238816131f9565b91505061213e565b508061224b816131f9565b915050612101565b508061225e816131f9565b9150506120f6565b60008060008060008060005b8a81101561295d5760008a8a8381811061228e5761228e6131cd565b90506020028101906122a09190613228565b9050116122bf5760405162461bcd60e51b81526004016105ff90613272565b875115612354578989828181106122d8576122d86131cd565b90506020028101906122ea9190613228565b90508882815181106122fe576122fe6131cd565b602002602001015151146123545760405162461bcd60e51b815260206004820152601e60248201527f42656e644e6674506f6f6c3a20696e76616c6964207632506f6f6c496473000060448201526064016105ff565b8b8b82818110612366576123666131cd565b905060200201602081019061237b9190612f57565b6001600160a01b03818116600090815260cb602052604080822060d15481549251632cf98ebd60e11b81529285166004840152949b5099509092909116906359f31d7a906024016040805180830381865afa1580156123de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240291906134f4565b5090506000945061241287611d88565b60005b8b8b84818110612427576124276131cd565b90506020028101906124399190613228565b9050811015612852578b8b84818110612454576124546131cd565b90506020028101906124669190613228565b82818110612476576124766131cd565b8a546040516331a9108f60e11b815260209290920293909301356004820181905299506001600160a01b0390921691636352211e9150602401602060405180830381865afa1580156124cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f09190613124565b93508f6001600160a01b0316846001600160a01b03161415801561251c57506001600160a01b03821615155b80156125395750816001600160a01b0316846001600160a01b0316145b156125aa576040516331a9108f60e11b8152600481018890526001600160a01b03831690636352211e90602401602060405180830381865afa158015612583573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a79190613124565b93505b8951156126ca578f6001600160a01b0316846001600160a01b0316141580156125dd575060d3546001600160a01b031615155b80156125f6575060d3546001600160a01b038581169116145b156126ca5760d4548a516001600160a01b0390911690635da3a158908c9086908110612624576126246131cd565b6020026020010151838151811061263d5761263d6131cd565b60209081029190910101518a5460405160e084901b6001600160e01b031916815263ffffffff90921660048301526001600160a01b03166024820152604481018a9052606401606060405180830381865afa1580156126a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126c4919061352e565b50909450505b8f6001600160a01b0316846001600160a01b03161461272b5760405162461bcd60e51b815260206004820181905260248201527f42656e644e6674506f6f6c3a20696e76616c696420746f6b656e206f776e657260448201526064016105ff565b60cc54885460405163564370c360e11b8152600481018a90526001600160a01b03928316929091169063ac86e18690602401602060405180830381865afa15801561277a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279e9190613124565b6001600160a01b0316146127fe5760405162461bcd60e51b815260206004820152602160248201527f42656e644e6674506f6f6c3a20696e76616c696420746f6b656e207374616b656044820152603960f91b60648201526084016105ff565b6001880154600088815260028a01602052604090205461281e9190612a2a565b612828908761332c565b6001890154600089815260028b01602052604090205595508061284a816131f9565b915050612415565b50841561293d578d6001600160a01b0316886001600160a01b03167faf8c97f043b1a7f3c8d7490203d9851d7bc3c504ce73389ae77baea617b7ca838d8d868181106128a0576128a06131cd565b90506020028101906128b29190613228565b60cd5460405163266d6a8360e11b8152600481018c90526001600160a01b0390911690634cdad50690602401602060405180830381865afa1580156128fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291f9190613313565b8c600101546040516129349493929190613581565b60405180910390a35b612947858561332c565b9350508080612955906131f9565b915050612272565b5081156129e35760cd54604051635d043b2960e11b8152600481018490526001600160a01b038e811660248301523060448301529091169063ba087652906064016020604051808303816000875af11580156129bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129e19190613313565b505b50505050505050505050505050565b6001609755565b600081612a0e670de0b6b3a7640000856135a8565b612a1891906135bf565b612a22908561332c565b949350505050565b600081831115612a5457670de0b6b3a7640000612a4783856135e1565b612a5191906135bf565b90505b92915050565b612a62611fb8565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612a973390565b6040516001600160a01b03909116815260200160405180910390a1565b612abc612bcf565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612a97565b611ead846323b872dd60e01b858585604051602401612b0e939291906132a9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612c18565b600054610100900460ff16612b6c5760405162461bcd60e51b81526004016105ff906134a9565b610b1033611f0d565b600054610100900460ff16612b9c5760405162461bcd60e51b81526004016105ff906134a9565b6065805460ff19169055565b600054610100900460ff166129f25760405162461bcd60e51b81526004016105ff906134a9565b60655460ff16610b105760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105ff565b6000612c6d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612cea9092919063ffffffff16565b8051909150156119a05780806020019051810190612c8b9190613141565b6119a05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105ff565b6060612a22848460008585600080866001600160a01b03168587604051612d119190613618565b60006040518083038185875af1925050503d8060008114612d4e576040519150601f19603f3d011682016040523d82523d6000602084013e612d53565b606091505b5091509150612d6487838387612d6f565b979650505050505050565b60608315612dde578251600003612dd7576001600160a01b0385163b612dd75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105ff565b5081612a22565b612a228383815115612df35781518083602001fd5b8060405162461bcd60e51b81526004016105ff9190613634565b6001600160a01b038116811461187a57600080fd5b600080600080600060808688031215612e3a57600080fd5b8535612e4581612e0d565b94506020860135612e5581612e0d565b935060408601359250606086013567ffffffffffffffff80821115612e7957600080fd5b818801915088601f830112612e8d57600080fd5b813581811115612e9c57600080fd5b896020828501011115612eae57600080fd5b9699959850939650602001949392505050565b600080600080600080600060e0888a031215612edc57600080fd5b8735612ee781612e0d565b96506020880135612ef781612e0d565b95506040880135612f0781612e0d565b94506060880135612f1781612e0d565b93506080880135612f2781612e0d565b925060a0880135612f3781612e0d565b915060c0880135612f4781612e0d565b8091505092959891949750929550565b600060208284031215612f6957600080fd5b8135612f7481612e0d565b9392505050565b60008060408385031215612f8e57600080fd5b8235612f9981612e0d565b946020939093013593505050565b60008083601f840112612fb957600080fd5b50813567ffffffffffffffff811115612fd157600080fd5b6020830191508360208260051b8501011115612fec57600080fd5b9250929050565b6000806000806040858703121561300957600080fd5b843567ffffffffffffffff8082111561302157600080fd5b61302d88838901612fa7565b9096509450602087013591508082111561304657600080fd5b5061305387828801612fa7565b95989497509550505050565b801515811461187a57600080fd5b60006020828403121561307f57600080fd5b8135612f748161305f565b600080600080600080606087890312156130a357600080fd5b863567ffffffffffffffff808211156130bb57600080fd5b6130c78a838b01612fa7565b909850965060208901359150808211156130e057600080fd5b6130ec8a838b01612fa7565b9096509450604089013591508082111561310557600080fd5b5061311289828a01612fa7565b979a9699509497509295939492505050565b60006020828403121561313657600080fd5b8151612f7481612e0d565b60006020828403121561315357600080fd5b8151612f748161305f565b60208082526014908201527342656e644e6674506f6f6c3a206e6f742061706560601b604082015260600190565b60208082526021908201527f42656e644e6674506f6f6c3a2063616c6c6572206973206e6f74207374616b656040820152603960f91b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161320b5761320b6131e3565b5060010190565b634e487b7160e01b600052604160045260246000fd5b6000808335601e1984360301811261323f57600080fd5b83018035915067ffffffffffffffff82111561325a57600080fd5b6020019150600581901b3603821315612fec57600080fd5b6020808252601b908201527f42656e644e6674506f6f6c3a20656d70747920746f6b656e4964730000000000604082015260600190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b81835260006001600160fb1b038311156132e657600080fd5b8260051b80836020870137939093016020019392505050565b602081526000612a226020830184866132cd565b60006020828403121561332557600080fd5b5051919050565b80820180821115612a5457612a546131e3565b6001600160a01b0385811682528416602082015260606040820181905260009061336c90830184866132cd565b9695505050505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561339f5761339f613212565b604052919050565b600067ffffffffffffffff8211156133c1576133c1613212565b5060051b60200190565b60006133de6133d9846133a7565b613376565b83815260208082019190600586811b8601368111156133fc57600080fd5b865b8181101561349c57803567ffffffffffffffff81111561341e5760008081fd5b880136601f8201126134305760008081fd5b803561343e6133d9826133a7565b81815290851b8201860190868101903683111561345b5760008081fd5b928701925b8284101561348c57833563ffffffff8116811461347d5760008081fd5b82529287019290870190613460565b89525050509483019483016133fe565b5092979650505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000806040838503121561350757600080fd5b825161351281612e0d565b602084015190925061352381612e0d565b809150509250929050565b60008060006060848603121561354357600080fd5b835161354e81612e0d565b602085015190935060ff8116811461356557600080fd5b604085015190925061357681612e0d565b809150509250925092565b6060815260006135956060830186886132cd565b6020830194909452506040015292915050565b8082028115828204841417612a5457612a546131e3565b6000826135dc57634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115612a5457612a546131e3565b60005b8381101561360f5781810151838201526020016135f7565b50506000910152565b6000825161362a8184602087016135f4565b9190910192915050565b60208152600082518060208401526136538160408501602087016135f4565b601f01601f1916919091016040019291505056fea2646970667358221220a9255fe0b2866f3ef856eaaa5a55ea8e0b0ea6b7cc4d71eb4c6e1db7084673bf64736f6c63430008120033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.