Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
RewardReader
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "../libraries/token/IERC20.sol"; import "../libraries/math/SafeMath.sol"; import "../staking/interfaces/IRewardTracker.sol"; contract RewardReader { using SafeMath for uint256; function getDepositBalances( address _account, address[] memory _depositTokens, address[] memory _rewardTrackers ) public view returns (uint256[] memory) { uint256[] memory amounts = new uint256[](_rewardTrackers.length); for (uint256 i = 0; i < _rewardTrackers.length; i++) { IRewardTracker rewardTracker = IRewardTracker(_rewardTrackers[i]); amounts[i] = rewardTracker.depositBalances(_account, _depositTokens[i]); } return amounts; } function getStakingInfo(address _account, address[] memory _rewardTrackers) public view returns (uint256[] memory) { uint256 propsLength = 5; uint256[] memory amounts = new uint256[](_rewardTrackers.length * propsLength); for (uint256 i = 0; i < _rewardTrackers.length; i++) { IRewardTracker rewardTracker = IRewardTracker(_rewardTrackers[i]); amounts[i * propsLength] = rewardTracker.claimable(_account); amounts[i * propsLength + 1] = rewardTracker.tokensPerInterval(); amounts[i * propsLength + 2] = rewardTracker.averageStakedAmounts(_account); amounts[i * propsLength + 3] = rewardTracker.cumulativeRewards(_account); amounts[i * propsLength + 4] = IERC20(_rewardTrackers[i]).totalSupply(); } return amounts; } }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; interface IRewardTracker { function depositBalances(address _account, address _depositToken) external view returns (uint256); function stakedAmounts(address _account) external view returns (uint256); function updateRewards() external; function stake(address _depositToken, uint256 _amount) external; function stakeForAccount(address _fundingAccount, address _account, address _depositToken, uint256 _amount) external; function unstake(address _depositToken, uint256 _amount) external; function unstakeForAccount(address _account, address _depositToken, uint256 _amount, address _receiver) external; function tokensPerInterval() external view returns (uint256); function claim(address _receiver) external returns (uint256); function claimForAccount(address _account, address _receiver) external returns (uint256); function claimable(address _account) external view returns (uint256); function averageStakedAmounts(address _account) external view returns (uint256); function cumulativeRewards(address _account) external view returns (uint256); }
{ "metadata": { "bytecodeHash": "none", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 1 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address[]","name":"_depositTokens","type":"address[]"},{"internalType":"address[]","name":"_rewardTrackers","type":"address[]"}],"name":"getDepositBalances","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address[]","name":"_rewardTrackers","type":"address[]"}],"name":"getStakingInfo","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061070b806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063575157e41461003b578063937a0be8146101be575b600080fd5b61016e6004803603606081101561005157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561007b57600080fd5b82018360208201111561008d57600080fd5b803590602001918460208302840111600160201b831117156100ae57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156100fd57600080fd5b82018360208201111561010f57600080fd5b803590602001918460208302840111600160201b8311171561013057600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061026f945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156101aa578181015183820152602001610192565b505050509050019250505060405180910390f35b61016e600480360360408110156101d457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156101fe57600080fd5b82018360208201111561021057600080fd5b803590602001918460208302840111600160201b8311171561023157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506103a2945050505050565b60608082516001600160401b038111801561028957600080fd5b506040519080825280602002602001820160405280156102b3578160200160208202803683370190505b50905060005b83518110156103995760008482815181106102d057fe5b60200260200101519050806001600160a01b031663f5d9d63e888885815181106102f657fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561034b57600080fd5b505afa15801561035f573d6000803e3d6000fd5b505050506040513d602081101561037557600080fd5b5051835184908490811061038557fe5b6020908102919091010152506001016102b9565b50949350505050565b60606000600590506060818451026001600160401b03811180156103c557600080fd5b506040519080825280602002602001820160405280156103ef578160200160208202803683370190505b50905060005b845181101561039957600085828151811061040c57fe5b60200260200101519050806001600160a01b031663402914f5886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561046357600080fd5b505afa158015610477573d6000803e3d6000fd5b505050506040513d602081101561048d57600080fd5b50518351849084870290811061049f57fe5b602002602001018181525050806001600160a01b031663a8d936276040518163ffffffff1660e01b815260040160206040518083038186803b1580156104e457600080fd5b505afa1580156104f8573d6000803e3d6000fd5b505050506040513d602081101561050e57600080fd5b50518351849060018588020190811061052357fe5b602002602001018181525050806001600160a01b031663a3180217886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561057c57600080fd5b505afa158015610590573d6000803e3d6000fd5b505050506040513d60208110156105a657600080fd5b5051835184906002858802019081106105bb57fe5b602002602001018181525050806001600160a01b0316633792def3886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561061457600080fd5b505afa158015610628573d6000803e3d6000fd5b505050506040513d602081101561063e57600080fd5b50518351849060038588020190811061065357fe5b60200260200101818152505085828151811061066b57fe5b60200260200101516001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156106ab57600080fd5b505afa1580156106bf573d6000803e3d6000fd5b505050506040513d60208110156106d557600080fd5b5051835184906004858802019081106106ea57fe5b6020908102919091010152506001016103f556fea164736f6c634300060c000a
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063575157e41461003b578063937a0be8146101be575b600080fd5b61016e6004803603606081101561005157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561007b57600080fd5b82018360208201111561008d57600080fd5b803590602001918460208302840111600160201b831117156100ae57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156100fd57600080fd5b82018360208201111561010f57600080fd5b803590602001918460208302840111600160201b8311171561013057600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061026f945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156101aa578181015183820152602001610192565b505050509050019250505060405180910390f35b61016e600480360360408110156101d457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156101fe57600080fd5b82018360208201111561021057600080fd5b803590602001918460208302840111600160201b8311171561023157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506103a2945050505050565b60608082516001600160401b038111801561028957600080fd5b506040519080825280602002602001820160405280156102b3578160200160208202803683370190505b50905060005b83518110156103995760008482815181106102d057fe5b60200260200101519050806001600160a01b031663f5d9d63e888885815181106102f657fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b15801561034b57600080fd5b505afa15801561035f573d6000803e3d6000fd5b505050506040513d602081101561037557600080fd5b5051835184908490811061038557fe5b6020908102919091010152506001016102b9565b50949350505050565b60606000600590506060818451026001600160401b03811180156103c557600080fd5b506040519080825280602002602001820160405280156103ef578160200160208202803683370190505b50905060005b845181101561039957600085828151811061040c57fe5b60200260200101519050806001600160a01b031663402914f5886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561046357600080fd5b505afa158015610477573d6000803e3d6000fd5b505050506040513d602081101561048d57600080fd5b50518351849084870290811061049f57fe5b602002602001018181525050806001600160a01b031663a8d936276040518163ffffffff1660e01b815260040160206040518083038186803b1580156104e457600080fd5b505afa1580156104f8573d6000803e3d6000fd5b505050506040513d602081101561050e57600080fd5b50518351849060018588020190811061052357fe5b602002602001018181525050806001600160a01b031663a3180217886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561057c57600080fd5b505afa158015610590573d6000803e3d6000fd5b505050506040513d60208110156105a657600080fd5b5051835184906002858802019081106105bb57fe5b602002602001018181525050806001600160a01b0316633792def3886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561061457600080fd5b505afa158015610628573d6000803e3d6000fd5b505050506040513d602081101561063e57600080fd5b50518351849060038588020190811061065357fe5b60200260200101818152505085828151811061066b57fe5b60200260200101516001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156106ab57600080fd5b505afa1580156106bf573d6000803e3d6000fd5b505050506040513d60208110156106d557600080fd5b5051835184906004858802019081106106ea57fe5b6020908102919091010152506001016103f556fea164736f6c634300060c000a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.