Note: Our ether balance display is temporarily unavailable. Please check back later.
Source Code
Overview
ETH Balance
Ether balance is temporarily unavailable. Please check back later.
More Info
ContractCreator
Multichain Info
N/A
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60a06040 | 7000283 | 664 days ago | IN | Create: MerkleOrchard | 0 ETH | 0.00309286 |
Loading...
Loading
Contract Name:
MerkleOrchard
Compiler Version
v0.7.1+commit.f4a555be
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma experimental ABIEncoderV2; import "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/MerkleProof.sol"; import "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/IERC20.sol"; import "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/SafeERC20.sol"; import "@balancer-labs/v2-vault/contracts/interfaces/IVault.sol"; import "@balancer-labs/v2-vault/contracts/interfaces/IAsset.sol"; import "./interfaces/IDistributorCallback.sol"; pragma solidity ^0.7.0; contract MerkleOrchard { using SafeERC20 for IERC20; // Recorded distributions // channelId > distributionId mapping(bytes32 => uint256) private _nextDistributionId; // channelId > distributionId > root mapping(bytes32 => mapping(uint256 => bytes32)) private _distributionRoot; // channelId > claimer > distributionId / 256 (word index) -> bitmap mapping(bytes32 => mapping(address => mapping(uint256 => uint256))) private _claimedBitmap; // channelId > balance mapping(bytes32 => uint256) private _remainingBalance; event DistributionAdded( address indexed distributor, IERC20 indexed token, uint256 distributionId, bytes32 merkleRoot, uint256 amount ); event DistributionClaimed( address indexed distributor, IERC20 indexed token, uint256 distributionId, address indexed claimer, address recipient, uint256 amount ); IVault private immutable _vault; constructor(IVault vault) { _vault = vault; } struct Claim { uint256 distributionId; uint256 balance; address distributor; uint256 tokenIndex; bytes32[] merkleProof; } // Getters function getVault() public view returns (IVault) { return _vault; } function getDistributionRoot( IERC20 token, address distributor, uint256 distributionId ) external view returns (bytes32) { bytes32 channelId = _getChannelId(token, distributor); return _distributionRoot[channelId][distributionId]; } function getRemainingBalance(IERC20 token, address distributor) external view returns (uint256) { bytes32 channelId = _getChannelId(token, distributor); return _remainingBalance[channelId]; } /** * @notice distribution ids must be sequential and can have an optional offset */ function getNextDistributionId(IERC20 token, address distributor) external view returns (uint256) { bytes32 channelId = _getChannelId(token, distributor); return _nextDistributionId[channelId]; } function isClaimed( IERC20 token, address distributor, uint256 distributionId, address claimer ) public view returns (bool) { (uint256 distributionWordIndex, uint256 distributionBitIndex) = _getIndices(distributionId); bytes32 channelId = _getChannelId(token, distributor); return (_claimedBitmap[channelId][claimer][distributionWordIndex] & (1 << distributionBitIndex)) != 0; } function verifyClaim( IERC20 token, address distributor, uint256 distributionId, address claimer, uint256 claimedBalance, bytes32[] memory merkleProof ) external view returns (bool) { bytes32 channelId = _getChannelId(token, distributor); return _verifyClaim(channelId, distributionId, claimer, claimedBalance, merkleProof); } // Claim functions /** * @notice Allows anyone to claim multiple distributions for a claimer. */ function claimDistributions( address claimer, Claim[] memory claims, IERC20[] memory tokens ) external { _processClaims(claimer, claimer, claims, tokens, false); } /** * @notice Allows a user to claim their own multiple distributions to internal balance. */ function claimDistributionsToInternalBalance( address claimer, Claim[] memory claims, IERC20[] memory tokens ) external { require(msg.sender == claimer, "user must claim own balance"); _processClaims(claimer, claimer, claims, tokens, true); } /** * @notice Allows a user to claim their own several distributions to a callback. */ function claimDistributionsWithCallback( address claimer, Claim[] memory claims, IERC20[] memory tokens, IDistributorCallback callbackContract, bytes calldata callbackData ) external { require(msg.sender == claimer, "user must claim own balance"); _processClaims(claimer, address(callbackContract), claims, tokens, true); callbackContract.distributorCallback(callbackData); } /** * @notice Allows a distributor to add funds to the contract as a merkle tree. */ function createDistribution( IERC20 token, bytes32 merkleRoot, uint256 amount, uint256 distributionId ) external { address distributor = msg.sender; bytes32 channelId = _getChannelId(token, distributor); require( _nextDistributionId[channelId] == distributionId || _nextDistributionId[channelId] == 0, "invalid distribution ID" ); token.safeTransferFrom(distributor, address(this), amount); token.approve(address(getVault()), amount); IVault.UserBalanceOp[] memory ops = new IVault.UserBalanceOp[](1); ops[0] = IVault.UserBalanceOp({ asset: IAsset(address(token)), amount: amount, sender: address(this), recipient: payable(address(this)), kind: IVault.UserBalanceOpKind.DEPOSIT_INTERNAL }); getVault().manageUserBalance(ops); _remainingBalance[channelId] += amount; _distributionRoot[channelId][distributionId] = merkleRoot; _nextDistributionId[channelId] = distributionId + 1; emit DistributionAdded(distributor, token, distributionId, merkleRoot, amount); } // Helper functions function _getChannelId(IERC20 token, address distributor) private pure returns (bytes32) { return keccak256(abi.encodePacked(token, distributor)); } function _processClaims( address claimer, address recipient, Claim[] memory claims, IERC20[] memory tokens, bool asInternalBalance ) internal { uint256[] memory amounts = new uint256[](tokens.length); // To save gas when setting claimed statuses in storage, we group claims for each channel and word index // (referred to as a 'claims set'), aggregating the claim bits to set and total claimed amount, only committing // to storage when changing claims sets (or when processing the last claim). // This means that callers should sort claims by grouping distribution channels and distributions with the same // word index in order to achieve reduced gas costs. // Variables to support claims set aggregation bytes32 currentChannelId; // Since channel ids are a hash, the initial zero id can be safely considered invalid uint256 currentWordIndex; uint256 currentBits; // The accumulated claimed bits to set in storage uint256 currentClaimAmount; // The accumulated tokens to be claimed from the current channel (not claims set!) Claim memory claim; for (uint256 i = 0; i < claims.length; i++) { claim = claims[i]; // New scope to avoid stack-too-deep issues { (uint256 distributionWordIndex, uint256 distributionBitIndex) = _getIndices(claim.distributionId); if (currentChannelId == _getChannelId(tokens[claim.tokenIndex], claim.distributor)) { if (currentWordIndex == distributionWordIndex) { // Same claims set as the previous one: simply track the new bit to set. currentBits |= 1 << distributionBitIndex; } else { // This case is an odd exception: the claims set is not the same, but the channel id is. This // happens for example when there are so many distributions that they don't fit in a single 32 // byte bitmap. // Since the channel is the same, we can continue accumulating the claim amount, but must commit // the previous claim bits as they correspond to a different word index. _setClaimedBits(currentChannelId, claimer, currentWordIndex, currentBits); // Start a new claims set, except channel id is the same as the previous one, and amount is not // reset. currentWordIndex = distributionWordIndex; currentBits = 1 << distributionBitIndex; } // Amounts are always accumulated for the same channel id currentClaimAmount += claim.balance; } else { // Skip initial invalid claims set if (currentChannelId != bytes32(0)) { // Commit previous claims set _setClaimedBits(currentChannelId, claimer, currentWordIndex, currentBits); _deductClaimedBalance(currentChannelId, currentClaimAmount); } // Start a new claims set currentChannelId = _getChannelId(tokens[claim.tokenIndex], claim.distributor); currentWordIndex = distributionWordIndex; currentBits = 1 << distributionBitIndex; currentClaimAmount = claim.balance; } } // Since a claims set is only committed if the next one is not part of the same set, the last claims set // must be manually committed always. if (i == claims.length - 1) { _setClaimedBits(currentChannelId, claimer, currentWordIndex, currentBits); _deductClaimedBalance(currentChannelId, currentClaimAmount); } require( _verifyClaim(currentChannelId, claim.distributionId, claimer, claim.balance, claim.merkleProof), "incorrect merkle proof" ); // Note that balances to claim are here accumulated *per token*, independent of the distribution channel and // claims set accounting. amounts[claim.tokenIndex] += claim.balance; emit DistributionClaimed( claim.distributor, tokens[claim.tokenIndex], claim.distributionId, claimer, recipient, claim.balance ); } IVault.UserBalanceOpKind kind = asInternalBalance ? IVault.UserBalanceOpKind.TRANSFER_INTERNAL : IVault.UserBalanceOpKind.WITHDRAW_INTERNAL; IVault.UserBalanceOp[] memory ops = new IVault.UserBalanceOp[](tokens.length); for (uint256 i = 0; i < tokens.length; i++) { ops[i] = IVault.UserBalanceOp({ asset: IAsset(address(tokens[i])), amount: amounts[i], sender: address(this), recipient: payable(recipient), kind: kind }); } getVault().manageUserBalance(ops); } /** * @dev Sets the bits set in `newClaimsBitmap` for the corresponding distribution. */ function _setClaimedBits( bytes32 channelId, address claimer, uint256 wordIndex, uint256 newClaimsBitmap ) private { uint256 currentBitmap = _claimedBitmap[channelId][claimer][wordIndex]; // All newly set bits must not have been previously set require((newClaimsBitmap & currentBitmap) == 0, "cannot claim twice"); _claimedBitmap[channelId][claimer][wordIndex] = currentBitmap | newClaimsBitmap; } /** * @dev Deducts `balanceBeingClaimed` from a distribution channel's allocation. This isolates tokens accross * distribution channels, and prevents claims for one channel from using the tokens of another one. */ function _deductClaimedBalance(bytes32 channelId, uint256 balanceBeingClaimed) private { require( _remainingBalance[channelId] >= balanceBeingClaimed, "distributor hasn't provided sufficient tokens for claim" ); _remainingBalance[channelId] -= balanceBeingClaimed; } function _verifyClaim( bytes32 channelId, uint256 distributionId, address claimer, uint256 claimedBalance, bytes32[] memory merkleProof ) internal view returns (bool) { bytes32 leaf = keccak256(abi.encodePacked(claimer, claimedBalance)); return MerkleProof.verify(merkleProof, _distributionRoot[channelId][distributionId], leaf); } function _getIndices(uint256 distributionId) private pure returns (uint256 distributionWordIndex, uint256 distributionBitIndex) { distributionWordIndex = distributionId / 256; distributionBitIndex = distributionId % 256; } }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma experimental ABIEncoderV2; import "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/IERC20.sol"; import "@balancer-labs/v2-solidity-utils/contracts/helpers/ISignaturesValidator.sol"; import "@balancer-labs/v2-solidity-utils/contracts/helpers/ITemporarilyPausable.sol"; import "@balancer-labs/v2-solidity-utils/contracts/misc/IWETH.sol"; import "./IAsset.sol"; import "./IAuthorizer.sol"; import "./IFlashLoanRecipient.sol"; import "./IProtocolFeesCollector.sol"; pragma solidity ^0.7.0; /** * @dev Full external interface for the Vault core contract - no external or public methods exist in the contract that * don't override one of these declarations. */ interface IVault is ISignaturesValidator, ITemporarilyPausable { // Generalities about the Vault: // // - Whenever documentation refers to 'tokens', it strictly refers to ERC20-compliant token contracts. Tokens are // transferred out of the Vault by calling the `IERC20.transfer` function, and transferred in by calling // `IERC20.transferFrom`. In these cases, the sender must have previously allowed the Vault to use their tokens by // calling `IERC20.approve`. The only deviation from the ERC20 standard that is supported is functions not returning // a boolean value: in these scenarios, a non-reverting call is assumed to be successful. // // - All non-view functions in the Vault are non-reentrant: calling them while another one is mid-execution (e.g. // while execution control is transferred to a token contract during a swap) will result in a revert. View // functions can be called in a re-reentrant way, but doing so might cause them to return inconsistent results. // Contracts calling view functions in the Vault must make sure the Vault has not already been entered. // // - View functions revert if referring to either unregistered Pools, or unregistered tokens for registered Pools. // Authorizer // // Some system actions are permissioned, like setting and collecting protocol fees. This permissioning system exists // outside of the Vault in the Authorizer contract: the Vault simply calls the Authorizer to check if the caller // can perform a given action. /** * @dev Returns the Vault's Authorizer. */ function getAuthorizer() external view returns (IAuthorizer); /** * @dev Sets a new Authorizer for the Vault. The caller must be allowed by the current Authorizer to do this. * * Emits an `AuthorizerChanged` event. */ function setAuthorizer(IAuthorizer newAuthorizer) external; /** * @dev Emitted when a new authorizer is set by `setAuthorizer`. */ event AuthorizerChanged(IAuthorizer indexed newAuthorizer); // Relayers // // Additionally, it is possible for an account to perform certain actions on behalf of another one, using their // Vault ERC20 allowance and Internal Balance. These accounts are said to be 'relayers' for these Vault functions, // and are expected to be smart contracts with sound authentication mechanisms. For an account to be able to wield // this power, two things must occur: // - The Authorizer must grant the account the permission to be a relayer for the relevant Vault function. This // means that Balancer governance must approve each individual contract to act as a relayer for the intended // functions. // - Each user must approve the relayer to act on their behalf. // This double protection means users cannot be tricked into approving malicious relayers (because they will not // have been allowed by the Authorizer via governance), nor can malicious relayers approved by a compromised // Authorizer or governance drain user funds, since they would also need to be approved by each individual user. /** * @dev Returns true if `user` has approved `relayer` to act as a relayer for them. */ function hasApprovedRelayer(address user, address relayer) external view returns (bool); /** * @dev Allows `relayer` to act as a relayer for `sender` if `approved` is true, and disallows it otherwise. * * Emits a `RelayerApprovalChanged` event. */ function setRelayerApproval( address sender, address relayer, bool approved ) external; /** * @dev Emitted every time a relayer is approved or disapproved by `setRelayerApproval`. */ event RelayerApprovalChanged(address indexed relayer, address indexed sender, bool approved); // Internal Balance // // Users can deposit tokens into the Vault, where they are allocated to their Internal Balance, and later // transferred or withdrawn. It can also be used as a source of tokens when joining Pools, as a destination // when exiting them, and as either when performing swaps. This usage of Internal Balance results in greatly reduced // gas costs when compared to relying on plain ERC20 transfers, leading to large savings for frequent users. // // Internal Balance management features batching, which means a single contract call can be used to perform multiple // operations of different kinds, with different senders and recipients, at once. /** * @dev Returns `user`'s Internal Balance for a set of tokens. */ function getInternalBalance(address user, IERC20[] memory tokens) external view returns (uint256[] memory); /** * @dev Performs a set of user balance operations, which involve Internal Balance (deposit, withdraw or transfer) * and plain ERC20 transfers using the Vault's allowance. This last feature is particularly useful for relayers, as * it lets integrators reuse a user's Vault allowance. * * For each operation, if the caller is not `sender`, it must be an authorized relayer for them. */ function manageUserBalance(UserBalanceOp[] memory ops) external payable; /** * @dev Data for `manageUserBalance` operations, which include the possibility for ETH to be sent and received without manual WETH wrapping or unwrapping. */ struct UserBalanceOp { UserBalanceOpKind kind; IAsset asset; uint256 amount; address sender; address payable recipient; } // There are four possible operations in `manageUserBalance`: // // - DEPOSIT_INTERNAL // Increases the Internal Balance of the `recipient` account by transferring tokens from the corresponding // `sender`. The sender must have allowed the Vault to use their tokens via `IERC20.approve()`. // // ETH can be used by passing the ETH sentinel value as the asset and forwarding ETH in the call: it will be wrapped // and deposited as WETH. Any ETH amount remaining will be sent back to the caller (not the sender, which is // relevant for relayers). // // Emits an `InternalBalanceChanged` event. // // // - WITHDRAW_INTERNAL // Decreases the Internal Balance of the `sender` account by transferring tokens to the `recipient`. // // ETH can be used by passing the ETH sentinel value as the asset. This will deduct WETH instead, unwrap it and send // it to the recipient as ETH. // // Emits an `InternalBalanceChanged` event. // // // - TRANSFER_INTERNAL // Transfers tokens from the Internal Balance of the `sender` account to the Internal Balance of `recipient`. // // Reverts if the ETH sentinel value is passed. // // Emits an `InternalBalanceChanged` event. // // // - TRANSFER_EXTERNAL // Transfers tokens from `sender` to `recipient`, using the Vault's ERC20 allowance. This is typically used by // relayers, as it lets them reuse a user's Vault allowance. // // Reverts if the ETH sentinel value is passed. // // Emits an `ExternalBalanceTransfer` event. enum UserBalanceOpKind { DEPOSIT_INTERNAL, WITHDRAW_INTERNAL, TRANSFER_INTERNAL, TRANSFER_EXTERNAL } /** * @dev Emitted when a user's Internal Balance changes, either from calls to `manageUserBalance`, or through * interacting with Pools using Internal Balance. * * Because Internal Balance works exclusively with ERC20 tokens, ETH deposits and withdrawals will use the WETH * address. */ event InternalBalanceChanged(address indexed user, IERC20 indexed token, int256 delta); /** * @dev Emitted when a user's Vault ERC20 allowance is used by the Vault to transfer tokens to an external account. */ event ExternalBalanceTransfer(IERC20 indexed token, address indexed sender, address recipient, uint256 amount); // Pools // // There are three specialization settings for Pools, which allow for cheaper swaps at the cost of reduced // functionality: // // - General: no specialization, suited for all Pools. IGeneralPool is used for swap request callbacks, passing the // balance of all tokens in the Pool. These Pools have the largest swap costs (because of the extra storage reads), // which increase with the number of registered tokens. // // - Minimal Swap Info: IMinimalSwapInfoPool is used instead of IGeneralPool, which saves gas by only passing the // balance of the two tokens involved in the swap. This is suitable for some pricing algorithms, like the weighted // constant product one popularized by Balancer V1. Swap costs are smaller compared to general Pools, and are // independent of the number of registered tokens. // // - Two Token: only allows two tokens to be registered. This achieves the lowest possible swap gas cost. Like // minimal swap info Pools, these are called via IMinimalSwapInfoPool. enum PoolSpecialization { GENERAL, MINIMAL_SWAP_INFO, TWO_TOKEN } /** * @dev Registers the caller account as a Pool with a given specialization setting. Returns the Pool's ID, which * is used in all Pool-related functions. Pools cannot be deregistered, nor can the Pool's specialization be * changed. * * The caller is expected to be a smart contract that implements either `IGeneralPool` or `IMinimalSwapInfoPool`, * depending on the chosen specialization setting. This contract is known as the Pool's contract. * * Note that the same contract may register itself as multiple Pools with unique Pool IDs, or in other words, * multiple Pools may share the same contract. * * Emits a `PoolRegistered` event. */ function registerPool(PoolSpecialization specialization) external returns (bytes32); /** * @dev Emitted when a Pool is registered by calling `registerPool`. */ event PoolRegistered(bytes32 indexed poolId, address indexed poolAddress, PoolSpecialization specialization); /** * @dev Returns a Pool's contract address and specialization setting. */ function getPool(bytes32 poolId) external view returns (address, PoolSpecialization); /** * @dev Registers `tokens` for the `poolId` Pool. Must be called by the Pool's contract. * * Pools can only interact with tokens they have registered. Users join a Pool by transferring registered tokens, * exit by receiving registered tokens, and can only swap registered tokens. * * Each token can only be registered once. For Pools with the Two Token specialization, `tokens` must have a length * of two, that is, both tokens must be registered in the same `registerTokens` call, and they must be sorted in * ascending order. * * The `tokens` and `assetManagers` arrays must have the same length, and each entry in these indicates the Asset * Manager for the corresponding token. Asset Managers can manage a Pool's tokens via `managePoolBalance`, * depositing and withdrawing them directly, and can even set their balance to arbitrary amounts. They are therefore * expected to be highly secured smart contracts with sound design principles, and the decision to register an * Asset Manager should not be made lightly. * * Pools can choose not to assign an Asset Manager to a given token by passing in the zero address. Once an Asset * Manager is set, it cannot be changed except by deregistering the associated token and registering again with a * different Asset Manager. * * Emits a `TokensRegistered` event. */ function registerTokens( bytes32 poolId, IERC20[] memory tokens, address[] memory assetManagers ) external; /** * @dev Emitted when a Pool registers tokens by calling `registerTokens`. */ event TokensRegistered(bytes32 indexed poolId, IERC20[] tokens, address[] assetManagers); /** * @dev Deregisters `tokens` for the `poolId` Pool. Must be called by the Pool's contract. * * Only registered tokens (via `registerTokens`) can be deregistered. Additionally, they must have zero total * balance. For Pools with the Two Token specialization, `tokens` must have a length of two, that is, both tokens * must be deregistered in the same `deregisterTokens` call. * * A deregistered token can be re-registered later on, possibly with a different Asset Manager. * * Emits a `TokensDeregistered` event. */ function deregisterTokens(bytes32 poolId, IERC20[] memory tokens) external; /** * @dev Emitted when a Pool deregisters tokens by calling `deregisterTokens`. */ event TokensDeregistered(bytes32 indexed poolId, IERC20[] tokens); /** * @dev Returns detailed information for a Pool's registered token. * * `cash` is the number of tokens the Vault currently holds for the Pool. `managed` is the number of tokens * withdrawn and held outside the Vault by the Pool's token Asset Manager. The Pool's total balance for `token` * equals the sum of `cash` and `managed`. * * Internally, `cash` and `managed` are stored using 112 bits. No action can ever cause a Pool's token `cash`, * `managed` or `total` balance to be greater than 2^112 - 1. * * `lastChangeBlock` is the number of the block in which `token`'s total balance was last modified (via either a * join, exit, swap, or Asset Manager update). This value is useful to avoid so-called 'sandwich attacks', for * example when developing price oracles. A change of zero (e.g. caused by a swap with amount zero) is considered a * change for this purpose, and will update `lastChangeBlock`. * * `assetManager` is the Pool's token Asset Manager. */ function getPoolTokenInfo(bytes32 poolId, IERC20 token) external view returns ( uint256 cash, uint256 managed, uint256 lastChangeBlock, address assetManager ); /** * @dev Returns a Pool's registered tokens, the total balance for each, and the latest block when *any* of * the tokens' `balances` changed. * * The order of the `tokens` array is the same order that will be used in `joinPool`, `exitPool`, as well as in all * Pool hooks (where applicable). Calls to `registerTokens` and `deregisterTokens` may change this order. * * If a Pool only registers tokens once, and these are sorted in ascending order, they will be stored in the same * order as passed to `registerTokens`. * * Total balances include both tokens held by the Vault and those withdrawn by the Pool's Asset Managers. These are * the amounts used by joins, exits and swaps. For a detailed breakdown of token balances, use `getPoolTokenInfo` * instead. */ function getPoolTokens(bytes32 poolId) external view returns ( IERC20[] memory tokens, uint256[] memory balances, uint256 lastChangeBlock ); /** * @dev Called by users to join a Pool, which transfers tokens from `sender` into the Pool's balance. This will * trigger custom Pool behavior, which will typically grant something in return to `recipient` - often tokenized * Pool shares. * * If the caller is not `sender`, it must be an authorized relayer for them. * * The `assets` and `maxAmountsIn` arrays must have the same length, and each entry indicates the maximum amount * to send for each asset. The amounts to send are decided by the Pool and not the Vault: it just enforces * these maximums. * * If joining a Pool that holds WETH, it is possible to send ETH directly: the Vault will do the wrapping. To enable * this mechanism, the IAsset sentinel value (the zero address) must be passed in the `assets` array instead of the * WETH address. Note that it is not possible to combine ETH and WETH in the same join. Any excess ETH will be sent * back to the caller (not the sender, which is important for relayers). * * `assets` must have the same length and order as the array returned by `getPoolTokens`. This prevents issues when * interacting with Pools that register and deregister tokens frequently. If sending ETH however, the array must be * sorted *before* replacing the WETH address with the ETH sentinel value (the zero address), which means the final * `assets` array might not be sorted. Pools with no registered tokens cannot be joined. * * If `fromInternalBalance` is true, the caller's Internal Balance will be preferred: ERC20 transfers will only * be made for the difference between the requested amount and Internal Balance (if any). Note that ETH cannot be * withdrawn from Internal Balance: attempting to do so will trigger a revert. * * This causes the Vault to call the `IBasePool.onJoinPool` hook on the Pool's contract, where Pools implement * their own custom logic. This typically requires additional information from the user (such as the expected number * of Pool shares). This can be encoded in the `userData` argument, which is ignored by the Vault and passed * directly to the Pool's contract, as is `recipient`. * * Emits a `PoolBalanceChanged` event. */ function joinPool( bytes32 poolId, address sender, address recipient, JoinPoolRequest memory request ) external payable; struct JoinPoolRequest { IAsset[] assets; uint256[] maxAmountsIn; bytes userData; bool fromInternalBalance; } /** * @dev Called by users to exit a Pool, which transfers tokens from the Pool's balance to `recipient`. This will * trigger custom Pool behavior, which will typically ask for something in return from `sender` - often tokenized * Pool shares. The amount of tokens that can be withdrawn is limited by the Pool's `cash` balance (see * `getPoolTokenInfo`). * * If the caller is not `sender`, it must be an authorized relayer for them. * * The `tokens` and `minAmountsOut` arrays must have the same length, and each entry in these indicates the minimum * token amount to receive for each token contract. The amounts to send are decided by the Pool and not the Vault: * it just enforces these minimums. * * If exiting a Pool that holds WETH, it is possible to receive ETH directly: the Vault will do the unwrapping. To * enable this mechanism, the IAsset sentinel value (the zero address) must be passed in the `assets` array instead * of the WETH address. Note that it is not possible to combine ETH and WETH in the same exit. * * `assets` must have the same length and order as the array returned by `getPoolTokens`. This prevents issues when * interacting with Pools that register and deregister tokens frequently. If receiving ETH however, the array must * be sorted *before* replacing the WETH address with the ETH sentinel value (the zero address), which means the * final `assets` array might not be sorted. Pools with no registered tokens cannot be exited. * * If `toInternalBalance` is true, the tokens will be deposited to `recipient`'s Internal Balance. Otherwise, * an ERC20 transfer will be performed. Note that ETH cannot be deposited to Internal Balance: attempting to * do so will trigger a revert. * * `minAmountsOut` is the minimum amount of tokens the user expects to get out of the Pool, for each token in the * `tokens` array. This array must match the Pool's registered tokens. * * This causes the Vault to call the `IBasePool.onExitPool` hook on the Pool's contract, where Pools implement * their own custom logic. This typically requires additional information from the user (such as the expected number * of Pool shares to return). This can be encoded in the `userData` argument, which is ignored by the Vault and * passed directly to the Pool's contract. * * Emits a `PoolBalanceChanged` event. */ function exitPool( bytes32 poolId, address sender, address payable recipient, ExitPoolRequest memory request ) external; struct ExitPoolRequest { IAsset[] assets; uint256[] minAmountsOut; bytes userData; bool toInternalBalance; } /** * @dev Emitted when a user joins or exits a Pool by calling `joinPool` or `exitPool`, respectively. */ event PoolBalanceChanged( bytes32 indexed poolId, address indexed liquidityProvider, IERC20[] tokens, int256[] deltas, uint256[] protocolFeeAmounts ); enum PoolBalanceChangeKind { JOIN, EXIT } // Swaps // // Users can swap tokens with Pools by calling the `swap` and `batchSwap` functions. To do this, // they need not trust Pool contracts in any way: all security checks are made by the Vault. They must however be // aware of the Pools' pricing algorithms in order to estimate the prices Pools will quote. // // The `swap` function executes a single swap, while `batchSwap` can perform multiple swaps in sequence. // In each individual swap, tokens of one kind are sent from the sender to the Pool (this is the 'token in'), // and tokens of another kind are sent from the Pool to the recipient in exchange (this is the 'token out'). // More complex swaps, such as one token in to multiple tokens out can be achieved by batching together // individual swaps. // // There are two swap kinds: // - 'given in' swaps, where the amount of tokens in (sent to the Pool) is known, and the Pool determines (via the // `onSwap` hook) the amount of tokens out (to send to the recipient). // - 'given out' swaps, where the amount of tokens out (received from the Pool) is known, and the Pool determines // (via the `onSwap` hook) the amount of tokens in (to receive from the sender). // // Additionally, it is possible to chain swaps using a placeholder input amount, which the Vault replaces with // the calculated output of the previous swap. If the previous swap was 'given in', this will be the calculated // tokenOut amount. If the previous swap was 'given out', it will use the calculated tokenIn amount. These extended // swaps are known as 'multihop' swaps, since they 'hop' through a number of intermediate tokens before arriving at // the final intended token. // // In all cases, tokens are only transferred in and out of the Vault (or withdrawn from and deposited into Internal // Balance) after all individual swaps have been completed, and the net token balance change computed. This makes // certain swap patterns, such as multihops, or swaps that interact with the same token pair in multiple Pools, cost // much less gas than they would otherwise. // // It also means that under certain conditions it is possible to perform arbitrage by swapping with multiple // Pools in a way that results in net token movement out of the Vault (profit), with no tokens being sent in (only // updating the Pool's internal accounting). // // To protect users from front-running or the market changing rapidly, they supply a list of 'limits' for each token // involved in the swap, where either the maximum number of tokens to send (by passing a positive value) or the // minimum amount of tokens to receive (by passing a negative value) is specified. // // Additionally, a 'deadline' timestamp can also be provided, forcing the swap to fail if it occurs after // this point in time (e.g. if the transaction failed to be included in a block promptly). // // If interacting with Pools that hold WETH, it is possible to both send and receive ETH directly: the Vault will do // the wrapping and unwrapping. To enable this mechanism, the IAsset sentinel value (the zero address) must be // passed in the `assets` array instead of the WETH address. Note that it is possible to combine ETH and WETH in the // same swap. Any excess ETH will be sent back to the caller (not the sender, which is relevant for relayers). // // Finally, Internal Balance can be used when either sending or receiving tokens. enum SwapKind { GIVEN_IN, GIVEN_OUT } /** * @dev Performs a swap with a single Pool. * * If the swap is 'given in' (the number of tokens to send to the Pool is known), it returns the amount of tokens * taken from the Pool, which must be greater than or equal to `limit`. * * If the swap is 'given out' (the number of tokens to take from the Pool is known), it returns the amount of tokens * sent to the Pool, which must be less than or equal to `limit`. * * Internal Balance usage and the recipient are determined by the `funds` struct. * * Emits a `Swap` event. */ function swap( SingleSwap memory singleSwap, FundManagement memory funds, uint256 limit, uint256 deadline ) external payable returns (uint256); /** * @dev Data for a single swap executed by `swap`. `amount` is either `amountIn` or `amountOut` depending on * the `kind` value. * * `assetIn` and `assetOut` are either token addresses, or the IAsset sentinel value for ETH (the zero address). * Note that Pools never interact with ETH directly: it will be wrapped to or unwrapped from WETH by the Vault. * * The `userData` field is ignored by the Vault, but forwarded to the Pool in the `onSwap` hook, and may be * used to extend swap behavior. */ struct SingleSwap { bytes32 poolId; SwapKind kind; IAsset assetIn; IAsset assetOut; uint256 amount; bytes userData; } /** * @dev Performs a series of swaps with one or multiple Pools. In each individual swap, the caller determines either * the amount of tokens sent to or received from the Pool, depending on the `kind` value. * * Returns an array with the net Vault asset balance deltas. Positive amounts represent tokens (or ETH) sent to the * Vault, and negative amounts represent tokens (or ETH) sent by the Vault. Each delta corresponds to the asset at * the same index in the `assets` array. * * Swaps are executed sequentially, in the order specified by the `swaps` array. Each array element describes a * Pool, the token to be sent to this Pool, the token to receive from it, and an amount that is either `amountIn` or * `amountOut` depending on the swap kind. * * Multihop swaps can be executed by passing an `amount` value of zero for a swap. This will cause the amount in/out * of the previous swap to be used as the amount in for the current one. In a 'given in' swap, 'tokenIn' must equal * the previous swap's `tokenOut`. For a 'given out' swap, `tokenOut` must equal the previous swap's `tokenIn`. * * The `assets` array contains the addresses of all assets involved in the swaps. These are either token addresses, * or the IAsset sentinel value for ETH (the zero address). Each entry in the `swaps` array specifies tokens in and * out by referencing an index in `assets`. Note that Pools never interact with ETH directly: it will be wrapped to * or unwrapped from WETH by the Vault. * * Internal Balance usage, sender, and recipient are determined by the `funds` struct. The `limits` array specifies * the minimum or maximum amount of each token the vault is allowed to transfer. * * `batchSwap` can be used to make a single swap, like `swap` does, but doing so requires more gas than the * equivalent `swap` call. * * Emits `Swap` events. */ function batchSwap( SwapKind kind, BatchSwapStep[] memory swaps, IAsset[] memory assets, FundManagement memory funds, int256[] memory limits, uint256 deadline ) external payable returns (int256[] memory); /** * @dev Data for each individual swap executed by `batchSwap`. The asset in and out fields are indexes into the * `assets` array passed to that function, and ETH assets are converted to WETH. * * If `amount` is zero, the multihop mechanism is used to determine the actual amount based on the amount in/out * from the previous swap, depending on the swap kind. * * The `userData` field is ignored by the Vault, but forwarded to the Pool in the `onSwap` hook, and may be * used to extend swap behavior. */ struct BatchSwapStep { bytes32 poolId; uint256 assetInIndex; uint256 assetOutIndex; uint256 amount; bytes userData; } /** * @dev Emitted for each individual swap performed by `swap` or `batchSwap`. */ event Swap( bytes32 indexed poolId, IERC20 indexed tokenIn, IERC20 indexed tokenOut, uint256 amountIn, uint256 amountOut ); /** * @dev All tokens in a swap are either sent from the `sender` account to the Vault, or from the Vault to the * `recipient` account. * * If the caller is not `sender`, it must be an authorized relayer for them. * * If `fromInternalBalance` is true, the `sender`'s Internal Balance will be preferred, performing an ERC20 * transfer for the difference between the requested amount and the User's Internal Balance (if any). The `sender` * must have allowed the Vault to use their tokens via `IERC20.approve()`. This matches the behavior of * `joinPool`. * * If `toInternalBalance` is true, tokens will be deposited to `recipient`'s internal balance instead of * transferred. This matches the behavior of `exitPool`. * * Note that ETH cannot be deposited to or withdrawn from Internal Balance: attempting to do so will trigger a * revert. */ struct FundManagement { address sender; bool fromInternalBalance; address payable recipient; bool toInternalBalance; } /** * @dev Simulates a call to `batchSwap`, returning an array of Vault asset deltas. Calls to `swap` cannot be * simulated directly, but an equivalent `batchSwap` call can and will yield the exact same result. * * Each element in the array corresponds to the asset at the same index, and indicates the number of tokens (or ETH) * the Vault would take from the sender (if positive) or send to the recipient (if negative). The arguments it * receives are the same that an equivalent `batchSwap` call would receive. * * Unlike `batchSwap`, this function performs no checks on the sender or recipient field in the `funds` struct. * This makes it suitable to be called by off-chain applications via eth_call without needing to hold tokens, * approve them for the Vault, or even know a user's address. * * Note that this function is not 'view' (due to implementation details): the client code must explicitly execute * eth_call instead of eth_sendTransaction. */ function queryBatchSwap( SwapKind kind, BatchSwapStep[] memory swaps, IAsset[] memory assets, FundManagement memory funds ) external returns (int256[] memory assetDeltas); // Flash Loans /** * @dev Performs a 'flash loan', sending tokens to `recipient`, executing the `receiveFlashLoan` hook on it, * and then reverting unless the tokens plus a proportional protocol fee have been returned. * * The `tokens` and `amounts` arrays must have the same length, and each entry in these indicates the loan amount * for each token contract. `tokens` must be sorted in ascending order. * * The 'userData' field is ignored by the Vault, and forwarded as-is to `recipient` as part of the * `receiveFlashLoan` call. * * Emits `FlashLoan` events. */ function flashLoan( IFlashLoanRecipient recipient, IERC20[] memory tokens, uint256[] memory amounts, bytes memory userData ) external; /** * @dev Emitted for each individual flash loan performed by `flashLoan`. */ event FlashLoan(IFlashLoanRecipient indexed recipient, IERC20 indexed token, uint256 amount, uint256 feeAmount); // Asset Management // // Each token registered for a Pool can be assigned an Asset Manager, which is able to freely withdraw the Pool's // tokens from the Vault, deposit them, or assign arbitrary values to its `managed` balance (see // `getPoolTokenInfo`). This makes them extremely powerful and dangerous. Even if an Asset Manager only directly // controls one of the tokens in a Pool, a malicious manager could set that token's balance to manipulate the // prices of the other tokens, and then drain the Pool with swaps. The risk of using Asset Managers is therefore // not constrained to the tokens they are managing, but extends to the entire Pool's holdings. // // However, a properly designed Asset Manager smart contract can be safely used for the Pool's benefit, // for example by lending unused tokens out for interest, or using them to participate in voting protocols. // // This concept is unrelated to the IAsset interface. /** * @dev Performs a set of Pool balance operations, which may be either withdrawals, deposits or updates. * * Pool Balance management features batching, which means a single contract call can be used to perform multiple * operations of different kinds, with different Pools and tokens, at once. * * For each operation, the caller must be registered as the Asset Manager for `token` in `poolId`. */ function managePoolBalance(PoolBalanceOp[] memory ops) external; struct PoolBalanceOp { PoolBalanceOpKind kind; bytes32 poolId; IERC20 token; uint256 amount; } /** * Withdrawals decrease the Pool's cash, but increase its managed balance, leaving the total balance unchanged. * * Deposits increase the Pool's cash, but decrease its managed balance, leaving the total balance unchanged. * * Updates don't affect the Pool's cash balance, but because the managed balance changes, it does alter the total. * The external amount can be either increased or decreased by this call (i.e., reporting a gain or a loss). */ enum PoolBalanceOpKind { WITHDRAW, DEPOSIT, UPDATE } /** * @dev Emitted when a Pool's token Asset Manager alters its balance via `managePoolBalance`. */ event PoolBalanceManaged( bytes32 indexed poolId, address indexed assetManager, IERC20 indexed token, int256 cashDelta, int256 managedDelta ); // Protocol Fees // // Some operations cause the Vault to collect tokens in the form of protocol fees, which can then be withdrawn by // permissioned accounts. // // There are two kinds of protocol fees: // // - flash loan fees: charged on all flash loans, as a percentage of the amounts lent. // // - swap fees: a percentage of the fees charged by Pools when performing swaps. For a number of reasons, including // swap gas costs and interface simplicity, protocol swap fees are not charged on each individual swap. Rather, // Pools are expected to keep track of how much they have charged in swap fees, and pay any outstanding debts to the // Vault when they are joined or exited. This prevents users from joining a Pool with unpaid debt, as well as // exiting a Pool in debt without first paying their share. /** * @dev Returns the current protocol fee module. */ function getProtocolFeesCollector() external view returns (IProtocolFeesCollector); /** * @dev Safety mechanism to pause most Vault operations in the event of an emergency - typically detection of an * error in some part of the system. * * The Vault can only be paused during an initial time period, after which pausing is forever disabled. * * While the contract is paused, the following features are disabled: * - depositing and transferring internal balance * - transferring external balance (using the Vault's allowance) * - swaps * - joining Pools * - Asset Manager interactions * * Internal Balance can still be withdrawn, and Pools exited. */ function setPaused(bool paused) external; /** * @dev Returns the Vault's WETH instance. */ function WETH() external view returns (IWETH); // solhint-disable-previous-line func-name-mixedcase }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; interface IDistributorCallback { function distributorCallback(bytes calldata callbackData) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; /** * @dev Interface for the SignatureValidator helper, used to support meta-transactions. */ interface ISignaturesValidator { /** * @dev Returns the EIP712 domain separator. */ function getDomainSeparator() external view returns (bytes32); /** * @dev Returns the next nonce used by an address to sign messages. */ function getNextNonce(address user) external view returns (uint256); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; /** * @dev Interface for the TemporarilyPausable helper. */ interface ITemporarilyPausable { /** * @dev Emitted every time the pause state changes by `_setPaused`. */ event PausedStateChanged(bool paused); /** * @dev Returns the current paused state. */ function getPausedState() external view returns ( bool paused, uint256 pauseWindowEndTime, uint256 bufferPeriodEndTime ); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; import "../openzeppelin/IERC20.sol"; /** * @dev Interface for WETH9. * See https://github.com/gnosis/canonical-weth/blob/0dd1ea3e295eef916d0c6223ec63141137d22d67/contracts/WETH9.sol */ interface IWETH is IERC20 { function deposit() external payable; function withdraw(uint256 amount) external; }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; /** * @dev This is an empty interface used to represent either ERC20-conforming token contracts or ETH (using the zero * address sentinel value). We're just relying on the fact that `interface` can be used to declare new address-like * types. * * This concept is unrelated to a Pool's Asset Managers. */ interface IAsset { // solhint-disable-previous-line no-empty-blocks }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; interface IAuthorizer { /** * @dev Returns true if `account` can perform the action described by `actionId` in the contract `where`. */ function canPerform( bytes32 actionId, address account, address where ) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; // Inspired by Aave Protocol's IFlashLoanReceiver. import "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/IERC20.sol"; interface IFlashLoanRecipient { /** * @dev When `flashLoan` is called on the Vault, it invokes the `receiveFlashLoan` hook on the recipient. * * At the time of the call, the Vault will have transferred `amounts` for `tokens` to the recipient. Before this * call returns, the recipient must have transferred `amounts` plus `feeAmounts` for each token back to the * Vault, or else the entire flash loan will revert. * * `userData` is the same value passed in the `IVault.flashLoan` call. */ function receiveFlashLoan( IERC20[] memory tokens, uint256[] memory amounts, uint256[] memory feeAmounts, bytes memory userData ) external; }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/IERC20.sol"; import "./IVault.sol"; import "./IAuthorizer.sol"; interface IProtocolFeesCollector { event SwapFeePercentageChanged(uint256 newSwapFeePercentage); event FlashLoanFeePercentageChanged(uint256 newFlashLoanFeePercentage); function withdrawCollectedFees( IERC20[] calldata tokens, uint256[] calldata amounts, address recipient ) external; function setSwapFeePercentage(uint256 newSwapFeePercentage) external; function setFlashLoanFeePercentage(uint256 newFlashLoanFeePercentage) external; function getSwapFeePercentage() external view returns (uint256); function getFlashLoanFeePercentage() external view returns (uint256); function getCollectedFeeAmounts(IERC20[] memory tokens) external view returns (uint256[] memory feeAmounts); function getAuthorizer() external view returns (IAuthorizer); function vault() external view returns (IVault); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; // solhint-disable /** * @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are * supported. */ function _require(bool condition, uint256 errorCode) pure { if (!condition) _revert(errorCode); } /** * @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported. */ function _revert(uint256 errorCode) pure { // We're going to dynamically create a revert string based on the error code, with the following format: // 'BAL#{errorCode}' // where the code is left-padded with zeroes to three digits (so they range from 000 to 999). // // We don't have revert strings embedded in the contract to save bytecode size: it takes much less space to store a // number (8 to 16 bits) than the individual string characters. // // The dynamic string creation algorithm that follows could be implemented in Solidity, but assembly allows for a // much denser implementation, again saving bytecode size. Given this function unconditionally reverts, this is a // safe place to rely on it without worrying about how its usage might affect e.g. memory contents. assembly { // First, we need to compute the ASCII representation of the error code. We assume that it is in the 0-999 // range, so we only need to convert three digits. To convert the digits to ASCII, we add 0x30, the value for // the '0' character. let units := add(mod(errorCode, 10), 0x30) errorCode := div(errorCode, 10) let tenths := add(mod(errorCode, 10), 0x30) errorCode := div(errorCode, 10) let hundreds := add(mod(errorCode, 10), 0x30) // With the individual characters, we can now construct the full string. The "BAL#" part is a known constant // (0x42414c23): we simply shift this by 24 (to provide space for the 3 bytes of the error code), and add the // characters to it, each shifted by a multiple of 8. // The revert reason is then shifted left by 200 bits (256 minus the length of the string, 7 characters * 8 bits // per character = 56) to locate it in the most significant part of the 256 slot (the beginning of a byte // array). let revertReason := shl(200, add(0x42414c23000000, add(add(units, shl(8, tenths)), shl(16, hundreds)))) // We can now encode the reason in memory, which can be safely overwritten as we're about to revert. The encoded // message will have the following layout: // [ revert reason identifier ] [ string location offset ] [ string length ] [ string contents ] // The Solidity revert reason identifier is 0x08c739a0, the function selector of the Error(string) function. We // also write zeroes to the next 28 bytes of memory, but those are about to be overwritten. mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000) // Next is the offset to the location of the string, which will be placed immediately after (20 bytes away). mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020) // The string length is fixed: 7 characters. mstore(0x24, 7) // Finally, the string itself is stored. mstore(0x44, revertReason) // Even if the string is only 7 bytes long, we need to return a full 32 byte slot containing it. The length of // the encoded message is therefore 4 + 32 + 32 + 32 = 100. revert(0, 100) } } library Errors { // Math uint256 internal constant ADD_OVERFLOW = 0; uint256 internal constant SUB_OVERFLOW = 1; uint256 internal constant SUB_UNDERFLOW = 2; uint256 internal constant MUL_OVERFLOW = 3; uint256 internal constant ZERO_DIVISION = 4; uint256 internal constant DIV_INTERNAL = 5; uint256 internal constant X_OUT_OF_BOUNDS = 6; uint256 internal constant Y_OUT_OF_BOUNDS = 7; uint256 internal constant PRODUCT_OUT_OF_BOUNDS = 8; uint256 internal constant INVALID_EXPONENT = 9; // Input uint256 internal constant OUT_OF_BOUNDS = 100; uint256 internal constant UNSORTED_ARRAY = 101; uint256 internal constant UNSORTED_TOKENS = 102; uint256 internal constant INPUT_LENGTH_MISMATCH = 103; uint256 internal constant ZERO_TOKEN = 104; // Shared pools uint256 internal constant MIN_TOKENS = 200; uint256 internal constant MAX_TOKENS = 201; uint256 internal constant MAX_SWAP_FEE_PERCENTAGE = 202; uint256 internal constant MIN_SWAP_FEE_PERCENTAGE = 203; uint256 internal constant MINIMUM_BPT = 204; uint256 internal constant CALLER_NOT_VAULT = 205; uint256 internal constant UNINITIALIZED = 206; uint256 internal constant BPT_IN_MAX_AMOUNT = 207; uint256 internal constant BPT_OUT_MIN_AMOUNT = 208; uint256 internal constant EXPIRED_PERMIT = 209; uint256 internal constant NOT_TWO_TOKENS = 210; // Pools uint256 internal constant MIN_AMP = 300; uint256 internal constant MAX_AMP = 301; uint256 internal constant MIN_WEIGHT = 302; uint256 internal constant MAX_STABLE_TOKENS = 303; uint256 internal constant MAX_IN_RATIO = 304; uint256 internal constant MAX_OUT_RATIO = 305; uint256 internal constant MIN_BPT_IN_FOR_TOKEN_OUT = 306; uint256 internal constant MAX_OUT_BPT_FOR_TOKEN_IN = 307; uint256 internal constant NORMALIZED_WEIGHT_INVARIANT = 308; uint256 internal constant INVALID_TOKEN = 309; uint256 internal constant UNHANDLED_JOIN_KIND = 310; uint256 internal constant ZERO_INVARIANT = 311; uint256 internal constant ORACLE_INVALID_SECONDS_QUERY = 312; uint256 internal constant ORACLE_NOT_INITIALIZED = 313; uint256 internal constant ORACLE_QUERY_TOO_OLD = 314; uint256 internal constant ORACLE_INVALID_INDEX = 315; uint256 internal constant ORACLE_BAD_SECS = 316; uint256 internal constant AMP_END_TIME_TOO_CLOSE = 317; uint256 internal constant AMP_ONGOING_UPDATE = 318; uint256 internal constant AMP_RATE_TOO_HIGH = 319; uint256 internal constant AMP_NO_ONGOING_UPDATE = 320; uint256 internal constant STABLE_INVARIANT_DIDNT_CONVERGE = 321; uint256 internal constant STABLE_GET_BALANCE_DIDNT_CONVERGE = 322; uint256 internal constant RELAYER_NOT_CONTRACT = 323; uint256 internal constant BASE_POOL_RELAYER_NOT_CALLED = 324; uint256 internal constant REBALANCING_RELAYER_REENTERED = 325; uint256 internal constant GRADUAL_UPDATE_TIME_TRAVEL = 326; uint256 internal constant SWAPS_DISABLED = 327; uint256 internal constant CALLER_IS_NOT_LBP_OWNER = 328; uint256 internal constant PRICE_RATE_OVERFLOW = 329; uint256 internal constant INVALID_JOIN_EXIT_KIND_WHILE_SWAPS_DISABLED = 330; uint256 internal constant WEIGHT_CHANGE_TOO_FAST = 331; uint256 internal constant LOWER_GREATER_THAN_UPPER_TARGET = 332; uint256 internal constant UPPER_TARGET_TOO_HIGH = 333; uint256 internal constant UNHANDLED_BY_LINEAR_POOL = 334; uint256 internal constant OUT_OF_TARGET_RANGE = 335; uint256 internal constant UNHANDLED_EXIT_KIND = 336; uint256 internal constant UNAUTHORIZED_EXIT = 337; uint256 internal constant MAX_MANAGEMENT_SWAP_FEE_PERCENTAGE = 338; uint256 internal constant UNHANDLED_BY_INVESTMENT_POOL = 339; uint256 internal constant UNHANDLED_BY_PHANTOM_POOL = 340; uint256 internal constant TOKEN_DOES_NOT_HAVE_RATE_PROVIDER = 341; uint256 internal constant INVALID_INITIALIZATION = 342; // Lib uint256 internal constant REENTRANCY = 400; uint256 internal constant SENDER_NOT_ALLOWED = 401; uint256 internal constant PAUSED = 402; uint256 internal constant PAUSE_WINDOW_EXPIRED = 403; uint256 internal constant MAX_PAUSE_WINDOW_DURATION = 404; uint256 internal constant MAX_BUFFER_PERIOD_DURATION = 405; uint256 internal constant INSUFFICIENT_BALANCE = 406; uint256 internal constant INSUFFICIENT_ALLOWANCE = 407; uint256 internal constant ERC20_TRANSFER_FROM_ZERO_ADDRESS = 408; uint256 internal constant ERC20_TRANSFER_TO_ZERO_ADDRESS = 409; uint256 internal constant ERC20_MINT_TO_ZERO_ADDRESS = 410; uint256 internal constant ERC20_BURN_FROM_ZERO_ADDRESS = 411; uint256 internal constant ERC20_APPROVE_FROM_ZERO_ADDRESS = 412; uint256 internal constant ERC20_APPROVE_TO_ZERO_ADDRESS = 413; uint256 internal constant ERC20_TRANSFER_EXCEEDS_ALLOWANCE = 414; uint256 internal constant ERC20_DECREASED_ALLOWANCE_BELOW_ZERO = 415; uint256 internal constant ERC20_TRANSFER_EXCEEDS_BALANCE = 416; uint256 internal constant ERC20_BURN_EXCEEDS_ALLOWANCE = 417; uint256 internal constant SAFE_ERC20_CALL_FAILED = 418; uint256 internal constant ADDRESS_INSUFFICIENT_BALANCE = 419; uint256 internal constant ADDRESS_CANNOT_SEND_VALUE = 420; uint256 internal constant SAFE_CAST_VALUE_CANT_FIT_INT256 = 421; uint256 internal constant GRANT_SENDER_NOT_ADMIN = 422; uint256 internal constant REVOKE_SENDER_NOT_ADMIN = 423; uint256 internal constant RENOUNCE_SENDER_NOT_ALLOWED = 424; uint256 internal constant BUFFER_PERIOD_EXPIRED = 425; uint256 internal constant CALLER_IS_NOT_OWNER = 426; uint256 internal constant NEW_OWNER_IS_ZERO = 427; uint256 internal constant CODE_DEPLOYMENT_FAILED = 428; uint256 internal constant CALL_TO_NON_CONTRACT = 429; uint256 internal constant LOW_LEVEL_CALL_FAILED = 430; // Vault uint256 internal constant INVALID_POOL_ID = 500; uint256 internal constant CALLER_NOT_POOL = 501; uint256 internal constant SENDER_NOT_ASSET_MANAGER = 502; uint256 internal constant USER_DOESNT_ALLOW_RELAYER = 503; uint256 internal constant INVALID_SIGNATURE = 504; uint256 internal constant EXIT_BELOW_MIN = 505; uint256 internal constant JOIN_ABOVE_MAX = 506; uint256 internal constant SWAP_LIMIT = 507; uint256 internal constant SWAP_DEADLINE = 508; uint256 internal constant CANNOT_SWAP_SAME_TOKEN = 509; uint256 internal constant UNKNOWN_AMOUNT_IN_FIRST_SWAP = 510; uint256 internal constant MALCONSTRUCTED_MULTIHOP_SWAP = 511; uint256 internal constant INTERNAL_BALANCE_OVERFLOW = 512; uint256 internal constant INSUFFICIENT_INTERNAL_BALANCE = 513; uint256 internal constant INVALID_ETH_INTERNAL_BALANCE = 514; uint256 internal constant INVALID_POST_LOAN_BALANCE = 515; uint256 internal constant INSUFFICIENT_ETH = 516; uint256 internal constant UNALLOCATED_ETH = 517; uint256 internal constant ETH_TRANSFER = 518; uint256 internal constant CANNOT_USE_ETH_SENTINEL = 519; uint256 internal constant TOKENS_MISMATCH = 520; uint256 internal constant TOKEN_NOT_REGISTERED = 521; uint256 internal constant TOKEN_ALREADY_REGISTERED = 522; uint256 internal constant TOKENS_ALREADY_SET = 523; uint256 internal constant TOKENS_LENGTH_MUST_BE_2 = 524; uint256 internal constant NONZERO_TOKEN_BALANCE = 525; uint256 internal constant BALANCE_TOTAL_OVERFLOW = 526; uint256 internal constant POOL_NO_TOKENS = 527; uint256 internal constant INSUFFICIENT_FLASH_LOAN_BALANCE = 528; // Fees uint256 internal constant SWAP_FEE_PERCENTAGE_TOO_HIGH = 600; uint256 internal constant FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH = 601; uint256 internal constant INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT = 602; }
// SPDX-License-Identifier: MIT // Based on the ReentrancyGuard library from OpenZeppelin Contracts, altered to reduce gas costs. // The `safeTransfer` and `safeTransferFrom` functions assume that `token` is a contract (an account with code), and // work differently from the OpenZeppelin version if it is not. pragma solidity ^0.7.0; import "../helpers/BalancerErrors.sol"; import "./IERC20.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(address(token), abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(address(token), abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @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). * * WARNING: `token` is assumed to be a contract: calls to EOAs will *not* revert. */ function _callOptionalReturn(address 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. (bool success, bytes memory returndata) = token.call(data); // If the low-level call didn't succeed we return whatever was returned from it. assembly { if eq(success, 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } // Finally we check the returndata size is either zero or true - note that this check will always pass for EOAs _require(returndata.length == 0 || abi.decode(returndata, (bool)), Errors.SAFE_ERC20_CALL_FAILED); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev These functions deal with verification of Merkle trees (hash trees), */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; } }
{ "optimizer": { "enabled": true, "runs": 9999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"contract IVault","name":"vault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"distributor","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"distributionId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"distributor","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"distributionId","type":"uint256"},{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DistributionClaimed","type":"event"},{"inputs":[{"internalType":"address","name":"claimer","type":"address"},{"components":[{"internalType":"uint256","name":"distributionId","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"address","name":"distributor","type":"address"},{"internalType":"uint256","name":"tokenIndex","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct MerkleOrchard.Claim[]","name":"claims","type":"tuple[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"claimDistributions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"claimer","type":"address"},{"components":[{"internalType":"uint256","name":"distributionId","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"address","name":"distributor","type":"address"},{"internalType":"uint256","name":"tokenIndex","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct MerkleOrchard.Claim[]","name":"claims","type":"tuple[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"claimDistributionsToInternalBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"claimer","type":"address"},{"components":[{"internalType":"uint256","name":"distributionId","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"address","name":"distributor","type":"address"},{"internalType":"uint256","name":"tokenIndex","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"internalType":"struct MerkleOrchard.Claim[]","name":"claims","type":"tuple[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"contract IDistributorCallback","name":"callbackContract","type":"address"},{"internalType":"bytes","name":"callbackData","type":"bytes"}],"name":"claimDistributionsWithCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"distributionId","type":"uint256"}],"name":"createDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"distributor","type":"address"},{"internalType":"uint256","name":"distributionId","type":"uint256"}],"name":"getDistributionRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"distributor","type":"address"}],"name":"getNextDistributionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"distributor","type":"address"}],"name":"getRemainingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"distributor","type":"address"},{"internalType":"uint256","name":"distributionId","type":"uint256"},{"internalType":"address","name":"claimer","type":"address"}],"name":"isClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"distributor","type":"address"},{"internalType":"uint256","name":"distributionId","type":"uint256"},{"internalType":"address","name":"claimer","type":"address"},{"internalType":"uint256","name":"claimedBalance","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"verifyClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a060405234801561001057600080fd5b5060405161198738038061198783398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c6118f861008f600039806102dc52506118f86000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638d928af811610076578063ece123541161005b578063ece123541461016f578063fb97812814610182578063fea7364914610195576100be565b80638d928af814610147578063a68d1e9d1461015c576100be565b806362c8b7c9116100a757806362c8b7c91461010157806381ae8541146101145780638bf3e45714610134576100be565b80632b630140146100c3578063515ac052146100d8575b600080fd5b6100d66100d136600461119d565b6101a8565b005b6100eb6100e636600461138a565b6101bb565b6040516100f89190611659565b60405180910390f35b6100eb61010f3660046113dc565b610226565b610127610122366004611312565b61024e565b6040516100f89190611664565b6100d661014236600461119d565b610274565b61014f6102da565b6040516100f891906116ba565b6100d661016a366004611210565b6102fe565b6100d661017d366004611461565b6103e9565b610127610190366004611312565b6106a2565b6101276101a336600461134a565b6106c6565b6101b68384848460006106f7565b505050565b60008060006101c985610b23565b9150915060006101d98888610b31565b600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916845282528083209583529490529290922054600190911b161515915050949350505050565b6000806102338888610b31565b90506102428187878787610b64565b98975050505050505050565b60008061025b8484610b31565b6000908152600360205260409020549150505b92915050565b3373ffffffffffffffffffffffffffffffffffffffff8416146102cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906117dd565b60405180910390fd5b6101b68384848460016106f7565b7f000000000000000000000000000000000000000000000000000000000000000090565b3373ffffffffffffffffffffffffffffffffffffffff87161461034d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906117dd565b61035b8684878760016106f7565b6040517f55c524c100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906355c524c1906103af908590859060040161166d565b600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b50505050505050505050565b3360006103f68683610b31565b6000818152602081905260409020549091508314806104215750600081815260208190526040902054155b610457576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906116db565b61047973ffffffffffffffffffffffffffffffffffffffff8716833087610bdf565b8573ffffffffffffffffffffffffffffffffffffffff1663095ea7b361049d6102da565b866040518363ffffffff1660e01b81526004016104bb92919061159c565b602060405180830381600087803b1580156104d557600080fd5b505af11580156104e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050d91906112eb565b50604080516001808252818301909252606091816020015b61052d610f61565b8152602001906001900390816105255750506040805160a081018252600080825273ffffffffffffffffffffffffffffffffffffffff8b1660208301529181018890523060608201819052608082015282519293509183919061058c57fe5b602002602001018190525061059f6102da565b73ffffffffffffffffffffffffffffffffffffffff16630e8e3e84826040518263ffffffff1660e01b81526004016105d791906115c2565b600060405180830381600087803b1580156105f157600080fd5b505af1158015610605573d6000803e3d6000fd5b505050600083815260036020908152604080832080548a019055600180835281842089855283528184208b9055868452918390529182902090870190555173ffffffffffffffffffffffffffffffffffffffff808a1692508516907f24a80c4e3ef74c732b163bfb2decfbe077a51aef3b708c93f8ef3dd06fc3ea7c906106919088908b908b90611840565b60405180910390a350505050505050565b6000806106af8484610b31565b600090815260208190526040902054949350505050565b6000806106d38585610b31565b60009081526001602090815260408083208684529091529020549150509392505050565b6060825167ffffffffffffffff8111801561071157600080fd5b5060405190808252806020026020018201604052801561073b578160200160208202803683370190505b50905060008060008061074c610f91565b60005b89518110156109715789818151811061076457fe5b6020026020010151915060008061077e8460000151610b23565b915091506107a78b85606001518151811061079557fe5b60200260200101518560400151610b31565b8814156107e957818714156107c457806001901b861795506107db565b6107d0888f8989610c88565b819650806001901b95505b83602001518501945061082c565b8715610805576107fb888f8989610c88565b6108058886610d3c565b6108188b85606001518151811061079557fe5b9750819650806001901b9550836020015194505b505060018a510381141561085057610846868d8787610c88565b6108508684610d3c565b6108698683600001518e85602001518660800151610b64565b61089f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906117a6565b8160200151878360600151815181106108b457fe5b6020026020010181815101915081815250508b73ffffffffffffffffffffffffffffffffffffffff16898360600151815181106108ed57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167ff3f33f2319d28d6a1402aa9e6ca0ae16d3ada035d576b3b8074b422aaa03b69885600001518f876020015160405161096193929190611814565b60405180910390a460010161074f565b50600087610980576001610983565b60025b90506060895167ffffffffffffffff8111801561099f57600080fd5b506040519080825280602002602001820160405280156109d957816020015b6109c6610f61565b8152602001906001900390816109be5790505b50905060005b8a51811015610aa1576040518060a001604052808460038111156109ff57fe5b81526020018c8381518110610a1057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018a8381518110610a3f57fe5b602002602001015181526020013073ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff16815250828281518110610a8e57fe5b60209081029190910101526001016109df565b50610aaa6102da565b73ffffffffffffffffffffffffffffffffffffffff16630e8e3e84826040518263ffffffff1660e01b8152600401610ae291906115c2565b600060405180830381600087803b158015610afc57600080fd5b505af1158015610b10573d6000803e3d6000fd5b5050505050505050505050505050505050565b61010081049160ff90911690565b60008282604051602001610b46929190611531565b60405160208183030381529060405280519060200120905092915050565b6000808484604051602001610b7a9291906114b5565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152815160209283012060008a8152600184528281208a8252909352912054909150610bd490849083610d9d565b979650505050505050565b610c82846323b872dd60e01b858585604051602401610c009392919061156b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610e3a565b50505050565b600084815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452825280832085845290915290205481811615610cfa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c390611712565b600094855260026020908152604080872073ffffffffffffffffffffffffffffffffffffffff9096168752948152848620938652929092529190922091179055565b600082815260036020526040902054811115610d84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c390611749565b6000918252600360205260409091208054919091039055565b600081815b8551811015610e2f576000868281518110610db957fe5b60200260200101519050808311610dfa578281604051602001610ddd9291906114ea565b604051602081830303815290604052805190602001209250610e26565b8083604051602001610e0d9291906114ea565b6040516020818303038152906040528051906020012092505b50600101610da2565b509092149392505050565b600060608373ffffffffffffffffffffffffffffffffffffffff1683604051610e6391906114f8565b6000604051808303816000865af19150503d8060008114610ea0576040519150601f19603f3d011682016040523d82523d6000602084013e610ea5565b606091505b50915091506000821415610ebd573d6000803e3d6000fd5b610c82815160001480610edf575081806020019051810190610edf91906112eb565b6101a281610ef057610ef081610ef4565b5050565b7f08c379a0000000000000000000000000000000000000000000000000000000006000908152602060045260076024526642414c23000030600a808404818106603090810160081b95839006959095019082900491820690940160101b939093010160c81b604452606490fd5b6040805160a081019091528060008152600060208201819052604082018190526060820181905260809091015290565b6040518060a001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001606081525090565b803561026e8161189d565b600082601f830112610ff1578081fd5b8135611004610fff8261187d565b611856565b81815291506020808301908481018184028601820187101561102557600080fd5b60005b8481101561104457813584529282019290820190600101611028565b505050505092915050565b600082601f83011261105f578081fd5b813561106d610fff8261187d565b81815291506020808301908481018184028601820187101561108e57600080fd5b60005b848110156110445781356110a48161189d565b84529282019290820190600101611091565b600082601f8301126110c6578081fd5b81356110d4610fff8261187d565b818152915060208083019084810160005b84811015611044578135870160a0807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838c0301121561112457600080fd5b61112d81611856565b85830135815260408084013587830152606061114b8d828701610fd6565b828401526080915081850135818401525082840135925067ffffffffffffffff83111561117757600080fd5b6111858c8885870101610fe1565b908201528652505092820192908201906001016110e5565b6000806000606084860312156111b1578283fd5b83356111bc8161189d565b9250602084013567ffffffffffffffff808211156111d8578384fd5b6111e4878388016110b6565b935060408601359150808211156111f9578283fd5b506112068682870161104f565b9150509250925092565b60008060008060008060a08789031215611228578182fd5b86356112338161189d565b9550602087013567ffffffffffffffff8082111561124f578384fd5b61125b8a838b016110b6565b96506040890135915080821115611270578384fd5b61127c8a838b0161104f565b95506060890135915061128e8261189d565b909350608088013590808211156112a3578384fd5b818901915089601f8301126112b6578384fd5b8135818111156112c4578485fd5b8a60208285010111156112d5578485fd5b6020830194508093505050509295509295509295565b6000602082840312156112fc578081fd5b8151801515811461130b578182fd5b9392505050565b60008060408385031215611324578182fd5b823561132f8161189d565b9150602083013561133f8161189d565b809150509250929050565b60008060006060848603121561135e578283fd5b83356113698161189d565b925060208401356113798161189d565b929592945050506040919091013590565b6000806000806080858703121561139f578384fd5b84356113aa8161189d565b935060208501356113ba8161189d565b92506040850135915060608501356113d18161189d565b939692955090935050565b60008060008060008060c087890312156113f4578182fd5b86356113ff8161189d565b9550602087013561140f8161189d565b94506040870135935060608701356114268161189d565b92506080870135915060a087013567ffffffffffffffff811115611448578182fd5b61145489828a01610fe1565b9150509295509295509295565b60008060008060808587031215611476578182fd5b84356114818161189d565b966020860135965060408601359560600135945092505050565b73ffffffffffffffffffffffffffffffffffffffff169052565b60609290921b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168252601482015260340190565b918252602082015260400190565b60008251815b8181101561151857602081860181015185830152016114fe565b818111156115265782828501525b509190910192915050565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606093841b811682529190921b16601482015260280190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000919060409081850190868401855b8281101561164c5781518051600481106115f557fe5b8552808701516116078887018261149b565b5085810151868601526060808201516116228288018261149b565b5050608090810151906116378682018361149b565b505060a09390930192908501906001016115df565b5091979650505050505050565b901515815260200190565b90815260200190565b60006020825282602083015282846040840137818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60208082526017908201527f696e76616c696420646973747269627574696f6e204944000000000000000000604082015260600190565b60208082526012908201527f63616e6e6f7420636c61696d2074776963650000000000000000000000000000604082015260600190565b60208082526037908201527f6469737472696275746f72206861736e27742070726f7669646564207375666660408201527f696369656e7420746f6b656e7320666f7220636c61696d000000000000000000606082015260800190565b60208082526016908201527f696e636f7272656374206d65726b6c652070726f6f6600000000000000000000604082015260600190565b6020808252601b908201527f75736572206d75737420636c61696d206f776e2062616c616e63650000000000604082015260600190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff8111828210171561187557600080fd5b604052919050565b600067ffffffffffffffff821115611893578081fd5b5060209081020190565b73ffffffffffffffffffffffffffffffffffffffff811681146118bf57600080fd5b5056fea2646970667358221220f9a8e75dc6691ffb23712d46d1514f8655d6e950a762ea801145aba797c431b064736f6c63430007010033000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100be5760003560e01c80638d928af811610076578063ece123541161005b578063ece123541461016f578063fb97812814610182578063fea7364914610195576100be565b80638d928af814610147578063a68d1e9d1461015c576100be565b806362c8b7c9116100a757806362c8b7c91461010157806381ae8541146101145780638bf3e45714610134576100be565b80632b630140146100c3578063515ac052146100d8575b600080fd5b6100d66100d136600461119d565b6101a8565b005b6100eb6100e636600461138a565b6101bb565b6040516100f89190611659565b60405180910390f35b6100eb61010f3660046113dc565b610226565b610127610122366004611312565b61024e565b6040516100f89190611664565b6100d661014236600461119d565b610274565b61014f6102da565b6040516100f891906116ba565b6100d661016a366004611210565b6102fe565b6100d661017d366004611461565b6103e9565b610127610190366004611312565b6106a2565b6101276101a336600461134a565b6106c6565b6101b68384848460006106f7565b505050565b60008060006101c985610b23565b9150915060006101d98888610b31565b600090815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916845282528083209583529490529290922054600190911b161515915050949350505050565b6000806102338888610b31565b90506102428187878787610b64565b98975050505050505050565b60008061025b8484610b31565b6000908152600360205260409020549150505b92915050565b3373ffffffffffffffffffffffffffffffffffffffff8416146102cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906117dd565b60405180910390fd5b6101b68384848460016106f7565b7f000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c890565b3373ffffffffffffffffffffffffffffffffffffffff87161461034d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906117dd565b61035b8684878760016106f7565b6040517f55c524c100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416906355c524c1906103af908590859060040161166d565b600060405180830381600087803b1580156103c957600080fd5b505af11580156103dd573d6000803e3d6000fd5b50505050505050505050565b3360006103f68683610b31565b6000818152602081905260409020549091508314806104215750600081815260208190526040902054155b610457576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906116db565b61047973ffffffffffffffffffffffffffffffffffffffff8716833087610bdf565b8573ffffffffffffffffffffffffffffffffffffffff1663095ea7b361049d6102da565b866040518363ffffffff1660e01b81526004016104bb92919061159c565b602060405180830381600087803b1580156104d557600080fd5b505af11580156104e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050d91906112eb565b50604080516001808252818301909252606091816020015b61052d610f61565b8152602001906001900390816105255750506040805160a081018252600080825273ffffffffffffffffffffffffffffffffffffffff8b1660208301529181018890523060608201819052608082015282519293509183919061058c57fe5b602002602001018190525061059f6102da565b73ffffffffffffffffffffffffffffffffffffffff16630e8e3e84826040518263ffffffff1660e01b81526004016105d791906115c2565b600060405180830381600087803b1580156105f157600080fd5b505af1158015610605573d6000803e3d6000fd5b505050600083815260036020908152604080832080548a019055600180835281842089855283528184208b9055868452918390529182902090870190555173ffffffffffffffffffffffffffffffffffffffff808a1692508516907f24a80c4e3ef74c732b163bfb2decfbe077a51aef3b708c93f8ef3dd06fc3ea7c906106919088908b908b90611840565b60405180910390a350505050505050565b6000806106af8484610b31565b600090815260208190526040902054949350505050565b6000806106d38585610b31565b60009081526001602090815260408083208684529091529020549150509392505050565b6060825167ffffffffffffffff8111801561071157600080fd5b5060405190808252806020026020018201604052801561073b578160200160208202803683370190505b50905060008060008061074c610f91565b60005b89518110156109715789818151811061076457fe5b6020026020010151915060008061077e8460000151610b23565b915091506107a78b85606001518151811061079557fe5b60200260200101518560400151610b31565b8814156107e957818714156107c457806001901b861795506107db565b6107d0888f8989610c88565b819650806001901b95505b83602001518501945061082c565b8715610805576107fb888f8989610c88565b6108058886610d3c565b6108188b85606001518151811061079557fe5b9750819650806001901b9550836020015194505b505060018a510381141561085057610846868d8787610c88565b6108508684610d3c565b6108698683600001518e85602001518660800151610b64565b61089f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c3906117a6565b8160200151878360600151815181106108b457fe5b6020026020010181815101915081815250508b73ffffffffffffffffffffffffffffffffffffffff16898360600151815181106108ed57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16836040015173ffffffffffffffffffffffffffffffffffffffff167ff3f33f2319d28d6a1402aa9e6ca0ae16d3ada035d576b3b8074b422aaa03b69885600001518f876020015160405161096193929190611814565b60405180910390a460010161074f565b50600087610980576001610983565b60025b90506060895167ffffffffffffffff8111801561099f57600080fd5b506040519080825280602002602001820160405280156109d957816020015b6109c6610f61565b8152602001906001900390816109be5790505b50905060005b8a51811015610aa1576040518060a001604052808460038111156109ff57fe5b81526020018c8381518110610a1057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1681526020018a8381518110610a3f57fe5b602002602001015181526020013073ffffffffffffffffffffffffffffffffffffffff1681526020018e73ffffffffffffffffffffffffffffffffffffffff16815250828281518110610a8e57fe5b60209081029190910101526001016109df565b50610aaa6102da565b73ffffffffffffffffffffffffffffffffffffffff16630e8e3e84826040518263ffffffff1660e01b8152600401610ae291906115c2565b600060405180830381600087803b158015610afc57600080fd5b505af1158015610b10573d6000803e3d6000fd5b5050505050505050505050505050505050565b61010081049160ff90911690565b60008282604051602001610b46929190611531565b60405160208183030381529060405280519060200120905092915050565b6000808484604051602001610b7a9291906114b5565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152815160209283012060008a8152600184528281208a8252909352912054909150610bd490849083610d9d565b979650505050505050565b610c82846323b872dd60e01b858585604051602401610c009392919061156b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610e3a565b50505050565b600084815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452825280832085845290915290205481811615610cfa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c390611712565b600094855260026020908152604080872073ffffffffffffffffffffffffffffffffffffffff9096168752948152848620938652929092529190922091179055565b600082815260036020526040902054811115610d84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102c390611749565b6000918252600360205260409091208054919091039055565b600081815b8551811015610e2f576000868281518110610db957fe5b60200260200101519050808311610dfa578281604051602001610ddd9291906114ea565b604051602081830303815290604052805190602001209250610e26565b8083604051602001610e0d9291906114ea565b6040516020818303038152906040528051906020012092505b50600101610da2565b509092149392505050565b600060608373ffffffffffffffffffffffffffffffffffffffff1683604051610e6391906114f8565b6000604051808303816000865af19150503d8060008114610ea0576040519150601f19603f3d011682016040523d82523d6000602084013e610ea5565b606091505b50915091506000821415610ebd573d6000803e3d6000fd5b610c82815160001480610edf575081806020019051810190610edf91906112eb565b6101a281610ef057610ef081610ef4565b5050565b7f08c379a0000000000000000000000000000000000000000000000000000000006000908152602060045260076024526642414c23000030600a808404818106603090810160081b95839006959095019082900491820690940160101b939093010160c81b604452606490fd5b6040805160a081019091528060008152600060208201819052604082018190526060820181905260809091015290565b6040518060a001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001606081525090565b803561026e8161189d565b600082601f830112610ff1578081fd5b8135611004610fff8261187d565b611856565b81815291506020808301908481018184028601820187101561102557600080fd5b60005b8481101561104457813584529282019290820190600101611028565b505050505092915050565b600082601f83011261105f578081fd5b813561106d610fff8261187d565b81815291506020808301908481018184028601820187101561108e57600080fd5b60005b848110156110445781356110a48161189d565b84529282019290820190600101611091565b600082601f8301126110c6578081fd5b81356110d4610fff8261187d565b818152915060208083019084810160005b84811015611044578135870160a0807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838c0301121561112457600080fd5b61112d81611856565b85830135815260408084013587830152606061114b8d828701610fd6565b828401526080915081850135818401525082840135925067ffffffffffffffff83111561117757600080fd5b6111858c8885870101610fe1565b908201528652505092820192908201906001016110e5565b6000806000606084860312156111b1578283fd5b83356111bc8161189d565b9250602084013567ffffffffffffffff808211156111d8578384fd5b6111e4878388016110b6565b935060408601359150808211156111f9578283fd5b506112068682870161104f565b9150509250925092565b60008060008060008060a08789031215611228578182fd5b86356112338161189d565b9550602087013567ffffffffffffffff8082111561124f578384fd5b61125b8a838b016110b6565b96506040890135915080821115611270578384fd5b61127c8a838b0161104f565b95506060890135915061128e8261189d565b909350608088013590808211156112a3578384fd5b818901915089601f8301126112b6578384fd5b8135818111156112c4578485fd5b8a60208285010111156112d5578485fd5b6020830194508093505050509295509295509295565b6000602082840312156112fc578081fd5b8151801515811461130b578182fd5b9392505050565b60008060408385031215611324578182fd5b823561132f8161189d565b9150602083013561133f8161189d565b809150509250929050565b60008060006060848603121561135e578283fd5b83356113698161189d565b925060208401356113798161189d565b929592945050506040919091013590565b6000806000806080858703121561139f578384fd5b84356113aa8161189d565b935060208501356113ba8161189d565b92506040850135915060608501356113d18161189d565b939692955090935050565b60008060008060008060c087890312156113f4578182fd5b86356113ff8161189d565b9550602087013561140f8161189d565b94506040870135935060608701356114268161189d565b92506080870135915060a087013567ffffffffffffffff811115611448578182fd5b61145489828a01610fe1565b9150509295509295509295565b60008060008060808587031215611476578182fd5b84356114818161189d565b966020860135965060408601359560600135945092505050565b73ffffffffffffffffffffffffffffffffffffffff169052565b60609290921b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168252601482015260340190565b918252602082015260400190565b60008251815b8181101561151857602081860181015185830152016114fe565b818111156115265782828501525b509190910192915050565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606093841b811682529190921b16601482015260280190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000919060409081850190868401855b8281101561164c5781518051600481106115f557fe5b8552808701516116078887018261149b565b5085810151868601526060808201516116228288018261149b565b5050608090810151906116378682018361149b565b505060a09390930192908501906001016115df565b5091979650505050505050565b901515815260200190565b90815260200190565b60006020825282602083015282846040840137818301604090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b60208082526017908201527f696e76616c696420646973747269627574696f6e204944000000000000000000604082015260600190565b60208082526012908201527f63616e6e6f7420636c61696d2074776963650000000000000000000000000000604082015260600190565b60208082526037908201527f6469737472696275746f72206861736e27742070726f7669646564207375666660408201527f696369656e7420746f6b656e7320666f7220636c61696d000000000000000000606082015260800190565b60208082526016908201527f696e636f7272656374206d65726b6c652070726f6f6600000000000000000000604082015260600190565b6020808252601b908201527f75736572206d75737420636c61696d206f776e2062616c616e63650000000000604082015260600190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff8111828210171561187557600080fd5b604052919050565b600067ffffffffffffffff821115611893578081fd5b5060209081020190565b73ffffffffffffffffffffffffffffffffffffffff811681146118bf57600080fd5b5056fea2646970667358221220f9a8e75dc6691ffb23712d46d1514f8655d6e950a762ea801145aba797c431b064736f6c63430007010033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8
-----Decoded View---------------
Arg [0] : vault (address): 0xBA12222222228d8Ba445958a75a0704d566BF2C8
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000ba12222222228d8ba445958a75a0704d566bf2c8
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.