More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 151 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Remove Liquidity | 13601533 | 1159 days ago | IN | 0 ETH | 0.00694544 | ||||
Approve | 13581478 | 1162 days ago | IN | 0 ETH | 0.00609925 | ||||
Remove Liquidity | 13550081 | 1167 days ago | IN | 0 ETH | 0.00847095 | ||||
Remove Liquidity | 13546146 | 1168 days ago | IN | 0 ETH | 0.01586789 | ||||
Settle Relay | 13544781 | 1168 days ago | IN | 0 ETH | 0.01056004 | ||||
Settle Relay | 13544678 | 1168 days ago | IN | 0 ETH | 0.01712231 | ||||
Settle Relay | 13544619 | 1168 days ago | IN | 0 ETH | 0.01917323 | ||||
Settle Relay | 13544299 | 1168 days ago | IN | 0 ETH | 0.01974505 | ||||
Relay And Speed ... | 13544207 | 1168 days ago | IN | 0 ETH | 0.0312921 | ||||
Settle Relay | 13544204 | 1168 days ago | IN | 0 ETH | 0.01934289 | ||||
Relay And Speed ... | 13544139 | 1168 days ago | IN | 0 ETH | 0.02671874 | ||||
Relay And Speed ... | 13544085 | 1168 days ago | IN | 0 ETH | 0.03210764 | ||||
Relay And Speed ... | 13543784 | 1168 days ago | IN | 0 ETH | 0.019539 | ||||
Relay And Speed ... | 13543696 | 1168 days ago | IN | 0 ETH | 0.02855918 | ||||
Settle Relay | 13541934 | 1169 days ago | IN | 0 ETH | 0.01318023 | ||||
Settle Relay | 13541885 | 1169 days ago | IN | 0 ETH | 0.01758172 | ||||
Settle Relay | 13541732 | 1169 days ago | IN | 0 ETH | 0.01434556 | ||||
Relay And Speed ... | 13541172 | 1169 days ago | IN | 0 ETH | 0.02609445 | ||||
Settle Relay | 13540877 | 1169 days ago | IN | 0 ETH | 0.01910743 | ||||
Relay And Speed ... | 13540334 | 1169 days ago | IN | 0 ETH | 0.02704674 | ||||
Settle Relay | 13540211 | 1169 days ago | IN | 0 ETH | 0.02280204 | ||||
Relay And Speed ... | 13539669 | 1169 days ago | IN | 0 ETH | 0.02800855 | ||||
Settle Relay | 13539043 | 1169 days ago | IN | 0 ETH | 0.01778793 | ||||
Settle Relay | 13538817 | 1169 days ago | IN | 0 ETH | 0.01566423 | ||||
Settle Relay | 13538732 | 1169 days ago | IN | 0 ETH | 0.01943362 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
13546146 | 1168 days ago | 0.33001226 ETH | ||||
13546146 | 1168 days ago | 0.33001226 ETH | ||||
13544207 | 1168 days ago | 0.09730047 ETH | ||||
13544207 | 1168 days ago | 0.09730047 ETH | ||||
13544139 | 1168 days ago | 0.01728562 ETH | ||||
13544139 | 1168 days ago | 0.01728562 ETH | ||||
13544085 | 1168 days ago | 0.06733367 ETH | ||||
13544085 | 1168 days ago | 0.06733367 ETH | ||||
13543784 | 1168 days ago | 0.09839877 ETH | ||||
13543784 | 1168 days ago | 0.09839877 ETH | ||||
13543696 | 1168 days ago | 0.09786026 ETH | ||||
13543696 | 1168 days ago | 0.09786026 ETH | ||||
13541172 | 1169 days ago | 0.0978145 ETH | ||||
13541172 | 1169 days ago | 0.0978145 ETH | ||||
13540334 | 1169 days ago | 0.09729509 ETH | ||||
13540334 | 1169 days ago | 0.09729509 ETH | ||||
13539669 | 1169 days ago | 0.09722933 ETH | ||||
13539669 | 1169 days ago | 0.09722933 ETH | ||||
13538503 | 1169 days ago | 0.19359379 ETH | ||||
13538503 | 1169 days ago | 0.19359379 ETH | ||||
13538284 | 1169 days ago | 0.04746713 ETH | ||||
13538284 | 1169 days ago | 0.04746713 ETH | ||||
13538190 | 1169 days ago | 0.03193518 ETH | ||||
13538190 | 1169 days ago | 0.03193518 ETH | ||||
13538015 | 1169 days ago | 0.008765 ETH |
Loading...
Loading
Contract Name:
BridgePool
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "./interfaces/BridgeAdminInterface.sol"; import "./interfaces/BridgePoolInterface.sol"; import "../oracle/interfaces/SkinnyOptimisticOracleInterface.sol"; import "../oracle/interfaces/StoreInterface.sol"; import "../oracle/interfaces/FinderInterface.sol"; import "../oracle/implementation/Constants.sol"; import "../common/implementation/AncillaryData.sol"; import "../common/implementation/Testable.sol"; import "../common/implementation/FixedPoint.sol"; import "../common/implementation/Lockable.sol"; import "../common/implementation/ExpandedERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; interface WETH9Like { function withdraw(uint256 wad) external; function deposit() external payable; } /** * @notice Contract deployed on L1 that provides methods for "Relayers" to fulfill deposit orders that originated on L2. * The Relayers can either post capital to fulfill the deposit (instant relay), or request that the funds are taken out * of a passive liquidity provider pool following a challenge period (slow relay). This contract ingests liquidity from * passive liquidity providers and returns them claims to withdraw their funds. Liquidity providers are incentivized * to post collateral by earning a fee per fulfilled deposit order. * @dev A "Deposit" is an order to send capital from L2 to L1, and a "Relay" is a fulfillment attempt of that order. */ contract BridgePool is Testable, BridgePoolInterface, ERC20, Lockable { using SafeERC20 for IERC20; using FixedPoint for FixedPoint.Unsigned; using Address for address; // Token that this contract receives as LP deposits. IERC20 public override l1Token; // Track the total number of relays and uniquely identifies relays. uint32 public numberOfRelays; // Reserves that are unutilized and withdrawable. uint256 public liquidReserves; // Reserves currently utilized due to L2-L1 transactions in flight. int256 public utilizedReserves; // Reserves that are not yet utilized but are pre-allocated for a pending relay. uint256 public pendingReserves; // True If this pool houses WETH. If the withdrawn token is WETH then unwrap and send ETH when finalizing // withdrawal. bool public isWethPool; // Exponential decay exchange rate to accumulate fees to LPs over time. uint64 public lpFeeRatePerSecond; // Last timestamp that LP fees were updated. uint32 public lastLpFeeUpdate; // Store local instances of contract params to save gas relaying. uint64 public proposerBondPct; uint32 public optimisticOracleLiveness; // Store local instance of the reserve currency final fee. This is a gas optimization to not re-call the store. uint256 l1TokenFinalFee; // Cumulative undistributed LP fees. As fees accumulate, they are subtracted from this number. uint256 public undistributedLpFees; // Total bond amount held for pending relays. Bonds are released following a successful relay or after a dispute. uint256 public bonds; // Administrative contract that deployed this contract and also houses all state variables needed to relay deposits. BridgeAdminInterface public bridgeAdmin; // Store local instances of the contract instances to save gas relaying. Can be sync with the Finder at any time via // the syncUmaEcosystemParams() public function. StoreInterface public store; SkinnyOptimisticOracleInterface public optimisticOracle; // DVM price request identifier that is resolved based on the validity of a relay attempt. bytes32 public identifier; // A Relay represents an attempt to finalize a cross-chain transfer that originated on an L2 DepositBox contract. // The flow chart between states is as follows: // - Begin at Uninitialized. // - When relayDeposit() is called, a new relay is created with state Pending and mapped to the L2 deposit hash. // - If the relay is disputed, the RelayData gets deleted and the L2 deposit hash has no relay mapped to it anymore. // - The above statements enable state to transfer between the Uninitialized and Pending states. // - When settleRelay() is successfully called, the relay state gets set to Finalized and cannot change from there. // - It is impossible for a relay to be deleted when in Finalized state (and have its state set to Uninitialized) // because the only way for settleRelay() to succeed is if the price has resolved on the OptimisticOracle. // - You cannot dispute an already resolved request on the OptimisticOracle. Moreover, the mapping from // a relay's ancillary data hash to its deposit hash is deleted after a successful settleRelay() call. enum RelayState { Uninitialized, Pending, Finalized } // Data from L2 deposit transaction. struct DepositData { uint256 chainId; uint64 depositId; address payable l1Recipient; address l2Sender; uint256 amount; uint64 slowRelayFeePct; uint64 instantRelayFeePct; uint32 quoteTimestamp; } // Each L2 Deposit can have one Relay attempt at any one time. A Relay attempt is characterized by its RelayData. struct RelayData { RelayState relayState; address slowRelayer; uint32 relayId; uint64 realizedLpFeePct; uint32 priceRequestTime; uint256 proposerBond; uint256 finalFee; } // Associate deposits with pending relay data. When the mapped relay hash is empty, new relay attempts can be made // for this deposit. The relay data contains information necessary to pay out relayers on successful relay. // Relay hashes are deleted when they are disputed on the OptimisticOracle. mapping(bytes32 => bytes32) public relays; // Map hash of deposit and realized-relay fee to instant relayers. This mapping is checked at settlement time // to determine if there was a valid instant relayer. mapping(bytes32 => address) public instantRelays; event LiquidityAdded(uint256 amount, uint256 lpTokensMinted, address indexed liquidityProvider); event LiquidityRemoved(uint256 amount, uint256 lpTokensBurnt, address indexed liquidityProvider); event DepositRelayed( bytes32 indexed depositHash, DepositData depositData, RelayData relay, bytes32 relayAncillaryDataHash ); event RelaySpedUp(bytes32 indexed depositHash, address indexed instantRelayer, RelayData relay); // Note: the difference between a dispute and a cancellation is that a cancellation happens in the case where // something changes in the OO between request and dispute that causes calls to it to fail. The most common // case would be an increase in final fee. However, things like whitelisting can also cause problems. event RelayDisputed(bytes32 indexed depositHash, bytes32 indexed relayHash, address indexed disputer); event RelayCanceled(bytes32 indexed depositHash, bytes32 indexed relayHash, address indexed disputer); event RelaySettled(bytes32 indexed depositHash, address indexed caller, RelayData relay); event BridgePoolAdminTransferred(address oldAdmin, address newAdmin); modifier onlyFromOptimisticOracle() { require(msg.sender == address(optimisticOracle), "Caller must be OptimisticOracle"); _; } /** * @notice Construct the Bridge Pool. * @param _lpTokenName Name of the LP token to be deployed by this contract. * @param _lpTokenSymbol Symbol of the LP token to be deployed by this contract. * @param _bridgeAdmin Admin contract deployed alongside on L1. Stores global variables and has owner control. * @param _l1Token Address of the L1 token that this bridgePool holds. This is the token LPs deposit and is bridged. * @param _lpFeeRatePerSecond Interest rate payment that scales the amount of pending fees per second paid to LPs. * @param _timer Timer used to synchronize contract time in testing. Set to 0x000... in production. */ constructor( string memory _lpTokenName, string memory _lpTokenSymbol, address _bridgeAdmin, address _l1Token, uint64 _lpFeeRatePerSecond, bool _isWethPool, address _timer ) Testable(_timer) ERC20(_lpTokenName, _lpTokenSymbol) { require(bytes(_lpTokenName).length != 0 && bytes(_lpTokenSymbol).length != 0, "Bad LP token name or symbol"); bridgeAdmin = BridgeAdminInterface(_bridgeAdmin); l1Token = IERC20(_l1Token); lastLpFeeUpdate = uint32(getCurrentTime()); lpFeeRatePerSecond = _lpFeeRatePerSecond; isWethPool = _isWethPool; syncUmaEcosystemParams(); // Fetch OptimisticOracle and Store addresses and L1Token finalFee. syncWithBridgeAdminParams(); // Fetch ProposerBondPct OptimisticOracleLiveness, Identifier from the BridgeAdmin. } /************************************************* * LIQUIDITY PROVIDER FUNCTIONS * *************************************************/ /** * @notice Add liquidity to the bridge pool. Pulls l1Token from the callers wallet. The caller is sent back a * commensurate number of LP tokens (minted to their address) at the prevailing exchange rate. * @dev The caller must approve this contract to transfer `l1TokenAmount` amount of l1Token if depositing ERC20. * @dev The caller can deposit ETH which is auto wrapped to WETH. This can only be done if: a) this is the Weth pool * and b) the l1TokenAmount matches to the transaction msg.value. * @dev Reentrancy guard not added to this function because this indirectly calls sync() which is guarded. * @param l1TokenAmount Number of l1Token to add as liquidity. */ function addLiquidity(uint256 l1TokenAmount) public payable nonReentrant() { // If this is the weth pool and the caller sends msg.value then the msg.value must match the l1TokenAmount. // Else, msg.value must be set to 0. require((isWethPool && msg.value == l1TokenAmount) || msg.value == 0, "Bad add liquidity Eth value"); // Since `exchangeRateCurrent()` reads this contract's balance and updates contract state using it, // we must call it first before transferring any tokens to this contract. uint256 lpTokensToMint = (l1TokenAmount * 1e18) / _exchangeRateCurrent(); _mint(msg.sender, lpTokensToMint); liquidReserves += l1TokenAmount; if (msg.value > 0 && isWethPool) WETH9Like(address(l1Token)).deposit{ value: msg.value }(); else l1Token.safeTransferFrom(msg.sender, address(this), l1TokenAmount); emit LiquidityAdded(l1TokenAmount, lpTokensToMint, msg.sender); } /** * @notice Removes liquidity to the bridge pool. Burns lpTokenAmount LP tokens from the callers wallet. The caller * is sent back a commensurate number of l1Tokens at the prevailing exchange rate. * @dev The caller does not need to approve the spending of LP tokens as this method directly uses the burn logic. * @dev Reentrancy guard not added to this function because this indirectly calls sync() which is guarded. * @param lpTokenAmount Number of lpTokens to redeem for underlying. * @param sendEth Enable the liquidity provider to remove liquidity in ETH, if this is the WETH pool. */ function removeLiquidity(uint256 lpTokenAmount, bool sendEth) public nonReentrant() { // Can only send eth on withdrawing liquidity iff this is the WETH pool. require(!sendEth || isWethPool, "Cant send eth"); uint256 l1TokensToReturn = (lpTokenAmount * _exchangeRateCurrent()) / 1e18; // Check that there is enough liquid reserves to withdraw the requested amount. require(liquidReserves >= (pendingReserves + l1TokensToReturn), "Utilization too high to remove"); _burn(msg.sender, lpTokenAmount); liquidReserves -= l1TokensToReturn; if (sendEth) _unwrapWETHTo(payable(msg.sender), l1TokensToReturn); else l1Token.safeTransfer(msg.sender, l1TokensToReturn); emit LiquidityRemoved(l1TokensToReturn, lpTokenAmount, msg.sender); } /************************************** * RELAYER FUNCTIONS * **************************************/ /** * @notice Called by Relayer to execute a slow + fast relay from L2 to L1, fulfilling a corresponding deposit order. * @dev There can only be one pending relay for a deposit. This method is effectively the relayDeposit and * speedUpRelay methods concatenated. This could be refactored to just call each method, but there * are some gas savings in combining the transfers and hash computations. * @dev Caller must have approved this contract to spend the total bond + amount - fees for `l1Token`. * @param depositData the deposit data struct containing all the user's deposit information. * @param realizedLpFeePct LP fee calculated off-chain considering the L1 pool liquidity at deposit time, before * quoteTimestamp. The OO acts to verify the correctness of this realized fee. Can not exceed 50%. */ function relayAndSpeedUp(DepositData memory depositData, uint64 realizedLpFeePct) public nonReentrant() { // If no pending relay for this deposit, then associate the caller's relay attempt with it. uint32 priceRequestTime = uint32(getCurrentTime()); // The realizedLPFeePct should never be greater than 0.5e18 and the slow and instant relay fees should never be // more than 0.25e18 each. Therefore, the sum of all fee types can never exceed 1e18 (or 100%). require( depositData.slowRelayFeePct <= 0.25e18 && depositData.instantRelayFeePct <= 0.25e18 && realizedLpFeePct < 0.5e18 ); // Check if there is a pending relay for this deposit. bytes32 depositHash = _getDepositHash(depositData); // Note: A disputed relay deletes the stored relay hash and enables this require statement to pass. require(relays[depositHash] == bytes32(0), "Pending relay exists"); uint256 proposerBond = _getProposerBond(depositData.amount); // Save hash of new relay attempt parameters. // Note: The liveness for this relay can be changed in the BridgeAdmin, which means that each relay has a // potentially variable liveness time. This should not provide any exploit opportunities, especially because // the BridgeAdmin state (including the liveness value) is permissioned to the cross domained owner. RelayData memory relayData = RelayData({ relayState: RelayState.Pending, slowRelayer: msg.sender, relayId: numberOfRelays++, // Note: Increment numberOfRelays at the same time as setting relayId to its current value. realizedLpFeePct: realizedLpFeePct, priceRequestTime: priceRequestTime, proposerBond: proposerBond, finalFee: l1TokenFinalFee }); bytes32 relayHash = _getRelayHash(depositData, relayData); relays[depositHash] = _getRelayDataHash(relayData); bytes32 instantRelayHash = _getInstantRelayHash(depositHash, relayData); require( // Can only speed up a pending relay without an existing instant relay associated with it. instantRelays[instantRelayHash] == address(0), "Relay cannot be sped up" ); // Sanity check that pool has enough balance to cover relay amount + proposer reward. Reward amount will be // paid on settlement after the OptimisticOracle price request has passed the challenge period. // Note: liquidReserves should always be <= balance - bonds. require(liquidReserves - pendingReserves >= depositData.amount, "Insufficient pool balance"); // Compute total proposal bond and pull from caller so that the OptimisticOracle can pull it from here. uint256 totalBond = proposerBond + l1TokenFinalFee; // Pull relay amount minus fees from caller and send to the deposit l1Recipient. The total fees paid is the sum // of the LP fees, the relayer fees and the instant relay fee. uint256 feesTotal = _getAmountFromPct( relayData.realizedLpFeePct + depositData.slowRelayFeePct + depositData.instantRelayFeePct, depositData.amount ); // If the L1 token is WETH then: a) pull WETH from instant relayer b) unwrap WETH c) send ETH to recipient. uint256 recipientAmount = depositData.amount - feesTotal; bonds += totalBond; pendingReserves += depositData.amount; // Book off maximum liquidity used by this relay in the pending reserves. instantRelays[instantRelayHash] = msg.sender; l1Token.safeTransferFrom(msg.sender, address(this), recipientAmount + totalBond); // If this is a weth pool then unwrap and send eth. if (isWethPool) { _unwrapWETHTo(depositData.l1Recipient, recipientAmount); // Else, this is a normal ERC20 token. Send to recipient. } else l1Token.safeTransfer(depositData.l1Recipient, recipientAmount); emit DepositRelayed(depositHash, depositData, relayData, relayHash); emit RelaySpedUp(depositHash, msg.sender, relayData); } /** * @notice Called by Disputer to dispute an ongoing relay. * @dev The result of this method is to always throw out the relay, providing an opportunity for another relay for * the same deposit. Between the disputer and proposer, whoever is incorrect loses their bond. Whoever is correct * gets it back + a payout. * @dev Caller must have approved this contract to spend the total bond + amount - fees for `l1Token`. * @param depositData the deposit data struct containing all the user's deposit information. * @param relayData RelayData logged in the disputed relay. */ function disputeRelay(DepositData memory depositData, RelayData memory relayData) public nonReentrant() { require(relayData.priceRequestTime + optimisticOracleLiveness > getCurrentTime(), "Past liveness"); require(relayData.relayState == RelayState.Pending, "Not disputable"); // Validate the input data. bytes32 depositHash = _getDepositHash(depositData); _validateRelayDataHash(depositHash, relayData); // Submit the proposal and dispute to the OO. bytes32 relayHash = _getRelayHash(depositData, relayData); // Note: in some cases this will fail due to changes in the OO and the method will refund the relayer. bool success = _requestProposeDispute( relayData.slowRelayer, msg.sender, relayData.proposerBond, relayData.finalFee, _getRelayAncillaryData(relayHash) ); // Drop the relay and remove the bond from the tracked bonds. bonds -= relayData.finalFee + relayData.proposerBond; pendingReserves -= depositData.amount; delete relays[depositHash]; if (success) emit RelayDisputed(depositHash, _getRelayDataHash(relayData), msg.sender); else emit RelayCanceled(depositHash, _getRelayDataHash(relayData), msg.sender); } /** * @notice Called by Relayer to execute a slow relay from L2 to L1, fulfilling a corresponding deposit order. * @dev There can only be one pending relay for a deposit. * @dev Caller must have approved this contract to spend the total bond + amount - fees for `l1Token`. * @param depositData the deposit data struct containing all the user's deposit information. * @param realizedLpFeePct LP fee calculated off-chain considering the L1 pool liquidity at deposit time, before * quoteTimestamp. The OO acts to verify the correctness of this realized fee. Can not exceed 50%. */ function relayDeposit(DepositData memory depositData, uint64 realizedLpFeePct) public nonReentrant() { // The realizedLPFeePct should never be greater than 0.5e18 and the slow and instant relay fees should never be // more than 0.25e18 each. Therefore, the sum of all fee types can never exceed 1e18 (or 100%). require( depositData.slowRelayFeePct <= 0.25e18 && depositData.instantRelayFeePct <= 0.25e18 && realizedLpFeePct < 0.5e18 ); // Check if there is a pending relay for this deposit. bytes32 depositHash = _getDepositHash(depositData); // Note: A disputed relay deletes the stored relay hash and enables this require statement to pass. require(relays[depositHash] == bytes32(0), "Pending relay exists"); // If no pending relay for this deposit, then associate the caller's relay attempt with it. uint32 priceRequestTime = uint32(getCurrentTime()); uint256 proposerBond = _getProposerBond(depositData.amount); // Save hash of new relay attempt parameters. // Note: The liveness for this relay can be changed in the BridgeAdmin, which means that each relay has a // potentially variable liveness time. This should not provide any exploit opportunities, especially because // the BridgeAdmin state (including the liveness value) is permissioned to the cross domained owner. RelayData memory relayData = RelayData({ relayState: RelayState.Pending, slowRelayer: msg.sender, relayId: numberOfRelays++, // Note: Increment numberOfRelays at the same time as setting relayId to its current value. realizedLpFeePct: realizedLpFeePct, priceRequestTime: priceRequestTime, proposerBond: proposerBond, finalFee: l1TokenFinalFee }); relays[depositHash] = _getRelayDataHash(relayData); bytes32 relayHash = _getRelayHash(depositData, relayData); // Sanity check that pool has enough balance to cover relay amount + proposer reward. Reward amount will be // paid on settlement after the OptimisticOracle price request has passed the challenge period. // Note: liquidReserves should always be <= balance - bonds. require(liquidReserves - pendingReserves >= depositData.amount, "Insufficient pool balance"); // Compute total proposal bond and pull from caller so that the OptimisticOracle can pull it from here. uint256 totalBond = proposerBond + l1TokenFinalFee; pendingReserves += depositData.amount; // Book off maximum liquidity used by this relay in the pending reserves. bonds += totalBond; l1Token.safeTransferFrom(msg.sender, address(this), totalBond); emit DepositRelayed(depositHash, depositData, relayData, relayHash); } /** * @notice Instantly relay a deposit amount minus fees to the l1Recipient. Instant relayer earns a reward following * the pending relay challenge period. * @dev We assume that the caller has performed an off-chain check that the deposit data they are attempting to * relay is valid. If the deposit data is invalid, then the instant relayer has no recourse to receive their funds * back after the invalid deposit data is disputed. Moreover, no one will be able to resubmit a relay for the * invalid deposit data because they know it will get disputed again. On the other hand, if the deposit data is * valid, then even if it is falsely disputed, the instant relayer will eventually get reimbursed because someone * else will be incentivized to resubmit the relay to earn slow relayer rewards. Once the valid relay is finalized, * the instant relayer will be reimbursed. Therefore, the caller has the same responsibility as the disputer in * validating the relay data. * @dev Caller must have approved this contract to spend the deposit amount of L1 tokens to relay. There can only * be one instant relayer per relay attempt. You cannot speed up a relay that is past liveness. * @param depositData Unique set of L2 deposit data that caller is trying to instantly relay. * @param relayData Parameters of Relay that caller is attempting to speedup. Must hash to the stored relay hash * for this deposit or this method will revert. */ function speedUpRelay(DepositData memory depositData, RelayData memory relayData) public nonReentrant() { bytes32 depositHash = _getDepositHash(depositData); _validateRelayDataHash(depositHash, relayData); bytes32 instantRelayHash = _getInstantRelayHash(depositHash, relayData); require( // Can only speed up a pending relay without an existing instant relay associated with it. getCurrentTime() < relayData.priceRequestTime + optimisticOracleLiveness && relayData.relayState == RelayState.Pending && instantRelays[instantRelayHash] == address(0), "Relay cannot be sped up" ); instantRelays[instantRelayHash] = msg.sender; // Pull relay amount minus fees from caller and send to the deposit l1Recipient. The total fees paid is the sum // of the LP fees, the relayer fees and the instant relay fee. uint256 feesTotal = _getAmountFromPct( relayData.realizedLpFeePct + depositData.slowRelayFeePct + depositData.instantRelayFeePct, depositData.amount ); // If the L1 token is WETH then: a) pull WETH from instant relayer b) unwrap WETH c) send ETH to recipient. uint256 recipientAmount = depositData.amount - feesTotal; if (isWethPool) { l1Token.safeTransferFrom(msg.sender, address(this), recipientAmount); _unwrapWETHTo(depositData.l1Recipient, recipientAmount); // Else, this is a normal ERC20 token. Send to recipient. } else l1Token.safeTransferFrom(msg.sender, depositData.l1Recipient, recipientAmount); emit RelaySpedUp(depositHash, msg.sender, relayData); } /** * @notice Reward relayers if a pending relay price request has a price available on the OptimisticOracle. Mark * the relay as complete. * @dev We use the relayData and depositData to compute the ancillary data that the relay price request is uniquely * associated with on the OptimisticOracle. If the price request passed in does not match the pending relay price * request, then this will revert. * @param depositData Unique set of L2 deposit data that caller is trying to settle a relay for. * @param relayData Parameters of Relay that caller is attempting to settle. Must hash to the stored relay hash * for this deposit. */ function settleRelay(DepositData memory depositData, RelayData memory relayData) public nonReentrant() { bytes32 depositHash = _getDepositHash(depositData); _validateRelayDataHash(depositHash, relayData); require(relayData.relayState == RelayState.Pending, "Already settled"); uint32 expirationTime = relayData.priceRequestTime + optimisticOracleLiveness; require(expirationTime <= getCurrentTime(), "Not settleable yet"); // Note: this check is to give the relayer a small, but reasonable amount of time to complete the relay before // before it can be "stolen" by someone else. This is to ensure there is an incentive to settle relays quickly. require( msg.sender == relayData.slowRelayer || getCurrentTime() > expirationTime + 15 minutes, "Not slow relayer" ); // Update the relay state to Finalized. This prevents any re-settling of a relay. relays[depositHash] = _getRelayDataHash( RelayData({ relayState: RelayState.Finalized, slowRelayer: relayData.slowRelayer, relayId: relayData.relayId, realizedLpFeePct: relayData.realizedLpFeePct, priceRequestTime: relayData.priceRequestTime, proposerBond: relayData.proposerBond, finalFee: relayData.finalFee }) ); // Reward relayers and pay out l1Recipient. // At this point there are two possible cases: // - This was a slow relay: In this case, a) pay the slow relayer their reward and b) pay the l1Recipient of the // amount minus the realized LP fee and the slow Relay fee. The transfer was not sped up so no instant fee. // - This was a instant relay: In this case, a) pay the slow relayer their reward and b) pay the instant relayer // the full bridging amount, minus the realized LP fee and minus the slow relay fee. When the instant // relayer called speedUpRelay they were docked this same amount, minus the instant relayer fee. As a // result, they are effectively paid what they spent when speeding up the relay + the instantRelayFee. uint256 instantRelayerOrRecipientAmount = depositData.amount - _getAmountFromPct(relayData.realizedLpFeePct + depositData.slowRelayFeePct, depositData.amount); // Refund the instant relayer iff the instant relay params match the approved relay. bytes32 instantRelayHash = _getInstantRelayHash(depositHash, relayData); address instantRelayer = instantRelays[instantRelayHash]; // If this is the WETH pool and the instant relayer is is address 0x0 (i.e the relay was not sped up) then: // a) withdraw WETH to ETH and b) send the ETH to the recipient. if (isWethPool && instantRelayer == address(0)) { _unwrapWETHTo(depositData.l1Recipient, instantRelayerOrRecipientAmount); // Else, this is a normal slow relay being finalizes where the contract sends ERC20 to the recipient OR this // is the finalization of an instant relay where we need to reimburse the instant relayer in WETH. } else l1Token.safeTransfer( instantRelayer != address(0) ? instantRelayer : depositData.l1Recipient, instantRelayerOrRecipientAmount ); // There is a fee and a bond to pay out. The fee goes to whoever settles. The bond always goes back to the // slow relayer. // Note: for gas efficiency, we use an if so we can combine these transfers in the event that they are the same // address. uint256 slowRelayerReward = _getAmountFromPct(depositData.slowRelayFeePct, depositData.amount); uint256 totalBond = relayData.finalFee + relayData.proposerBond; if (relayData.slowRelayer == msg.sender) l1Token.safeTransfer(relayData.slowRelayer, slowRelayerReward + totalBond); else { l1Token.safeTransfer(relayData.slowRelayer, totalBond); l1Token.safeTransfer(msg.sender, slowRelayerReward); } uint256 totalReservesSent = instantRelayerOrRecipientAmount + slowRelayerReward; // Update reserves by amounts changed and allocated LP fees. pendingReserves -= depositData.amount; liquidReserves -= totalReservesSent; utilizedReserves += int256(totalReservesSent); bonds -= totalBond; _updateAccumulatedLpFees(); _allocateLpFees(_getAmountFromPct(relayData.realizedLpFeePct, depositData.amount)); emit RelaySettled(depositHash, msg.sender, relayData); // Clean up state storage and receive gas refund. This also prevents `priceDisputed()` from being able to reset // this newly Finalized relay state. delete instantRelays[instantRelayHash]; } /** * @notice Synchronize any balance changes in this contract with the utilized & liquid reserves. This would be done * at the conclusion of an L2 -> L1 token transfer via the canonical token bridge. */ function sync() public nonReentrant() { _sync(); } /** * @notice Computes the exchange rate between LP tokens and L1Tokens. Used when adding/removing liquidity. * @return The updated exchange rate between LP tokens and L1 tokens. */ function exchangeRateCurrent() public nonReentrant() returns (uint256) { return _exchangeRateCurrent(); } /** * @notice Computes the current liquidity utilization ratio. * @dev Used in computing realizedLpFeePct off-chain. * @return The current utilization ratio. */ function liquidityUtilizationCurrent() public nonReentrant() returns (uint256) { return _liquidityUtilizationPostRelay(0); } /** * @notice Computes the liquidity utilization ratio post a relay of known size. * @dev Used in computing realizedLpFeePct off-chain. * @param relayedAmount Size of the relayed deposit to factor into the utilization calculation. * @return The updated utilization ratio accounting for a new `relayedAmount`. */ function liquidityUtilizationPostRelay(uint256 relayedAmount) public nonReentrant() returns (uint256) { return _liquidityUtilizationPostRelay(relayedAmount); } /** * @notice Return both the current utilization value and liquidity utilization post the relay. * @dev Used in computing realizedLpFeePct off-chain. * @param relayedAmount Size of the relayed deposit to factor into the utilization calculation. * @return utilizationCurrent The current utilization ratio. * @return utilizationPostRelay The updated utilization ratio accounting for a new `relayedAmount`. */ function getLiquidityUtilization(uint256 relayedAmount) public nonReentrant() returns (uint256 utilizationCurrent, uint256 utilizationPostRelay) { return (_liquidityUtilizationPostRelay(0), _liquidityUtilizationPostRelay(relayedAmount)); } /** * @notice Updates the address stored in this contract for the OptimisticOracle and the Store to the latest versions * set in the the Finder. Also pull finalFee Store these as local variables to make relay methods gas efficient. * @dev There is no risk of leaving this function public for anyone to call as in all cases we want the addresses * in this contract to map to the latest version in the Finder and store the latest final fee. */ function syncUmaEcosystemParams() public nonReentrant() { FinderInterface finder = FinderInterface(bridgeAdmin.finder()); optimisticOracle = SkinnyOptimisticOracleInterface( finder.getImplementationAddress(OracleInterfaces.SkinnyOptimisticOracle) ); store = StoreInterface(finder.getImplementationAddress(OracleInterfaces.Store)); l1TokenFinalFee = store.computeFinalFee(address(l1Token)).rawValue; } /** * @notice Updates the values of stored constants for the proposerBondPct, optimisticOracleLiveness and identifier * to that set in the bridge Admin. We store these as local variables to make the relay methods more gas efficient. * @dev There is no risk of leaving this function public for anyone to call as in all cases we want these values * in this contract to map to the latest version set in the BridgeAdmin. */ function syncWithBridgeAdminParams() public nonReentrant() { proposerBondPct = bridgeAdmin.proposerBondPct(); optimisticOracleLiveness = bridgeAdmin.optimisticOracleLiveness(); identifier = bridgeAdmin.identifier(); } /************************************ * ADMIN FUNCTIONS * ************************************/ /** * @notice Enable the current bridge admin to transfer admin to to a new address. * @param _newAdmin Admin address of the new admin. */ function changeAdmin(address _newAdmin) public override nonReentrant() { require(msg.sender == address(bridgeAdmin)); bridgeAdmin = BridgeAdminInterface(_newAdmin); emit BridgePoolAdminTransferred(msg.sender, _newAdmin); } /************************************ * VIEW FUNCTIONS * ************************************/ /** * @notice Computes the current amount of unallocated fees that have accumulated from the previous time this the * contract was called. */ function getAccumulatedFees() public view nonReentrantView() returns (uint256) { return _getAccumulatedFees(); } /** * @notice Returns ancillary data containing all relevant Relay data that voters can format into UTF8 and use to * determine if the relay is valid. * @dev Helpful method to test that ancillary data is constructed properly. We should consider removing if we don't * anticipate off-chain bots or users to call this method. * @param depositData Contains L2 deposit information used by off-chain validators to validate relay. * @param relayData Contains relay information used by off-chain validators to validate relay. * @return bytes New ancillary data that can be decoded into UTF8. */ function getRelayAncillaryData(DepositData memory depositData, RelayData memory relayData) public view nonReentrantView() returns (bytes memory) { return _getRelayAncillaryData(_getRelayHash(depositData, relayData)); } /************************************** * INTERNAL & PRIVATE FUNCTIONS * **************************************/ function _liquidityUtilizationPostRelay(uint256 relayedAmount) internal returns (uint256) { _sync(); // Fetch any balance changes due to token bridging finalization and factor them in. // liquidityUtilizationRatio := // (relayedAmount + pendingReserves + max(utilizedReserves,0)) / (liquidReserves + max(utilizedReserves,0)) // UtilizedReserves has a dual meaning: if it's greater than zero then it represents funds pending in the bridge // that will flow from L2 to L1. In this case, we can use it normally in the equation. However, if it is // negative, then it is already counted in liquidReserves. This occurs if tokens are transferred directly to the // contract. In this case, ignore it as it is captured in liquid reserves and has no meaning in the numerator. uint256 flooredUtilizedReserves = utilizedReserves > 0 ? uint256(utilizedReserves) : 0; uint256 numerator = relayedAmount + pendingReserves + flooredUtilizedReserves; uint256 denominator = liquidReserves + flooredUtilizedReserves; // If the denominator equals zero, return 1e18 (max utilization). if (denominator == 0) return 1e18; // In all other cases, return the utilization ratio. return (numerator * 1e18) / denominator; } function _sync() internal { // Check if the l1Token balance of the contract is greater than the liquidReserves. If it is then the bridging // action from L2 -> L1 has concluded and the local accounting can be updated. uint256 l1TokenBalance = l1Token.balanceOf(address(this)) - bonds; if (l1TokenBalance > liquidReserves) { // utilizedReserves can go to less than zero. This will happen if the accumulated fees exceeds the current // outstanding utilization. In other words, if outstanding bridging transfers are 0 then utilizedReserves // will equal the total LP fees accumulated over all time. utilizedReserves -= int256(l1TokenBalance - liquidReserves); liquidReserves = l1TokenBalance; } } function _exchangeRateCurrent() internal returns (uint256) { if (totalSupply() == 0) return 1e18; // initial rate is 1 pre any mint action. // First, update fee counters and local accounting of finalized transfers from L2 -> L1. _updateAccumulatedLpFees(); // Accumulate all allocated fees from the last time this method was called. _sync(); // Fetch any balance changes due to token bridging finalization and factor them in. // ExchangeRate := (liquidReserves + utilizedReserves - undistributedLpFees) / lpTokenSupply uint256 numerator = liquidReserves - undistributedLpFees; if (utilizedReserves > 0) numerator += uint256(utilizedReserves); else numerator -= uint256(utilizedReserves * -1); return (numerator * 1e18) / totalSupply(); } // Return UTF8-decodable ancillary data for relay price request associated with relay hash. function _getRelayAncillaryData(bytes32 relayHash) private pure returns (bytes memory) { return AncillaryData.appendKeyValueBytes32("", "relayHash", relayHash); } // Returns hash of unique relay and deposit event. This is added to the relay request's ancillary data. function _getRelayHash(DepositData memory depositData, RelayData memory relayData) private view returns (bytes32) { return keccak256(abi.encode(depositData, relayData.relayId, relayData.realizedLpFeePct, address(l1Token))); } // Return hash of relay data, which is stored in state and mapped to a deposit hash. function _getRelayDataHash(RelayData memory relayData) private pure returns (bytes32) { return keccak256(abi.encode(relayData)); } // Reverts if the stored relay data hash for `depositHash` does not match `_relayData`. function _validateRelayDataHash(bytes32 depositHash, RelayData memory relayData) private view { require( relays[depositHash] == _getRelayDataHash(relayData), "Hashed relay params do not match existing relay hash for deposit" ); } // Return hash of unique instant relay and deposit event. This is stored in state and mapped to a deposit hash. function _getInstantRelayHash(bytes32 depositHash, RelayData memory relayData) private pure returns (bytes32) { // Only include parameters that affect the "correctness" of an instant relay. For example, the realized LP fee // % directly affects how many tokens the instant relayer needs to send to the user, whereas the address of the // instant relayer does not matter for determining whether an instant relay is "correct". return keccak256(abi.encode(depositHash, relayData.realizedLpFeePct)); } function _getAccumulatedFees() internal view returns (uint256) { // UnallocatedLpFees := min(undistributedLpFees*lpFeeRatePerSecond*timeFromLastInteraction,undistributedLpFees) // The min acts to pay out all fees in the case the equation returns more than the remaining a fees. uint256 possibleUnpaidFees = (undistributedLpFees * lpFeeRatePerSecond * (getCurrentTime() - lastLpFeeUpdate)) / (1e18); return possibleUnpaidFees < undistributedLpFees ? possibleUnpaidFees : undistributedLpFees; } // Update internal fee counters by adding in any accumulated fees from the last time this logic was called. function _updateAccumulatedLpFees() internal { // Calculate the unallocatedAccumulatedFees from the last time the contract was called. uint256 unallocatedAccumulatedFees = _getAccumulatedFees(); // Decrement the undistributedLpFees by the amount of accumulated fees. undistributedLpFees = undistributedLpFees - unallocatedAccumulatedFees; lastLpFeeUpdate = uint32(getCurrentTime()); } // Allocate fees to the LPs by incrementing counters. function _allocateLpFees(uint256 allocatedLpFees) internal { // Add to the total undistributed LP fees and the utilized reserves. Adding it to the utilized reserves acts to // track the fees while they are in transit. undistributedLpFees += allocatedLpFees; utilizedReserves += int256(allocatedLpFees); } function _getAmountFromPct(uint64 percent, uint256 amount) private pure returns (uint256) { return (percent * amount) / 1e18; } function _getProposerBond(uint256 amount) private view returns (uint256) { return _getAmountFromPct(proposerBondPct, amount); } function _getDepositHash(DepositData memory depositData) private view returns (bytes32) { return keccak256( abi.encode( depositData.chainId, depositData.depositId, depositData.l1Recipient, depositData.l2Sender, address(l1Token), depositData.amount, depositData.slowRelayFeePct, depositData.instantRelayFeePct, depositData.quoteTimestamp ) ); } // Proposes new price of True for relay event associated with `customAncillaryData` to optimistic oracle. If anyone // disagrees with the relay parameters and whether they map to an L2 deposit, they can dispute with the oracle. function _requestProposeDispute( address proposer, address disputer, uint256 proposerBond, uint256 finalFee, bytes memory customAncillaryData ) private returns (bool) { uint256 totalBond = finalFee + proposerBond; l1Token.safeApprove(address(optimisticOracle), totalBond); try optimisticOracle.requestAndProposePriceFor( identifier, uint32(getCurrentTime()), customAncillaryData, IERC20(l1Token), // Set reward to 0, since we'll settle proposer reward payouts directly from this contract after a relay // proposal has passed the challenge period. 0, // Set the Optimistic oracle proposer bond for the price request. proposerBond, // Set the Optimistic oracle liveness for the price request. optimisticOracleLiveness, proposer, // Canonical value representing "True"; i.e. the proposed relay is valid. int256(1e18) ) returns (uint256 bondSpent) { if (bondSpent < totalBond) { // If the OO pulls less (due to a change in final fee), refund the proposer. uint256 refund = totalBond - bondSpent; l1Token.safeTransfer(proposer, refund); l1Token.safeApprove(address(optimisticOracle), 0); totalBond = bondSpent; } } catch { // If there's an error in the OO, this means something has changed to make this request undisputable. // To ensure the request does not go through by default, refund the proposer and return early, allowing // the calling method to delete the request, but with no additional recourse by the OO. l1Token.safeTransfer(proposer, totalBond); l1Token.safeApprove(address(optimisticOracle), 0); // Return early noting that the attempt at a proposal + dispute did not succeed. return false; } SkinnyOptimisticOracleInterface.Request memory request = SkinnyOptimisticOracleInterface.Request({ proposer: proposer, disputer: address(0), currency: IERC20(l1Token), settled: false, proposedPrice: int256(1e18), resolvedPrice: 0, expirationTime: getCurrentTime() + optimisticOracleLiveness, reward: 0, finalFee: totalBond - proposerBond, bond: proposerBond, customLiveness: uint256(optimisticOracleLiveness) }); // Note: don't pull funds until here to avoid any transfers that aren't needed. l1Token.safeTransferFrom(msg.sender, address(this), totalBond); l1Token.safeApprove(address(optimisticOracle), totalBond); // Dispute the request that we just sent. optimisticOracle.disputePriceFor( identifier, uint32(getCurrentTime()), customAncillaryData, request, disputer, address(this) ); // Return true to denote that the proposal + dispute calls succeeded. return true; } // Unwraps ETH and does a transfer to a recipient address. If the recipient is a smart contract then sends WETH. function _unwrapWETHTo(address payable to, uint256 amount) internal { if (address(to).isContract()) { l1Token.safeTransfer(to, amount); } else { WETH9Like(address(l1Token)).withdraw(amount); to.transfer(amount); } } // Added to enable the BridgePool to receive ETH. used when unwrapping Weth. receive() external payable {} } /** * @notice This is the BridgePool contract that should be deployed on live networks. It is exactly the same as the * regular BridgePool contract, but it overrides getCurrentTime to make the call a simply return block.timestamp with * no branching or storage queries. This is done to save gas. */ contract BridgePoolProd is BridgePool { constructor( string memory _lpTokenName, string memory _lpTokenSymbol, address _bridgeAdmin, address _l1Token, uint64 _lpFeeRatePerSecond, bool _isWethPool, address _timer ) BridgePool(_lpTokenName, _lpTokenSymbol, _bridgeAdmin, _l1Token, _lpFeeRatePerSecond, _isWethPool, _timer) {} function getCurrentTime() public view virtual override returns (uint256) { return block.timestamp; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; /** * @notice Helper view methods designed to be called by BridgePool contracts. */ interface BridgeAdminInterface { event SetDepositContracts( uint256 indexed chainId, address indexed l2DepositContract, address indexed l2MessengerContract ); event SetCrossDomainAdmin(uint256 indexed chainId, address indexed newAdmin); event SetRelayIdentifier(bytes32 indexed identifier); event SetOptimisticOracleLiveness(uint32 indexed liveness); event SetProposerBondPct(uint64 indexed proposerBondPct); event WhitelistToken(uint256 chainId, address indexed l1Token, address indexed l2Token, address indexed bridgePool); event SetMinimumBridgingDelay(uint256 indexed chainId, uint64 newMinimumBridgingDelay); event DepositsEnabled(uint256 indexed chainId, address indexed l2Token, bool depositsEnabled); event BridgePoolsAdminTransferred(address[] bridgePools, address newAdmin); function finder() external view returns (address); struct DepositUtilityContracts { address depositContract; // L2 deposit contract where cross-chain relays originate. address messengerContract; // L1 helper contract that can send a message to the L2 with the mapped network ID. } function depositContracts(uint256) external view returns (DepositUtilityContracts memory); struct L1TokenRelationships { mapping(uint256 => address) l2Tokens; // L2 Chain Id to l2Token address. address bridgePool; } function whitelistedTokens(address, uint256) external view returns (address l2Token, address bridgePool); function optimisticOracleLiveness() external view returns (uint32); function proposerBondPct() external view returns (uint64); function identifier() external view returns (bytes32); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface BridgePoolInterface { function l1Token() external view returns (IERC20); function changeAdmin(address newAdmin) external; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/OptimisticOracleInterface.sol"; /** * @title Interface for the gas-cost-reduced version of the OptimisticOracle. * @notice Differences from normal OptimisticOracle: * - refundOnDispute: flag is removed, by default there are no refunds on disputes. * - customizing request parameters: In the OptimisticOracle, parameters like `bond` and `customLiveness` can be reset * after a request is already made via `requestPrice`. In the SkinnyOptimisticOracle, these parameters can only be * set in `requestPrice`, which has an expanded input set. * - settleAndGetPrice: Replaced by `settle`, which can only be called once per settleable request. The resolved price * can be fetched via the `Settle` event or the return value of `settle`. * - general changes to interface: Functions that interact with existing requests all require the parameters of the * request to modify to be passed as input. These parameters must match with the existing request parameters or the * function will revert. This change reflects the internal refactor to store hashed request parameters instead of the * full request struct. * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface. */ abstract contract SkinnyOptimisticOracleInterface { // Struct representing a price request. Note that this differs from the OptimisticOracleInterface's Request struct // in that refundOnDispute is removed. struct Request { address proposer; // Address of the proposer. address disputer; // Address of the disputer. IERC20 currency; // ERC20 token used to pay rewards and fees. bool settled; // True if the request is settled. int256 proposedPrice; // Price that the proposer submitted. int256 resolvedPrice; // Price resolved once the request is settled. uint256 expirationTime; // Time at which the request auto-settles without a dispute. uint256 reward; // Amount of the currency to pay to the proposer on settlement. uint256 finalFee; // Final fee to pay to the Store upon request to the DVM. uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee. uint256 customLiveness; // Custom liveness value set by the requester. } // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses // to accept a price request made with ancillary data length over a certain size. uint256 public constant ancillaryBytesLimit = 8192; /** * @notice Requests a new price. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data representing additional args being passed with the price request. * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM. * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0, * which could make sense if the contract requests and proposes the value in the same call or * provides its own reward system. * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee. * @param customLiveness custom proposal liveness to set for request. * @return totalBond default bond + final fee that the proposer and disputer will be required to pay. */ function requestPrice( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, IERC20 currency, uint256 reward, uint256 bond, uint256 customLiveness ) external virtual returns (uint256 totalBond); /** * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come * from this proposal. However, any bonds are pulled from the caller. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param request price request parameters whose hash must match the request that the caller wants to * propose a price for. * @param proposer address to set as the proposer. * @param proposedPrice price being proposed. * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to * the proposer once settled if the proposal is correct. */ function proposePriceFor( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request, address proposer, int256 proposedPrice ) public virtual returns (uint256 totalBond); /** * @notice Proposes a price value where caller is the proposer. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param request price request parameters whose hash must match the request that the caller wants to * propose a price for. * @param proposedPrice price being proposed. * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to * the proposer once settled if the proposal is correct. */ function proposePrice( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request, int256 proposedPrice ) external virtual returns (uint256 totalBond); /** * @notice Combines logic of requestPrice and proposePrice while taking advantage of gas savings from not having to * overwrite Request params that a normal requestPrice() => proposePrice() flow would entail. Note: The proposer * will receive any rewards that come from this proposal. However, any bonds are pulled from the caller. * @dev The caller is the requester, but the proposer can be customized. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM. * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0, * which could make sense if the contract requests and proposes the value in the same call or * provides its own reward system. * @param bond custom proposal bond to set for request. If set to 0, defaults to the final fee. * @param customLiveness custom proposal liveness to set for request. * @param proposer address to set as the proposer. * @param proposedPrice price being proposed. * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to * the proposer once settled if the proposal is correct. */ function requestAndProposePriceFor( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, IERC20 currency, uint256 reward, uint256 bond, uint256 customLiveness, address proposer, int256 proposedPrice ) external virtual returns (uint256 totalBond); /** * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will * receive any rewards that come from this dispute. However, any bonds are pulled from the caller. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param request price request parameters whose hash must match the request that the caller wants to * dispute. * @param disputer address to set as the disputer. * @param requester sender of the initial price request. * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to * the disputer once settled if the dispute was valid (the proposal was incorrect). */ function disputePriceFor( bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request, address disputer, address requester ) public virtual returns (uint256 totalBond); /** * @notice Disputes a price request with an active proposal where caller is the disputer. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param request price request parameters whose hash must match the request that the caller wants to * dispute. * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to * the disputer once settled if the dispute was valid (the proposal was incorrect). */ function disputePrice( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request ) external virtual returns (uint256 totalBond); /** * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param request price request parameters whose hash must match the request that the caller wants to * settle. * @return payout the amount that the "winner" (proposer or disputer) receives on settlement. This amount includes * the returned bonds as well as additional rewards. * @return resolvedPrice the price that the request settled to. */ function settle( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request ) external virtual returns (uint256 payout, int256 resolvedPrice); /** * @notice Computes the current state of a price request. See the State enum for more details. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param request price request parameters. * @return the State. */ function getState( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request ) external virtual returns (OptimisticOracleInterface.State); /** * @notice Checks if a given request has resolved, expired or been settled (i.e the optimistic oracle has a price). * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param request price request parameters. The hash of these parameters must match with the request hash that is * associated with the price request unique ID {requester, identifier, timestamp, ancillaryData}, or this method * will revert. * @return boolean indicating true if price exists and false if not. */ function hasPrice( address requester, bytes32 identifier, uint32 timestamp, bytes memory ancillaryData, Request memory request ) public virtual returns (bool); /** * @notice Generates stamped ancillary data in the format that it would be used in the case of a price dispute. * @param ancillaryData ancillary data of the price being requested. * @param requester sender of the initial price request. * @return the stamped ancillary bytes. */ function stampAncillaryData(bytes memory ancillaryData, address requester) public pure virtual returns (bytes memory); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../common/implementation/FixedPoint.sol"; /** * @title Interface that allows financial contracts to pay oracle fees for their use of the system. */ interface StoreInterface { /** * @notice Pays Oracle fees in ETH to the store. * @dev To be used by contracts whose margin currency is ETH. */ function payOracleFees() external payable; /** * @notice Pays oracle fees in the margin currency, erc20Address, to the store. * @dev To be used if the margin currency is an ERC20 token rather than ETH. * @param erc20Address address of the ERC20 token used to pay the fee. * @param amount number of tokens to transfer. An approval for at least this amount must exist. */ function payOracleFeesErc20(address erc20Address, FixedPoint.Unsigned calldata amount) external; /** * @notice Computes the regular oracle fees that a contract should pay for a period. * @param startTime defines the beginning time from which the fee is paid. * @param endTime end time until which the fee is paid. * @param pfc "profit from corruption", or the maximum amount of margin currency that a * token sponsor could extract from the contract through corrupting the price feed in their favor. * @return regularFee amount owed for the duration from start to end time for the given pfc. * @return latePenalty for paying the fee after the deadline. */ function computeRegularFee( uint256 startTime, uint256 endTime, FixedPoint.Unsigned calldata pfc ) external view returns (FixedPoint.Unsigned memory regularFee, FixedPoint.Unsigned memory latePenalty); /** * @notice Computes the final oracle fees that a contract should pay at settlement. * @param currency token used to pay the final fee. * @return finalFee amount due. */ function computeFinalFee(address currency) external view returns (FixedPoint.Unsigned memory); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; /** * @title Provides addresses of the live contracts implementing certain interfaces. * @dev Examples are the Oracle or Store interfaces. */ interface FinderInterface { /** * @notice Updates the address of the contract that implements `interfaceName`. * @param interfaceName bytes32 encoding of the interface name that is either changed or registered. * @param implementationAddress address of the deployed contract that implements the interface. */ function changeImplementationAddress(bytes32 interfaceName, address implementationAddress) external; /** * @notice Gets the address of the contract that implements the given `interfaceName`. * @param interfaceName queried interface. * @return implementationAddress address of the deployed contract that implements the interface. */ function getImplementationAddress(bytes32 interfaceName) external view returns (address); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; /** * @title Stores common interface names used throughout the DVM by registration in the Finder. */ library OracleInterfaces { bytes32 public constant Oracle = "Oracle"; bytes32 public constant IdentifierWhitelist = "IdentifierWhitelist"; bytes32 public constant Store = "Store"; bytes32 public constant FinancialContractsAdmin = "FinancialContractsAdmin"; bytes32 public constant Registry = "Registry"; bytes32 public constant CollateralWhitelist = "CollateralWhitelist"; bytes32 public constant OptimisticOracle = "OptimisticOracle"; bytes32 public constant Bridge = "Bridge"; bytes32 public constant GenericHandler = "GenericHandler"; bytes32 public constant SkinnyOptimisticOracle = "SkinnyOptimisticOracle"; }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; /** * @title Library for encoding and decoding ancillary data for DVM price requests. * @notice We assume that on-chain ancillary data can be formatted directly from bytes to utf8 encoding via * web3.utils.hexToUtf8, and that clients will parse the utf8-encoded ancillary data as a comma-delimitted key-value * dictionary. Therefore, this library provides internal methods that aid appending to ancillary data from Solidity * smart contracts. More details on UMA's ancillary data guidelines below: * https://docs.google.com/document/d/1zhKKjgY1BupBGPPrY_WOJvui0B6DMcd-xDR8-9-SPDw/edit */ library AncillaryData { // This converts the bottom half of a bytes32 input to hex in a highly gas-optimized way. // Source: the brilliant implementation at https://gitter.im/ethereum/solidity?at=5840d23416207f7b0ed08c9b. function toUtf8Bytes32Bottom(bytes32 bytesIn) private pure returns (bytes32) { unchecked { uint256 x = uint256(bytesIn); // Nibble interleave x = x & 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; x = (x | (x * 2**64)) & 0x0000000000000000ffffffffffffffff0000000000000000ffffffffffffffff; x = (x | (x * 2**32)) & 0x00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff; x = (x | (x * 2**16)) & 0x0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff; x = (x | (x * 2**8)) & 0x00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff; x = (x | (x * 2**4)) & 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f; // Hex encode uint256 h = (x & 0x0808080808080808080808080808080808080808080808080808080808080808) / 8; uint256 i = (x & 0x0404040404040404040404040404040404040404040404040404040404040404) / 4; uint256 j = (x & 0x0202020202020202020202020202020202020202020202020202020202020202) / 2; x = x + (h & (i | j)) * 0x27 + 0x3030303030303030303030303030303030303030303030303030303030303030; // Return the result. return bytes32(x); } } /** * @notice Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8. * @dev Will return bytes32 in all lower case hex characters and without the leading 0x. * This has minor changes from the toUtf8BytesAddress to control for the size of the input. * @param bytesIn bytes32 to encode. * @return utf8 encoded bytes32. */ function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) { return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn)); } /** * @notice Returns utf8-encoded address that can be read via web3.utils.hexToUtf8. * Source: https://ethereum.stackexchange.com/questions/8346/convert-address-to-string/8447#8447 * @dev Will return address in all lower case characters and without the leading 0x. * @param x address to encode. * @return utf8 encoded address bytes. */ function toUtf8BytesAddress(address x) internal pure returns (bytes memory) { return abi.encodePacked(toUtf8Bytes32Bottom(bytes32(bytes20(x)) >> 128), bytes8(toUtf8Bytes32Bottom(bytes20(x)))); } /** * @notice Converts a uint into a base-10, UTF-8 representation stored in a `string` type. * @dev This method is based off of this code: https://stackoverflow.com/a/65707309. */ function toUtf8BytesUint(uint256 x) internal pure returns (bytes memory) { if (x == 0) { return "0"; } uint256 j = x; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len; while (x != 0) { k = k - 1; uint8 temp = (48 + uint8(x - (x / 10) * 10)); bytes1 b1 = bytes1(temp); bstr[k] = b1; x /= 10; } return bstr; } function appendKeyValueBytes32( bytes memory currentAncillaryData, bytes memory key, bytes32 value ) internal pure returns (bytes memory) { bytes memory prefix = constructPrefix(currentAncillaryData, key); return abi.encodePacked(prefix, toUtf8Bytes(value)); } /** * @notice Adds "key:value" to `currentAncillaryData` where `value` is an address that first needs to be converted * to utf8 bytes. For example, if `utf8(currentAncillaryData)="k1:v1"`, then this function will return * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`. * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not. * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not. * @param value An address to set as the value in the key:value pair to append to `currentAncillaryData`. * @return Newly appended ancillary data. */ function appendKeyValueAddress( bytes memory currentAncillaryData, bytes memory key, address value ) internal pure returns (bytes memory) { bytes memory prefix = constructPrefix(currentAncillaryData, key); return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesAddress(value)); } /** * @notice Adds "key:value" to `currentAncillaryData` where `value` is a uint that first needs to be converted * to utf8 bytes. For example, if `utf8(currentAncillaryData)="k1:v1"`, then this function will return * `utf8(k1:v1,key:value)`, and if `currentAncillaryData` is blank, then this will return `utf8(key:value)`. * @param currentAncillaryData This bytes data should ideally be able to be utf8-decoded, but its OK if not. * @param key Again, this bytes data should ideally be able to be utf8-decoded, but its OK if not. * @param value A uint to set as the value in the key:value pair to append to `currentAncillaryData`. * @return Newly appended ancillary data. */ function appendKeyValueUint( bytes memory currentAncillaryData, bytes memory key, uint256 value ) internal pure returns (bytes memory) { bytes memory prefix = constructPrefix(currentAncillaryData, key); return abi.encodePacked(currentAncillaryData, prefix, toUtf8BytesUint(value)); } /** * @notice Helper method that returns the left hand side of a "key:value" pair plus the colon ":" and a leading * comma "," if the `currentAncillaryData` is not empty. The return value is intended to be prepended as a prefix to * some utf8 value that is ultimately added to a comma-delimited, key-value dictionary. */ function constructPrefix(bytes memory currentAncillaryData, bytes memory key) internal pure returns (bytes memory) { if (currentAncillaryData.length > 0) { return abi.encodePacked(",", key, ":"); } else { return abi.encodePacked(key, ":"); } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "./Timer.sol"; /** * @title Base class that provides time overrides, but only if being run in test mode. */ abstract contract Testable { // If the contract is being run in production, then `timerAddress` will be the 0x0 address. // Note: this variable should be set on construction and never modified. address public timerAddress; /** * @notice Constructs the Testable contract. Called by child contracts. * @param _timerAddress Contract that stores the current time in a testing environment. * Must be set to 0x0 for production environments that use live time. */ constructor(address _timerAddress) { timerAddress = _timerAddress; } /** * @notice Reverts if not running in test mode. */ modifier onlyIfTest { require(timerAddress != address(0x0)); _; } /** * @notice Sets the current time. * @dev Will revert if not running in test mode. * @param time timestamp to set current Testable time to. */ function setCurrentTime(uint256 time) external onlyIfTest { Timer(timerAddress).setCurrentTime(time); } /** * @notice Gets the current time. Will return the last time set in `setCurrentTime` if running in test mode. * Otherwise, it will return the block timestamp. * @return uint for the current Testable timestamp. */ function getCurrentTime() public view virtual returns (uint256) { if (timerAddress != address(0x0)) { return Timer(timerAddress).getCurrentTime(); } else { return block.timestamp; // solhint-disable-line not-rely-on-time } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/math/SignedSafeMath.sol"; /** * @title Library for fixed point arithmetic on uints */ library FixedPoint { using SafeMath for uint256; using SignedSafeMath for int256; // Supports 18 decimals. E.g., 1e18 represents "1", 5e17 represents "0.5". // For unsigned values: // This can represent a value up to (2^256 - 1)/10^18 = ~10^59. 10^59 will be stored internally as uint256 10^77. uint256 private constant FP_SCALING_FACTOR = 10**18; // --------------------------------------- UNSIGNED ----------------------------------------------------------------------------- struct Unsigned { uint256 rawValue; } /** * @notice Constructs an `Unsigned` from an unscaled uint, e.g., `b=5` gets stored internally as `5*(10**18)`. * @param a uint to convert into a FixedPoint. * @return the converted FixedPoint. */ function fromUnscaledUint(uint256 a) internal pure returns (Unsigned memory) { return Unsigned(a.mul(FP_SCALING_FACTOR)); } /** * @notice Whether `a` is equal to `b`. * @param a a FixedPoint. * @param b a uint256. * @return True if equal, or False. */ function isEqual(Unsigned memory a, uint256 b) internal pure returns (bool) { return a.rawValue == fromUnscaledUint(b).rawValue; } /** * @notice Whether `a` is equal to `b`. * @param a a FixedPoint. * @param b a FixedPoint. * @return True if equal, or False. */ function isEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue == b.rawValue; } /** * @notice Whether `a` is greater than `b`. * @param a a FixedPoint. * @param b a FixedPoint. * @return True if `a > b`, or False. */ function isGreaterThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue > b.rawValue; } /** * @notice Whether `a` is greater than `b`. * @param a a FixedPoint. * @param b a uint256. * @return True if `a > b`, or False. */ function isGreaterThan(Unsigned memory a, uint256 b) internal pure returns (bool) { return a.rawValue > fromUnscaledUint(b).rawValue; } /** * @notice Whether `a` is greater than `b`. * @param a a uint256. * @param b a FixedPoint. * @return True if `a > b`, or False. */ function isGreaterThan(uint256 a, Unsigned memory b) internal pure returns (bool) { return fromUnscaledUint(a).rawValue > b.rawValue; } /** * @notice Whether `a` is greater than or equal to `b`. * @param a a FixedPoint. * @param b a FixedPoint. * @return True if `a >= b`, or False. */ function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue >= b.rawValue; } /** * @notice Whether `a` is greater than or equal to `b`. * @param a a FixedPoint. * @param b a uint256. * @return True if `a >= b`, or False. */ function isGreaterThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) { return a.rawValue >= fromUnscaledUint(b).rawValue; } /** * @notice Whether `a` is greater than or equal to `b`. * @param a a uint256. * @param b a FixedPoint. * @return True if `a >= b`, or False. */ function isGreaterThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) { return fromUnscaledUint(a).rawValue >= b.rawValue; } /** * @notice Whether `a` is less than `b`. * @param a a FixedPoint. * @param b a FixedPoint. * @return True if `a < b`, or False. */ function isLessThan(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue < b.rawValue; } /** * @notice Whether `a` is less than `b`. * @param a a FixedPoint. * @param b a uint256. * @return True if `a < b`, or False. */ function isLessThan(Unsigned memory a, uint256 b) internal pure returns (bool) { return a.rawValue < fromUnscaledUint(b).rawValue; } /** * @notice Whether `a` is less than `b`. * @param a a uint256. * @param b a FixedPoint. * @return True if `a < b`, or False. */ function isLessThan(uint256 a, Unsigned memory b) internal pure returns (bool) { return fromUnscaledUint(a).rawValue < b.rawValue; } /** * @notice Whether `a` is less than or equal to `b`. * @param a a FixedPoint. * @param b a FixedPoint. * @return True if `a <= b`, or False. */ function isLessThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue <= b.rawValue; } /** * @notice Whether `a` is less than or equal to `b`. * @param a a FixedPoint. * @param b a uint256. * @return True if `a <= b`, or False. */ function isLessThanOrEqual(Unsigned memory a, uint256 b) internal pure returns (bool) { return a.rawValue <= fromUnscaledUint(b).rawValue; } /** * @notice Whether `a` is less than or equal to `b`. * @param a a uint256. * @param b a FixedPoint. * @return True if `a <= b`, or False. */ function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) { return fromUnscaledUint(a).rawValue <= b.rawValue; } /** * @notice The minimum of `a` and `b`. * @param a a FixedPoint. * @param b a FixedPoint. * @return the minimum of `a` and `b`. */ function min(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { return a.rawValue < b.rawValue ? a : b; } /** * @notice The maximum of `a` and `b`. * @param a a FixedPoint. * @param b a FixedPoint. * @return the maximum of `a` and `b`. */ function max(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { return a.rawValue > b.rawValue ? a : b; } /** * @notice Adds two `Unsigned`s, reverting on overflow. * @param a a FixedPoint. * @param b a FixedPoint. * @return the sum of `a` and `b`. */ function add(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { return Unsigned(a.rawValue.add(b.rawValue)); } /** * @notice Adds an `Unsigned` to an unscaled uint, reverting on overflow. * @param a a FixedPoint. * @param b a uint256. * @return the sum of `a` and `b`. */ function add(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { return add(a, fromUnscaledUint(b)); } /** * @notice Subtracts two `Unsigned`s, reverting on overflow. * @param a a FixedPoint. * @param b a FixedPoint. * @return the difference of `a` and `b`. */ function sub(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { return Unsigned(a.rawValue.sub(b.rawValue)); } /** * @notice Subtracts an unscaled uint256 from an `Unsigned`, reverting on overflow. * @param a a FixedPoint. * @param b a uint256. * @return the difference of `a` and `b`. */ function sub(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { return sub(a, fromUnscaledUint(b)); } /** * @notice Subtracts an `Unsigned` from an unscaled uint256, reverting on overflow. * @param a a uint256. * @param b a FixedPoint. * @return the difference of `a` and `b`. */ function sub(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) { return sub(fromUnscaledUint(a), b); } /** * @notice Multiplies two `Unsigned`s, reverting on overflow. * @dev This will "floor" the product. * @param a a FixedPoint. * @param b a FixedPoint. * @return the product of `a` and `b`. */ function mul(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { // There are two caveats with this computation: // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is // stored internally as a uint256 ~10^59. // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which // would round to 3, but this computation produces the result 2. // No need to use SafeMath because FP_SCALING_FACTOR != 0. return Unsigned(a.rawValue.mul(b.rawValue) / FP_SCALING_FACTOR); } /** * @notice Multiplies an `Unsigned` and an unscaled uint256, reverting on overflow. * @dev This will "floor" the product. * @param a a FixedPoint. * @param b a uint256. * @return the product of `a` and `b`. */ function mul(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { return Unsigned(a.rawValue.mul(b)); } /** * @notice Multiplies two `Unsigned`s and "ceil's" the product, reverting on overflow. * @param a a FixedPoint. * @param b a FixedPoint. * @return the product of `a` and `b`. */ function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { uint256 mulRaw = a.rawValue.mul(b.rawValue); uint256 mulFloor = mulRaw / FP_SCALING_FACTOR; uint256 mod = mulRaw.mod(FP_SCALING_FACTOR); if (mod != 0) { return Unsigned(mulFloor.add(1)); } else { return Unsigned(mulFloor); } } /** * @notice Multiplies an `Unsigned` and an unscaled uint256 and "ceil's" the product, reverting on overflow. * @param a a FixedPoint. * @param b a FixedPoint. * @return the product of `a` and `b`. */ function mulCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { // Since b is an int, there is no risk of truncation and we can just mul it normally return Unsigned(a.rawValue.mul(b)); } /** * @notice Divides one `Unsigned` by an `Unsigned`, reverting on overflow or division by 0. * @dev This will "floor" the quotient. * @param a a FixedPoint numerator. * @param b a FixedPoint denominator. * @return the quotient of `a` divided by `b`. */ function div(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { // There are two caveats with this computation: // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows. // 10^41 is stored internally as a uint256 10^59. // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666. return Unsigned(a.rawValue.mul(FP_SCALING_FACTOR).div(b.rawValue)); } /** * @notice Divides one `Unsigned` by an unscaled uint256, reverting on overflow or division by 0. * @dev This will "floor" the quotient. * @param a a FixedPoint numerator. * @param b a uint256 denominator. * @return the quotient of `a` divided by `b`. */ function div(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { return Unsigned(a.rawValue.div(b)); } /** * @notice Divides one unscaled uint256 by an `Unsigned`, reverting on overflow or division by 0. * @dev This will "floor" the quotient. * @param a a uint256 numerator. * @param b a FixedPoint denominator. * @return the quotient of `a` divided by `b`. */ function div(uint256 a, Unsigned memory b) internal pure returns (Unsigned memory) { return div(fromUnscaledUint(a), b); } /** * @notice Divides one `Unsigned` by an `Unsigned` and "ceil's" the quotient, reverting on overflow or division by 0. * @param a a FixedPoint numerator. * @param b a FixedPoint denominator. * @return the quotient of `a` divided by `b`. */ function divCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) { uint256 aScaled = a.rawValue.mul(FP_SCALING_FACTOR); uint256 divFloor = aScaled.div(b.rawValue); uint256 mod = aScaled.mod(b.rawValue); if (mod != 0) { return Unsigned(divFloor.add(1)); } else { return Unsigned(divFloor); } } /** * @notice Divides one `Unsigned` by an unscaled uint256 and "ceil's" the quotient, reverting on overflow or division by 0. * @param a a FixedPoint numerator. * @param b a uint256 denominator. * @return the quotient of `a` divided by `b`. */ function divCeil(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory) { // Because it is possible that a quotient gets truncated, we can't just call "Unsigned(a.rawValue.div(b))" // similarly to mulCeil with a uint256 as the second parameter. Therefore we need to convert b into an Unsigned. // This creates the possibility of overflow if b is very large. return divCeil(a, fromUnscaledUint(b)); } /** * @notice Raises an `Unsigned` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`. * @dev This will "floor" the result. * @param a a FixedPoint numerator. * @param b a uint256 denominator. * @return output is `a` to the power of `b`. */ function pow(Unsigned memory a, uint256 b) internal pure returns (Unsigned memory output) { output = fromUnscaledUint(1); for (uint256 i = 0; i < b; i = i.add(1)) { output = mul(output, a); } } // ------------------------------------------------- SIGNED ------------------------------------------------------------- // Supports 18 decimals. E.g., 1e18 represents "1", 5e17 represents "0.5". // For signed values: // This can represent a value up (or down) to +-(2^255 - 1)/10^18 = ~10^58. 10^58 will be stored internally as int256 10^76. int256 private constant SFP_SCALING_FACTOR = 10**18; struct Signed { int256 rawValue; } function fromSigned(Signed memory a) internal pure returns (Unsigned memory) { require(a.rawValue >= 0, "Negative value provided"); return Unsigned(uint256(a.rawValue)); } function fromUnsigned(Unsigned memory a) internal pure returns (Signed memory) { require(a.rawValue <= uint256(type(int256).max), "Unsigned too large"); return Signed(int256(a.rawValue)); } /** * @notice Constructs a `Signed` from an unscaled int, e.g., `b=5` gets stored internally as `5*(10**18)`. * @param a int to convert into a FixedPoint.Signed. * @return the converted FixedPoint.Signed. */ function fromUnscaledInt(int256 a) internal pure returns (Signed memory) { return Signed(a.mul(SFP_SCALING_FACTOR)); } /** * @notice Whether `a` is equal to `b`. * @param a a FixedPoint.Signed. * @param b a int256. * @return True if equal, or False. */ function isEqual(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue == fromUnscaledInt(b).rawValue; } /** * @notice Whether `a` is equal to `b`. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return True if equal, or False. */ function isEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue == b.rawValue; } /** * @notice Whether `a` is greater than `b`. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return True if `a > b`, or False. */ function isGreaterThan(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue > b.rawValue; } /** * @notice Whether `a` is greater than `b`. * @param a a FixedPoint.Signed. * @param b an int256. * @return True if `a > b`, or False. */ function isGreaterThan(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue > fromUnscaledInt(b).rawValue; } /** * @notice Whether `a` is greater than `b`. * @param a an int256. * @param b a FixedPoint.Signed. * @return True if `a > b`, or False. */ function isGreaterThan(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue > b.rawValue; } /** * @notice Whether `a` is greater than or equal to `b`. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return True if `a >= b`, or False. */ function isGreaterThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue >= b.rawValue; } /** * @notice Whether `a` is greater than or equal to `b`. * @param a a FixedPoint.Signed. * @param b an int256. * @return True if `a >= b`, or False. */ function isGreaterThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue >= fromUnscaledInt(b).rawValue; } /** * @notice Whether `a` is greater than or equal to `b`. * @param a an int256. * @param b a FixedPoint.Signed. * @return True if `a >= b`, or False. */ function isGreaterThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue >= b.rawValue; } /** * @notice Whether `a` is less than `b`. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return True if `a < b`, or False. */ function isLessThan(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue < b.rawValue; } /** * @notice Whether `a` is less than `b`. * @param a a FixedPoint.Signed. * @param b an int256. * @return True if `a < b`, or False. */ function isLessThan(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue < fromUnscaledInt(b).rawValue; } /** * @notice Whether `a` is less than `b`. * @param a an int256. * @param b a FixedPoint.Signed. * @return True if `a < b`, or False. */ function isLessThan(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue < b.rawValue; } /** * @notice Whether `a` is less than or equal to `b`. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return True if `a <= b`, or False. */ function isLessThanOrEqual(Signed memory a, Signed memory b) internal pure returns (bool) { return a.rawValue <= b.rawValue; } /** * @notice Whether `a` is less than or equal to `b`. * @param a a FixedPoint.Signed. * @param b an int256. * @return True if `a <= b`, or False. */ function isLessThanOrEqual(Signed memory a, int256 b) internal pure returns (bool) { return a.rawValue <= fromUnscaledInt(b).rawValue; } /** * @notice Whether `a` is less than or equal to `b`. * @param a an int256. * @param b a FixedPoint.Signed. * @return True if `a <= b`, or False. */ function isLessThanOrEqual(int256 a, Signed memory b) internal pure returns (bool) { return fromUnscaledInt(a).rawValue <= b.rawValue; } /** * @notice The minimum of `a` and `b`. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return the minimum of `a` and `b`. */ function min(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return a.rawValue < b.rawValue ? a : b; } /** * @notice The maximum of `a` and `b`. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return the maximum of `a` and `b`. */ function max(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return a.rawValue > b.rawValue ? a : b; } /** * @notice Adds two `Signed`s, reverting on overflow. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return the sum of `a` and `b`. */ function add(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return Signed(a.rawValue.add(b.rawValue)); } /** * @notice Adds an `Signed` to an unscaled int, reverting on overflow. * @param a a FixedPoint.Signed. * @param b an int256. * @return the sum of `a` and `b`. */ function add(Signed memory a, int256 b) internal pure returns (Signed memory) { return add(a, fromUnscaledInt(b)); } /** * @notice Subtracts two `Signed`s, reverting on overflow. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return the difference of `a` and `b`. */ function sub(Signed memory a, Signed memory b) internal pure returns (Signed memory) { return Signed(a.rawValue.sub(b.rawValue)); } /** * @notice Subtracts an unscaled int256 from an `Signed`, reverting on overflow. * @param a a FixedPoint.Signed. * @param b an int256. * @return the difference of `a` and `b`. */ function sub(Signed memory a, int256 b) internal pure returns (Signed memory) { return sub(a, fromUnscaledInt(b)); } /** * @notice Subtracts an `Signed` from an unscaled int256, reverting on overflow. * @param a an int256. * @param b a FixedPoint.Signed. * @return the difference of `a` and `b`. */ function sub(int256 a, Signed memory b) internal pure returns (Signed memory) { return sub(fromUnscaledInt(a), b); } /** * @notice Multiplies two `Signed`s, reverting on overflow. * @dev This will "floor" the product. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return the product of `a` and `b`. */ function mul(Signed memory a, Signed memory b) internal pure returns (Signed memory) { // There are two caveats with this computation: // 1. Max output for the represented number is ~10^41, otherwise an intermediate value overflows. 10^41 is // stored internally as an int256 ~10^59. // 2. Results that can't be represented exactly are truncated not rounded. E.g., 1.4 * 2e-18 = 2.8e-18, which // would round to 3, but this computation produces the result 2. // No need to use SafeMath because SFP_SCALING_FACTOR != 0. return Signed(a.rawValue.mul(b.rawValue) / SFP_SCALING_FACTOR); } /** * @notice Multiplies an `Signed` and an unscaled int256, reverting on overflow. * @dev This will "floor" the product. * @param a a FixedPoint.Signed. * @param b an int256. * @return the product of `a` and `b`. */ function mul(Signed memory a, int256 b) internal pure returns (Signed memory) { return Signed(a.rawValue.mul(b)); } /** * @notice Multiplies two `Signed`s and "ceil's" the product, reverting on overflow. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return the product of `a` and `b`. */ function mulAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) { int256 mulRaw = a.rawValue.mul(b.rawValue); int256 mulTowardsZero = mulRaw / SFP_SCALING_FACTOR; // Manual mod because SignedSafeMath doesn't support it. int256 mod = mulRaw % SFP_SCALING_FACTOR; if (mod != 0) { bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0); int256 valueToAdd = isResultPositive ? int256(1) : int256(-1); return Signed(mulTowardsZero.add(valueToAdd)); } else { return Signed(mulTowardsZero); } } /** * @notice Multiplies an `Signed` and an unscaled int256 and "ceil's" the product, reverting on overflow. * @param a a FixedPoint.Signed. * @param b a FixedPoint.Signed. * @return the product of `a` and `b`. */ function mulAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) { // Since b is an int, there is no risk of truncation and we can just mul it normally return Signed(a.rawValue.mul(b)); } /** * @notice Divides one `Signed` by an `Signed`, reverting on overflow or division by 0. * @dev This will "floor" the quotient. * @param a a FixedPoint numerator. * @param b a FixedPoint denominator. * @return the quotient of `a` divided by `b`. */ function div(Signed memory a, Signed memory b) internal pure returns (Signed memory) { // There are two caveats with this computation: // 1. Max value for the number dividend `a` represents is ~10^41, otherwise an intermediate value overflows. // 10^41 is stored internally as an int256 10^59. // 2. Results that can't be represented exactly are truncated not rounded. E.g., 2 / 3 = 0.6 repeating, which // would round to 0.666666666666666667, but this computation produces the result 0.666666666666666666. return Signed(a.rawValue.mul(SFP_SCALING_FACTOR).div(b.rawValue)); } /** * @notice Divides one `Signed` by an unscaled int256, reverting on overflow or division by 0. * @dev This will "floor" the quotient. * @param a a FixedPoint numerator. * @param b an int256 denominator. * @return the quotient of `a` divided by `b`. */ function div(Signed memory a, int256 b) internal pure returns (Signed memory) { return Signed(a.rawValue.div(b)); } /** * @notice Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0. * @dev This will "floor" the quotient. * @param a an int256 numerator. * @param b a FixedPoint denominator. * @return the quotient of `a` divided by `b`. */ function div(int256 a, Signed memory b) internal pure returns (Signed memory) { return div(fromUnscaledInt(a), b); } /** * @notice Divides one `Signed` by an `Signed` and "ceil's" the quotient, reverting on overflow or division by 0. * @param a a FixedPoint numerator. * @param b a FixedPoint denominator. * @return the quotient of `a` divided by `b`. */ function divAwayFromZero(Signed memory a, Signed memory b) internal pure returns (Signed memory) { int256 aScaled = a.rawValue.mul(SFP_SCALING_FACTOR); int256 divTowardsZero = aScaled.div(b.rawValue); // Manual mod because SignedSafeMath doesn't support it. int256 mod = aScaled % b.rawValue; if (mod != 0) { bool isResultPositive = isLessThan(a, 0) == isLessThan(b, 0); int256 valueToAdd = isResultPositive ? int256(1) : int256(-1); return Signed(divTowardsZero.add(valueToAdd)); } else { return Signed(divTowardsZero); } } /** * @notice Divides one `Signed` by an unscaled int256 and "ceil's" the quotient, reverting on overflow or division by 0. * @param a a FixedPoint numerator. * @param b an int256 denominator. * @return the quotient of `a` divided by `b`. */ function divAwayFromZero(Signed memory a, int256 b) internal pure returns (Signed memory) { // Because it is possible that a quotient gets truncated, we can't just call "Signed(a.rawValue.div(b))" // similarly to mulCeil with an int256 as the second parameter. Therefore we need to convert b into an Signed. // This creates the possibility of overflow if b is very large. return divAwayFromZero(a, fromUnscaledInt(b)); } /** * @notice Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`. * @dev This will "floor" the result. * @param a a FixedPoint.Signed. * @param b a uint256 (negative exponents are not allowed). * @return output is `a` to the power of `b`. */ function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) { output = fromUnscaledInt(1); for (uint256 i = 0; i < b; i = i.add(1)) { output = mul(output, a); } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; /** * @title A contract that provides modifiers to prevent reentrancy to state-changing and view-only methods. This contract * is inspired by https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/ReentrancyGuard.sol * and https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol. */ contract Lockable { bool private _notEntered; constructor() { // Storing an initial 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. _notEntered = true; } /** * @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 state modification. */ modifier nonReentrant() { _preEntranceCheck(); _preEntranceSet(); _; _postEntranceReset(); } /** * @dev Designed to prevent a view-only method from being re-entered during a call to a `nonReentrant()` state-changing method. */ modifier nonReentrantView() { _preEntranceCheck(); _; } // Internal methods are used to avoid copying the require statement's bytecode to every `nonReentrant()` method. // On entry into a function, `_preEntranceCheck()` should always be called to check if the function is being // re-entered. Then, if the function modifies state, it should call `_postEntranceSet()`, perform its logic, and // then call `_postEntranceReset()`. // View-only methods can simply call `_preEntranceCheck()` to make sure that it is not being re-entered. function _preEntranceCheck() internal view { // On the first call to nonReentrant, _notEntered will be true require(_notEntered, "ReentrancyGuard: reentrant call"); } function _preEntranceSet() internal { // Any calls to nonReentrant after this point will fail _notEntered = false; } function _postEntranceReset() internal { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _notEntered = true; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./MultiRole.sol"; import "../interfaces/ExpandedIERC20.sol"; /** * @title An ERC20 with permissioned burning and minting. The contract deployer will initially * be the owner who is capable of adding new roles. */ contract ExpandedERC20 is ExpandedIERC20, ERC20, MultiRole { enum Roles { // Can set the minter and burner. Owner, // Addresses that can mint new tokens. Minter, // Addresses that can burn tokens that address owns. Burner } uint8 _decimals; /** * @notice Constructs the ExpandedERC20. * @param _tokenName The name which describes the new token. * @param _tokenSymbol The ticker abbreviation of the name. Ideally < 5 chars. * @param _tokenDecimals The number of decimals to define token precision. */ constructor( string memory _tokenName, string memory _tokenSymbol, uint8 _tokenDecimals ) ERC20(_tokenName, _tokenSymbol) { _decimals = _tokenDecimals; _createExclusiveRole(uint256(Roles.Owner), uint256(Roles.Owner), msg.sender); _createSharedRole(uint256(Roles.Minter), uint256(Roles.Owner), new address[](0)); _createSharedRole(uint256(Roles.Burner), uint256(Roles.Owner), new address[](0)); } function decimals() public view virtual override(ERC20) returns (uint8) { return _decimals; } /** * @dev Mints `value` tokens to `recipient`, returning true on success. * @param recipient address to mint to. * @param value amount of tokens to mint. * @return True if the mint succeeded, or False. */ function mint(address recipient, uint256 value) external override onlyRoleHolder(uint256(Roles.Minter)) returns (bool) { _mint(recipient, value); return true; } /** * @dev Burns `value` tokens owned by `msg.sender`. * @param value amount of tokens to burn. */ function burn(uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) { _burn(msg.sender, value); } /** * @dev Burns `value` tokens owned by `recipient`. * @param recipient address to burn tokens from. * @param value amount of tokens to burn. * @return True if the burn succeeded, or False. */ function burnFrom(address recipient, uint256 value) external override onlyRoleHolder(uint256(Roles.Burner)) returns (bool) { _burn(recipient, value); return true; } /** * @notice Add Minter role to account. * @dev The caller must have the Owner role. * @param account The address to which the Minter role is added. */ function addMinter(address account) external virtual override { addMember(uint256(Roles.Minter), account); } /** * @notice Add Burner role to account. * @dev The caller must have the Owner role. * @param account The address to which the Burner role is added. */ function addBurner(address account) external virtual override { addMember(uint256(Roles.Burner), account); } /** * @notice Reset Owner role to account. * @dev The caller must have the Owner role. * @param account The new holder of the Owner role. */ function resetOwner(address account) external virtual override { resetMember(uint256(Roles.Owner), account); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Financial contract facing Oracle interface. * @dev Interface used by financial contracts to interact with the Oracle. Voters will use a different interface. */ abstract contract OptimisticOracleInterface { // Struct representing the state of a price request. enum State { Invalid, // Never requested. Requested, // Requested, no other actions taken. Proposed, // Proposed, but not expired or disputed yet. Expired, // Proposed, not disputed, past liveness. Disputed, // Disputed, but no DVM price returned yet. Resolved, // Disputed and DVM price is available. Settled // Final price has been set in the contract (can get here from Expired or Resolved). } // Struct representing a price request. struct Request { address proposer; // Address of the proposer. address disputer; // Address of the disputer. IERC20 currency; // ERC20 token used to pay rewards and fees. bool settled; // True if the request is settled. bool refundOnDispute; // True if the requester should be refunded their reward on dispute. int256 proposedPrice; // Price that the proposer submitted. int256 resolvedPrice; // Price resolved once the request is settled. uint256 expirationTime; // Time at which the request auto-settles without a dispute. uint256 reward; // Amount of the currency to pay to the proposer on settlement. uint256 finalFee; // Final fee to pay to the Store upon request to the DVM. uint256 bond; // Bond that the proposer and disputer must pay on top of the final fee. uint256 customLiveness; // Custom liveness value set by the requester. } // This value must be <= the Voting contract's `ancillaryBytesLimit` value otherwise it is possible // that a price can be requested to this contract successfully, but cannot be disputed because the DVM refuses // to accept a price request made with ancillary data length over a certain size. uint256 public constant ancillaryBytesLimit = 8192; /** * @notice Requests a new price. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data representing additional args being passed with the price request. * @param currency ERC20 token used for payment of rewards and fees. Must be approved for use with the DVM. * @param reward reward offered to a successful proposer. Will be pulled from the caller. Note: this can be 0, * which could make sense if the contract requests and proposes the value in the same call or * provides its own reward system. * @return totalBond default bond (final fee) + final fee that the proposer and disputer will be required to pay. * This can be changed with a subsequent call to setBond(). */ function requestPrice( bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, IERC20 currency, uint256 reward ) external virtual returns (uint256 totalBond); /** * @notice Set the proposal bond associated with a price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param bond custom bond amount to set. * @return totalBond new bond + final fee that the proposer and disputer will be required to pay. This can be * changed again with a subsequent call to setBond(). */ function setBond( bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, uint256 bond ) external virtual returns (uint256 totalBond); /** * @notice Sets the request to refund the reward if the proposal is disputed. This can help to "hedge" the caller * in the event of a dispute-caused delay. Note: in the event of a dispute, the winner still receives the other's * bond, so there is still profit to be made even if the reward is refunded. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. */ function setRefundOnDispute( bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) external virtual; /** * @notice Sets a custom liveness value for the request. Liveness is the amount of time a proposal must wait before * being auto-resolved. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param customLiveness new custom liveness. */ function setCustomLiveness( bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, uint256 customLiveness ) external virtual; /** * @notice Proposes a price value on another address' behalf. Note: this address will receive any rewards that come * from this proposal. However, any bonds are pulled from the caller. * @param proposer address to set as the proposer. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param proposedPrice price being proposed. * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to * the proposer once settled if the proposal is correct. */ function proposePriceFor( address proposer, address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, int256 proposedPrice ) public virtual returns (uint256 totalBond); /** * @notice Proposes a price value for an existing price request. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @param proposedPrice price being proposed. * @return totalBond the amount that's pulled from the proposer's wallet as a bond. The bond will be returned to * the proposer once settled if the proposal is correct. */ function proposePrice( address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, int256 proposedPrice ) external virtual returns (uint256 totalBond); /** * @notice Disputes a price request with an active proposal on another address' behalf. Note: this address will * receive any rewards that come from this dispute. However, any bonds are pulled from the caller. * @param disputer address to set as the disputer. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @return totalBond the amount that's pulled from the caller's wallet as a bond. The bond will be returned to * the disputer once settled if the dispute was value (the proposal was incorrect). */ function disputePriceFor( address disputer, address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) public virtual returns (uint256 totalBond); /** * @notice Disputes a price value for an existing price request with an active proposal. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @return totalBond the amount that's pulled from the disputer's wallet as a bond. The bond will be returned to * the disputer once settled if the dispute was valid (the proposal was incorrect). */ function disputePrice( address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) external virtual returns (uint256 totalBond); /** * @notice Retrieves a price that was previously requested by a caller. Reverts if the request is not settled * or settleable. Note: this method is not view so that this call may actually settle the price request if it * hasn't been settled. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @return resolved price. */ function settleAndGetPrice( bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) external virtual returns (int256); /** * @notice Attempts to settle an outstanding price request. Will revert if it isn't settleable. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @return payout the amount that the "winner" (proposer or disputer) receives on settlement. This amount includes * the returned bonds as well as additional rewards. */ function settle( address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) external virtual returns (uint256 payout); /** * @notice Gets the current data structure containing all information about a price request. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @return the Request data structure. */ function getRequest( address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) public view virtual returns (Request memory); /** * @notice Returns the state of a price request. * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @return the State enum value. */ function getState( address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) public view virtual returns (State); /** * @notice Checks if a given request has resolved or been settled (i.e the optimistic oracle has a price). * @param requester sender of the initial price request. * @param identifier price identifier to identify the existing request. * @param timestamp timestamp to identify the existing request. * @param ancillaryData ancillary data of the price being requested. * @return true if price has resolved or settled, false otherwise. */ function hasPrice( address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData ) public view virtual returns (bool); function stampAncillaryData(bytes memory ancillaryData, address requester) public view virtual returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SignedSafeMath { /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { return a * b; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { return a / b; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { return a - b; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { return a + b; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; /** * @title Universal store of current contract time for testing environments. */ contract Timer { uint256 private currentTime; constructor() { currentTime = block.timestamp; // solhint-disable-line not-rely-on-time } /** * @notice Sets the current time. * @dev Will revert if not running in test mode. * @param time timestamp to set `currentTime` to. */ function setCurrentTime(uint256 time) external { currentTime = time; } /** * @notice Gets the currentTime variable set in the Timer. * @return uint256 for the current Testable timestamp. */ function getCurrentTime() public view returns (uint256) { return currentTime; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; library Exclusive { struct RoleMembership { address member; } function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) { return roleMembership.member == memberToCheck; } function resetMember(RoleMembership storage roleMembership, address newMember) internal { require(newMember != address(0x0), "Cannot set an exclusive role to 0x0"); roleMembership.member = newMember; } function getMember(RoleMembership storage roleMembership) internal view returns (address) { return roleMembership.member; } function init(RoleMembership storage roleMembership, address initialMember) internal { resetMember(roleMembership, initialMember); } } library Shared { struct RoleMembership { mapping(address => bool) members; } function isMember(RoleMembership storage roleMembership, address memberToCheck) internal view returns (bool) { return roleMembership.members[memberToCheck]; } function addMember(RoleMembership storage roleMembership, address memberToAdd) internal { require(memberToAdd != address(0x0), "Cannot add 0x0 to a shared role"); roleMembership.members[memberToAdd] = true; } function removeMember(RoleMembership storage roleMembership, address memberToRemove) internal { roleMembership.members[memberToRemove] = false; } function init(RoleMembership storage roleMembership, address[] memory initialMembers) internal { for (uint256 i = 0; i < initialMembers.length; i++) { addMember(roleMembership, initialMembers[i]); } } } /** * @title Base class to manage permissions for the derived class. */ abstract contract MultiRole { using Exclusive for Exclusive.RoleMembership; using Shared for Shared.RoleMembership; enum RoleType { Invalid, Exclusive, Shared } struct Role { uint256 managingRole; RoleType roleType; Exclusive.RoleMembership exclusiveRoleMembership; Shared.RoleMembership sharedRoleMembership; } mapping(uint256 => Role) private roles; event ResetExclusiveMember(uint256 indexed roleId, address indexed newMember, address indexed manager); event AddedSharedMember(uint256 indexed roleId, address indexed newMember, address indexed manager); event RemovedSharedMember(uint256 indexed roleId, address indexed oldMember, address indexed manager); /** * @notice Reverts unless the caller is a member of the specified roleId. */ modifier onlyRoleHolder(uint256 roleId) { require(holdsRole(roleId, msg.sender), "Sender does not hold required role"); _; } /** * @notice Reverts unless the caller is a member of the manager role for the specified roleId. */ modifier onlyRoleManager(uint256 roleId) { require(holdsRole(roles[roleId].managingRole, msg.sender), "Can only be called by a role manager"); _; } /** * @notice Reverts unless the roleId represents an initialized, exclusive roleId. */ modifier onlyExclusive(uint256 roleId) { require(roles[roleId].roleType == RoleType.Exclusive, "Must be called on an initialized Exclusive role"); _; } /** * @notice Reverts unless the roleId represents an initialized, shared roleId. */ modifier onlyShared(uint256 roleId) { require(roles[roleId].roleType == RoleType.Shared, "Must be called on an initialized Shared role"); _; } /** * @notice Whether `memberToCheck` is a member of roleId. * @dev Reverts if roleId does not correspond to an initialized role. * @param roleId the Role to check. * @param memberToCheck the address to check. * @return True if `memberToCheck` is a member of `roleId`. */ function holdsRole(uint256 roleId, address memberToCheck) public view returns (bool) { Role storage role = roles[roleId]; if (role.roleType == RoleType.Exclusive) { return role.exclusiveRoleMembership.isMember(memberToCheck); } else if (role.roleType == RoleType.Shared) { return role.sharedRoleMembership.isMember(memberToCheck); } revert("Invalid roleId"); } /** * @notice Changes the exclusive role holder of `roleId` to `newMember`. * @dev Reverts if the caller is not a member of the managing role for `roleId` or if `roleId` is not an * initialized, ExclusiveRole. * @param roleId the ExclusiveRole membership to modify. * @param newMember the new ExclusiveRole member. */ function resetMember(uint256 roleId, address newMember) public onlyExclusive(roleId) onlyRoleManager(roleId) { roles[roleId].exclusiveRoleMembership.resetMember(newMember); emit ResetExclusiveMember(roleId, newMember, msg.sender); } /** * @notice Gets the current holder of the exclusive role, `roleId`. * @dev Reverts if `roleId` does not represent an initialized, exclusive role. * @param roleId the ExclusiveRole membership to check. * @return the address of the current ExclusiveRole member. */ function getMember(uint256 roleId) public view onlyExclusive(roleId) returns (address) { return roles[roleId].exclusiveRoleMembership.getMember(); } /** * @notice Adds `newMember` to the shared role, `roleId`. * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the * managing role for `roleId`. * @param roleId the SharedRole membership to modify. * @param newMember the new SharedRole member. */ function addMember(uint256 roleId, address newMember) public onlyShared(roleId) onlyRoleManager(roleId) { roles[roleId].sharedRoleMembership.addMember(newMember); emit AddedSharedMember(roleId, newMember, msg.sender); } /** * @notice Removes `memberToRemove` from the shared role, `roleId`. * @dev Reverts if `roleId` does not represent an initialized, SharedRole or if the caller is not a member of the * managing role for `roleId`. * @param roleId the SharedRole membership to modify. * @param memberToRemove the current SharedRole member to remove. */ function removeMember(uint256 roleId, address memberToRemove) public onlyShared(roleId) onlyRoleManager(roleId) { roles[roleId].sharedRoleMembership.removeMember(memberToRemove); emit RemovedSharedMember(roleId, memberToRemove, msg.sender); } /** * @notice Removes caller from the role, `roleId`. * @dev Reverts if the caller is not a member of the role for `roleId` or if `roleId` is not an * initialized, SharedRole. * @param roleId the SharedRole membership to modify. */ function renounceMembership(uint256 roleId) public onlyShared(roleId) onlyRoleHolder(roleId) { roles[roleId].sharedRoleMembership.removeMember(msg.sender); emit RemovedSharedMember(roleId, msg.sender, msg.sender); } /** * @notice Reverts if `roleId` is not initialized. */ modifier onlyValidRole(uint256 roleId) { require(roles[roleId].roleType != RoleType.Invalid, "Attempted to use an invalid roleId"); _; } /** * @notice Reverts if `roleId` is initialized. */ modifier onlyInvalidRole(uint256 roleId) { require(roles[roleId].roleType == RoleType.Invalid, "Cannot use a pre-existing role"); _; } /** * @notice Internal method to initialize a shared role, `roleId`, which will be managed by `managingRoleId`. * `initialMembers` will be immediately added to the role. * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already * initialized. */ function _createSharedRole( uint256 roleId, uint256 managingRoleId, address[] memory initialMembers ) internal onlyInvalidRole(roleId) { Role storage role = roles[roleId]; role.roleType = RoleType.Shared; role.managingRole = managingRoleId; role.sharedRoleMembership.init(initialMembers); require( roles[managingRoleId].roleType != RoleType.Invalid, "Attempted to use an invalid role to manage a shared role" ); } /** * @notice Internal method to initialize an exclusive role, `roleId`, which will be managed by `managingRoleId`. * `initialMember` will be immediately added to the role. * @dev Should be called by derived contracts, usually at construction time. Will revert if the role is already * initialized. */ function _createExclusiveRole( uint256 roleId, uint256 managingRoleId, address initialMember ) internal onlyInvalidRole(roleId) { Role storage role = roles[roleId]; role.roleType = RoleType.Exclusive; role.managingRole = managingRoleId; role.exclusiveRoleMembership.init(initialMember); require( roles[managingRoleId].roleType != RoleType.Invalid, "Attempted to use an invalid role to manage an exclusive role" ); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title ERC20 interface that includes burn and mint methods. */ abstract contract ExpandedIERC20 is IERC20 { /** * @notice Burns a specific amount of the caller's tokens. * @dev Only burns the caller's tokens, so it is safe to leave this method permissionless. */ function burn(uint256 value) external virtual; /** * @dev Burns `value` tokens owned by `recipient`. * @param recipient address to burn tokens from. * @param value amount of tokens to burn. */ function burnFrom(address recipient, uint256 value) external virtual returns (bool); /** * @notice Mints tokens and adds them to the balance of the `to` address. * @dev This method should be permissioned to only allow designated parties to mint tokens. */ function mint(address to, uint256 value) external virtual returns (bool); function addMinter(address account) external virtual; function addBurner(address account) external virtual; function resetOwner(address account) external virtual; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT 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) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_lpTokenName","type":"string"},{"internalType":"string","name":"_lpTokenSymbol","type":"string"},{"internalType":"address","name":"_bridgeAdmin","type":"address"},{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"uint64","name":"_lpFeeRatePerSecond","type":"uint64"},{"internalType":"bool","name":"_isWethPool","type":"bool"},{"internalType":"address","name":"_timer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"BridgePoolAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"depositHash","type":"bytes32"},{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"depositId","type":"uint64"},{"internalType":"address payable","name":"l1Recipient","type":"address"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"slowRelayFeePct","type":"uint64"},{"internalType":"uint64","name":"instantRelayFeePct","type":"uint64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"}],"indexed":false,"internalType":"struct BridgePool.DepositData","name":"depositData","type":"tuple"},{"components":[{"internalType":"enum BridgePool.RelayState","name":"relayState","type":"uint8"},{"internalType":"address","name":"slowRelayer","type":"address"},{"internalType":"uint32","name":"relayId","type":"uint32"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"},{"internalType":"uint32","name":"priceRequestTime","type":"uint32"},{"internalType":"uint256","name":"proposerBond","type":"uint256"},{"internalType":"uint256","name":"finalFee","type":"uint256"}],"indexed":false,"internalType":"struct BridgePool.RelayData","name":"relay","type":"tuple"},{"indexed":false,"internalType":"bytes32","name":"relayAncillaryDataHash","type":"bytes32"}],"name":"DepositRelayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpTokensMinted","type":"uint256"},{"indexed":true,"internalType":"address","name":"liquidityProvider","type":"address"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpTokensBurnt","type":"uint256"},{"indexed":true,"internalType":"address","name":"liquidityProvider","type":"address"}],"name":"LiquidityRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"depositHash","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"relayHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"disputer","type":"address"}],"name":"RelayCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"depositHash","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"relayHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"disputer","type":"address"}],"name":"RelayDisputed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"depositHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"components":[{"internalType":"enum BridgePool.RelayState","name":"relayState","type":"uint8"},{"internalType":"address","name":"slowRelayer","type":"address"},{"internalType":"uint32","name":"relayId","type":"uint32"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"},{"internalType":"uint32","name":"priceRequestTime","type":"uint32"},{"internalType":"uint256","name":"proposerBond","type":"uint256"},{"internalType":"uint256","name":"finalFee","type":"uint256"}],"indexed":false,"internalType":"struct BridgePool.RelayData","name":"relay","type":"tuple"}],"name":"RelaySettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"depositHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"instantRelayer","type":"address"},{"components":[{"internalType":"enum BridgePool.RelayState","name":"relayState","type":"uint8"},{"internalType":"address","name":"slowRelayer","type":"address"},{"internalType":"uint32","name":"relayId","type":"uint32"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"},{"internalType":"uint32","name":"priceRequestTime","type":"uint32"},{"internalType":"uint256","name":"proposerBond","type":"uint256"},{"internalType":"uint256","name":"finalFee","type":"uint256"}],"indexed":false,"internalType":"struct BridgePool.RelayData","name":"relay","type":"tuple"}],"name":"RelaySpedUp","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"l1TokenAmount","type":"uint256"}],"name":"addLiquidity","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeAdmin","outputs":[{"internalType":"contract BridgeAdminInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"depositId","type":"uint64"},{"internalType":"address payable","name":"l1Recipient","type":"address"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"slowRelayFeePct","type":"uint64"},{"internalType":"uint64","name":"instantRelayFeePct","type":"uint64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"}],"internalType":"struct BridgePool.DepositData","name":"depositData","type":"tuple"},{"components":[{"internalType":"enum BridgePool.RelayState","name":"relayState","type":"uint8"},{"internalType":"address","name":"slowRelayer","type":"address"},{"internalType":"uint32","name":"relayId","type":"uint32"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"},{"internalType":"uint32","name":"priceRequestTime","type":"uint32"},{"internalType":"uint256","name":"proposerBond","type":"uint256"},{"internalType":"uint256","name":"finalFee","type":"uint256"}],"internalType":"struct BridgePool.RelayData","name":"relayData","type":"tuple"}],"name":"disputeRelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exchangeRateCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAccumulatedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"relayedAmount","type":"uint256"}],"name":"getLiquidityUtilization","outputs":[{"internalType":"uint256","name":"utilizationCurrent","type":"uint256"},{"internalType":"uint256","name":"utilizationPostRelay","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"depositId","type":"uint64"},{"internalType":"address payable","name":"l1Recipient","type":"address"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"slowRelayFeePct","type":"uint64"},{"internalType":"uint64","name":"instantRelayFeePct","type":"uint64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"}],"internalType":"struct BridgePool.DepositData","name":"depositData","type":"tuple"},{"components":[{"internalType":"enum BridgePool.RelayState","name":"relayState","type":"uint8"},{"internalType":"address","name":"slowRelayer","type":"address"},{"internalType":"uint32","name":"relayId","type":"uint32"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"},{"internalType":"uint32","name":"priceRequestTime","type":"uint32"},{"internalType":"uint256","name":"proposerBond","type":"uint256"},{"internalType":"uint256","name":"finalFee","type":"uint256"}],"internalType":"struct BridgePool.RelayData","name":"relayData","type":"tuple"}],"name":"getRelayAncillaryData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"identifier","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"instantRelays","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isWethPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1Token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastLpFeeUpdate","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityUtilizationCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"relayedAmount","type":"uint256"}],"name":"liquidityUtilizationPostRelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lpFeeRatePerSecond","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numberOfRelays","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"optimisticOracle","outputs":[{"internalType":"contract SkinnyOptimisticOracleInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"optimisticOracleLiveness","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposerBondPct","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"depositId","type":"uint64"},{"internalType":"address payable","name":"l1Recipient","type":"address"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"slowRelayFeePct","type":"uint64"},{"internalType":"uint64","name":"instantRelayFeePct","type":"uint64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"}],"internalType":"struct BridgePool.DepositData","name":"depositData","type":"tuple"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"}],"name":"relayAndSpeedUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"depositId","type":"uint64"},{"internalType":"address payable","name":"l1Recipient","type":"address"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"slowRelayFeePct","type":"uint64"},{"internalType":"uint64","name":"instantRelayFeePct","type":"uint64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"}],"internalType":"struct BridgePool.DepositData","name":"depositData","type":"tuple"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"}],"name":"relayDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"relays","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"lpTokenAmount","type":"uint256"},{"internalType":"bool","name":"sendEth","type":"bool"}],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"time","type":"uint256"}],"name":"setCurrentTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"depositId","type":"uint64"},{"internalType":"address payable","name":"l1Recipient","type":"address"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"slowRelayFeePct","type":"uint64"},{"internalType":"uint64","name":"instantRelayFeePct","type":"uint64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"}],"internalType":"struct BridgePool.DepositData","name":"depositData","type":"tuple"},{"components":[{"internalType":"enum BridgePool.RelayState","name":"relayState","type":"uint8"},{"internalType":"address","name":"slowRelayer","type":"address"},{"internalType":"uint32","name":"relayId","type":"uint32"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"},{"internalType":"uint32","name":"priceRequestTime","type":"uint32"},{"internalType":"uint256","name":"proposerBond","type":"uint256"},{"internalType":"uint256","name":"finalFee","type":"uint256"}],"internalType":"struct BridgePool.RelayData","name":"relayData","type":"tuple"}],"name":"settleRelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint64","name":"depositId","type":"uint64"},{"internalType":"address payable","name":"l1Recipient","type":"address"},{"internalType":"address","name":"l2Sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"slowRelayFeePct","type":"uint64"},{"internalType":"uint64","name":"instantRelayFeePct","type":"uint64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"}],"internalType":"struct BridgePool.DepositData","name":"depositData","type":"tuple"},{"components":[{"internalType":"enum BridgePool.RelayState","name":"relayState","type":"uint8"},{"internalType":"address","name":"slowRelayer","type":"address"},{"internalType":"uint32","name":"relayId","type":"uint32"},{"internalType":"uint64","name":"realizedLpFeePct","type":"uint64"},{"internalType":"uint32","name":"priceRequestTime","type":"uint32"},{"internalType":"uint256","name":"proposerBond","type":"uint256"},{"internalType":"uint256","name":"finalFee","type":"uint256"}],"internalType":"struct BridgePool.RelayData","name":"relayData","type":"tuple"}],"name":"speedUpRelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"store","outputs":[{"internalType":"contract StoreInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sync","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"syncUmaEcosystemParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"syncWithBridgeAdminParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"undistributedLpFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"utilizedReserves","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162004fa038038062004fa08339810160408190526200003491620008f6565b600080546001600160a01b0319166001600160a01b038316179055865187908790620000689060049060208501906200073d565b5080516200007e9060059060208401906200073d565b50506006805460ff19166001179055508651158015906200009f5750855115155b620000f15760405162461bcd60e51b815260206004820152601b60248201527f426164204c5020746f6b656e206e616d65206f722073796d626f6c000000000060448201526064015b60405180910390fd5b600e80546001600160a01b0319166001600160a01b038781169190911790915560068054610100600160a81b031916610100928716929092029190911790556200013a620001aa565b600a8054610100600160681b031916690100000000000000000063ffffffff9390931692909202610100600160481b031916919091176101006001600160401b038616021760ff1916831515179055620001936200024f565b6200019d620004d5565b5050505050505062000aca565b600080546001600160a01b0316156200024a5760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200020a57600080fd5b505afa1580156200021f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002459190620009c3565b905090565b504290565b62000259620006e9565b620002696006805460ff19169055565b600e5460408051632e68f21360e21b815290516000926001600160a01b03169163b9a3c84c916004808301926020929190829003018186803b158015620002af57600080fd5b505afa158015620002c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002ea9190620009dd565b6040516302abf57960e61b81527f536b696e6e794f7074696d69737469634f7261636c650000000000000000000060048201529091506001600160a01b0382169063aafd5e409060240160206040518083038186803b1580156200034d57600080fd5b505afa15801562000362573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003889190620009dd565b601080546001600160a01b0319166001600160a01b039283161790556040516302abf57960e61b81526453746f726560d81b60048201529082169063aafd5e409060240160206040518083038186803b158015620003e557600080fd5b505afa158015620003fa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004209190620009dd565b600f80546001600160a01b0319166001600160a01b03928316908117909155600654604051635b97aadd60e01b8152610100909104909216600483015290635b97aadd9060240160206040518083038186803b1580156200048057600080fd5b505afa15801562000495573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004bb919062000a02565b51600b5550620004d36006805460ff19166001179055565b565b620004df620006e9565b620004ef6006805460ff19169055565b600e60009054906101000a90046001600160a01b03166001600160a01b031663c73a32c36040518163ffffffff1660e01b815260040160206040518083038186803b1580156200053e57600080fd5b505afa15801562000553573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000579919062000a47565b600a600d6101000a8154816001600160401b0302191690836001600160401b03160217905550600e60009054906101000a90046001600160a01b03166001600160a01b031663173684c56040518163ffffffff1660e01b815260040160206040518083038186803b158015620005ee57600080fd5b505afa15801562000603573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000629919062000a65565b600a60156101000a81548163ffffffff021916908363ffffffff160217905550600e60009054906101000a90046001600160a01b03166001600160a01b0316637998a1c46040518163ffffffff1660e01b815260040160206040518083038186803b1580156200069857600080fd5b505afa158015620006ad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006d39190620009c3565b601155620004d36006805460ff19166001179055565b60065460ff16620004d35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401620000e8565b8280546200074b9062000a8d565b90600052602060002090601f0160209004810192826200076f5760008555620007ba565b82601f106200078a57805160ff1916838001178555620007ba565b82800160010185558215620007ba579182015b82811115620007ba5782518255916020019190600101906200079d565b50620007c8929150620007cc565b5090565b5b80821115620007c85760008155600101620007cd565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620008245762000824620007e3565b604052919050565b600082601f8301126200083e57600080fd5b81516001600160401b038111156200085a576200085a620007e3565b602062000870601f8301601f19168201620007f9565b82815285828487010111156200088557600080fd5b60005b83811015620008a557858101830151828201840152820162000888565b83811115620008b75760008385840101525b5095945050505050565b80516001600160a01b0381168114620008d957600080fd5b919050565b80516001600160401b0381168114620008d957600080fd5b600080600080600080600060e0888a0312156200091257600080fd5b87516001600160401b03808211156200092a57600080fd5b620009388b838c016200082c565b985060208a01519150808211156200094f57600080fd5b506200095e8a828b016200082c565b9650506200096f60408901620008c1565b94506200097f60608901620008c1565b93506200098f60808901620008de565b925060a08801518015158114620009a557600080fd5b9150620009b560c08901620008c1565b905092959891949750929550565b600060208284031215620009d657600080fd5b5051919050565b600060208284031215620009f057600080fd5b620009fb82620008c1565b9392505050565b60006020828403121562000a1557600080fd5b604051602081016001600160401b038111828210171562000a3a5762000a3a620007e3565b6040529151825250919050565b60006020828403121562000a5a57600080fd5b620009fb82620008de565b60006020828403121562000a7857600080fd5b815163ffffffff81168114620009fb57600080fd5b600181811c9082168062000aa257607f821691505b6020821081141562000ac457634e487b7160e01b600052602260045260246000fd5b50919050565b6144c68062000ada6000396000f3fe6080604052600436106102b25760003560e01c806370a0823111610175578063b5351ee2116100dc578063cefed55f11610095578063df738fc81161006f578063df738fc81461088e578063ed4de3a3146108bb578063f1d24bab146108f0578063fff6cae91461091457600080fd5b8063cefed55f14610804578063d412f5a414610824578063dd62ed3e1461084857600080fd5b8063b5351ee214610754578063bd6d894d14610769578063bec73ade1461077e578063c01e1bd61461079e578063c73a32c3146107c3578063cc2c929e146107ea57600080fd5b8063975057e71161012e578063975057e714610688578063a457c2d7146106a8578063a6af2dfe146106c8578063a9059cbb146106e8578063b208420214610708578063b454e3261461071e57600080fd5b806370a08231146105d1578063753b91bb146106075780637998a1c41461062757806387a515d31461063d5780638f2839701461065357806395d89b411461067357600080fd5b806323b872dd116102195780634464fae4116101d25780634464fae41461053d5780634f52fd171461055357806351c6590a146105735780635df45a371461058657806362822d341461059b57806366db5240146105bb57600080fd5b806323b872dd1461049757806329cb924d146104b7578063313ce567146104cc57806339509351146104e85780633cc400b3146105085780633fa856c91461051d57600080fd5b806318160ddd1161026b57806318160ddd146103d557806319e9d894146103ea5780631bf71c38146103ff5780631c39c38d1461041f578063223029221461045757806322f8e5661461047757600080fd5b806306fdde03146102be578063095ea7b3146102e957806311cfc159146103195780631311172514610356578063135c404e14610378578063173684c51461039c57600080fd5b366102b957005b600080fd5b3480156102ca57600080fd5b506102d3610929565b6040516102e09190613a5f565b60405180910390f35b3480156102f557600080fd5b50610309610304366004613a92565b6109bb565b60405190151581526020016102e0565b34801561032557600080fd5b50600a5461033e9061010090046001600160401b031681565b6040516001600160401b0390911681526020016102e0565b34801561036257600080fd5b50610376610371366004613bfd565b6109d2565b005b34801561038457600080fd5b5061038e600d5481565b6040519081526020016102e0565b3480156103a857600080fd5b50600a546103c090600160a81b900463ffffffff1681565b60405163ffffffff90911681526020016102e0565b3480156103e157600080fd5b5060035461038e565b3480156103f657600080fd5b5061038e610c98565b34801561040b57600080fd5b506102d361041a366004613c37565b610cc1565b34801561042b57600080fd5b5060005461043f906001600160a01b031681565b6040516001600160a01b0390911681526020016102e0565b34801561046357600080fd5b5060105461043f906001600160a01b031681565b34801561048357600080fd5b50610376610492366004613cee565b610ce4565b3480156104a357600080fd5b506103096104b2366004613d07565b610d5a565b3480156104c357600080fd5b5061038e610e0b565b3480156104d857600080fd5b50604051601281526020016102e0565b3480156104f457600080fd5b50610309610503366004613a92565b610eab565b34801561051457600080fd5b50610376610ee2565b34801561052957600080fd5b50610376610538366004613c37565b6110d7565b34801561054957600080fd5b5061038e600c5481565b34801561055f57600080fd5b5061037661056e366004613d56565b611542565b610376610581366004613cee565b6116bb565b34801561059257600080fd5b5061038e611862565b3480156105a757600080fd5b5061038e6105b6366004613cee565b611874565b3480156105c757600080fd5b5061038e60085481565b3480156105dd57600080fd5b5061038e6105ec366004613d7b565b6001600160a01b031660009081526001602052604090205490565b34801561061357600080fd5b50610376610622366004613bfd565b61189e565b34801561063357600080fd5b5061038e60115481565b34801561064957600080fd5b5061038e60095481565b34801561065f57600080fd5b5061037661066e366004613d7b565b611cc1565b34801561067f57600080fd5b506102d3611d48565b34801561069457600080fd5b50600f5461043f906001600160a01b031681565b3480156106b457600080fd5b506103096106c3366004613a92565b611d57565b3480156106d457600080fd5b50600e5461043f906001600160a01b031681565b3480156106f457600080fd5b50610309610703366004613a92565b611df2565b34801561071457600080fd5b5061038e60075481565b34801561072a57600080fd5b5061043f610739366004613cee565b6013602052600090815260409020546001600160a01b031681565b34801561076057600080fd5b50610376611dff565b34801561077557600080fd5b5061038e612057565b34801561078a57600080fd5b50610376610799366004613c37565b612071565b3480156107aa57600080fd5b5060065461043f9061010090046001600160a01b031681565b3480156107cf57600080fd5b50600a5461033e90600160681b90046001600160401b031681565b3480156107f657600080fd5b50600a546103099060ff1681565b34801561081057600080fd5b5061037661081f366004613c37565b612265565b34801561083057600080fd5b506006546103c090600160a81b900463ffffffff1681565b34801561085457600080fd5b5061038e610863366004613d98565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561089a57600080fd5b5061038e6108a9366004613cee565b60126020526000908152604090205481565b3480156108c757600080fd5b506108db6108d6366004613cee565b612452565b604080519283526020830191909152016102e0565b3480156108fc57600080fd5b50600a546103c090600160481b900463ffffffff1681565b34801561092057600080fd5b50610376612489565b60606004805461093890613dc6565b80601f016020809104026020016040519081016040528092919081815260200182805461096490613dc6565b80156109b15780601f10610986576101008083540402835291602001916109b1565b820191906000526020600020905b81548152906001019060200180831161099457829003601f168201915b5050505050905090565b60006109c83384846124a9565b5060015b92915050565b6109da6125ce565b6109e2612620565b6703782dace9d900008260a001516001600160401b031611158015610a1c57506703782dace9d900008260c001516001600160401b031611155b8015610a3857506706f05b59d3b20000816001600160401b0316105b610a4157600080fd5b6000610a4c8361262c565b60008181526012602052604090205490915015610aa75760405162461bcd60e51b815260206004820152601460248201527350656e64696e672072656c61792065786973747360601b60448201526064015b60405180910390fd5b6000610ab1610e0b565b90506000610ac285608001516126ef565b905060006040518060e0016040528060016002811115610ae457610ae4613e01565b815233602082015260068054604090920191600160a81b900463ffffffff16906015610b0f83613e2d565b91906101000a81548163ffffffff021916908363ffffffff16021790555063ffffffff168152602001866001600160401b031681526020018463ffffffff168152602001838152602001600b548152509050610b6a8161270f565b600085815260126020526040812091909155610b868783612722565b90508660800151600954600754610b9d9190613e51565b1015610be75760405162461bcd60e51b8152602060048201526019602482015278496e73756666696369656e7420706f6f6c2062616c616e636560381b6044820152606401610a9e565b6000600b5484610bf79190613e68565b9050876080015160096000828254610c0f9190613e68565b9250508190555080600d6000828254610c289190613e68565b9091555050600654610c4a9061010090046001600160a01b0316333084612776565b857fa4ca36d112520cced74325c72711f376fe4015665829d879ba21590cb8130be0898585604051610c7e93929190613f8a565b60405180910390a2505050505050610c946127e7565b5050565b6000610ca26125ce565b610caa612620565b610cb460006127f6565b9050610cbe6127e7565b90565b6060610ccb6125ce565b610cdd610cd88484612722565b612884565b9392505050565b6000546001600160a01b0316610cf957600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b5050505050565b6000610d678484846128c1565b6001600160a01b038416600090815260026020908152604080832033845290915290205482811015610dec5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610a9e565b610e008533610dfb8685613e51565b6124a9565b506001949350505050565b600080546001600160a01b031615610ea65760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6957600080fd5b505afa158015610e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea19190613fb6565b905090565b504290565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916109c8918590610dfb908690613e68565b610eea6125ce565b610ef2612620565b600e60009054906101000a90046001600160a01b03166001600160a01b031663c73a32c36040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4057600080fd5b505afa158015610f54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f789190613fcf565b600a600d6101000a8154816001600160401b0302191690836001600160401b03160217905550600e60009054906101000a90046001600160a01b03166001600160a01b031663173684c56040518163ffffffff1660e01b815260040160206040518083038186803b158015610fec57600080fd5b505afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110249190613fec565b600a60156101000a81548163ffffffff021916908363ffffffff160217905550600e60009054906101000a90046001600160a01b03166001600160a01b0316637998a1c46040518163ffffffff1660e01b815260040160206040518083038186803b15801561109257600080fd5b505afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ca9190613fb6565b6011556110d56127e7565b565b6110df6125ce565b6110e7612620565b60006110f28361262c565b90506110fe8183612a99565b60018251600281111561111357611113613e01565b146111525760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e481cd95d1d1b1959608a1b6044820152606401610a9e565b6000600a60159054906101000a900463ffffffff1683608001516111769190614009565b9050611180610e0b565b8163ffffffff1611156111ca5760405162461bcd60e51b8152602060048201526012602482015271139bdd081cd95d1d1b1958589b19481e595d60721b6044820152606401610a9e565b82602001516001600160a01b0316336001600160a01b0316148061120557506111f581610384614009565b63ffffffff16611203610e0b565b115b6112445760405162461bcd60e51b815260206004820152601060248201526f2737ba1039b637bb903932b630bcb2b960811b6044820152606401610a9e565b6040805160e081019091526112b890806002815260200185602001516001600160a01b03168152602001856040015163ffffffff16815260200185606001516001600160401b03168152602001856080015163ffffffff1681526020018560a0015181526020018560c0015181525061270f565b60008381526012602052604081209190915560a085015160608501516112eb916112e191614031565b8660800151612b26565b85608001516112fa9190613e51565b905060006113088486612b4e565b600081815260136020526040902054600a549192506001600160a01b03169060ff16801561133d57506001600160a01b038116155b1561135557611350876040015184612b79565b61138a565b61138a6001600160a01b038216611370578760400151611372565b815b60065461010090046001600160a01b03169085612c42565b600061139e8860a001518960800151612b26565b905060008760a001518860c001516113b69190613e68565b60208901519091506001600160a01b03163314156113fe5760208801516113f9906113e18385613e68565b60065461010090046001600160a01b03169190612c42565b61143c565b6020880151600654611420916101009091046001600160a01b03169083612c42565b60065461143c9061010090046001600160a01b03163384612c42565b60006114488387613e68565b90508960800151600960008282546114609190613e51565b9250508190555080600760008282546114799190613e51565b9250508190555080600860008282546114929190614053565b9250508190555081600d60008282546114ab9190613e51565b909155506114b99050612c72565b6114d36114ce8a606001518c60800151612b26565b612cba565b336001600160a01b0316887fcfdda74fce9fedb259e0f0a1ab1550e19b338488ece64976a4639e7fce0293a78b60405161150d9190614094565b60405180910390a350505060009182525060136020526040902080546001600160a01b031916905550610c9491506127e79050565b61154a6125ce565b611552612620565b8015806115615750600a5460ff165b61159d5760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a9e565b6000670de0b6b3a76400006115b0612ced565b6115ba90856140a2565b6115c491906140d7565b9050806009546115d49190613e68565b60075410156116255760405162461bcd60e51b815260206004820152601e60248201527f5574696c697a6174696f6e20746f6f206869676820746f2072656d6f766500006044820152606401610a9e565b61162f3384612d8d565b80600760008282546116419190613e51565b9091555050811561165b576116563382612b79565b611677565b6006546116779061010090046001600160a01b03163383612c42565b604080518281526020810185905233917f0c54fc223ffd1a8f36652b5e83db4fff50f5ae151b11ceb56d5499b9f6e1fa18910160405180910390a250610c946127e7565b6116c36125ce565b6116cb612620565b600a5460ff1680156116dc57508034145b806116e5575034155b6117315760405162461bcd60e51b815260206004820152601b60248201527f42616420616464206c6971756964697479204574682076616c756500000000006044820152606401610a9e565b600061173b612ced565b61174d83670de0b6b3a76400006140a2565b61175791906140d7565b90506117633382612edc565b81600760008282546117759190613e68565b9091555050341580159061178b5750600a5460ff165b156117fe57600660019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156117e057600080fd5b505af11580156117f4573d6000803e3d6000fd5b505050505061181b565b60065461181b9061010090046001600160a01b0316333085612776565b604080518381526020810183905233917f0351f600ef1e31e5e13b4dc27bff4cbde3e9269f0ffc666629ae6cac573eb220910160405180910390a25061185f6127e7565b50565b600061186c6125ce565b610ea1612fbb565b600061187e6125ce565b611886612620565b61188f826127f6565b90506118996127e7565b919050565b6118a66125ce565b6118ae612620565b60006118b8610e0b565b90506703782dace9d900008360a001516001600160401b0316111580156118f457506703782dace9d900008360c001516001600160401b031611155b801561191057506706f05b59d3b20000826001600160401b0316105b61191957600080fd5b60006119248461262c565b6000818152601260205260409020549091501561197a5760405162461bcd60e51b815260206004820152601460248201527350656e64696e672072656c61792065786973747360601b6044820152606401610a9e565b600061198985608001516126ef565b905060006040518060e00160405280600160028111156119ab576119ab613e01565b815233602082015260068054604090920191600160a81b900463ffffffff169060156119d683613e2d565b91906101000a81548163ffffffff021916908363ffffffff16021790555063ffffffff168152602001866001600160401b031681526020018563ffffffff168152602001838152602001600b5481525090506000611a348783612722565b9050611a3f8261270f565b600085815260126020526040812091909155611a5b8584612b4e565b6000818152601360205260409020549091506001600160a01b031615611abd5760405162461bcd60e51b8152602060048201526017602482015276052656c61792063616e6e6f74206265207370656420757604c1b6044820152606401610a9e565b8760800151600954600754611ad29190613e51565b1015611b1c5760405162461bcd60e51b8152602060048201526019602482015278496e73756666696369656e7420706f6f6c2062616c616e636560381b6044820152606401610a9e565b6000600b5485611b2c9190613e68565b90506000611b608a60c001518b60a001518760600151611b4c9190614031565b611b569190614031565b8b60800151612b26565b90506000818b60800151611b749190613e51565b905082600d6000828254611b889190613e68565b909155505060808b015160098054600090611ba4908490613e68565b9091555050600084815260136020526040902080546001600160a01b03191633908117909155611bf29030611bd98685613e68565b60065461010090046001600160a01b0316929190612776565b600a5460ff1615611c1057611c0b8b6040015182612b79565b611c32565b60408b0151600654611c32916101009091046001600160a01b03169083612c42565b877fa4ca36d112520cced74325c72711f376fe4015665829d879ba21590cb8130be08c8888604051611c6693929190613f8a565b60405180910390a2336001600160a01b0316887ff98cddc88bc965917007822b05056cb92bc9ddf0f8bcc61678400cb78313bb4b88604051611ca89190614094565b60405180910390a3505050505050505050610c946127e7565b611cc96125ce565b611cd1612620565b600e546001600160a01b03163314611ce857600080fd5b600e80546001600160a01b0319166001600160a01b0383169081179091556040805133815260208101929092527f485a12424bd0c2c66a131c2681cb6c743b9573af3ae5f3014ef6ce7f55ab0192910160405180910390a161185f6127e7565b60606005805461093890613dc6565b3360009081526002602090815260408083206001600160a01b038616845290915281205482811015611dd95760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610a9e565b611de83385610dfb8685613e51565b5060019392505050565b60006109c83384846128c1565b611e076125ce565b611e0f612620565b600e5460408051632e68f21360e21b815290516000926001600160a01b03169163b9a3c84c916004808301926020929190829003018186803b158015611e5457600080fd5b505afa158015611e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8c91906140f9565b6040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201529091506001600160a01b0382169063aafd5e409060240160206040518083038186803b158015611ee757600080fd5b505afa158015611efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1f91906140f9565b601080546001600160a01b0319166001600160a01b039283161790556040516302abf57960e61b81526453746f726560d81b60048201529082169063aafd5e409060240160206040518083038186803b158015611f7b57600080fd5b505afa158015611f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb391906140f9565b600f80546001600160a01b0319166001600160a01b03928316908117909155600654604051635b97aadd60e01b8152610100909104909216600483015290635b97aadd9060240160206040518083038186803b15801561201257600080fd5b505afa158015612026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204a9190614116565b51600b55506110d56127e7565b60006120616125ce565b612069612620565b610cb4612ced565b6120796125ce565b612081612620565b600061208c8361262c565b90506120988183612a99565b60006120a48284612b4e565b9050600a60159054906101000a900463ffffffff1683608001516120c89190614009565b63ffffffff166120d6610e0b565b1080156120f557506001835160028111156120f3576120f3613e01565b145b801561211657506000818152601360205260409020546001600160a01b0316155b61215c5760405162461bcd60e51b8152602060048201526017602482015276052656c61792063616e6e6f74206265207370656420757604c1b6044820152606401610a9e565b600081815260136020526040812080546001600160a01b0319163317905560c085015160a086015160608601516121a1929161219791614031565b6112e19190614031565b905060008186608001516121b59190613e51565b600a5490915060ff16156121f3576006546121e09061010090046001600160a01b0316333084612776565b6121ee866040015182612b79565b612217565b6040860151600654612217916101009091046001600160a01b031690339084612776565b336001600160a01b0316847ff98cddc88bc965917007822b05056cb92bc9ddf0f8bcc61678400cb78313bb4b876040516122519190614094565b60405180910390a350505050610c946127e7565b61226d6125ce565b612275612620565b61227d610e0b565b600a54608083015161229c91600160a81b900463ffffffff1690614009565b63ffffffff16116122df5760405162461bcd60e51b815260206004820152600d60248201526c50617374206c6976656e65737360981b6044820152606401610a9e565b6001815160028111156122f4576122f4613e01565b146123325760405162461bcd60e51b815260206004820152600e60248201526d4e6f742064697370757461626c6560901b6044820152606401610a9e565b600061233d8361262c565b90506123498183612a99565b60006123558484612722565b9050600061237a8460200151338660a001518760c0015161237587612884565b613031565b90508360a001518460c001516123909190613e68565b600d60008282546123a19190613e51565b90915550506080850151600980546000906123bd908490613e51565b9091555050600083815260126020526040812055801561241157336123e18561270f565b60405185907f29751133c2d0a0ea7a9da312248b12ef10ac4c20f4e3ab5eebbb80d853b3836790600090a4612447565b3361241b8561270f565b60405185907f14173c4d3bd95e34f5c8f78729323444c9272bd21051e70045b64ed48f65818390600090a45b505050610c946127e7565b60008061245d6125ce565b612465612620565b61246f60006127f6565b612478846127f6565b915091506124846127e7565b915091565b6124916125ce565b612499612620565b6124a161336e565b6110d56127e7565b6001600160a01b03831661250b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a9e565b6001600160a01b03821661256c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a9e565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60065460ff166110d55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a9e565b6006805460ff19169055565b80516020808301516040808501516060860151600654608088015160a089015160c08a015160e08b0151965160009a6126d29a9099986001600160a01b03610100909704969096169591019889526001600160401b0397881660208a01526001600160a01b0396871660408a0152948616606089015292909416608087015260a086015291831660c0850152911660e083015263ffffffff166101008201526101200190565b604051602081830303815290604052805190602001209050919050565b600a546000906109cc90600160681b90046001600160401b031683612b26565b6000816040516020016126d29190614094565b60008282604001518360600151600660019054906101000a90046001600160a01b03166040516020016127589493929190614165565b60405160208183030381529060405280519060200120905092915050565b6040516001600160a01b03808516602483015283166044820152606481018290526127e19085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613431565b50505050565b6006805460ff19166001179055565b600061280061336e565b60008060085413612812576000612816565b6008545b9050600081600954856128299190613e68565b6128339190613e68565b90506000826007546128459190613e68565b90508061285e5750670de0b6b3a7640000949350505050565b8061287183670de0b6b3a76400006140a2565b61287b91906140d7565b95945050505050565b60606109cc60405180602001604052806000815250604051806040016040528060098152602001680e4cad8c2f290c2e6d60bb1b81525084613503565b6001600160a01b0383166129255760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610a9e565b6001600160a01b0382166129875760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610a9e565b6001600160a01b038316600090815260016020526040902054818110156129ff5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610a9e565b612a098282613e51565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290612a3f908490613e68565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612a8b91815260200190565b60405180910390a350505050565b612aa28161270f565b60008381526012602052604090205414610c94576040805162461bcd60e51b81526020600482015260248101919091527f4861736865642072656c617920706172616d7320646f206e6f74206d6174636860448201527f206578697374696e672072656c6179206861736820666f72206465706f7369746064820152608401610a9e565b6000670de0b6b3a7640000612b44836001600160401b0386166140a2565b610cdd91906140d7565b60008282606001516040516020016127589291909182526001600160401b0316602082015260400190565b6001600160a01b0382163b15612ba557600654610c949061010090046001600160a01b03168383612c42565b600654604051632e1a7d4d60e01b8152600481018390526101009091046001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612bef57600080fd5b505af1158015612c03573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f19350505050158015612c3d573d6000803e3d6000fd5b505050565b6040516001600160a01b038316602482015260448101829052612c3d90849063a9059cbb60e01b906064016127aa565b6000612c7c612fbb565b905080600c54612c8c9190613e51565b600c55612c97610e0b565b600a60096101000a81548163ffffffff021916908363ffffffff16021790555050565b80600c6000828254612ccc9190613e68565b925050819055508060086000828254612ce59190614053565b909155505050565b6000612cf860035490565b612d095750670de0b6b3a764000090565b612d11612c72565b612d1961336e565b6000600c54600754612d2b9190613e51565b905060006008541315612d4c57600854612d459082613e68565b9050612d68565b600854612d5b906000196141aa565b612d659082613e51565b90505b600354612d7d82670de0b6b3a76400006140a2565b612d8791906140d7565b91505090565b6001600160a01b038216612ded5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610a9e565b6001600160a01b03821660009081526001602052604090205481811015612e615760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610a9e565b612e6b8282613e51565b6001600160a01b03841660009081526001602052604081209190915560038054849290612e99908490613e51565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016125c1565b6001600160a01b038216612f325760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610a9e565b8060036000828254612f449190613e68565b90915550506001600160a01b03821660009081526001602052604081208054839290612f71908490613e68565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600a546000908190670de0b6b3a764000090600160481b900463ffffffff16612fe2610e0b565b612fec9190613e51565b600a54600c5461300a9161010090046001600160401b0316906140a2565b61301491906140a2565b61301e91906140d7565b9050600c54811061189957600c54612d87565b60008061303e8585613e68565b6010546006549192506130639161010090046001600160a01b03908116911683613547565b6010546011546001600160a01b039091169063af355d1e90613083610e0b565b86600660019054906101000a90046001600160a01b031660008b600a60159054906101000a900463ffffffff168f670de0b6b3a76400006040518a63ffffffff1660e01b81526004016130de9998979695949392919061422f565b602060405180830381600087803b1580156130f857600080fd5b505af1925050508015613128575060408051601f3d908101601f1916820190925261312591810190613fb6565b60015b613175576006546131489061010090046001600160a01b03168883612c42565b60105460065461316b916001600160a01b03610100909204821691166000613547565b600091505061287b565b818110156131d05760006131898284613e51565b6006549091506131a89061010090046001600160a01b03168a83612c42565b6010546006546131cb916001600160a01b03610100909204821691166000613547565b819250505b5060408051610160810182526001600160a01b03898116825260006020830181905260065461010090049091169282019290925260608101829052670de0b6b3a7640000608082015260a08101829052600a5460c0820190600160a81b900463ffffffff1661323d610e0b565b6132479190613e68565b81526000602082015260400161325d8885613e51565b815260208101889052600a54600160a81b900463ffffffff9081166040909201919091526006549192506132a69161010090046001600160a01b03169033903090869061277616565b6010546006546132c8916001600160a01b036101009092048216911684613547565b6010546011546001600160a01b0390911690639ce320c8906132e8610e0b565b87858c306040518763ffffffff1660e01b815260040161330d9695949392919061429a565b602060405180830381600087803b15801561332757600080fd5b505af115801561333b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061335f9190613fb6565b50600198975050505050505050565b600d546006546040516370a0823160e01b81523060048201526000929161010090046001600160a01b0316906370a082319060240160206040518083038186803b1580156133bb57600080fd5b505afa1580156133cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f39190613fb6565b6133fd9190613e51565b905060075481111561185f576007546134169082613e51565b600860008282546134279190614399565b9091555050600755565b6000613486826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661366b9092919063ffffffff16565b805190915015612c3d57808060200190518101906134a491906143d8565b612c3d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a9e565b606060006135118585613682565b90508061351d846136c4565b60405160200161352e9291906143f5565b6040516020818303038152906040529150509392505050565b8015806135d05750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561359657600080fd5b505afa1580156135aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ce9190613fb6565b155b61363b5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a9e565b6040516001600160a01b038316602482015260448101829052612c3d90849063095ea7b360e01b906064016127aa565b606061367a8484600085613704565b949350505050565b8151606090156136b3578160405160200161369d919061441b565b60405160208183030381529060405290506109cc565b8160405160200161369d919061444f565b60606136d3608083901c61382c565b6136dc8361382c565b6040805160208101939093528201526060016040516020818303038152906040529050919050565b6060824710156137655760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a9e565b843b6137b35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a9e565b600080866001600160a01b031685876040516137cf9190614474565b60006040518083038185875af1925050503d806000811461380c576040519150601f19603f3d011682016040523d82523d6000602084013e613811565b606091505b50915091506138218282866139ce565b979650505050505050565b6000808260001c9050806fffffffffffffffffffffffffffffffff169050806801000000000000000002811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f08080808080808080808080808080808080808080808080808080808080808081681613950576139506140c1565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b606083156139dd575081610cdd565b8251156139ed5782518084602001fd5b8160405162461bcd60e51b8152600401610a9e9190613a5f565b60005b83811015613a22578181015183820152602001613a0a565b838111156127e15750506000910152565b60008151808452613a4b816020860160208601613a07565b601f01601f19169290920160200192915050565b602081526000610cdd6020830184613a33565b6001600160a01b038116811461185f57600080fd5b803561189981613a72565b60008060408385031215613aa557600080fd5b8235613ab081613a72565b946020939093013593505050565b60405160e081016001600160401b0381118282101715613aee57634e487b7160e01b600052604160045260246000fd5b60405290565b6001600160401b038116811461185f57600080fd5b803561189981613af4565b63ffffffff8116811461185f57600080fd5b803561189981613b14565b6000610100808385031215613b4557600080fd5b604051908101906001600160401b0382118183101715613b7557634e487b7160e01b600052604160045260246000fd5b816040528092508335815260208401359150613b9082613af4565b816020820152613ba260408501613a87565b6040820152613bb360608501613a87565b606082015260808401356080820152613bce60a08501613b09565b60a0820152613bdf60c08501613b09565b60c0820152613bf060e08501613b26565b60e0820152505092915050565b6000806101208385031215613c1157600080fd5b613c1b8484613b31565b9150610100830135613c2c81613af4565b809150509250929050565b6000808284036101e0811215613c4c57600080fd5b613c568585613b31565b925060e060ff1982011215613c6a57600080fd5b50613c73613abe565b61010084013560038110613c8657600080fd5b8152613c956101208501613a87565b6020820152613ca76101408501613b26565b6040820152613cb96101608501613b09565b6060820152613ccb6101808501613b26565b60808201526101a084013560a08201526101c09093013560c08401525092909150565b600060208284031215613d0057600080fd5b5035919050565b600080600060608486031215613d1c57600080fd5b8335613d2781613a72565b92506020840135613d3781613a72565b929592945050506040919091013590565b801515811461185f57600080fd5b60008060408385031215613d6957600080fd5b823591506020830135613c2c81613d48565b600060208284031215613d8d57600080fd5b8135610cdd81613a72565b60008060408385031215613dab57600080fd5b8235613db681613a72565b91506020830135613c2c81613a72565b600181811c90821680613dda57607f821691505b60208210811415613dfb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415613e4757613e47613e17565b6001019392505050565b600082821015613e6357613e63613e17565b500390565b60008219821115613e7b57613e7b613e17565b500190565b8051825260208101516001600160401b0380821660208501526040830151915060018060a01b03808316604086015280606085015116606086015250608083015160808501528060a08401511660a08501528060c08401511660c0850152505063ffffffff60e08201511660e08301525050565b805160038110613f1457634e487b7160e01b600052602160045260246000fd5b82526020818101516001600160a01b03169083015260408082015190613f419084018263ffffffff169052565b506060810151613f5c60608401826001600160401b03169052565b506080810151613f74608084018263ffffffff169052565b5060a0818101519083015260c090810151910152565b6102008101613f998286613e80565b613fa7610100830185613ef4565b826101e0830152949350505050565b600060208284031215613fc857600080fd5b5051919050565b600060208284031215613fe157600080fd5b8151610cdd81613af4565b600060208284031215613ffe57600080fd5b8151610cdd81613b14565b600063ffffffff80831681851680830382111561402857614028613e17565b01949350505050565b60006001600160401b0380831681851680830382111561402857614028613e17565b600080821280156001600160ff1b038490038513161561407557614075613e17565b600160ff1b839003841281161561408e5761408e613e17565b50500190565b60e081016109cc8284613ef4565b60008160001904831182151516156140bc576140bc613e17565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826140f457634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561410b57600080fd5b8151610cdd81613a72565b60006020828403121561412857600080fd5b604051602081018181106001600160401b038211171561415857634e487b7160e01b600052604160045260246000fd5b6040529151825250919050565b61016081016141748287613e80565b63ffffffff949094166101008201526001600160401b03929092166101208301526001600160a01b031661014090910152919050565b60006001600160ff1b03818413828413808216868404861116156141d0576141d0613e17565b600160ff1b60008712828116878305891216156141ef576141ef613e17565b6000871292508782058712848416161561420b5761420b613e17565b8785058712818416161561422157614221613e17565b505050929093029392505050565b60006101208b835263ffffffff808c1660208501528160408501526142568285018c613a33565b6001600160a01b039a8b166060860152608085019990995260a084019790975250509290931660c083015290931660e0840152610100909201919091529392505050565b600061020088835263ffffffff881660208401528060408401526142c081840188613a33565b9150506142d96060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a08701525050505061437e6101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b60008083128015600160ff1b8501841216156143b7576143b7613e17565b6001600160ff1b03840183138116156143d2576143d2613e17565b50500390565b6000602082840312156143ea57600080fd5b8151610cdd81613d48565b60008351614407818460208801613a07565b835190830190614028818360208801613a07565b600b60fa1b815260008251614437816001850160208701613a07565b601d60f91b6001939091019283015250600201919050565b60008251614461818460208701613a07565b601d60f91b920191825250600101919050565b60008251614486818460208701613a07565b919091019291505056fea2646970667358221220f4e8d2d1b0a37bd84b57d2c689d120d0698fe6892ad84016206d0c5d7f1d029964736f6c6343000809003300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000de7130ceaf4345a12a2764f0dc50bc4899d7ec08000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000015d3ef7980000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4163726f73732057455448204c500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009412d574554482d4c500000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102b25760003560e01c806370a0823111610175578063b5351ee2116100dc578063cefed55f11610095578063df738fc81161006f578063df738fc81461088e578063ed4de3a3146108bb578063f1d24bab146108f0578063fff6cae91461091457600080fd5b8063cefed55f14610804578063d412f5a414610824578063dd62ed3e1461084857600080fd5b8063b5351ee214610754578063bd6d894d14610769578063bec73ade1461077e578063c01e1bd61461079e578063c73a32c3146107c3578063cc2c929e146107ea57600080fd5b8063975057e71161012e578063975057e714610688578063a457c2d7146106a8578063a6af2dfe146106c8578063a9059cbb146106e8578063b208420214610708578063b454e3261461071e57600080fd5b806370a08231146105d1578063753b91bb146106075780637998a1c41461062757806387a515d31461063d5780638f2839701461065357806395d89b411461067357600080fd5b806323b872dd116102195780634464fae4116101d25780634464fae41461053d5780634f52fd171461055357806351c6590a146105735780635df45a371461058657806362822d341461059b57806366db5240146105bb57600080fd5b806323b872dd1461049757806329cb924d146104b7578063313ce567146104cc57806339509351146104e85780633cc400b3146105085780633fa856c91461051d57600080fd5b806318160ddd1161026b57806318160ddd146103d557806319e9d894146103ea5780631bf71c38146103ff5780631c39c38d1461041f578063223029221461045757806322f8e5661461047757600080fd5b806306fdde03146102be578063095ea7b3146102e957806311cfc159146103195780631311172514610356578063135c404e14610378578063173684c51461039c57600080fd5b366102b957005b600080fd5b3480156102ca57600080fd5b506102d3610929565b6040516102e09190613a5f565b60405180910390f35b3480156102f557600080fd5b50610309610304366004613a92565b6109bb565b60405190151581526020016102e0565b34801561032557600080fd5b50600a5461033e9061010090046001600160401b031681565b6040516001600160401b0390911681526020016102e0565b34801561036257600080fd5b50610376610371366004613bfd565b6109d2565b005b34801561038457600080fd5b5061038e600d5481565b6040519081526020016102e0565b3480156103a857600080fd5b50600a546103c090600160a81b900463ffffffff1681565b60405163ffffffff90911681526020016102e0565b3480156103e157600080fd5b5060035461038e565b3480156103f657600080fd5b5061038e610c98565b34801561040b57600080fd5b506102d361041a366004613c37565b610cc1565b34801561042b57600080fd5b5060005461043f906001600160a01b031681565b6040516001600160a01b0390911681526020016102e0565b34801561046357600080fd5b5060105461043f906001600160a01b031681565b34801561048357600080fd5b50610376610492366004613cee565b610ce4565b3480156104a357600080fd5b506103096104b2366004613d07565b610d5a565b3480156104c357600080fd5b5061038e610e0b565b3480156104d857600080fd5b50604051601281526020016102e0565b3480156104f457600080fd5b50610309610503366004613a92565b610eab565b34801561051457600080fd5b50610376610ee2565b34801561052957600080fd5b50610376610538366004613c37565b6110d7565b34801561054957600080fd5b5061038e600c5481565b34801561055f57600080fd5b5061037661056e366004613d56565b611542565b610376610581366004613cee565b6116bb565b34801561059257600080fd5b5061038e611862565b3480156105a757600080fd5b5061038e6105b6366004613cee565b611874565b3480156105c757600080fd5b5061038e60085481565b3480156105dd57600080fd5b5061038e6105ec366004613d7b565b6001600160a01b031660009081526001602052604090205490565b34801561061357600080fd5b50610376610622366004613bfd565b61189e565b34801561063357600080fd5b5061038e60115481565b34801561064957600080fd5b5061038e60095481565b34801561065f57600080fd5b5061037661066e366004613d7b565b611cc1565b34801561067f57600080fd5b506102d3611d48565b34801561069457600080fd5b50600f5461043f906001600160a01b031681565b3480156106b457600080fd5b506103096106c3366004613a92565b611d57565b3480156106d457600080fd5b50600e5461043f906001600160a01b031681565b3480156106f457600080fd5b50610309610703366004613a92565b611df2565b34801561071457600080fd5b5061038e60075481565b34801561072a57600080fd5b5061043f610739366004613cee565b6013602052600090815260409020546001600160a01b031681565b34801561076057600080fd5b50610376611dff565b34801561077557600080fd5b5061038e612057565b34801561078a57600080fd5b50610376610799366004613c37565b612071565b3480156107aa57600080fd5b5060065461043f9061010090046001600160a01b031681565b3480156107cf57600080fd5b50600a5461033e90600160681b90046001600160401b031681565b3480156107f657600080fd5b50600a546103099060ff1681565b34801561081057600080fd5b5061037661081f366004613c37565b612265565b34801561083057600080fd5b506006546103c090600160a81b900463ffffffff1681565b34801561085457600080fd5b5061038e610863366004613d98565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561089a57600080fd5b5061038e6108a9366004613cee565b60126020526000908152604090205481565b3480156108c757600080fd5b506108db6108d6366004613cee565b612452565b604080519283526020830191909152016102e0565b3480156108fc57600080fd5b50600a546103c090600160481b900463ffffffff1681565b34801561092057600080fd5b50610376612489565b60606004805461093890613dc6565b80601f016020809104026020016040519081016040528092919081815260200182805461096490613dc6565b80156109b15780601f10610986576101008083540402835291602001916109b1565b820191906000526020600020905b81548152906001019060200180831161099457829003601f168201915b5050505050905090565b60006109c83384846124a9565b5060015b92915050565b6109da6125ce565b6109e2612620565b6703782dace9d900008260a001516001600160401b031611158015610a1c57506703782dace9d900008260c001516001600160401b031611155b8015610a3857506706f05b59d3b20000816001600160401b0316105b610a4157600080fd5b6000610a4c8361262c565b60008181526012602052604090205490915015610aa75760405162461bcd60e51b815260206004820152601460248201527350656e64696e672072656c61792065786973747360601b60448201526064015b60405180910390fd5b6000610ab1610e0b565b90506000610ac285608001516126ef565b905060006040518060e0016040528060016002811115610ae457610ae4613e01565b815233602082015260068054604090920191600160a81b900463ffffffff16906015610b0f83613e2d565b91906101000a81548163ffffffff021916908363ffffffff16021790555063ffffffff168152602001866001600160401b031681526020018463ffffffff168152602001838152602001600b548152509050610b6a8161270f565b600085815260126020526040812091909155610b868783612722565b90508660800151600954600754610b9d9190613e51565b1015610be75760405162461bcd60e51b8152602060048201526019602482015278496e73756666696369656e7420706f6f6c2062616c616e636560381b6044820152606401610a9e565b6000600b5484610bf79190613e68565b9050876080015160096000828254610c0f9190613e68565b9250508190555080600d6000828254610c289190613e68565b9091555050600654610c4a9061010090046001600160a01b0316333084612776565b857fa4ca36d112520cced74325c72711f376fe4015665829d879ba21590cb8130be0898585604051610c7e93929190613f8a565b60405180910390a2505050505050610c946127e7565b5050565b6000610ca26125ce565b610caa612620565b610cb460006127f6565b9050610cbe6127e7565b90565b6060610ccb6125ce565b610cdd610cd88484612722565b612884565b9392505050565b6000546001600160a01b0316610cf957600080fd5b60005460405163117c72b360e11b8152600481018390526001600160a01b03909116906322f8e56690602401600060405180830381600087803b158015610d3f57600080fd5b505af1158015610d53573d6000803e3d6000fd5b5050505050565b6000610d678484846128c1565b6001600160a01b038416600090815260026020908152604080832033845290915290205482811015610dec5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610a9e565b610e008533610dfb8685613e51565b6124a9565b506001949350505050565b600080546001600160a01b031615610ea65760008054906101000a90046001600160a01b03166001600160a01b03166329cb924d6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6957600080fd5b505afa158015610e7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea19190613fb6565b905090565b504290565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916109c8918590610dfb908690613e68565b610eea6125ce565b610ef2612620565b600e60009054906101000a90046001600160a01b03166001600160a01b031663c73a32c36040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4057600080fd5b505afa158015610f54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f789190613fcf565b600a600d6101000a8154816001600160401b0302191690836001600160401b03160217905550600e60009054906101000a90046001600160a01b03166001600160a01b031663173684c56040518163ffffffff1660e01b815260040160206040518083038186803b158015610fec57600080fd5b505afa158015611000573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110249190613fec565b600a60156101000a81548163ffffffff021916908363ffffffff160217905550600e60009054906101000a90046001600160a01b03166001600160a01b0316637998a1c46040518163ffffffff1660e01b815260040160206040518083038186803b15801561109257600080fd5b505afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ca9190613fb6565b6011556110d56127e7565b565b6110df6125ce565b6110e7612620565b60006110f28361262c565b90506110fe8183612a99565b60018251600281111561111357611113613e01565b146111525760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e481cd95d1d1b1959608a1b6044820152606401610a9e565b6000600a60159054906101000a900463ffffffff1683608001516111769190614009565b9050611180610e0b565b8163ffffffff1611156111ca5760405162461bcd60e51b8152602060048201526012602482015271139bdd081cd95d1d1b1958589b19481e595d60721b6044820152606401610a9e565b82602001516001600160a01b0316336001600160a01b0316148061120557506111f581610384614009565b63ffffffff16611203610e0b565b115b6112445760405162461bcd60e51b815260206004820152601060248201526f2737ba1039b637bb903932b630bcb2b960811b6044820152606401610a9e565b6040805160e081019091526112b890806002815260200185602001516001600160a01b03168152602001856040015163ffffffff16815260200185606001516001600160401b03168152602001856080015163ffffffff1681526020018560a0015181526020018560c0015181525061270f565b60008381526012602052604081209190915560a085015160608501516112eb916112e191614031565b8660800151612b26565b85608001516112fa9190613e51565b905060006113088486612b4e565b600081815260136020526040902054600a549192506001600160a01b03169060ff16801561133d57506001600160a01b038116155b1561135557611350876040015184612b79565b61138a565b61138a6001600160a01b038216611370578760400151611372565b815b60065461010090046001600160a01b03169085612c42565b600061139e8860a001518960800151612b26565b905060008760a001518860c001516113b69190613e68565b60208901519091506001600160a01b03163314156113fe5760208801516113f9906113e18385613e68565b60065461010090046001600160a01b03169190612c42565b61143c565b6020880151600654611420916101009091046001600160a01b03169083612c42565b60065461143c9061010090046001600160a01b03163384612c42565b60006114488387613e68565b90508960800151600960008282546114609190613e51565b9250508190555080600760008282546114799190613e51565b9250508190555080600860008282546114929190614053565b9250508190555081600d60008282546114ab9190613e51565b909155506114b99050612c72565b6114d36114ce8a606001518c60800151612b26565b612cba565b336001600160a01b0316887fcfdda74fce9fedb259e0f0a1ab1550e19b338488ece64976a4639e7fce0293a78b60405161150d9190614094565b60405180910390a350505060009182525060136020526040902080546001600160a01b031916905550610c9491506127e79050565b61154a6125ce565b611552612620565b8015806115615750600a5460ff165b61159d5760405162461bcd60e51b815260206004820152600d60248201526c086c2dce840e6cadcc840cae8d609b1b6044820152606401610a9e565b6000670de0b6b3a76400006115b0612ced565b6115ba90856140a2565b6115c491906140d7565b9050806009546115d49190613e68565b60075410156116255760405162461bcd60e51b815260206004820152601e60248201527f5574696c697a6174696f6e20746f6f206869676820746f2072656d6f766500006044820152606401610a9e565b61162f3384612d8d565b80600760008282546116419190613e51565b9091555050811561165b576116563382612b79565b611677565b6006546116779061010090046001600160a01b03163383612c42565b604080518281526020810185905233917f0c54fc223ffd1a8f36652b5e83db4fff50f5ae151b11ceb56d5499b9f6e1fa18910160405180910390a250610c946127e7565b6116c36125ce565b6116cb612620565b600a5460ff1680156116dc57508034145b806116e5575034155b6117315760405162461bcd60e51b815260206004820152601b60248201527f42616420616464206c6971756964697479204574682076616c756500000000006044820152606401610a9e565b600061173b612ced565b61174d83670de0b6b3a76400006140a2565b61175791906140d7565b90506117633382612edc565b81600760008282546117759190613e68565b9091555050341580159061178b5750600a5460ff165b156117fe57600660019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156117e057600080fd5b505af11580156117f4573d6000803e3d6000fd5b505050505061181b565b60065461181b9061010090046001600160a01b0316333085612776565b604080518381526020810183905233917f0351f600ef1e31e5e13b4dc27bff4cbde3e9269f0ffc666629ae6cac573eb220910160405180910390a25061185f6127e7565b50565b600061186c6125ce565b610ea1612fbb565b600061187e6125ce565b611886612620565b61188f826127f6565b90506118996127e7565b919050565b6118a66125ce565b6118ae612620565b60006118b8610e0b565b90506703782dace9d900008360a001516001600160401b0316111580156118f457506703782dace9d900008360c001516001600160401b031611155b801561191057506706f05b59d3b20000826001600160401b0316105b61191957600080fd5b60006119248461262c565b6000818152601260205260409020549091501561197a5760405162461bcd60e51b815260206004820152601460248201527350656e64696e672072656c61792065786973747360601b6044820152606401610a9e565b600061198985608001516126ef565b905060006040518060e00160405280600160028111156119ab576119ab613e01565b815233602082015260068054604090920191600160a81b900463ffffffff169060156119d683613e2d565b91906101000a81548163ffffffff021916908363ffffffff16021790555063ffffffff168152602001866001600160401b031681526020018563ffffffff168152602001838152602001600b5481525090506000611a348783612722565b9050611a3f8261270f565b600085815260126020526040812091909155611a5b8584612b4e565b6000818152601360205260409020549091506001600160a01b031615611abd5760405162461bcd60e51b8152602060048201526017602482015276052656c61792063616e6e6f74206265207370656420757604c1b6044820152606401610a9e565b8760800151600954600754611ad29190613e51565b1015611b1c5760405162461bcd60e51b8152602060048201526019602482015278496e73756666696369656e7420706f6f6c2062616c616e636560381b6044820152606401610a9e565b6000600b5485611b2c9190613e68565b90506000611b608a60c001518b60a001518760600151611b4c9190614031565b611b569190614031565b8b60800151612b26565b90506000818b60800151611b749190613e51565b905082600d6000828254611b889190613e68565b909155505060808b015160098054600090611ba4908490613e68565b9091555050600084815260136020526040902080546001600160a01b03191633908117909155611bf29030611bd98685613e68565b60065461010090046001600160a01b0316929190612776565b600a5460ff1615611c1057611c0b8b6040015182612b79565b611c32565b60408b0151600654611c32916101009091046001600160a01b03169083612c42565b877fa4ca36d112520cced74325c72711f376fe4015665829d879ba21590cb8130be08c8888604051611c6693929190613f8a565b60405180910390a2336001600160a01b0316887ff98cddc88bc965917007822b05056cb92bc9ddf0f8bcc61678400cb78313bb4b88604051611ca89190614094565b60405180910390a3505050505050505050610c946127e7565b611cc96125ce565b611cd1612620565b600e546001600160a01b03163314611ce857600080fd5b600e80546001600160a01b0319166001600160a01b0383169081179091556040805133815260208101929092527f485a12424bd0c2c66a131c2681cb6c743b9573af3ae5f3014ef6ce7f55ab0192910160405180910390a161185f6127e7565b60606005805461093890613dc6565b3360009081526002602090815260408083206001600160a01b038616845290915281205482811015611dd95760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610a9e565b611de83385610dfb8685613e51565b5060019392505050565b60006109c83384846128c1565b611e076125ce565b611e0f612620565b600e5460408051632e68f21360e21b815290516000926001600160a01b03169163b9a3c84c916004808301926020929190829003018186803b158015611e5457600080fd5b505afa158015611e68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8c91906140f9565b6040516302abf57960e61b815275536b696e6e794f7074696d69737469634f7261636c6560501b60048201529091506001600160a01b0382169063aafd5e409060240160206040518083038186803b158015611ee757600080fd5b505afa158015611efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1f91906140f9565b601080546001600160a01b0319166001600160a01b039283161790556040516302abf57960e61b81526453746f726560d81b60048201529082169063aafd5e409060240160206040518083038186803b158015611f7b57600080fd5b505afa158015611f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb391906140f9565b600f80546001600160a01b0319166001600160a01b03928316908117909155600654604051635b97aadd60e01b8152610100909104909216600483015290635b97aadd9060240160206040518083038186803b15801561201257600080fd5b505afa158015612026573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204a9190614116565b51600b55506110d56127e7565b60006120616125ce565b612069612620565b610cb4612ced565b6120796125ce565b612081612620565b600061208c8361262c565b90506120988183612a99565b60006120a48284612b4e565b9050600a60159054906101000a900463ffffffff1683608001516120c89190614009565b63ffffffff166120d6610e0b565b1080156120f557506001835160028111156120f3576120f3613e01565b145b801561211657506000818152601360205260409020546001600160a01b0316155b61215c5760405162461bcd60e51b8152602060048201526017602482015276052656c61792063616e6e6f74206265207370656420757604c1b6044820152606401610a9e565b600081815260136020526040812080546001600160a01b0319163317905560c085015160a086015160608601516121a1929161219791614031565b6112e19190614031565b905060008186608001516121b59190613e51565b600a5490915060ff16156121f3576006546121e09061010090046001600160a01b0316333084612776565b6121ee866040015182612b79565b612217565b6040860151600654612217916101009091046001600160a01b031690339084612776565b336001600160a01b0316847ff98cddc88bc965917007822b05056cb92bc9ddf0f8bcc61678400cb78313bb4b876040516122519190614094565b60405180910390a350505050610c946127e7565b61226d6125ce565b612275612620565b61227d610e0b565b600a54608083015161229c91600160a81b900463ffffffff1690614009565b63ffffffff16116122df5760405162461bcd60e51b815260206004820152600d60248201526c50617374206c6976656e65737360981b6044820152606401610a9e565b6001815160028111156122f4576122f4613e01565b146123325760405162461bcd60e51b815260206004820152600e60248201526d4e6f742064697370757461626c6560901b6044820152606401610a9e565b600061233d8361262c565b90506123498183612a99565b60006123558484612722565b9050600061237a8460200151338660a001518760c0015161237587612884565b613031565b90508360a001518460c001516123909190613e68565b600d60008282546123a19190613e51565b90915550506080850151600980546000906123bd908490613e51565b9091555050600083815260126020526040812055801561241157336123e18561270f565b60405185907f29751133c2d0a0ea7a9da312248b12ef10ac4c20f4e3ab5eebbb80d853b3836790600090a4612447565b3361241b8561270f565b60405185907f14173c4d3bd95e34f5c8f78729323444c9272bd21051e70045b64ed48f65818390600090a45b505050610c946127e7565b60008061245d6125ce565b612465612620565b61246f60006127f6565b612478846127f6565b915091506124846127e7565b915091565b6124916125ce565b612499612620565b6124a161336e565b6110d56127e7565b6001600160a01b03831661250b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a9e565b6001600160a01b03821661256c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a9e565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60065460ff166110d55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a9e565b6006805460ff19169055565b80516020808301516040808501516060860151600654608088015160a089015160c08a015160e08b0151965160009a6126d29a9099986001600160a01b03610100909704969096169591019889526001600160401b0397881660208a01526001600160a01b0396871660408a0152948616606089015292909416608087015260a086015291831660c0850152911660e083015263ffffffff166101008201526101200190565b604051602081830303815290604052805190602001209050919050565b600a546000906109cc90600160681b90046001600160401b031683612b26565b6000816040516020016126d29190614094565b60008282604001518360600151600660019054906101000a90046001600160a01b03166040516020016127589493929190614165565b60405160208183030381529060405280519060200120905092915050565b6040516001600160a01b03808516602483015283166044820152606481018290526127e19085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613431565b50505050565b6006805460ff19166001179055565b600061280061336e565b60008060085413612812576000612816565b6008545b9050600081600954856128299190613e68565b6128339190613e68565b90506000826007546128459190613e68565b90508061285e5750670de0b6b3a7640000949350505050565b8061287183670de0b6b3a76400006140a2565b61287b91906140d7565b95945050505050565b60606109cc60405180602001604052806000815250604051806040016040528060098152602001680e4cad8c2f290c2e6d60bb1b81525084613503565b6001600160a01b0383166129255760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610a9e565b6001600160a01b0382166129875760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610a9e565b6001600160a01b038316600090815260016020526040902054818110156129ff5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610a9e565b612a098282613e51565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290612a3f908490613e68565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612a8b91815260200190565b60405180910390a350505050565b612aa28161270f565b60008381526012602052604090205414610c94576040805162461bcd60e51b81526020600482015260248101919091527f4861736865642072656c617920706172616d7320646f206e6f74206d6174636860448201527f206578697374696e672072656c6179206861736820666f72206465706f7369746064820152608401610a9e565b6000670de0b6b3a7640000612b44836001600160401b0386166140a2565b610cdd91906140d7565b60008282606001516040516020016127589291909182526001600160401b0316602082015260400190565b6001600160a01b0382163b15612ba557600654610c949061010090046001600160a01b03168383612c42565b600654604051632e1a7d4d60e01b8152600481018390526101009091046001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015612bef57600080fd5b505af1158015612c03573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f19350505050158015612c3d573d6000803e3d6000fd5b505050565b6040516001600160a01b038316602482015260448101829052612c3d90849063a9059cbb60e01b906064016127aa565b6000612c7c612fbb565b905080600c54612c8c9190613e51565b600c55612c97610e0b565b600a60096101000a81548163ffffffff021916908363ffffffff16021790555050565b80600c6000828254612ccc9190613e68565b925050819055508060086000828254612ce59190614053565b909155505050565b6000612cf860035490565b612d095750670de0b6b3a764000090565b612d11612c72565b612d1961336e565b6000600c54600754612d2b9190613e51565b905060006008541315612d4c57600854612d459082613e68565b9050612d68565b600854612d5b906000196141aa565b612d659082613e51565b90505b600354612d7d82670de0b6b3a76400006140a2565b612d8791906140d7565b91505090565b6001600160a01b038216612ded5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610a9e565b6001600160a01b03821660009081526001602052604090205481811015612e615760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610a9e565b612e6b8282613e51565b6001600160a01b03841660009081526001602052604081209190915560038054849290612e99908490613e51565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016125c1565b6001600160a01b038216612f325760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610a9e565b8060036000828254612f449190613e68565b90915550506001600160a01b03821660009081526001602052604081208054839290612f71908490613e68565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600a546000908190670de0b6b3a764000090600160481b900463ffffffff16612fe2610e0b565b612fec9190613e51565b600a54600c5461300a9161010090046001600160401b0316906140a2565b61301491906140a2565b61301e91906140d7565b9050600c54811061189957600c54612d87565b60008061303e8585613e68565b6010546006549192506130639161010090046001600160a01b03908116911683613547565b6010546011546001600160a01b039091169063af355d1e90613083610e0b565b86600660019054906101000a90046001600160a01b031660008b600a60159054906101000a900463ffffffff168f670de0b6b3a76400006040518a63ffffffff1660e01b81526004016130de9998979695949392919061422f565b602060405180830381600087803b1580156130f857600080fd5b505af1925050508015613128575060408051601f3d908101601f1916820190925261312591810190613fb6565b60015b613175576006546131489061010090046001600160a01b03168883612c42565b60105460065461316b916001600160a01b03610100909204821691166000613547565b600091505061287b565b818110156131d05760006131898284613e51565b6006549091506131a89061010090046001600160a01b03168a83612c42565b6010546006546131cb916001600160a01b03610100909204821691166000613547565b819250505b5060408051610160810182526001600160a01b03898116825260006020830181905260065461010090049091169282019290925260608101829052670de0b6b3a7640000608082015260a08101829052600a5460c0820190600160a81b900463ffffffff1661323d610e0b565b6132479190613e68565b81526000602082015260400161325d8885613e51565b815260208101889052600a54600160a81b900463ffffffff9081166040909201919091526006549192506132a69161010090046001600160a01b03169033903090869061277616565b6010546006546132c8916001600160a01b036101009092048216911684613547565b6010546011546001600160a01b0390911690639ce320c8906132e8610e0b565b87858c306040518763ffffffff1660e01b815260040161330d9695949392919061429a565b602060405180830381600087803b15801561332757600080fd5b505af115801561333b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061335f9190613fb6565b50600198975050505050505050565b600d546006546040516370a0823160e01b81523060048201526000929161010090046001600160a01b0316906370a082319060240160206040518083038186803b1580156133bb57600080fd5b505afa1580156133cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f39190613fb6565b6133fd9190613e51565b905060075481111561185f576007546134169082613e51565b600860008282546134279190614399565b9091555050600755565b6000613486826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661366b9092919063ffffffff16565b805190915015612c3d57808060200190518101906134a491906143d8565b612c3d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a9e565b606060006135118585613682565b90508061351d846136c4565b60405160200161352e9291906143f5565b6040516020818303038152906040529150509392505050565b8015806135d05750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561359657600080fd5b505afa1580156135aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ce9190613fb6565b155b61363b5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610a9e565b6040516001600160a01b038316602482015260448101829052612c3d90849063095ea7b360e01b906064016127aa565b606061367a8484600085613704565b949350505050565b8151606090156136b3578160405160200161369d919061441b565b60405160208183030381529060405290506109cc565b8160405160200161369d919061444f565b60606136d3608083901c61382c565b6136dc8361382c565b6040805160208101939093528201526060016040516020818303038152906040529050919050565b6060824710156137655760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a9e565b843b6137b35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a9e565b600080866001600160a01b031685876040516137cf9190614474565b60006040518083038185875af1925050503d806000811461380c576040519150601f19603f3d011682016040523d82523d6000602084013e613811565b606091505b50915091506138218282866139ce565b979650505050505050565b6000808260001c9050806fffffffffffffffffffffffffffffffff169050806801000000000000000002811777ffffffffffffffff0000000000000000ffffffffffffffff169050806401000000000281177bffffffff00000000ffffffff00000000ffffffff00000000ffffffff16905080620100000281177dffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff169050806101000281177eff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff1690508060100281177f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f16905060006008827f08080808080808080808080808080808080808080808080808080808080808081681613950576139506140c1565b0460047f040404040404040404040404040404040404040404040404040404040404040484160460027f020202020202020202020202020202020202020202020202020202020202020285160417166027029091017f3030303030303030303030303030303030303030303030303030303030303030019392505050565b606083156139dd575081610cdd565b8251156139ed5782518084602001fd5b8160405162461bcd60e51b8152600401610a9e9190613a5f565b60005b83811015613a22578181015183820152602001613a0a565b838111156127e15750506000910152565b60008151808452613a4b816020860160208601613a07565b601f01601f19169290920160200192915050565b602081526000610cdd6020830184613a33565b6001600160a01b038116811461185f57600080fd5b803561189981613a72565b60008060408385031215613aa557600080fd5b8235613ab081613a72565b946020939093013593505050565b60405160e081016001600160401b0381118282101715613aee57634e487b7160e01b600052604160045260246000fd5b60405290565b6001600160401b038116811461185f57600080fd5b803561189981613af4565b63ffffffff8116811461185f57600080fd5b803561189981613b14565b6000610100808385031215613b4557600080fd5b604051908101906001600160401b0382118183101715613b7557634e487b7160e01b600052604160045260246000fd5b816040528092508335815260208401359150613b9082613af4565b816020820152613ba260408501613a87565b6040820152613bb360608501613a87565b606082015260808401356080820152613bce60a08501613b09565b60a0820152613bdf60c08501613b09565b60c0820152613bf060e08501613b26565b60e0820152505092915050565b6000806101208385031215613c1157600080fd5b613c1b8484613b31565b9150610100830135613c2c81613af4565b809150509250929050565b6000808284036101e0811215613c4c57600080fd5b613c568585613b31565b925060e060ff1982011215613c6a57600080fd5b50613c73613abe565b61010084013560038110613c8657600080fd5b8152613c956101208501613a87565b6020820152613ca76101408501613b26565b6040820152613cb96101608501613b09565b6060820152613ccb6101808501613b26565b60808201526101a084013560a08201526101c09093013560c08401525092909150565b600060208284031215613d0057600080fd5b5035919050565b600080600060608486031215613d1c57600080fd5b8335613d2781613a72565b92506020840135613d3781613a72565b929592945050506040919091013590565b801515811461185f57600080fd5b60008060408385031215613d6957600080fd5b823591506020830135613c2c81613d48565b600060208284031215613d8d57600080fd5b8135610cdd81613a72565b60008060408385031215613dab57600080fd5b8235613db681613a72565b91506020830135613c2c81613a72565b600181811c90821680613dda57607f821691505b60208210811415613dfb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415613e4757613e47613e17565b6001019392505050565b600082821015613e6357613e63613e17565b500390565b60008219821115613e7b57613e7b613e17565b500190565b8051825260208101516001600160401b0380821660208501526040830151915060018060a01b03808316604086015280606085015116606086015250608083015160808501528060a08401511660a08501528060c08401511660c0850152505063ffffffff60e08201511660e08301525050565b805160038110613f1457634e487b7160e01b600052602160045260246000fd5b82526020818101516001600160a01b03169083015260408082015190613f419084018263ffffffff169052565b506060810151613f5c60608401826001600160401b03169052565b506080810151613f74608084018263ffffffff169052565b5060a0818101519083015260c090810151910152565b6102008101613f998286613e80565b613fa7610100830185613ef4565b826101e0830152949350505050565b600060208284031215613fc857600080fd5b5051919050565b600060208284031215613fe157600080fd5b8151610cdd81613af4565b600060208284031215613ffe57600080fd5b8151610cdd81613b14565b600063ffffffff80831681851680830382111561402857614028613e17565b01949350505050565b60006001600160401b0380831681851680830382111561402857614028613e17565b600080821280156001600160ff1b038490038513161561407557614075613e17565b600160ff1b839003841281161561408e5761408e613e17565b50500190565b60e081016109cc8284613ef4565b60008160001904831182151516156140bc576140bc613e17565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826140f457634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561410b57600080fd5b8151610cdd81613a72565b60006020828403121561412857600080fd5b604051602081018181106001600160401b038211171561415857634e487b7160e01b600052604160045260246000fd5b6040529151825250919050565b61016081016141748287613e80565b63ffffffff949094166101008201526001600160401b03929092166101208301526001600160a01b031661014090910152919050565b60006001600160ff1b03818413828413808216868404861116156141d0576141d0613e17565b600160ff1b60008712828116878305891216156141ef576141ef613e17565b6000871292508782058712848416161561420b5761420b613e17565b8785058712818416161561422157614221613e17565b505050929093029392505050565b60006101208b835263ffffffff808c1660208501528160408501526142568285018c613a33565b6001600160a01b039a8b166060860152608085019990995260a084019790975250509290931660c083015290931660e0840152610100909201919091529392505050565b600061020088835263ffffffff881660208401528060408401526142c081840188613a33565b9150506142d96060830186516001600160a01b03169052565b60208501516001600160a01b03811660808401525060408501516001600160a01b03811660a084015250606085015180151560c084015250608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015161016087015281890151610180870152808901516101a08701525050505061437e6101c08301856001600160a01b03169052565b6001600160a01b0383166101e0830152979650505050505050565b60008083128015600160ff1b8501841216156143b7576143b7613e17565b6001600160ff1b03840183138116156143d2576143d2613e17565b50500390565b6000602082840312156143ea57600080fd5b8151610cdd81613d48565b60008351614407818460208801613a07565b835190830190614028818360208801613a07565b600b60fa1b815260008251614437816001850160208701613a07565b601d60f91b6001939091019283015250600201919050565b60008251614461818460208701613a07565b601d60f91b920191825250600101919050565b60008251614486818460208701613a07565b919091019291505056fea2646970667358221220f4e8d2d1b0a37bd84b57d2c689d120d0698fe6892ad84016206d0c5d7f1d029964736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000de7130ceaf4345a12a2764f0dc50bc4899d7ec08000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000015d3ef7980000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4163726f73732057455448204c500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009412d574554482d4c500000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _lpTokenName (string): Across WETH LP
Arg [1] : _lpTokenSymbol (string): A-WETH-LP
Arg [2] : _bridgeAdmin (address): 0xDE7130CEaf4345a12a2764F0Dc50bc4899d7EC08
Arg [3] : _l1Token (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [4] : _lpFeeRatePerSecond (uint64): 1500000000000
Arg [5] : _isWethPool (bool): True
Arg [6] : _timer (address): 0x0000000000000000000000000000000000000000
-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [2] : 000000000000000000000000de7130ceaf4345a12a2764f0dc50bc4899d7ec08
Arg [3] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [4] : 0000000000000000000000000000000000000000000000000000015d3ef79800
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [8] : 4163726f73732057455448204c50000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [10] : 412d574554482d4c500000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $3,244.29 | 0.15 | $486.64 |
Loading...
Loading
[ Download: CSV Export ]
[ 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.