Contract
0xf7D5DcE55E6D47852F054697BAB6A1B48A00ddbd
4
Contract Overview
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
View more zero value Internal Transactions in Advanced View mode
Contract Name:
ChildChainGaugeRewardHelper
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: 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; pragma experimental ABIEncoderV2; import "../solidity-utils/openzeppelin/IERC20.sol"; // For compatibility, we're keeping the same function names as in the original Curve code, including the mixed-case // naming convention. // solhint-disable func-name-mixedcase, var-name-mixedcase interface IRewardTokenDistributor { struct Reward { IERC20 token; address distributor; uint256 period_finish; uint256 rate; uint256 last_update; uint256 integral; } function reward_tokens(uint256 index) external view returns (IERC20); function reward_data(IERC20 token) external view returns (Reward memory); function claim_rewards(address user) external; function add_reward(IERC20 rewardToken, address distributor) external; function set_reward_distributor(IERC20 rewardToken, address distributor) external; function deposit_reward_token(IERC20 rewardToken, uint256 amount) external; function claimable_reward(address rewardToken, address user) external view returns (uint256); function claimable_reward_write(address rewardToken, address user) external 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; import "../solidity-utils/openzeppelin/IERC20.sol"; // For compatibility, we're keeping the same function names as in the original Curve code, including the mixed-case // naming convention. // solhint-disable func-name-mixedcase interface IChildChainStreamer { function initialize(address gauge) external; function get_reward() external; function reward_tokens(uint256 index) external view returns (IERC20); function add_reward( IERC20 rewardToken, address distributor, uint256 duration ) 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; import "./IChildChainStreamer.sol"; import "./IRewardTokenDistributor.sol"; // For compatibility, we're keeping the same function names as in the original Curve code, including the mixed-case // naming convention. // solhint-disable func-name-mixedcase interface IRewardsOnlyGauge is IRewardTokenDistributor { function initialize( address pool, address streamer, bytes32 claimSignature ) external; // solhint-disable-next-line func-name-mixedcase function lp_token() external view returns (IERC20); function reward_contract() external view returns (IChildChainStreamer); function set_rewards( address childChainStreamer, bytes32 claimSig, address[8] calldata rewardTokens ) external; function last_claim() 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; pragma experimental ABIEncoderV2; import "@balancer-labs/v2-interfaces/contracts/liquidity-mining/IRewardsOnlyGauge.sol"; import "@balancer-labs/v2-interfaces/contracts/liquidity-mining/IChildChainStreamer.sol"; /** * @title ChildChainGaugeRewardHelper * @author Balancer Labs * @notice Helper contract which allows claiming rewards from many RewardsOnlyGauges in a single transaction. * This contract manually triggers an update to the gauges' streamers as a workaround for the gauge . */ contract ChildChainGaugeRewardHelper { uint256 public constant CLAIM_FREQUENCY = 3600; /** * @notice Returns the amount of ERC20 token `token` on RewardsOnlyGauge `gauge` claimable by address `user`. * @dev This function cannot be marked `view` as it updates the gauge's state (not possible in a view context). * Offchain users attempting to read from this function should manually perform a static call or modify the abi. * @param gauge - The address of the RewardsOnlyGauge for which to query. * @param user - The address of the user for which to query. * @param token - The address of the reward token for which to query. */ function getPendingRewards( IRewardsOnlyGauge gauge, address user, address token ) external returns (uint256) { gauge.reward_contract().get_reward(); return gauge.claimable_reward_write(user, token); } /** * @notice Claims pending rewards on RewardsOnlyGauge `gauge` for account `user`. * @param gauge - The address of the RewardsOnlyGauge from which to claim rewards. * @param user - The address of the user for which to claim rewards. */ function claimRewardsFromGauge(IRewardsOnlyGauge gauge, address user) external { _claimRewardsFromGauge(gauge, user); } /** * @notice Claims pending rewards on a list of RewardsOnlyGauges `gauges` for account `user`. * @param gauges - An array of address of RewardsOnlyGauges from which to claim rewards. * @param user - The address of the user for which to claim rewards. */ function claimRewardsFromGauges(IRewardsOnlyGauge[] calldata gauges, address user) external { for (uint256 i = 0; i < gauges.length; i++) { _claimRewardsFromGauge(gauges[i], user); } } // Internal functions function _claimRewardsFromGauge(IRewardsOnlyGauge gauge, address user) internal { // Force rewards from the streamer onto the gauge. gauge.reward_contract().get_reward(); gauge.claim_rewards(user); } }
{ "optimizer": { "enabled": true, "runs": 9999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[],"name":"CLAIM_FREQUENCY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IRewardsOnlyGauge","name":"gauge","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"claimRewardsFromGauge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRewardsOnlyGauge[]","name":"gauges","type":"address[]"},{"internalType":"address","name":"user","type":"address"}],"name":"claimRewardsFromGauges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRewardsOnlyGauge","name":"gauge","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506105ed806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80635db749491461005157806371d5065c1461007a578063c2ec33b51461008f578063ff98f88d146100a2575b600080fd5b61006461005f3660046104ea565b6100aa565b6040516100719190610589565b60405180910390f35b61008d6100883660046104b2565b610237565b005b61008d61009d3660046103f3565b610245565b610064610288565b60008373ffffffffffffffffffffffffffffffffffffffff1663bf88a6ff6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100f257600080fd5b505afa158015610106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012a9190610473565b73ffffffffffffffffffffffffffffffffffffffff16631afe22a66040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561017157600080fd5b505af1158015610185573d6000803e3d6000fd5b50506040517f59b7e40900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff871692506359b7e40991506101dd9086908690600401610562565b602060405180830381600087803b1580156101f757600080fd5b505af115801561020b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022f9190610529565b949350505050565b610241828261028e565b5050565b60005b828110156102825761027a84848381811061025f57fe5b90506020020160208101906102749190610496565b8361028e565b600101610248565b50505050565b610e1081565b8173ffffffffffffffffffffffffffffffffffffffff1663bf88a6ff6040518163ffffffff1660e01b815260040160206040518083038186803b1580156102d457600080fd5b505afa1580156102e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030c9190610473565b73ffffffffffffffffffffffffffffffffffffffff16631afe22a66040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561035357600080fd5b505af1158015610367573d6000803e3d6000fd5b50506040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851692506384e9bd7e91506103bd908490600401610541565b600060405180830381600087803b1580156103d757600080fd5b505af11580156103eb573d6000803e3d6000fd5b505050505050565b600080600060408486031215610407578283fd5b833567ffffffffffffffff8082111561041e578485fd5b818601915086601f830112610431578485fd5b81358181111561043f578586fd5b8760208083028501011115610452578586fd5b6020928301955093505084013561046881610592565b809150509250925092565b600060208284031215610484578081fd5b815161048f81610592565b9392505050565b6000602082840312156104a7578081fd5b813561048f81610592565b600080604083850312156104c4578182fd5b82356104cf81610592565b915060208301356104df81610592565b809150509250929050565b6000806000606084860312156104fe578283fd5b833561050981610592565b9250602084013561051981610592565b9150604084013561046881610592565b60006020828403121561053a578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b90815260200190565b73ffffffffffffffffffffffffffffffffffffffff811681146105b457600080fd5b5056fea2646970667358221220618a016f9f5f617a2dc22c26b5f542fba6f244a263be60b7ec1b49e36bce326564736f6c63430007010033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.