More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 732 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Migrate Stake | 17081361 | 660 days ago | IN | 0 ETH | 0.01111874 | ||||
Migrate Stake | 16969328 | 676 days ago | IN | 0 ETH | 0.0046518 | ||||
Migrate Stake | 16285913 | 772 days ago | IN | 0 ETH | 0.00236379 | ||||
Migrate Stake | 15986427 | 814 days ago | IN | 0 ETH | 0.00206348 | ||||
Migrate Stake | 15485923 | 885 days ago | IN | 0 ETH | 0.00386944 | ||||
Migrate Stake | 15347845 | 907 days ago | IN | 0 ETH | 0.0032393 | ||||
Migrate Stake | 15189308 | 932 days ago | IN | 0 ETH | 0.0018272 | ||||
Migrate Stake | 15090186 | 947 days ago | IN | 0 ETH | 0.01690297 | ||||
Migrate Stake | 15047627 | 954 days ago | IN | 0 ETH | 0.01485193 | ||||
Migrate Stake | 14846282 | 989 days ago | IN | 0 ETH | 0.01011349 | ||||
Migrate Stake | 14724414 | 1008 days ago | IN | 0 ETH | 0.0079605 | ||||
Migrate Stake | 14587202 | 1030 days ago | IN | 0 ETH | 0.00701698 | ||||
Migrate Stake | 14481116 | 1046 days ago | IN | 0 ETH | 0.00577817 | ||||
Migrate Stake | 14422998 | 1055 days ago | IN | 0 ETH | 0.00221026 | ||||
Migrate Stake | 14378997 | 1062 days ago | IN | 0 ETH | 0.00576897 | ||||
Migrate Stake | 14336038 | 1069 days ago | IN | 0 ETH | 0.00588887 | ||||
Migrate Stake | 14244531 | 1083 days ago | IN | 0 ETH | 0.00754058 | ||||
Unstake | 14240478 | 1084 days ago | IN | 0 ETH | 0.003666 | ||||
Migrate Stake | 14222805 | 1086 days ago | IN | 0 ETH | 0.01076213 | ||||
Unstake | 14212758 | 1088 days ago | IN | 0 ETH | 0.00570821 | ||||
Migrate Stake | 14200766 | 1090 days ago | IN | 0 ETH | 0.00615367 | ||||
Migrate Stake | 14162766 | 1096 days ago | IN | 0 ETH | 0.01253686 | ||||
Migrate Stake | 14157828 | 1096 days ago | IN | 0 ETH | 0.01031135 | ||||
Migrate Stake | 14154274 | 1097 days ago | IN | 0 ETH | 0.0190978 | ||||
Migrate Stake | 14043522 | 1114 days ago | IN | 0 ETH | 0.02135195 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PremiaFeeDiscount
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import "@openzeppelin/contracts/math/SafeMath.sol"; import '@openzeppelin/contracts/utils/SafeCast.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/ReentrancyGuard.sol'; import "./interface/INewPremiaFeeDiscount.sol"; import "./interface/IERC2612Permit.sol"; /// @author Premia /// @title A contract allowing you to lock xPremia to get Premia protocol fee discounts contract PremiaFeeDiscount is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; using SafeCast for uint256; struct UserInfo { uint256 balance; // Balance staked by user uint64 stakePeriod; // Stake period selected by user uint64 lockedUntil; // Timestamp at which the lock ends } struct StakeLevel { uint256 amount; // Amount to stake uint256 discount; // Discount when amount is reached } // The xPremia token IERC20 public xPremia; uint256 private constant _inverseBasisPoint = 1e4; // User data with balance staked and date at which lock ends mapping (address => UserInfo) public userInfo; // Available lockup periods with their bonus (seconds lockup => multiplier (x1 = 1e4)) mapping (uint256 => uint256) public stakePeriods; // List of all existing stake periods uint256[] public existingStakePeriods; // In case we want to upgrade this contract // Users will have to migrate their stake manually by calling migrateStake() so that there is no risk of funds being drained INewPremiaFeeDiscount public newContract; // Staking levels StakeLevel[] public stakeLevels; //////////// // Events // //////////// event Staked(address indexed user, uint256 amount, uint256 stakePeriod, uint256 lockedUntil); event Unstaked(address indexed user, uint256 amount); event StakeMigrated(address indexed user, address newContract, uint256 amount, uint256 stakePeriod, uint256 lockedUntil); ////////////////////////////////////////////////// ////////////////////////////////////////////////// ////////////////////////////////////////////////// /// @param _xPremia The xPremia token constructor(IERC20 _xPremia) { xPremia = _xPremia; } ////////////////////////////////////////////////// ////////////////////////////////////////////////// ////////////////////////////////////////////////// /////////// // Admin // /////////// /// @notice Set a new PremiaFeeDiscount contract, to enable migration /// Users will have to call the migration function themselves to migrate their own stake /// @param _newContract The new contract address function setNewContract(INewPremiaFeeDiscount _newContract) external onlyOwner { newContract = _newContract; } /// @notice Set a stake period multiplier /// @param _secondsLocked The length (in seconds) that the stake will be locked for /// @param _multiplier The multiplier (In basis points) that users will get from choosing this staking period function setStakePeriod(uint256 _secondsLocked, uint256 _multiplier) external onlyOwner { if (_isInArray(_secondsLocked, existingStakePeriods)) { existingStakePeriods.push(_secondsLocked); } stakePeriods[_secondsLocked] = _multiplier; } /// @notice Set new amounts and discounts values for stake levels /// @dev Previous stake levels will be removed and replace by the new ones given /// @param _stakeLevels The new stake levels to set function setStakeLevels(StakeLevel[] memory _stakeLevels) external onlyOwner { for (uint256 i=0; i < _stakeLevels.length; i++) { if (i > 0) { require(_stakeLevels[i].amount > _stakeLevels[i-1].amount && _stakeLevels[i].discount > _stakeLevels[i-1].discount, "Wrong stake level"); } } delete stakeLevels; for (uint256 i=0; i < _stakeLevels.length; i++) { stakeLevels.push(_stakeLevels[i]); } } ////////////////////////////////////////////////// ////////// // Main // ////////// /// @notice Allow a user to migrate their stake to a new PremiaFeeDiscount contract (If a new contract has been set), /// while preserving same lockup expiration date function migrateStake() external nonReentrant { require(address(newContract) != address(0), "Migration disabled"); UserInfo memory user = userInfo[msg.sender]; require(user.balance > 0, "No stake"); delete userInfo[msg.sender]; xPremia.safeIncreaseAllowance(address(newContract), user.balance); newContract.migrate(msg.sender, user.balance, user.stakePeriod, user.lockedUntil); emit StakeMigrated(msg.sender, address(newContract), user.balance, user.stakePeriod, user.lockedUntil); } /// @notice Stake using IERC2612 permit /// @param _amount The amount of xPremia to stake /// @param _period The lockup period (in seconds) /// @param _deadline Deadline after which permit will fail /// @param _v V /// @param _r R /// @param _s S function stakeWithPermit(uint256 _amount, uint256 _period, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s) external { IERC2612Permit(address(xPremia)).permit(msg.sender, address(this), _amount, _deadline, _v, _r, _s); stake(_amount, _period); } /// @notice Lockup xPremia for protocol fee discounts /// Longer period of locking will apply a multiplier on the amount staked, in the fee discount calculation /// @param _amount The amount of xPremia to stake /// @param _period The lockup period (in seconds) function stake(uint256 _amount, uint256 _period) public nonReentrant { require(stakePeriods[_period] > 0, "Stake period does not exists"); UserInfo storage user = userInfo[msg.sender]; uint256 lockedUntil = block.timestamp.add(_period); require(lockedUntil > user.lockedUntil, "Cannot add stake with lower stake period"); xPremia.safeTransferFrom(msg.sender, address(this), _amount); user.balance = user.balance.add(_amount); user.lockedUntil = lockedUntil.toUint64(); user.stakePeriod = _period.toUint64(); emit Staked(msg.sender, _amount, _period, lockedUntil); } /// @notice Unstake xPremia (If lockup period has ended) /// @param _amount The amount of xPremia to unstake function unstake(uint256 _amount) external nonReentrant { UserInfo storage user = userInfo[msg.sender]; // We allow unstake if the stakePeriod that the user used has been disabled require(stakePeriods[user.stakePeriod] == 0 || user.lockedUntil <= block.timestamp, "Stake still locked"); user.balance = user.balance.sub(_amount); xPremia.safeTransfer(msg.sender, _amount); emit Unstaked(msg.sender, _amount); } ////////////////////////////////////////////////// ////////// // View // ////////// /// @notice Get number of stake levels /// @return The amount of stake levels function stakeLevelsLength() external view returns(uint256) { return stakeLevels.length; } /// Calculate the stake amount of a user, after applying the bonus from the lockup period chosen /// @param _user The user from which to query the stake amount /// @return The user stake amount after applying the bonus function getStakeAmountWithBonus(address _user) public view returns(uint256) { UserInfo memory user = userInfo[_user]; return user.balance.mul(stakePeriods[user.stakePeriod]).div(_inverseBasisPoint); } /// @notice Calculate the % of fee discount for user, based on his stake /// @param _user The _user for which the discount is for /// @return Percentage of protocol fee discount (in basis point) /// Ex : 1000 = 10% fee discount function getDiscount(address _user) external view returns(uint256) { uint256 userBalance = getStakeAmountWithBonus(_user); for (uint256 i=0; i < stakeLevels.length; i++) { StakeLevel memory level = stakeLevels[i]; if (userBalance < level.amount) { uint256 amountPrevLevel; uint256 discountPrevLevel; // If stake is lower, user is in this level, and we need to LERP with prev level to get discount value if (i > 0) { amountPrevLevel = stakeLevels[i - 1].amount; discountPrevLevel = stakeLevels[i - 1].discount; } else { // If this is the first level, prev level is 0 / 0 amountPrevLevel = 0; discountPrevLevel = 0; } uint256 remappedDiscount = level.discount.sub(discountPrevLevel); uint256 remappedAmount = level.amount.sub(amountPrevLevel); uint256 remappedBalance = userBalance.sub(amountPrevLevel); uint256 levelProgress = remappedBalance.mul(_inverseBasisPoint).div(remappedAmount); return discountPrevLevel.add(remappedDiscount.mul(levelProgress).div(_inverseBasisPoint)); } } // If no match found it means user is >= max possible stake, and therefore has max discount possible return stakeLevels[stakeLevels.length - 1].discount; } ////////////////////////////////////////////////// ////////////// // Internal // ////////////// /// @notice Utility function to check if a value is inside an array /// @param _value The value to look for /// @param _array The array to check /// @return Whether the value is in the array or not function _isInArray(uint256 _value, uint256[] memory _array) internal pure returns(bool) { uint256 length = _array.length; for (uint256 i = 0; i < length; ++i) { if (_array[i] == _value) { return true; } } return false; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.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 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @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). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 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. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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.0 <0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such 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. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; interface INewPremiaFeeDiscount { function migrate(address _user, uint256 _amount, uint256 _stakePeriod, uint256 _lockedUntil) external; }
//SPDX-License-Identifier: MIT pragma solidity ^0.7.0; /** * @dev Interface of the ERC2612 standard as defined in the EIP. * * Adds the {permit} method, which can be used to change one's * {IERC20-allowance} without having to send a transaction, by signing a * message. This allows users to spend tokens without having to hold Ether. * * See https://eips.ethereum.org/EIPS/eip-2612. */ interface IERC2612Permit { /** * @dev Sets `amount` as the allowance of `spender` over `owner`'s tokens, * given `owner`'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current ERC2612 nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IERC20","name":"_xPremia","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"newContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakePeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockedUntil","type":"uint256"}],"name":"StakeMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakePeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockedUntil","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"existingStakePeriods","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getStakeAmountWithBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"migrateStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"newContract","outputs":[{"internalType":"contract INewPremiaFeeDiscount","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INewPremiaFeeDiscount","name":"_newContract","type":"address"}],"name":"setNewContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"}],"internalType":"struct PremiaFeeDiscount.StakeLevel[]","name":"_stakeLevels","type":"tuple[]"}],"name":"setStakeLevels","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_secondsLocked","type":"uint256"},{"internalType":"uint256","name":"_multiplier","type":"uint256"}],"name":"setStakePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakeLevels","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"discount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeLevelsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakePeriods","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"internalType":"uint8","name":"_v","type":"uint8"},{"internalType":"bytes32","name":"_r","type":"bytes32"},{"internalType":"bytes32","name":"_s","type":"bytes32"}],"name":"stakeWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint64","name":"stakePeriod","type":"uint64"},{"internalType":"uint64","name":"lockedUntil","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xPremia","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405162001bf638038062001bf6833981016040819052610031916100b2565b600061003b6100ae565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060018055600280546001600160a01b0319166001600160a01b03929092169190911790556100e0565b3390565b6000602082840312156100c3578081fd5b81516001600160a01b03811681146100d9578182fd5b9392505050565b611b0680620000f06000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c806362f03951116100ad5780639d50880f116100715780639d50880f1461023b578063d5d72e971461024e578063e1d3ef3614610261578063f2fde38b14610274578063f3b093681461028757610121565b806362f03951146101e45780636690714414610205578063715018a6146102185780637b0472f0146102205780638da5cb5b1461023357610121565b806321a9c714116100f457806321a9c714146101905780632e17de78146101a35780634313b531146101b657806343482fb9146101be5780635668b02e146101d157610121565b8063055c39cd1461012657806306f2791a146101445780630aed7b0d146101645780631959a0021461016e575b600080fd5b61012e61028f565b60405161013b91906117c4565b60405180910390f35b610157610152366004611646565b61029e565b60405161013b919061196f565b61016c61040f565b005b61018161017c366004611646565b61061d565b60405161013b9392919061199c565b61016c61019e36600461174c565b61064a565b61016c6101b1366004611734565b610749565b61012e61087c565b6101576101cc366004611646565b61088b565b61016c6101df36600461176d565b6108fa565b6101f76101f2366004611734565b61097a565b60405161013b929190611978565b610157610213366004611734565b6109a8565b61016c6109c9565b61016c61022e36600461174c565b610a6b565b61012e610c0e565b610157610249366004611734565b610c1d565b61016c61025c366004611646565b610c2f565b61016c61026f366004611662565b610ca9565b61016c610282366004611646565b610e08565b610157610f00565b6002546001600160a01b031681565b6000806102aa8361088b565b905060005b6007548110156103e1576000600782815481106102c857fe5b906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050905080600001518310156103d8576000808315610359576007600185038154811061031c57fe5b90600052602060002090600202016000015491506007600185038154811061034057fe5b9060005260206000209060020201600101549050610360565b5060009050805b60208301516000906103729083610f06565b84519091506000906103849085610f06565b905060006103928886610f06565b905060006103ac836103a684612710610f51565b90610faa565b90506103c86103c16127106103a68785610f51565b8690610fec565b995050505050505050505061040a565b506001016102af565b506007805460001981019081106103f457fe5b9060005260206000209060020201600101549150505b919050565b60026001541415610467576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556006546001600160a01b031661049d5760405162461bcd60e51b81526004016104949061184b565b60405180910390fd5b33600090815260036020908152604091829020825160608101845281548082526001909201546001600160401b0380821694830194909452600160401b900490921692820192909252906105035760405162461bcd60e51b8152600401610494906118bf565b33600090815260036020526040812090815560010180546fffffffffffffffffffffffffffffffff19169055600654815160025461054f926001600160a01b0391821692911690611046565b600654815160208301516040808501519051631dc8484f60e31b81526001600160a01b039094169363ee424278936105909333939192909190600401611819565b600060405180830381600087803b1580156105aa57600080fd5b505af11580156105be573d6000803e3d6000fd5b50506006548351602085015160408087015190513396507fbf26a6cba55b2ada584d48541e3986634d7ad78795b1eea765a63f4de5f97b60955061060e946001600160a01b031693929190611819565b60405180910390a25060018055565b600360205260009081526040902080546001909101546001600160401b0380821691600160401b90041683565b610652611137565b6000546001600160a01b039081169116146106a2576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b6106fc8260058054806020026020016040519081016040528092919081815260200182805480156106f257602002820191906000526020600020905b8154815260200190600101908083116106de575b505050505061113b565b1561073757600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018290555b60009182526004602052604090912055565b600260015414156107a1576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001908155336000908152600360209081526040808320938401546001600160401b03168352600490915290205415806107f25750600181015442600160401b9091046001600160401b031611155b61080e5760405162461bcd60e51b81526004016104949061190c565b805461081a9083610f06565b8155600254610833906001600160a01b03163384611183565b336001600160a01b03167f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f758360405161086c919061196f565b60405180910390a2505060018055565b6006546001600160a01b031681565b6001600160a01b03811660009081526003602090815260408083208151606081018352815481526001909101546001600160401b03808216838601819052600160401b90920416828401528452600490925282205481516108f391612710916103a691610f51565b9392505050565b60025460405163d505accf60e01b81526001600160a01b039091169063d505accf9061093690339030908b908a908a908a908a906004016117d8565b600060405180830381600087803b15801561095057600080fd5b505af1158015610964573d6000803e3d6000fd5b505050506109728686610a6b565b505050505050565b6007818154811061098a57600080fd5b60009182526020909120600290910201805460019091015490915082565b600581815481106109b857600080fd5b600091825260209091200154905081565b6109d1611137565b6000546001600160a01b03908116911614610a21576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60026001541415610ac3576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155600081815260046020526040902054610af35760405162461bcd60e51b815260040161049490611938565b33600090815260036020526040812090610b0d4284610fec565b6001830154909150600160401b90046001600160401b03168111610b435760405162461bcd60e51b815260040161049490611877565b600254610b5b906001600160a01b03163330876111da565b8154610b679085610fec565b8255610b7281611234565b8260010160086101000a8154816001600160401b0302191690836001600160401b03160217905550610ba383611234565b60018301805467ffffffffffffffff19166001600160401b039290921691909117905560405133907fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed90610bfc90879087908690611986565b60405180910390a25050600180555050565b6000546001600160a01b031690565b60046020526000908152604090205481565b610c37611137565b6000546001600160a01b03908116911614610c87576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b610cb1611137565b6000546001600160a01b03908116911614610d01576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b60005b8151811015610da7578015610d9f57816001820381518110610d2257fe5b602002602001015160000151828281518110610d3a57fe5b602002602001015160000151118015610d835750816001820381518110610d5d57fe5b602002602001015160200151828281518110610d7557fe5b602002602001015160200151115b610d9f5760405162461bcd60e51b8152600401610494906118e1565b600101610d04565b50610db460076000611607565b60005b8151811015610e04576007828281518110610dce57fe5b60209081029190910181015182546001818101855560009485529383902082516002909202019081559101519082015501610db7565b5050565b610e10611137565b6000546001600160a01b03908116911614610e60576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b6001600160a01b038116610ea55760405162461bcd60e51b81526004018080602001828103825260268152602001806119f46026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60075490565b6000610f4883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061127c565b90505b92915050565b600082610f6057506000610f4b565b82820282848281610f6d57fe5b0414610f485760405162461bcd60e51b8152600401808060200182810382526021815260200180611a406021913960400191505060405180910390fd5b6000610f4883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611313565b600082820183811015610f48576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006110dc82856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b1580156110aa57600080fd5b505afa1580156110be573d6000803e3d6000fd5b505050506040513d60208110156110d457600080fd5b505190610fec565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150611131908590611378565b50505050565b3390565b8051600090815b81811015611178578484828151811061115757fe5b6020026020010151141561117057600192505050610f4b565b600101611142565b506000949350505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526111d5908490611378565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611131908590611378565b6000600160401b82106112785760405162461bcd60e51b8152600401808060200182810382526026815260200180611a616026913960400191505060405180910390fd5b5090565b6000818484111561130b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112d05781810151838201526020016112b8565b50505050905090810190601f1680156112fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836113625760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156112d05781810151838201526020016112b8565b50600083858161136e57fe5b0495945050505050565b60006113cd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114299092919063ffffffff16565b8051909150156111d5578080602001905160208110156113ec57600080fd5b50516111d55760405162461bcd60e51b815260040180806020018281038252602a815260200180611aa7602a913960400191505060405180910390fd5b60606114388484600085611440565b949350505050565b6060824710156114815760405162461bcd60e51b8152600401808060200182810382526026815260200180611a1a6026913960400191505060405180910390fd5b61148a8561159b565b6114db576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106115195780518252601f1990920191602091820191016114fa565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461157b576040519150601f19603f3d011682016040523d82523d6000602084013e611580565b606091505b50915091506115908282866115a1565b979650505050505050565b3b151590565b606083156115b05750816108f3565b8251156115c05782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156112d05781810151838201526020016112b8565b5080546000825560020290600052602060002090810190611628919061162b565b50565b5b80821115611278576000808255600182015560020161162c565b600060208284031215611657578081fd5b8135610f48816119de565b60006020808385031215611674578182fd5b82356001600160401b038082111561168a578384fd5b818501915085601f83011261169d578384fd5b8135818111156116a957fe5b6116b684858302016119bb565b818152848101908486016040808502870188018b10156116d4578889fd5b8896505b848710156117255780828c0312156116ee578889fd5b8051818101818110888211171561170157fe5b825282358152888301358982015284526001969096019592870192908101906116d8565b50909998505050505050505050565b600060208284031215611745578081fd5b5035919050565b6000806040838503121561175e578081fd5b50508035926020909101359150565b60008060008060008060c08789031215611785578182fd5b863595506020870135945060408701359350606087013560ff811681146117aa578283fd5b9598949750929560808101359460a0909101359350915050565b6001600160a01b0391909116815260200190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b0394909416845260208401929092526001600160401b03908116604084015216606082015260800190565b602080825260129082015271135a59dc985d1a5bdb88191a5cd8589b195960721b604082015260600190565b60208082526028908201527f43616e6e6f7420616464207374616b652077697468206c6f776572207374616b60408201526719481c195c9a5bd960c21b606082015260800190565b6020808252600890820152674e6f207374616b6560c01b604082015260600190565b60208082526011908201527015dc9bdb99c81cdd185ad9481b195d995b607a1b604082015260600190565b60208082526012908201527114dd185ad9481cdd1a5b1b081b1bd8dad95960721b604082015260600190565b6020808252601c908201527f5374616b6520706572696f6420646f6573206e6f742065786973747300000000604082015260600190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b9283526001600160401b03918216602084015216604082015260600190565b6040518181016001600160401b03811182821017156119d657fe5b604052919050565b6001600160a01b038116811461162857600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7753616665436173743a2076616c756520646f65736e27742066697420696e20363420626974734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122002803ff8179b6461e96352d256f4adf5fcc59116a588cac12714d7abc8c1992364736f6c6343000706003300000000000000000000000016f9d564df80376c61ac914205d3fdff7057d610
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806362f03951116100ad5780639d50880f116100715780639d50880f1461023b578063d5d72e971461024e578063e1d3ef3614610261578063f2fde38b14610274578063f3b093681461028757610121565b806362f03951146101e45780636690714414610205578063715018a6146102185780637b0472f0146102205780638da5cb5b1461023357610121565b806321a9c714116100f457806321a9c714146101905780632e17de78146101a35780634313b531146101b657806343482fb9146101be5780635668b02e146101d157610121565b8063055c39cd1461012657806306f2791a146101445780630aed7b0d146101645780631959a0021461016e575b600080fd5b61012e61028f565b60405161013b91906117c4565b60405180910390f35b610157610152366004611646565b61029e565b60405161013b919061196f565b61016c61040f565b005b61018161017c366004611646565b61061d565b60405161013b9392919061199c565b61016c61019e36600461174c565b61064a565b61016c6101b1366004611734565b610749565b61012e61087c565b6101576101cc366004611646565b61088b565b61016c6101df36600461176d565b6108fa565b6101f76101f2366004611734565b61097a565b60405161013b929190611978565b610157610213366004611734565b6109a8565b61016c6109c9565b61016c61022e36600461174c565b610a6b565b61012e610c0e565b610157610249366004611734565b610c1d565b61016c61025c366004611646565b610c2f565b61016c61026f366004611662565b610ca9565b61016c610282366004611646565b610e08565b610157610f00565b6002546001600160a01b031681565b6000806102aa8361088b565b905060005b6007548110156103e1576000600782815481106102c857fe5b906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050905080600001518310156103d8576000808315610359576007600185038154811061031c57fe5b90600052602060002090600202016000015491506007600185038154811061034057fe5b9060005260206000209060020201600101549050610360565b5060009050805b60208301516000906103729083610f06565b84519091506000906103849085610f06565b905060006103928886610f06565b905060006103ac836103a684612710610f51565b90610faa565b90506103c86103c16127106103a68785610f51565b8690610fec565b995050505050505050505061040a565b506001016102af565b506007805460001981019081106103f457fe5b9060005260206000209060020201600101549150505b919050565b60026001541415610467576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556006546001600160a01b031661049d5760405162461bcd60e51b81526004016104949061184b565b60405180910390fd5b33600090815260036020908152604091829020825160608101845281548082526001909201546001600160401b0380821694830194909452600160401b900490921692820192909252906105035760405162461bcd60e51b8152600401610494906118bf565b33600090815260036020526040812090815560010180546fffffffffffffffffffffffffffffffff19169055600654815160025461054f926001600160a01b0391821692911690611046565b600654815160208301516040808501519051631dc8484f60e31b81526001600160a01b039094169363ee424278936105909333939192909190600401611819565b600060405180830381600087803b1580156105aa57600080fd5b505af11580156105be573d6000803e3d6000fd5b50506006548351602085015160408087015190513396507fbf26a6cba55b2ada584d48541e3986634d7ad78795b1eea765a63f4de5f97b60955061060e946001600160a01b031693929190611819565b60405180910390a25060018055565b600360205260009081526040902080546001909101546001600160401b0380821691600160401b90041683565b610652611137565b6000546001600160a01b039081169116146106a2576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b6106fc8260058054806020026020016040519081016040528092919081815260200182805480156106f257602002820191906000526020600020905b8154815260200190600101908083116106de575b505050505061113b565b1561073757600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018290555b60009182526004602052604090912055565b600260015414156107a1576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001908155336000908152600360209081526040808320938401546001600160401b03168352600490915290205415806107f25750600181015442600160401b9091046001600160401b031611155b61080e5760405162461bcd60e51b81526004016104949061190c565b805461081a9083610f06565b8155600254610833906001600160a01b03163384611183565b336001600160a01b03167f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f758360405161086c919061196f565b60405180910390a2505060018055565b6006546001600160a01b031681565b6001600160a01b03811660009081526003602090815260408083208151606081018352815481526001909101546001600160401b03808216838601819052600160401b90920416828401528452600490925282205481516108f391612710916103a691610f51565b9392505050565b60025460405163d505accf60e01b81526001600160a01b039091169063d505accf9061093690339030908b908a908a908a908a906004016117d8565b600060405180830381600087803b15801561095057600080fd5b505af1158015610964573d6000803e3d6000fd5b505050506109728686610a6b565b505050505050565b6007818154811061098a57600080fd5b60009182526020909120600290910201805460019091015490915082565b600581815481106109b857600080fd5b600091825260209091200154905081565b6109d1611137565b6000546001600160a01b03908116911614610a21576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60026001541415610ac3576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155600081815260046020526040902054610af35760405162461bcd60e51b815260040161049490611938565b33600090815260036020526040812090610b0d4284610fec565b6001830154909150600160401b90046001600160401b03168111610b435760405162461bcd60e51b815260040161049490611877565b600254610b5b906001600160a01b03163330876111da565b8154610b679085610fec565b8255610b7281611234565b8260010160086101000a8154816001600160401b0302191690836001600160401b03160217905550610ba383611234565b60018301805467ffffffffffffffff19166001600160401b039290921691909117905560405133907fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed90610bfc90879087908690611986565b60405180910390a25050600180555050565b6000546001600160a01b031690565b60046020526000908152604090205481565b610c37611137565b6000546001600160a01b03908116911614610c87576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b610cb1611137565b6000546001600160a01b03908116911614610d01576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b60005b8151811015610da7578015610d9f57816001820381518110610d2257fe5b602002602001015160000151828281518110610d3a57fe5b602002602001015160000151118015610d835750816001820381518110610d5d57fe5b602002602001015160200151828281518110610d7557fe5b602002602001015160200151115b610d9f5760405162461bcd60e51b8152600401610494906118e1565b600101610d04565b50610db460076000611607565b60005b8151811015610e04576007828281518110610dce57fe5b60209081029190910181015182546001818101855560009485529383902082516002909202019081559101519082015501610db7565b5050565b610e10611137565b6000546001600160a01b03908116911614610e60576040805162461bcd60e51b81526020600482018190526024820152600080516020611a87833981519152604482015290519081900360640190fd5b6001600160a01b038116610ea55760405162461bcd60e51b81526004018080602001828103825260268152602001806119f46026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60075490565b6000610f4883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061127c565b90505b92915050565b600082610f6057506000610f4b565b82820282848281610f6d57fe5b0414610f485760405162461bcd60e51b8152600401808060200182810382526021815260200180611a406021913960400191505060405180910390fd5b6000610f4883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611313565b600082820183811015610f48576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006110dc82856001600160a01b031663dd62ed3e30876040518363ffffffff1660e01b815260040180836001600160a01b03168152602001826001600160a01b031681526020019250505060206040518083038186803b1580156110aa57600080fd5b505afa1580156110be573d6000803e3d6000fd5b505050506040513d60208110156110d457600080fd5b505190610fec565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052909150611131908590611378565b50505050565b3390565b8051600090815b81811015611178578484828151811061115757fe5b6020026020010151141561117057600192505050610f4b565b600101611142565b506000949350505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526111d5908490611378565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611131908590611378565b6000600160401b82106112785760405162461bcd60e51b8152600401808060200182810382526026815260200180611a616026913960400191505060405180910390fd5b5090565b6000818484111561130b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112d05781810151838201526020016112b8565b50505050905090810190601f1680156112fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836113625760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156112d05781810151838201526020016112b8565b50600083858161136e57fe5b0495945050505050565b60006113cd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166114299092919063ffffffff16565b8051909150156111d5578080602001905160208110156113ec57600080fd5b50516111d55760405162461bcd60e51b815260040180806020018281038252602a815260200180611aa7602a913960400191505060405180910390fd5b60606114388484600085611440565b949350505050565b6060824710156114815760405162461bcd60e51b8152600401808060200182810382526026815260200180611a1a6026913960400191505060405180910390fd5b61148a8561159b565b6114db576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106115195780518252601f1990920191602091820191016114fa565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461157b576040519150601f19603f3d011682016040523d82523d6000602084013e611580565b606091505b50915091506115908282866115a1565b979650505050505050565b3b151590565b606083156115b05750816108f3565b8251156115c05782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156112d05781810151838201526020016112b8565b5080546000825560020290600052602060002090810190611628919061162b565b50565b5b80821115611278576000808255600182015560020161162c565b600060208284031215611657578081fd5b8135610f48816119de565b60006020808385031215611674578182fd5b82356001600160401b038082111561168a578384fd5b818501915085601f83011261169d578384fd5b8135818111156116a957fe5b6116b684858302016119bb565b818152848101908486016040808502870188018b10156116d4578889fd5b8896505b848710156117255780828c0312156116ee578889fd5b8051818101818110888211171561170157fe5b825282358152888301358982015284526001969096019592870192908101906116d8565b50909998505050505050505050565b600060208284031215611745578081fd5b5035919050565b6000806040838503121561175e578081fd5b50508035926020909101359150565b60008060008060008060c08789031215611785578182fd5b863595506020870135945060408701359350606087013560ff811681146117aa578283fd5b9598949750929560808101359460a0909101359350915050565b6001600160a01b0391909116815260200190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b0394909416845260208401929092526001600160401b03908116604084015216606082015260800190565b602080825260129082015271135a59dc985d1a5bdb88191a5cd8589b195960721b604082015260600190565b60208082526028908201527f43616e6e6f7420616464207374616b652077697468206c6f776572207374616b60408201526719481c195c9a5bd960c21b606082015260800190565b6020808252600890820152674e6f207374616b6560c01b604082015260600190565b60208082526011908201527015dc9bdb99c81cdd185ad9481b195d995b607a1b604082015260600190565b60208082526012908201527114dd185ad9481cdd1a5b1b081b1bd8dad95960721b604082015260600190565b6020808252601c908201527f5374616b6520706572696f6420646f6573206e6f742065786973747300000000604082015260600190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b9283526001600160401b03918216602084015216604082015260600190565b6040518181016001600160401b03811182821017156119d657fe5b604052919050565b6001600160a01b038116811461162857600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7753616665436173743a2076616c756520646f65736e27742066697420696e20363420626974734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122002803ff8179b6461e96352d256f4adf5fcc59116a588cac12714d7abc8c1992364736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000016f9d564df80376c61ac914205d3fdff7057d610
-----Decoded View---------------
Arg [0] : _xPremia (address): 0x16f9D564Df80376C61AC914205D3fDfF7057d610
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000016f9d564df80376c61ac914205d3fdff7057d610
Loading...
Loading
Loading...
Loading
OVERVIEW
Lock xPremia to get protocol fee discountMultichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.