Overview
APE Balance
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 7 from a total of 7 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Genesis Start Ro... | 9971348 | 9 days ago | IN | 0 APE | 0.00330812 | ||||
Unpause | 9971334 | 9 days ago | IN | 0 APE | 0.00097124 | ||||
Pause | 9971317 | 9 days ago | IN | 0 APE | 0.00090662 | ||||
Genesis Lock Rou... | 9971206 | 9 days ago | IN | 0 APE | 0.00116205 | ||||
Genesis Start Ro... | 9970724 | 9 days ago | IN | 0 APE | 0.00374281 | ||||
Unpause | 9970691 | 9 days ago | IN | 0 APE | 0.00090007 | ||||
Pause | 9970658 | 9 days ago | IN | 0 APE | 0.00090662 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ApePredictV2
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@pythnetwork/pyth-sdk-solidity/IPyth.sol"; import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol"; /** * @title ApePredict */ contract ApePredictV2 is Ownable, Pausable, ReentrancyGuard { using SafeERC20 for IERC20; IPyth public oracle; bytes32 public priceId; // Pyth price feed identifier bool public genesisLockOnce = false; bool public genesisStartOnce = false; address public adminAddress; address public operatorAddress; uint256 public bufferSeconds; uint256 public intervalSeconds; uint256 public minBetAmount; uint256 public treasuryFee; uint256 public treasuryAmount; uint256 public currentEpoch; uint256 public oracleLatestRoundId; uint256 public oracleUpdateAllowance; uint256 public constant MAX_TREASURY_FEE = 1000; // 10% mapping(uint256 => mapping(address => BetInfo)) public ledger; mapping(uint256 => Round) public rounds; mapping(address => uint256[]) public userRounds; enum Position { Bull, Bear } struct Round { uint256 epoch; uint256 startTimestamp; uint256 lockTimestamp; uint256 closeTimestamp; int256 lockPrice; int256 closePrice; uint256 lockOracleId; uint256 closeOracleId; uint256 totalAmount; uint256 bullAmount; uint256 bearAmount; uint256 rewardBaseCalAmount; uint256 rewardAmount; bool oracleCalled; } struct BetInfo { Position position; uint256 amount; bool claimed; } event BetBear(address indexed sender, uint256 indexed epoch, uint256 amount); event BetBull(address indexed sender, uint256 indexed epoch, uint256 amount); event Claim(address indexed sender, uint256 indexed epoch, uint256 amount); event EndRound(uint256 indexed epoch, uint256 indexed roundId, int256 price); event LockRound(uint256 indexed epoch, uint256 indexed roundId, int256 price); event NewAdminAddress(address admin); event NewBufferAndIntervalSeconds(uint256 bufferSeconds, uint256 intervalSeconds); event NewMinBetAmount(uint256 indexed epoch, uint256 minBetAmount); event NewTreasuryFee(uint256 indexed epoch, uint256 treasuryFee); event NewOperatorAddress(address operator); event NewOracle(address oracle, bytes32 priceId); event NewOracleUpdateAllowance(uint256 oracleUpdateAllowance); event Pause(uint256 indexed epoch); event RewardsCalculated( uint256 indexed epoch, uint256 rewardBaseCalAmount, uint256 rewardAmount, uint256 treasuryAmount ); event StartRound(uint256 indexed epoch); event TokenRecovery(address indexed token, uint256 amount); event TreasuryClaim(uint256 amount); event Unpause(uint256 indexed epoch); modifier onlyAdmin() { require(msg.sender == adminAddress, "Not admin"); _; } modifier onlyAdminOrOperator() { require(msg.sender == adminAddress || msg.sender == operatorAddress, "Not operator/admin"); _; } modifier onlyOperator() { require(msg.sender == operatorAddress, "Not operator"); _; } modifier notContract() { require(!_isContract(msg.sender), "Contract not allowed"); require(msg.sender == tx.origin, "Proxy contract not allowed"); _; } constructor( address _oracleAddress, bytes32 _priceId, address _adminAddress, address _operatorAddress, uint256 _intervalSeconds, uint256 _bufferSeconds, uint256 _minBetAmount, uint256 _oracleUpdateAllowance, uint256 _treasuryFee ) { require(_treasuryFee <= MAX_TREASURY_FEE, "Treasury fee too high"); oracle = IPyth(_oracleAddress); priceId = _priceId; adminAddress = _adminAddress; operatorAddress = _operatorAddress; intervalSeconds = _intervalSeconds; bufferSeconds = _bufferSeconds; minBetAmount = _minBetAmount; oracleUpdateAllowance = _oracleUpdateAllowance; treasuryFee = _treasuryFee; } function betBear(uint256 epoch) external payable whenNotPaused nonReentrant notContract { require(epoch == currentEpoch, "Bet is too early/late"); require(_bettable(epoch), "Round not bettable"); require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount"); require(ledger[epoch][msg.sender].amount == 0, "Can only bet once per round"); uint256 amount = msg.value; Round storage round = rounds[epoch]; round.totalAmount = round.totalAmount + amount; round.bearAmount = round.bearAmount + amount; BetInfo storage betInfo = ledger[epoch][msg.sender]; betInfo.position = Position.Bear; betInfo.amount = amount; userRounds[msg.sender].push(epoch); emit BetBear(msg.sender, epoch, amount); } function betBull(uint256 epoch) external payable whenNotPaused nonReentrant notContract { require(epoch == currentEpoch, "Bet is too early/late"); require(_bettable(epoch), "Round not bettable"); require(msg.value >= minBetAmount, "Bet amount must be greater than minBetAmount"); require(ledger[epoch][msg.sender].amount == 0, "Can only bet once per round"); uint256 amount = msg.value; Round storage round = rounds[epoch]; round.totalAmount = round.totalAmount + amount; round.bullAmount = round.bullAmount + amount; BetInfo storage betInfo = ledger[epoch][msg.sender]; betInfo.position = Position.Bull; betInfo.amount = amount; userRounds[msg.sender].push(epoch); emit BetBull(msg.sender, epoch, amount); } function claim(uint256[] calldata epochs) external nonReentrant notContract { uint256 reward; // Initializes reward for (uint256 i = 0; i < epochs.length; i++) { require(rounds[epochs[i]].startTimestamp != 0, "Round has not started"); require(block.timestamp > rounds[epochs[i]].closeTimestamp, "Round has not ended"); uint256 addedReward = 0; // Round valid, claim rewards if (rounds[epochs[i]].oracleCalled) { require(claimable(epochs[i], msg.sender), "Not eligible for claim"); Round memory round = rounds[epochs[i]]; addedReward = (ledger[epochs[i]][msg.sender].amount * round.rewardAmount) / round.rewardBaseCalAmount; } // Round invalid, refund bet amount else { require(refundable(epochs[i], msg.sender), "Not eligible for refund"); addedReward = ledger[epochs[i]][msg.sender].amount; } ledger[epochs[i]][msg.sender].claimed = true; reward += addedReward; emit Claim(msg.sender, epochs[i], addedReward); } if (reward > 0) { _safeTransferBNB(address(msg.sender), reward); } } function executeRound() external whenNotPaused onlyOperator { require( genesisStartOnce && genesisLockOnce, "Can only run after genesisStartRound and genesisLockRound is triggered" ); (uint80 currentRoundId, int256 currentPrice) = _getPriceFromOracle(); oracleLatestRoundId = uint256(currentRoundId); // CurrentEpoch refers to previous round (n-1) _safeLockRound(currentEpoch, currentRoundId, currentPrice); _safeEndRound(currentEpoch - 1, currentRoundId, currentPrice); _calculateRewards(currentEpoch - 1); // Increment currentEpoch to current round (n) currentEpoch = currentEpoch + 1; _safeStartRound(currentEpoch); } function genesisLockRound() external whenNotPaused onlyOperator { require(genesisStartOnce, "Can only run after genesisStartRound is triggered"); require(!genesisLockOnce, "Can only run genesisLockRound once"); (uint80 currentRoundId, int256 currentPrice) = _getPriceFromOracle(); oracleLatestRoundId = uint256(currentRoundId); _safeLockRound(currentEpoch, currentRoundId, currentPrice); currentEpoch = currentEpoch + 1; _startRound(currentEpoch); genesisLockOnce = true; } function genesisStartRound() external whenNotPaused onlyOperator { require(!genesisStartOnce, "Can only run genesisStartRound once"); currentEpoch = currentEpoch + 1; _startRound(currentEpoch); genesisStartOnce = true; } function pause() external whenNotPaused onlyAdminOrOperator { _pause(); emit Pause(currentEpoch); } function unpause() external whenPaused onlyAdminOrOperator { genesisStartOnce = false; genesisLockOnce = false; _unpause(); emit Unpause(currentEpoch); } function claimTreasury() external nonReentrant onlyAdmin { uint256 currentTreasuryAmount = treasuryAmount; treasuryAmount = 0; _safeTransferBNB(adminAddress, currentTreasuryAmount); emit TreasuryClaim(currentTreasuryAmount); } function setBufferAndIntervalSeconds(uint256 _bufferSeconds, uint256 _intervalSeconds) external whenPaused onlyAdmin { require(_bufferSeconds < _intervalSeconds, "bufferSeconds must be inferior to intervalSeconds"); bufferSeconds = _bufferSeconds; intervalSeconds = _intervalSeconds; emit NewBufferAndIntervalSeconds(_bufferSeconds, _intervalSeconds); } function setMinBetAmount(uint256 _minBetAmount) external whenPaused onlyAdmin { require(_minBetAmount != 0, "Must be superior to 0"); minBetAmount = _minBetAmount; emit NewMinBetAmount(currentEpoch, minBetAmount); } function setOperator(address _operatorAddress) external onlyAdmin { require(_operatorAddress != address(0), "Cannot be zero address"); operatorAddress = _operatorAddress; emit NewOperatorAddress(_operatorAddress); } function setOracle(address _oracle, bytes32 _priceId) external whenPaused onlyAdmin { require(_oracle != address(0), "Cannot be zero address"); oracle = IPyth(_oracle); priceId = _priceId; oracleLatestRoundId = 0; // Dummy check to make sure the interface works oracle.getPrice(priceId); emit NewOracle(_oracle, _priceId); } function setOracleUpdateAllowance(uint256 _oracleUpdateAllowance) external whenPaused onlyAdmin { oracleUpdateAllowance = _oracleUpdateAllowance; emit NewOracleUpdateAllowance(_oracleUpdateAllowance); } function setTreasuryFee(uint256 _treasuryFee) external whenPaused onlyAdmin { require(_treasuryFee <= MAX_TREASURY_FEE, "Treasury fee too high"); treasuryFee = _treasuryFee; emit NewTreasuryFee(currentEpoch, treasuryFee); } function recoverToken(address _token, uint256 _amount) external onlyOwner { IERC20(_token).safeTransfer(address(msg.sender), _amount); emit TokenRecovery(_token, _amount); } function setAdmin(address _adminAddress) external onlyOwner { require(_adminAddress != address(0), "Cannot be zero address"); adminAddress = _adminAddress; emit NewAdminAddress(_adminAddress); } function getUserRounds( address user, uint256 cursor, uint256 size ) external view returns ( uint256[] memory, BetInfo[] memory, uint256 ) { uint256 length = size; if (length > userRounds[user].length - cursor) { length = userRounds[user].length - cursor; } uint256[] memory values = new uint256[](length); BetInfo[] memory betInfo = new BetInfo[](length); for (uint256 i = 0; i < length; i++) { values[i] = userRounds[user][cursor + i]; betInfo[i] = ledger[values[i]][user]; } return (values, betInfo, cursor + length); } function getUserRoundsLength(address user) external view returns (uint256) { return userRounds[user].length; } function claimable(uint256 epoch, address user) public view returns (bool) { BetInfo memory betInfo = ledger[epoch][user]; Round memory round = rounds[epoch]; if (round.lockPrice == round.closePrice) { return false; } return round.oracleCalled && betInfo.amount != 0 && !betInfo.claimed && ((round.closePrice > round.lockPrice && betInfo.position == Position.Bull) || (round.closePrice < round.lockPrice && betInfo.position == Position.Bear)); } function refundable(uint256 epoch, address user) public view returns (bool) { BetInfo memory betInfo = ledger[epoch][user]; Round memory round = rounds[epoch]; return !round.oracleCalled && !betInfo.claimed && block.timestamp > round.closeTimestamp + bufferSeconds && betInfo.amount != 0; } function _calculateRewards(uint256 epoch) internal { require(rounds[epoch].rewardBaseCalAmount == 0 && rounds[epoch].rewardAmount == 0, "Rewards calculated"); Round storage round = rounds[epoch]; uint256 rewardBaseCalAmount; uint256 treasuryAmt; uint256 rewardAmount; // Bull wins if (round.closePrice > round.lockPrice) { rewardBaseCalAmount = round.bullAmount; treasuryAmt = (round.totalAmount * treasuryFee) / 10000; rewardAmount = round.totalAmount - treasuryAmt; } // Bear wins else if (round.closePrice < round.lockPrice) { rewardBaseCalAmount = round.bearAmount; treasuryAmt = (round.totalAmount * treasuryFee) / 10000; rewardAmount = round.totalAmount - treasuryAmt; } // House wins else { rewardBaseCalAmount = 0; rewardAmount = 0; treasuryAmt = round.totalAmount; } round.rewardBaseCalAmount = rewardBaseCalAmount; round.rewardAmount = rewardAmount; // Add to treasury treasuryAmount += treasuryAmt; emit RewardsCalculated(epoch, rewardBaseCalAmount, rewardAmount, treasuryAmt); } function _safeEndRound( uint256 epoch, uint256 roundId, int256 price ) internal { require(rounds[epoch].lockTimestamp != 0, "Can only end round after round has locked"); require(block.timestamp >= rounds[epoch].closeTimestamp, "Can only end round after closeTimestamp"); require( block.timestamp <= rounds[epoch].closeTimestamp + bufferSeconds, "Can only end round within bufferSeconds" ); Round storage round = rounds[epoch]; round.closePrice = price; round.closeOracleId = roundId; round.oracleCalled = true; emit EndRound(epoch, roundId, round.closePrice); } function _safeLockRound( uint256 epoch, uint256 roundId, int256 price ) internal { require(rounds[epoch].startTimestamp != 0, "Can only lock round after round has started"); require(block.timestamp >= rounds[epoch].lockTimestamp, "Can only lock round after lockTimestamp"); require( block.timestamp <= rounds[epoch].lockTimestamp + bufferSeconds, "Can only lock round within bufferSeconds" ); Round storage round = rounds[epoch]; round.closeTimestamp = block.timestamp + intervalSeconds; round.lockPrice = price; round.lockOracleId = roundId; emit LockRound(epoch, roundId, round.lockPrice); } function _safeStartRound(uint256 epoch) internal { require(genesisStartOnce, "Can only run after genesisStartRound is triggered"); require(rounds[epoch - 2].closeTimestamp != 0, "Can only start round after round n-2 has ended"); require( block.timestamp >= rounds[epoch - 2].closeTimestamp, "Can only start new round after round n-2 closeTimestamp" ); _startRound(epoch); } function _safeTransferBNB(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(""); require(success, "TransferHelper: BNB_TRANSFER_FAILED"); } function _startRound(uint256 epoch) internal { Round storage round = rounds[epoch]; round.startTimestamp = block.timestamp; round.lockTimestamp = block.timestamp + intervalSeconds; round.closeTimestamp = block.timestamp + (2 * intervalSeconds); round.epoch = epoch; round.totalAmount = 0; emit StartRound(epoch); } function _bettable(uint256 epoch) internal view returns (bool) { return rounds[epoch].startTimestamp != 0 && rounds[epoch].lockTimestamp != 0 && block.timestamp > rounds[epoch].startTimestamp && block.timestamp < rounds[epoch].lockTimestamp; } function _getPriceFromOracle() internal view returns (uint80, int256) { PythStructs.Price memory price = oracle.getPriceNoOlderThan( priceId, oracleUpdateAllowance ); // Check price is not from the future require( uint256(price.publishTime) <= block.timestamp, "Oracle price timestamp is from the future" ); require( uint256(price.publishTime) > oracleLatestRoundId, "Oracle update roundId must be larger than oracleLatestRoundId" ); return (uint80(price.publishTime), price.price); } function _isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.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 Pausable is Context { /** * @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. */ constructor() { _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()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./PythStructs.sol"; import "./IPythEvents.sol"; /// @title Consume prices from the Pyth Network (https://pyth.network/). /// @dev Please refer to the guidance at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how to consume prices safely. /// @author Pyth Data Association interface IPyth is IPythEvents { /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time function getValidTimePeriod() external view returns (uint validTimePeriod); /// @notice Returns the price and confidence interval. /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds. /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price and confidence interval. /// @dev Reverts if the EMA price is not available. /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price of a price feed without any sanity checks. /// @dev This function returns the most recent price update in this contract without any recency checks. /// This function is unsafe as the returned price update may be arbitrarily far in the past. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price that is no older than `age` seconds of the current time. /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks. /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available. /// However, if the price is not recent this function returns the latest available price. /// /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that /// the returned price is recent or useful for any particular application. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds /// of the current time. /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Update price feeds with given update messages. /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// Prices will be updated if they are more recent than the current stored prices. /// The call will succeed even if the update is not the most recent. /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. function updatePriceFeeds(bytes[] calldata updateData) external payable; /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas. /// Otherwise, it calls updatePriceFeeds method to update the prices. /// /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]` function updatePriceFeedsIfNecessary( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64[] calldata publishTimes ) external payable; /// @notice Returns the required fee to update an array of price updates. /// @param updateData Array of price update data. /// @return feeAmount The required fee in Wei. function getUpdateFee( bytes[] calldata updateData ) external view returns (uint feeAmount); /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published /// within `minPublishTime` and `maxPublishTime`. /// /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price; /// otherwise, please consider using `updatePriceFeeds`. This method may store the price updates on-chain, if they /// are more recent than the current stored prices. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is /// no update for any of the given `priceIds` within the given time range. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`. /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`. /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order). function parsePriceFeedUpdates( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds); /// @notice Similar to `parsePriceFeedUpdates` but ensures the updates returned are /// the first updates published in minPublishTime. That is, if there are multiple updates for a given timestamp, /// this method will return the first update. This method may store the price updates on-chain, if they /// are more recent than the current stored prices. /// /// /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is /// no update for any of the given `priceIds` within the given time range and uniqueness condition. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`. /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`. /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order). function parsePriceFeedUpdatesUnique( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @title IPythEvents contains the events that Pyth contract emits. /// @dev This interface can be used for listening to the updates for off-chain and testing purposes. interface IPythEvents { /// @dev Emitted when the price feed with `id` has received a fresh update. /// @param id The Pyth Price Feed ID. /// @param publishTime Publish time of the given price update. /// @param price Price of the given price update. /// @param conf Confidence interval of the given price update. event PriceFeedUpdate( bytes32 indexed id, uint64 publishTime, int64 price, uint64 conf ); /// @dev Emitted when a batch price update is processed successfully. /// @param chainId ID of the source chain that the batch price update comes from. /// @param sequenceNumber Sequence number of the batch price update. event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; contract PythStructs { // A price with a degree of uncertainty, represented as a price +- a confidence interval. // // The confidence interval roughly corresponds to the standard error of a normal distribution. // Both the price and confidence are stored in a fixed-point numeric representation, // `x * (10^expo)`, where `expo` is the exponent. // // Please refer to the documentation at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how // to how this price safely. struct Price { // Price int64 price; // Confidence interval around the price uint64 conf; // Price exponent int32 expo; // Unix timestamp describing when the price was published uint publishTime; } // PriceFeed represents a current aggregate price from pyth publisher feeds. struct PriceFeed { // The price ID. bytes32 id; // Latest available price Price price; // Latest available exponentially-weighted moving average price Price emaPrice; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_oracleAddress","type":"address"},{"internalType":"bytes32","name":"_priceId","type":"bytes32"},{"internalType":"address","name":"_adminAddress","type":"address"},{"internalType":"address","name":"_operatorAddress","type":"address"},{"internalType":"uint256","name":"_intervalSeconds","type":"uint256"},{"internalType":"uint256","name":"_bufferSeconds","type":"uint256"},{"internalType":"uint256","name":"_minBetAmount","type":"uint256"},{"internalType":"uint256","name":"_oracleUpdateAllowance","type":"uint256"},{"internalType":"uint256","name":"_treasuryFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBear","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BetBull","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"price","type":"int256"}],"name":"EndRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"price","type":"int256"}],"name":"LockRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"NewAdminAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bufferSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"intervalSeconds","type":"uint256"}],"name":"NewBufferAndIntervalSeconds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minBetAmount","type":"uint256"}],"name":"NewMinBetAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"NewOperatorAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"},{"indexed":false,"internalType":"bytes32","name":"priceId","type":"bytes32"}],"name":"NewOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oracleUpdateAllowance","type":"uint256"}],"name":"NewOracleUpdateAllowance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryFee","type":"uint256"}],"name":"NewTreasuryFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"treasuryAmount","type":"uint256"}],"name":"RewardsCalculated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"StartRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenRecovery","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TreasuryClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_TREASURY_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"betBear","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"betBull","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"bufferSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"epochs","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"claimable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executeRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genesisLockOnce","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"genesisLockRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genesisStartOnce","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"genesisStartRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"cursor","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"name":"getUserRounds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"components":[{"internalType":"enum ApePredictV2.Position","name":"position","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"internalType":"struct ApePredictV2.BetInfo[]","name":"","type":"tuple[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserRoundsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"intervalSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"ledger","outputs":[{"internalType":"enum ApePredictV2.Position","name":"position","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"claimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBetAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IPyth","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleLatestRoundId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleUpdateAllowance","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":[],"name":"priceId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"recoverToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"refundable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rounds","outputs":[{"internalType":"uint256","name":"epoch","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"lockTimestamp","type":"uint256"},{"internalType":"uint256","name":"closeTimestamp","type":"uint256"},{"internalType":"int256","name":"lockPrice","type":"int256"},{"internalType":"int256","name":"closePrice","type":"int256"},{"internalType":"uint256","name":"lockOracleId","type":"uint256"},{"internalType":"uint256","name":"closeOracleId","type":"uint256"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"uint256","name":"bullAmount","type":"uint256"},{"internalType":"uint256","name":"bearAmount","type":"uint256"},{"internalType":"uint256","name":"rewardBaseCalAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"bool","name":"oracleCalled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_adminAddress","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bufferSeconds","type":"uint256"},{"internalType":"uint256","name":"_intervalSeconds","type":"uint256"}],"name":"setBufferAndIntervalSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minBetAmount","type":"uint256"}],"name":"setMinBetAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operatorAddress","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"bytes32","name":"_priceId","type":"bytes32"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_oracleUpdateAllowance","type":"uint256"}],"name":"setOracleUpdateAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_treasuryFee","type":"uint256"}],"name":"setTreasuryFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userRounds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60803461019f57601f612ffe38819003918201601f19168301916001600160401b038311848410176101a4578084926101209460405283398101031261019f57610048816101ba565b9060208101519161005b604083016101ba565b90610068606084016101ba565b60808401519060a08501519260c08601519461010060e08801519701519760005492604051933360018060a01b0382167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a36001600160a81b0319163360ff60a01b19161760005560018055600454936103e88b1161015d5750600280546001600160a01b03199081166001600160a01b03938416179091556003929092556001600160b01b031990931660109290921b62010000600160b01b0316919091176004556005805490911692909116919091179055600755600655600855600d55600955604051612e2f90816101cf8239f35b62461bcd60e51b815260206004820152601560248201527f54726561737572792066656520746f6f206869676800000000000000000000006044820152606490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361019f5756fe6080604052600436101561001257600080fd5b60003560e01c80623bdc7414611e9b5780630f74174f14611e78578063127effb214611e4f5780631975f05914611d4b578063273867d414611d115780633118933414611cf3578063368acb0914611cd55780633f4ba83a14611c14578063452fd75a14611b5c57806357fb096f14611a3e5780635c975abb14611a1857806360554011146119fa5780636ba4c138146115ff5780636c18859314611554578063704b6c02146114ca578063715018a6146114715780637285c58b1461140557806376671808146113e757806377e741c7146113395780637b3205f514610e015780637bf4125414610ddb5780637d1cd04f14610dbd5780637dc0d1d014610d945780638456cb5914610cd2578063890dc76614610bfa5780638c65c81f14610b365780638da5cb5b14610b0d578063951fd600146108a0578063a0c7f71c14610870578063aa6b873a1461074b578063b29a8140146105e2578063b3ab15fb1461055f578063cc32d17614610541578063cf2f5039146104dd578063d9d55eac146103e3578063dd1f75961461038a578063eaba23611461036c578063ec3247031461034e578063f2b3c80914610331578063f2fde38b1461026a578063f7fdec2814610244578063fa968eea146102265763fc6f9468146101f457600080fd5b346102215760003660031901126102215760045460405160109190911c6001600160a01b03168152602090f35b600080fd5b34610221576000366003190112610221576020600854604051908152f35b3461022157600036600319011261022157602060ff60045460081c166040519015158152f35b3461022157602036600319011261022157610283611f12565b61028b6129c8565b6001600160a01b031680156102dd57600080546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b346102215760003660031901126102215760206040516103e88152f35b34610221576000366003190112610221576020600c54604051908152f35b34610221576000366003190112610221576020600654604051908152f35b34610221576040366003190112610221576103a3611f12565b6001600160a01b0316600090815260106020526040902080546024359190821015610221576020916103d491611f4b565b90549060031b1c604051908152f35b34610221576000366003190112610221576103fc61288c565b61041160018060a01b0360055416331461213b565b60ff600454610424828260081c166126da565b1661048d5761044d69ffffffffffffffffffff61043f612a20565b911680600c55600b54612b7a565b600b5460018101809111610477578061046891600b556128d3565b6004805460ff19166001179055005b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f43616e206f6e6c792072756e2067656e657369734c6f636b526f756e64206f6e604482015261636560f01b6064820152608490fd5b34610221576020366003190112610221577f93ccaceac092ffb842c46b8718667a13a80e9058dcd0bd403d0b47215b30da07602060043561051c612840565b61053460018060a01b0360045460101c163314611f79565b80600d55604051908152a1005b34610221576000366003190112610221576020600954604051908152f35b34610221576020366003190112610221577fc47d127c07bdd56c5ccba00463ce3bd3c1bca71b4670eea6e5d0c02e4aa156e2602061059b611f12565b6105b360018060a01b0360045460101c163314611f79565b6001600160a01b03166105c7811515611fb1565b600580546001600160a01b03191682179055604051908152a1005b34610221576040366003190112610221576105fb611f12565b602435906106076129c8565b60018060a01b031690604051610692602082019163a9059cbb60e01b835233602482015283604482015260448152610640606482612045565b6000806040948551936106538786612045565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020860152519082895af161068b612796565b9086612d29565b8051908115918215610728575b5050156106d2577f14f11966a996e0629572e51064726d2057a80fbd34efc066682c06a71dbb6e989160209151908152a2005b5162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b81925090602091810103126102215760200151801515810361022157848061069f565b60203660031901126102215760043561076261288c565b61076a612740565b610775333b15612183565b6107803233146121c6565b61078d600b548214612212565b61079e6107998261294e565b612256565b6107ac600854341015612297565b6000818152600e602090815260408083203384529091529020600101546107d390156122f8565b80600052600f602052600a6040600020600881016107f2348254612176565b905501610800348254612176565b90556000818152600e602090815260408083203384528252808320805460ff191660019081178255349101556010909152902061083e908290612344565b6040513481527f0d8c1fe3e67ab767116a81f122b83c2557a8c2564019cb7c4f83de1aeb1f1f0d60203392a360018055005b3461022157604036600319011261022157602061089661088e611f28565b600435612525565b6040519015158152f35b34610221576060366003190112610221576108b9611f12565b6001600160a01b031660008181526010602052604090205460243591604435916108e49084906123a1565b8211610aed575b6108f4826124f9565b916109026040519384612045565b80835261090e816124f9565b602084019490601f1901368637610924826124f9565b926109326040519485612045565b828452601f19610941846124f9565b0160005b818110610ac157505060005b838110610a005750509061096491612176565b604051926060840190606085525180915260808401949060005b8181106109ea5750505082840360208401526020808351958681520192016000945b8086106109b557505082935060408301520390f35b909260206060600192604087516109cd838251611f3e565b8481015185840152015115156040820152019401950194906109a0565b825187526020968701969092019160010161097e565b816000526010602052610a216040600020610a1b8386612176565b90611f4b565b90549060031b1c610a328288612511565b52610a3d8187612511565b51600052600e6020526040806000206000908482526020522090604051610a6381612029565b60ff835416926002841015610aab57600260ff91600195845285810154602085015201541615156040820152610a998288612511565b52610aa48187612511565b5001610951565b634e487b7160e01b600052602160045260246000fd5b602090604051610ad081612029565b600081526000838201526000604082015282828901015201610945565b8091506000526010602052610b07826040600020546123a1565b906108eb565b34610221576000366003190112610221576000546040516001600160a01b039091168152602090f35b3461022157602036600319011261022157600435600052600f6020526101c0604060002080549060018101549060028101546003820154600483015460058401546006850154600786015490600887015492600988015494600a89015496600b8a01549860ff600d600c8d01549c0154169b60206040519e8f908152015260408d015260608c015260808b015260a08a015260c089015260e088015261010087015261012086015261014085015261016084015261018083015215156101a0820152f35b3461022157604036600319011261022157600435602435610c19612840565b610c3160018060a01b0360045460101c163314611f79565b80821015610c7357816040917fe60149e0431fec12df63dfab5fce2a9cefe9a4d3df5f41cb626f579ae1f2b91a936006558060075582519182526020820152a1005b60405162461bcd60e51b815260206004820152603160248201527f6275666665725365636f6e6473206d75737420626520696e666572696f7220746044820152706f20696e74657276616c5365636f6e647360781b6064820152608490fd5b3461022157600036600319011261022157610ceb61288c565b6004543360109190911c6001600160a01b0316148015610d80575b610d0f906120fa565b610d1761288c565b6000805460ff60a01b1916600160a01b1790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602090a1600b547f68b095021b1f40fe513109f513c66692f0b3219aee674a69f4efc57badb8201d600080a2005b506005546001600160a01b03163314610d06565b34610221576000366003190112610221576002546040516001600160a01b039091168152602090f35b34610221576000366003190112610221576020600754604051908152f35b34610221576040366003190112610221576020610896610df9611f28565b6004356123ae565b3461022157600036600319011261022157610e1a61288c565b610e2f60018060a01b0360055416331461213b565b60045460ff8160081c16908161132e575b50156112b45769ffffffffffffffffffff610e59612a20565b91169081600c55610e6d8183600b54612b7a565b600b546000198101919082116104775781600052600f6020526002604060002001541561125d5781600052600f60205260036040600020015442106112085781600052600f602052610eca60036040600020015460065490612176565b42116111b35760207fb6ff1fe915db84788cbbbc017f0d2bef9485fad9fd0bd8ce9340fde0d8410dd89183600052600f8252600d604060002082600582015586600782015501600160ff19825416179055604051908152a3600b5460001981019081116104775780600052600f602052600b60406000200154158061119a575b156111605780600052600f6020527f6dfdfcb09c8804d0058826cd2539f1acfbe3cb887c9be03d928035bce0f1a58d606060406000206000600582015460048301549081811360001461112057505050600981015490600c600882015491610fc2612710610fba6009548661238e565b0480946123a1565b9182915b85600b8201550155610fda82600a54612176565b600a5560405192835260208301526040820152a2600b5460018101908181116104775781600b5561101260ff60045460081c166126da565b60001901908082116104775781600052600f602052600360406000200154156110c4576000918252600f6020526003604083200154421061105957611056906128d3565b80f35b60405162461bcd60e51b815260206004820152603760248201527f43616e206f6e6c79207374617274206e657720726f756e64206166746572207260448201527f6f756e64206e2d3220636c6f736554696d657374616d700000000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152602e60248201527f43616e206f6e6c7920737461727420726f756e6420616674657220726f756e6460448201526d081b8b4c881a185cc8195b99195960921b6064820152608490fd5b121561114f5750600a81015490600c600882015491611147612710610fba6009548661238e565b918291610fc6565b90600080600c600884015493610fc6565b60405162461bcd60e51b815260206004820152601260248201527114995dd85c991cc818d85b18dd5b185d195960721b6044820152606490fd5b5080600052600f602052600c6040600020015415610f4a565b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e642077697468696e206275666665726044820152665365636f6e647360c81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e6420616674657220636c6f7365546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f43616e206f6e6c7920656e6420726f756e6420616674657220726f756e642068604482015268185cc81b1bd8dad95960ba1b6064820152608490fd5b60405162461bcd60e51b815260206004820152604660248201527f43616e206f6e6c792072756e2061667465722067656e6573697353746172745260448201527f6f756e6420616e642067656e657369734c6f636b526f756e642069732074726960648201526519d9d95c995960d21b608482015260a490fd5b60ff91501681610e40565b3461022157602036600319011261022157600435611355612840565b61136d60018060a01b0360045460101c163314611f79565b6103e881116113aa57806009557fb1c4ee38d35556741133da7ff9b6f7ab0fa88d0406133126ff128f635490a8576020600b5492604051908152a2005b60405162461bcd60e51b81526020600482015260156024820152740a8e4cac2e6eae4f240cccaca40e8dede40d0d2ced605b1b6044820152606490fd5b34610221576000366003190112610221576020600b54604051908152f35b346102215760403660031901126102215760606040611422611f28565b600435600052600e6020528160002060009160018060a01b031682526020522060ff8154169060ff6002600183015492015416906114636040518094611f3e565b602083015215156040820152f35b346102215760003660031901126102215761148a6129c8565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610221576020366003190112610221577f137b621413925496477d46e5055ac0d56178bdd724ba8bf843afceef18268ba36020611506611f12565b61150e6129c8565b6001600160a01b03811690611524821515611fb1565b6004805462010000600160b01b03191660109290921b62010000600160b01b0316919091179055604051908152a1005b3461022157602036600319011261022157600435611570612840565b61158860018060a01b0360045460101c163314611f79565b80156115c257806008557f90eb87c560a0213754ceb3a7fa3012f01acab0a35602c1e1995adf69dabc9d506020600b5492604051908152a2005b60405162461bcd60e51b815260206004820152601560248201527404d757374206265207375706572696f7220746f203605c1b6044820152606490fd5b346102215760203660031901126102215760043567ffffffffffffffff8111610221573660238201121561022157806004013567ffffffffffffffff8111610221576024820191602436918360051b0101116102215761165d612740565b611668333b15612183565b6116733233146121c6565b6000913390835b83811061169e57848061168e575b60018055005b61169890336127d6565b80611688565b6116a981858461237e565b35600052600f602052600160406000200154156119bd576116cb81858461237e565b35600052600f6020526003604060002001544211156119825760006116f182868561237e565b358152600f60205260408120600d015460ff16156118f3575061171f3361171983878661237e565b35612525565b156118b55761172f81858461237e565b35600052600f60205260406000206118136040519161174d83611ff6565b8054835260018101546020840152600281015460408401526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b8101549261016081019384526101a060ff600d600c85015494610180850195865201541615159101526117ee84888761237e565b35600052600e602052600160408060002060009089825260205220015490519061238e565b905190600082156118a1575060019291611861910480975b61183684898861237e565b35600052600e60205260026040806000206000908a825260205220018560ff19825416179055612176565b9561186d82878661237e565b35906040519081527f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf760203392a30161167a565b634e487b7160e01b81526012600452602490fd5b60405162461bcd60e51b81526020600482015260166024820152754e6f7420656c696769626c6520666f7220636c61696d60501b6044820152606490fd5b906119093361190383888761237e565b356123ae565b1561193d57611861600160408194611922858a8961237e565b358152600e602052818120888252602052200154809761182b565b60405162461bcd60e51b815260206004820152601760248201527f4e6f7420656c696769626c6520666f7220726566756e640000000000000000006044820152606490fd5b60405162461bcd60e51b8152602060048201526013602482015272149bdd5b99081a185cc81b9bdd08195b991959606a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526015602482015274149bdd5b99081a185cc81b9bdd081cdd185c9d1959605a1b6044820152606490fd5b34610221576000366003190112610221576020600d54604051908152f35b3461022157600036600319011261022157602060ff60005460a01c166040519015158152f35b602036600319011261022157600435611a5561288c565b611a5d612740565b611a68333b15612183565b611a733233146121c6565b611a80600b548214612212565b611a8c6107998261294e565b611a9a600854341015612297565b6000818152600e60209081526040808320338452909152902060010154611ac190156122f8565b80600052600f6020526009604060002060088101611ae0348254612176565b905501611aee348254612176565b90556000818152600e602090815260408083203384528252808320805460ff191681553460019091015560109091529020611b2a908290612344565b6040513481527f438122d8cff518d18388099a5181f0d17a12b4f1b55faedf6e4a6acee0060c1260203392a360018055005b3461022157600036600319011261022157611b7561288c565b611b8a60018060a01b0360055416331461213b565b60ff60045460081c16611bc357600b54600181018091116104775780611bb291600b556128d3565b6004805461ff001916610100179055005b60405162461bcd60e51b815260206004820152602360248201527f43616e206f6e6c792072756e2067656e657369735374617274526f756e64206f6044820152626e636560e81b6064820152608490fd5b3461022157600036600319011261022157611c2d612840565b60045433601082901c6001600160a01b0316148015611cc1575b611c50906120fa565b61ffff1916600455611c60612840565b60ff60a01b19600054166000557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1600b547faaa520fdd7d2c83061d632fa017b0432407e798818af63ea908589fceda39ab7600080a2005b506005546001600160a01b03163314611c47565b34610221576000366003190112610221576020600a54604051908152f35b34610221576000366003190112610221576020600354604051908152f35b34610221576020366003190112610221576001600160a01b03611d32611f12565b1660005260106020526020604060002054604051908152f35b3461022157604036600319011261022157611d64611f12565b60243590611d70612840565b611d8860018060a01b0360045460101c163314611f79565b6001600160a01b031690611d9d821515611fb1565b600280546001600160a01b0319168317905560038190556000600c556040516331d98b3f60e01b81526004810182905291608083602481845afa918215611e43577ffe2deee4fd77d1a02c8c3a0f0bf4a3954722c1a30fefc67a6890092c5947add593604093611e16575b5082519182526020820152a1005b611e379060803d608011611e3c575b611e2f8183612045565b810190612067565b611e08565b503d611e25565b6040513d6000823e3d90fd5b34610221576000366003190112610221576005546040516001600160a01b039091168152602090f35b3461022157600036600319011261022157602060ff600454166040519015158152f35b3461022157600036600319011261022157611eb4612740565b6004547fb9197c6b8e21274bd1e2d9c956a88af5cfee510f630fab3f046300f88b4223619060209060101c6001600160a01b0316611ef3338214611f79565b611f05600a5480926000600a556127d6565b604051908152a160018055005b600435906001600160a01b038216820361022157565b602435906001600160a01b038216820361022157565b906002821015610aab5752565b8054821015611f635760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b15611f8057565b60405162461bcd60e51b81526020600482015260096024820152682737ba1030b236b4b760b91b6044820152606490fd5b15611fb857565b60405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606490fd5b6101c0810190811067ffffffffffffffff82111761201357604052565b634e487b7160e01b600052604160045260246000fd5b6060810190811067ffffffffffffffff82111761201357604052565b90601f8019910116810190811067ffffffffffffffff82111761201357604052565b90816080910312610221576040519060006080830167ffffffffffffffff8111848210176120e65760405281518060070b81036120e2578352602082015167ffffffffffffffff811681036120e25760208401526040820151908160030b82036120df57509060609160408401520151606082015290565b80fd5b5080fd5b634e487b7160e01b82526041600452602482fd5b1561210157565b60405162461bcd60e51b81526020600482015260126024820152712737ba1037b832b930ba37b917b0b236b4b760711b6044820152606490fd5b1561214257565b60405162461bcd60e51b815260206004820152600c60248201526b2737ba1037b832b930ba37b960a11b6044820152606490fd5b9190820180921161047757565b1561218a57565b60405162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081b9bdd08185b1b1bddd95960621b6044820152606490fd5b156121cd57565b60405162461bcd60e51b815260206004820152601a60248201527f50726f787920636f6e7472616374206e6f7420616c6c6f7765640000000000006044820152606490fd5b1561221957565b60405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606490fd5b1561225d57565b60405162461bcd60e51b8152602060048201526012602482015271526f756e64206e6f74206265747461626c6560701b6044820152606490fd5b1561229e57565b60405162461bcd60e51b815260206004820152602c60248201527f42657420616d6f756e74206d7573742062652067726561746572207468616e2060448201526b1b5a5b90995d105b5bdd5b9d60a21b6064820152608490fd5b156122ff57565b60405162461bcd60e51b815260206004820152601b60248201527f43616e206f6e6c7920626574206f6e63652070657220726f756e6400000000006044820152606490fd5b8054680100000000000000008110156120135761236691600182018155611f4b565b819291549060031b91821b91600019901b1916179055565b9190811015611f635760051b0190565b8181029291811591840414171561047757565b9190820391821161047757565b9060409082600052600e6020528160002060009160018060a01b0316825260205220604051916123dd83612029565b60ff8254166002811015610aab578352604060ff60026001850154946020870195865201541693019215158352600052600f60205260406000206040519261242484611ff6565b81548452600182015460208501526002820154604085015260ff600d60038401549384606088015260048101546080880152600581015460a0880152600681015460c0880152600781015460e088015260088101546101008801526009810154610120880152600a810154610140880152600b810154610160880152600c81015461018088015201541615936101a08515910152836124ef575b50826124d7575b50816124cf575090565b905051151590565b6124e691925060065490612176565b421190386124c5565b51159250386124be565b67ffffffffffffffff81116120135760051b60200190565b8051821015611f635760209160051b010190565b6000818152600e602090815260408083206001600160a01b039095168352939052829020915161255481612029565b60ff835416926002841015610aab576101a093825260ff60026001830154926020850193845201541692604083019315158452600052600f6020526040600020926040516125a181611ff6565b84548152600185015460208201526002850154604082015260038501546060820152600485015491608082019383855260058701549260ff600d60a0830199868b52600681015460c0850152600781015460e085015260088101546101008501526009810154610120850152600a810154610140850152600b810154610160850152600c810154610180850152015416151598899101528284146126cd57876126c2575b50866126b8575b508561265b575b505050505090565b1393509091836126a4575b831561267a575b5050503880808080612653565b5190511391508161268f575b5038808061266d565b9050516002811015610aab5760011438612686565b925081516002811015610aab571592612666565b511595503861264c565b511515965038612645565b5050505050505050600090565b156126e157565b60405162461bcd60e51b815260206004820152603160248201527f43616e206f6e6c792072756e2061667465722067656e657369735374617274526044820152701bdd5b99081a5cc81d1c9a59d9d95c9959607a1b6064820152608490fd5b600260015414612751576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b3d156127d1573d9067ffffffffffffffff821161201357604051916127c5601f8201601f191660200184612045565b82523d6000602084013e565b606090565b600080809381935af16127e7612796565b50156127ef57565b60405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a20424e425f5452414e534645525f46414960448201526213115160ea1b6064820152608490fd5b60ff60005460a01c161561285057565b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b60ff60005460a01c1661289b57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b80600052600f60205260406000204260018201556128f360075442612176565b60028201556007546001600160ff1b03811681036104775760009161291d60089260011b42612176565b600382015583815501557f939f42374aa9bf1d8d8cd56d8a9110cb040cd8dfeae44080c6fcf2645e51b452600080a2565b80600052600f602052600160406000200154151590816129ac575b81612990575b81612978575090565b9050600052600f602052600260406000200154421090565b809150600052600f60205260016040600020015442119061296f565b809150600052600f602052600260406000200154151590612969565b6000546001600160a01b031633036129dc57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b600254600354600d5460405163052571af60e51b8152600481019290925260248201529190608090839060449082906001600160a01b03165afa918215611e4357600092612b59575b506060820180514210612b02578051600c541015612a975769ffffffffffffffffffff905116915160070b90565b60405162461bcd60e51b815260206004820152603d60248201527f4f7261636c652075706461746520726f756e644964206d757374206265206c6160448201527f72676572207468616e206f7261636c654c6174657374526f756e6449640000006064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f4f7261636c652070726963652074696d657374616d702069732066726f6d207460448201526868652066757475726560b81b6064820152608490fd5b612b7391925060803d608011611e3c57611e2f8183612045565b9038612a69565b909181600052600f60205260016040600020015415612cd05781600052600f6020526002604060002001544210612c7b5781600052600f602052612bc960026040600020015460065490612176565b4211612c255760207f482e76a65b448a42deef26e99e58fb20c85e26f075defff8df6aa80459b390069183600052600f82528460066040600020612c0f60075442612176565b60038201558360048201550155604051908152a3565b60405162461bcd60e51b815260206004820152602860248201527f43616e206f6e6c79206c6f636b20726f756e642077697468696e206275666665604482015267725365636f6e647360c01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c79206c6f636b20726f756e64206166746572206c6f636b546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602b60248201527f43616e206f6e6c79206c6f636b20726f756e6420616674657220726f756e642060448201526a1a185cc81cdd185c9d195960aa1b6064820152608490fd5b91929015612d8b5750815115612d3d575090565b3b15612d465790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015612d9e5750805190602001fd5b6040519062461bcd60e51b8252602060048301528181519182602483015260005b838110612de15750508160006044809484010152601f80199101168101030190fd5b60208282018101516044878401015285935001612dbf56fea2646970667358221220fa8db10a7748ca09c2a0f2e7ddaaf46d545b31dd0c2ddd3c21fda4f1e421362e64736f6c634300081c00330000000000000000000000002880ab155794e7179c9ee2e38200202908c17b4315add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c8640000000000000000000000007493fdf8de3b37b92281fe777894c740fcfe3841000000000000000000000000129c15ca41b1367a5e9e675b27db43162995d3ae000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000258
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c80623bdc7414611e9b5780630f74174f14611e78578063127effb214611e4f5780631975f05914611d4b578063273867d414611d115780633118933414611cf3578063368acb0914611cd55780633f4ba83a14611c14578063452fd75a14611b5c57806357fb096f14611a3e5780635c975abb14611a1857806360554011146119fa5780636ba4c138146115ff5780636c18859314611554578063704b6c02146114ca578063715018a6146114715780637285c58b1461140557806376671808146113e757806377e741c7146113395780637b3205f514610e015780637bf4125414610ddb5780637d1cd04f14610dbd5780637dc0d1d014610d945780638456cb5914610cd2578063890dc76614610bfa5780638c65c81f14610b365780638da5cb5b14610b0d578063951fd600146108a0578063a0c7f71c14610870578063aa6b873a1461074b578063b29a8140146105e2578063b3ab15fb1461055f578063cc32d17614610541578063cf2f5039146104dd578063d9d55eac146103e3578063dd1f75961461038a578063eaba23611461036c578063ec3247031461034e578063f2b3c80914610331578063f2fde38b1461026a578063f7fdec2814610244578063fa968eea146102265763fc6f9468146101f457600080fd5b346102215760003660031901126102215760045460405160109190911c6001600160a01b03168152602090f35b600080fd5b34610221576000366003190112610221576020600854604051908152f35b3461022157600036600319011261022157602060ff60045460081c166040519015158152f35b3461022157602036600319011261022157610283611f12565b61028b6129c8565b6001600160a01b031680156102dd57600080546001600160a01b03198116831782556001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b346102215760003660031901126102215760206040516103e88152f35b34610221576000366003190112610221576020600c54604051908152f35b34610221576000366003190112610221576020600654604051908152f35b34610221576040366003190112610221576103a3611f12565b6001600160a01b0316600090815260106020526040902080546024359190821015610221576020916103d491611f4b565b90549060031b1c604051908152f35b34610221576000366003190112610221576103fc61288c565b61041160018060a01b0360055416331461213b565b60ff600454610424828260081c166126da565b1661048d5761044d69ffffffffffffffffffff61043f612a20565b911680600c55600b54612b7a565b600b5460018101809111610477578061046891600b556128d3565b6004805460ff19166001179055005b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152602260248201527f43616e206f6e6c792072756e2067656e657369734c6f636b526f756e64206f6e604482015261636560f01b6064820152608490fd5b34610221576020366003190112610221577f93ccaceac092ffb842c46b8718667a13a80e9058dcd0bd403d0b47215b30da07602060043561051c612840565b61053460018060a01b0360045460101c163314611f79565b80600d55604051908152a1005b34610221576000366003190112610221576020600954604051908152f35b34610221576020366003190112610221577fc47d127c07bdd56c5ccba00463ce3bd3c1bca71b4670eea6e5d0c02e4aa156e2602061059b611f12565b6105b360018060a01b0360045460101c163314611f79565b6001600160a01b03166105c7811515611fb1565b600580546001600160a01b03191682179055604051908152a1005b34610221576040366003190112610221576105fb611f12565b602435906106076129c8565b60018060a01b031690604051610692602082019163a9059cbb60e01b835233602482015283604482015260448152610640606482612045565b6000806040948551936106538786612045565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020860152519082895af161068b612796565b9086612d29565b8051908115918215610728575b5050156106d2577f14f11966a996e0629572e51064726d2057a80fbd34efc066682c06a71dbb6e989160209151908152a2005b5162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608490fd5b81925090602091810103126102215760200151801515810361022157848061069f565b60203660031901126102215760043561076261288c565b61076a612740565b610775333b15612183565b6107803233146121c6565b61078d600b548214612212565b61079e6107998261294e565b612256565b6107ac600854341015612297565b6000818152600e602090815260408083203384529091529020600101546107d390156122f8565b80600052600f602052600a6040600020600881016107f2348254612176565b905501610800348254612176565b90556000818152600e602090815260408083203384528252808320805460ff191660019081178255349101556010909152902061083e908290612344565b6040513481527f0d8c1fe3e67ab767116a81f122b83c2557a8c2564019cb7c4f83de1aeb1f1f0d60203392a360018055005b3461022157604036600319011261022157602061089661088e611f28565b600435612525565b6040519015158152f35b34610221576060366003190112610221576108b9611f12565b6001600160a01b031660008181526010602052604090205460243591604435916108e49084906123a1565b8211610aed575b6108f4826124f9565b916109026040519384612045565b80835261090e816124f9565b602084019490601f1901368637610924826124f9565b926109326040519485612045565b828452601f19610941846124f9565b0160005b818110610ac157505060005b838110610a005750509061096491612176565b604051926060840190606085525180915260808401949060005b8181106109ea5750505082840360208401526020808351958681520192016000945b8086106109b557505082935060408301520390f35b909260206060600192604087516109cd838251611f3e565b8481015185840152015115156040820152019401950194906109a0565b825187526020968701969092019160010161097e565b816000526010602052610a216040600020610a1b8386612176565b90611f4b565b90549060031b1c610a328288612511565b52610a3d8187612511565b51600052600e6020526040806000206000908482526020522090604051610a6381612029565b60ff835416926002841015610aab57600260ff91600195845285810154602085015201541615156040820152610a998288612511565b52610aa48187612511565b5001610951565b634e487b7160e01b600052602160045260246000fd5b602090604051610ad081612029565b600081526000838201526000604082015282828901015201610945565b8091506000526010602052610b07826040600020546123a1565b906108eb565b34610221576000366003190112610221576000546040516001600160a01b039091168152602090f35b3461022157602036600319011261022157600435600052600f6020526101c0604060002080549060018101549060028101546003820154600483015460058401546006850154600786015490600887015492600988015494600a89015496600b8a01549860ff600d600c8d01549c0154169b60206040519e8f908152015260408d015260608c015260808b015260a08a015260c089015260e088015261010087015261012086015261014085015261016084015261018083015215156101a0820152f35b3461022157604036600319011261022157600435602435610c19612840565b610c3160018060a01b0360045460101c163314611f79565b80821015610c7357816040917fe60149e0431fec12df63dfab5fce2a9cefe9a4d3df5f41cb626f579ae1f2b91a936006558060075582519182526020820152a1005b60405162461bcd60e51b815260206004820152603160248201527f6275666665725365636f6e6473206d75737420626520696e666572696f7220746044820152706f20696e74657276616c5365636f6e647360781b6064820152608490fd5b3461022157600036600319011261022157610ceb61288c565b6004543360109190911c6001600160a01b0316148015610d80575b610d0f906120fa565b610d1761288c565b6000805460ff60a01b1916600160a01b1790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602090a1600b547f68b095021b1f40fe513109f513c66692f0b3219aee674a69f4efc57badb8201d600080a2005b506005546001600160a01b03163314610d06565b34610221576000366003190112610221576002546040516001600160a01b039091168152602090f35b34610221576000366003190112610221576020600754604051908152f35b34610221576040366003190112610221576020610896610df9611f28565b6004356123ae565b3461022157600036600319011261022157610e1a61288c565b610e2f60018060a01b0360055416331461213b565b60045460ff8160081c16908161132e575b50156112b45769ffffffffffffffffffff610e59612a20565b91169081600c55610e6d8183600b54612b7a565b600b546000198101919082116104775781600052600f6020526002604060002001541561125d5781600052600f60205260036040600020015442106112085781600052600f602052610eca60036040600020015460065490612176565b42116111b35760207fb6ff1fe915db84788cbbbc017f0d2bef9485fad9fd0bd8ce9340fde0d8410dd89183600052600f8252600d604060002082600582015586600782015501600160ff19825416179055604051908152a3600b5460001981019081116104775780600052600f602052600b60406000200154158061119a575b156111605780600052600f6020527f6dfdfcb09c8804d0058826cd2539f1acfbe3cb887c9be03d928035bce0f1a58d606060406000206000600582015460048301549081811360001461112057505050600981015490600c600882015491610fc2612710610fba6009548661238e565b0480946123a1565b9182915b85600b8201550155610fda82600a54612176565b600a5560405192835260208301526040820152a2600b5460018101908181116104775781600b5561101260ff60045460081c166126da565b60001901908082116104775781600052600f602052600360406000200154156110c4576000918252600f6020526003604083200154421061105957611056906128d3565b80f35b60405162461bcd60e51b815260206004820152603760248201527f43616e206f6e6c79207374617274206e657720726f756e64206166746572207260448201527f6f756e64206e2d3220636c6f736554696d657374616d700000000000000000006064820152608490fd5b60405162461bcd60e51b815260206004820152602e60248201527f43616e206f6e6c7920737461727420726f756e6420616674657220726f756e6460448201526d081b8b4c881a185cc8195b99195960921b6064820152608490fd5b121561114f5750600a81015490600c600882015491611147612710610fba6009548661238e565b918291610fc6565b90600080600c600884015493610fc6565b60405162461bcd60e51b815260206004820152601260248201527114995dd85c991cc818d85b18dd5b185d195960721b6044820152606490fd5b5080600052600f602052600c6040600020015415610f4a565b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e642077697468696e206275666665726044820152665365636f6e647360c81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c7920656e6420726f756e6420616674657220636c6f7365546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f43616e206f6e6c7920656e6420726f756e6420616674657220726f756e642068604482015268185cc81b1bd8dad95960ba1b6064820152608490fd5b60405162461bcd60e51b815260206004820152604660248201527f43616e206f6e6c792072756e2061667465722067656e6573697353746172745260448201527f6f756e6420616e642067656e657369734c6f636b526f756e642069732074726960648201526519d9d95c995960d21b608482015260a490fd5b60ff91501681610e40565b3461022157602036600319011261022157600435611355612840565b61136d60018060a01b0360045460101c163314611f79565b6103e881116113aa57806009557fb1c4ee38d35556741133da7ff9b6f7ab0fa88d0406133126ff128f635490a8576020600b5492604051908152a2005b60405162461bcd60e51b81526020600482015260156024820152740a8e4cac2e6eae4f240cccaca40e8dede40d0d2ced605b1b6044820152606490fd5b34610221576000366003190112610221576020600b54604051908152f35b346102215760403660031901126102215760606040611422611f28565b600435600052600e6020528160002060009160018060a01b031682526020522060ff8154169060ff6002600183015492015416906114636040518094611f3e565b602083015215156040820152f35b346102215760003660031901126102215761148a6129c8565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34610221576020366003190112610221577f137b621413925496477d46e5055ac0d56178bdd724ba8bf843afceef18268ba36020611506611f12565b61150e6129c8565b6001600160a01b03811690611524821515611fb1565b6004805462010000600160b01b03191660109290921b62010000600160b01b0316919091179055604051908152a1005b3461022157602036600319011261022157600435611570612840565b61158860018060a01b0360045460101c163314611f79565b80156115c257806008557f90eb87c560a0213754ceb3a7fa3012f01acab0a35602c1e1995adf69dabc9d506020600b5492604051908152a2005b60405162461bcd60e51b815260206004820152601560248201527404d757374206265207375706572696f7220746f203605c1b6044820152606490fd5b346102215760203660031901126102215760043567ffffffffffffffff8111610221573660238201121561022157806004013567ffffffffffffffff8111610221576024820191602436918360051b0101116102215761165d612740565b611668333b15612183565b6116733233146121c6565b6000913390835b83811061169e57848061168e575b60018055005b61169890336127d6565b80611688565b6116a981858461237e565b35600052600f602052600160406000200154156119bd576116cb81858461237e565b35600052600f6020526003604060002001544211156119825760006116f182868561237e565b358152600f60205260408120600d015460ff16156118f3575061171f3361171983878661237e565b35612525565b156118b55761172f81858461237e565b35600052600f60205260406000206118136040519161174d83611ff6565b8054835260018101546020840152600281015460408401526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e084015260088101546101008401526009810154610120840152600a810154610140840152600b8101549261016081019384526101a060ff600d600c85015494610180850195865201541615159101526117ee84888761237e565b35600052600e602052600160408060002060009089825260205220015490519061238e565b905190600082156118a1575060019291611861910480975b61183684898861237e565b35600052600e60205260026040806000206000908a825260205220018560ff19825416179055612176565b9561186d82878661237e565b35906040519081527f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf760203392a30161167a565b634e487b7160e01b81526012600452602490fd5b60405162461bcd60e51b81526020600482015260166024820152754e6f7420656c696769626c6520666f7220636c61696d60501b6044820152606490fd5b906119093361190383888761237e565b356123ae565b1561193d57611861600160408194611922858a8961237e565b358152600e602052818120888252602052200154809761182b565b60405162461bcd60e51b815260206004820152601760248201527f4e6f7420656c696769626c6520666f7220726566756e640000000000000000006044820152606490fd5b60405162461bcd60e51b8152602060048201526013602482015272149bdd5b99081a185cc81b9bdd08195b991959606a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526015602482015274149bdd5b99081a185cc81b9bdd081cdd185c9d1959605a1b6044820152606490fd5b34610221576000366003190112610221576020600d54604051908152f35b3461022157600036600319011261022157602060ff60005460a01c166040519015158152f35b602036600319011261022157600435611a5561288c565b611a5d612740565b611a68333b15612183565b611a733233146121c6565b611a80600b548214612212565b611a8c6107998261294e565b611a9a600854341015612297565b6000818152600e60209081526040808320338452909152902060010154611ac190156122f8565b80600052600f6020526009604060002060088101611ae0348254612176565b905501611aee348254612176565b90556000818152600e602090815260408083203384528252808320805460ff191681553460019091015560109091529020611b2a908290612344565b6040513481527f438122d8cff518d18388099a5181f0d17a12b4f1b55faedf6e4a6acee0060c1260203392a360018055005b3461022157600036600319011261022157611b7561288c565b611b8a60018060a01b0360055416331461213b565b60ff60045460081c16611bc357600b54600181018091116104775780611bb291600b556128d3565b6004805461ff001916610100179055005b60405162461bcd60e51b815260206004820152602360248201527f43616e206f6e6c792072756e2067656e657369735374617274526f756e64206f6044820152626e636560e81b6064820152608490fd5b3461022157600036600319011261022157611c2d612840565b60045433601082901c6001600160a01b0316148015611cc1575b611c50906120fa565b61ffff1916600455611c60612840565b60ff60a01b19600054166000557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1600b547faaa520fdd7d2c83061d632fa017b0432407e798818af63ea908589fceda39ab7600080a2005b506005546001600160a01b03163314611c47565b34610221576000366003190112610221576020600a54604051908152f35b34610221576000366003190112610221576020600354604051908152f35b34610221576020366003190112610221576001600160a01b03611d32611f12565b1660005260106020526020604060002054604051908152f35b3461022157604036600319011261022157611d64611f12565b60243590611d70612840565b611d8860018060a01b0360045460101c163314611f79565b6001600160a01b031690611d9d821515611fb1565b600280546001600160a01b0319168317905560038190556000600c556040516331d98b3f60e01b81526004810182905291608083602481845afa918215611e43577ffe2deee4fd77d1a02c8c3a0f0bf4a3954722c1a30fefc67a6890092c5947add593604093611e16575b5082519182526020820152a1005b611e379060803d608011611e3c575b611e2f8183612045565b810190612067565b611e08565b503d611e25565b6040513d6000823e3d90fd5b34610221576000366003190112610221576005546040516001600160a01b039091168152602090f35b3461022157600036600319011261022157602060ff600454166040519015158152f35b3461022157600036600319011261022157611eb4612740565b6004547fb9197c6b8e21274bd1e2d9c956a88af5cfee510f630fab3f046300f88b4223619060209060101c6001600160a01b0316611ef3338214611f79565b611f05600a5480926000600a556127d6565b604051908152a160018055005b600435906001600160a01b038216820361022157565b602435906001600160a01b038216820361022157565b906002821015610aab5752565b8054821015611f635760005260206000200190600090565b634e487b7160e01b600052603260045260246000fd5b15611f8057565b60405162461bcd60e51b81526020600482015260096024820152682737ba1030b236b4b760b91b6044820152606490fd5b15611fb857565b60405162461bcd60e51b815260206004820152601660248201527543616e6e6f74206265207a65726f206164647265737360501b6044820152606490fd5b6101c0810190811067ffffffffffffffff82111761201357604052565b634e487b7160e01b600052604160045260246000fd5b6060810190811067ffffffffffffffff82111761201357604052565b90601f8019910116810190811067ffffffffffffffff82111761201357604052565b90816080910312610221576040519060006080830167ffffffffffffffff8111848210176120e65760405281518060070b81036120e2578352602082015167ffffffffffffffff811681036120e25760208401526040820151908160030b82036120df57509060609160408401520151606082015290565b80fd5b5080fd5b634e487b7160e01b82526041600452602482fd5b1561210157565b60405162461bcd60e51b81526020600482015260126024820152712737ba1037b832b930ba37b917b0b236b4b760711b6044820152606490fd5b1561214257565b60405162461bcd60e51b815260206004820152600c60248201526b2737ba1037b832b930ba37b960a11b6044820152606490fd5b9190820180921161047757565b1561218a57565b60405162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081b9bdd08185b1b1bddd95960621b6044820152606490fd5b156121cd57565b60405162461bcd60e51b815260206004820152601a60248201527f50726f787920636f6e7472616374206e6f7420616c6c6f7765640000000000006044820152606490fd5b1561221957565b60405162461bcd60e51b815260206004820152601560248201527442657420697320746f6f206561726c792f6c61746560581b6044820152606490fd5b1561225d57565b60405162461bcd60e51b8152602060048201526012602482015271526f756e64206e6f74206265747461626c6560701b6044820152606490fd5b1561229e57565b60405162461bcd60e51b815260206004820152602c60248201527f42657420616d6f756e74206d7573742062652067726561746572207468616e2060448201526b1b5a5b90995d105b5bdd5b9d60a21b6064820152608490fd5b156122ff57565b60405162461bcd60e51b815260206004820152601b60248201527f43616e206f6e6c7920626574206f6e63652070657220726f756e6400000000006044820152606490fd5b8054680100000000000000008110156120135761236691600182018155611f4b565b819291549060031b91821b91600019901b1916179055565b9190811015611f635760051b0190565b8181029291811591840414171561047757565b9190820391821161047757565b9060409082600052600e6020528160002060009160018060a01b0316825260205220604051916123dd83612029565b60ff8254166002811015610aab578352604060ff60026001850154946020870195865201541693019215158352600052600f60205260406000206040519261242484611ff6565b81548452600182015460208501526002820154604085015260ff600d60038401549384606088015260048101546080880152600581015460a0880152600681015460c0880152600781015460e088015260088101546101008801526009810154610120880152600a810154610140880152600b810154610160880152600c81015461018088015201541615936101a08515910152836124ef575b50826124d7575b50816124cf575090565b905051151590565b6124e691925060065490612176565b421190386124c5565b51159250386124be565b67ffffffffffffffff81116120135760051b60200190565b8051821015611f635760209160051b010190565b6000818152600e602090815260408083206001600160a01b039095168352939052829020915161255481612029565b60ff835416926002841015610aab576101a093825260ff60026001830154926020850193845201541692604083019315158452600052600f6020526040600020926040516125a181611ff6565b84548152600185015460208201526002850154604082015260038501546060820152600485015491608082019383855260058701549260ff600d60a0830199868b52600681015460c0850152600781015460e085015260088101546101008501526009810154610120850152600a810154610140850152600b810154610160850152600c810154610180850152015416151598899101528284146126cd57876126c2575b50866126b8575b508561265b575b505050505090565b1393509091836126a4575b831561267a575b5050503880808080612653565b5190511391508161268f575b5038808061266d565b9050516002811015610aab5760011438612686565b925081516002811015610aab571592612666565b511595503861264c565b511515965038612645565b5050505050505050600090565b156126e157565b60405162461bcd60e51b815260206004820152603160248201527f43616e206f6e6c792072756e2061667465722067656e657369735374617274526044820152701bdd5b99081a5cc81d1c9a59d9d95c9959607a1b6064820152608490fd5b600260015414612751576002600155565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b3d156127d1573d9067ffffffffffffffff821161201357604051916127c5601f8201601f191660200184612045565b82523d6000602084013e565b606090565b600080809381935af16127e7612796565b50156127ef57565b60405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a20424e425f5452414e534645525f46414960448201526213115160ea1b6064820152608490fd5b60ff60005460a01c161561285057565b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b60ff60005460a01c1661289b57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b80600052600f60205260406000204260018201556128f360075442612176565b60028201556007546001600160ff1b03811681036104775760009161291d60089260011b42612176565b600382015583815501557f939f42374aa9bf1d8d8cd56d8a9110cb040cd8dfeae44080c6fcf2645e51b452600080a2565b80600052600f602052600160406000200154151590816129ac575b81612990575b81612978575090565b9050600052600f602052600260406000200154421090565b809150600052600f60205260016040600020015442119061296f565b809150600052600f602052600260406000200154151590612969565b6000546001600160a01b031633036129dc57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b600254600354600d5460405163052571af60e51b8152600481019290925260248201529190608090839060449082906001600160a01b03165afa918215611e4357600092612b59575b506060820180514210612b02578051600c541015612a975769ffffffffffffffffffff905116915160070b90565b60405162461bcd60e51b815260206004820152603d60248201527f4f7261636c652075706461746520726f756e644964206d757374206265206c6160448201527f72676572207468616e206f7261636c654c6174657374526f756e6449640000006064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f4f7261636c652070726963652074696d657374616d702069732066726f6d207460448201526868652066757475726560b81b6064820152608490fd5b612b7391925060803d608011611e3c57611e2f8183612045565b9038612a69565b909181600052600f60205260016040600020015415612cd05781600052600f6020526002604060002001544210612c7b5781600052600f602052612bc960026040600020015460065490612176565b4211612c255760207f482e76a65b448a42deef26e99e58fb20c85e26f075defff8df6aa80459b390069183600052600f82528460066040600020612c0f60075442612176565b60038201558360048201550155604051908152a3565b60405162461bcd60e51b815260206004820152602860248201527f43616e206f6e6c79206c6f636b20726f756e642077697468696e206275666665604482015267725365636f6e647360c01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602760248201527f43616e206f6e6c79206c6f636b20726f756e64206166746572206c6f636b546960448201526606d657374616d760cc1b6064820152608490fd5b60405162461bcd60e51b815260206004820152602b60248201527f43616e206f6e6c79206c6f636b20726f756e6420616674657220726f756e642060448201526a1a185cc81cdd185c9d195960aa1b6064820152608490fd5b91929015612d8b5750815115612d3d575090565b3b15612d465790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b825190915015612d9e5750805190602001fd5b6040519062461bcd60e51b8252602060048301528181519182602483015260005b838110612de15750508160006044809484010152601f80199101168101030190fd5b60208282018101516044878401015285935001612dbf56fea2646970667358221220fa8db10a7748ca09c2a0f2e7ddaaf46d545b31dd0c2ddd3c21fda4f1e421362e64736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b4315add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c8640000000000000000000000007493fdf8de3b37b92281fe777894c740fcfe3841000000000000000000000000129c15ca41b1367a5e9e675b27db43162995d3ae000000000000000000000000000000000000000000000000000000000000012c000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000258
-----Decoded View---------------
Arg [0] : _oracleAddress (address): 0x2880aB155794e7179c9eE2e38200202908C17B43
Arg [1] : _priceId (bytes32): 0x15add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c864
Arg [2] : _adminAddress (address): 0x7493fdF8dE3b37b92281Fe777894c740Fcfe3841
Arg [3] : _operatorAddress (address): 0x129c15ca41B1367A5e9E675b27db43162995d3AE
Arg [4] : _intervalSeconds (uint256): 300
Arg [5] : _bufferSeconds (uint256): 30
Arg [6] : _minBetAmount (uint256): 100000000000000000
Arg [7] : _oracleUpdateAllowance (uint256): 60
Arg [8] : _treasuryFee (uint256): 600
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000002880ab155794e7179c9ee2e38200202908c17b43
Arg [1] : 15add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c864
Arg [2] : 0000000000000000000000007493fdf8de3b37b92281fe777894c740fcfe3841
Arg [3] : 000000000000000000000000129c15ca41b1367a5e9e675b27db43162995d3ae
Arg [4] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [5] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [6] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [7] : 000000000000000000000000000000000000000000000000000000000000003c
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000258
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.