Contract Overview
Balance:
0 ETH
ETH Value:
$0.00
My Name Tag:
Not Available
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
GlpBalance
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/math/SafeMath.sol"; import "../libraries/token/IERC20.sol"; import "../core/interfaces/IGlpManager.sol"; contract GlpBalance { using SafeMath for uint256; IGlpManager public glpManager; address public stakedGlpTracker; mapping (address => mapping (address => uint256)) public allowances; event Approval(address indexed owner, address indexed spender, uint256 value); constructor( IGlpManager _glpManager, address _stakedGlpTracker ) public { glpManager = _glpManager; stakedGlpTracker = _stakedGlpTracker; } function allowance(address _owner, address _spender) external view returns (uint256) { return allowances[_owner][_spender]; } function approve(address _spender, uint256 _amount) external returns (bool) { _approve(msg.sender, _spender, _amount); return true; } function transfer(address _recipient, uint256 _amount) external returns (bool) { _transfer(msg.sender, _recipient, _amount); return true; } function transferFrom(address _sender, address _recipient, uint256 _amount) external returns (bool) { uint256 nextAllowance = allowances[_sender][msg.sender].sub(_amount, "GlpBalance: transfer amount exceeds allowance"); _approve(_sender, msg.sender, nextAllowance); _transfer(_sender, _recipient, _amount); return true; } function _approve(address _owner, address _spender, uint256 _amount) private { require(_owner != address(0), "GlpBalance: approve from the zero address"); require(_spender != address(0), "GlpBalance: approve to the zero address"); allowances[_owner][_spender] = _amount; emit Approval(_owner, _spender, _amount); } function _transfer(address _sender, address _recipient, uint256 _amount) private { require(_sender != address(0), "GlpBalance: transfer from the zero address"); require(_recipient != address(0), "GlpBalance: transfer to the zero address"); require( glpManager.lastAddedAt(_sender).add(glpManager.cooldownDuration()) <= block.timestamp, "GlpBalance: cooldown duration not yet passed" ); IERC20(stakedGlpTracker).transferFrom(_sender, _recipient, _amount); } }
// 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 IGlpManager { function cooldownDuration() external returns (uint256); function lastAddedAt(address _account) external returns (uint256); function addLiquidity(address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp) external returns (uint256); function addLiquidityForAccount(address _fundingAccount, address _account, address _token, uint256 _amount, uint256 _minUsdg, uint256 _minGlp) external returns (uint256); function removeLiquidity(address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver) external returns (uint256); function removeLiquidityForAccount(address _account, address _tokenOut, uint256 _glpAmount, uint256 _minOut, address _receiver) external returns (uint256); }
{ "optimizer": { "enabled": true, "runs": 1 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"contract IGlpManager","name":"_glpManager","type":"address"},{"internalType":"address","name":"_stakedGlpTracker","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"glpManager","outputs":[{"internalType":"contract IGlpManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedGlpTracker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161088a38038061088a8339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b039384166001600160a01b031991821617909155600180549390921692169190911790556108108061007a6000396000f3fe608060405234801561001057600080fd5b506004361061006d5760003560e01c8063095ea7b31461007257806323b872dd146100b257806355b6ed5c146100e8578063a9059cbb14610128578063af394d0014610154578063dd62ed3e14610178578063fa6db1bc146101a6575b600080fd5b61009e6004803603604081101561008857600080fd5b506001600160a01b0381351690602001356101ae565b604080519115158252519081900360200190f35b61009e600480360360608110156100c857600080fd5b506001600160a01b038135811691602081013590911690604001356101c4565b610116600480360360408110156100fe57600080fd5b506001600160a01b0381358116916020013516610232565b60408051918252519081900360200190f35b61009e6004803603604081101561013e57600080fd5b506001600160a01b03813516906020013561024f565b61015c61025c565b604080516001600160a01b039092168252519081900360200190f35b6101166004803603604081101561018e57600080fd5b506001600160a01b038135811691602001351661026b565b61015c610296565b60006101bb3384846102a5565b50600192915050565b60008061020f836040518060600160405280602d81526020016106e0602d91396001600160a01b03881660009081526002602090815260408083203384529091529020549190610391565b905061021c8533836102a5565b610227858585610428565b506001949350505050565b600260209081526000928352604080842090915290825290205481565b60006101bb338484610428565b6001546001600160a01b031681565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6000546001600160a01b031681565b6001600160a01b0383166102ea5760405162461bcd60e51b815260040180806020018281038252602981526020018061070d6029913960400191505060405180910390fd5b6001600160a01b03821661032f5760405162461bcd60e51b81526004018080602001828103825260278152602001806107b46027913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600081848411156104205760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156103e55781810151838201526020016103cd565b50505050905090810190601f1680156104125780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03831661046d5760405162461bcd60e51b815260040180806020018281038252602a81526020018061078a602a913960400191505060405180910390fd5b6001600160a01b0382166104b25760405162461bcd60e51b81526004018080602001828103825260288152602001806107366028913960400191505060405180910390fd5b426105b460008054906101000a90046001600160a01b03166001600160a01b031663352693156040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561050457600080fd5b505af1158015610518573d6000803e3d6000fd5b505050506040513d602081101561052e57600080fd5b50516000805460408051638b770e1160e01b81526001600160a01b038a8116600483015291519190921692638b770e1192602480820193602093909283900390910190829087803b15801561058257600080fd5b505af1158015610596573d6000803e3d6000fd5b505050506040513d60208110156105ac57600080fd5b505190610680565b11156105f15760405162461bcd60e51b815260040180806020018281038252602c81526020018061075e602c913960400191505060405180910390fd5b600154604080516323b872dd60e01b81526001600160a01b038681166004830152858116602483015260448201859052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561064f57600080fd5b505af1158015610663573d6000803e3d6000fd5b505050506040513d602081101561067957600080fd5b5050505050565b6000828201838110156106d8576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b939250505056fe476c7042616c616e63653a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365476c7042616c616e63653a20617070726f76652066726f6d20746865207a65726f2061646472657373476c7042616c616e63653a207472616e7366657220746f20746865207a65726f2061646472657373476c7042616c616e63653a20636f6f6c646f776e206475726174696f6e206e6f742079657420706173736564476c7042616c616e63653a207472616e736665722066726f6d20746865207a65726f2061646472657373476c7042616c616e63653a20617070726f766520746f20746865207a65726f2061646472657373a26469706673582212209d1c2fd560db99651717fa89c7d8988f4eefce46a6bd5ae717c95e8e59804eac64736f6c634300060c0033000000000000000000000000321f653eed006ad1c29d174e17d96351bde226490000000000000000000000001addd80e6039594ee970e5872d247bf0414c8903
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000321f653eed006ad1c29d174e17d96351bde226490000000000000000000000001addd80e6039594ee970e5872d247bf0414c8903
-----Decoded View---------------
Arg [0] : _glpManager (address): 0x321f653eed006ad1c29d174e17d96351bde22649
Arg [1] : _stakedGlpTracker (address): 0x1addd80e6039594ee970e5872d247bf0414c8903
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000321f653eed006ad1c29d174e17d96351bde22649
Arg [1] : 0000000000000000000000001addd80e6039594ee970e5872d247bf0414c8903
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.