Source Code
Overview
POL Balance
Token Holdings
More Info
ContractCreator
Multichain Info
N/A
Latest 25 from a total of 64 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Finish Certifica... | 16157554 | 77 days ago | IN | 0 POL | 0.00249556 | ||||
Finish Certifica... | 16157547 | 77 days ago | IN | 0 POL | 0.00267403 | ||||
Finish Certifica... | 16157273 | 77 days ago | IN | 0 POL | 0.00267403 | ||||
Finish Certifica... | 16157265 | 77 days ago | IN | 0 POL | 0.00267403 | ||||
Finish Certifica... | 16118308 | 78 days ago | IN | 0 POL | 0.00344994 | ||||
Demander Paid | 16117303 | 78 days ago | IN | 0 POL | 0.00216927 | ||||
Create Certifica... | 16116799 | 78 days ago | IN | 0 POL | 0.01120673 | ||||
Create Certifica... | 16116752 | 78 days ago | IN | 0 POL | 0.01187718 | ||||
Withdraw Guarant... | 16116651 | 78 days ago | IN | 0 POL | 0.00203854 | ||||
Terminate Certif... | 16116625 | 78 days ago | IN | 0 POL | 0.00354551 | ||||
Terminate Certif... | 16116620 | 78 days ago | IN | 0 POL | 0.00421596 | ||||
Withdraw Guarant... | 16116429 | 78 days ago | IN | 0 POL | 0.00203854 | ||||
Create Certifica... | 16116398 | 78 days ago | IN | 0 POL | 0.01120626 | ||||
Create Certifica... | 16116386 | 78 days ago | IN | 0 POL | 0.01120673 | ||||
Create Certifica... | 16116378 | 78 days ago | IN | 0 POL | 0.01120626 | ||||
Create Certifica... | 16116366 | 78 days ago | IN | 0 POL | 0.01187718 | ||||
Terminate Certif... | 16116175 | 78 days ago | IN | 0 POL | 0.00335732 | ||||
Terminate Certif... | 16116170 | 78 days ago | IN | 0 POL | 0.00421548 | ||||
Withdraw Guarant... | 16115936 | 78 days ago | IN | 0 POL | 0.00203854 | ||||
Terminate Certif... | 16115830 | 78 days ago | IN | 0 POL | 0.00354551 | ||||
Terminate Certif... | 16115825 | 78 days ago | IN | 0 POL | 0.00421596 | ||||
Withdraw Guarant... | 16115635 | 78 days ago | IN | 0 POL | 0.00203854 | ||||
Terminate Certif... | 16114829 | 78 days ago | IN | 0 POL | 0.00421596 | ||||
Withdraw Guarant... | 16113859 | 78 days ago | IN | 0 POL | 0.00171746 | ||||
Withdraw Guarant... | 16111905 | 78 days ago | IN | 0 POL | 0.00135184 |
Loading...
Loading
Contract Name:
Guaranty
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; // lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); } // lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) /** * @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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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); } // lib/openzeppelin-contracts/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } } // lib/openzeppelin-contracts/contracts/utils/Context.sol // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } } // lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } } // lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } } // lib/openzeppelin-contracts/contracts/utils/math/Math.sol // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } } // lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } } // lib/openzeppelin-contracts/contracts/access/Ownable.sol // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.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. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @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 { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _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); } } // lib/openzeppelin-contracts/contracts/utils/Strings.sol // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } } // lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.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 An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @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); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @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(token).code.length > 0; } } // lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } } // src/libs/IERC20Token.sol library IERC20Token { using Address for address payable; using SafeERC20 for IERC20; function sendTo(IERC20 token, address to, uint256 amount) internal { require(to != address(0), "Invalid recipient"); if (address(token) == address(0)) { require(address(this).balance >= amount, "Insufficient ETH"); payable(to).sendValue(amount); } else { uint256 balanceFrom = token.balanceOf(address(this)); require(balanceFrom >= amount, "Insufficient balance"); uint256 balanceTo = token.balanceOf(to); (bool success,) = address(token).call(abi.encodeCall(IERC20.transfer, (to, amount))); require(success, "ERC20 token transfer call failed"); require(token.balanceOf(to) == balanceTo + amount, "ERC20 token transfer to failed"); require(token.balanceOf(address(this)) == balanceFrom - amount, "ERC20 token transfer from failed"); } } function receiveFromSender(IERC20 token, uint256 amount) internal { if (address(token) == address(0)) { require(msg.value >= amount, "Insufficient value"); } else { require(amount > 0, "Invalid amount"); uint256 allowance = token.allowance(msg.sender, address(this)); require(allowance >= amount, "Insufficient allowance"); token.safeTransferFrom(msg.sender, address(this), amount); } } } // src/libs/TronMessageHashUtils.sol library TronMessageHashUtils { function toSignedMessageHash(bytes32 messageHash, bool isTron) internal pure returns (bytes32) { return isTron ? toTronSignedMessageHash(messageHash) : toEthSignedMessageHash(messageHash); } function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32) { return MessageHashUtils.toEthSignedMessageHash(messageHash); } // function toTronSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32) { // return keccak256( // abi.encodePacked("\x19TRON Signed Message:\n32", messageHash) // ); // } function toTronSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19TRON Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } function toTronSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19TRON Signed Message:\n", bytes(Strings.toString(message.length)), message)); } } // src/Guaranty.sol contract Guaranty is Ownable, ReentrancyGuard { using IERC20Token for IERC20; using TronMessageHashUtils for bytes32; enum CertificationStatus { INACTIVE, ACTIVE, TERMINATED } enum GuarantorIncomeType { CreateCert, TerminateCert } struct Guarantor { bool isAuthenticated; address tokenAddr; uint256 depositAmount; uint256 availableAmount; mapping(address => uint256) feePool; } struct Certification { address guarantor; address demander; address tokenAddr; uint256 startTime; uint256 endTime; uint256 guaranteeAmount; uint256 availableAmount; uint256 penaltyRate; CertificationStatus status; } struct TokenInfo{ address tokenAddr; uint256 amount; } address[] private _certTokens; mapping(address => bool) private supportedTokens; mapping(address => Guarantor) private guarantors; mapping(string => Certification) private certifications; mapping(address => uint256) public guarantorCertNum; mapping(address => bool) private executorList; mapping(address => uint256) private feePool; event GuarantorAuthenticated(address guarantorAddr, address tokenAddr, uint256 amount); event GuarantorDeregistered(address guarantorAddr, uint256 amount); event CertCreated(string certId, address demanderAddr, address guarantorAddr, address tokenAddr, uint256 amount, uint256 serviceFee, uint256 platformFee, uint256 penaltyRate, uint256 startTime, uint256 endTime); event CertFunded(string certId, address demanderAddr, address tokenAddr, uint256 amount); event CertFinished(string certId, address demanderAddr, address tokenAddr, uint256 amount); event CertTerminated(string certId, address demanderAddr, address tokenAddr, uint256 amount, uint256 fee, uint256 rate); event GuarantorPaid(string paidNo, string certId, address guarantorAddr, address targetAddr, address tokenAddr, uint256 amount); event DemanderPaid(string paidNo, string certId, address demanderAddr, address targetAddr, address tokenAddr, uint256 amount); event AddExecutor(address _newExecutor); event DelExecutor(address _oldExecutor); event WithdrawPFee(address tokenAddr, address targetAddr, uint256 amount); event WithdrawGFee(address tokenAddr, address guarantorAddr, uint256 amount); event GuarantorIncome(string certId, address tokenAddr, uint256 amount, GuarantorIncomeType incomeType); event PlatformIncome(string certId, address tokenAddr, uint256 amount); event UnclaimedIncome(address guarantorAddr, address tokenAddr, uint256 amount); error NotAuthorizedExecutor(); error NotAuthenticatedGuarantor(); error GuarantorNotFound(); error HasActiveCertifications(); error CertificationNotActive(); error NotCertificationGuarantor(); error InsufficientAvailableAmount(); error InvalidExecutorSignature(); error InvalidGuarantorSignature(); error GuarantorNotAuthenticated(); error NotCertificationOwner(); error CertificationNotExpired(); error CertificationNeedFinished(); modifier onlyExecutor() { if (!executorList[msg.sender] && owner() != msg.sender) { revert NotAuthorizedExecutor(); } _; } modifier onlyGuarantor() { if (!guarantors[msg.sender].isAuthenticated) { revert NotAuthenticatedGuarantor(); } _; } constructor() Ownable(msg.sender) { executorList[msg.sender] = true; } function authenticateGuarantor(address tokenAddr, uint256 amount, uint256 timestamp, bytes memory signature, bool isTron) external nonReentrant { _checkSigTimestamp(timestamp); _verifyExecutorSignature(keccak256(abi.encode(msg.sender, tokenAddr, amount, timestamp)), signature, isTron); require(!guarantors[msg.sender].isAuthenticated, "Duplicate authentication"); _receiveToken(tokenAddr, amount); _addSupportedToken(tokenAddr); guarantors[msg.sender].isAuthenticated = true; guarantors[msg.sender].tokenAddr = tokenAddr; guarantors[msg.sender].depositAmount = amount; guarantors[msg.sender].availableAmount = amount; emit GuarantorAuthenticated(msg.sender, tokenAddr, amount); } function deregisterGuarantor(address guarantorAddr) external onlyExecutor nonReentrant { Guarantor storage guarantor = guarantors[guarantorAddr]; if (!guarantor.isAuthenticated) { revert GuarantorNotFound(); } if (guarantorCertNum[guarantorAddr] > 0) { revert HasActiveCertifications(); } guarantor.isAuthenticated = false; guarantor.depositAmount = 0; uint256 amount = 0; if(guarantor.availableAmount > 0) { amount = guarantor.availableAmount; guarantor.availableAmount = 0; _transferToken(guarantor.tokenAddr, guarantorAddr, amount); } emit GuarantorDeregistered(guarantorAddr, amount); uint256 cnt = _certTokens.length; if (cnt > 0) { amount = 0; for (uint256 i = 0; i < cnt; i++) { address tokenAddr = _certTokens[i]; amount = guarantor.feePool[tokenAddr]; if (amount > 0) { guarantor.feePool[tokenAddr] -= amount; feePool[tokenAddr] += amount; emit UnclaimedIncome(guarantorAddr, tokenAddr, amount); } } } } function guarantorPaid(string memory paidNo, string memory certId, address targetAddr, uint256 amount) external onlyExecutor nonReentrant { Certification storage cert = certifications[certId]; if (cert.status != CertificationStatus.ACTIVE || block.timestamp < cert.startTime ||block.timestamp > cert.endTime) { revert CertificationNotActive(); } Guarantor storage guarantor = guarantors[cert.guarantor]; if (guarantor.availableAmount < amount) { revert InsufficientAvailableAmount(); } guarantor.availableAmount -= amount; _transferToken(guarantor.tokenAddr, targetAddr, amount); emit GuarantorPaid(paidNo, certId, cert.guarantor, targetAddr, guarantor.tokenAddr, amount); } function getGuarantorInfo(address guarantorAddr) external view returns (bool isAuthenticated, address tokenAddr, uint256 depositAmount, uint256 availableAmount) { Guarantor storage guarantor = guarantors[guarantorAddr]; return ( guarantor.isAuthenticated, guarantor.tokenAddr, guarantor.depositAmount, guarantor.availableAmount ); } function withdrawGuarantorFee(address guarantorAddr, address[] memory tokenAddr, uint256[] memory amount) external nonReentrant { if(guarantorAddr == address(0)){ guarantorAddr = msg.sender; } Guarantor storage guarantor = guarantors[guarantorAddr]; if (!guarantor.isAuthenticated) { revert GuarantorNotFound(); } for(uint256 i = 0; i < tokenAddr.length; i++){ uint256 fee = guarantor.feePool[tokenAddr[i]]; if(amount[i] == 0){ amount[i] = fee; } if(amount[i] == 0) continue; require(amount[i] <= fee, "Insufficient fee"); guarantor.feePool[tokenAddr[i]] -= amount[i]; _transferToken(tokenAddr[i], guarantorAddr, amount[i]); emit WithdrawGFee(tokenAddr[i], guarantorAddr, amount[i]); } } function getGuarantorFee(address guarantorAddr) external view returns (TokenInfo[] memory fees) { uint256 cnt = _certTokens.length; if(cnt > 0){ fees = new TokenInfo[](cnt); for(uint256 i = 0;i < cnt; i++){ fees[i].tokenAddr = _certTokens[i]; fees[i].amount = guarantors[guarantorAddr].feePool[_certTokens[i]]; } } } function createCertification( string memory certId, address[2] calldata addrs, uint256[6] calldata amounts, bytes memory signature, bool isTron ) external nonReentrant { // addrs 0: guarantorAddr; 1: tokenAddr // amounts 0: amount; 1: serviceFee; 2: platformFee; 3: penaltyRate; 4: period; 5: ts _checkGuarantorSigTimestamp(amounts[5]); _verifyGuarantorSignature(keccak256(abi.encode(certId, msg.sender, addrs[0], addrs[1], amounts[0], amounts[1], amounts[2], amounts[3], amounts[4], amounts[5])), signature, isTron); Guarantor storage guarantor = guarantors[addrs[0]]; if (!guarantor.isAuthenticated) { revert GuarantorNotAuthenticated(); } uint256 available = amounts[0] - amounts[1] - amounts[2]; require(available > 0, "Insufficient amount"); _receiveToken(addrs[1], amounts[0]); _addSupportedToken(addrs[1]); uint256 startTime = block.timestamp - (block.timestamp % 86400); uint256 endTime = startTime + amounts[4] * 86400; certifications[certId] = Certification({ guarantor: addrs[0], demander: msg.sender, tokenAddr: addrs[1], startTime: startTime, endTime: endTime, guaranteeAmount: amounts[0], availableAmount: available, penaltyRate: amounts[3], status: CertificationStatus.ACTIVE }); guarantorCertNum[addrs[0]] += 1; feePool[addrs[1]] += amounts[2]; emit PlatformIncome(certId, addrs[1], amounts[2]); guarantor.feePool[addrs[1]] += amounts[1]; emit GuarantorIncome(certId, addrs[1], amounts[1], GuarantorIncomeType.CreateCert); emit CertCreated(certId, msg.sender, addrs[0], addrs[1], amounts[0], amounts[1], amounts[2], amounts[3], startTime, endTime); } function fundCertification(string memory certId, uint256 amount, uint256 timestamp, bytes memory signature, bool isTron) external nonReentrant { _checkGuarantorSigTimestamp(timestamp); _verifyGuarantorSignature(keccak256(abi.encode(certId, msg.sender, amount, timestamp)), signature, isTron); Certification storage cert = certifications[certId]; if (cert.status != CertificationStatus.ACTIVE || block.timestamp >= cert.endTime) { revert CertificationNotActive(); } if (msg.sender != cert.demander) { revert NotCertificationOwner(); } _receiveToken(cert.tokenAddr, amount); cert.guaranteeAmount += amount; cert.availableAmount += amount; emit CertFunded(certId, msg.sender, cert.tokenAddr, amount); } function finishCertification(string memory certId) external onlyExecutor nonReentrant { Certification storage cert = certifications[certId]; if (cert.status != CertificationStatus.ACTIVE) { revert CertificationNotActive(); } if (block.timestamp > cert.startTime && block.timestamp < cert.endTime) { revert CertificationNotExpired(); } cert.status = CertificationStatus.TERMINATED; guarantorCertNum[cert.guarantor] -= 1; uint256 amount = 0; if(cert.availableAmount > 0){ amount = cert.availableAmount; cert.availableAmount = 0; _transferToken(cert.tokenAddr, cert.demander, amount); } emit CertFinished(certId, cert.demander, cert.tokenAddr, amount); } function terminateCertification(string memory certId, uint256 timestamp, bytes memory signature, bool isTron) external nonReentrant { _checkGuarantorSigTimestamp(timestamp); _verifyGuarantorSignature(keccak256(abi.encode(certId, msg.sender, timestamp)), signature, isTron); Certification storage cert = certifications[certId]; if (cert.status != CertificationStatus.ACTIVE) { revert CertificationNotActive(); } if (block.timestamp < cert.startTime || block.timestamp > cert.endTime) { revert CertificationNeedFinished(); } if (msg.sender != cert.demander) { revert NotCertificationOwner(); } cert.status = CertificationStatus.TERMINATED; guarantorCertNum[cert.guarantor] -= 1; uint256 amount = 0; uint256 fee = 0; if(cert.availableAmount > 0){ amount = cert.availableAmount; fee = amount * cert.penaltyRate / 10000; guarantors[cert.guarantor].feePool[cert.tokenAddr] += fee; emit GuarantorIncome(certId, cert.tokenAddr, fee, GuarantorIncomeType.TerminateCert); cert.availableAmount = 0; _transferToken(cert.tokenAddr, cert.demander, amount - fee); } emit CertTerminated(certId, cert.demander, cert.tokenAddr, amount, fee, cert.penaltyRate); } function demanderPaid(string memory paidNo, string memory certId, address targetAddr, uint256 amount) external nonReentrant { Certification storage cert = certifications[certId]; if (cert.status != CertificationStatus.ACTIVE || block.timestamp >= cert.endTime) { revert CertificationNotActive(); } if (msg.sender != cert.guarantor) { revert NotCertificationGuarantor(); } if (cert.availableAmount < amount) { revert InsufficientAvailableAmount(); } cert.availableAmount -= amount; _transferToken(cert.tokenAddr, targetAddr, amount); emit DemanderPaid(paidNo, certId, cert.demander, targetAddr, cert.tokenAddr, amount); } function getCertificationInfo(string memory certId) external view returns ( uint256 startTime, uint256 endTime, uint256 guaranteeAmount, address tokenAddr, address guarantorAddr, address demanderAddr, uint256 availableAmount, uint256 penaltyRate, CertificationStatus status ) { Certification memory cert = certifications[certId]; return ( cert.startTime, cert.endTime, cert.guaranteeAmount, cert.tokenAddr, cert.guarantor, cert.demander, cert.availableAmount, cert.penaltyRate, cert.status ); } function withdrawPlatformFee(address targetAddr, address[] memory tokenAddr, uint256[] memory amount) external onlyExecutor nonReentrant { for(uint256 i = 0; i < tokenAddr.length; i++){ uint256 fee = feePool[tokenAddr[i]]; if(amount[i] == 0){ amount[i] = fee; } if(amount[i] == 0) continue; require(amount[i] <= fee, "Insufficient fee"); feePool[tokenAddr[i]] -= amount[i]; _transferToken(tokenAddr[i], targetAddr, amount[i]); emit WithdrawPFee(tokenAddr[i], targetAddr, amount[i]); } } function getPlatformFee() external view returns (TokenInfo[] memory fees) { uint256 cnt = _certTokens.length; if(cnt > 0){ fees = new TokenInfo[](cnt); for(uint256 i = 0;i < cnt; i++){ fees[i].tokenAddr = _certTokens[i]; fees[i].amount = feePool[_certTokens[i]]; } } } function addExecutor(address _newExecutor) external onlyOwner { executorList[_newExecutor] = true; emit AddExecutor(_newExecutor); } function delExecutor(address _oldExecutor) external onlyOwner { executorList[_oldExecutor] = false; emit DelExecutor(_oldExecutor); } function _receiveToken(address token, uint256 amount) private { IERC20(token).receiveFromSender(amount); } function _transferToken(address token, address to, uint256 amount) private { IERC20(token).sendTo(to, amount); } function _checkSigTimestamp(uint256 sigTimestamp) private view { require(block.timestamp > sigTimestamp, "Invalid sig timestamp!"); require(block.timestamp - sigTimestamp <= 1 hours, "Sig timestamp expire!"); } function _checkGuarantorSigTimestamp(uint256 sigTimestamp) private view { require(block.timestamp > sigTimestamp, "Invalid sig timestamp!"); require(block.timestamp - sigTimestamp <= 1 days, "Sig timestamp expire!"); } function _verifyExecutorSignature(bytes32 hash, bytes memory signature, bool isTron) private view { if (!executorList[ECDSA.recover(hash.toSignedMessageHash(isTron), signature)]) { revert InvalidExecutorSignature(); } } function _verifyGuarantorSignature(bytes32 hash, bytes memory signature, bool isTron) private view { if (!guarantors[ECDSA.recover(hash.toSignedMessageHash(isTron), signature)].isAuthenticated) { revert InvalidGuarantorSignature(); } } function _addSupportedToken(address token) private { if (!supportedTokens[token]) { supportedTokens[token] = true; _certTokens.push(token); } } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CertificationNeedFinished","type":"error"},{"inputs":[],"name":"CertificationNotActive","type":"error"},{"inputs":[],"name":"CertificationNotExpired","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"GuarantorNotAuthenticated","type":"error"},{"inputs":[],"name":"GuarantorNotFound","type":"error"},{"inputs":[],"name":"HasActiveCertifications","type":"error"},{"inputs":[],"name":"InsufficientAvailableAmount","type":"error"},{"inputs":[],"name":"InvalidExecutorSignature","type":"error"},{"inputs":[],"name":"InvalidGuarantorSignature","type":"error"},{"inputs":[],"name":"NotAuthenticatedGuarantor","type":"error"},{"inputs":[],"name":"NotAuthorizedExecutor","type":"error"},{"inputs":[],"name":"NotCertificationGuarantor","type":"error"},{"inputs":[],"name":"NotCertificationOwner","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newExecutor","type":"address"}],"name":"AddExecutor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"demanderAddr","type":"address"},{"indexed":false,"internalType":"address","name":"guarantorAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"serviceFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"platformFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"penaltyRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"CertCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"demanderAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CertFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"demanderAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CertFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"demanderAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"CertTerminated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldExecutor","type":"address"}],"name":"DelExecutor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"paidNo","type":"string"},{"indexed":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"demanderAddr","type":"address"},{"indexed":false,"internalType":"address","name":"targetAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DemanderPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guarantorAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"GuarantorAuthenticated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guarantorAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"GuarantorDeregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"enum Guaranty.GuarantorIncomeType","name":"incomeType","type":"uint8"}],"name":"GuarantorIncome","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"paidNo","type":"string"},{"indexed":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"guarantorAddr","type":"address"},{"indexed":false,"internalType":"address","name":"targetAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"GuarantorPaid","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":false,"internalType":"string","name":"certId","type":"string"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PlatformIncome","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guarantorAddr","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnclaimedIncome","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"address","name":"guarantorAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawGFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"tokenAddr","type":"address"},{"indexed":false,"internalType":"address","name":"targetAddr","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawPFee","type":"event"},{"inputs":[{"internalType":"address","name":"_newExecutor","type":"address"}],"name":"addExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"isTron","type":"bool"}],"name":"authenticateGuarantor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"certId","type":"string"},{"internalType":"address[2]","name":"addrs","type":"address[2]"},{"internalType":"uint256[6]","name":"amounts","type":"uint256[6]"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"isTron","type":"bool"}],"name":"createCertification","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oldExecutor","type":"address"}],"name":"delExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"paidNo","type":"string"},{"internalType":"string","name":"certId","type":"string"},{"internalType":"address","name":"targetAddr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"demanderPaid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"guarantorAddr","type":"address"}],"name":"deregisterGuarantor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"certId","type":"string"}],"name":"finishCertification","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"certId","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"isTron","type":"bool"}],"name":"fundCertification","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"certId","type":"string"}],"name":"getCertificationInfo","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"guaranteeAmount","type":"uint256"},{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"address","name":"guarantorAddr","type":"address"},{"internalType":"address","name":"demanderAddr","type":"address"},{"internalType":"uint256","name":"availableAmount","type":"uint256"},{"internalType":"uint256","name":"penaltyRate","type":"uint256"},{"internalType":"enum Guaranty.CertificationStatus","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"guarantorAddr","type":"address"}],"name":"getGuarantorFee","outputs":[{"components":[{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Guaranty.TokenInfo[]","name":"fees","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"guarantorAddr","type":"address"}],"name":"getGuarantorInfo","outputs":[{"internalType":"bool","name":"isAuthenticated","type":"bool"},{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"uint256","name":"availableAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPlatformFee","outputs":[{"components":[{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct Guaranty.TokenInfo[]","name":"fees","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"guarantorCertNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"paidNo","type":"string"},{"internalType":"string","name":"certId","type":"string"},{"internalType":"address","name":"targetAddr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"guarantorPaid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"certId","type":"string"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"isTron","type":"bool"}],"name":"terminateCertification","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"guarantorAddr","type":"address"},{"internalType":"address[]","name":"tokenAddr","type":"address[]"},{"internalType":"uint256[]","name":"amount","type":"uint256[]"}],"name":"withdrawGuarantorFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"targetAddr","type":"address"},{"internalType":"address[]","name":"tokenAddr","type":"address[]"},{"internalType":"uint256[]","name":"amount","type":"uint256[]"}],"name":"withdrawPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5033806200003957604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b62000044816200006a565b506001808055336000908152600760205260409020805460ff19169091179055620000ba565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61362c80620000ca6000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063df0c039711610071578063df0c0397146102e5578063f0d6e739146102f8578063f2fde38b1461030b578063f3dc8ac71461031e578063fefeb9421461033157600080fd5b80638da5cb5b1461022157806393b1c0be1461023c57806394cc0caa146102ac578063abbffd7f146102bf578063c00ff594146102d257600080fd5b80633e999530116100f45780633e999530146101b057806351263f3e146101de5780636a12d691146101fe5780636ea8bc1014610211578063715018a61461021957600080fd5b80631f5a0bbe14610131578063285cc863146101465780632f8dc0b114610159578063323c8fd71461016c578063373a82291461019d575b600080fd5b61014461013f366004612cba565b610344565b005b610144610154366004612d9a565b6103a7565b610144610167366004612eb5565b610533565b61017f61017a366004612f87565b6107df565b60405161019499989796959493929190612fda565b60405180910390f35b6101446101ab366004612cba565b6108fa565b6101d06101be366004612cba565b60066020526000908152604090205481565b604051908152602001610194565b6101f16101ec366004612cba565b610b6a565b6040516101949190613042565b61014461020c366004612f87565b610ccb565b6101f1610e92565b610144610fe7565b6000546040516001600160a01b039091168152602001610194565b61028261024a366004612cba565b6001600160a01b0390811660009081526004602052604090208054600182015460029092015460ff8216946101009092049093169290565b6040805194151585526001600160a01b039093166020850152918301526060820152608001610194565b6101446102ba36600461309a565b610ffb565b6101446102cd366004612eb5565b611288565b6101446102e036600461311a565b611524565b6101446102f33660046131b6565b611a45565b6101446103063660046131b6565b611bf4565b610144610319366004612cba565b611d4b565b61014461032c366004613232565b611d86565b61014461033f366004612cba565b611ed7565b61034c611f30565b6001600160a01b038116600081815260076020908152604091829020805460ff1916600117905590519182527f93c7cc308c27512f308819cbaa4c96440f4f9d65281fad8e5ef00e47040f8b5d91015b60405180910390a150565b6103af611f5d565b6103b883611f87565b6103ef853386866040516020016103d294939291906132d9565b604051602081830303815290604052805190602001208383612023565b60006005866040516104019190613311565b90815260405190819003602001902090506001600882015460ff16600281111561042d5761042d612fc4565b14158061043e575080600401544210155b1561045c5760405163caa1497160e01b815260040160405180910390fd5b60018101546001600160a01b0316331461048957604051635108225f60e01b815260040160405180910390fd5b60028101546104a1906001600160a01b031686612074565b848160050160008282546104b59190613343565b92505081905550848160060160008282546104d09190613343565b909155505060028101546040517fe4beadee588b5258b127bbd695bdb882f13feb7d04941947a42e4edafdd42e809161051a91899133916001600160a01b03909116908a90613356565b60405180910390a15061052c60018055565b5050505050565b61053b611f5d565b6001600160a01b03831661054d573392505b6001600160a01b0383166000908152600460205260409020805460ff1661058757604051638a0485f960e01b815260040160405180910390fd5b60005b83518110156107cf5760008260030160008684815181106105ad576105ad61338c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205490508382815181106105ea576105ea61338c565b6020026020010151600003610619578084838151811061060c5761060c61338c565b6020026020010181815250505b83828151811061062b5761062b61338c565b602002602001015160000361064057506107bd565b808483815181106106535761065361338c565b602002602001015111156106a15760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b60448201526064015b60405180910390fd5b8382815181106106b3576106b361338c565b60200260200101518360030160008785815181106106d3576106d361338c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600082825461070a91906133a2565b9250508190555061074e8583815181106107265761072661338c565b6020026020010151878685815181106107415761074161338c565b602002602001015161208b565b7f64c2af7a694cf88cf9a458a6e1dd6cea545679194c344bcf8a88f0862b1d69618583815181106107815761078161338c565b60200260200101518786858151811061079c5761079c61338c565b60200260200101516040516107b3939291906133b5565b60405180910390a1505b806107c7816133d9565b91505061058a565b50506107da60018055565b505050565b60008060008060008060008060008060058b6040516107fe9190613311565b90815260408051602092819003830181206101208201835280546001600160a01b0390811683526001820154811694830194909452600280820154909416928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e08201526008820154909261010084019160ff169081111561089557610895612fc4565b60028111156108a6576108a6612fc4565b815250509050806060015181608001518260a001518360400151846000015185602001518660c001518760e00151886101000151995099509950995099509950995099509950509193959799909294969850565b3360009081526007602052604090205460ff161580156109345750336109286000546001600160a01b031690565b6001600160a01b031614155b1561095257604051631a75945360e21b815260040160405180910390fd5b61095a611f5d565b6001600160a01b0381166000908152600460205260409020805460ff1661099457604051638a0485f960e01b815260040160405180910390fd5b6001600160a01b038216600090815260066020526040902054156109cb57604051639fbc65df60e01b815260040160405180910390fd5b805460ff19168155600060018201819055600282015415610a0d575060028101805460009091558154610a0d9061010090046001600160a01b0316848361208b565b604080516001600160a01b0385168152602081018390527ff45125f67e34d1fd0b4e22eb323de75a5895ff2aaa3a14e4587e90a20338702b910160405180910390a16002548015610b5b576000915060005b81811015610b5957600060028281548110610a7c57610a7c61338c565b60009182526020808320909101546001600160a01b031680835260038801909152604090912054945090508315610b46576001600160a01b038116600090815260038601602052604081208054869290610ad79084906133a2565b90915550506001600160a01b03811660009081526008602052604081208054869290610b04908490613343565b90915550506040517ff6c9190ab9e587d44203b4057d1e911a8c6b0f5afbb5c00fe07a438b2adb662b90610b3d908890849088906133b5565b60405180910390a15b5080610b51816133d9565b915050610a5f565b505b505050610b6760018055565b50565b6002546060908015610cc5578067ffffffffffffffff811115610b8f57610b8f612cd5565b604051908082528060200260200182016040528015610bd457816020015b6040805180820190915260008082526020820152815260200190600190039081610bad5790505b50915060005b81811015610cc35760028181548110610bf557610bf561338c565b9060005260206000200160009054906101000a90046001600160a01b0316838281518110610c2557610c2561338c565b6020908102919091018101516001600160a01b0392831690529085166000908152600490915260408120600280546003909201929184908110610c6a57610c6a61338c565b60009182526020808320909101546001600160a01b031683528201929092526040019020548351849083908110610ca357610ca361338c565b602090810291909101810151015280610cbb816133d9565b915050610bda565b505b50919050565b3360009081526007602052604090205460ff16158015610d05575033610cf96000546001600160a01b031690565b6001600160a01b031614155b15610d2357604051631a75945360e21b815260040160405180910390fd5b610d2b611f5d565b6000600582604051610d3d9190613311565b90815260405190819003602001902090506001600882015460ff166002811115610d6957610d69612fc4565b14610d875760405163caa1497160e01b815260040160405180910390fd5b806003015442118015610d9d5750806004015442105b15610dbb5760405163f4ccb25d60e01b815260040160405180910390fd5b60088101805460ff1916600217905580546001600160a01b03166000908152600660205260408120805460019290610df49084906133a2565b9091555050600681015460009015610e335750600681018054600090915560028201546001830154610e33916001600160a01b0390811691168361208b565b600182015460028301546040517fdb46044070e997437f48c54bc1f631d4b764f9b2db668dd08c2b75cd2f3b14db92610e7f9287926001600160a01b0392831692909116908690613356565b60405180910390a15050610b6760018055565b6002546060908015610fe3578067ffffffffffffffff811115610eb757610eb7612cd5565b604051908082528060200260200182016040528015610efc57816020015b6040805180820190915260008082526020820152815260200190600190039081610ed55790505b50915060005b81811015610fe15760028181548110610f1d57610f1d61338c565b9060005260206000200160009054906101000a90046001600160a01b0316838281518110610f4d57610f4d61338c565b6020026020010151600001906001600160a01b031690816001600160a01b0316815250506008600060028381548110610f8857610f8861338c565b60009182526020808320909101546001600160a01b031683528201929092526040019020548351849083908110610fc157610fc161338c565b602090810291909101810151015280610fd9816133d9565b915050610f02565b505b5090565b610fef611f30565b610ff9600061209f565b565b611003611f5d565b61100c83611f87565b6110248433856040516020016103d2939291906133f2565b60006005856040516110369190613311565b90815260405190819003602001902090506001600882015460ff16600281111561106257611062612fc4565b146110805760405163caa1497160e01b815260040160405180910390fd5b80600301544210806110955750806004015442115b156110b357604051633d991c7760e01b815260040160405180910390fd5b60018101546001600160a01b031633146110e057604051635108225f60e01b815260040160405180910390fd5b60088101805460ff1916600217905580546001600160a01b031660009081526006602052604081208054600192906111199084906133a2565b9091555050600681015460009081901561121a57826006015491506127108360070154836111479190613420565b611151919061344d565b83546001600160a01b039081166000908152600460209081526040808320600289015490941683526003909301905290812080549293508392909190611198908490613343565b909155505060028301546040517f6dd04698d6369e1fc7f26b7de3cc578d1f8de62e7566a604446f1e745f1c2433916111e1918a916001600160a01b0316908590600190613461565b60405180910390a1600060068401556002830154600184015461121a916001600160a01b03908116911661121584866133a2565b61208b565b6001830154600284015460078501546040517fe2bf30fb6079aea4f533e84b8d79bb8e2be03d5fcd44a72792812674d0688b0b9361126e938c936001600160a01b03928316939290911691889188916134ab565b60405180910390a150505061128260018055565b50505050565b3360009081526007602052604090205460ff161580156112c25750336112b66000546001600160a01b031690565b6001600160a01b031614155b156112e057604051631a75945360e21b815260040160405180910390fd5b6112e8611f5d565b60005b825181101561151a5760006008600085848151811061130c5761130c61338c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205490508282815181106113495761134961338c565b6020026020010151600003611378578083838151811061136b5761136b61338c565b6020026020010181815250505b82828151811061138a5761138a61338c565b602002602001015160000361139f5750611508565b808383815181106113b2576113b261338c565b602002602001015111156113fb5760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610698565b82828151811061140d5761140d61338c565b60200260200101516008600086858151811061142b5761142b61338c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600082825461146291906133a2565b9250508190555061149984838151811061147e5761147e61338c565b6020026020010151868585815181106107415761074161338c565b7ff8f5bbf0838cacfc546b920891c79cce3359e0e41c9d3462c23416a0488ab37b8483815181106114cc576114cc61338c565b6020026020010151868585815181106114e7576114e761338c565b60200260200101516040516114fe939291906133b5565b60405180910390a1505b80611512816133d9565b9150506112eb565b506107da60018055565b61152c611f5d565b61153960a0840135611f87565b6115a4853361154b6020880188612cba565b61155b6040890160208a01612cba565b8760006020020135886001602002013589600260200201358a600360200201358b600460200201358c600560200201356040516020016103d29a999897969594939291906134f3565b60006004816115b66020880188612cba565b6001600160a01b031681526020810191909152604001600020805490915060ff166115f45760405163dd4379a760e01b815260040160405180910390fd5b6000604085013561160a602087013587356133a2565b61161491906133a2565b90506000811161165c5760405162461bcd60e51b8152602060048201526013602482015272125b9cdd59999a58da595b9d08185b5bdd5b9d606a1b6044820152606401610698565b61167661166f6040880160208901612cba565b8635612074565b61168e6116896040880160208901612cba565b6120ef565b600061169d6201518042613557565b6116a790426133a2565b905060006116bc608088013562015180613420565b6116c69083613343565b9050604051806101200160405280896000600281106116e7576116e761338c565b6020020160208101906116fa9190612cba565b6001600160a01b031681523360208201526040018960016020020160208101906117249190612cba565b6001600160a01b03168152602081018490526040810183905288356060808301919091526080820186905289013560a082015260c001600181525060058a60405161176f9190613311565b9081526040805160209281900383019020835181546001600160a01b03199081166001600160a01b03928316178355938501516001808401805487169284169290921790915592850151600280840180549096169190921617909355606084015160038201556080840151600482015560a0840151600582015560c0840151600682015560e0840151600782015561010084015160088201805492949193909260ff191691849081111561182557611825612fc4565b02179055506001915060069050600061184160208c018c612cba565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546118709190613343565b909155505060408088013590600890600090611891908c0160208d01612cba565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546118c09190613343565b909155507f819255859451cb1d22ee7b16632a5dff1e1aae811a50bb210aa18a391f3e83ea9050896118f860408b0160208c01612cba565b6040805161190b9392918c0135906133f2565b60405180910390a16020808801359060038601906000906119329060408d01908d01612cba565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546119619190613343565b909155507f6dd04698d6369e1fc7f26b7de3cc578d1f8de62e7566a604446f1e745f1c243390508961199960408b0160208c01612cba565b6040516119b092919060208c013590600090613461565b60405180910390a17f4fbce2f54c601d1611f9f579b68be00e5ccca68ecd633e14ec9e555c1327990289336119e860208c018c612cba565b6119f860408d0160208e01612cba565b8b600060200201358c600160200201358d600260200201358e600360200201358a8a604051611a309a999897969594939291906134f3565b60405180910390a15050505061052c60018055565b3360009081526007602052604090205460ff16158015611a7f575033611a736000546001600160a01b031690565b6001600160a01b031614155b15611a9d57604051631a75945360e21b815260040160405180910390fd5b611aa5611f5d565b6000600584604051611ab79190613311565b90815260405190819003602001902090506001600882015460ff166002811115611ae357611ae3612fc4565b141580611af35750806003015442105b80611b015750806004015442115b15611b1f5760405163caa1497160e01b815260040160405180910390fd5b80546001600160a01b031660009081526004602052604090206002810154831115611b5d5760405163b35f6c3760e01b815260040160405180910390fd5b82816002016000828254611b7191906133a2565b90915550508054611b919061010090046001600160a01b0316858561208b565b815481546040517f6619f0dd4f318c9c029f8dc03a5333640d21c55b5c58590578f115400941769892611be1928a928a926001600160a01b03908116928b92610100909104909116908a9061356b565b60405180910390a1505061128260018055565b611bfc611f5d565b6000600584604051611c0e9190613311565b90815260405190819003602001902090506001600882015460ff166002811115611c3a57611c3a612fc4565b141580611c4b575080600401544210155b15611c695760405163caa1497160e01b815260040160405180910390fd5b80546001600160a01b03163314611c9357604051632fc7075d60e11b815260040160405180910390fd5b8181600601541015611cb85760405163b35f6c3760e01b815260040160405180910390fd5b81816006016000828254611ccc91906133a2565b90915550506002810154611cea906001600160a01b0316848461208b565b600181015460028201546040517f9be6dbcaf4b06f543edce6f4d3f6652632b061bff8d611ca4c15fc19f982d05992611d3992899289926001600160a01b03908116928a92911690899061356b565b60405180910390a15061128260018055565b611d53611f30565b6001600160a01b038116611d7d57604051631e4fbdf760e01b815260006004820152602401610698565b610b678161209f565b611d8e611f5d565b611d9783612175565b604080513360208201526001600160a01b038716918101919091526060810185905260808101849052611de49060a0016040516020818303038152906040528051906020012083836121ca565b3360009081526004602052604090205460ff1615611e445760405162461bcd60e51b815260206004820152601860248201527f4475706c69636174652061757468656e7469636174696f6e00000000000000006044820152606401610698565b611e4e8585612074565b611e57856120ef565b3360008181526004602052604090819020805460016001600160a81b03199091166101006001600160a01b038b160217811782558101879055600201869055517f031d04f6a40e144a113c642f1005ad66a38fae6b723e0b4e055169e727b1979391611ec691889088906133b5565b60405180910390a161052c60018055565b611edf611f30565b6001600160a01b038116600081815260076020908152604091829020805460ff1916905590519182527fd96f2ee6fc90ccdacdc133ce2a13d876eae3a1d62033c54b39687920f85b1159910161039c565b6000546001600160a01b03163314610ff95760405163118cdaa760e01b8152336004820152602401610698565b600260015403611f8057604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b804211611fcf5760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964207369672074696d657374616d702160501b6044820152606401610698565b62015180611fdd82426133a2565b1115610b675760405162461bcd60e51b81526020600482015260156024820152745369672074696d657374616d70206578706972652160581b6044820152606401610698565b6004600061203a6120348685612215565b85612263565b6001600160a01b0316815260208101919091526040016000205460ff166107da576040516369790f8760e11b815260040160405180910390fd5b6120876001600160a01b0383168261228d565b5050565b6107da6001600160a01b03841683836123f2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811660009081526003602052604090205460ff16610b67576001600160a01b03166000818152600360205260408120805460ff191660019081179091556002805491820181559091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319169091179055565b8042116121bd5760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964207369672074696d657374616d702160501b6044820152606401610698565b610e10611fdd82426133a2565b600760006121db6120348685612215565b6001600160a01b0316815260208101919091526040016000205460ff166107da57604051638f4450b560e01b815260040160405180910390fd5b60008161222a5761222583612838565b61225a565b7f1954524f4e205369676e6564204d6573736167653a0a333200000000000000006000908152601c849052603c90205b90505b92915050565b600080600080612273868661286c565b92509250925061228382826128b9565b5090949350505050565b6001600160a01b0382166122e057803410156120875760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742076616c756560701b6044820152606401610698565b600081116123215760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610698565b604051636eb1769f60e11b81523360048201523060248201526000906001600160a01b0384169063dd62ed3e90604401602060405180830381865afa15801561236e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239291906135c0565b9050818110156123dd5760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610698565b6107da6001600160a01b038416333085612972565b6001600160a01b03821661243c5760405162461bcd60e51b8152602060048201526011602482015270125b9d985b1a59081c9958da5c1a595b9d607a1b6044820152606401610698565b6001600160a01b0383166124a0578047101561248d5760405162461bcd60e51b815260206004820152601060248201526f092dce6eaccccd2c6d2cadce8408aa8960831b6044820152606401610698565b6107da6001600160a01b038316826129cc565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156124e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250b91906135c0565b9050818110156125545760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610698565b6040516370a0823160e01b81526001600160a01b038481166004830152600091908616906370a0823190602401602060405180830381865afa15801561259e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c291906135c0565b6040516001600160a01b0386811660248301526044820186905291925060009187169060640160408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b1790525161261d9190613311565b6000604051808303816000865af19150503d806000811461265a576040519150601f19603f3d011682016040523d82523d6000602084013e61265f565b606091505b50509050806126b05760405162461bcd60e51b815260206004820181905260248201527f455243323020746f6b656e207472616e736665722063616c6c206661696c65646044820152606401610698565b6126ba8483613343565b6040516370a0823160e01b81526001600160a01b0387811660048301528816906370a0823190602401602060405180830381865afa158015612700573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061272491906135c0565b146127715760405162461bcd60e51b815260206004820152601e60248201527f455243323020746f6b656e207472616e7366657220746f206661696c656400006044820152606401610698565b61277b84846133a2565b6040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa1580156127bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127e391906135c0565b146128305760405162461bcd60e51b815260206004820181905260248201527f455243323020746f6b656e207472616e736665722066726f6d206661696c65646044820152606401610698565b505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c829052603c812061225d565b600080600083516041036128a65760208401516040850151606086015160001a61289888828585612a63565b9550955095505050506128b2565b50508151600091506002905b9250925092565b60008260038111156128cd576128cd612fc4565b036128d6575050565b60018260038111156128ea576128ea612fc4565b036129085760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561291c5761291c612fc4565b0361293d5760405163fce698f760e01b815260048101829052602401610698565b600382600381111561295157612951612fc4565b03612087576040516335e2f38360e21b815260048101829052602401610698565b61128284856001600160a01b03166323b872dd86868660405160240161299a939291906133b5565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612b32565b804710156129ef5760405163cd78605960e01b8152306004820152602401610698565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612a3c576040519150601f19603f3d011682016040523d82523d6000602084013e612a41565b606091505b50509050806107da57604051630a12f52160e11b815260040160405180910390fd5b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115612a9e5750600091506003905082612b28565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015612af2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612b1e57506000925060019150829050612b28565b9250600091508190505b9450945094915050565b6000612b476001600160a01b03841683612b95565b90508051600014158015612b6c575080806020019051810190612b6a91906135d9565b155b156107da57604051635274afe760e01b81526001600160a01b0384166004820152602401610698565b606061225a8383600084600080856001600160a01b03168486604051612bbb9190613311565b60006040518083038185875af1925050503d8060008114612bf8576040519150601f19603f3d011682016040523d82523d6000602084013e612bfd565b606091505b5091509150612c0d868383612c19565b925050505b9392505050565b606082612c2e57612c2982612c75565b612c12565b8151158015612c4557506001600160a01b0384163b155b15612c6e57604051639996b31560e01b81526001600160a01b0385166004820152602401610698565b5080612c12565b805115612c855780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b0381168114612cb557600080fd5b919050565b600060208284031215612ccc57600080fd5b61225a82612c9e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612d1457612d14612cd5565b604052919050565b600082601f830112612d2d57600080fd5b813567ffffffffffffffff811115612d4757612d47612cd5565b612d5a601f8201601f1916602001612ceb565b818152846020838601011115612d6f57600080fd5b816020850160208301376000918101602001919091529392505050565b8015158114610b6757600080fd5b600080600080600060a08688031215612db257600080fd5b853567ffffffffffffffff80821115612dca57600080fd5b612dd689838a01612d1c565b965060208801359550604088013594506060880135915080821115612dfa57600080fd5b50612e0788828901612d1c565b9250506080860135612e1881612d8c565b809150509295509295909350565b600067ffffffffffffffff821115612e4057612e40612cd5565b5060051b60200190565b600082601f830112612e5b57600080fd5b81356020612e70612e6b83612e26565b612ceb565b82815260059290921b84018101918181019086841115612e8f57600080fd5b8286015b84811015612eaa5780358352918301918301612e93565b509695505050505050565b600080600060608486031215612eca57600080fd5b612ed384612c9e565b925060208085013567ffffffffffffffff80821115612ef157600080fd5b818701915087601f830112612f0557600080fd5b8135612f13612e6b82612e26565b81815260059190911b8301840190848101908a831115612f3257600080fd5b938501935b82851015612f5757612f4885612c9e565b82529385019390850190612f37565b965050506040870135925080831115612f6f57600080fd5b5050612f7d86828701612e4a565b9150509250925092565b600060208284031215612f9957600080fd5b813567ffffffffffffffff811115612fb057600080fd5b612fbc84828501612d1c565b949350505050565b634e487b7160e01b600052602160045260246000fd5b89815260208101899052604081018890526001600160a01b0387811660608301528681166080830152851660a082015260c0810184905260e0810183905261012081016003831061302d5761302d612fc4565b826101008301529a9950505050505050505050565b602080825282518282018190526000919060409081850190868401855b8281101561308d57815180516001600160a01b0316855286015186850152928401929085019060010161305f565b5091979650505050505050565b600080600080608085870312156130b057600080fd5b843567ffffffffffffffff808211156130c857600080fd5b6130d488838901612d1c565b95506020870135945060408701359150808211156130f157600080fd5b506130fe87828801612d1c565b925050606085013561310f81612d8c565b939692955090935050565b6000806000806000610160868803121561313357600080fd5b853567ffffffffffffffff8082111561314b57600080fd5b61315789838a01612d1c565b96506060880191508882111561316c57600080fd5b60208801955061012088018981111561318457600080fd5b9194509035908082111561319757600080fd5b506131a488828901612d1c565b925050610140860135612e1881612d8c565b600080600080608085870312156131cc57600080fd5b843567ffffffffffffffff808211156131e457600080fd5b6131f088838901612d1c565b9550602087013591508082111561320657600080fd5b5061321387828801612d1c565b93505061322260408601612c9e565b9396929550929360600135925050565b600080600080600060a0868803121561324a57600080fd5b61325386612c9e565b94506020860135935060408601359250606086013567ffffffffffffffff81111561327d57600080fd5b612e0788828901612d1c565b60005b838110156132a457818101518382015260200161328c565b50506000910152565b600081518084526132c5816020860160208601613289565b601f01601f19169290920160200192915050565b6080815260006132ec60808301876132ad565b6001600160a01b03959095166020830152506040810192909252606090910152919050565b60008251613323818460208701613289565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561225d5761225d61332d565b60808152600061336960808301876132ad565b6001600160a01b0395861660208401529390941660408201526060015292915050565b634e487b7160e01b600052603260045260246000fd5b8181038181111561225d5761225d61332d565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6000600182016133eb576133eb61332d565b5060010190565b60608152600061340560608301866132ad565b6001600160a01b039490941660208301525060400152919050565b808202811582820484141761225d5761225d61332d565b634e487b7160e01b600052601260045260246000fd5b60008261345c5761345c613437565b500490565b60808152600061347460808301876132ad565b6001600160a01b03861660208401526040830185905290506002831061349c5761349c612fc4565b82606083015295945050505050565b60c0815260006134be60c08301896132ad565b6001600160a01b0397881660208401529590961660408201526060810193909352608083019190915260a09091015292915050565b60006101408083526135078184018e6132ad565b6001600160a01b039c8d1660208501529a8c1660408401525050969098166060870152608086019490945260a085019290925260c084015260e08301526101008201526101200191909152919050565b60008261356657613566613437565b500690565b60c08152600061357e60c08301896132ad565b828103602084015261359081896132ad565b6001600160a01b0397881660408501529587166060840152505091909316608082015260a0019190915292915050565b6000602082840312156135d257600080fd5b5051919050565b6000602082840312156135eb57600080fd5b8151612c1281612d8c56fea2646970667358221220c7e31b5e598e6f8a84287bb24ae6d302661df2379e55cedb1594e093cd90fd8d64736f6c63430008140033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80638da5cb5b116100ad578063df0c039711610071578063df0c0397146102e5578063f0d6e739146102f8578063f2fde38b1461030b578063f3dc8ac71461031e578063fefeb9421461033157600080fd5b80638da5cb5b1461022157806393b1c0be1461023c57806394cc0caa146102ac578063abbffd7f146102bf578063c00ff594146102d257600080fd5b80633e999530116100f45780633e999530146101b057806351263f3e146101de5780636a12d691146101fe5780636ea8bc1014610211578063715018a61461021957600080fd5b80631f5a0bbe14610131578063285cc863146101465780632f8dc0b114610159578063323c8fd71461016c578063373a82291461019d575b600080fd5b61014461013f366004612cba565b610344565b005b610144610154366004612d9a565b6103a7565b610144610167366004612eb5565b610533565b61017f61017a366004612f87565b6107df565b60405161019499989796959493929190612fda565b60405180910390f35b6101446101ab366004612cba565b6108fa565b6101d06101be366004612cba565b60066020526000908152604090205481565b604051908152602001610194565b6101f16101ec366004612cba565b610b6a565b6040516101949190613042565b61014461020c366004612f87565b610ccb565b6101f1610e92565b610144610fe7565b6000546040516001600160a01b039091168152602001610194565b61028261024a366004612cba565b6001600160a01b0390811660009081526004602052604090208054600182015460029092015460ff8216946101009092049093169290565b6040805194151585526001600160a01b039093166020850152918301526060820152608001610194565b6101446102ba36600461309a565b610ffb565b6101446102cd366004612eb5565b611288565b6101446102e036600461311a565b611524565b6101446102f33660046131b6565b611a45565b6101446103063660046131b6565b611bf4565b610144610319366004612cba565b611d4b565b61014461032c366004613232565b611d86565b61014461033f366004612cba565b611ed7565b61034c611f30565b6001600160a01b038116600081815260076020908152604091829020805460ff1916600117905590519182527f93c7cc308c27512f308819cbaa4c96440f4f9d65281fad8e5ef00e47040f8b5d91015b60405180910390a150565b6103af611f5d565b6103b883611f87565b6103ef853386866040516020016103d294939291906132d9565b604051602081830303815290604052805190602001208383612023565b60006005866040516104019190613311565b90815260405190819003602001902090506001600882015460ff16600281111561042d5761042d612fc4565b14158061043e575080600401544210155b1561045c5760405163caa1497160e01b815260040160405180910390fd5b60018101546001600160a01b0316331461048957604051635108225f60e01b815260040160405180910390fd5b60028101546104a1906001600160a01b031686612074565b848160050160008282546104b59190613343565b92505081905550848160060160008282546104d09190613343565b909155505060028101546040517fe4beadee588b5258b127bbd695bdb882f13feb7d04941947a42e4edafdd42e809161051a91899133916001600160a01b03909116908a90613356565b60405180910390a15061052c60018055565b5050505050565b61053b611f5d565b6001600160a01b03831661054d573392505b6001600160a01b0383166000908152600460205260409020805460ff1661058757604051638a0485f960e01b815260040160405180910390fd5b60005b83518110156107cf5760008260030160008684815181106105ad576105ad61338c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205490508382815181106105ea576105ea61338c565b6020026020010151600003610619578084838151811061060c5761060c61338c565b6020026020010181815250505b83828151811061062b5761062b61338c565b602002602001015160000361064057506107bd565b808483815181106106535761065361338c565b602002602001015111156106a15760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b60448201526064015b60405180910390fd5b8382815181106106b3576106b361338c565b60200260200101518360030160008785815181106106d3576106d361338c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600082825461070a91906133a2565b9250508190555061074e8583815181106107265761072661338c565b6020026020010151878685815181106107415761074161338c565b602002602001015161208b565b7f64c2af7a694cf88cf9a458a6e1dd6cea545679194c344bcf8a88f0862b1d69618583815181106107815761078161338c565b60200260200101518786858151811061079c5761079c61338c565b60200260200101516040516107b3939291906133b5565b60405180910390a1505b806107c7816133d9565b91505061058a565b50506107da60018055565b505050565b60008060008060008060008060008060058b6040516107fe9190613311565b90815260408051602092819003830181206101208201835280546001600160a01b0390811683526001820154811694830194909452600280820154909416928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e08201526008820154909261010084019160ff169081111561089557610895612fc4565b60028111156108a6576108a6612fc4565b815250509050806060015181608001518260a001518360400151846000015185602001518660c001518760e00151886101000151995099509950995099509950995099509950509193959799909294969850565b3360009081526007602052604090205460ff161580156109345750336109286000546001600160a01b031690565b6001600160a01b031614155b1561095257604051631a75945360e21b815260040160405180910390fd5b61095a611f5d565b6001600160a01b0381166000908152600460205260409020805460ff1661099457604051638a0485f960e01b815260040160405180910390fd5b6001600160a01b038216600090815260066020526040902054156109cb57604051639fbc65df60e01b815260040160405180910390fd5b805460ff19168155600060018201819055600282015415610a0d575060028101805460009091558154610a0d9061010090046001600160a01b0316848361208b565b604080516001600160a01b0385168152602081018390527ff45125f67e34d1fd0b4e22eb323de75a5895ff2aaa3a14e4587e90a20338702b910160405180910390a16002548015610b5b576000915060005b81811015610b5957600060028281548110610a7c57610a7c61338c565b60009182526020808320909101546001600160a01b031680835260038801909152604090912054945090508315610b46576001600160a01b038116600090815260038601602052604081208054869290610ad79084906133a2565b90915550506001600160a01b03811660009081526008602052604081208054869290610b04908490613343565b90915550506040517ff6c9190ab9e587d44203b4057d1e911a8c6b0f5afbb5c00fe07a438b2adb662b90610b3d908890849088906133b5565b60405180910390a15b5080610b51816133d9565b915050610a5f565b505b505050610b6760018055565b50565b6002546060908015610cc5578067ffffffffffffffff811115610b8f57610b8f612cd5565b604051908082528060200260200182016040528015610bd457816020015b6040805180820190915260008082526020820152815260200190600190039081610bad5790505b50915060005b81811015610cc35760028181548110610bf557610bf561338c565b9060005260206000200160009054906101000a90046001600160a01b0316838281518110610c2557610c2561338c565b6020908102919091018101516001600160a01b0392831690529085166000908152600490915260408120600280546003909201929184908110610c6a57610c6a61338c565b60009182526020808320909101546001600160a01b031683528201929092526040019020548351849083908110610ca357610ca361338c565b602090810291909101810151015280610cbb816133d9565b915050610bda565b505b50919050565b3360009081526007602052604090205460ff16158015610d05575033610cf96000546001600160a01b031690565b6001600160a01b031614155b15610d2357604051631a75945360e21b815260040160405180910390fd5b610d2b611f5d565b6000600582604051610d3d9190613311565b90815260405190819003602001902090506001600882015460ff166002811115610d6957610d69612fc4565b14610d875760405163caa1497160e01b815260040160405180910390fd5b806003015442118015610d9d5750806004015442105b15610dbb5760405163f4ccb25d60e01b815260040160405180910390fd5b60088101805460ff1916600217905580546001600160a01b03166000908152600660205260408120805460019290610df49084906133a2565b9091555050600681015460009015610e335750600681018054600090915560028201546001830154610e33916001600160a01b0390811691168361208b565b600182015460028301546040517fdb46044070e997437f48c54bc1f631d4b764f9b2db668dd08c2b75cd2f3b14db92610e7f9287926001600160a01b0392831692909116908690613356565b60405180910390a15050610b6760018055565b6002546060908015610fe3578067ffffffffffffffff811115610eb757610eb7612cd5565b604051908082528060200260200182016040528015610efc57816020015b6040805180820190915260008082526020820152815260200190600190039081610ed55790505b50915060005b81811015610fe15760028181548110610f1d57610f1d61338c565b9060005260206000200160009054906101000a90046001600160a01b0316838281518110610f4d57610f4d61338c565b6020026020010151600001906001600160a01b031690816001600160a01b0316815250506008600060028381548110610f8857610f8861338c565b60009182526020808320909101546001600160a01b031683528201929092526040019020548351849083908110610fc157610fc161338c565b602090810291909101810151015280610fd9816133d9565b915050610f02565b505b5090565b610fef611f30565b610ff9600061209f565b565b611003611f5d565b61100c83611f87565b6110248433856040516020016103d2939291906133f2565b60006005856040516110369190613311565b90815260405190819003602001902090506001600882015460ff16600281111561106257611062612fc4565b146110805760405163caa1497160e01b815260040160405180910390fd5b80600301544210806110955750806004015442115b156110b357604051633d991c7760e01b815260040160405180910390fd5b60018101546001600160a01b031633146110e057604051635108225f60e01b815260040160405180910390fd5b60088101805460ff1916600217905580546001600160a01b031660009081526006602052604081208054600192906111199084906133a2565b9091555050600681015460009081901561121a57826006015491506127108360070154836111479190613420565b611151919061344d565b83546001600160a01b039081166000908152600460209081526040808320600289015490941683526003909301905290812080549293508392909190611198908490613343565b909155505060028301546040517f6dd04698d6369e1fc7f26b7de3cc578d1f8de62e7566a604446f1e745f1c2433916111e1918a916001600160a01b0316908590600190613461565b60405180910390a1600060068401556002830154600184015461121a916001600160a01b03908116911661121584866133a2565b61208b565b6001830154600284015460078501546040517fe2bf30fb6079aea4f533e84b8d79bb8e2be03d5fcd44a72792812674d0688b0b9361126e938c936001600160a01b03928316939290911691889188916134ab565b60405180910390a150505061128260018055565b50505050565b3360009081526007602052604090205460ff161580156112c25750336112b66000546001600160a01b031690565b6001600160a01b031614155b156112e057604051631a75945360e21b815260040160405180910390fd5b6112e8611f5d565b60005b825181101561151a5760006008600085848151811061130c5761130c61338c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205490508282815181106113495761134961338c565b6020026020010151600003611378578083838151811061136b5761136b61338c565b6020026020010181815250505b82828151811061138a5761138a61338c565b602002602001015160000361139f5750611508565b808383815181106113b2576113b261338c565b602002602001015111156113fb5760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610698565b82828151811061140d5761140d61338c565b60200260200101516008600086858151811061142b5761142b61338c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600082825461146291906133a2565b9250508190555061149984838151811061147e5761147e61338c565b6020026020010151868585815181106107415761074161338c565b7ff8f5bbf0838cacfc546b920891c79cce3359e0e41c9d3462c23416a0488ab37b8483815181106114cc576114cc61338c565b6020026020010151868585815181106114e7576114e761338c565b60200260200101516040516114fe939291906133b5565b60405180910390a1505b80611512816133d9565b9150506112eb565b506107da60018055565b61152c611f5d565b61153960a0840135611f87565b6115a4853361154b6020880188612cba565b61155b6040890160208a01612cba565b8760006020020135886001602002013589600260200201358a600360200201358b600460200201358c600560200201356040516020016103d29a999897969594939291906134f3565b60006004816115b66020880188612cba565b6001600160a01b031681526020810191909152604001600020805490915060ff166115f45760405163dd4379a760e01b815260040160405180910390fd5b6000604085013561160a602087013587356133a2565b61161491906133a2565b90506000811161165c5760405162461bcd60e51b8152602060048201526013602482015272125b9cdd59999a58da595b9d08185b5bdd5b9d606a1b6044820152606401610698565b61167661166f6040880160208901612cba565b8635612074565b61168e6116896040880160208901612cba565b6120ef565b600061169d6201518042613557565b6116a790426133a2565b905060006116bc608088013562015180613420565b6116c69083613343565b9050604051806101200160405280896000600281106116e7576116e761338c565b6020020160208101906116fa9190612cba565b6001600160a01b031681523360208201526040018960016020020160208101906117249190612cba565b6001600160a01b03168152602081018490526040810183905288356060808301919091526080820186905289013560a082015260c001600181525060058a60405161176f9190613311565b9081526040805160209281900383019020835181546001600160a01b03199081166001600160a01b03928316178355938501516001808401805487169284169290921790915592850151600280840180549096169190921617909355606084015160038201556080840151600482015560a0840151600582015560c0840151600682015560e0840151600782015561010084015160088201805492949193909260ff191691849081111561182557611825612fc4565b02179055506001915060069050600061184160208c018c612cba565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546118709190613343565b909155505060408088013590600890600090611891908c0160208d01612cba565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546118c09190613343565b909155507f819255859451cb1d22ee7b16632a5dff1e1aae811a50bb210aa18a391f3e83ea9050896118f860408b0160208c01612cba565b6040805161190b9392918c0135906133f2565b60405180910390a16020808801359060038601906000906119329060408d01908d01612cba565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546119619190613343565b909155507f6dd04698d6369e1fc7f26b7de3cc578d1f8de62e7566a604446f1e745f1c243390508961199960408b0160208c01612cba565b6040516119b092919060208c013590600090613461565b60405180910390a17f4fbce2f54c601d1611f9f579b68be00e5ccca68ecd633e14ec9e555c1327990289336119e860208c018c612cba565b6119f860408d0160208e01612cba565b8b600060200201358c600160200201358d600260200201358e600360200201358a8a604051611a309a999897969594939291906134f3565b60405180910390a15050505061052c60018055565b3360009081526007602052604090205460ff16158015611a7f575033611a736000546001600160a01b031690565b6001600160a01b031614155b15611a9d57604051631a75945360e21b815260040160405180910390fd5b611aa5611f5d565b6000600584604051611ab79190613311565b90815260405190819003602001902090506001600882015460ff166002811115611ae357611ae3612fc4565b141580611af35750806003015442105b80611b015750806004015442115b15611b1f5760405163caa1497160e01b815260040160405180910390fd5b80546001600160a01b031660009081526004602052604090206002810154831115611b5d5760405163b35f6c3760e01b815260040160405180910390fd5b82816002016000828254611b7191906133a2565b90915550508054611b919061010090046001600160a01b0316858561208b565b815481546040517f6619f0dd4f318c9c029f8dc03a5333640d21c55b5c58590578f115400941769892611be1928a928a926001600160a01b03908116928b92610100909104909116908a9061356b565b60405180910390a1505061128260018055565b611bfc611f5d565b6000600584604051611c0e9190613311565b90815260405190819003602001902090506001600882015460ff166002811115611c3a57611c3a612fc4565b141580611c4b575080600401544210155b15611c695760405163caa1497160e01b815260040160405180910390fd5b80546001600160a01b03163314611c9357604051632fc7075d60e11b815260040160405180910390fd5b8181600601541015611cb85760405163b35f6c3760e01b815260040160405180910390fd5b81816006016000828254611ccc91906133a2565b90915550506002810154611cea906001600160a01b0316848461208b565b600181015460028201546040517f9be6dbcaf4b06f543edce6f4d3f6652632b061bff8d611ca4c15fc19f982d05992611d3992899289926001600160a01b03908116928a92911690899061356b565b60405180910390a15061128260018055565b611d53611f30565b6001600160a01b038116611d7d57604051631e4fbdf760e01b815260006004820152602401610698565b610b678161209f565b611d8e611f5d565b611d9783612175565b604080513360208201526001600160a01b038716918101919091526060810185905260808101849052611de49060a0016040516020818303038152906040528051906020012083836121ca565b3360009081526004602052604090205460ff1615611e445760405162461bcd60e51b815260206004820152601860248201527f4475706c69636174652061757468656e7469636174696f6e00000000000000006044820152606401610698565b611e4e8585612074565b611e57856120ef565b3360008181526004602052604090819020805460016001600160a81b03199091166101006001600160a01b038b160217811782558101879055600201869055517f031d04f6a40e144a113c642f1005ad66a38fae6b723e0b4e055169e727b1979391611ec691889088906133b5565b60405180910390a161052c60018055565b611edf611f30565b6001600160a01b038116600081815260076020908152604091829020805460ff1916905590519182527fd96f2ee6fc90ccdacdc133ce2a13d876eae3a1d62033c54b39687920f85b1159910161039c565b6000546001600160a01b03163314610ff95760405163118cdaa760e01b8152336004820152602401610698565b600260015403611f8057604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b804211611fcf5760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964207369672074696d657374616d702160501b6044820152606401610698565b62015180611fdd82426133a2565b1115610b675760405162461bcd60e51b81526020600482015260156024820152745369672074696d657374616d70206578706972652160581b6044820152606401610698565b6004600061203a6120348685612215565b85612263565b6001600160a01b0316815260208101919091526040016000205460ff166107da576040516369790f8760e11b815260040160405180910390fd5b6120876001600160a01b0383168261228d565b5050565b6107da6001600160a01b03841683836123f2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811660009081526003602052604090205460ff16610b67576001600160a01b03166000818152600360205260408120805460ff191660019081179091556002805491820181559091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319169091179055565b8042116121bd5760405162461bcd60e51b8152602060048201526016602482015275496e76616c6964207369672074696d657374616d702160501b6044820152606401610698565b610e10611fdd82426133a2565b600760006121db6120348685612215565b6001600160a01b0316815260208101919091526040016000205460ff166107da57604051638f4450b560e01b815260040160405180910390fd5b60008161222a5761222583612838565b61225a565b7f1954524f4e205369676e6564204d6573736167653a0a333200000000000000006000908152601c849052603c90205b90505b92915050565b600080600080612273868661286c565b92509250925061228382826128b9565b5090949350505050565b6001600160a01b0382166122e057803410156120875760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742076616c756560701b6044820152606401610698565b600081116123215760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610698565b604051636eb1769f60e11b81523360048201523060248201526000906001600160a01b0384169063dd62ed3e90604401602060405180830381865afa15801561236e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239291906135c0565b9050818110156123dd5760405162461bcd60e51b8152602060048201526016602482015275496e73756666696369656e7420616c6c6f77616e636560501b6044820152606401610698565b6107da6001600160a01b038416333085612972565b6001600160a01b03821661243c5760405162461bcd60e51b8152602060048201526011602482015270125b9d985b1a59081c9958da5c1a595b9d607a1b6044820152606401610698565b6001600160a01b0383166124a0578047101561248d5760405162461bcd60e51b815260206004820152601060248201526f092dce6eaccccd2c6d2cadce8408aa8960831b6044820152606401610698565b6107da6001600160a01b038316826129cc565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156124e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250b91906135c0565b9050818110156125545760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610698565b6040516370a0823160e01b81526001600160a01b038481166004830152600091908616906370a0823190602401602060405180830381865afa15801561259e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c291906135c0565b6040516001600160a01b0386811660248301526044820186905291925060009187169060640160408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b1790525161261d9190613311565b6000604051808303816000865af19150503d806000811461265a576040519150601f19603f3d011682016040523d82523d6000602084013e61265f565b606091505b50509050806126b05760405162461bcd60e51b815260206004820181905260248201527f455243323020746f6b656e207472616e736665722063616c6c206661696c65646044820152606401610698565b6126ba8483613343565b6040516370a0823160e01b81526001600160a01b0387811660048301528816906370a0823190602401602060405180830381865afa158015612700573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061272491906135c0565b146127715760405162461bcd60e51b815260206004820152601e60248201527f455243323020746f6b656e207472616e7366657220746f206661696c656400006044820152606401610698565b61277b84846133a2565b6040516370a0823160e01b81523060048201526001600160a01b038816906370a0823190602401602060405180830381865afa1580156127bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127e391906135c0565b146128305760405162461bcd60e51b815260206004820181905260248201527f455243323020746f6b656e207472616e736665722066726f6d206661696c65646044820152606401610698565b505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c829052603c812061225d565b600080600083516041036128a65760208401516040850151606086015160001a61289888828585612a63565b9550955095505050506128b2565b50508151600091506002905b9250925092565b60008260038111156128cd576128cd612fc4565b036128d6575050565b60018260038111156128ea576128ea612fc4565b036129085760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561291c5761291c612fc4565b0361293d5760405163fce698f760e01b815260048101829052602401610698565b600382600381111561295157612951612fc4565b03612087576040516335e2f38360e21b815260048101829052602401610698565b61128284856001600160a01b03166323b872dd86868660405160240161299a939291906133b5565b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050612b32565b804710156129ef5760405163cd78605960e01b8152306004820152602401610698565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612a3c576040519150601f19603f3d011682016040523d82523d6000602084013e612a41565b606091505b50509050806107da57604051630a12f52160e11b815260040160405180910390fd5b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115612a9e5750600091506003905082612b28565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015612af2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612b1e57506000925060019150829050612b28565b9250600091508190505b9450945094915050565b6000612b476001600160a01b03841683612b95565b90508051600014158015612b6c575080806020019051810190612b6a91906135d9565b155b156107da57604051635274afe760e01b81526001600160a01b0384166004820152602401610698565b606061225a8383600084600080856001600160a01b03168486604051612bbb9190613311565b60006040518083038185875af1925050503d8060008114612bf8576040519150601f19603f3d011682016040523d82523d6000602084013e612bfd565b606091505b5091509150612c0d868383612c19565b925050505b9392505050565b606082612c2e57612c2982612c75565b612c12565b8151158015612c4557506001600160a01b0384163b155b15612c6e57604051639996b31560e01b81526001600160a01b0385166004820152602401610698565b5080612c12565b805115612c855780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b0381168114612cb557600080fd5b919050565b600060208284031215612ccc57600080fd5b61225a82612c9e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612d1457612d14612cd5565b604052919050565b600082601f830112612d2d57600080fd5b813567ffffffffffffffff811115612d4757612d47612cd5565b612d5a601f8201601f1916602001612ceb565b818152846020838601011115612d6f57600080fd5b816020850160208301376000918101602001919091529392505050565b8015158114610b6757600080fd5b600080600080600060a08688031215612db257600080fd5b853567ffffffffffffffff80821115612dca57600080fd5b612dd689838a01612d1c565b965060208801359550604088013594506060880135915080821115612dfa57600080fd5b50612e0788828901612d1c565b9250506080860135612e1881612d8c565b809150509295509295909350565b600067ffffffffffffffff821115612e4057612e40612cd5565b5060051b60200190565b600082601f830112612e5b57600080fd5b81356020612e70612e6b83612e26565b612ceb565b82815260059290921b84018101918181019086841115612e8f57600080fd5b8286015b84811015612eaa5780358352918301918301612e93565b509695505050505050565b600080600060608486031215612eca57600080fd5b612ed384612c9e565b925060208085013567ffffffffffffffff80821115612ef157600080fd5b818701915087601f830112612f0557600080fd5b8135612f13612e6b82612e26565b81815260059190911b8301840190848101908a831115612f3257600080fd5b938501935b82851015612f5757612f4885612c9e565b82529385019390850190612f37565b965050506040870135925080831115612f6f57600080fd5b5050612f7d86828701612e4a565b9150509250925092565b600060208284031215612f9957600080fd5b813567ffffffffffffffff811115612fb057600080fd5b612fbc84828501612d1c565b949350505050565b634e487b7160e01b600052602160045260246000fd5b89815260208101899052604081018890526001600160a01b0387811660608301528681166080830152851660a082015260c0810184905260e0810183905261012081016003831061302d5761302d612fc4565b826101008301529a9950505050505050505050565b602080825282518282018190526000919060409081850190868401855b8281101561308d57815180516001600160a01b0316855286015186850152928401929085019060010161305f565b5091979650505050505050565b600080600080608085870312156130b057600080fd5b843567ffffffffffffffff808211156130c857600080fd5b6130d488838901612d1c565b95506020870135945060408701359150808211156130f157600080fd5b506130fe87828801612d1c565b925050606085013561310f81612d8c565b939692955090935050565b6000806000806000610160868803121561313357600080fd5b853567ffffffffffffffff8082111561314b57600080fd5b61315789838a01612d1c565b96506060880191508882111561316c57600080fd5b60208801955061012088018981111561318457600080fd5b9194509035908082111561319757600080fd5b506131a488828901612d1c565b925050610140860135612e1881612d8c565b600080600080608085870312156131cc57600080fd5b843567ffffffffffffffff808211156131e457600080fd5b6131f088838901612d1c565b9550602087013591508082111561320657600080fd5b5061321387828801612d1c565b93505061322260408601612c9e565b9396929550929360600135925050565b600080600080600060a0868803121561324a57600080fd5b61325386612c9e565b94506020860135935060408601359250606086013567ffffffffffffffff81111561327d57600080fd5b612e0788828901612d1c565b60005b838110156132a457818101518382015260200161328c565b50506000910152565b600081518084526132c5816020860160208601613289565b601f01601f19169290920160200192915050565b6080815260006132ec60808301876132ad565b6001600160a01b03959095166020830152506040810192909252606090910152919050565b60008251613323818460208701613289565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561225d5761225d61332d565b60808152600061336960808301876132ad565b6001600160a01b0395861660208401529390941660408201526060015292915050565b634e487b7160e01b600052603260045260246000fd5b8181038181111561225d5761225d61332d565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6000600182016133eb576133eb61332d565b5060010190565b60608152600061340560608301866132ad565b6001600160a01b039490941660208301525060400152919050565b808202811582820484141761225d5761225d61332d565b634e487b7160e01b600052601260045260246000fd5b60008261345c5761345c613437565b500490565b60808152600061347460808301876132ad565b6001600160a01b03861660208401526040830185905290506002831061349c5761349c612fc4565b82606083015295945050505050565b60c0815260006134be60c08301896132ad565b6001600160a01b0397881660208401529590961660408201526060810193909352608083019190915260a09091015292915050565b60006101408083526135078184018e6132ad565b6001600160a01b039c8d1660208501529a8c1660408401525050969098166060870152608086019490945260a085019290925260c084015260e08301526101008201526101200191909152919050565b60008261356657613566613437565b500690565b60c08152600061357e60c08301896132ad565b828103602084015261359081896132ad565b6001600160a01b0397881660408501529587166060840152505091909316608082015260a0019190915292915050565b6000602082840312156135d257600080fd5b5051919050565b6000602082840312156135eb57600080fd5b8151612c1281612d8c56fea2646970667358221220c7e31b5e598e6f8a84287bb24ae6d302661df2379e55cedb1594e093cd90fd8d64736f6c63430008140033
Loading...
Loading
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.