Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 19421982 | 241 days ago | IN | 0 ETH | 0.17720696 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
DavosBridge
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; pragma abicoder v2; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; import "../interfaces/IDavosBridge.sol"; import "../libraries/EthereumVerifier.sol"; import "../libraries/ProofParser.sol"; import "../libraries/Utils.sol"; contract DavosBridge is IDavosBridge, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { // --- Vars --- uint256 private _globalNonce; address private _consensusAddress; Metadata private _nativeTokenMetadata; mapping(bytes32 => bool) private _usedProofs; mapping(uint256 => address) private _bridgeAddressByChainId; mapping(bytes32 => address) private _warpDestinations; // KECCAK256(fromToken,fromChain,_bridgeAddressByChainId(toChain), toChain) => destinationToken uint256 public shortCapDuration; // [sec] mapping(address => uint256) public shortCaps; // Token => Cap per 'shortCapTime' mapping(address => mapping(uint256 => uint256)) public shortCapsDeposit; // Token => (EpochTime/shortCapDuration) => Current Deposits mapping(address => mapping(uint256 => uint256)) public shortCapsWithdraw; // Token => (EpochTime/shortCapDuration) => Current Withdraws uint256 public longCapDuration; // [sec] mapping(address => uint256) public longCaps; // Token => Cap per 'longCapTime' mapping(address => mapping(uint256 => uint256)) public longCapsDeposit; // Token => (EpochTime/longCapDuration) => Current Deposits mapping(address => mapping(uint256 => uint256)) public longCapsWithdraw; // Token => (EpochTime/longCapDuration) => Current Withdraws /// @custom:oz-upgrades-unsafe-allow constructor // --- Constructor --- constructor() { _disableInitializers(); } // --- Init --- function initialize(address consensusAddress, string memory nativeTokenSymbol, string memory nativeTokenName) external initializer { __Ownable_init(); __Pausable_init(); __ReentrancyGuard_init(); _consensusAddress = consensusAddress; _nativeTokenMetadata = Metadata( Utils.stringToBytes32(nativeTokenSymbol), Utils.stringToBytes32(nativeTokenName), block.chainid, address(bytes20(keccak256(abi.encodePacked("DavosBridge", nativeTokenSymbol)))) ); shortCapDuration = 1 hours; longCapDuration = 1 days; } // --- User --- function depositToken(address fromToken, uint256 toChain, address toAddress, uint256 amount) external override nonReentrant whenNotPaused { _updateDepositCaps(fromToken, amount); if (warpDestination(fromToken, toChain) != address(0)) { _depositWarped(fromToken, toChain, toAddress, amount); } else revert("DavosBridge/warp-destination-unknown"); } function _updateDepositCaps(address fromToken, uint256 amount) internal { require(shortCapsDeposit[fromToken][getCurrentStamp(shortCapDuration)] + amount <= shortCaps[fromToken], "DavosBridge/short-caps-exceeded"); shortCapsDeposit[fromToken][getCurrentStamp(shortCapDuration)] += amount; require(longCapsDeposit[fromToken][getCurrentStamp(longCapDuration)] + amount <= longCaps[fromToken], "DavosBridge/long-caps-exceeded"); longCapsDeposit[fromToken][getCurrentStamp(longCapDuration)] += amount; } /** * @dev Tokens on source and destination chains are linked with independent supplies. * Burns tokens on source chain (to later mint on destination chain). * @param fromToken one of many warp-able token on source chain. * @param toChain one of many destination chain ID. * @param toAddress claimer of 'totalAmount' on destination chain. * @param totalAmount amout of tokens to be warped. */ function _depositWarped(address fromToken, uint256 toChain, address toAddress, uint256 totalAmount) internal { require(_bridgeAddressByChainId[toChain] != address(0), "DavosBridge/non-existing-bridge"); address fromAddress = address(msg.sender); uint256 balanceBefore = IERC20Upgradeable(fromToken).balanceOf(fromAddress); IERC20Mintable(fromToken).burn(fromAddress, totalAmount); uint256 balanceAfter = IERC20Upgradeable(fromToken).balanceOf(fromAddress); require(balanceAfter + totalAmount == balanceBefore, "DavosBridge/incorrect-transfer-amount"); /* fromToken and toToken are independent, originChain and originAddress are invalid */ Metadata memory metaData = Metadata( Utils.stringToBytes32(IERC20Extra(fromToken).symbol()), Utils.stringToBytes32(IERC20Extra(fromToken).name()), 0, address(0) ); _globalNonce++; emit DepositWarped(toChain, fromAddress, toAddress, fromToken, warpDestination(fromToken, toChain), _amountErc20Token(fromToken, totalAmount), _globalNonce, metaData); } function _amountErc20Token(address fromToken, uint256 totalAmount) internal returns (uint256) { /* scale amount to 18 decimals */ require(IERC20Extra(fromToken).decimals() <= 18, "DavosBridge/decimals-overflow"); totalAmount *= (10**(18 - IERC20Extra(fromToken).decimals())); return totalAmount; } function withdraw(bytes calldata, /* encodedProof */ bytes calldata rawReceipt, bytes memory proofSignature) external override nonReentrant whenNotPaused { uint256 proofOffset; uint256 receiptOffset; assembly { proofOffset := add(0x4, calldataload(4)) receiptOffset := add(0x4, calldataload(36)) } /* we must parse and verify that tx and receipt matches */ (EthereumVerifier.State memory state, EthereumVerifier.PegInType pegInType) = EthereumVerifier.parseTransactionReceipt(receiptOffset); require(state.chainId == block.chainid, "DavosBridge/receipt-points-to-another-chain"); ProofParser.Proof memory proof = ProofParser.parseProof(proofOffset); require(state.contractAddress != address(0), "DavosBridge/invalid-contractAddress"); require(_bridgeAddressByChainId[proof.chainId] == state.contractAddress, "DavosBridge/event-from-unknown-bridge"); state.receiptHash = keccak256(rawReceipt); proof.status = 0x01; proof.receiptHash = state.receiptHash; bytes32 proofHash; assembly { proofHash := keccak256(proof, 0x100) } // we can trust receipt only if proof is signed by consensus require(ECDSAUpgradeable.recover(proofHash, proofSignature) == _consensusAddress, "DavosBridge/bad-signature"); // withdraw funds to recipient _withdraw(state, pegInType, proof, proofHash); } function _withdraw(EthereumVerifier.State memory state, EthereumVerifier.PegInType pegInType, ProofParser.Proof memory proof, bytes32 payload) internal { require(!_usedProofs[payload], "DavosBridge/used-proof"); _usedProofs[payload] = true; if (pegInType == EthereumVerifier.PegInType.Warp) { _withdrawWarped(state, proof); } else revert("DavosBridge/invalid-type"); } function _withdrawWarped(EthereumVerifier.State memory state, ProofParser.Proof memory proof) internal { require(state.fromToken != address(0), "DavosBridge/invalid-fromToken"); require(warpDestination(state.toToken, proof.chainId) == state.fromToken, "DavosBridge/bridge-from-unknown-destination"); uint8 decimals = IERC20MetadataUpgradeable(state.toToken).decimals(); require(decimals <= 18, "DavosBridge/decimals-overflow"); uint256 scaledAmount = state.totalAmount / (10**(18 - decimals)); _updateWithdrawCaps(state.toToken, scaledAmount); IERC20Mintable(state.toToken).mint(state.toAddress, scaledAmount); emit WithdrawMinted(state.receiptHash, state.fromAddress, state.toAddress, state.fromToken, state.toToken, state.totalAmount); } function _updateWithdrawCaps(address token, uint256 amount) internal { require(shortCapsWithdraw[token][getCurrentStamp(shortCapDuration)] + amount <= shortCaps[token], "DavosBridge/short-caps-exceeded"); shortCapsWithdraw[token][getCurrentStamp(shortCapDuration)] += amount; require(longCapsWithdraw[token][getCurrentStamp(longCapDuration)] + amount <= longCaps[token], "DavosBridge/long-caps-exceeded"); longCapsWithdraw[token][getCurrentStamp(longCapDuration)] += amount; } // --- Admin --- function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } function addBridge(address bridge, uint256 toChain) public onlyOwner { require(_bridgeAddressByChainId[toChain] == address(0x00), "DavosBridge/already-allowed"); require(toChain > 0, "DavosBridge/invalid-chain"); _bridgeAddressByChainId[toChain] = bridge; emit BridgeAdded(bridge, toChain); } function removeBridge(uint256 toChain) public onlyOwner { require(_bridgeAddressByChainId[toChain] != address(0x00), "already-removed"); require(toChain > 0, "DavosBridge/invalid-chain"); address bridge = _bridgeAddressByChainId[toChain]; delete _bridgeAddressByChainId[toChain]; emit BridgeRemoved(bridge, toChain); } function addWarpDestination(address fromToken, uint256 toChain, address toToken) external onlyOwner { require(_bridgeAddressByChainId[toChain] != address(0), "DavosBridge/bad-chain"); bytes32 direction = keccak256(abi.encodePacked(fromToken, block.chainid, _bridgeAddressByChainId[toChain], toChain)); require(_warpDestinations[direction] == address(0), "DavosBridge/known-destination"); _warpDestinations[direction] = toToken; emit WarpDestinationAdded(fromToken, toChain, toToken); } function removeWarpDestination(address fromToken, uint256 toChain, address toToken) external onlyOwner { require(_bridgeAddressByChainId[toChain] != address(0), "DavosBridge/bad-chain"); bytes32 direction = keccak256(abi.encodePacked(fromToken, block.chainid, _bridgeAddressByChainId[toChain], toChain)); require(_warpDestinations[direction] != address(0), "DavosBridge/unknown-destination"); delete _warpDestinations[direction]; emit WarpDestinationRemoved(fromToken, toChain, toToken); } function changeConsensus(address consensus) public onlyOwner { require(consensus != address(0x0), "DavosBridge/invalid-address"); _consensusAddress = consensus; emit ConsensusChanged(_consensusAddress); } function changeMetadata(address token, bytes32 name, bytes32 symbol) external onlyOwner { IERC20MetadataChangeable(token).changeName(name); IERC20MetadataChangeable(token).changeSymbol(symbol); } function changeShortCap(address token, uint256 amount) external onlyOwner { uint256 xAmount = shortCaps[token]; shortCaps[token] = amount; emit ShortCapChanged(token, xAmount, amount); } function changeShortCapDuration(uint256 duration) external onlyOwner { uint256 xDuration = shortCapDuration; shortCapDuration = duration; emit ShortCapDurationChanged(xDuration, duration); } function changeLongCap(address token, uint256 amount) external onlyOwner { uint256 xAmount = longCaps[token]; longCaps[token] = amount; emit LongCapChanged(token, xAmount, amount); } function changeLongCapDuration(uint256 duration) external onlyOwner { uint256 xDuration = longCapDuration; longCapDuration = duration; emit LongCapDurationChanged(xDuration, duration); } // --- Views --- function warpDestination(address fromToken, uint256 toChain) public view returns(address) { return _warpDestinations[keccak256(abi.encodePacked(fromToken, block.chainid, _bridgeAddressByChainId[toChain], toChain))]; } function getCurrentStamp(uint256 duration) public view returns(uint256) { return (block.timestamp / duration) * duration; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.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 ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode 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 {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] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { 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); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode 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 {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); 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] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); 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. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // 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); } // 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); } return (signer, RecoverError.NoError); } /** * @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) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (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; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); 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 (rounding == Rounding.Up && 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 down. * * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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 10, 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 + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.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), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.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) { 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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); 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); } }
// // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; import "./IERC20.sol"; interface IDavosBridge { // --- Structs --- struct Metadata { bytes32 symbol; bytes32 name; uint256 originChain; address originAddress; } // --- Events --- event ShortCapChanged(address indexed token, uint256 indexed xAmount, uint256 indexed amount); event LongCapChanged(address indexed token,uint256 indexed xAmount, uint256 indexed amount); event ShortCapDurationChanged(uint256 indexed xDuration, uint256 indexed duration); event LongCapDurationChanged(uint256 indexed xDuration, uint256 indexed duration); event BridgeAdded(address bridge, uint256 toChain); event BridgeRemoved(address bridge, uint256 toChain); event WarpDestinationAdded(address indexed fromToken, uint256 indexed toChain, address indexed toToken); event WarpDestinationRemoved(address indexed fromToken, uint256 indexed toChain, address indexed toToken); event ConsensusChanged(address consensusAddress); event DepositWarped(uint256 chainId, address indexed fromAddress, address indexed toAddress, address fromToken, address toToken, uint256 totalAmount, uint256 nonce, Metadata metadata); event WithdrawMinted(bytes32 receiptHash, address indexed fromAddress, address indexed toAddress, address fromToken, address toToken, uint256 totalAmount); // --- Functions --- function depositToken(address fromToken, uint256 toChain, address toAddress, uint256 amount) external; function withdraw(bytes calldata encodedProof, bytes calldata rawReceipt, bytes memory receiptRootSignature) external; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; interface IERC20Mintable { function mint(address account, uint256 amount) external; function burn(address account, uint256 amount) external; // use for charge bridge commission before burn function chargeFrom(address sender, address recipient, uint256 amount) external returns (bool); } interface IERC20Pegged { function getOrigin() external view returns (uint256, address); } interface IERC20Extra { function name() external returns (string memory); function decimals() external returns (uint8); function symbol() external returns (string memory); } interface IERC20MetadataChangeable { event NameChanged(string prevValue, string newValue); event SymbolChanged(string prevValue, string newValue); function changeName(bytes32) external; function changeSymbol(bytes32) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.16; library CallDataRLPReader { uint8 constant STRING_SHORT_START = 0x80; uint8 constant STRING_LONG_START = 0xb8; uint8 constant LIST_SHORT_START = 0xc0; uint8 constant LIST_LONG_START = 0xf8; uint8 constant WORD_SIZE = 32; function beginIteration(uint256 listOffset) internal pure returns (uint256 iter) { return listOffset + _payloadOffset(listOffset); } function next(uint256 iter) internal pure returns (uint256 nextIter) { return iter + itemLength(iter); } function payloadLen(uint256 ptr, uint256 len) internal pure returns (uint256) { return len - _payloadOffset(ptr); } function toAddress(uint256 ptr) internal pure returns (address) { return address(uint160(toUint(ptr, 21))); } function toUint(uint256 ptr, uint256 len) internal pure returns (uint256) { require(len > 0 && len <= 33); uint256 offset = _payloadOffset(ptr); uint256 numLen = len - offset; uint256 result; assembly { result := calldataload(add(ptr, offset)) // cut off redundant bytes result := shr(mul(8, sub(32, numLen)), result) } return result; } function toUintStrict(uint256 ptr) internal pure returns (uint256) { // one byte prefix uint256 result; assembly { result := calldataload(add(ptr, 1)) } return result; } function rawDataPtr(uint256 ptr) internal pure returns (uint256) { return ptr + _payloadOffset(ptr); } // @return entire rlp item byte length function itemLength(uint256 callDataPtr) internal pure returns (uint256) { uint256 itemLen; uint256 byte0; assembly { byte0 := byte(0, calldataload(callDataPtr)) } if (byte0 < STRING_SHORT_START) itemLen = 1; else if (byte0 < STRING_LONG_START) itemLen = byte0 - STRING_SHORT_START + 1; else if (byte0 < LIST_SHORT_START) { assembly { let byteLen := sub(byte0, 0xb7) // # of bytes the actual length is callDataPtr := add(callDataPtr, 1) // skip over the first byte /* 32 byte word size */ let dataLen := shr( mul(8, sub(32, byteLen)), calldataload(callDataPtr) ) itemLen := add(dataLen, add(byteLen, 1)) } } else if (byte0 < LIST_LONG_START) { itemLen = byte0 - LIST_SHORT_START + 1; } else { assembly { let byteLen := sub(byte0, 0xf7) callDataPtr := add(callDataPtr, 1) let dataLen := shr( mul(8, sub(32, byteLen)), calldataload(callDataPtr) ) itemLen := add(dataLen, add(byteLen, 1)) } } return itemLen; } // @return number of bytes until the data function _payloadOffset(uint256 callDataPtr) private pure returns (uint256) { uint256 byte0; assembly { byte0 := byte(0, calldataload(callDataPtr)) } if (byte0 < STRING_SHORT_START) return 0; else if ( byte0 < STRING_LONG_START || (byte0 >= LIST_SHORT_START && byte0 < LIST_LONG_START) ) return 1; else if (byte0 < LIST_SHORT_START) return byte0 - (STRING_LONG_START - 1) + 1; else return byte0 - (LIST_LONG_START - 1) + 1; } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; import "./CallDataRLPReader.sol"; import "./Utils.sol"; import "../interfaces/IDavosBridge.sol"; library EthereumVerifier { bytes32 constant TOPIC_PEG_IN_WARPED = keccak256("DepositWarped(uint256,address,address,address,address,uint256,uint256,(bytes32,bytes32,uint256,address))"); enum PegInType { None, Warp } struct State { bytes32 receiptHash; address contractAddress; uint256 chainId; address fromAddress; address toAddress; address fromToken; address toToken; uint256 totalAmount; uint256 nonce; // metadata fields (we can't use Metadata struct here because of Solidity struct memory layout) bytes32 symbol; bytes32 name; uint256 originChain; address originToken; } function getMetadata(State memory state) internal pure returns (IDavosBridge.Metadata memory) { IDavosBridge.Metadata memory metadata; assembly { metadata := add(state, 0x120) } return metadata; } function parseTransactionReceipt(uint256 receiptOffset) internal pure returns (State memory state, PegInType pegInType) { /* parse peg-in data from logs */ uint256 iter = CallDataRLPReader.beginIteration(receiptOffset + 0x20); { /* postStateOrStatus - we must ensure that tx is not reverted */ uint256 statusOffset = iter; iter = CallDataRLPReader.next(iter); require( CallDataRLPReader.payloadLen( statusOffset, iter - statusOffset ) == 1, "EthereumVerifier: tx is reverted" ); } /* skip cumulativeGasUsed */ iter = CallDataRLPReader.next(iter); /* logs - we need to find our logs */ uint256 logs = iter; iter = CallDataRLPReader.next(iter); uint256 logsIter = CallDataRLPReader.beginIteration(logs); for (; logsIter < iter; ) { uint256 log = logsIter; logsIter = CallDataRLPReader.next(logsIter); /* make sure there is only one peg-in event in logs */ PegInType logType = _decodeReceiptLogs(state, log); if (logType != PegInType.None) { require( pegInType == PegInType.None, "EthereumVerifier: multiple logs" ); pegInType = logType; } } /* don't allow to process if peg-in type is unknown */ require(pegInType != PegInType.None, "EthereumVerifier: missing logs"); return (state, pegInType); } function _decodeReceiptLogs(State memory state, uint256 log) internal pure returns (PegInType pegInType) { uint256 logIter = CallDataRLPReader.beginIteration(log); address contractAddress; { /* parse smart contract address */ uint256 addressOffset = logIter; logIter = CallDataRLPReader.next(logIter); contractAddress = CallDataRLPReader.toAddress(addressOffset); } /* topics */ bytes32 mainTopic; address fromAddress; address toAddress; { uint256 topicsIter = logIter; logIter = CallDataRLPReader.next(logIter); // Must be 3 topics RLP encoded: event signature, fromAddress, toAddress // Each topic RLP encoded is 33 bytes (0xa0[32 bytes data]) // Total payload: 99 bytes. Since it's list with total size bigger than 55 bytes we need 2 bytes prefix (0xf863) // So total size of RLP encoded topics array must be 101 if (CallDataRLPReader.itemLength(topicsIter) != 101) { return PegInType.None; } topicsIter = CallDataRLPReader.beginIteration(topicsIter); mainTopic = bytes32(CallDataRLPReader.toUintStrict(topicsIter)); topicsIter = CallDataRLPReader.next(topicsIter); fromAddress = address( bytes20(uint160(CallDataRLPReader.toUintStrict(topicsIter))) ); topicsIter = CallDataRLPReader.next(topicsIter); toAddress = address( bytes20(uint160(CallDataRLPReader.toUintStrict(topicsIter))) ); topicsIter = CallDataRLPReader.next(topicsIter); require(topicsIter == logIter); // safety check that iteration is finished } uint256 ptr = CallDataRLPReader.rawDataPtr(logIter); logIter = CallDataRLPReader.next(logIter); uint256 len = logIter - ptr; { // parse logs based on topic type and check that event data has correct length uint256 expectedLen; if (mainTopic == TOPIC_PEG_IN_WARPED) { expectedLen = 0x120; pegInType = PegInType.Warp; } else { return PegInType.None; } if (len != expectedLen) { return PegInType.None; } } { // read chain id separately and verify that contract that emitted event is relevant uint256 chainId; assembly { chainId := calldataload(ptr) } // if (chainId != Utils.currentChain()) return PegInType.None; // All checks are passed after this point, no errors allowed and we can modify state state.chainId = chainId; ptr += 0x20; len -= 0x20; } { uint256 structOffset; assembly { // skip 5 fields: receiptHash, contractAddress, chainId, fromAddress, toAddress structOffset := add(state, 0xa0) calldatacopy(structOffset, ptr, len) } } state.contractAddress = contractAddress; state.fromAddress = fromAddress; state.toAddress = toAddress; return pegInType; } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.6; import "./CallDataRLPReader.sol"; import "./Utils.sol"; library ProofParser { // Proof is message format signed by the protocol. It contains somewhat redundant information, so only part // of the proof could be passed into the contract and other part can be inferred from transaction receipt struct Proof { uint256 chainId; uint256 status; bytes32 transactionHash; uint256 blockNumber; bytes32 blockHash; uint256 transactionIndex; bytes32 receiptHash; uint256 transferAmount; } function parseProof(uint256 proofOffset) internal pure returns (Proof memory) { Proof memory proof; uint256 dataOffset = proofOffset + 0x20; assembly { calldatacopy(proof, dataOffset, 0x20) // 1 field (chainId) dataOffset := add(dataOffset, 0x40) calldatacopy(add(proof, 0x40), dataOffset, 0x80) // 4 fields * 0x20 = 0x80 dataOffset := add(dataOffset, 0xa0) calldatacopy(add(proof, 0xe0), dataOffset, 0x20) // transferAmount } return proof; } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.16; library Utils { function currentChain() internal view returns (uint256) { uint256 chain; assembly { chain := chainid() } return chain; } function stringToBytes32(string memory source) internal pure returns (bytes32 result) { bytes memory tempEmptyStringTest = bytes(source); if (tempEmptyStringTest.length == 0) { return 0x0; } assembly { result := mload(add(source, 32)) } } function saturatingMultiply(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { if (a == 0) return 0; uint256 c = a * b; if (c / a != b) return type(uint256).max; return c; } } function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) { unchecked { uint256 c = a + b; if (c < a) return type(uint256).max; return c; } } // Preconditions: // 1. a may be arbitrary (up to 2 ** 256 - 1) // 2. b * c < 2 ** 256 // Returned value: min(floor((a * b) / c), 2 ** 256 - 1) function multiplyAndDivideFloor( uint256 a, uint256 b, uint256 c ) internal pure returns (uint256) { return saturatingAdd( saturatingMultiply(a / c, b), ((a % c) * b) / c // can't fail because of assumption 2. ); } // Preconditions: // 1. a may be arbitrary (up to 2 ** 256 - 1) // 2. b * c < 2 ** 256 // Returned value: min(ceil((a * b) / c), 2 ** 256 - 1) function multiplyAndDivideCeil( uint256 a, uint256 b, uint256 c ) internal pure returns (uint256) { return saturatingAdd( saturatingMultiply(a / c, b), ((a % c) * b + (c - 1)) / c // can't fail because of assumption 2. ); } }
{ "optimizer": { "enabled": true, "runs": 100 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bridge","type":"address"},{"indexed":false,"internalType":"uint256","name":"toChain","type":"uint256"}],"name":"BridgeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bridge","type":"address"},{"indexed":false,"internalType":"uint256","name":"toChain","type":"uint256"}],"name":"BridgeRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"consensusAddress","type":"address"}],"name":"ConsensusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"address","name":"fromToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"components":[{"internalType":"bytes32","name":"symbol","type":"bytes32"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"uint256","name":"originChain","type":"uint256"},{"internalType":"address","name":"originAddress","type":"address"}],"indexed":false,"internalType":"struct IDavosBridge.Metadata","name":"metadata","type":"tuple"}],"name":"DepositWarped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"xAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LongCapChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"xDuration","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"LongCapDurationChanged","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":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"xAmount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ShortCapChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"xDuration","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"ShortCapDurationChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"uint256","name":"toChain","type":"uint256"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"}],"name":"WarpDestinationAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fromToken","type":"address"},{"indexed":true,"internalType":"uint256","name":"toChain","type":"uint256"},{"indexed":true,"internalType":"address","name":"toToken","type":"address"}],"name":"WarpDestinationRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"receiptHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"address","name":"fromToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"WithdrawMinted","type":"event"},{"inputs":[{"internalType":"address","name":"bridge","type":"address"},{"internalType":"uint256","name":"toChain","type":"uint256"}],"name":"addBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"uint256","name":"toChain","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"}],"name":"addWarpDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"consensus","type":"address"}],"name":"changeConsensus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"changeLongCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"changeLongCapDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"name","type":"bytes32"},{"internalType":"bytes32","name":"symbol","type":"bytes32"}],"name":"changeMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"changeShortCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"changeShortCapDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"uint256","name":"toChain","type":"uint256"},{"internalType":"address","name":"toAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"getCurrentStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"consensusAddress","type":"address"},{"internalType":"string","name":"nativeTokenSymbol","type":"string"},{"internalType":"string","name":"nativeTokenName","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"longCapDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"longCaps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"longCapsDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"longCapsWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"toChain","type":"uint256"}],"name":"removeBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"uint256","name":"toChain","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"}],"name":"removeWarpDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"shortCapDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"shortCaps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"shortCapsDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"shortCapsWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"uint256","name":"toChain","type":"uint256"}],"name":"warpDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"bytes","name":"rawReceipt","type":"bytes"},{"internalType":"bytes","name":"proofSignature","type":"bytes"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612fdb80620000f46000396000f3fe608060405234801561001057600080fd5b506004361061018f5760003560e01c8063802503d5116100e4578063a713058711610092578063a713058714610357578063c5ea676814610382578063c7725bad14610395578063d0f48715146103a8578063d2f125b2146103bb578063e049c3a3146103ce578063f2fde38b146103f9578063fd1949911461040c57600080fd5b8063802503d5146102a45780638456cb59146102c45780638bc5d4d3146102cc5780638cc13012146102f75780638da5cb5b1461031757806390657147146103315780639805f11a1461034457600080fd5b806351ee7d271161014157806351ee7d2714610227578063570c20b71461023a5780635ac02ed01461024d5780635c975abb146102605780636701ccb514610276578063715018a6146102895780637f669d8c1461029157600080fd5b806304ee802f146101945780632d8de281146101a95780632f0de139146101c55780633e276d62146101d85780633e8e89f0146101e15780633f4ba83a146101f45780634e58469d146101fc575b600080fd5b6101a76101a23660046127c3565b61041f565b005b6101b260d65481565b6040519081526020015b60405180910390f35b6101a76101d33660046127f8565b610460565b6101b260d25481565b6101a76101ef3660046127c3565b61051a565b6101a761055b565b6101b261020a366004612813565b60d460209081526000928352604080842090915290825290205481565b6101a7610235366004612813565b61056d565b6101a7610248366004612813565b6105c5565b6101a761025b3660046127c3565b6106b7565b60655460ff1660405190151581526020016101bc565b6101a761028436600461283d565b610792565b6101a761083b565b6101a761029f366004612813565b61084d565b6101b26102b23660046127f8565b60d76020526000908152604090205481565b6101a76108a5565b6101b26102da366004612813565b60d860209081526000928352604080842090915290825290205481565b6101b26103053660046127f8565b60d36020526000908152604090205481565b6033546001600160a01b03165b6040516101bc9190612881565b6101a761033f366004612962565b6108b5565b6101a76103523660046129d6565b610a92565b6101b2610365366004612813565b60d960209081526000928352604080842090915290825290205481565b610324610390366004612813565b610b53565b6101a76103a3366004612a09565b610bbe565b6101a76103b6366004612a87565b610d01565b6101a76103c9366004612a09565b610f40565b6101b26103dc366004612813565b60d560209081526000928352604080842090915290825290205481565b6101a76104073660046127f8565b61108a565b6101b261041a3660046127c3565b611103565b61042761111a565b60d6805490829055604051829082907fc318ed6288cdf2cd1dec4feb3d48f84828f062d9b812afb65cf43135f94289ab90600090a35050565b61046861111a565b6001600160a01b0381166104c35760405162461bcd60e51b815260206004820152601b60248201527f4461766f734272696467652f696e76616c69642d61646472657373000000000060448201526064015b60405180910390fd5b60ca80546001600160a01b0319166001600160a01b0383169081179091556040517f1e2dea1ea1c691deaacf3226024b51e2b907bb9db3a24135738faf96a19b9ed09161050f91612881565b60405180910390a150565b61052261111a565b60d2805490829055604051829082907fcd5dd143ec4e58a4fd610459b592e7a0df095b56ff28113b33ef454b7be6d23590600090a35050565b61056361111a565b61056b611174565b565b61057561111a565b6001600160a01b038216600081815260d3602052604080822080549085905590519092849284927f31df6ae5b1f4d8b2d9f67caa6cde087b4f3b9e12dac0aaf9a3f27d247cd232009190a4505050565b6105cd61111a565b600081815260d060205260409020546001600160a01b0316156106325760405162461bcd60e51b815260206004820152601b60248201527f4461766f734272696467652f616c72656164792d616c6c6f776564000000000060448201526064016104ba565b600081116106525760405162461bcd60e51b81526004016104ba90612b2f565b600081815260d060205260409081902080546001600160a01b0319166001600160a01b038516179055517f10916f5c971b65b1a3f05d1a63bfc558ca4d659670f408b6de05007215f1812a906106ab9084908490612b62565b60405180910390a15050565b6106bf61111a565b600081815260d060205260409020546001600160a01b03166107155760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4b5c995b5bdd9959608a1b60448201526064016104ba565b600081116107355760405162461bcd60e51b81526004016104ba90612b2f565b600081815260d060205260409081902080546001600160a01b0319811690915590516001600160a01b03909116907ffc5b6fb2b8ba31620717843fd7a36a4ad996612ff9f3ece7cba2900efb43bc2b906106ab9083908590612b62565b61079a6111c0565b6107a2611219565b6107ac848261125f565b60006107b88585610b53565b6001600160a01b0316146107d7576107d2848484846113c9565b61082b565b60405162461bcd60e51b8152602060048201526024808201527f4461766f734272696467652f776172702d64657374696e6174696f6e2d756e6b6044820152633737bbb760e11b60648201526084016104ba565b6108356001609755565b50505050565b61084361111a565b61056b6000611789565b61085561111a565b6001600160a01b038216600081815260d7602052604080822080549085905590519092849284927f9879bf40436c98ee8b389ce84c33503f4494a999077f6fb7aa6c4f63de6a9adf9190a4505050565b6108ad61111a565b61056b6117db565b600054610100900460ff16158080156108d55750600054600160ff909116105b806108ef5750303b1580156108ef575060005460ff166001145b6109525760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104ba565b6000805460ff191660011790558015610975576000805461ff0019166101001790555b61097d611818565b610985611847565b61098d611876565b60ca80546001600160a01b0319166001600160a01b0386161790556040805160808101909152806109bd856118a5565b81526020016109cb846118a5565b8152602001468152602001846040516020016109e79190612b9f565b60408051808303601f190181529181528151602092830120606090811c909352835160cb559083015160cc5582015160cd55015160ce80546001600160a01b0319166001600160a01b03909216919091179055610e1060d2556201518060d6558015610835576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b610a9a61111a565b60405163898855ed60e01b8152600481018390526001600160a01b0384169063898855ed90602401600060405180830381600087803b158015610adc57600080fd5b505af1158015610af0573d6000803e3d6000fd5b5050604051630d6c7ef360e11b8152600481018490526001600160a01b0386169250631ad8fde69150602401600060405180830381600087803b158015610b3657600080fd5b505af1158015610b4a573d6000803e3d6000fd5b50505050505050565b600081815260d06020908152604080832054905160d1928492610b8692889246926001600160a01b031691899101612bd2565b60408051601f19818403018152918152815160209283012083529082019290925201600020546001600160a01b031690505b92915050565b610bc661111a565b600082815260d060205260409020546001600160a01b0316610bfa5760405162461bcd60e51b81526004016104ba90612c0b565b600082815260d060209081526040808320549051610c2a92879246926001600160a01b0390911691889101612bd2565b60408051601f198184030181529181528151602092830120600081815260d19093529120549091506001600160a01b0316610ca75760405162461bcd60e51b815260206004820152601f60248201527f4461766f734272696467652f756e6b6e6f776e2d64657374696e6174696f6e0060448201526064016104ba565b600081815260d1602052604080822080546001600160a01b0319169055516001600160a01b03848116928692918816917fbbcefea7388a2fce55f6f7bc8b8fb140e4a90100232f853b2892432748d185b89190a450505050565b610d096111c0565b610d11611219565b6004803581019060243501600080610d28836118c4565b9150915046826040015114610d935760405162461bcd60e51b815260206004820152602b60248201527f4461766f734272696467652f726563656970742d706f696e74732d746f2d616e60448201526a37ba3432b916b1b430b4b760a91b60648201526084016104ba565b6000610d9e85611ae9565b60208401519091506001600160a01b0316610e075760405162461bcd60e51b815260206004820152602360248201527f4461766f734272696467652f696e76616c69642d636f6e74726163744164647260448201526265737360e81b60648201526084016104ba565b6020808401518251600090815260d09092526040909120546001600160a01b03908116911614610e875760405162461bcd60e51b815260206004820152602560248201527f4461766f734272696467652f6576656e742d66726f6d2d756e6b6e6f776e2d62604482015264726964676560d81b60648201526084016104ba565b8787604051610e97929190612c3a565b604051908190039020835260016020820152825160c0820152610100812060ca546001600160a01b0316610ecb8289611b2d565b6001600160a01b031614610f1d5760405162461bcd60e51b81526020600482015260196024820152784461766f734272696467652f6261642d7369676e617475726560381b60448201526064016104ba565b610f2984848484611b51565b505050505050610f396001609755565b5050505050565b610f4861111a565b600082815260d060205260409020546001600160a01b0316610f7c5760405162461bcd60e51b81526004016104ba90612c0b565b600082815260d060209081526040808320549051610fac92879246926001600160a01b0390911691889101612bd2565b60408051601f198184030181529181528151602092830120600081815260d19093529120549091506001600160a01b03161561102a5760405162461bcd60e51b815260206004820152601d60248201527f4461766f734272696467652f6b6e6f776e2d64657374696e6174696f6e00000060448201526064016104ba565b600081815260d1602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915191928692918816917fe28a125d78f695ba47a84c50686b72e8157091f96188b62d21945f155ec72d479190a450505050565b61109261111a565b6001600160a01b0381166110f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104ba565b61110081611789565b50565b6000816111108142612c60565b610bb89190612c82565b6033546001600160a01b0316331461056b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104ba565b61117c611c2e565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516111b69190612881565b60405180910390a1565b6002609754036112125760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104ba565b6002609755565b60655460ff161561056b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104ba565b6001600160a01b038216600090815260d3602090815260408083205460d4909252822060d2549192849261129290611103565b8152602001908152602001600020546112ab9190612ca1565b11156112c95760405162461bcd60e51b81526004016104ba90612cb4565b6001600160a01b038216600090815260d46020526040812060d2548392906112f090611103565b8152602001908152602001600020600082825461130d9190612ca1565b90915550506001600160a01b038216600090815260d7602090815260408083205460d8909252822060d6549192849261134590611103565b81526020019081526020016000205461135e9190612ca1565b111561137c5760405162461bcd60e51b81526004016104ba90612ceb565b6001600160a01b038216600090815260d86020526040812060d6548392906113a390611103565b815260200190815260200160002060008282546113c09190612ca1565b90915550505050565b600083815260d060205260409020546001600160a01b031661142d5760405162461bcd60e51b815260206004820152601f60248201527f4461766f734272696467652f6e6f6e2d6578697374696e672d6272696467650060448201526064016104ba565b6040516370a0823160e01b815233906000906001600160a01b038716906370a082319061145e908590600401612881565b602060405180830381865afa15801561147b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149f9190612d22565b604051632770a7eb60e21b81529091506001600160a01b03871690639dc29fac906114d09085908790600401612b62565b600060405180830381600087803b1580156114ea57600080fd5b505af11580156114fe573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b03891691506370a0823190611531908690600401612881565b602060405180830381865afa15801561154e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115729190612d22565b90508161157f8583612ca1565b146115da5760405162461bcd60e51b815260206004820152602560248201527f4461766f734272696467652f696e636f72726563742d7472616e736665722d616044820152641b5bdd5b9d60da1b60648201526084016104ba565b600060405180608001604052806116578a6001600160a01b03166395d89b416040518163ffffffff1660e01b81526004016000604051808303816000875af115801561162a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116529190810190612d3b565b6118a5565b815260200161169f8a6001600160a01b03166306fdde036040518163ffffffff1660e01b81526004016000604051808303816000875af115801561162a573d6000803e3d6000fd5b8152600060208201819052604090910181905260c98054929350906116c383612db2565b9190505550856001600160a01b0316846001600160a01b03167fbb91bc033add952080918570fb6f133f59b480190b2e57e131fb76a6cc5a605b898b6117098d8d610b53565b6117138e8c611c77565b60c954604080519586526001600160a01b03948516602080880191909152938516868201526060808701939093526080860191909152885160a08601529188015160c08501529087015160e0840152860151166101008201526101200160405180910390a35050505050505050565b6001609755565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6117e3611219565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586111a93390565b600054610100900460ff1661183f5760405162461bcd60e51b81526004016104ba90612dcb565b61056b611d8b565b600054610100900460ff1661186e5760405162461bcd60e51b81526004016104ba90612dcb565b61056b611dbb565b600054610100900460ff1661189d5760405162461bcd60e51b81526004016104ba90612dcb565b61056b611dee565b8051600090829082036118bb5750600092915050565b50506020015190565b604080516101a081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081019190915260008061194361193e856020612ca1565b611e15565b90508061194f81611e2a565b91506119648161195f8185612e16565b611e35565b6001146119b35760405162461bcd60e51b815260206004820181905260248201527f457468657265756d56657269666965723a20747820697320726576657274656460448201526064016104ba565b506119bd81611e2a565b9050806119c981611e2a565b915060006119d682611e15565b90505b82811015611a8057806119eb81611e2a565b915060006119f98783611e4a565b90506000816001811115611a0f57611a0f612e29565b14611a79576000866001811115611a2857611a28612e29565b14611a755760405162461bcd60e51b815260206004820152601f60248201527f457468657265756d56657269666965723a206d756c7469706c65206c6f67730060448201526064016104ba565b8095505b50506119d9565b6000846001811115611a9457611a94612e29565b03611ae15760405162461bcd60e51b815260206004820152601e60248201527f457468657265756d56657269666965723a206d697373696e67206c6f6773000060448201526064016104ba565b505050915091565b611af161277f565b611af961277f565b6000611b06846020612ca1565b90506020818337604081019050608081604084013760a00160208160e08401375092915050565b6000806000611b3c8585611fdf565b91509150611b4981612024565b509392505050565b600081815260cf602052604090205460ff1615611ba95760405162461bcd60e51b81526020600482015260166024820152752230bb37b9a13934b233b297bab9b2b216b83937b7b360511b60448201526064016104ba565b600081815260cf60205260409020805460ff19166001908117909155836001811115611bd757611bd7612e29565b03611beb57611be68483612169565b610835565b60405162461bcd60e51b81526020600482015260186024820152774461766f734272696467652f696e76616c69642d7479706560401b60448201526064016104ba565b60655460ff1661056b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104ba565b60006012836001600160a01b031663313ce5676040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdf9190612e3f565b60ff161115611d005760405162461bcd60e51b81526004016104ba90612e62565b826001600160a01b031663313ce5676040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611d40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d649190612e3f565b611d6f906012612e99565b611d7a90600a612f96565b611d849083612c82565b9392505050565b600054610100900460ff16611db25760405162461bcd60e51b81526004016104ba90612dcb565b61056b33611789565b600054610100900460ff16611de25760405162461bcd60e51b81526004016104ba90612dcb565b6065805460ff19169055565b600054610100900460ff166117825760405162461bcd60e51b81526004016104ba90612dcb565b6000611e208261240a565b610bb89083612ca1565b6000611e2082612484565b6000611e408361240a565b611d849083612e16565b600080611e5683611e15565b9050600081611e6481611e2a565b9250611e6f81612527565b915060009050808084611e8181611e2a565b9550611e8c81612484565b606514611ea25760009650505050505050610bb8565b611eab81611e15565b905060018101359350611ebd81611e2a565b905060018101356001600160a01b03169250611ed881611e2a565b905060018101356001600160a01b03169150611ef381611e2a565b9050858114611f0157600080fd5b506000611f0d86611e15565b9050611f1886611e2a565b95506000611f268288612e16565b905060007fbb91bc033add952080918570fb6f133f59b480190b2e57e131fb76a6cc5a605b8603611f5e575060019750610120611f6f565b600098505050505050505050610bb8565b808214611f8757600098505050505050505050610bb8565b50813560408b01819052611f9c602084612ca1565b9250611fa9602083612e16565b91505060a08a01818382375050506001600160a01b03938416602089015290831660608801529091166080860152505092915050565b60008082516041036120155760208301516040840151606085015160001a61200987828585612534565b9450945050505061201d565b506000905060025b9250929050565b600081600481111561203857612038612e29565b036120405750565b600181600481111561205457612054612e29565b0361209c5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016104ba565b60028160048111156120b0576120b0612e29565b036120fd5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104ba565b600381600481111561211157612111612e29565b036111005760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104ba565b60a08201516001600160a01b03166121c35760405162461bcd60e51b815260206004820152601d60248201527f4461766f734272696467652f696e76616c69642d66726f6d546f6b656e00000060448201526064016104ba565b8160a001516001600160a01b03166121e38360c001518360000151610b53565b6001600160a01b03161461224d5760405162461bcd60e51b815260206004820152602b60248201527f4461766f734272696467652f6272696467652d66726f6d2d756e6b6e6f776e2d60448201526a3232b9ba34b730ba34b7b760a91b60648201526084016104ba565b60008260c001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612291573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b59190612e3f565b905060128160ff1611156122db5760405162461bcd60e51b81526004016104ba90612e62565b60006122e8826012612e99565b6122f390600a612f96565b8460e001516123029190612c60565b90506123128460c00151826125ee565b60c084015160808501516040516340c10f1960e01b81526001600160a01b03909216916340c10f1991612349918590600401612b62565b600060405180830381600087803b15801561236357600080fd5b505af1158015612377573d6000803e3d6000fd5b5050505083608001516001600160a01b031684606001516001600160a01b03167f7ef13c4fefd7825b89456cad661f67d3969e8c54ff26aa038aa13d904b7b98b086600001518760a001518860c001518960e001516040516123fc94939291909384526001600160a01b03928316602085015291166040830152606082015260800190565b60405180910390a350505050565b60008135811a60808110156124225750600092915050565b60b881108061243d575060c0811080159061243d575060f881105b1561244b5750600192915050565b60c081101561247857612460600160b8612e99565b61246d9060ff1682612e16565b611d84906001612ca1565b612460600160f8612e99565b6000808235811a608081101561249d5760019150612520565b60b88110156124c3576124b1608082612e16565b6124bc906001612ca1565b9150612520565b60c08110156124ee576001939093019283356008602083900360b701021c810160b519019150612520565b60f8811015612502576124b160c082612e16565b6001939093019283356008602083900360f701021c810160f5190191505b5092915050565b6000610bb8826015612732565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561256157506000905060036125e5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156125b5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125de576000600192509250506125e5565b9150600090505b94509492505050565b6001600160a01b038216600090815260d3602090815260408083205460d5909252822060d2549192849261262190611103565b81526020019081526020016000205461263a9190612ca1565b11156126585760405162461bcd60e51b81526004016104ba90612cb4565b6001600160a01b038216600090815260d56020526040812060d25483929061267f90611103565b8152602001908152602001600020600082825461269c9190612ca1565b90915550506001600160a01b038216600090815260d7602090815260408083205460d9909252822060d654919284926126d490611103565b8152602001908152602001600020546126ed9190612ca1565b111561270b5760405162461bcd60e51b81526004016104ba90612ceb565b6001600160a01b038216600090815260d96020526040812060d6548392906113a390611103565b60008082118015612744575060218211155b61274d57600080fd5b60006127588461240a565b905060006127668285612e16565b94909101356020949094036008029390931c9392505050565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b6000602082840312156127d557600080fd5b5035919050565b80356001600160a01b03811681146127f357600080fd5b919050565b60006020828403121561280a57600080fd5b611d84826127dc565b6000806040838503121561282657600080fd5b61282f836127dc565b946020939093013593505050565b6000806000806080858703121561285357600080fd5b61285c856127dc565b935060208501359250612871604086016127dc565b9396929550929360600135925050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156128d4576128d4612895565b604052919050565b600067ffffffffffffffff8211156128f6576128f6612895565b50601f01601f191660200190565b6000612917612912846128dc565b6128ab565b905082815283838301111561292b57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261295357600080fd5b611d8483833560208501612904565b60008060006060848603121561297757600080fd5b612980846127dc565b9250602084013567ffffffffffffffff8082111561299d57600080fd5b6129a987838801612942565b935060408601359150808211156129bf57600080fd5b506129cc86828701612942565b9150509250925092565b6000806000606084860312156129eb57600080fd5b6129f4846127dc565b95602085013595506040909401359392505050565b600080600060608486031215612a1e57600080fd5b612a27846127dc565b925060208401359150612a3c604085016127dc565b90509250925092565b60008083601f840112612a5757600080fd5b50813567ffffffffffffffff811115612a6f57600080fd5b60208301915083602082850101111561201d57600080fd5b600080600080600060608688031215612a9f57600080fd5b853567ffffffffffffffff80821115612ab757600080fd5b612ac389838a01612a45565b90975095506020880135915080821115612adc57600080fd5b612ae889838a01612a45565b90955093506040880135915080821115612b0157600080fd5b508601601f81018813612b1357600080fd5b612b2288823560208401612904565b9150509295509295909350565b6020808252601990820152782230bb37b9a13934b233b297b4b73b30b634b216b1b430b4b760391b604082015260600190565b6001600160a01b03929092168252602082015260400190565b60005b83811015612b96578181015183820152602001612b7e565b50506000910152565b6a4461766f7342726964676560a81b815260008251612bc581600b850160208701612b7b565b91909101600b0192915050565b6bffffffffffffffffffffffff19606095861b8116825260148201949094529190931b9091166034820152604881019190915260680190565b6020808252601590820152742230bb37b9a13934b233b297b130b216b1b430b4b760591b604082015260600190565b8183823760009101908152919050565b634e487b7160e01b600052601160045260246000fd5b600082612c7d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612c9c57612c9c612c4a565b500290565b80820180821115610bb857610bb8612c4a565b6020808252601f908201527f4461766f734272696467652f73686f72742d636170732d657863656564656400604082015260600190565b6020808252601e908201527f4461766f734272696467652f6c6f6e672d636170732d65786365656465640000604082015260600190565b600060208284031215612d3457600080fd5b5051919050565b600060208284031215612d4d57600080fd5b815167ffffffffffffffff811115612d6457600080fd5b8201601f81018413612d7557600080fd5b8051612d83612912826128dc565b818152856020838501011115612d9857600080fd5b612da9826020830160208601612b7b565b95945050505050565b600060018201612dc457612dc4612c4a565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b81810381811115610bb857610bb8612c4a565b634e487b7160e01b600052602160045260246000fd5b600060208284031215612e5157600080fd5b815160ff81168114611d8457600080fd5b6020808252601d908201527f4461766f734272696467652f646563696d616c732d6f766572666c6f77000000604082015260600190565b60ff8281168282160390811115610bb857610bb8612c4a565b600181815b80851115612eed578160001904821115612ed357612ed3612c4a565b80851615612ee057918102915b93841c9390800290612eb7565b509250929050565b600082612f0457506001610bb8565b81612f1157506000610bb8565b8160018114612f275760028114612f3157612f4d565b6001915050610bb8565b60ff841115612f4257612f42612c4a565b50506001821b610bb8565b5060208310610133831016604e8410600b8410161715612f70575081810a610bb8565b612f7a8383612eb2565b8060001904821115612f8e57612f8e612c4a565b029392505050565b6000611d8460ff841683612ef556fea26469706673582212207c4ef9331cdc12a434315f6c2f5f5b328f358902a0e6de1a16251dbc4c32248764736f6c63430008100033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061018f5760003560e01c8063802503d5116100e4578063a713058711610092578063a713058714610357578063c5ea676814610382578063c7725bad14610395578063d0f48715146103a8578063d2f125b2146103bb578063e049c3a3146103ce578063f2fde38b146103f9578063fd1949911461040c57600080fd5b8063802503d5146102a45780638456cb59146102c45780638bc5d4d3146102cc5780638cc13012146102f75780638da5cb5b1461031757806390657147146103315780639805f11a1461034457600080fd5b806351ee7d271161014157806351ee7d2714610227578063570c20b71461023a5780635ac02ed01461024d5780635c975abb146102605780636701ccb514610276578063715018a6146102895780637f669d8c1461029157600080fd5b806304ee802f146101945780632d8de281146101a95780632f0de139146101c55780633e276d62146101d85780633e8e89f0146101e15780633f4ba83a146101f45780634e58469d146101fc575b600080fd5b6101a76101a23660046127c3565b61041f565b005b6101b260d65481565b6040519081526020015b60405180910390f35b6101a76101d33660046127f8565b610460565b6101b260d25481565b6101a76101ef3660046127c3565b61051a565b6101a761055b565b6101b261020a366004612813565b60d460209081526000928352604080842090915290825290205481565b6101a7610235366004612813565b61056d565b6101a7610248366004612813565b6105c5565b6101a761025b3660046127c3565b6106b7565b60655460ff1660405190151581526020016101bc565b6101a761028436600461283d565b610792565b6101a761083b565b6101a761029f366004612813565b61084d565b6101b26102b23660046127f8565b60d76020526000908152604090205481565b6101a76108a5565b6101b26102da366004612813565b60d860209081526000928352604080842090915290825290205481565b6101b26103053660046127f8565b60d36020526000908152604090205481565b6033546001600160a01b03165b6040516101bc9190612881565b6101a761033f366004612962565b6108b5565b6101a76103523660046129d6565b610a92565b6101b2610365366004612813565b60d960209081526000928352604080842090915290825290205481565b610324610390366004612813565b610b53565b6101a76103a3366004612a09565b610bbe565b6101a76103b6366004612a87565b610d01565b6101a76103c9366004612a09565b610f40565b6101b26103dc366004612813565b60d560209081526000928352604080842090915290825290205481565b6101a76104073660046127f8565b61108a565b6101b261041a3660046127c3565b611103565b61042761111a565b60d6805490829055604051829082907fc318ed6288cdf2cd1dec4feb3d48f84828f062d9b812afb65cf43135f94289ab90600090a35050565b61046861111a565b6001600160a01b0381166104c35760405162461bcd60e51b815260206004820152601b60248201527f4461766f734272696467652f696e76616c69642d61646472657373000000000060448201526064015b60405180910390fd5b60ca80546001600160a01b0319166001600160a01b0383169081179091556040517f1e2dea1ea1c691deaacf3226024b51e2b907bb9db3a24135738faf96a19b9ed09161050f91612881565b60405180910390a150565b61052261111a565b60d2805490829055604051829082907fcd5dd143ec4e58a4fd610459b592e7a0df095b56ff28113b33ef454b7be6d23590600090a35050565b61056361111a565b61056b611174565b565b61057561111a565b6001600160a01b038216600081815260d3602052604080822080549085905590519092849284927f31df6ae5b1f4d8b2d9f67caa6cde087b4f3b9e12dac0aaf9a3f27d247cd232009190a4505050565b6105cd61111a565b600081815260d060205260409020546001600160a01b0316156106325760405162461bcd60e51b815260206004820152601b60248201527f4461766f734272696467652f616c72656164792d616c6c6f776564000000000060448201526064016104ba565b600081116106525760405162461bcd60e51b81526004016104ba90612b2f565b600081815260d060205260409081902080546001600160a01b0319166001600160a01b038516179055517f10916f5c971b65b1a3f05d1a63bfc558ca4d659670f408b6de05007215f1812a906106ab9084908490612b62565b60405180910390a15050565b6106bf61111a565b600081815260d060205260409020546001600160a01b03166107155760405162461bcd60e51b815260206004820152600f60248201526e185b1c9958591e4b5c995b5bdd9959608a1b60448201526064016104ba565b600081116107355760405162461bcd60e51b81526004016104ba90612b2f565b600081815260d060205260409081902080546001600160a01b0319811690915590516001600160a01b03909116907ffc5b6fb2b8ba31620717843fd7a36a4ad996612ff9f3ece7cba2900efb43bc2b906106ab9083908590612b62565b61079a6111c0565b6107a2611219565b6107ac848261125f565b60006107b88585610b53565b6001600160a01b0316146107d7576107d2848484846113c9565b61082b565b60405162461bcd60e51b8152602060048201526024808201527f4461766f734272696467652f776172702d64657374696e6174696f6e2d756e6b6044820152633737bbb760e11b60648201526084016104ba565b6108356001609755565b50505050565b61084361111a565b61056b6000611789565b61085561111a565b6001600160a01b038216600081815260d7602052604080822080549085905590519092849284927f9879bf40436c98ee8b389ce84c33503f4494a999077f6fb7aa6c4f63de6a9adf9190a4505050565b6108ad61111a565b61056b6117db565b600054610100900460ff16158080156108d55750600054600160ff909116105b806108ef5750303b1580156108ef575060005460ff166001145b6109525760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104ba565b6000805460ff191660011790558015610975576000805461ff0019166101001790555b61097d611818565b610985611847565b61098d611876565b60ca80546001600160a01b0319166001600160a01b0386161790556040805160808101909152806109bd856118a5565b81526020016109cb846118a5565b8152602001468152602001846040516020016109e79190612b9f565b60408051808303601f190181529181528151602092830120606090811c909352835160cb559083015160cc5582015160cd55015160ce80546001600160a01b0319166001600160a01b03909216919091179055610e1060d2556201518060d6558015610835576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b610a9a61111a565b60405163898855ed60e01b8152600481018390526001600160a01b0384169063898855ed90602401600060405180830381600087803b158015610adc57600080fd5b505af1158015610af0573d6000803e3d6000fd5b5050604051630d6c7ef360e11b8152600481018490526001600160a01b0386169250631ad8fde69150602401600060405180830381600087803b158015610b3657600080fd5b505af1158015610b4a573d6000803e3d6000fd5b50505050505050565b600081815260d06020908152604080832054905160d1928492610b8692889246926001600160a01b031691899101612bd2565b60408051601f19818403018152918152815160209283012083529082019290925201600020546001600160a01b031690505b92915050565b610bc661111a565b600082815260d060205260409020546001600160a01b0316610bfa5760405162461bcd60e51b81526004016104ba90612c0b565b600082815260d060209081526040808320549051610c2a92879246926001600160a01b0390911691889101612bd2565b60408051601f198184030181529181528151602092830120600081815260d19093529120549091506001600160a01b0316610ca75760405162461bcd60e51b815260206004820152601f60248201527f4461766f734272696467652f756e6b6e6f776e2d64657374696e6174696f6e0060448201526064016104ba565b600081815260d1602052604080822080546001600160a01b0319169055516001600160a01b03848116928692918816917fbbcefea7388a2fce55f6f7bc8b8fb140e4a90100232f853b2892432748d185b89190a450505050565b610d096111c0565b610d11611219565b6004803581019060243501600080610d28836118c4565b9150915046826040015114610d935760405162461bcd60e51b815260206004820152602b60248201527f4461766f734272696467652f726563656970742d706f696e74732d746f2d616e60448201526a37ba3432b916b1b430b4b760a91b60648201526084016104ba565b6000610d9e85611ae9565b60208401519091506001600160a01b0316610e075760405162461bcd60e51b815260206004820152602360248201527f4461766f734272696467652f696e76616c69642d636f6e74726163744164647260448201526265737360e81b60648201526084016104ba565b6020808401518251600090815260d09092526040909120546001600160a01b03908116911614610e875760405162461bcd60e51b815260206004820152602560248201527f4461766f734272696467652f6576656e742d66726f6d2d756e6b6e6f776e2d62604482015264726964676560d81b60648201526084016104ba565b8787604051610e97929190612c3a565b604051908190039020835260016020820152825160c0820152610100812060ca546001600160a01b0316610ecb8289611b2d565b6001600160a01b031614610f1d5760405162461bcd60e51b81526020600482015260196024820152784461766f734272696467652f6261642d7369676e617475726560381b60448201526064016104ba565b610f2984848484611b51565b505050505050610f396001609755565b5050505050565b610f4861111a565b600082815260d060205260409020546001600160a01b0316610f7c5760405162461bcd60e51b81526004016104ba90612c0b565b600082815260d060209081526040808320549051610fac92879246926001600160a01b0390911691889101612bd2565b60408051601f198184030181529181528151602092830120600081815260d19093529120549091506001600160a01b03161561102a5760405162461bcd60e51b815260206004820152601d60248201527f4461766f734272696467652f6b6e6f776e2d64657374696e6174696f6e00000060448201526064016104ba565b600081815260d1602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915191928692918816917fe28a125d78f695ba47a84c50686b72e8157091f96188b62d21945f155ec72d479190a450505050565b61109261111a565b6001600160a01b0381166110f75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104ba565b61110081611789565b50565b6000816111108142612c60565b610bb89190612c82565b6033546001600160a01b0316331461056b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104ba565b61117c611c2e565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516111b69190612881565b60405180910390a1565b6002609754036112125760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104ba565b6002609755565b60655460ff161561056b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104ba565b6001600160a01b038216600090815260d3602090815260408083205460d4909252822060d2549192849261129290611103565b8152602001908152602001600020546112ab9190612ca1565b11156112c95760405162461bcd60e51b81526004016104ba90612cb4565b6001600160a01b038216600090815260d46020526040812060d2548392906112f090611103565b8152602001908152602001600020600082825461130d9190612ca1565b90915550506001600160a01b038216600090815260d7602090815260408083205460d8909252822060d6549192849261134590611103565b81526020019081526020016000205461135e9190612ca1565b111561137c5760405162461bcd60e51b81526004016104ba90612ceb565b6001600160a01b038216600090815260d86020526040812060d6548392906113a390611103565b815260200190815260200160002060008282546113c09190612ca1565b90915550505050565b600083815260d060205260409020546001600160a01b031661142d5760405162461bcd60e51b815260206004820152601f60248201527f4461766f734272696467652f6e6f6e2d6578697374696e672d6272696467650060448201526064016104ba565b6040516370a0823160e01b815233906000906001600160a01b038716906370a082319061145e908590600401612881565b602060405180830381865afa15801561147b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149f9190612d22565b604051632770a7eb60e21b81529091506001600160a01b03871690639dc29fac906114d09085908790600401612b62565b600060405180830381600087803b1580156114ea57600080fd5b505af11580156114fe573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b03891691506370a0823190611531908690600401612881565b602060405180830381865afa15801561154e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115729190612d22565b90508161157f8583612ca1565b146115da5760405162461bcd60e51b815260206004820152602560248201527f4461766f734272696467652f696e636f72726563742d7472616e736665722d616044820152641b5bdd5b9d60da1b60648201526084016104ba565b600060405180608001604052806116578a6001600160a01b03166395d89b416040518163ffffffff1660e01b81526004016000604051808303816000875af115801561162a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116529190810190612d3b565b6118a5565b815260200161169f8a6001600160a01b03166306fdde036040518163ffffffff1660e01b81526004016000604051808303816000875af115801561162a573d6000803e3d6000fd5b8152600060208201819052604090910181905260c98054929350906116c383612db2565b9190505550856001600160a01b0316846001600160a01b03167fbb91bc033add952080918570fb6f133f59b480190b2e57e131fb76a6cc5a605b898b6117098d8d610b53565b6117138e8c611c77565b60c954604080519586526001600160a01b03948516602080880191909152938516868201526060808701939093526080860191909152885160a08601529188015160c08501529087015160e0840152860151166101008201526101200160405180910390a35050505050505050565b6001609755565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6117e3611219565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586111a93390565b600054610100900460ff1661183f5760405162461bcd60e51b81526004016104ba90612dcb565b61056b611d8b565b600054610100900460ff1661186e5760405162461bcd60e51b81526004016104ba90612dcb565b61056b611dbb565b600054610100900460ff1661189d5760405162461bcd60e51b81526004016104ba90612dcb565b61056b611dee565b8051600090829082036118bb5750600092915050565b50506020015190565b604080516101a081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081019190915260008061194361193e856020612ca1565b611e15565b90508061194f81611e2a565b91506119648161195f8185612e16565b611e35565b6001146119b35760405162461bcd60e51b815260206004820181905260248201527f457468657265756d56657269666965723a20747820697320726576657274656460448201526064016104ba565b506119bd81611e2a565b9050806119c981611e2a565b915060006119d682611e15565b90505b82811015611a8057806119eb81611e2a565b915060006119f98783611e4a565b90506000816001811115611a0f57611a0f612e29565b14611a79576000866001811115611a2857611a28612e29565b14611a755760405162461bcd60e51b815260206004820152601f60248201527f457468657265756d56657269666965723a206d756c7469706c65206c6f67730060448201526064016104ba565b8095505b50506119d9565b6000846001811115611a9457611a94612e29565b03611ae15760405162461bcd60e51b815260206004820152601e60248201527f457468657265756d56657269666965723a206d697373696e67206c6f6773000060448201526064016104ba565b505050915091565b611af161277f565b611af961277f565b6000611b06846020612ca1565b90506020818337604081019050608081604084013760a00160208160e08401375092915050565b6000806000611b3c8585611fdf565b91509150611b4981612024565b509392505050565b600081815260cf602052604090205460ff1615611ba95760405162461bcd60e51b81526020600482015260166024820152752230bb37b9a13934b233b297bab9b2b216b83937b7b360511b60448201526064016104ba565b600081815260cf60205260409020805460ff19166001908117909155836001811115611bd757611bd7612e29565b03611beb57611be68483612169565b610835565b60405162461bcd60e51b81526020600482015260186024820152774461766f734272696467652f696e76616c69642d7479706560401b60448201526064016104ba565b60655460ff1661056b5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104ba565b60006012836001600160a01b031663313ce5676040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cdf9190612e3f565b60ff161115611d005760405162461bcd60e51b81526004016104ba90612e62565b826001600160a01b031663313ce5676040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611d40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d649190612e3f565b611d6f906012612e99565b611d7a90600a612f96565b611d849083612c82565b9392505050565b600054610100900460ff16611db25760405162461bcd60e51b81526004016104ba90612dcb565b61056b33611789565b600054610100900460ff16611de25760405162461bcd60e51b81526004016104ba90612dcb565b6065805460ff19169055565b600054610100900460ff166117825760405162461bcd60e51b81526004016104ba90612dcb565b6000611e208261240a565b610bb89083612ca1565b6000611e2082612484565b6000611e408361240a565b611d849083612e16565b600080611e5683611e15565b9050600081611e6481611e2a565b9250611e6f81612527565b915060009050808084611e8181611e2a565b9550611e8c81612484565b606514611ea25760009650505050505050610bb8565b611eab81611e15565b905060018101359350611ebd81611e2a565b905060018101356001600160a01b03169250611ed881611e2a565b905060018101356001600160a01b03169150611ef381611e2a565b9050858114611f0157600080fd5b506000611f0d86611e15565b9050611f1886611e2a565b95506000611f268288612e16565b905060007fbb91bc033add952080918570fb6f133f59b480190b2e57e131fb76a6cc5a605b8603611f5e575060019750610120611f6f565b600098505050505050505050610bb8565b808214611f8757600098505050505050505050610bb8565b50813560408b01819052611f9c602084612ca1565b9250611fa9602083612e16565b91505060a08a01818382375050506001600160a01b03938416602089015290831660608801529091166080860152505092915050565b60008082516041036120155760208301516040840151606085015160001a61200987828585612534565b9450945050505061201d565b506000905060025b9250929050565b600081600481111561203857612038612e29565b036120405750565b600181600481111561205457612054612e29565b0361209c5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016104ba565b60028160048111156120b0576120b0612e29565b036120fd5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104ba565b600381600481111561211157612111612e29565b036111005760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104ba565b60a08201516001600160a01b03166121c35760405162461bcd60e51b815260206004820152601d60248201527f4461766f734272696467652f696e76616c69642d66726f6d546f6b656e00000060448201526064016104ba565b8160a001516001600160a01b03166121e38360c001518360000151610b53565b6001600160a01b03161461224d5760405162461bcd60e51b815260206004820152602b60248201527f4461766f734272696467652f6272696467652d66726f6d2d756e6b6e6f776e2d60448201526a3232b9ba34b730ba34b7b760a91b60648201526084016104ba565b60008260c001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015612291573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b59190612e3f565b905060128160ff1611156122db5760405162461bcd60e51b81526004016104ba90612e62565b60006122e8826012612e99565b6122f390600a612f96565b8460e001516123029190612c60565b90506123128460c00151826125ee565b60c084015160808501516040516340c10f1960e01b81526001600160a01b03909216916340c10f1991612349918590600401612b62565b600060405180830381600087803b15801561236357600080fd5b505af1158015612377573d6000803e3d6000fd5b5050505083608001516001600160a01b031684606001516001600160a01b03167f7ef13c4fefd7825b89456cad661f67d3969e8c54ff26aa038aa13d904b7b98b086600001518760a001518860c001518960e001516040516123fc94939291909384526001600160a01b03928316602085015291166040830152606082015260800190565b60405180910390a350505050565b60008135811a60808110156124225750600092915050565b60b881108061243d575060c0811080159061243d575060f881105b1561244b5750600192915050565b60c081101561247857612460600160b8612e99565b61246d9060ff1682612e16565b611d84906001612ca1565b612460600160f8612e99565b6000808235811a608081101561249d5760019150612520565b60b88110156124c3576124b1608082612e16565b6124bc906001612ca1565b9150612520565b60c08110156124ee576001939093019283356008602083900360b701021c810160b519019150612520565b60f8811015612502576124b160c082612e16565b6001939093019283356008602083900360f701021c810160f5190191505b5092915050565b6000610bb8826015612732565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561256157506000905060036125e5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156125b5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166125de576000600192509250506125e5565b9150600090505b94509492505050565b6001600160a01b038216600090815260d3602090815260408083205460d5909252822060d2549192849261262190611103565b81526020019081526020016000205461263a9190612ca1565b11156126585760405162461bcd60e51b81526004016104ba90612cb4565b6001600160a01b038216600090815260d56020526040812060d25483929061267f90611103565b8152602001908152602001600020600082825461269c9190612ca1565b90915550506001600160a01b038216600090815260d7602090815260408083205460d9909252822060d654919284926126d490611103565b8152602001908152602001600020546126ed9190612ca1565b111561270b5760405162461bcd60e51b81526004016104ba90612ceb565b6001600160a01b038216600090815260d96020526040812060d6548392906113a390611103565b60008082118015612744575060218211155b61274d57600080fd5b60006127588461240a565b905060006127668285612e16565b94909101356020949094036008029390931c9392505050565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b6000602082840312156127d557600080fd5b5035919050565b80356001600160a01b03811681146127f357600080fd5b919050565b60006020828403121561280a57600080fd5b611d84826127dc565b6000806040838503121561282657600080fd5b61282f836127dc565b946020939093013593505050565b6000806000806080858703121561285357600080fd5b61285c856127dc565b935060208501359250612871604086016127dc565b9396929550929360600135925050565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156128d4576128d4612895565b604052919050565b600067ffffffffffffffff8211156128f6576128f6612895565b50601f01601f191660200190565b6000612917612912846128dc565b6128ab565b905082815283838301111561292b57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261295357600080fd5b611d8483833560208501612904565b60008060006060848603121561297757600080fd5b612980846127dc565b9250602084013567ffffffffffffffff8082111561299d57600080fd5b6129a987838801612942565b935060408601359150808211156129bf57600080fd5b506129cc86828701612942565b9150509250925092565b6000806000606084860312156129eb57600080fd5b6129f4846127dc565b95602085013595506040909401359392505050565b600080600060608486031215612a1e57600080fd5b612a27846127dc565b925060208401359150612a3c604085016127dc565b90509250925092565b60008083601f840112612a5757600080fd5b50813567ffffffffffffffff811115612a6f57600080fd5b60208301915083602082850101111561201d57600080fd5b600080600080600060608688031215612a9f57600080fd5b853567ffffffffffffffff80821115612ab757600080fd5b612ac389838a01612a45565b90975095506020880135915080821115612adc57600080fd5b612ae889838a01612a45565b90955093506040880135915080821115612b0157600080fd5b508601601f81018813612b1357600080fd5b612b2288823560208401612904565b9150509295509295909350565b6020808252601990820152782230bb37b9a13934b233b297b4b73b30b634b216b1b430b4b760391b604082015260600190565b6001600160a01b03929092168252602082015260400190565b60005b83811015612b96578181015183820152602001612b7e565b50506000910152565b6a4461766f7342726964676560a81b815260008251612bc581600b850160208701612b7b565b91909101600b0192915050565b6bffffffffffffffffffffffff19606095861b8116825260148201949094529190931b9091166034820152604881019190915260680190565b6020808252601590820152742230bb37b9a13934b233b297b130b216b1b430b4b760591b604082015260600190565b8183823760009101908152919050565b634e487b7160e01b600052601160045260246000fd5b600082612c7d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612c9c57612c9c612c4a565b500290565b80820180821115610bb857610bb8612c4a565b6020808252601f908201527f4461766f734272696467652f73686f72742d636170732d657863656564656400604082015260600190565b6020808252601e908201527f4461766f734272696467652f6c6f6e672d636170732d65786365656465640000604082015260600190565b600060208284031215612d3457600080fd5b5051919050565b600060208284031215612d4d57600080fd5b815167ffffffffffffffff811115612d6457600080fd5b8201601f81018413612d7557600080fd5b8051612d83612912826128dc565b818152856020838501011115612d9857600080fd5b612da9826020830160208601612b7b565b95945050505050565b600060018201612dc457612dc4612c4a565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b81810381811115610bb857610bb8612c4a565b634e487b7160e01b600052602160045260246000fd5b600060208284031215612e5157600080fd5b815160ff81168114611d8457600080fd5b6020808252601d908201527f4461766f734272696467652f646563696d616c732d6f766572666c6f77000000604082015260600190565b60ff8281168282160390811115610bb857610bb8612c4a565b600181815b80851115612eed578160001904821115612ed357612ed3612c4a565b80851615612ee057918102915b93841c9390800290612eb7565b509250929050565b600082612f0457506001610bb8565b81612f1157506000610bb8565b8160018114612f275760028114612f3157612f4d565b6001915050610bb8565b60ff841115612f4257612f42612c4a565b50506001821b610bb8565b5060208310610133831016604e8410600b8410161715612f70575081810a610bb8565b612f7a8383612eb2565b8060001904821115612f8e57612f8e612c4a565b029392505050565b6000611d8460ff841683612ef556fea26469706673582212207c4ef9331cdc12a434315f6c2f5f5b328f358902a0e6de1a16251dbc4c32248764736f6c63430008100033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.