Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MlpBalance
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 50 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/IMlpManager.sol";
contract MlpBalance {
using SafeMath for uint256;
IMlpManager public mlpManager;
address public stakedMlpTracker;
mapping(address => mapping(address => uint256)) public allowances;
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(IMlpManager _mlpManager, address _stakedMlpTracker) public {
mlpManager = _mlpManager;
stakedMlpTracker = _stakedMlpTracker;
}
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, "MlpBalance: 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), "MlpBalance: approve from the zero address");
require(_spender != address(0), "MlpBalance: 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), "MlpBalance: transfer from the zero address");
require(_recipient != address(0), "MlpBalance: transfer to the zero address");
require(mlpManager.lastAddedAt(_sender).add(mlpManager.cooldownDuration()) <= block.timestamp, "MlpBalance: cooldown duration not yet passed");
IERC20(stakedMlpTracker).transferFrom(_sender, _recipient, _amount);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
interface IMlpManager {
function usdm() external view returns (address);
function cooldownDuration() external returns (uint256);
function setCooldownDuration(uint256 _cooldownDuration) external;
function lastAddedAt(address _account) external returns (uint256);
function addLiquidity(
address _token,
uint256 _amount,
uint256 _minUsdm,
uint256 _minMlp
) external returns (uint256);
function addLiquidityForAccount(
address _fundingAccount,
address _account,
address _token,
uint256 _amount,
uint256 _minUsdm,
uint256 _minMlp
) external returns (uint256);
function removeLiquidity(
address _tokenOut,
uint256 _mlpAmount,
uint256 _minOut,
address _receiver
) external returns (uint256);
function removeLiquidityForAccount(
address _account,
address _tokenOut,
uint256 _mlpAmount,
uint256 _minOut,
address _receiver
) external returns (uint256);
}// 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);
}{
"optimizer": {
"enabled": true,
"runs": 50
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IMlpManager","name":"_mlpManager","type":"address"},{"internalType":"address","name":"_stakedMlpTracker","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":"mlpManager","outputs":[{"internalType":"contract IMlpManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedMlpTracker","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
608060405234801561001057600080fd5b5060405161088a38038061088a8339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b039384166001600160a01b031991821617909155600180549390921692169190911790556108108061007a6000396000f3fe608060405234801561001057600080fd5b506004361061006d5760003560e01c8063095ea7b31461007257806323b872dd146100b257806355b6ed5c146100e8578063a9059cbb14610128578063cbb91c5e14610154578063d4d933f014610178578063dd62ed3e14610180575b600080fd5b61009e6004803603604081101561008857600080fd5b506001600160a01b0381351690602001356101ae565b604080519115158252519081900360200190f35b61009e600480360360608110156100c857600080fd5b506001600160a01b038135811691602081013590911690604001356101c4565b610116600480360360408110156100fe57600080fd5b506001600160a01b0381358116916020013516610232565b60408051918252519081900360200190f35b61009e6004803603604081101561013e57600080fd5b506001600160a01b03813516906020013561024f565b61015c61025c565b604080516001600160a01b039092168252519081900360200190f35b61015c61026b565b6101166004803603604081101561019657600080fd5b506001600160a01b038135811691602001351661027a565b60006101bb3384846102a5565b50600192915050565b60008061020f836040518060600160405280602d8152602001610731602d91396001600160a01b03881660009081526002602090815260408083203384529091529020549190610391565b905061021c8533836102a5565b610227858585610428565b506001949350505050565b600260209081526000928352604080842090915290825290205481565b60006101bb338484610428565b6000546001600160a01b031681565b6001546001600160a01b031681565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6001600160a01b0383166102ea5760405162461bcd60e51b815260040180806020018281038252602981526020018061078a6029913960400191505060405180910390fd5b6001600160a01b03821661032f5760405162461bcd60e51b815260040180806020018281038252602781526020018061070a6027913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600081848411156104205760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156103e55781810151838201526020016103cd565b50505050905090810190601f1680156104125780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03831661046d5760405162461bcd60e51b815260040180806020018281038252602a8152602001806106e0602a913960400191505060405180910390fd5b6001600160a01b0382166104b25760405162461bcd60e51b81526004018080602001828103825260288152602001806107b36028913960400191505060405180910390fd5b426105b460008054906101000a90046001600160a01b03166001600160a01b031663352693156040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561050457600080fd5b505af1158015610518573d6000803e3d6000fd5b505050506040513d602081101561052e57600080fd5b50516000805460408051638b770e1160e01b81526001600160a01b038a8116600483015291519190921692638b770e1192602480820193602093909283900390910190829087803b15801561058257600080fd5b505af1158015610596573d6000803e3d6000fd5b505050506040513d60208110156105ac57600080fd5b505190610680565b11156105f15760405162461bcd60e51b815260040180806020018281038252602c81526020018061075e602c913960400191505060405180910390fd5b600154604080516323b872dd60e01b81526001600160a01b038681166004830152858116602483015260448201859052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561064f57600080fd5b505af1158015610663573d6000803e3d6000fd5b505050506040513d602081101561067957600080fd5b5050505050565b6000828201838110156106d8576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b939250505056fe4d6c7042616c616e63653a207472616e736665722066726f6d20746865207a65726f20616464726573734d6c7042616c616e63653a20617070726f766520746f20746865207a65726f20616464726573734d6c7042616c616e63653a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654d6c7042616c616e63653a20636f6f6c646f776e206475726174696f6e206e6f7420796574207061737365644d6c7042616c616e63653a20617070726f76652066726f6d20746865207a65726f20616464726573734d6c7042616c616e63653a207472616e7366657220746f20746865207a65726f2061646472657373a26469706673582212205a6cc322d48dff7b973549c486df919eea2373147d5443968260c48be0ecd45464736f6c634300060c0033000000000000000000000000d20deab29db49742d52fe0708d766a343de58efe000000000000000000000000d65b02f0f0202916d744db9458538611275b5a7f
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061006d5760003560e01c8063095ea7b31461007257806323b872dd146100b257806355b6ed5c146100e8578063a9059cbb14610128578063cbb91c5e14610154578063d4d933f014610178578063dd62ed3e14610180575b600080fd5b61009e6004803603604081101561008857600080fd5b506001600160a01b0381351690602001356101ae565b604080519115158252519081900360200190f35b61009e600480360360608110156100c857600080fd5b506001600160a01b038135811691602081013590911690604001356101c4565b610116600480360360408110156100fe57600080fd5b506001600160a01b0381358116916020013516610232565b60408051918252519081900360200190f35b61009e6004803603604081101561013e57600080fd5b506001600160a01b03813516906020013561024f565b61015c61025c565b604080516001600160a01b039092168252519081900360200190f35b61015c61026b565b6101166004803603604081101561019657600080fd5b506001600160a01b038135811691602001351661027a565b60006101bb3384846102a5565b50600192915050565b60008061020f836040518060600160405280602d8152602001610731602d91396001600160a01b03881660009081526002602090815260408083203384529091529020549190610391565b905061021c8533836102a5565b610227858585610428565b506001949350505050565b600260209081526000928352604080842090915290825290205481565b60006101bb338484610428565b6000546001600160a01b031681565b6001546001600160a01b031681565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6001600160a01b0383166102ea5760405162461bcd60e51b815260040180806020018281038252602981526020018061078a6029913960400191505060405180910390fd5b6001600160a01b03821661032f5760405162461bcd60e51b815260040180806020018281038252602781526020018061070a6027913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600081848411156104205760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156103e55781810151838201526020016103cd565b50505050905090810190601f1680156104125780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b03831661046d5760405162461bcd60e51b815260040180806020018281038252602a8152602001806106e0602a913960400191505060405180910390fd5b6001600160a01b0382166104b25760405162461bcd60e51b81526004018080602001828103825260288152602001806107b36028913960400191505060405180910390fd5b426105b460008054906101000a90046001600160a01b03166001600160a01b031663352693156040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561050457600080fd5b505af1158015610518573d6000803e3d6000fd5b505050506040513d602081101561052e57600080fd5b50516000805460408051638b770e1160e01b81526001600160a01b038a8116600483015291519190921692638b770e1192602480820193602093909283900390910190829087803b15801561058257600080fd5b505af1158015610596573d6000803e3d6000fd5b505050506040513d60208110156105ac57600080fd5b505190610680565b11156105f15760405162461bcd60e51b815260040180806020018281038252602c81526020018061075e602c913960400191505060405180910390fd5b600154604080516323b872dd60e01b81526001600160a01b038681166004830152858116602483015260448201859052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561064f57600080fd5b505af1158015610663573d6000803e3d6000fd5b505050506040513d602081101561067957600080fd5b5050505050565b6000828201838110156106d8576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b939250505056fe4d6c7042616c616e63653a207472616e736665722066726f6d20746865207a65726f20616464726573734d6c7042616c616e63653a20617070726f766520746f20746865207a65726f20616464726573734d6c7042616c616e63653a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654d6c7042616c616e63653a20636f6f6c646f776e206475726174696f6e206e6f7420796574207061737365644d6c7042616c616e63653a20617070726f76652066726f6d20746865207a65726f20616464726573734d6c7042616c616e63653a207472616e7366657220746f20746865207a65726f2061646472657373a26469706673582212205a6cc322d48dff7b973549c486df919eea2373147d5443968260c48be0ecd45464736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d20deab29db49742d52fe0708d766a343de58efe000000000000000000000000d65b02f0f0202916d744db9458538611275b5a7f
-----Decoded View---------------
Arg [0] : _mlpManager (address): 0xD20dEab29dB49742D52Fe0708d766A343DE58EFe
Arg [1] : _stakedMlpTracker (address): 0xD65B02F0f0202916d744DB9458538611275B5a7f
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000d20deab29db49742d52fe0708d766a343de58efe
Arg [1] : 000000000000000000000000d65b02f0f0202916d744db9458538611275b5a7f
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.