Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 283 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Redeem Settle | 21836739 | 6 days ago | IN | 0 ETH | 0.00008936 | ||||
Redeem Settle | 21820509 | 8 days ago | IN | 0 ETH | 0.00008386 | ||||
Redeem | 21800991 | 11 days ago | IN | 0 ETH | 0.00015092 | ||||
Redeem | 21800570 | 11 days ago | IN | 0 ETH | 0.00012236 | ||||
Redeem Settle | 21643555 | 33 days ago | IN | 0 ETH | 0.00057082 | ||||
Redeem | 21621659 | 36 days ago | IN | 0 ETH | 0.00061974 | ||||
Redeem Settle | 21593253 | 40 days ago | IN | 0 ETH | 0.00029776 | ||||
Redeem Settle | 21593248 | 40 days ago | IN | 0 ETH | 0.00029986 | ||||
Redeem | 21579141 | 42 days ago | IN | 0 ETH | 0.00068725 | ||||
Set Redeem Confi... | 21578869 | 42 days ago | IN | 0 ETH | 0.00017857 | ||||
Redeem Settle | 21577325 | 42 days ago | IN | 0 ETH | 0.00038078 | ||||
Redeem | 21564552 | 44 days ago | IN | 0 ETH | 0.00131712 | ||||
Redeem | 21562135 | 45 days ago | IN | 0 ETH | 0.00109218 | ||||
Redeem Settle | 21521347 | 50 days ago | IN | 0 ETH | 0.00111693 | ||||
Redeem | 21465556 | 58 days ago | IN | 0 ETH | 0.00129625 | ||||
Redeem Settle | 21370619 | 71 days ago | IN | 0 ETH | 0.00076555 | ||||
Redeem Settle | 21364198 | 72 days ago | IN | 0 ETH | 0.00077488 | ||||
Redeem | 21341064 | 75 days ago | IN | 0 ETH | 0.00198941 | ||||
Redeem Settle | 21070727 | 113 days ago | IN | 0 ETH | 0.00043423 | ||||
Set Coin Info | 21033552 | 118 days ago | IN | 0 ETH | 0.00018819 | ||||
Set Coin Info | 21033551 | 118 days ago | IN | 0 ETH | 0.00019547 | ||||
Redeem Settle | 21020938 | 120 days ago | IN | 0 ETH | 0.00038155 | ||||
Set Redeem Fee R... | 21012435 | 121 days ago | IN | 0 ETH | 0.00026882 | ||||
Redeem Settle | 20991485 | 124 days ago | IN | 0 ETH | 0.00136951 | ||||
Redeem | 20985184 | 125 days ago | IN | 0 ETH | 0.00715528 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xC5937A7A...130f3c946 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
Minter
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; import "./interfaces/ISTBT.sol"; import "./interfaces/IStbtTimelockController.sol"; contract Minter is Ownable { using SafeERC20 for IERC20; using EnumerableMap for EnumerableMap.AddressToUintMap; struct DepositConfig { bool needDivAdjust; uint96 adjustUnit; uint96 minimumDepositAmount; } struct RedeemConfig { bool needDivAdjust; uint96 adjustUnit; uint96 minimumRedeemAmount; } address public timeLockContract; address public targetContract; address public poolAccount; uint64 public nonceForRedeem; uint64 public virtualCountOfRedeemSettled; uint64 public nonceForMint; mapping(address => DepositConfig) public depositConfigMap; mapping(address => RedeemConfig) public redeemConfigMap; mapping(address => uint) public redeemFeeRateMap; mapping(uint => address) public redeemTargetMap; uint public depositPeriod; uint public redeemPeriod; EnumerableMap.AddressToUintMap private purchaseInfoMap; uint private constant UNIT = 10**18; event Mint(address indexed requestor, address indexed token, uint indexed nonce, uint depositAmount, uint proposeAmount, bytes32 salt, bytes data); event Redeem(address indexed requestor, address indexed token, uint indexed nonce, uint amount, bytes32 salt, bytes data); event Settle(address indexed target, address indexed token, uint indexed nonce, uint amount, bytes32 redeemTxId, uint redeemServiceFeeRate, uint executionPrice); constructor(address _timeLockContract, address _targetContract, address _poolAccount) Ownable() { timeLockContract = _timeLockContract; targetContract = _targetContract; poolAccount = _poolAccount; uint64 _nonceStart = uint64(1000 * block.timestamp); nonceForMint = _nonceStart; nonceForRedeem = _nonceStart; virtualCountOfRedeemSettled = _nonceStart; } function setCoinInfo(address token, uint receiverAndRate) onlyOwner external { require(uint96(receiverAndRate) < UNIT, "MINTER: FEE_RATE_TOO_LARGE"); purchaseInfoMap.set(token, receiverAndRate); } function getCoinInfo(address coin) external view returns (uint) { return purchaseInfoMap.get(coin); } function getCoinsInfo() external view returns (address[] memory coinList, uint[] memory receiverAndRateList) { coinList = new address[](purchaseInfoMap.length()); receiverAndRateList = new uint[](purchaseInfoMap.length()); for(uint i=0; i<coinList.length; i++) { (address coin, uint reveiverAndRate) = purchaseInfoMap.at(i); coinList[i] = coin; receiverAndRateList[i] = reveiverAndRate; } } function setDepositConfig(address token, DepositConfig calldata config) onlyOwner external { depositConfigMap[token] = config; } function setRedeemConfig(address token, RedeemConfig calldata config) onlyOwner external { redeemConfigMap[token] = config; } function setRedeemFeeRate(address token, uint r) onlyOwner external { redeemFeeRateMap[token] = r; } function setDepositPeriod(uint p) onlyOwner external { depositPeriod = p; } function setRedeemPeriod(uint p) onlyOwner external { redeemPeriod = p; } function setTimeLockContract(address _timeLockContract) onlyOwner external { timeLockContract = _timeLockContract; } function setTargetContract(address _targetContract) onlyOwner external { targetContract = _targetContract; } function setPoolAccount(address _poolAccount) onlyOwner external { poolAccount = _poolAccount; } // token: which token to deposit? // depositAmount: how much to deposit? // minProposedAmount: the sender use this value to protect against sudden rise of feeRate // salt: a random number that can affect TimelockController's input salt // extraData: will be used to call STBT's issue function function mint(address token, uint depositAmount, uint minProposedAmount, bytes32 salt, bytes calldata extraData) external { { (, bool receiveAllowed, uint64 expiryTime) = ISTBT(targetContract).permissions(msg.sender); require(receiveAllowed, 'MINTER: NO_RECEIVE_PERMISSION'); require(expiryTime == 0 || expiryTime > block.timestamp, 'MINTER: RECEIVE_PERMISSION_EXPIRED'); } uint receiverAndRate = purchaseInfoMap.get(token); require(receiverAndRate != 0, "MINTER: TOKEN_NOT_SUPPORTED"); address receiver = address(uint160(receiverAndRate>>96)); uint feeRate = uint96(receiverAndRate); DepositConfig memory config = depositConfigMap[token]; require(config.minimumDepositAmount != 0 && depositAmount >= config.minimumDepositAmount, "MINTER: DEPOSIT_AMOUNT_TOO_SMALL"); uint proposeAmount = depositAmount*(UNIT-feeRate)/UNIT; proposeAmount = config.needDivAdjust? proposeAmount / config.adjustUnit : proposeAmount * config.adjustUnit; require(proposeAmount >= minProposedAmount, "MINTER: PROPOSE_AMOUNT_TOO_SMALL"); IERC20(token).safeTransferFrom(msg.sender, receiver, depositAmount); bytes memory data = abi.encodeWithSignature("issue(address,uint256,bytes)", msg.sender, proposeAmount, extraData); uint64 _nonceForMint = nonceForMint; salt = keccak256(abi.encodePacked(salt, _nonceForMint)); nonceForMint = _nonceForMint + 1; IStbtTimelockController(timeLockContract).schedule(targetContract, 0, data, bytes32(""), salt, 0); emit Mint(msg.sender, token, _nonceForMint, depositAmount, proposeAmount, salt, data); } // token: which token to receive after redeem? // amount: how much STBT to deposit? // salt: a random number that can affect TimelockController's input salt // extraData: will be used to call STBT's redeemFrom function function redeem(uint amount, address token, bytes32 salt, bytes calldata extraData) external { RedeemConfig memory config = redeemConfigMap[token]; require(config.minimumRedeemAmount != 0 && amount >= config.minimumRedeemAmount, "MINTER: REDEEM_AMOUNT_TOO_SMALL"); IERC20(targetContract).safeTransferFrom(msg.sender, poolAccount, amount); bytes memory data = abi.encodeWithSignature("redeemFrom(address,uint256,bytes)", poolAccount, amount, extraData); uint adjusted = config.needDivAdjust? amount / config.adjustUnit : amount * config.adjustUnit; salt = keccak256(abi.encodePacked(salt, nonceForRedeem)); IStbtTimelockController(timeLockContract).schedule(targetContract, 0, data, bytes32(""), salt, 0); redeemTargetMap[nonceForRedeem] = msg.sender; emit Redeem(msg.sender, token, nonceForRedeem, adjusted, salt, data); nonceForRedeem = nonceForRedeem + 1; } // token: which token to refund the customer? // amount: how much to refund? // nonce: the nonce assigned to this redeem operation // redeemTxId: at which tx did the customer call 'redeem'? // redeemServiceFeeRate: some of the refunded tokens will be deducted as fee // executionPrice: the price of STBT measure by 'token' function redeemSettle(address token, uint amount, uint64 nonce, bytes32 redeemTxId, uint redeemServiceFeeRate, uint executionPrice) onlyOwner external { virtualCountOfRedeemSettled++; address target = redeemTargetMap[nonce]; require(target != address(0), "MINTER: NULL_TARGET"); delete redeemTargetMap[nonce]; IERC20(token).safeTransfer(target, amount); emit Settle(target, token, nonce, amount, redeemTxId, redeemServiceFeeRate, executionPrice); } // the rescue ETH or ERC20 tokens which were accidentally sent to this contract function rescue(address token, address receiver, uint amount) onlyOwner external { require(virtualCountOfRedeemSettled == nonceForRedeem, "MINTER: PENDING_REDEEM"); IERC20(token).safeTransfer(receiver, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/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() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../token/ERC20/extensions/IERC20Metadata.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ 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' 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)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @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"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @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). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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"); (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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableMap.js. pragma solidity ^0.8.0; import "./EnumerableSet.sol"; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * The following map types are supported: * * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0 * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableMap. * ==== */ library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct Bytes32ToBytes32Map { // Storage of keys EnumerableSet.Bytes32Set _keys; mapping(bytes32 => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key"); return value; } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( Bytes32ToBytes32Map storage map, bytes32 key, string memory errorMessage ) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), errorMessage); return value; } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) { return map._keys.values(); } // UintToUintMap struct UintToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToUintMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key), errorMessage)); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToUintMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintToAddressMap struct UintToAddressMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( UintToAddressMap storage map, uint256 key, string memory errorMessage ) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage)))); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressToUintMap struct AddressToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(AddressToUintMap storage map, address key) internal returns (bool) { return remove(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns the number of elements in the map. O(1). */ function length(AddressToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (address(uint160(uint256(key))), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key)))); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(AddressToUintMap storage map, address key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( AddressToUintMap storage map, address key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage)); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(AddressToUintMap storage map) internal view returns (address[] memory) { bytes32[] memory store = keys(map._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // Bytes32ToUintMap struct Bytes32ToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) { return set(map._inner, key, bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) { return remove(map._inner, key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) { return contains(map._inner, key); } /** * @dev Returns the number of elements in the map. O(1). */ function length(Bytes32ToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. 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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (key, uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, key); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) { return uint256(get(map._inner, key)); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( Bytes32ToUintMap storage map, bytes32 key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, key, errorMessage)); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) { bytes32[] memory store = keys(map._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @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. * * ```solidity * 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. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ 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; if (lastIndex != toDeleteIndex) { 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] = valueIndex; // Replace lastValue's index to valueIndex } // 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) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // 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); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // 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)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // 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 in 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)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/interfaces/IERC20Metadata.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; interface IERC1644 is IERC20 { // Controller Events event ControllerTransfer( address _controller, address indexed _from, address indexed _to, uint256 _value, bytes _data, bytes _operatorData ); event ControllerRedemption( address _controller, address indexed _tokenHolder, uint256 _value, bytes _data, bytes _operatorData ); // Controller Operation function isControllable() external view returns (bool); function controllerTransfer(address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external; function controllerRedeem(address _tokenHolder, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external; } interface IERC1643 { // Document Events event DocumentRemoved(bytes32 indexed _name, string _uri, bytes32 _documentHash); event DocumentUpdated(bytes32 indexed _name, string _uri, bytes32 _documentHash); // Document Management function getDocument(bytes32 _name) external view returns (string memory, bytes32, uint256); function setDocument(bytes32 _name, string calldata _uri, bytes32 _documentHash) external; function removeDocument(bytes32 _name) external; function getAllDocuments() external view returns (bytes32[] memory); } interface IERC1594 is IERC20 { // Issuance / Redemption Events event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data); event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data); // Transfers function transferWithData(address _to, uint256 _value, bytes calldata _data) external; function transferFromWithData(address _from, address _to, uint256 _value, bytes calldata _data) external; // Token Issuance function isIssuable() external view returns (bool); function issue(address _tokenHolder, uint256 _value, bytes calldata _data) external; // Token Redemption function redeem(uint256 _value, bytes calldata _data) external; function redeemFrom(address _tokenHolder, uint256 _value, bytes calldata _data) external; // Transfer Validity function canTransfer(address _to, uint256 _value, bytes calldata _data) external view returns (bool, uint8, bytes32); function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool, uint8, bytes32); } struct Permission { bool sendAllowed; // default: true bool receiveAllowed; // Address holder’s KYC will be validated till this time, after that the holder needs to re-KYC. uint64 expiryTime; // default:0 validated forever } interface ISTBT is IERC20, IERC20Metadata, IERC1594, IERC1643, IERC1644 { event InterestsDistributed(int interest, uint newTotalSupply, uint interestFromTime, uint interestToTime); event TransferShares(address indexed from, address indexed to, uint256 sharesValue); function issuer() external view returns (address); function controller() external view returns (address); function moderator() external view returns (address); function totalShares() external view returns (uint); function allowance(address _owner, address _spender) external view returns (uint256); function permissions(address addr) external view returns (bool sendAllowed, bool receiveAllowed, uint64 expiryTime); function lastDistributeTime() external view returns (uint64); function minDistributeInterval() external view returns (uint64); function maxDistributeRatio() external view returns (uint64); function setIssuer(address _issuer) external; function setController(address _controller) external; function setModerator(address _moderator) external; function setMinDistributeInterval(uint64 interval) external; function setMaxDistributeRatio(uint64 ratio) external; function setPermission(address addr, Permission calldata permission) external; function distributeInterests(int256 _distributedInterest, uint interestFromTime, uint interestToTime) external; function increaseAllowance(address _spender, uint256 _addedValue) external returns (bool); function decreaseAllowance(address _spender, uint256 _subtractedValue) external returns (bool); function sharesOf(address _account) external view returns (uint256); function getSharesByAmount(uint256 _amount) external view returns (uint256 result); function getSharesByAmountRoundUp(uint256 _amount) external view returns (uint256 result); function getAmountByShares(uint256 _shares) external view returns (uint256 result); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; interface IStbtTimelockController { function schedule( address target, uint256 value, bytes calldata data, bytes32 predecessor, bytes32 salt, uint256 /*delay*/ ) external; }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_timeLockContract","type":"address"},{"internalType":"address","name":"_targetContract","type":"address"},{"internalType":"address","name":"_poolAccount","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requestor","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"proposeAmount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"salt","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Mint","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":"requestor","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"salt","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"redeemTxId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"redeemServiceFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionPrice","type":"uint256"}],"name":"Settle","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositConfigMap","outputs":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumDepositAmount","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"coin","type":"address"}],"name":"getCoinInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCoinsInfo","outputs":[{"internalType":"address[]","name":"coinList","type":"address[]"},{"internalType":"uint256[]","name":"receiverAndRateList","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"uint256","name":"minProposedAmount","type":"uint256"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nonceForMint","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonceForRedeem","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolAccount","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redeemConfigMap","outputs":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumRedeemAmount","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redeemFeeRateMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"bytes32","name":"redeemTxId","type":"bytes32"},{"internalType":"uint256","name":"redeemServiceFeeRate","type":"uint256"},{"internalType":"uint256","name":"executionPrice","type":"uint256"}],"name":"redeemSettle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"redeemTargetMap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"receiverAndRate","type":"uint256"}],"name":"setCoinInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumDepositAmount","type":"uint96"}],"internalType":"struct Minter.DepositConfig","name":"config","type":"tuple"}],"name":"setDepositConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"p","type":"uint256"}],"name":"setDepositPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolAccount","type":"address"}],"name":"setPoolAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumRedeemAmount","type":"uint96"}],"internalType":"struct Minter.RedeemConfig","name":"config","type":"tuple"}],"name":"setRedeemConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"r","type":"uint256"}],"name":"setRedeemFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"p","type":"uint256"}],"name":"setRedeemPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_targetContract","type":"address"}],"name":"setTargetContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_timeLockContract","type":"address"}],"name":"setTimeLockContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"targetContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeLockContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"virtualCountOfRedeemSettled","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638da5cb5b11610104578063dd3c3ef6116100a2578063ed82ae2c11610071578063ed82ae2c146104a9578063f0d82e84146104bc578063f2fde38b146104cf578063fd88fa3e146104e257600080fd5b8063dd3c3ef614610433578063e02339f214610446578063e630f4bc14610483578063e8dd46551461049657600080fd5b8063bd90df70116100de578063bd90df70146103df578063be79399c146103f2578063c4e138751461040d578063d047e2a01461042057600080fd5b80638da5cb5b146103a8578063945adc3c146103b95780639ec83b2b146103cc57600080fd5b80632f6603621161017c578063709c4c971161014b578063709c4c9714610364578063715018a614610377578063735f4ec11461037f57806387df2c161461039f57600080fd5b80632f6603621461031457806340a233a61461032757806347fc822f1461033e578063500ac9d71461035157600080fd5b80631dcce717116101b85780631dcce7171461027357806320ff430b14610289578063241ba0191461029c578063283413b0146102b057600080fd5b806301cf1e9a146101df578063042b8945146101f45780631a7c85fa1461023a575b600080fd5b6101f26101ed366004611911565b6104f5565b005b61021d61020236600461192c565b6008602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b60045461025a9068010000000000000000900467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610231565b61027b61051f565b604051610231929190611945565b6101f26102973660046119c9565b610648565b60045461025a9067ffffffffffffffff1681565b6102ed6102be366004611911565b60066020526000908152604090205460ff8116906001600160601b036101008204811691600160681b90041683565b6040805193151584526001600160601b039283166020850152911690820152606001610231565b60015461021d906001600160a01b031681565b610330600a5481565b604051908152602001610231565b6101f261034c366004611911565b6106d6565b6101f261035f366004611a05565b610700565b6101f2610372366004611a47565b610774565b6101f26107a6565b61033061038d366004611911565b60076020526000908152604090205481565b61033060095481565b6000546001600160a01b031661021d565b6101f26103c7366004611abd565b6107ba565b6101f26103da366004611b44565b610d25565b60025461021d906001600160a01b031681565b60035461025a90600160a01b900467ffffffffffffffff1681565b6101f261041b366004611911565b610e79565b6101f261042e366004611a05565b610ea3565b60035461021d906001600160a01b031681565b6102ed610454366004611911565b60056020526000908152604090205460ff8116906001600160601b036101008204811691600160681b90041683565b6101f261049136600461192c565b610ec7565b6103306104a4366004611911565b610ed4565b6101f26104b7366004611b9e565b610ee7565b6101f26104ca36600461192c565b61122d565b6101f26104dd366004611911565b61123a565b6101f26104f0366004611a47565b6112ca565b6104fd6112f6565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60608061052c600b611350565b67ffffffffffffffff81111561054457610544611c06565b60405190808252806020026020018201604052801561056d578160200160208202803683370190505b50915061057a600b611350565b67ffffffffffffffff81111561059257610592611c06565b6040519080825280602002602001820160405280156105bb578160200160208202803683370190505b50905060005b8251811015610643576000806105d8600b8461135b565b91509150818584815181106105ef576105ef611c1c565b60200260200101906001600160a01b031690816001600160a01b0316815250508084848151811061062257610622611c1c565b6020026020010181815250505050808061063b90611c48565b9150506105c1565b509091565b6106506112f6565b60035460045467ffffffffffffffff908116600160a01b90920416146106bd5760405162461bcd60e51b815260206004820152601660248201527f4d494e5445523a2050454e44494e475f52454445454d0000000000000000000060448201526064015b60405180910390fd5b6106d16001600160a01b0384168383611379565b505050565b6106de6112f6565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6107086112f6565b670de0b6b3a7640000816001600160601b0316106107685760405162461bcd60e51b815260206004820152601a60248201527f4d494e5445523a204645455f524154455f544f4f5f4c4152474500000000000060448201526064016106b4565b6106d1600b838361140d565b61077c6112f6565b6001600160a01b038216600090815260066020526040902081906107a08282611d35565b50505050565b6107ae6112f6565b6107b8600061142b565b565b6002546040517f01e8820800000000000000000000000000000000000000000000000000000000815233600482015260009182916001600160a01b03909116906301e8820890602401606060405180830381865afa158015610820573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108449190611d3f565b9250925050816108965760405162461bcd60e51b815260206004820152601d60248201527f4d494e5445523a204e4f5f524543454956455f5045524d495353494f4e00000060448201526064016106b4565b67ffffffffffffffff811615806108b65750428167ffffffffffffffff16115b6109285760405162461bcd60e51b815260206004820152602260248201527f4d494e5445523a20524543454956455f5045524d495353494f4e5f455850495260448201527f454400000000000000000000000000000000000000000000000000000000000060648201526084016106b4565b5060009050610938600b8861147b565b90508060000361098a5760405162461bcd60e51b815260206004820152601b60248201527f4d494e5445523a20544f4b454e5f4e4f545f535550504f52544544000000000060448201526064016106b4565b6001600160a01b038716600090815260056020908152604091829020825160608082018552915460ff8116151582526001600160601b036101008204811694830194909452600160681b900483169381018490529084901c929184169115801590610a02575080604001516001600160601b03168910155b610a4e5760405162461bcd60e51b815260206004820181905260248201527f4d494e5445523a204445504f5349545f414d4f554e545f544f4f5f534d414c4c60448201526064016106b4565b6000670de0b6b3a7640000610a638482611d8c565b610a6d908c611d9f565b610a779190611db6565b8251909150610a9d576020820151610a98906001600160601b031682611d9f565b610ab5565b6020820151610ab5906001600160601b031682611db6565b905088811015610b075760405162461bcd60e51b815260206004820181905260248201527f4d494e5445523a2050524f504f53455f414d4f554e545f544f4f5f534d414c4c60448201526064016106b4565b610b1c6001600160a01b038c1633868d611497565b600033828989604051602401610b359493929190611dd8565b60408051601f19818403018152918152602080830180516001600160e01b03167fbb3acde900000000000000000000000000000000000000000000000000000000179052600454915192935067ffffffffffffffff680100000000000000009092049190911691610bd8918c9184910191825260c01b7fffffffffffffffff00000000000000000000000000000000000000000000000016602082015260280190565b604051602081830303815290604052805190602001209950806001610bfd9190611e1e565b600460086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600160009054906101000a90046001600160a01b03166001600160a01b03166301d5062a600260009054906101000a90046001600160a01b031660008560008f60006040518763ffffffff1660e01b8152600401610c8896959493929190611e96565b600060405180830381600087803b158015610ca257600080fd5b505af1158015610cb6573d6000803e3d6000fd5b505050508067ffffffffffffffff168d6001600160a01b0316336001600160a01b03167f2205f0f396c53967f6d82d59c867a9833f072ebbd75c3d977882997bfc65a5fa8f878f88604051610d0e9493929190611edc565b60405180910390a450505050505050505050505050565b610d2d6112f6565b6004805467ffffffffffffffff16906000610d4783611f0b565b82546101009290920a67ffffffffffffffff81810219909316918316021790915585166000908152600860205260409020546001600160a01b0316905080610dd15760405162461bcd60e51b815260206004820152601360248201527f4d494e5445523a204e554c4c5f5441524745540000000000000000000000000060448201526064016106b4565b67ffffffffffffffff8516600090815260086020526040902080546001600160a01b0319169055610e0c6001600160a01b0388168288611379565b60408051878152602081018690529081018490526060810183905267ffffffffffffffff8616906001600160a01b03808a1691908416907f30cc1b4a64a0bd6f58ae40a6575008f56436dbb9b09dea8e6aedc8297bfa14d59060800160405180910390a450505050505050565b610e816112f6565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b610eab6112f6565b6001600160a01b03909116600090815260076020526040902055565b610ecf6112f6565b600955565b6000610ee1600b8361147b565b92915050565b6001600160a01b0384166000908152600660209081526040918290208251606081018452905460ff8116151582526001600160601b036101008204811693830193909352600160681b90049091169181018290529015801590610f57575080604001516001600160601b03168610155b610fa35760405162461bcd60e51b815260206004820152601f60248201527f4d494e5445523a2052454445454d5f414d4f554e545f544f4f5f534d414c4c0060448201526064016106b4565b600354600254610fc2916001600160a01b039182169133911689611497565b600354604051600091610fe9916001600160a01b0390911690899087908790602401611dd8565b60408051601f198184030181529190526020810180516001600160e01b03167f9675193c000000000000000000000000000000000000000000000000000000001790528251909150600090611055576020830151611050906001600160601b031689611d9f565b61106d565b602083015161106d906001600160601b031689611db6565b60035460408051602081018a9052600160a01b90920460c01b7fffffffffffffffff000000000000000000000000000000000000000000000000169082015290915060480160408051601f198184030181529082905280516020909101206001546002547f01d5062a0000000000000000000000000000000000000000000000000000000084529198506001600160a01b03908116926301d5062a92611122921690600090879082908d908290600401611e96565b600060405180830381600087803b15801561113c57600080fd5b505af1158015611150573d6000803e3d6000fd5b50506003805467ffffffffffffffff600160a01b9182900481166000908152600860205260409081902080546001600160a01b03191633908117909155935490519290041693506001600160a01b038b1692507fc9083441fee7f34b32dac11477d44ed85f06ee49083338b11e9a0a3383dc1f82906111d49086908c908990611f32565b60405180910390a46003546111fb90600160a01b900467ffffffffffffffff166001611e1e565b600360146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050505050505050565b6112356112f6565b600a55565b6112426112f6565b6001600160a01b0381166112be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016106b4565b6112c78161142b565b50565b6112d26112f6565b6001600160a01b038216600090815260056020526040902081906107a08282611d35565b6000546001600160a01b031633146107b85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b4565b6000610ee1826114e8565b600080808061136a86866114f3565b909450925050505b9250929050565b6040516001600160a01b0383166024820152604481018290526106d19084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180516001600160e01b03167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261151e565b6000611423846001600160a01b03851684611606565b949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611490836001600160a01b038416611623565b9392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526107a09085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016113be565b6000610ee182611693565b60008080611501858561169d565b600081815260029690960160205260409095205494959350505050565b6000611573826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116a99092919063ffffffff16565b90508051600014806115945750808060200190518101906115949190611f5a565b6106d15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106b4565b6000828152600284016020526040812082905561142384846116b8565b600081815260028301602052604081205480151580611647575061164784846116c4565b6114905760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b6579000060448201526064016106b4565b6000610ee1825490565b600061149083836116d0565b606061142384846000856116fa565b600061149083836117ec565b6000611490838361183b565b60008260000182815481106116e7576116e7611c1c565b9060005260206000200154905092915050565b6060824710156117725760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106b4565b600080866001600160a01b0316858760405161178e9190611f77565b60006040518083038185875af1925050503d80600081146117cb576040519150601f19603f3d011682016040523d82523d6000602084013e6117d0565b606091505b50915091506117e187838387611853565b979650505050505050565b600081815260018301602052604081205461183357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ee1565b506000610ee1565b60008181526001830160205260408120541515611490565b606083156118c25782516000036118bb576001600160a01b0385163b6118bb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106b4565b5081611423565b61142383838151156118d75781518083602001fd5b8060405162461bcd60e51b81526004016106b49190611f93565b5050565b80356001600160a01b038116811461190c57600080fd5b919050565b60006020828403121561192357600080fd5b611490826118f5565b60006020828403121561193e57600080fd5b5035919050565b604080825283519082018190526000906020906060840190828701845b828110156119875781516001600160a01b031684529284019290840190600101611962565b5050508381038285015284518082528583019183019060005b818110156119bc578351835292840192918401916001016119a0565b5090979650505050505050565b6000806000606084860312156119de57600080fd5b6119e7846118f5565b92506119f5602085016118f5565b9150604084013590509250925092565b60008060408385031215611a1857600080fd5b611a21836118f5565b946020939093013593505050565b600060608284031215611a4157600080fd5b50919050565b60008060808385031215611a5a57600080fd5b611a63836118f5565b9150611a728460208501611a2f565b90509250929050565b60008083601f840112611a8d57600080fd5b50813567ffffffffffffffff811115611aa557600080fd5b60208301915083602082850101111561137257600080fd5b60008060008060008060a08789031215611ad657600080fd5b611adf876118f5565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff811115611b1057600080fd5b611b1c89828a01611a7b565b979a9699509497509295939492505050565b67ffffffffffffffff811681146112c757600080fd5b60008060008060008060c08789031215611b5d57600080fd5b611b66876118f5565b9550602087013594506040870135611b7d81611b2e565b959894975094956060810135955060808101359460a0909101359350915050565b600080600080600060808688031215611bb657600080fd5b85359450611bc6602087016118f5565b935060408601359250606086013567ffffffffffffffff811115611be957600080fd5b611bf588828901611a7b565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c5a57611c5a611c32565b5060010190565b80151581146112c757600080fd5b600081356001600160601b0381168114610ee157600080fd5b8135611c9381611c61565b815460ff19811691151560ff1691821783556cffffffffffffffffffffffff00611cbf60208601611c6f565b60081b1680836cffffffffffffffffffffffffff1984161717845578ffffffffffffffffffffffff00000000000000000000000000611d0060408701611c6f565b60681b16837fffffffffffffff0000000000000000000000000000000000000000000000000084161782171784555050505050565b6118f18282611c88565b600080600060608486031215611d5457600080fd5b8351611d5f81611c61565b6020850151909350611d7081611c61565b6040850151909250611d8181611b2e565b809150509250925092565b81810381811115610ee157610ee1611c32565b8082028115828204841417610ee157610ee1611c32565b600082611dd357634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038516815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f909201601f191601019392505050565b67ffffffffffffffff818116838216019080821115611e3f57611e3f611c32565b5092915050565b60005b83811015611e61578181015183820152602001611e49565b50506000910152565b60008151808452611e82816020860160208601611e46565b601f01601f19169290920160200192915050565b6001600160a01b038716815285602082015260c060408201526000611ebe60c0830187611e6a565b606083019590955250608081019290925260a0909101529392505050565b848152836020820152826040820152608060608201526000611f016080830184611e6a565b9695505050505050565b600067ffffffffffffffff808316818103611f2857611f28611c32565b6001019392505050565b838152826020820152606060408201526000611f516060830184611e6a565b95945050505050565b600060208284031215611f6c57600080fd5b815161149081611c61565b60008251611f89818460208701611e46565b9190910192915050565b6020815260006114906020830184611e6a56fea2646970667358221220ad35862e1f7de9e1e35384152dbb08f9738ae7462845eaacae641ad7adb9366664736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.