Address Details
contract
0xe5AE6c3Fd6484069008879eB1eeBd88039aCCE32
- Contract Name
- ChainspotProxy
- Creator
- 0x4c33c1–21263d at 0xaf1cad–de96ae
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 1 Transactions
- Transfers
- 0 Transfers
- Gas Used
- 45,438
- Last Balance Update
- 18585936
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- ChainspotProxy
- Optimization enabled
- true
- Compiler version
- v0.8.17+commit.8df45f5f
- Optimization runs
- 1000
- EVM Version
- london
- Verified at
- 2023-05-19T18:37:28.051642Z
contracts/ChainspotProxy.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./ProxyWithdrawal.sol"; import "./ProxyFee.sol"; /// Chainspot proxy contract contract ChainspotProxy is Ownable, ReentrancyGuard, ProxyWithdrawal, ProxyFee { using Address for address; using SafeERC20 for IERC20; using SafeMath for uint; struct Client { bool exists; } mapping(address => Client) public clients; /// Constructor /// @param _feeBase uint Fee base param /// @param _feeMul uint Fee multiply param constructor(uint _feeBase, uint _feeMul) { setFeeParams(_feeBase, _feeMul); } /// Just for tests receive() external payable {} /// Add trusted client (only for owner) /// @param _clientAddress address Client address function addClient(address _clientAddress) public onlyOwner { require(_clientAddress.isContract(), "ChainspotProxy: address is non-contract"); clients[_clientAddress].exists = true; } /// Add multiple trusted clients (only for owner) /// @param _clientAddresses address[] Client addresses list function addClients(address[] calldata _clientAddresses) public onlyOwner { for (uint i = 0; i < _clientAddresses.length; i++) { addClient(_clientAddresses[i]); } } /// Remove trusted client (only for owner) /// @param _clientAddress address Client address function removeClient(address _clientAddress) public onlyOwner { delete clients[_clientAddress]; } /// Meta proxy - transfer transaction initiation /// @param _token IERC20 Token address (address(0) - native coins) /// @param _approveTo address Approve to address /// @param _callDataTo address Calldata address /// @param _data bytes Calldata function metaProxy(IERC20 _token, address _approveTo, address _callDataTo, bytes calldata _data) external payable nonReentrant { require(clients[_callDataTo].exists, "ChainspotProxy: wrong client address"); if (address(_token) == address(0)) { proxyCoins(_callDataTo, _data); } else { proxyTokens(_token, _approveTo, _callDataTo, _data); } } /// Proxy coins /// @param _to address Calldata address /// @param _data bytes Calldata function proxyCoins(address _to, bytes calldata _data) internal { uint amount = msg.value; require(amount > 0, "ChainspotProxy: amount is too small"); uint feeAmount = calcFee(amount); if (feeAmount > 0) { (bool successFee, ) = owner().call{value: feeAmount}(""); require(successFee, "ChainspotProxy: fee not sent"); } uint routerAmount = amount.sub(feeAmount); require(routerAmount > 0, "ChainspotProxy: routerAmount is too small"); (bool success, ) = _to.call{value: routerAmount}(_data); require(success, "ChainspotProxy: transfer not sent"); } /// Proxy tokens /// @param _token IERC20 Token address /// @param _approveTo address Approve to address /// @param _callDataTo address Calldata address /// @param _data bytes Calldata function proxyTokens(IERC20 _token, address _approveTo, address _callDataTo, bytes calldata _data) internal { if (msg.value > 0) { (bool successTV, ) = msg.sender.call{value: msg.value}(""); require(successTV, "ChainspotProxy: accidentally value not sent"); } address selfAddress = address(this); address fromAddress = msg.sender; uint amount = _token.allowance(fromAddress, selfAddress); require(amount > 0, "ChainspotProxy: amount is too small"); uint feeAmount = calcFee(amount); if (feeAmount > 0) { require(_token.transferFrom(fromAddress, owner(), feeAmount), "ChainspotProxy: fee transfer request failed"); } uint routerAmount = amount.sub(feeAmount); require(routerAmount > 0, "ChainspotProxy: routerAmount is too small"); require(_token.transferFrom(fromAddress, selfAddress, routerAmount), "ChainspotProxy: transferFrom request failed"); require(_token.approve(_approveTo, routerAmount), "ChainspotProxy: approve request failed"); (bool success, ) = _callDataTo.call(_data); require(success, "ChainspotProxy: call data request failed"); if (_token.allowance(selfAddress, _approveTo) > 0) { require(_token.approve(_approveTo, 0), "ChainspotProxy: refert approve request failed"); } } }
/_openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
/_openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _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 require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // 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; } }
/_openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
/_openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
/_openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
/_openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
/_openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
/_openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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. * * _Available since v3.4._ */ 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 addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
/contracts/ProxyFee.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; abstract contract ProxyFee is Ownable { using SafeMath for uint; uint public feeBase; uint public feeMul; // example: feeBase + feeSum = 1001 or 100.1% uint public maxFeePercent = 10; // Maximum but not current fee, just for validation /// Update fee params event /// @param _feeBase uint Base fee amount /// @param _feeMul uint Multiply fee amount event UpdateFeeParams(uint _feeBase, uint _feeMul); /// Set system fee (only for owner) /// @param _feeBase uint Base fee /// @param _feeMul uint Multiply fee function setFeeParams(uint _feeBase, uint _feeMul) public onlyOwner { require(_feeBase > 0, "Fee: _feeBase must be valid"); require(_feeMul > 0, "Fee: _feeMul must be valid"); uint validationAmount = 1000; require( validationAmount.mul(maxFeePercent).div(100) >= calcFeeWithParams(validationAmount, _feeBase, _feeMul), "Fee: fee must be less than maximum" ); feeBase = _feeBase; feeMul = _feeMul; emit UpdateFeeParams(_feeBase, _feeMul); } /// Calculate fee by amount /// @param _amount uint Amount /// @return uint Calculated fee function calcFee(uint _amount) internal view returns(uint) { return calcFeeWithParams(_amount, feeBase, feeMul); } /// Calculate fee with params /// @param _amount uint Amount /// @param _feeBase uint Base fee /// @param _feeMul uint Multiply fee /// @return uint Calculated fee function calcFeeWithParams(uint _amount, uint _feeBase, uint _feeMul) internal pure returns(uint) { return _amount.mul(_feeMul).div(_feeBase.add(_feeMul)); } }
/contracts/ProxyWithdrawal.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; abstract contract ProxyWithdrawal is Ownable { using Address for address; /// Transfer event /// @param _to address Destination address /// @param _amount uint Transfer amount /// @param _tokenAddress address Transfer token address (address(0) - native coins) event TransferEvent(address _to, uint _amount, address _tokenAddress); /// Return coni balance /// @return uint function getBalance() public view returns(uint) { return address(this).balance; } /// Return token balance /// @return uint function getTokenBalance(IERC20 _token) public view returns(uint) { return _token.balanceOf(address(this)); } /// Transfer coins (only for owner) /// @param _to address Destination address /// @param _amount uint Transfer amount function transferCoins(address _to, uint _amount) external onlyOwner { require(!_to.isContract(), "Withdrawal: target address is contract"); require(getBalance() >= _amount, "Withdrawal: balance not enough"); (bool successFee, ) = _to.call{value: _amount}(""); require(successFee, "Withdrawal: transfer failed"); emit TransferEvent(_to, _amount, address(0)); } /// Transfer tokens (only for owner) /// @param _token IERC20 Token address /// @param _to address Destination address /// @param _amount uint Transfer amount function transferTokens(IERC20 _token, address _to, uint _amount) external onlyOwner { require(getTokenBalance(_token) >= _amount, "Withdrawal: not enough tokens"); require(_token.transfer(_to, _amount), "Withdrawal: transfer request failed"); emit TransferEvent(_to, _amount, address(_token)); } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"uint256","name":"_feeBase","internalType":"uint256"},{"type":"uint256","name":"_feeMul","internalType":"uint256"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TransferEvent","inputs":[{"type":"address","name":"_to","internalType":"address","indexed":false},{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false},{"type":"address","name":"_tokenAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateFeeParams","inputs":[{"type":"uint256","name":"_feeBase","internalType":"uint256","indexed":false},{"type":"uint256","name":"_feeMul","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addClient","inputs":[{"type":"address","name":"_clientAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addClients","inputs":[{"type":"address[]","name":"_clientAddresses","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"exists","internalType":"bool"}],"name":"clients","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeBase","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeMul","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBalance","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTokenBalance","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maxFeePercent","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"metaProxy","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"},{"type":"address","name":"_approveTo","internalType":"address"},{"type":"address","name":"_callDataTo","internalType":"address"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeClient","inputs":[{"type":"address","name":"_clientAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeParams","inputs":[{"type":"uint256","name":"_feeBase","internalType":"uint256"},{"type":"uint256","name":"_feeMul","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferCoins","inputs":[{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferTokens","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"},{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x6080604052600a6004553480156200001657600080fd5b5060405162001d0c38038062001d0c83398101604081905262000039916200031a565b62000044336200005c565b60018055620000548282620000ac565b5050620003a8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620000b662000247565b600082116200010c5760405162461bcd60e51b815260206004820152601b60248201527f4665653a205f66656542617365206d7573742062652076616c6964000000000060448201526064015b60405180910390fd5b600081116200015e5760405162461bcd60e51b815260206004820152601a60248201527f4665653a205f6665654d756c206d7573742062652076616c6964000000000000604482015260640162000103565b6103e86200016e818484620002a5565b620001a460646200019060045485620002e760201b62000b211790919060201c565b620002fe60201b62000b341790919060201c565b1015620001ff5760405162461bcd60e51b815260206004820152602260248201527f4665653a20666565206d757374206265206c657373207468616e206d6178696d604482015261756d60f01b606482015260840162000103565b6002839055600382905560408051848152602081018490527f72aceb7acc9f4d0182ba135b119cc820114f0e1a1ba6ea5197b5274e63193c73910160405180910390a1505050565b6000546001600160a01b03163314620002a35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000103565b565b6000620002df620002c583856200030c60201b62000b401790919060201c565b620001908487620002e760201b62000b211790919060201c565b949350505050565b6000620002f5828462000355565b90505b92915050565b6000620002f582846200036f565b6000620002f5828462000392565b600080604083850312156200032e57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417620002f857620002f86200033f565b6000826200038d57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115620002f857620002f86200033f565b61195480620003b86000396000f3fe6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063a64b6e5f11610059578063a64b6e5f14610283578063d830a05b146102a3578063f17059d8146102b9578063f2fde38b146102d957600080fd5b80638da5cb5b146102055780639089f6161461022d57806395e911a81461024d5780639d2ec1881461026357600080fd5b8063517d50bc116100c6578063517d50bc1461018757806353e1a7a01461019a57806361eed2a9146101b0578063715018a6146101f057600080fd5b806312065fe0146101035780632dba5cfa146101255780633aecd0e31461014757806343928cfd1461016757600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b50475b6040519081526020015b60405180910390f35b34801561013157600080fd5b50610145610140366004611666565b6102f9565b005b34801561015357600080fd5b50610112610162366004611692565b6104ca565b34801561017357600080fd5b50610145610182366004611692565b610554565b6101456101953660046116af565b6105fd565b3480156101a657600080fd5b5061011260035481565b3480156101bc57600080fd5b506101e06101cb366004611692565b60056020526000908152604090205460ff1681565b604051901515815260200161011c565b3480156101fc57600080fd5b506101456106cd565b34801561021157600080fd5b506000546040516001600160a01b03909116815260200161011c565b34801561023957600080fd5b50610145610248366004611692565b6106e1565b34801561025957600080fd5b5061011260025481565b34801561026f57600080fd5b5061014561027e366004611757565b61070a565b34801561028f57600080fd5b5061014561029e366004611779565b610894565b3480156102af57600080fd5b5061011260045481565b3480156102c557600080fd5b506101456102d43660046117ba565b610a3d565b3480156102e557600080fd5b506101456102f4366004611692565b610a91565b610301610b4c565b6001600160a01b0382163b156103845760405162461bcd60e51b815260206004820152602660248201527f5769746864726177616c3a20746172676574206164647265737320697320636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b804710156103d45760405162461bcd60e51b815260206004820152601e60248201527f5769746864726177616c3a2062616c616e6365206e6f7420656e6f7567680000604482015260640161037b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610421576040519150601f19603f3d011682016040523d82523d6000602084013e610426565b606091505b50509050806104775760405162461bcd60e51b815260206004820152601b60248201527f5769746864726177616c3a207472616e73666572206661696c65640000000000604482015260640161037b565b604080516001600160a01b0385168152602081018490526000918101919091527f4420906a06ee6f58d494695203e8076d66fe934bad627b133b2452f55ddff9cb906060015b60405180910390a1505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561052a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054e919061182f565b92915050565b61055c610b4c565b6001600160a01b0381163b6105d95760405162461bcd60e51b815260206004820152602760248201527f436861696e73706f7450726f78793a2061646472657373206973206e6f6e2d6360448201527f6f6e747261637400000000000000000000000000000000000000000000000000606482015260840161037b565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b610605610ba6565b6001600160a01b03831660009081526005602052604090205460ff166106925760405162461bcd60e51b8152602060048201526024808201527f436861696e73706f7450726f78793a2077726f6e6720636c69656e742061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161037b565b6001600160a01b0385166106b0576106ab838383610bff565b6106bd565b6106bd8585858585610e60565b6106c660018055565b5050505050565b6106d5610b4c565b6106df60006115ab565b565b6106e9610b4c565b6001600160a01b03166000908152600560205260409020805460ff19169055565b610712610b4c565b600082116107625760405162461bcd60e51b815260206004820152601b60248201527f4665653a205f66656542617365206d7573742062652076616c69640000000000604482015260640161037b565b600081116107b25760405162461bcd60e51b815260206004820152601a60248201527f4665653a205f6665654d756c206d7573742062652076616c6964000000000000604482015260640161037b565b6103e86107c0818484611613565b6107e060646107da60045485610b2190919063ffffffff16565b90610b34565b10156108545760405162461bcd60e51b815260206004820152602260248201527f4665653a20666565206d757374206265206c657373207468616e206d6178696d60448201527f756d000000000000000000000000000000000000000000000000000000000000606482015260840161037b565b6002839055600382905560408051848152602081018490527f72aceb7acc9f4d0182ba135b119cc820114f0e1a1ba6ea5197b5274e63193c7391016104bd565b61089c610b4c565b806108a6846104ca565b10156108f45760405162461bcd60e51b815260206004820152601d60248201527f5769746864726177616c3a206e6f7420656e6f75676820746f6b656e73000000604482015260640161037b565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561095c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109809190611848565b6109f25760405162461bcd60e51b815260206004820152602360248201527f5769746864726177616c3a207472616e7366657220726571756573742066616960448201527f6c65640000000000000000000000000000000000000000000000000000000000606482015260840161037b565b604080516001600160a01b038085168252602082018490528516918101919091527f4420906a06ee6f58d494695203e8076d66fe934bad627b133b2452f55ddff9cb906060016104bd565b610a45610b4c565b60005b81811015610a8c57610a7a838383818110610a6557610a6561186a565b90506020020160208101906101829190611692565b80610a8481611896565b915050610a48565b505050565b610a99610b4c565b6001600160a01b038116610b155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161037b565b610b1e816115ab565b50565b6000610b2d82846118af565b9392505050565b6000610b2d82846118c6565b6000610b2d82846118e8565b6000546001600160a01b031633146106df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161037b565b600260015403610bf85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161037b565b6002600155565b3480610c595760405162461bcd60e51b815260206004820152602360248201527f436861696e73706f7450726f78793a20616d6f756e7420697320746f6f20736d604482015262185b1b60ea1b606482015260840161037b565b6000610c6482611634565b90508015610d1157600080546040516001600160a01b039091169083908381818185875af1925050503d8060008114610cb9576040519150601f19603f3d011682016040523d82523d6000602084013e610cbe565b606091505b5050905080610d0f5760405162461bcd60e51b815260206004820152601c60248201527f436861696e73706f7450726f78793a20666565206e6f742073656e7400000000604482015260640161037b565b505b6000610d1d8383611645565b905060008111610d815760405162461bcd60e51b815260206004820152602960248201527f436861696e73706f7450726f78793a20726f75746572416d6f756e74206973206044820152681d1bdbc81cdb585b1b60ba1b606482015260840161037b565b6000866001600160a01b0316828787604051610d9e9291906118fb565b60006040518083038185875af1925050503d8060008114610ddb576040519150601f19603f3d011682016040523d82523d6000602084013e610de0565b606091505b5050905080610e575760405162461bcd60e51b815260206004820152602160248201527f436861696e73706f7450726f78793a207472616e73666572206e6f742073656e60448201527f7400000000000000000000000000000000000000000000000000000000000000606482015260840161037b565b50505050505050565b3415610f2657604051600090339034908381818185875af1925050503d8060008114610ea8576040519150601f19603f3d011682016040523d82523d6000602084013e610ead565b606091505b5050905080610f245760405162461bcd60e51b815260206004820152602b60248201527f436861696e73706f7450726f78793a206163636964656e74616c6c792076616c60448201527f7565206e6f742073656e74000000000000000000000000000000000000000000606482015260840161037b565b505b604051636eb1769f60e11b815233600482018190523060248301819052916000906001600160a01b0389169063dd62ed3e90604401602060405180830381865afa158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c919061182f565b905060008111610ffa5760405162461bcd60e51b815260206004820152602360248201527f436861696e73706f7450726f78793a20616d6f756e7420697320746f6f20736d604482015262185b1b60ea1b606482015260840161037b565b600061100582611634565b9050801561111f57886001600160a01b03166323b872dd8461102f6000546001600160a01b031690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b03928316600482015291166024820152604481018490526064016020604051808303816000875af115801561109b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bf9190611848565b61111f5760405162461bcd60e51b815260206004820152602b60248201527f436861696e73706f7450726f78793a20666565207472616e736665722072657160448201526a1d595cdd0819985a5b195960aa1b606482015260840161037b565b600061112b8383611645565b90506000811161118f5760405162461bcd60e51b815260206004820152602960248201527f436861696e73706f7450726f78793a20726f75746572416d6f756e74206973206044820152681d1bdbc81cdb585b1b60ba1b606482015260840161037b565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528681166024830152604482018390528b16906323b872dd906064016020604051808303816000875af11580156111ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112239190611848565b6112835760405162461bcd60e51b815260206004820152602b60248201527f436861696e73706f7450726f78793a207472616e7366657246726f6d2072657160448201526a1d595cdd0819985a5b195960aa1b606482015260840161037b565b60405163095ea7b360e01b81526001600160a01b038a81166004830152602482018390528b169063095ea7b3906044016020604051808303816000875af11580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f69190611848565b6113685760405162461bcd60e51b815260206004820152602660248201527f436861696e73706f7450726f78793a20617070726f766520726571756573742060448201527f6661696c65640000000000000000000000000000000000000000000000000000606482015260840161037b565b6000886001600160a01b031688886040516113849291906118fb565b6000604051808303816000865af19150503d80600081146113c1576040519150601f19603f3d011682016040523d82523d6000602084013e6113c6565b606091505b505090508061143d5760405162461bcd60e51b815260206004820152602860248201527f436861696e73706f7450726f78793a2063616c6c20646174612072657175657360448201527f74206661696c6564000000000000000000000000000000000000000000000000606482015260840161037b565b604051636eb1769f60e11b81526001600160a01b0387811660048301528b81166024830152600091908d169063dd62ed3e90604401602060405180830381865afa15801561148f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b3919061182f565b111561159e5760405163095ea7b360e01b81526001600160a01b038b81166004830152600060248301528c169063095ea7b3906044016020604051808303816000875af1158015611508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152c9190611848565b61159e5760405162461bcd60e51b815260206004820152602d60248201527f436861696e73706f7450726f78793a2072656665727420617070726f7665207260448201527f657175657374206661696c656400000000000000000000000000000000000000606482015260840161037b565b5050505050505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061162c6116228484610b40565b6107da8685610b21565b949350505050565b600061054e82600254600354611613565b6000610b2d828461190b565b6001600160a01b0381168114610b1e57600080fd5b6000806040838503121561167957600080fd5b823561168481611651565b946020939093013593505050565b6000602082840312156116a457600080fd5b8135610b2d81611651565b6000806000806000608086880312156116c757600080fd5b85356116d281611651565b945060208601356116e281611651565b935060408601356116f281611651565b9250606086013567ffffffffffffffff8082111561170f57600080fd5b818801915088601f83011261172357600080fd5b81358181111561173257600080fd5b89602082850101111561174457600080fd5b9699959850939650602001949392505050565b6000806040838503121561176a57600080fd5b50508035926020909101359150565b60008060006060848603121561178e57600080fd5b833561179981611651565b925060208401356117a981611651565b929592945050506040919091013590565b600080602083850312156117cd57600080fd5b823567ffffffffffffffff808211156117e557600080fd5b818501915085601f8301126117f957600080fd5b81358181111561180857600080fd5b8660208260051b850101111561181d57600080fd5b60209290920196919550909350505050565b60006020828403121561184157600080fd5b5051919050565b60006020828403121561185a57600080fd5b81518015158114610b2d57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016118a8576118a8611880565b5060010190565b808202811582820484141761054e5761054e611880565b6000826118e357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561054e5761054e611880565b8183823760009101908152919050565b8181038181111561054e5761054e61188056fea2646970667358221220e098700d193f11efeda59a855ba1ac30e17f83a58ac1df46339a1b41f56de41364736f6c6343000811003300000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000001
Deployed ByteCode
0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063a64b6e5f11610059578063a64b6e5f14610283578063d830a05b146102a3578063f17059d8146102b9578063f2fde38b146102d957600080fd5b80638da5cb5b146102055780639089f6161461022d57806395e911a81461024d5780639d2ec1881461026357600080fd5b8063517d50bc116100c6578063517d50bc1461018757806353e1a7a01461019a57806361eed2a9146101b0578063715018a6146101f057600080fd5b806312065fe0146101035780632dba5cfa146101255780633aecd0e31461014757806343928cfd1461016757600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b50475b6040519081526020015b60405180910390f35b34801561013157600080fd5b50610145610140366004611666565b6102f9565b005b34801561015357600080fd5b50610112610162366004611692565b6104ca565b34801561017357600080fd5b50610145610182366004611692565b610554565b6101456101953660046116af565b6105fd565b3480156101a657600080fd5b5061011260035481565b3480156101bc57600080fd5b506101e06101cb366004611692565b60056020526000908152604090205460ff1681565b604051901515815260200161011c565b3480156101fc57600080fd5b506101456106cd565b34801561021157600080fd5b506000546040516001600160a01b03909116815260200161011c565b34801561023957600080fd5b50610145610248366004611692565b6106e1565b34801561025957600080fd5b5061011260025481565b34801561026f57600080fd5b5061014561027e366004611757565b61070a565b34801561028f57600080fd5b5061014561029e366004611779565b610894565b3480156102af57600080fd5b5061011260045481565b3480156102c557600080fd5b506101456102d43660046117ba565b610a3d565b3480156102e557600080fd5b506101456102f4366004611692565b610a91565b610301610b4c565b6001600160a01b0382163b156103845760405162461bcd60e51b815260206004820152602660248201527f5769746864726177616c3a20746172676574206164647265737320697320636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b804710156103d45760405162461bcd60e51b815260206004820152601e60248201527f5769746864726177616c3a2062616c616e6365206e6f7420656e6f7567680000604482015260640161037b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610421576040519150601f19603f3d011682016040523d82523d6000602084013e610426565b606091505b50509050806104775760405162461bcd60e51b815260206004820152601b60248201527f5769746864726177616c3a207472616e73666572206661696c65640000000000604482015260640161037b565b604080516001600160a01b0385168152602081018490526000918101919091527f4420906a06ee6f58d494695203e8076d66fe934bad627b133b2452f55ddff9cb906060015b60405180910390a1505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561052a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054e919061182f565b92915050565b61055c610b4c565b6001600160a01b0381163b6105d95760405162461bcd60e51b815260206004820152602760248201527f436861696e73706f7450726f78793a2061646472657373206973206e6f6e2d6360448201527f6f6e747261637400000000000000000000000000000000000000000000000000606482015260840161037b565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b610605610ba6565b6001600160a01b03831660009081526005602052604090205460ff166106925760405162461bcd60e51b8152602060048201526024808201527f436861696e73706f7450726f78793a2077726f6e6720636c69656e742061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161037b565b6001600160a01b0385166106b0576106ab838383610bff565b6106bd565b6106bd8585858585610e60565b6106c660018055565b5050505050565b6106d5610b4c565b6106df60006115ab565b565b6106e9610b4c565b6001600160a01b03166000908152600560205260409020805460ff19169055565b610712610b4c565b600082116107625760405162461bcd60e51b815260206004820152601b60248201527f4665653a205f66656542617365206d7573742062652076616c69640000000000604482015260640161037b565b600081116107b25760405162461bcd60e51b815260206004820152601a60248201527f4665653a205f6665654d756c206d7573742062652076616c6964000000000000604482015260640161037b565b6103e86107c0818484611613565b6107e060646107da60045485610b2190919063ffffffff16565b90610b34565b10156108545760405162461bcd60e51b815260206004820152602260248201527f4665653a20666565206d757374206265206c657373207468616e206d6178696d60448201527f756d000000000000000000000000000000000000000000000000000000000000606482015260840161037b565b6002839055600382905560408051848152602081018490527f72aceb7acc9f4d0182ba135b119cc820114f0e1a1ba6ea5197b5274e63193c7391016104bd565b61089c610b4c565b806108a6846104ca565b10156108f45760405162461bcd60e51b815260206004820152601d60248201527f5769746864726177616c3a206e6f7420656e6f75676820746f6b656e73000000604482015260640161037b565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561095c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109809190611848565b6109f25760405162461bcd60e51b815260206004820152602360248201527f5769746864726177616c3a207472616e7366657220726571756573742066616960448201527f6c65640000000000000000000000000000000000000000000000000000000000606482015260840161037b565b604080516001600160a01b038085168252602082018490528516918101919091527f4420906a06ee6f58d494695203e8076d66fe934bad627b133b2452f55ddff9cb906060016104bd565b610a45610b4c565b60005b81811015610a8c57610a7a838383818110610a6557610a6561186a565b90506020020160208101906101829190611692565b80610a8481611896565b915050610a48565b505050565b610a99610b4c565b6001600160a01b038116610b155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161037b565b610b1e816115ab565b50565b6000610b2d82846118af565b9392505050565b6000610b2d82846118c6565b6000610b2d82846118e8565b6000546001600160a01b031633146106df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161037b565b600260015403610bf85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161037b565b6002600155565b3480610c595760405162461bcd60e51b815260206004820152602360248201527f436861696e73706f7450726f78793a20616d6f756e7420697320746f6f20736d604482015262185b1b60ea1b606482015260840161037b565b6000610c6482611634565b90508015610d1157600080546040516001600160a01b039091169083908381818185875af1925050503d8060008114610cb9576040519150601f19603f3d011682016040523d82523d6000602084013e610cbe565b606091505b5050905080610d0f5760405162461bcd60e51b815260206004820152601c60248201527f436861696e73706f7450726f78793a20666565206e6f742073656e7400000000604482015260640161037b565b505b6000610d1d8383611645565b905060008111610d815760405162461bcd60e51b815260206004820152602960248201527f436861696e73706f7450726f78793a20726f75746572416d6f756e74206973206044820152681d1bdbc81cdb585b1b60ba1b606482015260840161037b565b6000866001600160a01b0316828787604051610d9e9291906118fb565b60006040518083038185875af1925050503d8060008114610ddb576040519150601f19603f3d011682016040523d82523d6000602084013e610de0565b606091505b5050905080610e575760405162461bcd60e51b815260206004820152602160248201527f436861696e73706f7450726f78793a207472616e73666572206e6f742073656e60448201527f7400000000000000000000000000000000000000000000000000000000000000606482015260840161037b565b50505050505050565b3415610f2657604051600090339034908381818185875af1925050503d8060008114610ea8576040519150601f19603f3d011682016040523d82523d6000602084013e610ead565b606091505b5050905080610f245760405162461bcd60e51b815260206004820152602b60248201527f436861696e73706f7450726f78793a206163636964656e74616c6c792076616c60448201527f7565206e6f742073656e74000000000000000000000000000000000000000000606482015260840161037b565b505b604051636eb1769f60e11b815233600482018190523060248301819052916000906001600160a01b0389169063dd62ed3e90604401602060405180830381865afa158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c919061182f565b905060008111610ffa5760405162461bcd60e51b815260206004820152602360248201527f436861696e73706f7450726f78793a20616d6f756e7420697320746f6f20736d604482015262185b1b60ea1b606482015260840161037b565b600061100582611634565b9050801561111f57886001600160a01b03166323b872dd8461102f6000546001600160a01b031690565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b03928316600482015291166024820152604481018490526064016020604051808303816000875af115801561109b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bf9190611848565b61111f5760405162461bcd60e51b815260206004820152602b60248201527f436861696e73706f7450726f78793a20666565207472616e736665722072657160448201526a1d595cdd0819985a5b195960aa1b606482015260840161037b565b600061112b8383611645565b90506000811161118f5760405162461bcd60e51b815260206004820152602960248201527f436861696e73706f7450726f78793a20726f75746572416d6f756e74206973206044820152681d1bdbc81cdb585b1b60ba1b606482015260840161037b565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528681166024830152604482018390528b16906323b872dd906064016020604051808303816000875af11580156111ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112239190611848565b6112835760405162461bcd60e51b815260206004820152602b60248201527f436861696e73706f7450726f78793a207472616e7366657246726f6d2072657160448201526a1d595cdd0819985a5b195960aa1b606482015260840161037b565b60405163095ea7b360e01b81526001600160a01b038a81166004830152602482018390528b169063095ea7b3906044016020604051808303816000875af11580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f69190611848565b6113685760405162461bcd60e51b815260206004820152602660248201527f436861696e73706f7450726f78793a20617070726f766520726571756573742060448201527f6661696c65640000000000000000000000000000000000000000000000000000606482015260840161037b565b6000886001600160a01b031688886040516113849291906118fb565b6000604051808303816000865af19150503d80600081146113c1576040519150601f19603f3d011682016040523d82523d6000602084013e6113c6565b606091505b505090508061143d5760405162461bcd60e51b815260206004820152602860248201527f436861696e73706f7450726f78793a2063616c6c20646174612072657175657360448201527f74206661696c6564000000000000000000000000000000000000000000000000606482015260840161037b565b604051636eb1769f60e11b81526001600160a01b0387811660048301528b81166024830152600091908d169063dd62ed3e90604401602060405180830381865afa15801561148f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b3919061182f565b111561159e5760405163095ea7b360e01b81526001600160a01b038b81166004830152600060248301528c169063095ea7b3906044016020604051808303816000875af1158015611508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152c9190611848565b61159e5760405162461bcd60e51b815260206004820152602d60248201527f436861696e73706f7450726f78793a2072656665727420617070726f7665207260448201527f657175657374206661696c656400000000000000000000000000000000000000606482015260840161037b565b5050505050505050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061162c6116228484610b40565b6107da8685610b21565b949350505050565b600061054e82600254600354611613565b6000610b2d828461190b565b6001600160a01b0381168114610b1e57600080fd5b6000806040838503121561167957600080fd5b823561168481611651565b946020939093013593505050565b6000602082840312156116a457600080fd5b8135610b2d81611651565b6000806000806000608086880312156116c757600080fd5b85356116d281611651565b945060208601356116e281611651565b935060408601356116f281611651565b9250606086013567ffffffffffffffff8082111561170f57600080fd5b818801915088601f83011261172357600080fd5b81358181111561173257600080fd5b89602082850101111561174457600080fd5b9699959850939650602001949392505050565b6000806040838503121561176a57600080fd5b50508035926020909101359150565b60008060006060848603121561178e57600080fd5b833561179981611651565b925060208401356117a981611651565b929592945050506040919091013590565b600080602083850312156117cd57600080fd5b823567ffffffffffffffff808211156117e557600080fd5b818501915085601f8301126117f957600080fd5b81358181111561180857600080fd5b8660208260051b850101111561181d57600080fd5b60209290920196919550909350505050565b60006020828403121561184157600080fd5b5051919050565b60006020828403121561185a57600080fd5b81518015158114610b2d57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016118a8576118a8611880565b5060010190565b808202811582820484141761054e5761054e611880565b6000826118e357634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561054e5761054e611880565b8183823760009101908152919050565b8181038181111561054e5761054e61188056fea2646970667358221220e098700d193f11efeda59a855ba1ac30e17f83a58ac1df46339a1b41f56de41364736f6c63430008110033