Contract
0xFA69292726A53d62111c9485C03ac551Ba05679b
4
Contract Overview
My Name Tag:
Not Available
TokenTracker:
[ Download CSV Export ]
Contract Name:
GMVDToken
Compiler Version
v0.7.5+commit.eb77ed08
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; import "./lib/Ownable.sol"; import "./lib/SafeMath.sol"; import "./lib/SafeERC20.sol"; import "./lib/ERC20.sol"; import "./lib/ReentrancyGuard.sol"; import "./lib/EnumerableSet.sol"; import "./interfaces/IGMVD.sol"; import "./interfaces/IGMVDToken.sol"; import "./interfaces/IGMVDTokenUsage.sol"; /* * gMVD is Metavault escrowed governance token obtainable by converting MVD to it * It's non-transferable, except from/to whitelisted addresses * It can be converted back to MVD through a vesting process * This contract is made to receive gMVD deposits from users in order to allocate them to Usages (plugins) contracts */ contract GMVDToken is Ownable, ReentrancyGuard, ERC20("Governance MVD", "gMVD"), IGMVDToken { using Address for address; using SafeMath for uint256; using EnumerableSet for EnumerableSet.AddressSet; using SafeERC20 for IGMVD; struct GMVDBalance { uint256 allocatedAmount; // Amount of gMVD allocated to a Usage uint256 redeemingAmount; // Total amount of gMVD currently being redeemed } struct RedeemInfo { uint256 mvdAmount; // MVD amount to receive when vesting has ended uint256 gMVDAmount; // gMVD amount to redeem uint256 endTime; IGMVDTokenUsage dividendsAddress; uint256 dividendsAllocation; // Share of redeeming gMVD to allocate to the Dividends Usage contract } IGMVD public immutable mvdToken; // MVD token to convert to/from IGMVDTokenUsage public dividendsAddress; // Metavault dividends contract EnumerableSet.AddressSet private _transferWhitelist; // addresses allowed to send/receive gMVD mapping(address => mapping(address => uint256)) public usageApprovals; // Usage approvals to allocate gMVD mapping(address => mapping(address => uint256)) public override usageAllocations; // Active gMVD allocations to usages uint256 public constant MAX_DEALLOCATION_FEE = 200; // 2% mapping(address => uint256) public usagesDeallocationFee; // Fee paid when deallocating gMVD uint256 public constant MAX_FIXED_RATIO = 100; // 100% address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; // Redeeming min/max settings uint256 public minRedeemRatio = 50; // 1:0.5 uint256 public maxRedeemRatio = 100; // 1:1 uint256 public minRedeemDuration = 15 days; // 1296000s uint256 public maxRedeemDuration = 180 days; // 15552000s // Adjusted dividends rewards for redeeming gMVD uint256 public redeemDividendsAdjustment = 50; // 50% mapping(address => GMVDBalance) public gMVDBalances; // User's gMVD balances mapping(address => RedeemInfo[]) public userRedeems; // User's redeeming instances constructor(IGMVD mvdToken_) { mvdToken = mvdToken_; _transferWhitelist.add(address(this)); } /********************************************/ /****************** EVENTS ******************/ /********************************************/ event ApproveUsage(address indexed userAddress, address indexed usageAddress, uint256 amount); event Convert(address indexed from, address to, uint256 amount); event UpdateRedeemSettings(uint256 minRedeemRatio, uint256 maxRedeemRatio, uint256 minRedeemDuration, uint256 maxRedeemDuration, uint256 redeemDividendsAdjustment); event UpdateDividendsAddress(address previousDividendsAddress, address newDividendsAddress); event UpdateDeallocationFee(address indexed usageAddress, uint256 fee); event SetTransferWhitelist(address account, bool add); event Redeem(address indexed userAddress, uint256 gMVDAmount, uint256 mvdAmount, uint256 duration); event FinalizeRedeem(address indexed userAddress, uint256 gMVDAmount, uint256 mvdAmount); event CancelRedeem(address indexed userAddress, uint256 gMVDAmount); event UpdateRedeemDividendsAddress(address indexed userAddress, uint256 redeemIndex, address previousDividendsAddress, address newDividendsAddress); event Allocate(address indexed userAddress, address indexed usageAddress, uint256 amount); event Deallocate(address indexed userAddress, address indexed usageAddress, uint256 amount, uint256 fee); /***********************************************/ /****************** MODIFIERS ******************/ /***********************************************/ /* * @dev Check if a redeem entry exists */ modifier validateRedeem(address userAddress, uint256 redeemIndex) { require(redeemIndex < userRedeems[userAddress].length, "validateRedeem: redeem entry does not exist"); _; } /**************************************************/ /****************** PUBLIC VIEWS ******************/ /**************************************************/ /* * @dev Returns user's gMVD balances */ function getGMVDBalance(address userAddress) external view returns (uint256 allocatedAmount, uint256 redeemingAmount) { GMVDBalance storage balance = gMVDBalances[userAddress]; return (balance.allocatedAmount, balance.redeemingAmount); } /* * @dev returns redeemable MVD for "amount" of gMVD vested for "duration" seconds */ function getMvdByVestingDuration(uint256 amount, uint256 duration) public view returns (uint256) { if (duration < minRedeemDuration) { return 0; } // capped to maxRedeemDuration if (duration > maxRedeemDuration) { return amount.mul(maxRedeemRatio).div(100); } uint256 ratio = minRedeemRatio.add((duration.sub(minRedeemDuration)).mul(maxRedeemRatio.sub(minRedeemRatio)).div(maxRedeemDuration.sub(minRedeemDuration))); return amount.mul(ratio).div(100); } /** * @dev returns quantity of "userAddress" pending redeems */ function getUserRedeemsLength(address userAddress) external view returns (uint256) { return userRedeems[userAddress].length; } /** * @dev returns "userAddress" info for a pending redeem identified by "redeemIndex" */ function getUserRedeem( address userAddress, uint256 redeemIndex ) external view validateRedeem(userAddress, redeemIndex) returns (uint256 mvdAmount, uint256 gMVDAmount, uint256 endTime, address dividendsContract, uint256 dividendsAllocation) { RedeemInfo storage _redeem = userRedeems[userAddress][redeemIndex]; return (_redeem.mvdAmount, _redeem.gMVDAmount, _redeem.endTime, address(_redeem.dividendsAddress), _redeem.dividendsAllocation); } /** * @dev returns approved gMVD to allocate from "userAddress" to "usageAddress" */ function getUsageApproval(address userAddress, address usageAddress) external view returns (uint256) { return usageApprovals[userAddress][usageAddress]; } /** * @dev returns allocated gMVD from "userAddress" to "usageAddress" */ function getUsageAllocation(address userAddress, address usageAddress) external view returns (uint256) { return usageAllocations[userAddress][usageAddress]; } /** * @dev returns length of transferWhitelist array */ function transferWhitelistLength() external view returns (uint256) { return _transferWhitelist.length(); } /** * @dev returns transferWhitelist array item's address for "index" */ function transferWhitelist(uint256 index) external view returns (address) { return _transferWhitelist.at(index); } /** * @dev returns if "account" is allowed to send/receive gMVD */ function isTransferWhitelisted(address account) external view override returns (bool) { return _transferWhitelist.contains(account); } /*******************************************************/ /****************** OWNABLE FUNCTIONS ******************/ /*******************************************************/ /** * @dev Updates all redeem ratios and durations * * Must only be called by owner */ function updateRedeemSettings( uint256 minRedeemRatio_, uint256 maxRedeemRatio_, uint256 minRedeemDuration_, uint256 maxRedeemDuration_, uint256 redeemDividendsAdjustment_ ) external onlyOwner { require(minRedeemRatio_ <= maxRedeemRatio_, "updateRedeemSettings: wrong ratio values"); require(minRedeemDuration_ < maxRedeemDuration_, "updateRedeemSettings: wrong duration values"); // should never exceed 100% require(maxRedeemRatio_ <= MAX_FIXED_RATIO && redeemDividendsAdjustment_ <= MAX_FIXED_RATIO, "updateRedeemSettings: wrong ratio values"); minRedeemRatio = minRedeemRatio_; maxRedeemRatio = maxRedeemRatio_; minRedeemDuration = minRedeemDuration_; maxRedeemDuration = maxRedeemDuration_; redeemDividendsAdjustment = redeemDividendsAdjustment_; emit UpdateRedeemSettings(minRedeemRatio_, maxRedeemRatio_, minRedeemDuration_, maxRedeemDuration_, redeemDividendsAdjustment_); } /** * @dev Updates dividends contract address * * Must only be called by owner */ function updateDividendsAddress(IGMVDTokenUsage dividendsAddress_) external onlyOwner { // if set to 0, also set divs earnings while redeeming to 0 if (address(dividendsAddress_) == address(0)) { redeemDividendsAdjustment = 0; } emit UpdateDividendsAddress(address(dividendsAddress), address(dividendsAddress_)); dividendsAddress = dividendsAddress_; } /** * @dev Updates fee paid by users when deallocating from "usageAddress" */ function updateDeallocationFee(address usageAddress, uint256 fee) external onlyOwner { require(fee <= MAX_DEALLOCATION_FEE, "updateDeallocationFee: too high"); usagesDeallocationFee[usageAddress] = fee; emit UpdateDeallocationFee(usageAddress, fee); } /** * @dev Adds or removes addresses from the transferWhitelist */ function updateTransferWhitelist(address account, bool add) external onlyOwner { require(account != address(this), "updateTransferWhitelist: Cannot remove gMVD from whitelist"); if (add) _transferWhitelist.add(account); else _transferWhitelist.remove(account); emit SetTransferWhitelist(account, add); } /*****************************************************************/ /****************** EXTERNAL PUBLIC FUNCTIONS ******************/ /*****************************************************************/ /** * @dev Approves "usage" address to get allocations up to "amount" of gMVD from msg.sender */ function approveUsage(IGMVDTokenUsage usage, uint256 amount) external nonReentrant { require(address(usage) != address(0), "approveUsage: approve to the zero address"); usageApprovals[msg.sender][address(usage)] = amount; emit ApproveUsage(msg.sender, address(usage), amount); } /** * @dev Convert caller's "amount" of MVD to gMVD */ function convert(uint256 amount) external nonReentrant { _convert(amount, msg.sender); } /** * @dev Convert caller's "amount" of MVD to gMVD to "to" address */ function convertTo(uint256 amount, address to) external override nonReentrant { require(address(msg.sender).isContract(), "convertTo: not allowed"); _convert(amount, to); } /** * @dev Initiates redeem process (gMVD to MVD) * * Handles dividends' compensation allocation during the vesting process if needed */ function redeem(uint256 gMVDAmount, uint256 duration) external nonReentrant { require(gMVDAmount > 0, "redeem: gMVDAmount cannot be null"); require(duration >= minRedeemDuration, "redeem: duration too low"); _transfer(msg.sender, address(this), gMVDAmount); GMVDBalance storage balance = gMVDBalances[msg.sender]; // get corresponding MVD amount uint256 mvdAmount = getMvdByVestingDuration(gMVDAmount, duration); emit Redeem(msg.sender, gMVDAmount, mvdAmount, duration); // if redeeming is not immediate, go through vesting process if (duration > 0) { // add to SBT total balance.redeemingAmount = balance.redeemingAmount.add(gMVDAmount); // handle dividends during the vesting process uint256 dividendsAllocation = gMVDAmount.mul(redeemDividendsAdjustment).div(100); // only if compensation is active if (dividendsAllocation > 0) { // allocate to dividends dividendsAddress.allocate(msg.sender, dividendsAllocation, new bytes(0)); } // add redeeming entry userRedeems[msg.sender].push(RedeemInfo(mvdAmount, gMVDAmount, _currentBlockTimestamp().add(duration), dividendsAddress, dividendsAllocation)); } else { // immediately redeem for MVD _finalizeRedeem(msg.sender, gMVDAmount, mvdAmount); } } /** * @dev Finalizes redeem process when vesting duration has been reached * * Can only be called by the redeem entry owner */ function finalizeRedeem(uint256 redeemIndex) external nonReentrant validateRedeem(msg.sender, redeemIndex) { GMVDBalance storage balance = gMVDBalances[msg.sender]; RedeemInfo storage _redeem = userRedeems[msg.sender][redeemIndex]; require(_currentBlockTimestamp() >= _redeem.endTime, "finalizeRedeem: vesting duration has not ended yet"); // remove from SBT total balance.redeemingAmount = balance.redeemingAmount.sub(_redeem.gMVDAmount); _finalizeRedeem(msg.sender, _redeem.gMVDAmount, _redeem.mvdAmount); // handle dividends compensation if any was active if (_redeem.dividendsAllocation > 0) { // deallocate from dividends IGMVDTokenUsage(_redeem.dividendsAddress).deallocate(msg.sender, _redeem.dividendsAllocation, new bytes(0)); } // remove redeem entry _deleteRedeemEntry(redeemIndex); } /** * @dev Updates dividends address for an existing active redeeming process * * Can only be called by the involved user * Should only be used if dividends contract was to be migrated */ function updateRedeemDividendsAddress(uint256 redeemIndex) external nonReentrant validateRedeem(msg.sender, redeemIndex) { RedeemInfo storage _redeem = userRedeems[msg.sender][redeemIndex]; // only if the active dividends contract is not the same anymore if (dividendsAddress != _redeem.dividendsAddress && address(dividendsAddress) != address(0)) { if (_redeem.dividendsAllocation > 0) { // deallocate from old dividends contract _redeem.dividendsAddress.deallocate(msg.sender, _redeem.dividendsAllocation, new bytes(0)); // allocate to new used dividends contract dividendsAddress.allocate(msg.sender, _redeem.dividendsAllocation, new bytes(0)); } emit UpdateRedeemDividendsAddress(msg.sender, redeemIndex, address(_redeem.dividendsAddress), address(dividendsAddress)); _redeem.dividendsAddress = dividendsAddress; } } /** * @dev Cancels an ongoing redeem entry * * Can only be called by its owner */ function cancelRedeem(uint256 redeemIndex) external nonReentrant validateRedeem(msg.sender, redeemIndex) { GMVDBalance storage balance = gMVDBalances[msg.sender]; RedeemInfo storage _redeem = userRedeems[msg.sender][redeemIndex]; // make redeeming gMVD available again balance.redeemingAmount = balance.redeemingAmount.sub(_redeem.gMVDAmount); _transfer(address(this), msg.sender, _redeem.gMVDAmount); // handle dividends compensation if any was active if (_redeem.dividendsAllocation > 0) { // deallocate from dividends IGMVDTokenUsage(_redeem.dividendsAddress).deallocate(msg.sender, _redeem.dividendsAllocation, new bytes(0)); } emit CancelRedeem(msg.sender, _redeem.gMVDAmount); // remove redeem entry _deleteRedeemEntry(redeemIndex); } /** * @dev Allocates caller's "amount" of available gMVD to "usageAddress" contract * * args specific to usage contract must be passed into "usageData" */ function allocate(address usageAddress, uint256 amount, bytes calldata usageData) external nonReentrant { _allocate(msg.sender, usageAddress, amount); // allocates gMVD to usageContract IGMVDTokenUsage(usageAddress).allocate(msg.sender, amount, usageData); } /** * @dev Allocates "amount" of available gMVD from "userAddress" to caller (ie usage contract) * * Caller must have an allocation approval for the required gMVD gMVD from "userAddress" */ function allocateFromUsage(address userAddress, uint256 amount) external override nonReentrant { _allocate(userAddress, msg.sender, amount); } /** * @dev Deallocates caller's "amount" of available gMVD from "usageAddress" contract * * args specific to usage contract must be passed into "usageData" */ function deallocate(address usageAddress, uint256 amount, bytes calldata usageData) external nonReentrant { _deallocate(msg.sender, usageAddress, amount); // deallocate gMVD into usageContract IGMVDTokenUsage(usageAddress).deallocate(msg.sender, amount, usageData); } /** * @dev Deallocates "amount" of allocated gMVD belonging to "userAddress" from caller (ie usage contract) * * Caller can only deallocate gMVD from itself */ function deallocateFromUsage(address userAddress, uint256 amount) external override nonReentrant { _deallocate(userAddress, msg.sender, amount); } /********************************************************/ /****************** INTERNAL FUNCTIONS ******************/ /********************************************************/ /** * @dev Convert caller's "amount" of MVD into gMVD to "to" */ function _convert(uint256 amount, address to) internal { require(amount != 0, "convert: amount cannot be null"); // mint new gMVD _mint(to, amount); emit Convert(msg.sender, to, amount); mvdToken.safeTransferFrom(msg.sender, address(this), amount); } /** * @dev Finalizes the redeeming process for "userAddress" by transferring him "mvdAmount" and removing "gMVDAmount" from supply * * Any vesting check should be ran before calling this * MVD excess is automatically burnt */ function _finalizeRedeem(address userAddress, uint256 gMVDAmount, uint256 mvdAmount) internal { uint256 mvdExcess = gMVDAmount.sub(mvdAmount); // sends due MVD tokens mvdToken.safeTransfer(userAddress, mvdAmount); // burns MVD excess if any mvdToken.safeTransfer(BURN_ADDRESS, mvdExcess); _burn(address(this), gMVDAmount); emit FinalizeRedeem(userAddress, gMVDAmount, mvdAmount); } /** * @dev Allocates "userAddress" user's "amount" of available gMVD to "usageAddress" contract * */ function _allocate(address userAddress, address usageAddress, uint256 amount) internal { require(amount > 0, "allocate: amount cannot be null"); GMVDBalance storage balance = gMVDBalances[userAddress]; // approval checks if allocation request amount has been approved by userAddress to be allocated to this usageAddress uint256 approvedGMVD = usageApprovals[userAddress][usageAddress]; require(approvedGMVD >= amount, "allocate: non authorized amount"); // remove allocated amount from usage's approved amount usageApprovals[userAddress][usageAddress] = approvedGMVD.sub(amount); // update usage's allocatedAmount for userAddress usageAllocations[userAddress][usageAddress] = usageAllocations[userAddress][usageAddress].add(amount); // adjust user's gMVD balances balance.allocatedAmount = balance.allocatedAmount.add(amount); _transfer(userAddress, address(this), amount); emit Allocate(userAddress, usageAddress, amount); } /** * @dev Deallocates "amount" of available gMVD to "usageAddress" contract * * args specific to usage contract must be passed into "usageData" */ function _deallocate(address userAddress, address usageAddress, uint256 amount) internal { require(amount > 0, "deallocate: amount cannot be null"); // check if there is enough allocated gMVD to this usage to deallocate uint256 allocatedAmount = usageAllocations[userAddress][usageAddress]; require(allocatedAmount >= amount, "deallocate: non authorized amount"); // remove deallocated amount from usage's allocation usageAllocations[userAddress][usageAddress] = allocatedAmount.sub(amount); uint256 deallocationFeeAmount = amount.mul(usagesDeallocationFee[usageAddress]).div(10000); // adjust user's gMVD balances GMVDBalance storage balance = gMVDBalances[userAddress]; balance.allocatedAmount = balance.allocatedAmount.sub(amount); _transfer(address(this), userAddress, amount.sub(deallocationFeeAmount)); // burn corresponding MVD and GMVD mvdToken.safeTransfer(BURN_ADDRESS, deallocationFeeAmount); _burn(address(this), deallocationFeeAmount); emit Deallocate(userAddress, usageAddress, amount, deallocationFeeAmount); } function _deleteRedeemEntry(uint256 index) internal { userRedeems[msg.sender][index] = userRedeems[msg.sender][userRedeems[msg.sender].length - 1]; userRedeems[msg.sender].pop(); } /** * @dev Hook override to forbid transfers except from whitelisted addresses and minting */ function _beforeTokenTransfer(address from, address to, uint256 /*amount*/) internal view override { require(from == address(0) || _transferWhitelist.contains(from) || _transferWhitelist.contains(to), "transfer: not allowed"); } /** * @dev Utility function to get the current block timestamp */ function _currentBlockTimestamp() internal view virtual returns (uint256) { /* solhint-disable not-rely-on-time */ return block.timestamp; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; /** * @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.7.5; import "./IERC20.sol"; interface IGMVD is IERC20{ function lastEmissionTime() external view returns (uint256); function claimMasterRewards(uint256 amount) external returns (uint256 effectiveAmount); function masterEmissionRate() external view returns (uint256); function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; import "./IERC20.sol"; interface IGMVDToken is IERC20 { function usageAllocations(address userAddress, address usageAddress) external view returns (uint256 allocation); function allocateFromUsage(address userAddress, uint256 amount) external; function convertTo(uint256 amount, address to) external; function deallocateFromUsage(address userAddress, uint256 amount) external; function isTransferWhitelisted(address account) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; interface IGMVDTokenUsage { function allocate(address userAddress, uint256 amount, bytes calldata data) external; function deallocate(address userAddress, uint256 amount, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; /** * @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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(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.7.5; /* * @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; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; import "./Context.sol"; import "../interfaces/IERC20.sol"; import "./SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _decimals = 9; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.5; import "./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 () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual 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.7.5; /** * @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 () { _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.5; import "../interfaces/IERC20.sol"; import "./SafeMath.sol"; import "./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.7.5; /** * @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, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @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) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * 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); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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; } }
{ "metadata": { "bytecodeHash": "none", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 1 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"contract IGMVD","name":"mvdToken_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"address","name":"usageAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Allocate","type":"event"},{"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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"address","name":"usageAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ApproveUsage","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"gMVDAmount","type":"uint256"}],"name":"CancelRedeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Convert","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"address","name":"usageAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"Deallocate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"gMVDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mvdAmount","type":"uint256"}],"name":"FinalizeRedeem","type":"event"},{"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":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"gMVDAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mvdAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"add","type":"bool"}],"name":"SetTransferWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usageAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"UpdateDeallocationFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousDividendsAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newDividendsAddress","type":"address"}],"name":"UpdateDividendsAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"previousDividendsAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newDividendsAddress","type":"address"}],"name":"UpdateRedeemDividendsAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minRedeemRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRedeemRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minRedeemDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxRedeemDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemDividendsAdjustment","type":"uint256"}],"name":"UpdateRedeemSettings","type":"event"},{"inputs":[],"name":"BURN_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DEALLOCATION_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_FIXED_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"usageAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"usageData","type":"bytes"}],"name":"allocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"allocateFromUsage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"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":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IGMVDTokenUsage","name":"usage","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveUsage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"cancelRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"convertTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"usageAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"usageData","type":"bytes"}],"name":"deallocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deallocateFromUsage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dividendsAddress","outputs":[{"internalType":"contract IGMVDTokenUsage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"finalizeRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gMVDBalances","outputs":[{"internalType":"uint256","name":"allocatedAmount","type":"uint256"},{"internalType":"uint256","name":"redeemingAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getGMVDBalance","outputs":[{"internalType":"uint256","name":"allocatedAmount","type":"uint256"},{"internalType":"uint256","name":"redeemingAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"getMvdByVestingDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"usageAddress","type":"address"}],"name":"getUsageAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"usageAddress","type":"address"}],"name":"getUsageApproval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"getUserRedeem","outputs":[{"internalType":"uint256","name":"mvdAmount","type":"uint256"},{"internalType":"uint256","name":"gMVDAmount","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"address","name":"dividendsContract","type":"address"},{"internalType":"uint256","name":"dividendsAllocation","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getUserRedeemsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isTransferWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRedeemDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRedeemRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRedeemDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minRedeemRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mvdToken","outputs":[{"internalType":"contract IGMVD","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gMVDAmount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"redeemDividendsAdjustment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"transferWhitelist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferWhitelistLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"usageAddress","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"updateDeallocationFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IGMVDTokenUsage","name":"dividendsAddress_","type":"address"}],"name":"updateDividendsAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemIndex","type":"uint256"}],"name":"updateRedeemDividendsAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minRedeemRatio_","type":"uint256"},{"internalType":"uint256","name":"maxRedeemRatio_","type":"uint256"},{"internalType":"uint256","name":"minRedeemDuration_","type":"uint256"},{"internalType":"uint256","name":"maxRedeemDuration_","type":"uint256"},{"internalType":"uint256","name":"redeemDividendsAdjustment_","type":"uint256"}],"name":"updateRedeemSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"add","type":"bool"}],"name":"updateTransferWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"usageAllocations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"usageApprovals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"usagesDeallocationFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userRedeems","outputs":[{"internalType":"uint256","name":"mvdAmount","type":"uint256"},{"internalType":"uint256","name":"gMVDAmount","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"contract IGMVDTokenUsage","name":"dividendsAddress","type":"address"},{"internalType":"uint256","name":"dividendsAllocation","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040526032600d556064600e556213c680600f5562ed4e0060105560326011553480156200002e57600080fd5b5060405162003f1738038062003f17833981810160405260208110156200005457600080fd5b5051604080518082018252600e81526d11dbdd995c9b985b98d94813559160921b6020828101919091528251808401909352600483526319d3559160e21b90830152906000620000a362000161565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060018055815162000106906005906020850190620001ec565b5080516200011c906006906020840190620001ec565b505060078054600960ff1990911617905550606081901b6001600160601b0319166080526200015960083062000165602090811b620026cf17901c565b505062000298565b3390565b60006200017c836001600160a01b03841662000185565b90505b92915050565b6000620001938383620001d4565b620001cb575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200017f565b5060006200017f565b60009081526001919091016020526040902054151590565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200022457600085556200026f565b82601f106200023f57805160ff19168380011785556200026f565b828001600101855582156200026f579182015b828111156200026f57825182559160200191906001019062000252565b506200027d92915062000281565b5090565b5b808211156200027d576000815560010162000282565b60805160601c613c4d620002ca600039806125b75280612ea25280612fe252806130ea528061311e5250613c4d6000f3fe608060405234801561001057600080fd5b50600436106102675760003560e01c806302f91e551461026c57806306045a211461028657806306fdde03146102ae578063093220b71461032b578063095ea7b3146103605780630f7d3a69146103a05780631290bf6f146103cc578063161aab431461040b57806318160ddd146104135780631c32196d1461041b5780631c352679146104415780631c75e369146104495780631eee7e60146104cc57806323b872dd146104f25780632b489679146105285780632cc2f5ce146105565780632e9a76e41461058457806331124ce3146105b2578063313ce567146105cf57806339509351146105ed5780633b90f9a014610619578063488c830314610645578063497965ee146106735780634a5b406e146106975780634b359d381461069f5780634f62b7ec146106bc578063539ffb771461071c578063549230c9146107395780635a1d34dc146107bc578063619ac95b146107e857806370a08231146107f0578063715018a6146108165780637cbc23731461081e57806389083654146108415780638975f9181461086f5780638da5cb5b1461089557806395d89b411461089d578063a0bdc7cb146108a5578063a3908e1b146108d1578063a457c2d7146108ee578063a9059cbb1461091a578063aff6cbf114610946578063b90c2b5214610963578063bd593db714610989578063c360ed1c146109ac578063c4b10766146109d8578063cc6c5423146109e0578063dd62ed3e14610a0c578063e3a2950b14610a3a578063e9ed87f814610a42578063ee5083ee14610a4a578063f2fde38b14610a52578063fccc281314610a78575b600080fd5b610274610a80565b60408051918252519081900360200190f35b6102ac6004803603602081101561029c57600080fd5b50356001600160a01b0316610a85565b005b6102b6610b70565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102f05781810151838201526020016102d8565b50505050905090810190601f16801561031d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102ac600480360360a081101561034157600080fd5b5080359060208101359060408101359060608101359060800135610c06565b61038c6004803603604081101561037657600080fd5b506001600160a01b038135169060200135610da0565b604080519115158252519081900360200190f35b6102ac600480360360408110156103b657600080fd5b506001600160a01b038135169060200135610dbe565b6103f2600480360360208110156103e257600080fd5b50356001600160a01b0316610eca565b6040805192835260208301919091528051918290030190f35b610274610eed565b610274610efe565b6103f26004803603602081101561043157600080fd5b50356001600160a01b0316610f04565b610274610f1d565b6102ac6004803603606081101561045f57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561048e57600080fd5b8201836020820111156104a057600080fd5b803590602001918460018302840111600160201b831117156104c157600080fd5b509092509050610f23565b61038c600480360360208110156104e257600080fd5b50356001600160a01b0316611026565b61038c6004803603606081101561050857600080fd5b506001600160a01b03813581169160208101359091169060400135611033565b6102746004803603604081101561053e57600080fd5b506001600160a01b03813581169160200135166110bb565b6102746004803603604081101561056c57600080fd5b506001600160a01b03813581169160200135166110e6565b6102746004803603604081101561059a57600080fd5b506001600160a01b0381358116916020013516611103565b6102ac600480360360208110156105c857600080fd5b503561112e565b6105d76114a7565b6040805160ff9092168252519081900360200190f35b61038c6004803603604081101561060357600080fd5b506001600160a01b0381351690602001356114b0565b6102ac6004803603604081101561062f57600080fd5b506001600160a01b0381351690602001356114fe565b6102746004803603604081101561065b57600080fd5b506001600160a01b038135811691602001351661155c565b61067b611579565b604080516001600160a01b039092168252519081900360200190f35b61027461158d565b61067b600480360360208110156106b557600080fd5b5035611593565b6106e8600480360360408110156106d257600080fd5b506001600160a01b0381351690602001356115a0565b604080519586526020860194909452848401929092526001600160a01b031660608401526080830152519081900360a00190f35b6102ac6004803603602081101561073257600080fd5b50356115f7565b6102ac6004803603606081101561074f57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561077e57600080fd5b82018360208201111561079057600080fd5b803590602001918460018302840111600160201b831117156107b157600080fd5b509092509050611841565b6102ac600480360360408110156107d257600080fd5b50803590602001356001600160a01b0316611922565b6102746119ca565b6102746004803603602081101561080657600080fd5b50356001600160a01b03166119cf565b6102ac6119ea565b6102ac6004803603604081101561083457600080fd5b5080359060200135611a84565b6102ac6004803603604081101561085757600080fd5b506001600160a01b0381351690602001351515611ddb565b6102746004803603602081101561088557600080fd5b50356001600160a01b0316611ef2565b61067b611f04565b6102b6611f13565b6102ac600480360360408110156108bb57600080fd5b506001600160a01b038135169060200135611f74565b6102ac600480360360208110156108e757600080fd5b5035611fca565b61038c6004803603604081101561090457600080fd5b506001600160a01b038135169060200135612026565b61038c6004803603604081101561093057600080fd5b506001600160a01b03813516906020013561208e565b6102ac6004803603602081101561095c57600080fd5b50356120a2565b6102746004803603602081101561097957600080fd5b50356001600160a01b03166122ed565b6102746004803603604081101561099f57600080fd5b5080359060200135612308565b6102ac600480360360408110156109c257600080fd5b506001600160a01b0381351690602001356123b6565b6102746124ac565b6106e8600480360360408110156109f657600080fd5b506001600160a01b0381351690602001356124b2565b61027460048036036040811015610a2257600080fd5b506001600160a01b038135811691602001351661257e565b6102746125a9565b6102746125af565b61067b6125b5565b6102ac60048036036020811015610a6857600080fd5b50356001600160a01b03166125d9565b61067b6126c9565b60c881565b610a8d6126e4565b6001600160a01b0316610a9e611f04565b6001600160a01b031614610ae7576040805162461bcd60e51b81526020600482018190526024820152600080516020613acb833981519152604482015290519081900360640190fd5b6001600160a01b038116610afb5760006011555b600754604080516001600160a01b0361010090930483168152918316602083015280517f044c75b8fa43ce72364b4c23fdb8451beafbda46505bf44c76f0853a01ed4ade9281900390910190a1600780546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bfc5780601f10610bd157610100808354040283529160200191610bfc565b820191906000526020600020905b815481529060010190602001808311610bdf57829003601f168201915b5050505050905090565b610c0e6126e4565b6001600160a01b0316610c1f611f04565b6001600160a01b031614610c68576040805162461bcd60e51b81526020600482018190526024820152600080516020613acb833981519152604482015290519081900360640190fd5b83851115610ca75760405162461bcd60e51b81526004018080602001828103825260288152602001806139646028913960400191505060405180910390fd5b818310610ce55760405162461bcd60e51b815260040180806020018281038252602b81526020018061398c602b913960400191505060405180910390fd5b60648411158015610cf7575060648111155b610d325760405162461bcd60e51b81526004018080602001828103825260288152602001806139646028913960400191505060405180910390fd5b600d859055600e849055600f839055601082905560118190556040805186815260208101869052808201859052606081018490526080810183905290517f5b37d10782e41a6539b50d59366d4112a880236e4187e85b6d1514d20e07d9b89181900360a00190a15050505050565b6000610db4610dad6126e4565b84846126e8565b5060015b92915050565b610dc66126e4565b6001600160a01b0316610dd7611f04565b6001600160a01b031614610e20576040805162461bcd60e51b81526020600482018190526024820152600080516020613acb833981519152604482015290519081900360640190fd5b60c8811115610e76576040805162461bcd60e51b815260206004820152601f60248201527f7570646174654465616c6c6f636174696f6e4665653a20746f6f206869676800604482015290519081900360640190fd5b6001600160a01b0382166000818152600c6020908152604091829020849055815184815291517f6ff024152fc2cd8071bc701f966036513eb03e243863f21d8218646faac0eaef9281900390910190a25050565b6001600160a01b0316600090815260126020526040902080546001909101549091565b6000610ef960086127d4565b905090565b60045490565b6012602052600090815260409020805460019091015482565b600d5481565b60026001541415610f69576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b6002600155610f793385856127df565b836001600160a01b0316631c75e369338585856040518563ffffffff1660e01b815260040180856001600160a01b03168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561100457600080fd5b505af1158015611018573d6000803e3d6000fd5b505060018055505050505050565b6000610db860088361299b565b60006110408484846129b0565b6110b08461104c6126e4565b6110ab85604051806060016040528060288152602001613aa3602891396001600160a01b038a1660009081526003602052604081209061108a6126e4565b6001600160a01b031681526020810191909152604001600020549190612afb565b6126e8565b5060015b9392505050565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600b60209081526000928352604080842090915290825290205481565b6001600160a01b039182166000908152600b6020908152604080832093909416825291909152205490565b60026001541415611174576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b600260015533600081815260136020526040902054829081106111c85760405162461bcd60e51b815260040180806020018281038252602b815260200180613b95602b913960400191505060405180910390fd5b3360009081526013602052604081208054859081106111e357fe5b6000918252602090912060059091020160038101546007549192506001600160a01b03908116610100909204161480159061122d575060075461010090046001600160a01b031615155b1561149d576004810154156114175760038101546004820154604080516000808252602082019283905263549230c960e01b83523360248301818152604484018690526060606485019081528451608486018190526001600160a01b039098169763549230c99793969395949293919260a486019291908190849084905b838110156112c35781810151838201526020016112ab565b50505050905090810190601f1680156112f05780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561131157600080fd5b505af1158015611325573d6000803e3d6000fd5b505060075460048401546040805160008082526020820192839052631c75e36960e01b83523360248301818152604484018690526060606485019081528451608486018190526101009098046001600160a01b03169950631c75e3699850919693949093919260a4860192908190849084905b838110156113b0578181015183820152602001611398565b50505050905090810190601f1680156113dd5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156113fe57600080fd5b505af1158015611412573d6000803e3d6000fd5b505050505b6003810154600754604080518781526001600160a01b03938416602082015261010090920490921681830152905133917fa60c8f9118be22c9277a8129333d64ffda3de44ca7a5831d077a3127f1237a18919081900360600190a26007546003820180546101009092046001600160a01b03166001600160a01b03199092169190911790555b5050600180555050565b60075460ff1690565b6000610db46114bd6126e4565b846110ab85600360006114ce6126e4565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490612b92565b60026001541415611544576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b60026001556115548233836127df565b505060018055565b600a60209081526000928352604080842090915290825290205481565b60075461010090046001600160a01b031681565b60115481565b6000610db8600883612bea565b601360205281600052604060002081815481106115bc57600080fd5b600091825260209091206005909102018054600182015460028301546003840154600490940154929550909350916001600160a01b03169085565b6002600154141561163d576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b600260015533600081815260136020526040902054829081106116915760405162461bcd60e51b815260040180806020018281038252602b815260200180613b95602b913960400191505060405180910390fd5b336000908152601260209081526040808320601390925282208054919291869081106116b957fe5b906000526020600020906005020190506116e481600101548360010154612bf690919063ffffffff16565b82600101819055506116fb303383600101546129b0565b6004810154156117f35760038101546004820154604080516000808252602082019283905263549230c960e01b83523360248301818152604484018690526060606485019081528451608486018190526001600160a01b039098169763549230c99793969395949293919260a486019291908190849084905b8381101561178c578181015183820152602001611774565b50505050905090810190601f1680156117b95780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156117da57600080fd5b505af11580156117ee573d6000803e3d6000fd5b505050505b6001810154604080519182525133917f56d7520e387607a8daa892e3fed116badc2a636307bdc794b1c1aed97ae203f4919081900360200190a261183685612c53565b505060018055505050565b60026001541415611887576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b6002600155611897338585612d63565b836001600160a01b031663549230c9338585856040518563ffffffff1660e01b815260040180856001600160a01b03168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561100457600080fd5b60026001541415611968576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b600260015561197633612f30565b6119c0576040805162461bcd60e51b815260206004820152601660248201527518dbdb9d995c9d151bce881b9bdd08185b1b1bddd95960521b604482015290519081900360640190fd5b6115548282612f36565b606481565b6001600160a01b031660009081526002602052604090205490565b6119f26126e4565b6001600160a01b0316611a03611f04565b6001600160a01b031614611a4c576040805162461bcd60e51b81526020600482018190526024820152600080516020613acb833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020613aeb833981519152908390a3600080546001600160a01b0319169055565b60026001541415611aca576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b600260015581611b0b5760405162461bcd60e51b81526004018080602001828103825260218152602001806138fb6021913960400191505060405180910390fd5b600f54811015611b5d576040805162461bcd60e51b815260206004820152601860248201527772656465656d3a206475726174696f6e20746f6f206c6f7760401b604482015290519081900360640190fd5b611b683330846129b0565b33600090815260126020526040812090611b828484612308565b6040805186815260208101839052808201869052905191925033917fbd5034ffbd47e4e72a94baa2cdb74c6fad73cb3bcdc13036b72ec8306f5a76469181900360600190a28215611dd0576001820154611bdc9085612b92565b6001830155601154600090611bff90606490611bf990889061300e565b90613067565b90508015611d145760075461010090046001600160a01b0316631c75e369338360006040519080825280601f01601f191660200182016040528015611c4b576020820181803683370190505b506040518463ffffffff1660e01b815260040180846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611cad578181015183820152602001611c95565b50505050905090810190601f168015611cda5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015611cfb57600080fd5b505af1158015611d0f573d6000803e3d6000fd5b505050505b33600090815260136020908152604091829020825160a081018452858152918201889052918101611d4d87611d476130cb565b90612b92565b815260075461010090046001600160a01b0390811660208084019190915260409283019590955283546001808201865560009586529486902084516005909202019081559483015193850193909355810151600284015560608101516003840180546001600160a01b03191691909316179091556080015160049091015561149d565b61149d3385836130cf565b611de36126e4565b6001600160a01b0316611df4611f04565b6001600160a01b031614611e3d576040805162461bcd60e51b81526020600482018190526024820152600080516020613acb833981519152604482015290519081900360640190fd5b6001600160a01b038216301415611e855760405162461bcd60e51b815260040180806020018281038252603a815260200180613a69603a913960400191505060405180910390fd5b8015611e9c57611e966008836126cf565b50611ea9565b611ea760088361319a565b505b604080516001600160a01b0384168152821515602082015281517f3a34209cb941a5d23a56dea730a13738454bc7daefd4bb32e8d7df58c1bd920d929181900390910190a15050565b600c6020526000908152604090205481565b6000546001600160a01b031690565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610bfc5780601f10610bd157610100808354040283529160200191610bfc565b60026001541415611fba576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b6002600155611554823383612d63565b60026001541415612010576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b600260015561201f8133612f36565b5060018055565b6000610db46120336126e4565b846110ab85604051806060016040528060258152602001613c1c602591396003600061205d6126e4565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190612afb565b6000610db461209b6126e4565b84846129b0565b600260015414156120e8576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b6002600155336000818152601360205260409020548290811061213c5760405162461bcd60e51b815260040180806020018281038252602b815260200180613b95602b913960400191505060405180910390fd5b3360009081526012602090815260408083206013909252822080549192918690811061216457fe5b9060005260206000209060050201905080600201546121816130cb565b10156121be5760405162461bcd60e51b8152600401808060200182810382526032815260200180613bc06032913960400191505060405180910390fd5b600180820154908301546121d191612bf6565b82600101819055506121ec33826001015483600001546130cf565b6004810154156122e45760038101546004820154604080516000808252602082019283905263549230c960e01b83523360248301818152604484018690526060606485019081528451608486018190526001600160a01b039098169763549230c99793969395949293919260a486019291908190849084905b8381101561227d578181015183820152602001612265565b50505050905090810190601f1680156122aa5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156122cb57600080fd5b505af11580156122df573d6000803e3d6000fd5b505050505b61183685612c53565b6001600160a01b031660009081526013602052604090205490565b6000600f5482101561231c57506000610db8565b601054821115612347576123406064611bf9600e548661300e90919063ffffffff16565b9050610db8565b600061239d612394612366600f54601054612bf690919063ffffffff16565b611bf9612380600d54600e54612bf690919063ffffffff16565b600f5461238e908990612bf6565b9061300e565b600d5490612b92565b90506123ae6064611bf9868461300e565b949350505050565b600260015414156123fc576040805162461bcd60e51b815260206004820152601f60248201526000805160206138b9833981519152604482015290519081900360640190fd5b60026001556001600160a01b0382166124465760405162461bcd60e51b81526004018080602001828103825260298152602001806139fe6029913960400191505060405180910390fd5b336000818152600a602090815260408083206001600160a01b03871680855290835292819020859055805185815290519293927fe75ec259c38e4601f24580968665ec00b21cca4f996689b260ec598aec5c08db929181900390910190a3505060018055565b600f5481565b6001600160a01b03821660009081526013602052604081205481908190819081908790879081106125145760405162461bcd60e51b815260040180806020018281038252602b815260200180613b95602b913960400191505060405180910390fd5b6001600160a01b038916600090815260136020526040812080548a90811061253857fe5b600091825260209091206005909102018054600182015460028301546003840154600490940154929e919d509b506001600160a01b039092169950975095505050505050565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600e5481565b60105481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6125e16126e4565b6001600160a01b03166125f2611f04565b6001600160a01b03161461263b576040805162461bcd60e51b81526020600482018190526024820152600080516020613acb833981519152604482015290519081900360640190fd5b6001600160a01b0381166126805760405162461bcd60e51b815260040180806020018281038252602681526020018061391c6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020613aeb83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b61dead81565b60006110b4836001600160a01b0384166131af565b3390565b6001600160a01b03831661272d5760405162461bcd60e51b8152600401808060200182810382526024815260200180613b716024913960400191505060405180910390fd5b6001600160a01b0382166127725760405162461bcd60e51b81526004018080602001828103825260228152602001806139426022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000610db8826131f9565b60008111612834576040805162461bcd60e51b815260206004820152601f60248201527f616c6c6f636174653a20616d6f756e742063616e6e6f74206265206e756c6c00604482015290519081900360640190fd5b6001600160a01b038084166000908152601260209081526040808320600a8352818420948716845293909152902054828110156128b8576040805162461bcd60e51b815260206004820152601f60248201527f616c6c6f636174653a206e6f6e20617574686f72697a656420616d6f756e7400604482015290519081900360640190fd5b6128c28184612bf6565b6001600160a01b038087166000818152600a60209081526040808320948a1680845294825280832095909555918152600b8252838120928152919052205461290a9084612b92565b6001600160a01b038087166000908152600b6020908152604080832093891683529290522055815461293c9084612b92565b82556129498530856129b0565b836001600160a01b0316856001600160a01b03167f5168bfb88d6125d4580e2b91ecb103a730312c3e8b0be9c4031a0fc794e2cd5f856040518082815260200191505060405180910390a35050505050565b60006110b4836001600160a01b0384166131fd565b6001600160a01b0383166129f55760405162461bcd60e51b8152600401808060200182810382526025815260200180613b4c6025913960400191505060405180910390fd5b6001600160a01b038216612a3a5760405162461bcd60e51b81526004018080602001828103825260238152602001806138966023913960400191505060405180910390fd5b612a45838383613215565b612a82816040518060600160405280602681526020016139b7602691396001600160a01b0386166000908152600260205260409020549190612afb565b6001600160a01b038085166000908152600260205260408082209390935590841681522054612ab19082612b92565b6001600160a01b038084166000818152600260209081526040918290209490945580518581529051919392871692600080516020613b0b83398151915292918290030190a3505050565b60008184841115612b8a5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b4f578181015183820152602001612b37565b50505050905090810190601f168015612b7c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156110b4576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b60006110b48383613290565b600082821115612c4d576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b33600090815260136020526040902080546000198101908110612c7257fe5b906000526020600020906005020160136000336001600160a01b03166001600160a01b031681526020019081526020016000208281548110612cb057fe5b600091825260208083208454600590930201918255600180850154908301556002808501549083015560038085015490830180546001600160a01b0319166001600160a01b039092169190911790556004938401549390910192909255338152601390915260409020805480612d2257fe5b60008281526020812060056000199093019283020181815560018101829055600281018290556003810180546001600160a01b031916905560040155905550565b60008111612da25760405162461bcd60e51b8152600401808060200182810382526021815260200180613a276021913960400191505060405180910390fd5b6001600160a01b038084166000908152600b602090815260408083209386168352929052205481811015612e075760405162461bcd60e51b81526004018080602001828103825260218152602001806139dd6021913960400191505060405180910390fd5b612e118183612bf6565b6001600160a01b038086166000908152600b60209081526040808320938816835292815282822093909355600c909252812054612e579061271090611bf990869061300e565b6001600160a01b0386166000908152601260205260409020805491925090612e7f9085612bf6565b8155612e953087612e908786612bf6565b6129b0565b612ecb6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661dead846132f4565b612ed53083613346565b846001600160a01b0316866001600160a01b03167f7d613f7bd1a777aeeefdd38ae61201003086575188df50618d02482220f5c1478685604051808381526020018281526020019250505060405180910390a3505050505050565b3b151590565b81612f88576040805162461bcd60e51b815260206004820152601e60248201527f636f6e766572743a20616d6f756e742063616e6e6f74206265206e756c6c0000604482015290519081900360640190fd5b612f928183613430565b604080516001600160a01b038316815260208101849052815133927fccfaeb3043a96a967dc036ab72e078a9632af809671bc2a1ac30a8043645f89e928290030190a261300a6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333085613510565b5050565b60008261301d57506000610db8565b8282028284828161302a57fe5b04146110b45760405162461bcd60e51b8152600401808060200182810382526021815260200180613a486021913960400191505060405180910390fd5b60008082116130ba576040805162461bcd60e51b815260206004820152601a602482015279536166654d6174683a206469766973696f6e206279207a65726f60301b604482015290519081900360640190fd5b8183816130c357fe5b049392505050565b4290565b60006130db8383612bf6565b90506131116001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001685846132f4565b6131476001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661dead836132f4565b6131513084613346565b604080518481526020810184905281516001600160a01b038716927f0da072ebd7a5649099f43a3776eb0cda17aca79426ee9f28aae203f5dfa04eda928290030190a250505050565b60006110b4836001600160a01b038416613570565b60006131bb83836131fd565b6131f157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610db8565b506000610db8565b5490565b60009081526001919091016020526040902054151590565b6001600160a01b0383161580613231575061323160088461299b565b80613242575061324260088361299b565b61328b576040805162461bcd60e51b81526020600482015260156024820152741d1c985b9cd9995c8e881b9bdd08185b1b1bddd959605a1b604482015290519081900360640190fd5b505050565b815460009082106132d25760405162461bcd60e51b81526004018080602001828103825260228152602001806138746022913960400191505060405180910390fd5b8260000182815481106132e157fe5b9060005260206000200154905092915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261328b908490613636565b6001600160a01b03821661338b5760405162461bcd60e51b8152600401808060200182810382526021815260200180613b2b6021913960400191505060405180910390fd5b61339782600083613215565b6133d4816040518060600160405280602281526020016138d9602291396001600160a01b0385166000908152600260205260409020549190612afb565b6001600160a01b0383166000908152600260205260409020556004546133fa9082612bf6565b6004556040805182815290516000916001600160a01b03851691600080516020613b0b8339815191529181900360200190a35050565b6001600160a01b03821661348b576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61349760008383613215565b6004546134a49082612b92565b6004556001600160a01b0382166000908152600260205260409020546134ca9082612b92565b6001600160a01b0383166000818152600260209081526040808320949094558351858152935192939192600080516020613b0b8339815191529281900390910190a35050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261356a908590613636565b50505050565b6000818152600183016020526040812054801561362c57835460001980830191908101906000908790839081106135a357fe5b90600052602060002001549050808760000184815481106135c057fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806135f057fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610db8565b6000915050610db8565b606061368b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136e79092919063ffffffff16565b80519091501561328b578080602001905160208110156136aa57600080fd5b505161328b5760405162461bcd60e51b815260040180806020018281038252602a815260200180613bf2602a913960400191505060405180910390fd5b60606123ae8484600085856136fb85612f30565b61374c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061378b5780518252601f19909201916020918201910161376c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146137ed576040519150601f19603f3d011682016040523d82523d6000602084013e6137f2565b606091505b509150915061380282828661380d565b979650505050505050565b6060831561381c5750816110b4565b82511561382c5782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315612b4f578181015183820152602001612b3756fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647345524332303a207472616e7366657220746f20746865207a65726f20616464726573735265656e7472616e637947756172643a207265656e7472616e742063616c6c0045524332303a206275726e20616d6f756e7420657863656564732062616c616e636572656465656d3a20674d5644416d6f756e742063616e6e6f74206265206e756c6c4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737375706461746552656465656d53657474696e67733a2077726f6e6720726174696f2076616c75657375706461746552656465656d53657474696e67733a2077726f6e67206475726174696f6e2076616c75657345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63656465616c6c6f636174653a206e6f6e20617574686f72697a656420616d6f756e74617070726f766555736167653a20617070726f766520746f20746865207a65726f20616464726573736465616c6c6f636174653a20616d6f756e742063616e6e6f74206265206e756c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f777570646174655472616e7366657257686974656c6973743a2043616e6e6f742072656d6f766520674d56442066726f6d2077686974656c69737445524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737376616c696461746552656465656d3a2072656465656d20656e74727920646f6573206e6f7420657869737466696e616c697a6552656465656d3a2076657374696e67206475726174696f6e20686173206e6f7420656e646564207965745361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa164736f6c6343000705000a00000000000000000000000015a808ed3846d25e88ae868de79f1bcb1ac382b5
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000015a808ed3846d25e88ae868de79f1bcb1ac382b5
-----Decoded View---------------
Arg [0] : mvdToken_ (address): 0x15a808ed3846d25e88ae868de79f1bcb1ac382b5
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000015a808ed3846d25e88ae868de79f1bcb1ac382b5
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.