Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x6154e161 | 13113347 | 1054 days ago | IN | Create: ExchangeBlocks | 0 ETH | 0.2309981 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ExchangeBlocks
Compiler Version
v0.7.6+commit.7338295f
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2021-08-28 */ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; // File: contracts/lib/AddressUtil.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for addresses /// @author Daniel Wang - <[email protected]> /// @author Brecht Devos - <[email protected]> library AddressUtil { using AddressUtil for *; function isContract( address addr ) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(addr) } return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470); } function toPayable( address addr ) internal pure returns (address payable) { return payable(addr); } // Works like address.send but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETH( address to, uint amount, uint gasLimit ) internal returns (bool success) { if (amount == 0) { return true; } address payable recipient = to.toPayable(); /* solium-disable-next-line */ (success, ) = recipient.call{value: amount, gas: gasLimit}(""); } // Works like address.transfer but with a customizable gas limit // Make sure your code is safe for reentrancy when using this function! function sendETHAndVerify( address to, uint amount, uint gasLimit ) internal returns (bool success) { success = to.sendETH(amount, gasLimit); require(success, "TRANSFER_FAILURE"); } // Works like call but is slightly more efficient when data // needs to be copied from memory to do the call. function fastCall( address to, uint gasLimit, uint value, bytes memory data ) internal returns (bool success, bytes memory returnData) { if (to != address(0)) { assembly { // Do the call success := call(gasLimit, to, value, add(data, 32), mload(data), 0, 0) // Copy the return data let size := returndatasize() returnData := mload(0x40) mstore(returnData, size) returndatacopy(add(returnData, 32), 0, size) // Update free memory pointer mstore(0x40, add(returnData, add(32, size))) } } } // Like fastCall, but throws when the call is unsuccessful. function fastCallAndVerify( address to, uint gasLimit, uint value, bytes memory data ) internal returns (bytes memory returnData) { bool success; (success, returnData) = fastCall(to, gasLimit, value, data); if (!success) { assembly { revert(add(returnData, 32), mload(returnData)) } } } } // File: contracts/lib/MathUint.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for uint /// @author Daniel Wang - <[email protected]> library MathUint { using MathUint for uint; function mul( uint a, uint b ) internal pure returns (uint c) { c = a * b; require(a == 0 || c / a == b, "MUL_OVERFLOW"); } function sub( uint a, uint b ) internal pure returns (uint) { require(b <= a, "SUB_UNDERFLOW"); return a - b; } function add( uint a, uint b ) internal pure returns (uint c) { c = a + b; require(c >= a, "ADD_OVERFLOW"); } function add64( uint64 a, uint64 b ) internal pure returns (uint64 c) { c = a + b; require(c >= a, "ADD_OVERFLOW"); } } // File: contracts/thirdparty/BytesUtil.sol //Mainly taken from https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol library BytesUtil { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function slice( bytes memory _bytes, uint _start, uint _length ) internal pure returns (bytes memory) { require(_bytes.length >= (_start + _length)); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint _start) internal pure returns (address) { require(_bytes.length >= (_start + 20)); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint _start) internal pure returns (uint8) { require(_bytes.length >= (_start + 1)); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint _start) internal pure returns (uint16) { require(_bytes.length >= (_start + 2)); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint24(bytes memory _bytes, uint _start) internal pure returns (uint24) { require(_bytes.length >= (_start + 3)); uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint _start) internal pure returns (uint32) { require(_bytes.length >= (_start + 4)); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint _start) internal pure returns (uint64) { require(_bytes.length >= (_start + 8)); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint _start) internal pure returns (uint96) { require(_bytes.length >= (_start + 12)); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint _start) internal pure returns (uint128) { require(_bytes.length >= (_start + 16)); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint(bytes memory _bytes, uint _start) internal pure returns (uint256) { require(_bytes.length >= (_start + 32)); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes4(bytes memory _bytes, uint _start) internal pure returns (bytes4) { require(_bytes.length >= (_start + 4)); bytes4 tempBytes4; assembly { tempBytes4 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes4; } function toBytes20(bytes memory _bytes, uint _start) internal pure returns (bytes20) { require(_bytes.length >= (_start + 20)); bytes20 tempBytes20; assembly { tempBytes20 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes20; } function toBytes32(bytes memory _bytes, uint _start) internal pure returns (bytes32) { require(_bytes.length >= (_start + 32)); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function toAddressUnsafe(bytes memory _bytes, uint _start) internal pure returns (address) { address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8Unsafe(bytes memory _bytes, uint _start) internal pure returns (uint8) { uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16Unsafe(bytes memory _bytes, uint _start) internal pure returns (uint16) { uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint24Unsafe(bytes memory _bytes, uint _start) internal pure returns (uint24) { uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } function toUint32Unsafe(bytes memory _bytes, uint _start) internal pure returns (uint32) { uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64Unsafe(bytes memory _bytes, uint _start) internal pure returns (uint64) { uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96Unsafe(bytes memory _bytes, uint _start) internal pure returns (uint96) { uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128Unsafe(bytes memory _bytes, uint _start) internal pure returns (uint128) { uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUintUnsafe(bytes memory _bytes, uint _start) internal pure returns (uint256) { uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes4Unsafe(bytes memory _bytes, uint _start) internal pure returns (bytes4) { bytes4 tempBytes4; assembly { tempBytes4 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes4; } function toBytes20Unsafe(bytes memory _bytes, uint _start) internal pure returns (bytes20) { bytes20 tempBytes20; assembly { tempBytes20 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes20; } function toBytes32Unsafe(bytes memory _bytes, uint _start) internal pure returns (bytes32) { bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function fastSHA256( bytes memory data ) internal view returns (bytes32) { bytes32[] memory result = new bytes32[](1); bool success; assembly { let ptr := add(data, 32) success := staticcall(sub(gas(), 2000), 2, ptr, mload(data), add(result, 32), 32) } require(success, "SHA256_FAILED"); return result[0]; } } // File: contracts/core/iface/IAgentRegistry.sol // Copyright 2017 Loopring Technology Limited. interface IAgent{} abstract contract IAgentRegistry { /// @dev Returns whether an agent address is an agent of an account owner /// @param owner The account owner. /// @param agent The agent address /// @return True if the agent address is an agent for the account owner, else false function isAgent( address owner, address agent ) external virtual view returns (bool); /// @dev Returns whether an agent address is an agent of all account owners /// @param owners The account owners. /// @param agent The agent address /// @return True if the agent address is an agent for the account owner, else false function isAgent( address[] calldata owners, address agent ) external virtual view returns (bool); /// @dev Returns whether an agent address is a universal agent. /// @param agent The agent address /// @return True if the agent address is a universal agent, else false function isUniversalAgent(address agent) public virtual view returns (bool); } // File: contracts/lib/Ownable.sol // Copyright 2017 Loopring Technology Limited. /// @title Ownable /// @author Brecht Devos - <[email protected]> /// @dev The Ownable contract has an owner address, and provides basic /// authorization control functions, this simplifies the implementation of /// "user permissions". contract Ownable { address public owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /// @dev The Ownable constructor sets the original `owner` of the contract /// to the sender. constructor() { owner = msg.sender; } /// @dev Throws if called by any account other than the owner. modifier onlyOwner() { require(msg.sender == owner, "UNAUTHORIZED"); _; } /// @dev Allows the current owner to transfer control of the contract to a /// new owner. /// @param newOwner The address to transfer ownership to. function transferOwnership( address newOwner ) public virtual onlyOwner { require(newOwner != address(0), "ZERO_ADDRESS"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } function renounceOwnership() public onlyOwner { emit OwnershipTransferred(owner, address(0)); owner = address(0); } } // File: contracts/lib/Claimable.sol // Copyright 2017 Loopring Technology Limited. /// @title Claimable /// @author Brecht Devos - <[email protected]> /// @dev Extension for the Ownable contract, where the ownership needs /// to be claimed. This allows the new owner to accept the transfer. contract Claimable is Ownable { address public pendingOwner; /// @dev Modifier throws if called by any account other than the pendingOwner. modifier onlyPendingOwner() { require(msg.sender == pendingOwner, "UNAUTHORIZED"); _; } /// @dev Allows the current owner to set the pendingOwner address. /// @param newOwner The address to transfer ownership to. function transferOwnership( address newOwner ) public override onlyOwner { require(newOwner != address(0) && newOwner != owner, "INVALID_ADDRESS"); pendingOwner = newOwner; } /// @dev Allows the pendingOwner address to finalize the transfer. function claimOwnership() public onlyPendingOwner { emit OwnershipTransferred(owner, pendingOwner); owner = pendingOwner; pendingOwner = address(0); } } // File: contracts/core/iface/IBlockVerifier.sol // Copyright 2017 Loopring Technology Limited. /// @title IBlockVerifier /// @author Brecht Devos - <[email protected]> abstract contract IBlockVerifier is Claimable { // -- Events -- event CircuitRegistered( uint8 indexed blockType, uint16 blockSize, uint8 blockVersion ); event CircuitDisabled( uint8 indexed blockType, uint16 blockSize, uint8 blockVersion ); // -- Public functions -- /// @dev Sets the verifying key for the specified circuit. /// Every block permutation needs its own circuit and thus its own set of /// verification keys. Only a limited number of block sizes per block /// type are supported. /// @param blockType The type of the block /// @param blockSize The number of requests handled in the block /// @param blockVersion The block version (i.e. which circuit version needs to be used) /// @param vk The verification key function registerCircuit( uint8 blockType, uint16 blockSize, uint8 blockVersion, uint[18] calldata vk ) external virtual; /// @dev Disables the use of the specified circuit. /// @param blockType The type of the block /// @param blockSize The number of requests handled in the block /// @param blockVersion The block version (i.e. which circuit version needs to be used) function disableCircuit( uint8 blockType, uint16 blockSize, uint8 blockVersion ) external virtual; /// @dev Verifies blocks with the given public data and proofs. /// Verifying a block makes sure all requests handled in the block /// are correctly handled by the operator. /// @param blockType The type of block /// @param blockSize The number of requests handled in the block /// @param blockVersion The block version (i.e. which circuit version needs to be used) /// @param publicInputs The hash of all the public data of the blocks /// @param proofs The ZK proofs proving that the blocks are correct /// @return True if the block is valid, false otherwise function verifyProofs( uint8 blockType, uint16 blockSize, uint8 blockVersion, uint[] calldata publicInputs, uint[] calldata proofs ) external virtual view returns (bool); /// @dev Checks if a circuit with the specified parameters is registered. /// @param blockType The type of the block /// @param blockSize The number of requests handled in the block /// @param blockVersion The block version (i.e. which circuit version needs to be used) /// @return True if the circuit is registered, false otherwise function isCircuitRegistered( uint8 blockType, uint16 blockSize, uint8 blockVersion ) external virtual view returns (bool); /// @dev Checks if a circuit can still be used to commit new blocks. /// @param blockType The type of the block /// @param blockSize The number of requests handled in the block /// @param blockVersion The block version (i.e. which circuit version needs to be used) /// @return True if the circuit is enabled, false otherwise function isCircuitEnabled( uint8 blockType, uint16 blockSize, uint8 blockVersion ) external virtual view returns (bool); } // File: contracts/core/iface/IDepositContract.sol // Copyright 2017 Loopring Technology Limited. /// @title IDepositContract. /// @dev Contract storing and transferring funds for an exchange. /// /// ERC1155 tokens can be supported by registering pseudo token addresses calculated /// as `address(keccak256(real_token_address, token_params))`. Then the custom /// deposit contract can look up the real token address and paramsters with the /// pseudo token address before doing the transfers. /// @author Brecht Devos - <[email protected]> interface IDepositContract { /// @dev Returns if a token is suppoprted by this contract. function isTokenSupported(address token) external view returns (bool); /// @dev Transfers tokens from a user to the exchange. This function will /// be called when a user deposits funds to the exchange. /// In a simple implementation the funds are simply stored inside the /// deposit contract directly. More advanced implementations may store the funds /// in some DeFi application to earn interest, so this function could directly /// call the necessary functions to store the funds there. /// /// This function needs to throw when an error occurred! /// /// This function can only be called by the exchange. /// /// @param from The address of the account that sends the tokens. /// @param token The address of the token to transfer (`0x0` for ETH). /// @param amount The amount of tokens to transfer. /// @param extraData Opaque data that can be used by the contract to handle the deposit /// @return amountReceived The amount to deposit to the user's account in the Merkle tree function deposit( address from, address token, uint96 amount, bytes calldata extraData ) external payable returns (uint96 amountReceived); /// @dev Transfers tokens from the exchange to a user. This function will /// be called when a withdrawal is done for a user on the exchange. /// In the simplest implementation the funds are simply stored inside the /// deposit contract directly so this simply transfers the requested tokens back /// to the user. More advanced implementations may store the funds /// in some DeFi application to earn interest so the function would /// need to get those tokens back from the DeFi application first before they /// can be transferred to the user. /// /// This function needs to throw when an error occurred! /// /// This function can only be called by the exchange. /// /// @param from The address from which 'amount' tokens are transferred. /// @param to The address to which 'amount' tokens are transferred. /// @param token The address of the token to transfer (`0x0` for ETH). /// @param amount The amount of tokens transferred. /// @param extraData Opaque data that can be used by the contract to handle the withdrawal function withdraw( address from, address to, address token, uint amount, bytes calldata extraData ) external payable; /// @dev Transfers tokens (ETH not supported) for a user using the allowance set /// for the exchange. This way the approval can be used for all functionality (and /// extended functionality) of the exchange. /// Should NOT be used to deposit/withdraw user funds, `deposit`/`withdraw` /// should be used for that as they will contain specialised logic for those operations. /// This function can be called by the exchange to transfer onchain funds of users /// necessary for Agent functionality. /// /// This function needs to throw when an error occurred! /// /// This function can only be called by the exchange. /// /// @param from The address of the account that sends the tokens. /// @param to The address to which 'amount' tokens are transferred. /// @param token The address of the token to transfer (ETH is and cannot be suppported). /// @param amount The amount of tokens transferred. function transfer( address from, address to, address token, uint amount ) external payable; /// @dev Checks if the given address is used for depositing ETH or not. /// Is used while depositing to send the correct ETH amount to the deposit contract. /// /// Note that 0x0 is always registered for deposting ETH when the exchange is created! /// This function allows additional addresses to be used for depositing ETH, the deposit /// contract can implement different behaviour based on the address value. /// /// @param addr The address to check /// @return True if the address is used for depositing ETH, else false. function isETH(address addr) external view returns (bool); } // File: contracts/core/iface/ILoopringV3.sol // Copyright 2017 Loopring Technology Limited. /// @title ILoopringV3 /// @author Brecht Devos - <[email protected]> /// @author Daniel Wang - <[email protected]> abstract contract ILoopringV3 is Claimable { // == Events == event ExchangeStakeDeposited(address exchangeAddr, uint amount); event ExchangeStakeWithdrawn(address exchangeAddr, uint amount); event ExchangeStakeBurned(address exchangeAddr, uint amount); event SettingsUpdated(uint time); // == Public Variables == mapping (address => uint) internal exchangeStake; uint public totalStake; address public blockVerifierAddress; uint public forcedWithdrawalFee; uint public tokenRegistrationFeeLRCBase; uint public tokenRegistrationFeeLRCDelta; uint8 public protocolTakerFeeBips; uint8 public protocolMakerFeeBips; address payable public protocolFeeVault; // == Public Functions == /// @dev Returns the LRC token address /// @return the LRC token address function lrcAddress() external view virtual returns (address); /// @dev Updates the global exchange settings. /// This function can only be called by the owner of this contract. /// /// Warning: these new values will be used by existing and /// new Loopring exchanges. function updateSettings( address payable _protocolFeeVault, // address(0) not allowed address _blockVerifierAddress, // address(0) not allowed uint _forcedWithdrawalFee ) external virtual; /// @dev Updates the global protocol fee settings. /// This function can only be called by the owner of this contract. /// /// Warning: these new values will be used by existing and /// new Loopring exchanges. function updateProtocolFeeSettings( uint8 _protocolTakerFeeBips, uint8 _protocolMakerFeeBips ) external virtual; /// @dev Gets the amount of staked LRC for an exchange. /// @param exchangeAddr The address of the exchange /// @return stakedLRC The amount of LRC function getExchangeStake( address exchangeAddr ) public virtual view returns (uint stakedLRC); /// @dev Burns a certain amount of staked LRC for a specific exchange. /// This function is meant to be called only from exchange contracts. /// @return burnedLRC The amount of LRC burned. If the amount is greater than /// the staked amount, all staked LRC will be burned. function burnExchangeStake( uint amount ) external virtual returns (uint burnedLRC); /// @dev Stakes more LRC for an exchange. /// @param exchangeAddr The address of the exchange /// @param amountLRC The amount of LRC to stake /// @return stakedLRC The total amount of LRC staked for the exchange function depositExchangeStake( address exchangeAddr, uint amountLRC ) external virtual returns (uint stakedLRC); /// @dev Withdraws a certain amount of staked LRC for an exchange to the given address. /// This function is meant to be called only from within exchange contracts. /// @param recipient The address to receive LRC /// @param requestedAmount The amount of LRC to withdraw /// @return amountLRC The amount of LRC withdrawn function withdrawExchangeStake( address recipient, uint requestedAmount ) external virtual returns (uint amountLRC); /// @dev Gets the protocol fee values for an exchange. /// @return takerFeeBips The protocol taker fee /// @return makerFeeBips The protocol maker fee function getProtocolFeeValues( ) public virtual view returns ( uint8 takerFeeBips, uint8 makerFeeBips ); } // File: contracts/core/iface/ExchangeData.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeData /// @dev All methods in this lib are internal, therefore, there is no need /// to deploy this library independently. /// @author Daniel Wang - <[email protected]> /// @author Brecht Devos - <[email protected]> library ExchangeData { // -- Enums -- enum TransactionType { NOOP, DEPOSIT, WITHDRAWAL, TRANSFER, SPOT_TRADE, ACCOUNT_UPDATE, AMM_UPDATE, SIGNATURE_VERIFICATION, NFT_MINT, // L2 NFT mint or L1-to-L2 NFT deposit NFT_DATA } enum NftType { ERC1155, ERC721 } // -- Structs -- struct Token { address token; } struct ProtocolFeeData { uint32 syncedAt; // only valid before 2105 (85 years to go) uint8 takerFeeBips; uint8 makerFeeBips; uint8 previousTakerFeeBips; uint8 previousMakerFeeBips; } // General auxiliary data for each conditional transaction struct AuxiliaryData { uint txIndex; bool approved; bytes data; } // This is the (virtual) block the owner needs to submit onchain to maintain the // per-exchange (virtual) blockchain. struct Block { uint8 blockType; uint16 blockSize; uint8 blockVersion; bytes data; uint256[8] proof; // Whether we should store the @BlockInfo for this block on-chain. bool storeBlockInfoOnchain; // Block specific data that is only used to help process the block on-chain. // It is not used as input for the circuits and it is not necessary for data-availability. // This bytes array contains the abi encoded AuxiliaryData[] data. bytes auxiliaryData; // Arbitrary data, mainly for off-chain data-availability, i.e., // the multihash of the IPFS file that contains the block data. bytes offchainData; } struct BlockInfo { // The time the block was submitted on-chain. uint32 timestamp; // The public data hash of the block (the 28 most significant bytes). bytes28 blockDataHash; } // Represents an onchain deposit request. struct Deposit { uint96 amount; uint64 timestamp; } // A forced withdrawal request. // If the actual owner of the account initiated the request (we don't know who the owner is // at the time the request is being made) the full balance will be withdrawn. struct ForcedWithdrawal { address owner; uint64 timestamp; } struct Constants { uint SNARK_SCALAR_FIELD; uint MAX_OPEN_FORCED_REQUESTS; uint MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE; uint TIMESTAMP_HALF_WINDOW_SIZE_IN_SECONDS; uint MAX_NUM_ACCOUNTS; uint MAX_NUM_TOKENS; uint MIN_AGE_PROTOCOL_FEES_UNTIL_UPDATED; uint MIN_TIME_IN_SHUTDOWN; uint TX_DATA_AVAILABILITY_SIZE; uint MAX_AGE_DEPOSIT_UNTIL_WITHDRAWABLE_UPPERBOUND; } // This is the prime number that is used for the alt_bn128 elliptic curve, see EIP-196. uint public constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; uint public constant MAX_OPEN_FORCED_REQUESTS = 4096; uint public constant MAX_AGE_FORCED_REQUEST_UNTIL_WITHDRAW_MODE = 15 days; uint public constant TIMESTAMP_HALF_WINDOW_SIZE_IN_SECONDS = 7 days; uint public constant MAX_NUM_ACCOUNTS = 2 ** 32; uint public constant MAX_NUM_TOKENS = 2 ** 16; uint public constant MIN_AGE_PROTOCOL_FEES_UNTIL_UPDATED = 7 days; uint public constant MIN_TIME_IN_SHUTDOWN = 30 days; // The amount of bytes each rollup transaction uses in the block data for data-availability. // This is the maximum amount of bytes of all different transaction types. uint32 public constant MAX_AGE_DEPOSIT_UNTIL_WITHDRAWABLE_UPPERBOUND = 15 days; uint32 public constant ACCOUNTID_PROTOCOLFEE = 0; uint public constant TX_DATA_AVAILABILITY_SIZE = 68; uint public constant TX_DATA_AVAILABILITY_SIZE_PART_1 = 29; uint public constant TX_DATA_AVAILABILITY_SIZE_PART_2 = 39; uint public constant NFT_TOKEN_ID_START = 2 ** 15; struct AccountLeaf { uint32 accountID; address owner; uint pubKeyX; uint pubKeyY; uint32 nonce; uint feeBipsAMM; } struct BalanceLeaf { uint16 tokenID; uint96 balance; uint weightAMM; uint storageRoot; } struct Nft { address minter; // Minter address for a L2 mint or // the NFT's contract address in the case of a L1-to-L2 NFT deposit. NftType nftType; address token; uint256 nftID; uint8 creatorFeeBips; } struct MerkleProof { ExchangeData.AccountLeaf accountLeaf; ExchangeData.BalanceLeaf balanceLeaf; ExchangeData.Nft nft; uint[48] accountMerkleProof; uint[24] balanceMerkleProof; } struct BlockContext { bytes32 DOMAIN_SEPARATOR; uint32 timestamp; Block block; uint txIndex; } // Represents the entire exchange state except the owner of the exchange. struct State { uint32 maxAgeDepositUntilWithdrawable; bytes32 DOMAIN_SEPARATOR; ILoopringV3 loopring; IBlockVerifier blockVerifier; IAgentRegistry agentRegistry; IDepositContract depositContract; // The merkle root of the offchain data stored in a Merkle tree. The Merkle tree // stores balances for users using an account model. bytes32 merkleRoot; // List of all blocks mapping(uint => BlockInfo) blocks; uint numBlocks; // List of all tokens Token[] tokens; // A map from a token to its tokenID + 1 mapping (address => uint16) tokenToTokenId; // A map from an accountID to a tokenID to if the balance is withdrawn mapping (uint32 => mapping (uint16 => bool)) withdrawnInWithdrawMode; // A map from an account to a token to the amount withdrawable for that account. // This is only used when the automatic distribution of the withdrawal failed. mapping (address => mapping (uint16 => uint)) amountWithdrawable; // A map from an account to a token to the forced withdrawal (always full balance) // The `uint16' represents ERC20 token ID (if < NFT_TOKEN_ID_START) or // NFT balance slot (if >= NFT_TOKEN_ID_START) mapping (uint32 => mapping (uint16 => ForcedWithdrawal)) pendingForcedWithdrawals; // A map from an address to a token to a deposit mapping (address => mapping (uint16 => Deposit)) pendingDeposits; // A map from an account owner to an approved transaction hash to if the transaction is approved or not mapping (address => mapping (bytes32 => bool)) approvedTx; // A map from an account owner to a destination address to a tokenID to an amount to a storageID to a new recipient address mapping (address => mapping (address => mapping (uint16 => mapping (uint => mapping (uint32 => address))))) withdrawalRecipient; // Counter to keep track of how many of forced requests are open so we can limit the work that needs to be done by the owner uint32 numPendingForcedTransactions; // Cached data for the protocol fee ProtocolFeeData protocolFeeData; // Time when the exchange was shutdown uint shutdownModeStartTime; // Time when the exchange has entered withdrawal mode uint withdrawalModeStartTime; // Last time the protocol fee was withdrawn for a specific token mapping (address => uint) protocolFeeLastWithdrawnTime; // Duplicated loopring address address loopringAddr; // AMM fee bips uint8 ammFeeBips; // Enable/Disable `onchainTransferFrom` bool allowOnchainTransferFrom; // owner => NFT type => token address => nftID => Deposit mapping (address => mapping (NftType => mapping (address => mapping(uint256 => Deposit)))) pendingNFTDeposits; // owner => minter => NFT type => token address => nftID => amount withdrawable // This is only used when the automatic distribution of the withdrawal failed. mapping (address => mapping (address => mapping (NftType => mapping (address => mapping(uint256 => uint))))) amountWithdrawableNFT; } } // File: contracts/core/impl/libtransactions/BlockReader.sol // Copyright 2017 Loopring Technology Limited. /// @title BlockReader /// @author Brecht Devos - <[email protected]> /// @dev Utility library to read block data. library BlockReader { using BlockReader for ExchangeData.Block; using BytesUtil for bytes; uint public constant OFFSET_TO_TRANSACTIONS = 20 + 32 + 32 + 4 + 1 + 1 + 4 + 4; struct BlockHeader { address exchange; bytes32 merkleRootBefore; bytes32 merkleRootAfter; uint32 timestamp; uint8 protocolTakerFeeBips; uint8 protocolMakerFeeBips; uint32 numConditionalTransactions; uint32 operatorAccountID; } function readHeader( bytes memory _blockData ) internal pure returns (BlockHeader memory header) { uint offset = 0; header.exchange = _blockData.toAddress(offset); offset += 20; header.merkleRootBefore = _blockData.toBytes32(offset); offset += 32; header.merkleRootAfter = _blockData.toBytes32(offset); offset += 32; header.timestamp = _blockData.toUint32(offset); offset += 4; header.protocolTakerFeeBips = _blockData.toUint8(offset); offset += 1; header.protocolMakerFeeBips = _blockData.toUint8(offset); offset += 1; header.numConditionalTransactions = _blockData.toUint32(offset); offset += 4; header.operatorAccountID = _blockData.toUint32(offset); offset += 4; assert(offset == OFFSET_TO_TRANSACTIONS); } function readTransactionData( bytes memory data, uint txIdx, uint blockSize, bytes memory txData ) internal pure { require(txIdx < blockSize, "INVALID_TX_IDX"); // The transaction was transformed to make it easier to compress. // Transform it back here. // Part 1 uint txDataOffset = OFFSET_TO_TRANSACTIONS + txIdx * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_1; assembly { mstore(add(txData, 32), mload(add(data, add(txDataOffset, 32)))) } // Part 2 txDataOffset = OFFSET_TO_TRANSACTIONS + blockSize * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_1 + txIdx * ExchangeData.TX_DATA_AVAILABILITY_SIZE_PART_2; assembly { mstore(add(txData, 61 /*32 + 29*/), mload(add(data, add(txDataOffset, 32)))) mstore(add(txData, 68 ), mload(add(data, add(txDataOffset, 39)))) } } } // File: contracts/lib/EIP712.sol // Copyright 2017 Loopring Technology Limited. library EIP712 { struct Domain { string name; string version; address verifyingContract; } bytes32 constant internal EIP712_DOMAIN_TYPEHASH = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); string constant internal EIP191_HEADER = "\x19\x01"; function hash(Domain memory domain) internal pure returns (bytes32) { uint _chainid; assembly { _chainid := chainid() } return keccak256( abi.encode( EIP712_DOMAIN_TYPEHASH, keccak256(bytes(domain.name)), keccak256(bytes(domain.version)), _chainid, domain.verifyingContract ) ); } function hashPacked( bytes32 domainSeparator, bytes32 dataHash ) internal pure returns (bytes32) { return keccak256( abi.encodePacked( EIP191_HEADER, domainSeparator, dataHash ) ); } } // File: contracts/thirdparty/SafeCast.sol // Taken from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/SafeCast.sol /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value < 2**96, "SafeCast: value doesn\'t fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 40 bits */ function toUint40(uint256 value) internal pure returns (uint40) { require(value < 2**40, "SafeCast: value doesn\'t fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } } // File: contracts/lib/FloatUtil.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for floats /// @author Brecht Devos - <[email protected]> library FloatUtil { using MathUint for uint; using SafeCast for uint; // Decodes a decimal float value that is encoded like `exponent | mantissa`. // Both exponent and mantissa are in base 10. // Decoding to an integer is as simple as `mantissa * (10 ** exponent)` // Will throw when the decoded value overflows an uint96 /// @param f The float value with 5 bits for the exponent /// @param numBits The total number of bits (numBitsMantissa := numBits - numBitsExponent) /// @return value The decoded integer value. function decodeFloat( uint f, uint numBits ) internal pure returns (uint96 value) { if (f == 0) { return 0; } uint numBitsMantissa = numBits.sub(5); uint exponent = f >> numBitsMantissa; // log2(10**77) = 255.79 < 256 require(exponent <= 77, "EXPONENT_TOO_LARGE"); uint mantissa = f & ((1 << numBitsMantissa) - 1); value = mantissa.mul(10 ** exponent).toUint96(); } // Decodes a decimal float value that is encoded like `exponent | mantissa`. // Both exponent and mantissa are in base 10. // Decoding to an integer is as simple as `mantissa * (10 ** exponent)` // Will throw when the decoded value overflows an uint96 /// @param f The float value with 5 bits exponent, 11 bits mantissa /// @return value The decoded integer value. function decodeFloat16( uint16 f ) internal pure returns (uint96) { uint value = ((uint(f) & 2047) * (10 ** (uint(f) >> 11))); require(value < 2**96, "SafeCast: value doesn\'t fit in 96 bits"); return uint96(value); } // Decodes a decimal float value that is encoded like `exponent | mantissa`. // Both exponent and mantissa are in base 10. // Decoding to an integer is as simple as `mantissa * (10 ** exponent)` // Will throw when the decoded value overflows an uint96 /// @param f The float value with 5 bits exponent, 19 bits mantissa /// @return value The decoded integer value. function decodeFloat24( uint24 f ) internal pure returns (uint96) { uint value = ((uint(f) & 524287) * (10 ** (uint(f) >> 19))); require(value < 2**96, "SafeCast: value doesn\'t fit in 96 bits"); return uint96(value); } } // File: contracts/lib/ERC1271.sol // Copyright 2017 Loopring Technology Limited. abstract contract ERC1271 { // bytes4(keccak256("isValidSignature(bytes32,bytes)") bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e; function isValidSignature( bytes32 _hash, bytes memory _signature) public view virtual returns (bytes4 magicValueB32); } // File: contracts/lib/SignatureUtil.sol // Copyright 2017 Loopring Technology Limited. /// @title SignatureUtil /// @author Daniel Wang - <[email protected]> /// @dev This method supports multihash standard. Each signature's last byte indicates /// the signature's type. library SignatureUtil { using BytesUtil for bytes; using MathUint for uint; using AddressUtil for address; enum SignatureType { ILLEGAL, INVALID, EIP_712, ETH_SIGN, WALLET // deprecated } bytes4 constant internal ERC1271_MAGICVALUE = 0x1626ba7e; function verifySignatures( bytes32 signHash, address[] memory signers, bytes[] memory signatures ) internal view returns (bool) { require(signers.length == signatures.length, "BAD_SIGNATURE_DATA"); address lastSigner; for (uint i = 0; i < signers.length; i++) { require(signers[i] > lastSigner, "INVALID_SIGNERS_ORDER"); lastSigner = signers[i]; if (!verifySignature(signHash, signers[i], signatures[i])) { return false; } } return true; } function verifySignature( bytes32 signHash, address signer, bytes memory signature ) internal view returns (bool) { if (signer == address(0)) { return false; } return signer.isContract()? verifyERC1271Signature(signHash, signer, signature): verifyEOASignature(signHash, signer, signature); } function recoverECDSASigner( bytes32 signHash, bytes memory signature ) internal pure returns (address) { if (signature.length != 65) { return address(0); } bytes32 r; bytes32 s; uint8 v; // we jump 32 (0x20) as the first slot of bytes contains the length // we jump 65 (0x41) per signature // for v we load 32 bytes ending with v (the first 31 come from s) then apply a mask assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := and(mload(add(signature, 0x41)), 0xff) } // See https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return address(0); } if (v == 27 || v == 28) { return ecrecover(signHash, v, r, s); } else { return address(0); } } function verifyEOASignature( bytes32 signHash, address signer, bytes memory signature ) private pure returns (bool success) { if (signer == address(0)) { return false; } uint signatureTypeOffset = signature.length.sub(1); SignatureType signatureType = SignatureType(signature.toUint8(signatureTypeOffset)); // Strip off the last byte of the signature by updating the length assembly { mstore(signature, signatureTypeOffset) } if (signatureType == SignatureType.EIP_712) { success = (signer == recoverECDSASigner(signHash, signature)); } else if (signatureType == SignatureType.ETH_SIGN) { bytes32 hash = keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", signHash) ); success = (signer == recoverECDSASigner(hash, signature)); } else { success = false; } // Restore the signature length assembly { mstore(signature, add(signatureTypeOffset, 1)) } return success; } function verifyERC1271Signature( bytes32 signHash, address signer, bytes memory signature ) private view returns (bool) { bytes memory callData = abi.encodeWithSelector( ERC1271.isValidSignature.selector, signHash, signature ); (bool success, bytes memory result) = signer.staticcall(callData); return ( success && result.length == 32 && result.toBytes4(0) == ERC1271_MAGICVALUE ); } } // File: contracts/core/impl/libexchange/ExchangeSignatures.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeSignatures. /// @dev All methods in this lib are internal, therefore, there is no need /// to deploy this library independently. /// @author Brecht Devos - <[email protected]> /// @author Daniel Wang - <[email protected]> library ExchangeSignatures { using SignatureUtil for bytes32; function requireAuthorizedTx( ExchangeData.State storage S, address signer, bytes memory signature, bytes32 txHash ) internal // inline call { require(signer != address(0), "INVALID_SIGNER"); // Verify the signature if one is provided, otherwise fall back to an approved tx if (signature.length > 0) { require(txHash.verifySignature(signer, signature), "INVALID_SIGNATURE"); } else { require(S.approvedTx[signer][txHash], "TX_NOT_APPROVED"); delete S.approvedTx[signer][txHash]; } } } // File: contracts/core/impl/libtransactions/AccountUpdateTransaction.sol // Copyright 2017 Loopring Technology Limited. /// @title AccountUpdateTransaction /// @author Brecht Devos - <[email protected]> library AccountUpdateTransaction { using BytesUtil for bytes; using FloatUtil for uint16; using ExchangeSignatures for ExchangeData.State; bytes32 constant public ACCOUNTUPDATE_TYPEHASH = keccak256( "AccountUpdate(address owner,uint32 accountID,uint16 feeTokenID,uint96 maxFee,uint256 publicKey,uint32 validUntil,uint32 nonce)" ); struct AccountUpdate { address owner; uint32 accountID; uint16 feeTokenID; uint96 maxFee; uint96 fee; uint publicKey; uint32 validUntil; uint32 nonce; } // Auxiliary data for each account update struct AccountUpdateAuxiliaryData { bytes signature; uint96 maxFee; uint32 validUntil; } function process( ExchangeData.State storage S, ExchangeData.BlockContext memory ctx, bytes memory data, uint offset, bytes memory auxiliaryData ) internal { // Read the account update AccountUpdate memory accountUpdate; readTx(data, offset, accountUpdate); AccountUpdateAuxiliaryData memory auxData = abi.decode(auxiliaryData, (AccountUpdateAuxiliaryData)); // Fill in withdrawal data missing from DA accountUpdate.validUntil = auxData.validUntil; accountUpdate.maxFee = auxData.maxFee == 0 ? accountUpdate.fee : auxData.maxFee; // Validate require(ctx.timestamp < accountUpdate.validUntil, "ACCOUNT_UPDATE_EXPIRED"); require(accountUpdate.fee <= accountUpdate.maxFee, "ACCOUNT_UPDATE_FEE_TOO_HIGH"); // Calculate the tx hash bytes32 txHash = hashTx(ctx.DOMAIN_SEPARATOR, accountUpdate); // Check onchain authorization S.requireAuthorizedTx(accountUpdate.owner, auxData.signature, txHash); } function readTx( bytes memory data, uint offset, AccountUpdate memory accountUpdate ) internal pure { uint _offset = offset; require(data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.ACCOUNT_UPDATE), "INVALID_TX_TYPE"); _offset += 1; // Check that this is a conditional offset require(data.toUint8Unsafe(_offset) == 1, "INVALID_AUXILIARYDATA_DATA"); _offset += 1; // Extract the data from the tx data // We don't use abi.decode for this because of the large amount of zero-padding // bytes the circuit would also have to hash. accountUpdate.owner = data.toAddressUnsafe(_offset); _offset += 20; accountUpdate.accountID = data.toUint32Unsafe(_offset); _offset += 4; accountUpdate.feeTokenID = data.toUint16Unsafe(_offset); _offset += 2; accountUpdate.fee = data.toUint16Unsafe(_offset).decodeFloat16(); _offset += 2; accountUpdate.publicKey = data.toUintUnsafe(_offset); _offset += 32; accountUpdate.nonce = data.toUint32Unsafe(_offset); _offset += 4; } function hashTx( bytes32 DOMAIN_SEPARATOR, AccountUpdate memory accountUpdate ) internal pure returns (bytes32) { return EIP712.hashPacked( DOMAIN_SEPARATOR, keccak256( abi.encode( ACCOUNTUPDATE_TYPEHASH, accountUpdate.owner, accountUpdate.accountID, accountUpdate.feeTokenID, accountUpdate.maxFee, accountUpdate.publicKey, accountUpdate.validUntil, accountUpdate.nonce ) ) ); } } // File: contracts/core/impl/libtransactions/AmmUpdateTransaction.sol // Copyright 2017 Loopring Technology Limited. /// @title AmmUpdateTransaction /// @author Brecht Devos - <[email protected]> library AmmUpdateTransaction { using BytesUtil for bytes; using MathUint for uint; using ExchangeSignatures for ExchangeData.State; bytes32 constant public AMMUPDATE_TYPEHASH = keccak256( "AmmUpdate(address owner,uint32 accountID,uint16 tokenID,uint8 feeBips,uint96 tokenWeight,uint32 validUntil,uint32 nonce)" ); struct AmmUpdate { address owner; uint32 accountID; uint16 tokenID; uint8 feeBips; uint96 tokenWeight; uint32 validUntil; uint32 nonce; uint96 balance; } // Auxiliary data for each AMM update struct AmmUpdateAuxiliaryData { bytes signature; uint32 validUntil; } function process( ExchangeData.State storage S, ExchangeData.BlockContext memory ctx, bytes memory data, uint offset, bytes memory auxiliaryData ) internal { // Read in the AMM update AmmUpdate memory update; readTx(data, offset, update); AmmUpdateAuxiliaryData memory auxData = abi.decode(auxiliaryData, (AmmUpdateAuxiliaryData)); // Check validUntil require(ctx.timestamp < auxData.validUntil, "AMM_UPDATE_EXPIRED"); update.validUntil = auxData.validUntil; // Calculate the tx hash bytes32 txHash = hashTx(ctx.DOMAIN_SEPARATOR, update); // Check the on-chain authorization S.requireAuthorizedTx(update.owner, auxData.signature, txHash); } function readTx( bytes memory data, uint offset, AmmUpdate memory update ) internal pure { uint _offset = offset; require(data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.AMM_UPDATE), "INVALID_TX_TYPE"); _offset += 1; // We don't use abi.decode for this because of the large amount of zero-padding // bytes the circuit would also have to hash. update.owner = data.toAddressUnsafe(_offset); _offset += 20; update.accountID = data.toUint32Unsafe(_offset); _offset += 4; update.tokenID = data.toUint16Unsafe(_offset); _offset += 2; update.feeBips = data.toUint8Unsafe(_offset); _offset += 1; update.tokenWeight = data.toUint96Unsafe(_offset); _offset += 12; update.nonce = data.toUint32Unsafe(_offset); _offset += 4; update.balance = data.toUint96Unsafe(_offset); _offset += 12; } function hashTx( bytes32 DOMAIN_SEPARATOR, AmmUpdate memory update ) internal pure returns (bytes32) { return EIP712.hashPacked( DOMAIN_SEPARATOR, keccak256( abi.encode( AMMUPDATE_TYPEHASH, update.owner, update.accountID, update.tokenID, update.feeBips, update.tokenWeight, update.validUntil, update.nonce ) ) ); } } // File: contracts/lib/MathUint96.sol // Copyright 2017 Loopring Technology Limited. /// @title Utility Functions for uint /// @author Daniel Wang - <[email protected]> library MathUint96 { function add( uint96 a, uint96 b ) internal pure returns (uint96 c) { c = a + b; require(c >= a, "ADD_OVERFLOW"); } function sub( uint96 a, uint96 b ) internal pure returns (uint96 c) { require(b <= a, "SUB_UNDERFLOW"); return a - b; } } // File: contracts/core/impl/libtransactions/DepositTransaction.sol // Copyright 2017 Loopring Technology Limited. /// @title DepositTransaction /// @author Brecht Devos - <[email protected]> library DepositTransaction { using BytesUtil for bytes; using MathUint96 for uint96; struct Deposit { address to; uint32 toAccountID; uint16 tokenID; uint96 amount; } function process( ExchangeData.State storage S, ExchangeData.BlockContext memory /*ctx*/, bytes memory data, uint offset, bytes memory /*auxiliaryData*/ ) internal { // Read in the deposit Deposit memory deposit; readTx(data, offset, deposit); if (deposit.amount == 0) { return; } // Process the deposit ExchangeData.Deposit memory pendingDeposit = S.pendingDeposits[deposit.to][deposit.tokenID]; // Make sure the deposit was actually done require(pendingDeposit.timestamp > 0, "DEPOSIT_NOT_EXIST"); // Processing partial amounts of the deposited amount is allowed. // This is done to ensure the user can do multiple deposits after each other // without invalidating work done by the exchange owner for previous deposit amounts. require(pendingDeposit.amount >= deposit.amount, "INVALID_AMOUNT"); pendingDeposit.amount = pendingDeposit.amount.sub(deposit.amount); // If the deposit was fully consumed, reset it so the storage is freed up // and the owner receives a gas refund. if (pendingDeposit.amount == 0) { delete S.pendingDeposits[deposit.to][deposit.tokenID]; } else { S.pendingDeposits[deposit.to][deposit.tokenID] = pendingDeposit; } } function readTx( bytes memory data, uint offset, Deposit memory deposit ) internal pure { uint _offset = offset; require(data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.DEPOSIT), "INVALID_TX_TYPE"); _offset += 1; // We don't use abi.decode for this because of the large amount of zero-padding // bytes the circuit would also have to hash. deposit.to = data.toAddressUnsafe(_offset); _offset += 20; deposit.toAccountID = data.toUint32Unsafe(_offset); _offset += 4; deposit.tokenID = data.toUint16Unsafe(_offset); _offset += 2; deposit.amount = data.toUint96Unsafe(_offset); _offset += 12; } } // File: contracts/core/impl/libtransactions/TransferTransaction.sol // Copyright 2017 Loopring Technology Limited. /// @title TransferTransaction /// @author Brecht Devos - <[email protected]> library TransferTransaction { using BytesUtil for bytes; using FloatUtil for uint24; using FloatUtil for uint16; using MathUint for uint; using ExchangeSignatures for ExchangeData.State; bytes32 constant public TRANSFER_TYPEHASH = keccak256( "Transfer(address from,address to,uint16 tokenID,uint96 amount,uint16 feeTokenID,uint96 maxFee,uint32 validUntil,uint32 storageID)" ); struct Transfer { uint32 fromAccountID; uint32 toAccountID; address from; address to; uint16 tokenID; uint96 amount; uint16 feeTokenID; uint96 maxFee; uint96 fee; uint32 validUntil; uint32 storageID; } // Auxiliary data for each transfer struct TransferAuxiliaryData { bytes signature; uint96 maxFee; uint32 validUntil; } function process( ExchangeData.State storage S, ExchangeData.BlockContext memory ctx, bytes memory data, uint offset, bytes memory auxiliaryData ) internal { // Read the transfer Transfer memory transfer; readTx(data, offset, transfer); TransferAuxiliaryData memory auxData = abi.decode(auxiliaryData, (TransferAuxiliaryData)); // Fill in withdrawal data missing from DA transfer.validUntil = auxData.validUntil; transfer.maxFee = auxData.maxFee == 0 ? transfer.fee : auxData.maxFee; // Validate require(ctx.timestamp < transfer.validUntil, "TRANSFER_EXPIRED"); require(transfer.fee <= transfer.maxFee, "TRANSFER_FEE_TOO_HIGH"); // Calculate the tx hash bytes32 txHash = hashTx(ctx.DOMAIN_SEPARATOR, transfer); // Check the on-chain authorization S.requireAuthorizedTx(transfer.from, auxData.signature, txHash); } function readTx( bytes memory data, uint offset, Transfer memory transfer ) internal pure { uint _offset = offset; require(data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.TRANSFER), "INVALID_TX_TYPE"); _offset += 1; // Check that this is a conditional transfer require(data.toUint8Unsafe(_offset) == 1, "INVALID_AUXILIARYDATA_DATA"); _offset += 1; // Extract the transfer data // We don't use abi.decode for this because of the large amount of zero-padding // bytes the circuit would also have to hash. transfer.fromAccountID = data.toUint32Unsafe(_offset); _offset += 4; transfer.toAccountID = data.toUint32Unsafe(_offset); _offset += 4; transfer.tokenID = data.toUint16Unsafe(_offset); _offset += 2; transfer.amount = data.toUint24Unsafe(_offset).decodeFloat24(); _offset += 3; transfer.feeTokenID = data.toUint16Unsafe(_offset); _offset += 2; transfer.fee = data.toUint16Unsafe(_offset).decodeFloat16(); _offset += 2; transfer.storageID = data.toUint32Unsafe(_offset); _offset += 4; transfer.to = data.toAddressUnsafe(_offset); _offset += 20; transfer.from = data.toAddressUnsafe(_offset); _offset += 20; } function hashTx( bytes32 DOMAIN_SEPARATOR, Transfer memory transfer ) internal pure returns (bytes32) { return EIP712.hashPacked( DOMAIN_SEPARATOR, keccak256( abi.encode( TRANSFER_TYPEHASH, transfer.from, transfer.to, transfer.tokenID, transfer.amount, transfer.feeTokenID, transfer.maxFee, transfer.validUntil, transfer.storageID ) ) ); } } // File: contracts/core/impl/libexchange/ExchangeMode.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeMode. /// @dev All methods in this lib are internal, therefore, there is no need /// to deploy this library independently. /// @author Brecht Devos - <[email protected]> /// @author Daniel Wang - <[email protected]> library ExchangeMode { using MathUint for uint; function isInWithdrawalMode( ExchangeData.State storage S ) internal // inline call view returns (bool result) { result = S.withdrawalModeStartTime > 0; } function isShutdown( ExchangeData.State storage S ) internal // inline call view returns (bool) { return S.shutdownModeStartTime > 0; } function getNumAvailableForcedSlots( ExchangeData.State storage S ) internal view returns (uint) { return ExchangeData.MAX_OPEN_FORCED_REQUESTS - S.numPendingForcedTransactions; } } // File: contracts/lib/ERC20SafeTransfer.sol // Copyright 2017 Loopring Technology Limited. /// @title ERC20 safe transfer /// @dev see https://github.com/sec-bit/badERC20Fix /// @author Brecht Devos - <[email protected]> library ERC20SafeTransfer { function safeTransferAndVerify( address token, address to, uint value ) internal { safeTransferWithGasLimitAndVerify( token, to, value, gasleft() ); } function safeTransfer( address token, address to, uint value ) internal returns (bool) { return safeTransferWithGasLimit( token, to, value, gasleft() ); } function safeTransferWithGasLimitAndVerify( address token, address to, uint value, uint gasLimit ) internal { require( safeTransferWithGasLimit(token, to, value, gasLimit), "TRANSFER_FAILURE" ); } function safeTransferWithGasLimit( address token, address to, uint value, uint gasLimit ) internal returns (bool) { // A transfer is successful when 'call' is successful and depending on the token: // - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false) // - A single boolean is returned: this boolean needs to be true (non-zero) // bytes4(keccak256("transfer(address,uint256)")) = 0xa9059cbb bytes memory callData = abi.encodeWithSelector( bytes4(0xa9059cbb), to, value ); (bool success, ) = token.call{gas: gasLimit}(callData); return checkReturnValue(success); } function safeTransferFromAndVerify( address token, address from, address to, uint value ) internal { safeTransferFromWithGasLimitAndVerify( token, from, to, value, gasleft() ); } function safeTransferFrom( address token, address from, address to, uint value ) internal returns (bool) { return safeTransferFromWithGasLimit( token, from, to, value, gasleft() ); } function safeTransferFromWithGasLimitAndVerify( address token, address from, address to, uint value, uint gasLimit ) internal { bool result = safeTransferFromWithGasLimit( token, from, to, value, gasLimit ); require(result, "TRANSFER_FAILURE"); } function safeTransferFromWithGasLimit( address token, address from, address to, uint value, uint gasLimit ) internal returns (bool) { // A transferFrom is successful when 'call' is successful and depending on the token: // - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false) // - A single boolean is returned: this boolean needs to be true (non-zero) // bytes4(keccak256("transferFrom(address,address,uint256)")) = 0x23b872dd bytes memory callData = abi.encodeWithSelector( bytes4(0x23b872dd), from, to, value ); (bool success, ) = token.call{gas: gasLimit}(callData); return checkReturnValue(success); } function checkReturnValue( bool success ) internal pure returns (bool) { // A transfer/transferFrom is successful when 'call' is successful and depending on the token: // - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false) // - A single boolean is returned: this boolean needs to be true (non-zero) if (success) { assembly { switch returndatasize() // Non-standard ERC20: nothing is returned so if 'call' was successful we assume the transfer succeeded case 0 { success := 1 } // Standard ERC20: a single boolean value is returned which needs to be true case 32 { returndatacopy(0, 0, 32) success := mload(0) } // None of the above: not successful default { success := 0 } } } return success; } } // File: contracts/core/impl/libexchange/ExchangeTokens.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeTokens. /// @author Daniel Wang - <[email protected]> /// @author Brecht Devos - <[email protected]> library ExchangeTokens { using MathUint for uint; using ERC20SafeTransfer for address; using ExchangeMode for ExchangeData.State; event TokenRegistered( address token, uint16 tokenId ); function getTokenAddress( ExchangeData.State storage S, uint16 tokenID ) public view returns (address) { require(tokenID < S.tokens.length, "INVALID_TOKEN_ID"); return S.tokens[tokenID].token; } function registerToken( ExchangeData.State storage S, address tokenAddress ) public returns (uint16 tokenID) { require(!S.isInWithdrawalMode(), "INVALID_MODE"); require(S.tokenToTokenId[tokenAddress] == 0, "TOKEN_ALREADY_EXIST"); require(S.tokens.length < ExchangeData.NFT_TOKEN_ID_START, "TOKEN_REGISTRY_FULL"); // Check if the deposit contract supports the new token if (S.depositContract != IDepositContract(0)) { require( S.depositContract.isTokenSupported(tokenAddress), "UNSUPPORTED_TOKEN" ); } // Assign a tokenID and store the token ExchangeData.Token memory token = ExchangeData.Token( tokenAddress ); tokenID = uint16(S.tokens.length); S.tokens.push(token); S.tokenToTokenId[tokenAddress] = tokenID + 1; emit TokenRegistered(tokenAddress, tokenID); } function getTokenID( ExchangeData.State storage S, address tokenAddress ) internal // inline call view returns (uint16 tokenID) { tokenID = S.tokenToTokenId[tokenAddress]; require(tokenID != 0, "TOKEN_NOT_FOUND"); tokenID = tokenID - 1; } function isNFT(uint16 tokenID) internal // inline call pure returns (bool) { return tokenID >= ExchangeData.NFT_TOKEN_ID_START; } } // File: contracts/lib/Poseidon.sol // Copyright 2017 Loopring Technology Limited. /// @title Poseidon hash function /// See: https://eprint.iacr.org/2019/458.pdf /// Code auto-generated by generate_poseidon_EVM_code.py /// @author Brecht Devos - <[email protected]> library Poseidon { // // hash_t4f6p52 // struct HashInputs4 { uint t0; uint t1; uint t2; uint t3; } function mix(HashInputs4 memory i, uint q) internal pure { HashInputs4 memory o; o.t0 = mulmod(i.t0, 11739432287187184656569880828944421268616385874806221589758215824904320817117, q); o.t0 = addmod(o.t0, mulmod(i.t1, 4977258759536702998522229302103997878600602264560359702680165243908162277980, q), q); o.t0 = addmod(o.t0, mulmod(i.t2, 19167410339349846567561662441069598364702008768579734801591448511131028229281, q), q); o.t0 = addmod(o.t0, mulmod(i.t3, 14183033936038168803360723133013092560869148726790180682363054735190196956789, q), q); o.t1 = mulmod(i.t0, 16872301185549870956030057498946148102848662396374401407323436343924021192350, q); o.t1 = addmod(o.t1, mulmod(i.t1, 107933704346764130067829474107909495889716688591997879426350582457782826785, q), q); o.t1 = addmod(o.t1, mulmod(i.t2, 17034139127218860091985397764514160131253018178110701196935786874261236172431, q), q); o.t1 = addmod(o.t1, mulmod(i.t3, 2799255644797227968811798608332314218966179365168250111693473252876996230317, q), q); o.t2 = mulmod(i.t0, 18618317300596756144100783409915332163189452886691331959651778092154775572832, q); o.t2 = addmod(o.t2, mulmod(i.t1, 13596762909635538739079656925495736900379091964739248298531655823337482778123, q), q); o.t2 = addmod(o.t2, mulmod(i.t2, 18985203040268814769637347880759846911264240088034262814847924884273017355969, q), q); o.t2 = addmod(o.t2, mulmod(i.t3, 8652975463545710606098548415650457376967119951977109072274595329619335974180, q), q); o.t3 = mulmod(i.t0, 11128168843135959720130031095451763561052380159981718940182755860433840154182, q); o.t3 = addmod(o.t3, mulmod(i.t1, 2953507793609469112222895633455544691298656192015062835263784675891831794974, q), q); o.t3 = addmod(o.t3, mulmod(i.t2, 19025623051770008118343718096455821045904242602531062247152770448380880817517, q), q); o.t3 = addmod(o.t3, mulmod(i.t3, 9077319817220936628089890431129759976815127354480867310384708941479362824016, q), q); i.t0 = o.t0; i.t1 = o.t1; i.t2 = o.t2; i.t3 = o.t3; } function ark(HashInputs4 memory i, uint q, uint c) internal pure { HashInputs4 memory o; o.t0 = addmod(i.t0, c, q); o.t1 = addmod(i.t1, c, q); o.t2 = addmod(i.t2, c, q); o.t3 = addmod(i.t3, c, q); i.t0 = o.t0; i.t1 = o.t1; i.t2 = o.t2; i.t3 = o.t3; } function sbox_full(HashInputs4 memory i, uint q) internal pure { HashInputs4 memory o; o.t0 = mulmod(i.t0, i.t0, q); o.t0 = mulmod(o.t0, o.t0, q); o.t0 = mulmod(i.t0, o.t0, q); o.t1 = mulmod(i.t1, i.t1, q); o.t1 = mulmod(o.t1, o.t1, q); o.t1 = mulmod(i.t1, o.t1, q); o.t2 = mulmod(i.t2, i.t2, q); o.t2 = mulmod(o.t2, o.t2, q); o.t2 = mulmod(i.t2, o.t2, q); o.t3 = mulmod(i.t3, i.t3, q); o.t3 = mulmod(o.t3, o.t3, q); o.t3 = mulmod(i.t3, o.t3, q); i.t0 = o.t0; i.t1 = o.t1; i.t2 = o.t2; i.t3 = o.t3; } function sbox_partial(HashInputs4 memory i, uint q) internal pure { HashInputs4 memory o; o.t0 = mulmod(i.t0, i.t0, q); o.t0 = mulmod(o.t0, o.t0, q); o.t0 = mulmod(i.t0, o.t0, q); i.t0 = o.t0; } function hash_t4f6p52(HashInputs4 memory i, uint q) internal pure returns (uint) { // validate inputs require(i.t0 < q, "INVALID_INPUT"); require(i.t1 < q, "INVALID_INPUT"); require(i.t2 < q, "INVALID_INPUT"); require(i.t3 < q, "INVALID_INPUT"); // round 0 ark(i, q, 14397397413755236225575615486459253198602422701513067526754101844196324375522); sbox_full(i, q); mix(i, q); // round 1 ark(i, q, 10405129301473404666785234951972711717481302463898292859783056520670200613128); sbox_full(i, q); mix(i, q); // round 2 ark(i, q, 5179144822360023508491245509308555580251733042407187134628755730783052214509); sbox_full(i, q); mix(i, q); // round 3 ark(i, q, 9132640374240188374542843306219594180154739721841249568925550236430986592615); sbox_partial(i, q); mix(i, q); // round 4 ark(i, q, 20360807315276763881209958738450444293273549928693737723235350358403012458514); sbox_partial(i, q); mix(i, q); // round 5 ark(i, q, 17933600965499023212689924809448543050840131883187652471064418452962948061619); sbox_partial(i, q); mix(i, q); // round 6 ark(i, q, 3636213416533737411392076250708419981662897009810345015164671602334517041153); sbox_partial(i, q); mix(i, q); // round 7 ark(i, q, 2008540005368330234524962342006691994500273283000229509835662097352946198608); sbox_partial(i, q); mix(i, q); // round 8 ark(i, q, 16018407964853379535338740313053768402596521780991140819786560130595652651567); sbox_partial(i, q); mix(i, q); // round 9 ark(i, q, 20653139667070586705378398435856186172195806027708437373983929336015162186471); sbox_partial(i, q); mix(i, q); // round 10 ark(i, q, 17887713874711369695406927657694993484804203950786446055999405564652412116765); sbox_partial(i, q); mix(i, q); // round 11 ark(i, q, 4852706232225925756777361208698488277369799648067343227630786518486608711772); sbox_partial(i, q); mix(i, q); // round 12 ark(i, q, 8969172011633935669771678412400911310465619639756845342775631896478908389850); sbox_partial(i, q); mix(i, q); // round 13 ark(i, q, 20570199545627577691240476121888846460936245025392381957866134167601058684375); sbox_partial(i, q); mix(i, q); // round 14 ark(i, q, 16442329894745639881165035015179028112772410105963688121820543219662832524136); sbox_partial(i, q); mix(i, q); // round 15 ark(i, q, 20060625627350485876280451423010593928172611031611836167979515653463693899374); sbox_partial(i, q); mix(i, q); // round 16 ark(i, q, 16637282689940520290130302519163090147511023430395200895953984829546679599107); sbox_partial(i, q); mix(i, q); // round 17 ark(i, q, 15599196921909732993082127725908821049411366914683565306060493533569088698214); sbox_partial(i, q); mix(i, q); // round 18 ark(i, q, 16894591341213863947423904025624185991098788054337051624251730868231322135455); sbox_partial(i, q); mix(i, q); // round 19 ark(i, q, 1197934381747032348421303489683932612752526046745577259575778515005162320212); sbox_partial(i, q); mix(i, q); // round 20 ark(i, q, 6172482022646932735745595886795230725225293469762393889050804649558459236626); sbox_partial(i, q); mix(i, q); // round 21 ark(i, q, 21004037394166516054140386756510609698837211370585899203851827276330669555417); sbox_partial(i, q); mix(i, q); // round 22 ark(i, q, 15262034989144652068456967541137853724140836132717012646544737680069032573006); sbox_partial(i, q); mix(i, q); // round 23 ark(i, q, 15017690682054366744270630371095785995296470601172793770224691982518041139766); sbox_partial(i, q); mix(i, q); // round 24 ark(i, q, 15159744167842240513848638419303545693472533086570469712794583342699782519832); sbox_partial(i, q); mix(i, q); // round 25 ark(i, q, 11178069035565459212220861899558526502477231302924961773582350246646450941231); sbox_partial(i, q); mix(i, q); // round 26 ark(i, q, 21154888769130549957415912997229564077486639529994598560737238811887296922114); sbox_partial(i, q); mix(i, q); // round 27 ark(i, q, 20162517328110570500010831422938033120419484532231241180224283481905744633719); sbox_partial(i, q); mix(i, q); // round 28 ark(i, q, 2777362604871784250419758188173029886707024739806641263170345377816177052018); sbox_partial(i, q); mix(i, q); // round 29 ark(i, q, 15732290486829619144634131656503993123618032247178179298922551820261215487562); sbox_partial(i, q); mix(i, q); // round 30 ark(i, q, 6024433414579583476444635447152826813568595303270846875177844482142230009826); sbox_partial(i, q); mix(i, q); // round 31 ark(i, q, 17677827682004946431939402157761289497221048154630238117709539216286149983245); sbox_partial(i, q); mix(i, q); // round 32 ark(i, q, 10716307389353583413755237303156291454109852751296156900963208377067748518748); sbox_partial(i, q); mix(i, q); // round 33 ark(i, q, 14925386988604173087143546225719076187055229908444910452781922028996524347508); sbox_partial(i, q); mix(i, q); // round 34 ark(i, q, 8940878636401797005293482068100797531020505636124892198091491586778667442523); sbox_partial(i, q); mix(i, q); // round 35 ark(i, q, 18911747154199663060505302806894425160044925686870165583944475880789706164410); sbox_partial(i, q); mix(i, q); // round 36 ark(i, q, 8821532432394939099312235292271438180996556457308429936910969094255825456935); sbox_partial(i, q); mix(i, q); // round 37 ark(i, q, 20632576502437623790366878538516326728436616723089049415538037018093616927643); sbox_partial(i, q); mix(i, q); // round 38 ark(i, q, 71447649211767888770311304010816315780740050029903404046389165015534756512); sbox_partial(i, q); mix(i, q); // round 39 ark(i, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393); sbox_partial(i, q); mix(i, q); // round 40 ark(i, q, 12441376330954323535872906380510501637773629931719508864016287320488688345525); sbox_partial(i, q); mix(i, q); // round 41 ark(i, q, 2558302139544901035700544058046419714227464650146159803703499681139469546006); sbox_partial(i, q); mix(i, q); // round 42 ark(i, q, 10087036781939179132584550273563255199577525914374285705149349445480649057058); sbox_partial(i, q); mix(i, q); // round 43 ark(i, q, 4267692623754666261749551533667592242661271409704769363166965280715887854739); sbox_partial(i, q); mix(i, q); // round 44 ark(i, q, 4945579503584457514844595640661884835097077318604083061152997449742124905548); sbox_partial(i, q); mix(i, q); // round 45 ark(i, q, 17742335354489274412669987990603079185096280484072783973732137326144230832311); sbox_partial(i, q); mix(i, q); // round 46 ark(i, q, 6266270088302506215402996795500854910256503071464802875821837403486057988208); sbox_partial(i, q); mix(i, q); // round 47 ark(i, q, 2716062168542520412498610856550519519760063668165561277991771577403400784706); sbox_partial(i, q); mix(i, q); // round 48 ark(i, q, 19118392018538203167410421493487769944462015419023083813301166096764262134232); sbox_partial(i, q); mix(i, q); // round 49 ark(i, q, 9386595745626044000666050847309903206827901310677406022353307960932745699524); sbox_partial(i, q); mix(i, q); // round 50 ark(i, q, 9121640807890366356465620448383131419933298563527245687958865317869840082266); sbox_partial(i, q); mix(i, q); // round 51 ark(i, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210); sbox_partial(i, q); mix(i, q); // round 52 ark(i, q, 7157404299437167354719786626667769956233708887934477609633504801472827442743); sbox_partial(i, q); mix(i, q); // round 53 ark(i, q, 14056248655941725362944552761799461694550787028230120190862133165195793034373); sbox_partial(i, q); mix(i, q); // round 54 ark(i, q, 14124396743304355958915937804966111851843703158171757752158388556919187839849); sbox_partial(i, q); mix(i, q); // round 55 ark(i, q, 11851254356749068692552943732920045260402277343008629727465773766468466181076); sbox_full(i, q); mix(i, q); // round 56 ark(i, q, 9799099446406796696742256539758943483211846559715874347178722060519817626047); sbox_full(i, q); mix(i, q); // round 57 ark(i, q, 10156146186214948683880719664738535455146137901666656566575307300522957959544); sbox_full(i, q); mix(i, q); return i.t0; } // // hash_t5f6p52 // struct HashInputs5 { uint t0; uint t1; uint t2; uint t3; uint t4; } function hash_t5f6p52_internal( uint t0, uint t1, uint t2, uint t3, uint t4, uint q ) internal pure returns (uint) { assembly { function mix(_t0, _t1, _t2, _t3, _t4, _q) -> nt0, nt1, nt2, nt3, nt4 { nt0 := mulmod(_t0, 4977258759536702998522229302103997878600602264560359702680165243908162277980, _q) nt0 := addmod(nt0, mulmod(_t1, 19167410339349846567561662441069598364702008768579734801591448511131028229281, _q), _q) nt0 := addmod(nt0, mulmod(_t2, 14183033936038168803360723133013092560869148726790180682363054735190196956789, _q), _q) nt0 := addmod(nt0, mulmod(_t3, 9067734253445064890734144122526450279189023719890032859456830213166173619761, _q), _q) nt0 := addmod(nt0, mulmod(_t4, 16378664841697311562845443097199265623838619398287411428110917414833007677155, _q), _q) nt1 := mulmod(_t0, 107933704346764130067829474107909495889716688591997879426350582457782826785, _q) nt1 := addmod(nt1, mulmod(_t1, 17034139127218860091985397764514160131253018178110701196935786874261236172431, _q), _q) nt1 := addmod(nt1, mulmod(_t2, 2799255644797227968811798608332314218966179365168250111693473252876996230317, _q), _q) nt1 := addmod(nt1, mulmod(_t3, 2482058150180648511543788012634934806465808146786082148795902594096349483974, _q), _q) nt1 := addmod(nt1, mulmod(_t4, 16563522740626180338295201738437974404892092704059676533096069531044355099628, _q), _q) nt2 := mulmod(_t0, 13596762909635538739079656925495736900379091964739248298531655823337482778123, _q) nt2 := addmod(nt2, mulmod(_t1, 18985203040268814769637347880759846911264240088034262814847924884273017355969, _q), _q) nt2 := addmod(nt2, mulmod(_t2, 8652975463545710606098548415650457376967119951977109072274595329619335974180, _q), _q) nt2 := addmod(nt2, mulmod(_t3, 970943815872417895015626519859542525373809485973005165410533315057253476903, _q), _q) nt2 := addmod(nt2, mulmod(_t4, 19406667490568134101658669326517700199745817783746545889094238643063688871948, _q), _q) nt3 := mulmod(_t0, 2953507793609469112222895633455544691298656192015062835263784675891831794974, _q) nt3 := addmod(nt3, mulmod(_t1, 19025623051770008118343718096455821045904242602531062247152770448380880817517, _q), _q) nt3 := addmod(nt3, mulmod(_t2, 9077319817220936628089890431129759976815127354480867310384708941479362824016, _q), _q) nt3 := addmod(nt3, mulmod(_t3, 4770370314098695913091200576539533727214143013236894216582648993741910829490, _q), _q) nt3 := addmod(nt3, mulmod(_t4, 4298564056297802123194408918029088169104276109138370115401819933600955259473, _q), _q) nt4 := mulmod(_t0, 8336710468787894148066071988103915091676109272951895469087957569358494947747, _q) nt4 := addmod(nt4, mulmod(_t1, 16205238342129310687768799056463408647672389183328001070715567975181364448609, _q), _q) nt4 := addmod(nt4, mulmod(_t2, 8303849270045876854140023508764676765932043944545416856530551331270859502246, _q), _q) nt4 := addmod(nt4, mulmod(_t3, 20218246699596954048529384569730026273241102596326201163062133863539137060414, _q), _q) nt4 := addmod(nt4, mulmod(_t4, 1712845821388089905746651754894206522004527237615042226559791118162382909269, _q), _q) } function ark(_t0, _t1, _t2, _t3, _t4, _q, c) -> nt0, nt1, nt2, nt3, nt4 { nt0 := addmod(_t0, c, _q) nt1 := addmod(_t1, c, _q) nt2 := addmod(_t2, c, _q) nt3 := addmod(_t3, c, _q) nt4 := addmod(_t4, c, _q) } function sbox_full(_t0, _t1, _t2, _t3, _t4, _q) -> nt0, nt1, nt2, nt3, nt4 { nt0 := mulmod(_t0, _t0, _q) nt0 := mulmod(nt0, nt0, _q) nt0 := mulmod(_t0, nt0, _q) nt1 := mulmod(_t1, _t1, _q) nt1 := mulmod(nt1, nt1, _q) nt1 := mulmod(_t1, nt1, _q) nt2 := mulmod(_t2, _t2, _q) nt2 := mulmod(nt2, nt2, _q) nt2 := mulmod(_t2, nt2, _q) nt3 := mulmod(_t3, _t3, _q) nt3 := mulmod(nt3, nt3, _q) nt3 := mulmod(_t3, nt3, _q) nt4 := mulmod(_t4, _t4, _q) nt4 := mulmod(nt4, nt4, _q) nt4 := mulmod(_t4, nt4, _q) } function sbox_partial(_t, _q) -> nt { nt := mulmod(_t, _t, _q) nt := mulmod(nt, nt, _q) nt := mulmod(_t, nt, _q) } // round 0 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 14397397413755236225575615486459253198602422701513067526754101844196324375522) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 1 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 10405129301473404666785234951972711717481302463898292859783056520670200613128) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 2 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 5179144822360023508491245509308555580251733042407187134628755730783052214509) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 3 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 9132640374240188374542843306219594180154739721841249568925550236430986592615) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 4 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20360807315276763881209958738450444293273549928693737723235350358403012458514) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 5 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 17933600965499023212689924809448543050840131883187652471064418452962948061619) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 6 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 3636213416533737411392076250708419981662897009810345015164671602334517041153) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 7 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 2008540005368330234524962342006691994500273283000229509835662097352946198608) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 8 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16018407964853379535338740313053768402596521780991140819786560130595652651567) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 9 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20653139667070586705378398435856186172195806027708437373983929336015162186471) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 10 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 17887713874711369695406927657694993484804203950786446055999405564652412116765) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 11 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 4852706232225925756777361208698488277369799648067343227630786518486608711772) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 12 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 8969172011633935669771678412400911310465619639756845342775631896478908389850) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 13 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20570199545627577691240476121888846460936245025392381957866134167601058684375) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 14 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16442329894745639881165035015179028112772410105963688121820543219662832524136) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 15 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20060625627350485876280451423010593928172611031611836167979515653463693899374) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 16 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16637282689940520290130302519163090147511023430395200895953984829546679599107) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 17 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 15599196921909732993082127725908821049411366914683565306060493533569088698214) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 18 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 16894591341213863947423904025624185991098788054337051624251730868231322135455) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 19 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 1197934381747032348421303489683932612752526046745577259575778515005162320212) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 20 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 6172482022646932735745595886795230725225293469762393889050804649558459236626) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 21 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 21004037394166516054140386756510609698837211370585899203851827276330669555417) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 22 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 15262034989144652068456967541137853724140836132717012646544737680069032573006) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 23 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 15017690682054366744270630371095785995296470601172793770224691982518041139766) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 24 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 15159744167842240513848638419303545693472533086570469712794583342699782519832) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 25 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 11178069035565459212220861899558526502477231302924961773582350246646450941231) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 26 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 21154888769130549957415912997229564077486639529994598560737238811887296922114) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 27 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20162517328110570500010831422938033120419484532231241180224283481905744633719) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 28 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 2777362604871784250419758188173029886707024739806641263170345377816177052018) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 29 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 15732290486829619144634131656503993123618032247178179298922551820261215487562) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 30 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 6024433414579583476444635447152826813568595303270846875177844482142230009826) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 31 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 17677827682004946431939402157761289497221048154630238117709539216286149983245) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 32 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 10716307389353583413755237303156291454109852751296156900963208377067748518748) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 33 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 14925386988604173087143546225719076187055229908444910452781922028996524347508) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 34 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 8940878636401797005293482068100797531020505636124892198091491586778667442523) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 35 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 18911747154199663060505302806894425160044925686870165583944475880789706164410) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 36 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 8821532432394939099312235292271438180996556457308429936910969094255825456935) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 37 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 20632576502437623790366878538516326728436616723089049415538037018093616927643) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 38 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 71447649211767888770311304010816315780740050029903404046389165015534756512) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 39 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 40 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 12441376330954323535872906380510501637773629931719508864016287320488688345525) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 41 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 2558302139544901035700544058046419714227464650146159803703499681139469546006) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 42 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 10087036781939179132584550273563255199577525914374285705149349445480649057058) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 43 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 4267692623754666261749551533667592242661271409704769363166965280715887854739) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 44 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 4945579503584457514844595640661884835097077318604083061152997449742124905548) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 45 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 17742335354489274412669987990603079185096280484072783973732137326144230832311) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 46 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 6266270088302506215402996795500854910256503071464802875821837403486057988208) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 47 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 2716062168542520412498610856550519519760063668165561277991771577403400784706) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 48 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 19118392018538203167410421493487769944462015419023083813301166096764262134232) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 49 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 9386595745626044000666050847309903206827901310677406022353307960932745699524) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 50 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 9121640807890366356465620448383131419933298563527245687958865317869840082266) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 51 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 52 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 7157404299437167354719786626667769956233708887934477609633504801472827442743) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 53 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 14056248655941725362944552761799461694550787028230120190862133165195793034373) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 54 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 14124396743304355958915937804966111851843703158171757752158388556919187839849) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 55 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 11851254356749068692552943732920045260402277343008629727465773766468466181076) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 56 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 9799099446406796696742256539758943483211846559715874347178722060519817626047) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) // round 57 t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 10156146186214948683880719664738535455146137901666656566575307300522957959544) t0, t1, t2, t3, t4 := sbox_full(t0, t1, t2, t3, t4, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q) } return t0; } function hash_t5f6p52(HashInputs5 memory i, uint q) internal pure returns (uint) { // validate inputs require(i.t0 < q, "INVALID_INPUT"); require(i.t1 < q, "INVALID_INPUT"); require(i.t2 < q, "INVALID_INPUT"); require(i.t3 < q, "INVALID_INPUT"); require(i.t4 < q, "INVALID_INPUT"); return hash_t5f6p52_internal(i.t0, i.t1, i.t2, i.t3, i.t4, q); } // // hash_t7f6p52 // struct HashInputs7 { uint t0; uint t1; uint t2; uint t3; uint t4; uint t5; uint t6; } function mix(HashInputs7 memory i, uint q) internal pure { HashInputs7 memory o; o.t0 = mulmod(i.t0, 14183033936038168803360723133013092560869148726790180682363054735190196956789, q); o.t0 = addmod(o.t0, mulmod(i.t1, 9067734253445064890734144122526450279189023719890032859456830213166173619761, q), q); o.t0 = addmod(o.t0, mulmod(i.t2, 16378664841697311562845443097199265623838619398287411428110917414833007677155, q), q); o.t0 = addmod(o.t0, mulmod(i.t3, 12968540216479938138647596899147650021419273189336843725176422194136033835172, q), q); o.t0 = addmod(o.t0, mulmod(i.t4, 3636162562566338420490575570584278737093584021456168183289112789616069756675, q), q); o.t0 = addmod(o.t0, mulmod(i.t5, 8949952361235797771659501126471156178804092479420606597426318793013844305422, q), q); o.t0 = addmod(o.t0, mulmod(i.t6, 13586657904816433080148729258697725609063090799921401830545410130405357110367, q), q); o.t1 = mulmod(i.t0, 2799255644797227968811798608332314218966179365168250111693473252876996230317, q); o.t1 = addmod(o.t1, mulmod(i.t1, 2482058150180648511543788012634934806465808146786082148795902594096349483974, q), q); o.t1 = addmod(o.t1, mulmod(i.t2, 16563522740626180338295201738437974404892092704059676533096069531044355099628, q), q); o.t1 = addmod(o.t1, mulmod(i.t3, 10468644849657689537028565510142839489302836569811003546969773105463051947124, q), q); o.t1 = addmod(o.t1, mulmod(i.t4, 3328913364598498171733622353010907641674136720305714432354138807013088636408, q), q); o.t1 = addmod(o.t1, mulmod(i.t5, 8642889650254799419576843603477253661899356105675006557919250564400804756641, q), q); o.t1 = addmod(o.t1, mulmod(i.t6, 14300697791556510113764686242794463641010174685800128469053974698256194076125, q), q); o.t2 = mulmod(i.t0, 8652975463545710606098548415650457376967119951977109072274595329619335974180, q); o.t2 = addmod(o.t2, mulmod(i.t1, 970943815872417895015626519859542525373809485973005165410533315057253476903, q), q); o.t2 = addmod(o.t2, mulmod(i.t2, 19406667490568134101658669326517700199745817783746545889094238643063688871948, q), q); o.t2 = addmod(o.t2, mulmod(i.t3, 17049854690034965250221386317058877242629221002521630573756355118745574274967, q), q); o.t2 = addmod(o.t2, mulmod(i.t4, 4964394613021008685803675656098849539153699842663541444414978877928878266244, q), q); o.t2 = addmod(o.t2, mulmod(i.t5, 15474947305445649466370538888925567099067120578851553103424183520405650587995, q), q); o.t2 = addmod(o.t2, mulmod(i.t6, 1016119095639665978105768933448186152078842964810837543326777554729232767846, q), q); o.t3 = mulmod(i.t0, 9077319817220936628089890431129759976815127354480867310384708941479362824016, q); o.t3 = addmod(o.t3, mulmod(i.t1, 4770370314098695913091200576539533727214143013236894216582648993741910829490, q), q); o.t3 = addmod(o.t3, mulmod(i.t2, 4298564056297802123194408918029088169104276109138370115401819933600955259473, q), q); o.t3 = addmod(o.t3, mulmod(i.t3, 6905514380186323693285869145872115273350947784558995755916362330070690839131, q), q); o.t3 = addmod(o.t3, mulmod(i.t4, 4783343257810358393326889022942241108539824540285247795235499223017138301952, q), q); o.t3 = addmod(o.t3, mulmod(i.t5, 1420772902128122367335354247676760257656541121773854204774788519230732373317, q), q); o.t3 = addmod(o.t3, mulmod(i.t6, 14172871439045259377975734198064051992755748777535789572469924335100006948373, q), q); o.t4 = mulmod(i.t0, 8303849270045876854140023508764676765932043944545416856530551331270859502246, q); o.t4 = addmod(o.t4, mulmod(i.t1, 20218246699596954048529384569730026273241102596326201163062133863539137060414, q), q); o.t4 = addmod(o.t4, mulmod(i.t2, 1712845821388089905746651754894206522004527237615042226559791118162382909269, q), q); o.t4 = addmod(o.t4, mulmod(i.t3, 13001155522144542028910638547179410124467185319212645031214919884423841839406, q), q); o.t4 = addmod(o.t4, mulmod(i.t4, 16037892369576300958623292723740289861626299352695838577330319504984091062115, q), q); o.t4 = addmod(o.t4, mulmod(i.t5, 19189494548480259335554606182055502469831573298885662881571444557262020106898, q), q); o.t4 = addmod(o.t4, mulmod(i.t6, 19032687447778391106390582750185144485341165205399984747451318330476859342654, q), q); o.t5 = mulmod(i.t0, 13272957914179340594010910867091459756043436017766464331915862093201960540910, q); o.t5 = addmod(o.t5, mulmod(i.t1, 9416416589114508529880440146952102328470363729880726115521103179442988482948, q), q); o.t5 = addmod(o.t5, mulmod(i.t2, 8035240799672199706102747147502951589635001418759394863664434079699838251138, q), q); o.t5 = addmod(o.t5, mulmod(i.t3, 21642389080762222565487157652540372010968704000567605990102641816691459811717, q), q); o.t5 = addmod(o.t5, mulmod(i.t4, 20261355950827657195644012399234591122288573679402601053407151083849785332516, q), q); o.t5 = addmod(o.t5, mulmod(i.t5, 14514189384576734449268559374569145463190040567900950075547616936149781403109, q), q); o.t5 = addmod(o.t5, mulmod(i.t6, 19038036134886073991945204537416211699632292792787812530208911676638479944765, q), q); o.t6 = mulmod(i.t0, 15627836782263662543041758927100784213807648787083018234961118439434298020664, q); o.t6 = addmod(o.t6, mulmod(i.t1, 5655785191024506056588710805596292231240948371113351452712848652644610823632, q), q); o.t6 = addmod(o.t6, mulmod(i.t2, 8265264721707292643644260517162050867559314081394556886644673791575065394002, q), q); o.t6 = addmod(o.t6, mulmod(i.t3, 17151144681903609082202835646026478898625761142991787335302962548605510241586, q), q); o.t6 = addmod(o.t6, mulmod(i.t4, 18731644709777529787185361516475509623264209648904603914668024590231177708831, q), q); o.t6 = addmod(o.t6, mulmod(i.t5, 20697789991623248954020701081488146717484139720322034504511115160686216223641, q), q); o.t6 = addmod(o.t6, mulmod(i.t6, 6200020095464686209289974437830528853749866001482481427982839122465470640886, q), q); i.t0 = o.t0; i.t1 = o.t1; i.t2 = o.t2; i.t3 = o.t3; i.t4 = o.t4; i.t5 = o.t5; i.t6 = o.t6; } function ark(HashInputs7 memory i, uint q, uint c) internal pure { HashInputs7 memory o; o.t0 = addmod(i.t0, c, q); o.t1 = addmod(i.t1, c, q); o.t2 = addmod(i.t2, c, q); o.t3 = addmod(i.t3, c, q); o.t4 = addmod(i.t4, c, q); o.t5 = addmod(i.t5, c, q); o.t6 = addmod(i.t6, c, q); i.t0 = o.t0; i.t1 = o.t1; i.t2 = o.t2; i.t3 = o.t3; i.t4 = o.t4; i.t5 = o.t5; i.t6 = o.t6; } function sbox_full(HashInputs7 memory i, uint q) internal pure { HashInputs7 memory o; o.t0 = mulmod(i.t0, i.t0, q); o.t0 = mulmod(o.t0, o.t0, q); o.t0 = mulmod(i.t0, o.t0, q); o.t1 = mulmod(i.t1, i.t1, q); o.t1 = mulmod(o.t1, o.t1, q); o.t1 = mulmod(i.t1, o.t1, q); o.t2 = mulmod(i.t2, i.t2, q); o.t2 = mulmod(o.t2, o.t2, q); o.t2 = mulmod(i.t2, o.t2, q); o.t3 = mulmod(i.t3, i.t3, q); o.t3 = mulmod(o.t3, o.t3, q); o.t3 = mulmod(i.t3, o.t3, q); o.t4 = mulmod(i.t4, i.t4, q); o.t4 = mulmod(o.t4, o.t4, q); o.t4 = mulmod(i.t4, o.t4, q); o.t5 = mulmod(i.t5, i.t5, q); o.t5 = mulmod(o.t5, o.t5, q); o.t5 = mulmod(i.t5, o.t5, q); o.t6 = mulmod(i.t6, i.t6, q); o.t6 = mulmod(o.t6, o.t6, q); o.t6 = mulmod(i.t6, o.t6, q); i.t0 = o.t0; i.t1 = o.t1; i.t2 = o.t2; i.t3 = o.t3; i.t4 = o.t4; i.t5 = o.t5; i.t6 = o.t6; } function sbox_partial(HashInputs7 memory i, uint q) internal pure { HashInputs7 memory o; o.t0 = mulmod(i.t0, i.t0, q); o.t0 = mulmod(o.t0, o.t0, q); o.t0 = mulmod(i.t0, o.t0, q); i.t0 = o.t0; } function hash_t7f6p52(HashInputs7 memory i, uint q) internal pure returns (uint) { // validate inputs require(i.t0 < q, "INVALID_INPUT"); require(i.t1 < q, "INVALID_INPUT"); require(i.t2 < q, "INVALID_INPUT"); require(i.t3 < q, "INVALID_INPUT"); require(i.t4 < q, "INVALID_INPUT"); require(i.t5 < q, "INVALID_INPUT"); require(i.t6 < q, "INVALID_INPUT"); // round 0 ark(i, q, 14397397413755236225575615486459253198602422701513067526754101844196324375522); sbox_full(i, q); mix(i, q); // round 1 ark(i, q, 10405129301473404666785234951972711717481302463898292859783056520670200613128); sbox_full(i, q); mix(i, q); // round 2 ark(i, q, 5179144822360023508491245509308555580251733042407187134628755730783052214509); sbox_full(i, q); mix(i, q); // round 3 ark(i, q, 9132640374240188374542843306219594180154739721841249568925550236430986592615); sbox_partial(i, q); mix(i, q); // round 4 ark(i, q, 20360807315276763881209958738450444293273549928693737723235350358403012458514); sbox_partial(i, q); mix(i, q); // round 5 ark(i, q, 17933600965499023212689924809448543050840131883187652471064418452962948061619); sbox_partial(i, q); mix(i, q); // round 6 ark(i, q, 3636213416533737411392076250708419981662897009810345015164671602334517041153); sbox_partial(i, q); mix(i, q); // round 7 ark(i, q, 2008540005368330234524962342006691994500273283000229509835662097352946198608); sbox_partial(i, q); mix(i, q); // round 8 ark(i, q, 16018407964853379535338740313053768402596521780991140819786560130595652651567); sbox_partial(i, q); mix(i, q); // round 9 ark(i, q, 20653139667070586705378398435856186172195806027708437373983929336015162186471); sbox_partial(i, q); mix(i, q); // round 10 ark(i, q, 17887713874711369695406927657694993484804203950786446055999405564652412116765); sbox_partial(i, q); mix(i, q); // round 11 ark(i, q, 4852706232225925756777361208698488277369799648067343227630786518486608711772); sbox_partial(i, q); mix(i, q); // round 12 ark(i, q, 8969172011633935669771678412400911310465619639756845342775631896478908389850); sbox_partial(i, q); mix(i, q); // round 13 ark(i, q, 20570199545627577691240476121888846460936245025392381957866134167601058684375); sbox_partial(i, q); mix(i, q); // round 14 ark(i, q, 16442329894745639881165035015179028112772410105963688121820543219662832524136); sbox_partial(i, q); mix(i, q); // round 15 ark(i, q, 20060625627350485876280451423010593928172611031611836167979515653463693899374); sbox_partial(i, q); mix(i, q); // round 16 ark(i, q, 16637282689940520290130302519163090147511023430395200895953984829546679599107); sbox_partial(i, q); mix(i, q); // round 17 ark(i, q, 15599196921909732993082127725908821049411366914683565306060493533569088698214); sbox_partial(i, q); mix(i, q); // round 18 ark(i, q, 16894591341213863947423904025624185991098788054337051624251730868231322135455); sbox_partial(i, q); mix(i, q); // round 19 ark(i, q, 1197934381747032348421303489683932612752526046745577259575778515005162320212); sbox_partial(i, q); mix(i, q); // round 20 ark(i, q, 6172482022646932735745595886795230725225293469762393889050804649558459236626); sbox_partial(i, q); mix(i, q); // round 21 ark(i, q, 21004037394166516054140386756510609698837211370585899203851827276330669555417); sbox_partial(i, q); mix(i, q); // round 22 ark(i, q, 15262034989144652068456967541137853724140836132717012646544737680069032573006); sbox_partial(i, q); mix(i, q); // round 23 ark(i, q, 15017690682054366744270630371095785995296470601172793770224691982518041139766); sbox_partial(i, q); mix(i, q); // round 24 ark(i, q, 15159744167842240513848638419303545693472533086570469712794583342699782519832); sbox_partial(i, q); mix(i, q); // round 25 ark(i, q, 11178069035565459212220861899558526502477231302924961773582350246646450941231); sbox_partial(i, q); mix(i, q); // round 26 ark(i, q, 21154888769130549957415912997229564077486639529994598560737238811887296922114); sbox_partial(i, q); mix(i, q); // round 27 ark(i, q, 20162517328110570500010831422938033120419484532231241180224283481905744633719); sbox_partial(i, q); mix(i, q); // round 28 ark(i, q, 2777362604871784250419758188173029886707024739806641263170345377816177052018); sbox_partial(i, q); mix(i, q); // round 29 ark(i, q, 15732290486829619144634131656503993123618032247178179298922551820261215487562); sbox_partial(i, q); mix(i, q); // round 30 ark(i, q, 6024433414579583476444635447152826813568595303270846875177844482142230009826); sbox_partial(i, q); mix(i, q); // round 31 ark(i, q, 17677827682004946431939402157761289497221048154630238117709539216286149983245); sbox_partial(i, q); mix(i, q); // round 32 ark(i, q, 10716307389353583413755237303156291454109852751296156900963208377067748518748); sbox_partial(i, q); mix(i, q); // round 33 ark(i, q, 14925386988604173087143546225719076187055229908444910452781922028996524347508); sbox_partial(i, q); mix(i, q); // round 34 ark(i, q, 8940878636401797005293482068100797531020505636124892198091491586778667442523); sbox_partial(i, q); mix(i, q); // round 35 ark(i, q, 18911747154199663060505302806894425160044925686870165583944475880789706164410); sbox_partial(i, q); mix(i, q); // round 36 ark(i, q, 8821532432394939099312235292271438180996556457308429936910969094255825456935); sbox_partial(i, q); mix(i, q); // round 37 ark(i, q, 20632576502437623790366878538516326728436616723089049415538037018093616927643); sbox_partial(i, q); mix(i, q); // round 38 ark(i, q, 71447649211767888770311304010816315780740050029903404046389165015534756512); sbox_partial(i, q); mix(i, q); // round 39 ark(i, q, 2781996465394730190470582631099299305677291329609718650018200531245670229393); sbox_partial(i, q); mix(i, q); // round 40 ark(i, q, 12441376330954323535872906380510501637773629931719508864016287320488688345525); sbox_partial(i, q); mix(i, q); // round 41 ark(i, q, 2558302139544901035700544058046419714227464650146159803703499681139469546006); sbox_partial(i, q); mix(i, q); // round 42 ark(i, q, 10087036781939179132584550273563255199577525914374285705149349445480649057058); sbox_partial(i, q); mix(i, q); // round 43 ark(i, q, 4267692623754666261749551533667592242661271409704769363166965280715887854739); sbox_partial(i, q); mix(i, q); // round 44 ark(i, q, 4945579503584457514844595640661884835097077318604083061152997449742124905548); sbox_partial(i, q); mix(i, q); // round 45 ark(i, q, 17742335354489274412669987990603079185096280484072783973732137326144230832311); sbox_partial(i, q); mix(i, q); // round 46 ark(i, q, 6266270088302506215402996795500854910256503071464802875821837403486057988208); sbox_partial(i, q); mix(i, q); // round 47 ark(i, q, 2716062168542520412498610856550519519760063668165561277991771577403400784706); sbox_partial(i, q); mix(i, q); // round 48 ark(i, q, 19118392018538203167410421493487769944462015419023083813301166096764262134232); sbox_partial(i, q); mix(i, q); // round 49 ark(i, q, 9386595745626044000666050847309903206827901310677406022353307960932745699524); sbox_partial(i, q); mix(i, q); // round 50 ark(i, q, 9121640807890366356465620448383131419933298563527245687958865317869840082266); sbox_partial(i, q); mix(i, q); // round 51 ark(i, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210); sbox_partial(i, q); mix(i, q); // round 52 ark(i, q, 7157404299437167354719786626667769956233708887934477609633504801472827442743); sbox_partial(i, q); mix(i, q); // round 53 ark(i, q, 14056248655941725362944552761799461694550787028230120190862133165195793034373); sbox_partial(i, q); mix(i, q); // round 54 ark(i, q, 14124396743304355958915937804966111851843703158171757752158388556919187839849); sbox_partial(i, q); mix(i, q); // round 55 ark(i, q, 11851254356749068692552943732920045260402277343008629727465773766468466181076); sbox_full(i, q); mix(i, q); // round 56 ark(i, q, 9799099446406796696742256539758943483211846559715874347178722060519817626047); sbox_full(i, q); mix(i, q); // round 57 ark(i, q, 10156146186214948683880719664738535455146137901666656566575307300522957959544); sbox_full(i, q); mix(i, q); return i.t0; } } // File: contracts/core/impl/libexchange/ExchangeBalances.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeBalances. /// @author Daniel Wang - <[email protected]> /// @author Brecht Devos - <[email protected]> library ExchangeBalances { using ExchangeTokens for uint16; using MathUint for uint; function verifyAccountBalance( uint merkleRoot, ExchangeData.MerkleProof calldata merkleProof ) public pure { require( isAccountBalanceCorrect(merkleRoot, merkleProof), "INVALID_MERKLE_TREE_DATA" ); } function isAccountBalanceCorrect( uint merkleRoot, ExchangeData.MerkleProof memory merkleProof ) public pure returns (bool) { // Calculate the Merkle root using the Merkle paths provided uint calculatedRoot = getBalancesRoot( merkleProof.balanceLeaf.tokenID, merkleProof.balanceLeaf.balance, merkleProof.balanceLeaf.weightAMM, merkleProof.balanceLeaf.storageRoot, merkleProof.balanceMerkleProof ); calculatedRoot = getAccountInternalsRoot( merkleProof.accountLeaf.accountID, merkleProof.accountLeaf.owner, merkleProof.accountLeaf.pubKeyX, merkleProof.accountLeaf.pubKeyY, merkleProof.accountLeaf.nonce, merkleProof.accountLeaf.feeBipsAMM, calculatedRoot, merkleProof.accountMerkleProof ); if (merkleProof.balanceLeaf.tokenID.isNFT()) { // Verify the NFT data uint minter = uint(merkleProof.nft.minter); uint nftType = uint(merkleProof.nft.nftType); uint token = uint(merkleProof.nft.token); uint nftIDLo = merkleProof.nft.nftID & 0xffffffffffffffffffffffffffffffff; uint nftIDHi = merkleProof.nft.nftID >> 128; uint creatorFeeBips = merkleProof.nft.creatorFeeBips; Poseidon.HashInputs7 memory inputs = Poseidon.HashInputs7( minter, nftType, token, nftIDLo, nftIDHi, creatorFeeBips, 0 ); uint nftData = Poseidon.hash_t7f6p52(inputs, ExchangeData.SNARK_SCALAR_FIELD); if (nftData != merkleProof.balanceLeaf.weightAMM) { return false; } } // Check against the expected Merkle root return (calculatedRoot == merkleRoot); } function getBalancesRoot( uint16 tokenID, uint balance, uint weightAMM, uint storageRoot, uint[24] memory balanceMerkleProof ) private pure returns (uint) { // Hash the balance leaf uint balanceItem = hashImpl(balance, weightAMM, storageRoot, 0); // Calculate the Merkle root of the balance quad Merkle tree uint _id = tokenID; for (uint depth = 0; depth < 8; depth++) { uint base = depth * 3; if (_id & 3 == 0) { balanceItem = hashImpl( balanceItem, balanceMerkleProof[base], balanceMerkleProof[base + 1], balanceMerkleProof[base + 2] ); } else if (_id & 3 == 1) { balanceItem = hashImpl( balanceMerkleProof[base], balanceItem, balanceMerkleProof[base + 1], balanceMerkleProof[base + 2] ); } else if (_id & 3 == 2) { balanceItem = hashImpl( balanceMerkleProof[base], balanceMerkleProof[base + 1], balanceItem, balanceMerkleProof[base + 2] ); } else if (_id & 3 == 3) { balanceItem = hashImpl( balanceMerkleProof[base], balanceMerkleProof[base + 1], balanceMerkleProof[base + 2], balanceItem ); } _id = _id >> 2; } return balanceItem; } function getAccountInternalsRoot( uint32 accountID, address owner, uint pubKeyX, uint pubKeyY, uint nonce, uint feeBipsAMM, uint balancesRoot, uint[48] memory accountMerkleProof ) private pure returns (uint) { // Hash the account leaf uint accountItem = hashAccountLeaf(uint(owner), pubKeyX, pubKeyY, nonce, feeBipsAMM, balancesRoot); // Calculate the Merkle root of the account quad Merkle tree uint _id = accountID; for (uint depth = 0; depth < 16; depth++) { uint base = depth * 3; if (_id & 3 == 0) { accountItem = hashImpl( accountItem, accountMerkleProof[base], accountMerkleProof[base + 1], accountMerkleProof[base + 2] ); } else if (_id & 3 == 1) { accountItem = hashImpl( accountMerkleProof[base], accountItem, accountMerkleProof[base + 1], accountMerkleProof[base + 2] ); } else if (_id & 3 == 2) { accountItem = hashImpl( accountMerkleProof[base], accountMerkleProof[base + 1], accountItem, accountMerkleProof[base + 2] ); } else if (_id & 3 == 3) { accountItem = hashImpl( accountMerkleProof[base], accountMerkleProof[base + 1], accountMerkleProof[base + 2], accountItem ); } _id = _id >> 2; } return accountItem; } function hashAccountLeaf( uint t0, uint t1, uint t2, uint t3, uint t4, uint t5 ) public pure returns (uint) { Poseidon.HashInputs7 memory inputs = Poseidon.HashInputs7(t0, t1, t2, t3, t4, t5, 0); return Poseidon.hash_t7f6p52(inputs, ExchangeData.SNARK_SCALAR_FIELD); } function hashImpl( uint t0, uint t1, uint t2, uint t3 ) private pure returns (uint) { Poseidon.HashInputs5 memory inputs = Poseidon.HashInputs5(t0, t1, t2, t3, 0); return Poseidon.hash_t5f6p52(inputs, ExchangeData.SNARK_SCALAR_FIELD); } } // File: contracts/core/iface/IL2MintableNFT.sol // Copyright 2017 Loopring Technology Limited. interface IL2MintableNFT { /// @dev This function is called when an NFT minted on L2 is withdrawn from Loopring. /// That means the NFTs were burned on L2 and now need to be minted on L1. /// /// This function can only be called by the Loopring exchange. /// /// @param to The owner of the NFT /// @param tokenId The token type 'id` /// @param amount The amount of NFTs to mint /// @param minter The minter on L2, which can be used to decide if the NFT is authentic /// @param data Opaque data that can be used by the contract function mintFromL2( address to, uint256 tokenId, uint amount, address minter, bytes calldata data ) external; /// @dev Returns a list of all address that are authorized to mint NFTs on L2. /// @return The list of authorized minter on L2 function minters() external view returns (address[] memory); } // File: contracts/thirdparty/erc165/IERC165.sol /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: contracts/thirdparty/erc165/ERC165.sol /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // File: contracts/thirdparty/erc1155/IERC1155.sol /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external; } // File: contracts/thirdparty/erc721/IERC721.sol /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // File: contracts/core/impl/libexchange/ExchangeNFT.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeNFT /// @author Brecht Devos - <[email protected]> library ExchangeNFT { using ExchangeNFT for ExchangeData.State; function deposit( ExchangeData.State storage S, address from, ExchangeData.NftType nftType, address token, uint256 nftID, uint amount, bytes memory extraData ) internal { if (amount == 0) { return; } // Disable calls to certain contracts require(S.isTokenAddressAllowed(token), "TOKEN_ADDRESS_NOT_ALLOWED"); if (nftType == ExchangeData.NftType.ERC1155) { IERC1155(token).safeTransferFrom( from, address(this), nftID, amount, extraData ); } else if (nftType == ExchangeData.NftType.ERC721) { require(amount == 1, "INVALID_AMOUNT"); IERC721(token).safeTransferFrom( from, address(this), nftID, extraData ); } else { revert("UNKNOWN_NFTTYPE"); } } function withdraw( ExchangeData.State storage S, address /*from*/, address to, ExchangeData.NftType nftType, address token, uint256 nftID, uint amount, bytes memory extraData, uint gasLimit ) internal returns (bool success) { if (amount == 0) { return true; } // Disable calls to certain contracts if(!S.isTokenAddressAllowed(token)) { return false; } if (nftType == ExchangeData.NftType.ERC1155) { try IERC1155(token).safeTransferFrom{gas: gasLimit}( address(this), to, nftID, amount, extraData ) { success = true; } catch { success = false; } } else if (nftType == ExchangeData.NftType.ERC721) { try IERC721(token).safeTransferFrom{gas: gasLimit}( address(this), to, nftID, extraData ) { success = true; } catch { success = false; } } else { revert("UNKNOWN_NFTTYPE"); } } function mintFromL2( ExchangeData.State storage S, address to, address token, uint256 nftID, uint amount, address minter, bytes memory extraData, uint gasLimit ) internal returns (bool success) { if (amount == 0) { return true; } // Disable calls to certain contracts if(!S.isTokenAddressAllowed(token)) { return false; } try IL2MintableNFT(token).mintFromL2{gas: gasLimit}( to, nftID, amount, minter, extraData ) { success = true; } catch { success = false; } } function isTokenAddressAllowed( ExchangeData.State storage S, address token ) internal view returns (bool valid) { return (token != address(this) && token != address(S.depositContract)); } } // File: contracts/core/impl/libexchange/ExchangeWithdrawals.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeWithdrawals. /// @author Brecht Devos - <[email protected]> /// @author Daniel Wang - <[email protected]> library ExchangeWithdrawals { enum WithdrawalCategory { DISTRIBUTION, FROM_MERKLE_TREE, FROM_DEPOSIT_REQUEST, FROM_APPROVED_WITHDRAWAL } using AddressUtil for address; using AddressUtil for address payable; using BytesUtil for bytes; using MathUint for uint; using ExchangeBalances for ExchangeData.State; using ExchangeMode for ExchangeData.State; using ExchangeTokens for ExchangeData.State; using ExchangeTokens for uint16; event ForcedWithdrawalRequested( address owner, uint16 tokenID, // ERC20 token ID ( if < NFT_TOKEN_ID_START) or // NFT balance slot (if >= NFT_TOKEN_ID_START) uint32 accountID ); event WithdrawalCompleted( uint8 category, address from, address to, address token, uint amount ); event WithdrawalFailed( uint8 category, address from, address to, address token, uint amount ); event NftWithdrawalCompleted( uint8 category, address from, address to, uint16 tokenID, address token, uint256 nftID, uint amount ); event NftWithdrawalFailed( uint8 category, address from, address to, uint16 tokenID, address token, uint256 nftID, uint amount ); function forceWithdraw( ExchangeData.State storage S, address owner, uint16 tokenID, // ERC20 token ID ( if < NFT_TOKEN_ID_START) or // NFT balance slot (if >= NFT_TOKEN_ID_START) uint32 accountID ) public { require(!S.isInWithdrawalMode(), "INVALID_MODE"); // Limit the amount of pending forced withdrawals so that the owner cannot be overwhelmed. require(S.getNumAvailableForcedSlots() > 0, "TOO_MANY_REQUESTS_OPEN"); require(accountID < ExchangeData.MAX_NUM_ACCOUNTS, "INVALID_ACCOUNTID"); // Only allow withdrawing from registered ERC20 tokens or NFT tokenIDs require( tokenID < S.tokens.length || // ERC20 tokenID.isNFT(), // NFT "INVALID_TOKENID" ); // A user needs to pay a fixed ETH withdrawal fee, set by the protocol. uint withdrawalFeeETH = S.loopring.forcedWithdrawalFee(); // Check ETH value sent, can be larger than the expected withdraw fee require(msg.value >= withdrawalFeeETH, "INSUFFICIENT_FEE"); // Send surplus of ETH back to the sender uint feeSurplus = msg.value.sub(withdrawalFeeETH); if (feeSurplus > 0) { msg.sender.sendETHAndVerify(feeSurplus, gasleft()); } // There can only be a single forced withdrawal per (account, token) pair. require( S.pendingForcedWithdrawals[accountID][tokenID].timestamp == 0, "WITHDRAWAL_ALREADY_PENDING" ); // Store the forced withdrawal request data S.pendingForcedWithdrawals[accountID][tokenID] = ExchangeData.ForcedWithdrawal({ owner: owner, timestamp: uint64(block.timestamp) }); // Increment the number of pending forced transactions so we can keep count. S.numPendingForcedTransactions++; emit ForcedWithdrawalRequested( owner, tokenID, accountID ); } // We alow anyone to withdraw these funds for the account owner function withdrawFromMerkleTree( ExchangeData.State storage S, ExchangeData.MerkleProof calldata merkleProof ) public { require(S.isInWithdrawalMode(), "NOT_IN_WITHDRAW_MODE"); address owner = merkleProof.accountLeaf.owner; uint32 accountID = merkleProof.accountLeaf.accountID; uint16 tokenID = merkleProof.balanceLeaf.tokenID; uint96 balance = merkleProof.balanceLeaf.balance; // Make sure the funds aren't withdrawn already. require(S.withdrawnInWithdrawMode[accountID][tokenID] == false, "WITHDRAWN_ALREADY"); // Verify that the provided Merkle tree data is valid by using the Merkle proof. ExchangeBalances.verifyAccountBalance( uint(S.merkleRoot), merkleProof ); // Make sure the balance can only be withdrawn once S.withdrawnInWithdrawMode[accountID][tokenID] = true; if (!tokenID.isNFT()) { require( merkleProof.nft.nftID == 0 && merkleProof.nft.minter == address(0), "NOT_AN_NFT" ); // Transfer the tokens to the account owner transferTokens( S, uint8(WithdrawalCategory.FROM_MERKLE_TREE), owner, owner, tokenID, balance, new bytes(0), gasleft(), false ); } else { transferNFTs( S, uint8(WithdrawalCategory.DISTRIBUTION), owner, owner, tokenID, balance, merkleProof.nft, new bytes(0), gasleft(), false ); } } function withdrawFromDepositRequest( ExchangeData.State storage S, address owner, address token ) public { uint16 tokenID = S.getTokenID(token); ExchangeData.Deposit storage deposit = S.pendingDeposits[owner][tokenID]; require(deposit.timestamp != 0, "DEPOSIT_NOT_WITHDRAWABLE_YET"); // Check if the deposit has indeed exceeded the time limit of if the exchange is in withdrawal mode require( block.timestamp >= deposit.timestamp + S.maxAgeDepositUntilWithdrawable || S.isInWithdrawalMode(), "DEPOSIT_NOT_WITHDRAWABLE_YET" ); uint amount = deposit.amount; // Reset the deposit request delete S.pendingDeposits[owner][tokenID]; // Transfer the tokens transferTokens( S, uint8(WithdrawalCategory.FROM_DEPOSIT_REQUEST), owner, owner, tokenID, amount, new bytes(0), gasleft(), false ); } function withdrawFromNFTDepositRequest( ExchangeData.State storage S, address owner, address token, ExchangeData.NftType nftType, uint256 nftID ) public { ExchangeData.Deposit storage deposit = S.pendingNFTDeposits[owner][nftType][token][nftID]; require(deposit.timestamp != 0, "DEPOSIT_NOT_WITHDRAWABLE_YET"); // Check if the deposit has indeed exceeded the time limit of if the exchange is in withdrawal mode require( block.timestamp >= deposit.timestamp + S.maxAgeDepositUntilWithdrawable || S.isInWithdrawalMode(), "DEPOSIT_NOT_WITHDRAWABLE_YET" ); uint amount = deposit.amount; // Reset the deposit request delete S.pendingNFTDeposits[owner][nftType][token][nftID]; ExchangeData.Nft memory nft = ExchangeData.Nft({ minter: token, nftType: nftType, token: token, nftID: nftID, creatorFeeBips: 0 }); // Transfer the NFTs transferNFTs( S, uint8(WithdrawalCategory.FROM_DEPOSIT_REQUEST), owner, owner, 0, amount, nft, new bytes(0), gasleft(), false ); } function withdrawFromApprovedWithdrawals( ExchangeData.State storage S, address[] memory owners, address[] memory tokens ) public { require(owners.length == tokens.length, "INVALID_INPUT_DATA"); for (uint i = 0; i < owners.length; i++) { address owner = owners[i]; uint16 tokenID = S.getTokenID(tokens[i]); uint amount = S.amountWithdrawable[owner][tokenID]; // Make sure this amount can't be withdrawn again delete S.amountWithdrawable[owner][tokenID]; // Transfer the tokens to the owner transferTokens( S, uint8(WithdrawalCategory.FROM_APPROVED_WITHDRAWAL), owner, owner, tokenID, amount, new bytes(0), gasleft(), false ); } } function withdrawFromApprovedWithdrawalsNFT( ExchangeData.State storage S, address[] memory owners, address[] memory minters, ExchangeData.NftType[] memory nftTypes, address[] memory tokens, uint256[] memory nftIDs ) public { require(owners.length == minters.length, "INVALID_INPUT_DATA_MINTERS"); require(owners.length == nftTypes.length, "INVALID_INPUT_DATA_NFTTYPES"); require(owners.length == tokens.length, "INVALID_INPUT_DATA_TOKENS"); require(owners.length == nftIDs.length, "INVALID_INPUT_DATA_CONTENT_URIS"); for (uint i = 0; i < owners.length; i++) { address owner = owners[i]; address minter = minters[i]; ExchangeData.NftType nftType = nftTypes[i]; address token = tokens[i]; uint256 nftID = nftIDs[i]; uint amount = S.amountWithdrawableNFT[owner][minter][nftType][token][nftID]; // Make sure this amount can't be withdrawn again delete S.amountWithdrawableNFT[owner][minter][nftType][token][nftID]; ExchangeData.Nft memory nft = ExchangeData.Nft({ minter: minter, nftType: nftType, token: token, nftID: nftID, creatorFeeBips: 0 }); // Transfer the NFTs to the owner transferNFTs( S, uint8(WithdrawalCategory.DISTRIBUTION), owner, owner, 0, amount, nft, new bytes(0), gasleft(), false ); } } function distributeWithdrawal( ExchangeData.State storage S, address from, address to, uint16 tokenID, uint amount, bytes memory extraData, uint gasLimit, ExchangeData.Nft memory nft ) public { if (!tokenID.isNFT()) { // Try to transfer the tokens if (!transferTokens( S, uint8(WithdrawalCategory.DISTRIBUTION), from, to, tokenID, amount, extraData, gasLimit, true )) { // If the transfer was successful there's nothing left to do. // However, if the transfer failed the tokens are still in the contract and can be // withdrawn later to `to` by anyone by using `withdrawFromApprovedWithdrawal. S.amountWithdrawable[to][tokenID] = S.amountWithdrawable[to][tokenID].add(amount); } } else { // Try to transfer the tokens if (!transferNFTs( S, uint8(WithdrawalCategory.DISTRIBUTION), from, to, tokenID, amount, nft, extraData, gasLimit, true )) { // If the transfer was successful there's nothing left to do. // However, if the transfer failed the tokens are still in the contract and can be // withdrawn later to `to` by anyone by using `withdrawFromApprovedNftWithdrawal. S.amountWithdrawableNFT[to][nft.minter][nft.nftType][nft.token][nft.nftID] = S.amountWithdrawableNFT[to][nft.minter][nft.nftType][nft.token][nft.nftID].add(amount); } } } // == Internal and Private Functions == // If allowFailure is true the transfer can fail because of a transfer error or // because the transfer uses more than `gasLimit` gas. The function // will return true when successful, false otherwise. // If allowFailure is false the transfer is guaranteed to succeed using // as much gas as needed, otherwise it throws. The function always returns true. function transferTokens( ExchangeData.State storage S, uint8 category, address from, address to, uint16 tokenID, uint amount, bytes memory extraData, uint gasLimit, bool allowFailure ) private returns (bool success) { // Redirect withdrawals to address(0) to the protocol fee vault if (to == address(0)) { to = S.loopring.protocolFeeVault(); } address token = S.getTokenAddress(tokenID); // Transfer the tokens from the deposit contract to the owner if (gasLimit > 0) { try S.depositContract.withdraw{gas: gasLimit}(from, to, token, amount, extraData) { success = true; } catch { success = false; } } else { success = false; } require(allowFailure || success, "TRANSFER_FAILURE"); if (success) { emit WithdrawalCompleted(category, from, to, token, amount); // Keep track of when the protocol fees were last withdrawn // (only done to make this data easier available). if (from == address(0)) { S.protocolFeeLastWithdrawnTime[token] = block.timestamp; } } else { emit WithdrawalFailed(category, from, to, token, amount); } } // If allowFailure is true the transfer can fail because of a transfer error or // because the transfer uses more than `gasLimit` gas. The function // will return true when successful, false otherwise. // If allowFailure is false the transfer is guaranteed to succeed using // as much gas as needed, otherwise it throws. The function always returns true. function transferNFTs( ExchangeData.State storage S, uint8 category, address from, address to, uint16 tokenID, uint amount, ExchangeData.Nft memory nft, bytes memory extraData, uint gasLimit, bool allowFailure ) private returns (bool success) { if (nft.token == nft.minter) { // This is an existing thirdparty NFT contract success = ExchangeNFT.withdraw( S, from, to, nft.nftType, nft.token, nft.nftID, amount, extraData, gasLimit ); } else { // This is an inhouse NFT contract with L2 minting support success = ExchangeNFT.mintFromL2( S, to, nft.token, nft.nftID, amount, nft.minter, extraData, gasLimit ); } require(allowFailure || success, "NFT_TRANSFER_FAILURE"); if (success) { emit NftWithdrawalCompleted(category, from, to, tokenID, nft.token, nft.nftID, amount); } else { emit NftWithdrawalFailed(category, from, to, tokenID, nft.token, nft.nftID, amount); } } } // File: contracts/core/impl/libtransactions/NftDataTransaction.sol // Copyright 2017 Loopring Technology Limited. /// @title NftDataTransaction /// @author Brecht Devos - <[email protected]> library NftDataTransaction { using BlockReader for bytes; using BytesUtil for bytes; // Read the data in two transactions, each containing partial data. // Each tx contains largely the same data (`nftID`, `nftType`, `creatorFeeBips`) // except when // type == SCHEME_WITH_TOKEN_ADDRESS -> bring `tokenAddress` to L1, // type == SCHEME_WITH_MINTER_ADDRESS -> bring `minter` to L1. enum NftDataScheme { SCHEME_WITH_MINTER_ADDRESS, SCHEME_WITH_TOKEN_ADDRESS } struct NftData { uint8 scheme; uint32 accountID; // the `to` or `from` account's ID. uint16 tokenID; ExchangeData.Nft nft; } function readTx( bytes memory data, uint offset, NftData memory nftData ) internal pure { uint _offset = offset; require( data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.NFT_DATA), "INVALID_TX_TYPE" ); _offset += 1; nftData.scheme = data.toUint8Unsafe(_offset); _offset += 1; // Extract the transfer data // We don't use abi.decode for this because of the large amount of zero-padding // bytes the circuit would also have to hash. nftData.accountID = data.toUint32Unsafe(_offset); _offset += 4; nftData.tokenID = data.toUint16Unsafe(_offset); _offset += 2; nftData.nft.nftID = data.toUintUnsafe(_offset); _offset += 32; nftData.nft.creatorFeeBips = data.toUint8Unsafe(_offset); _offset += 1; nftData.nft.nftType = ExchangeData.NftType(data.toUint8Unsafe(_offset)); _offset += 1; if (nftData.scheme == uint8(NftDataScheme.SCHEME_WITH_MINTER_ADDRESS)) { nftData.nft.minter = data.toAddressUnsafe(_offset); } else if (nftData.scheme == uint8(NftDataScheme.SCHEME_WITH_TOKEN_ADDRESS)) { nftData.nft.token = data.toAddressUnsafe(_offset); } else { revert("INVALID_NFT_DATA_SUBTYPE"); } _offset += 20; } function readDualNftData( ExchangeData.BlockContext memory ctx, uint32 accountID, uint16 tokenID, uint txIdx, NftDataTransaction.NftData memory nftData ) internal pure { // There's 68 bytes we can use per transaction. The NFT data now contains // `hash(minter, nftType, tokenAddress, nftID, creatorFeeBips)`. So this data // needs txType + (1 byte) + minter (20 bytes) + nftType (1 byte) + // tokenAddress (20 bytes) + nftID (32 bytes) + creatorFeeBips (1 byte) = 76 bytes. // So 8 bytes too much to fit inside the available space in a single tx. readNftData( ctx, accountID, tokenID, txIdx, NftDataScheme.SCHEME_WITH_MINTER_ADDRESS, nftData ); readNftData( ctx, accountID, tokenID, txIdx + 1, NftDataScheme.SCHEME_WITH_TOKEN_ADDRESS, nftData ); } function readNftData( ExchangeData.BlockContext memory ctx, uint32 accountID, uint16 tokenID, uint txOffset, NftDataScheme expectedScheme, NftDataTransaction.NftData memory nftData ) private pure { // Read the NFT_DATA transaction bytes memory txData = new bytes(ExchangeData.TX_DATA_AVAILABILITY_SIZE); ctx.block.data.readTransactionData(txOffset, ctx.block.blockSize, txData); NftDataTransaction.readTx(txData, 0, nftData); // Make sure the NFT_DATA transaction pushes data on-chain // that matches the the tokens that are getting withdrawn require( nftData.scheme == uint8(expectedScheme) && nftData.accountID == accountID && nftData.tokenID == tokenID, "INVALID_NFT_DATA" ); } } // File: contracts/core/impl/libtransactions/WithdrawTransaction.sol // Copyright 2017 Loopring Technology Limited. /// @title WithdrawTransaction /// @author Brecht Devos - <[email protected]> /// @dev The following 4 types of withdrawals are supported: /// - withdrawType = 0: offchain withdrawals with EdDSA signatures /// - withdrawType = 1: offchain withdrawals with ECDSA signatures or onchain appprovals /// - withdrawType = 2: onchain valid forced withdrawals (owner and accountID match), or /// offchain operator-initiated withdrawals for protocol fees or for /// users in shutdown mode /// - withdrawType = 3: onchain invalid forced withdrawals (owner and accountID mismatch) library WithdrawTransaction { using BlockReader for bytes; using BytesUtil for bytes; using FloatUtil for uint16; using MathUint for uint; using ExchangeMode for ExchangeData.State; using ExchangeSignatures for ExchangeData.State; using ExchangeTokens for uint16; using ExchangeWithdrawals for ExchangeData.State; bytes32 constant public WITHDRAWAL_TYPEHASH = keccak256( "Withdrawal(address owner,uint32 accountID,uint16 tokenID,uint96 amount,uint16 feeTokenID,uint96 maxFee,address to,bytes extraData,uint256 minGas,uint32 validUntil,uint32 storageID)" ); struct Withdrawal { uint withdrawalType; address from; uint32 fromAccountID; uint16 tokenID; uint96 amount; uint16 feeTokenID; uint96 maxFee; uint96 fee; address to; bytes extraData; uint minGas; uint32 validUntil; uint32 storageID; bytes20 onchainDataHash; } // Auxiliary data for each withdrawal struct WithdrawalAuxiliaryData { bool storeRecipient; uint gasLimit; bytes signature; uint minGas; address to; bytes extraData; uint96 maxFee; uint32 validUntil; } function process( ExchangeData.State storage S, ExchangeData.BlockContext memory ctx, bytes memory data, uint offset, bytes memory auxiliaryData ) internal { Withdrawal memory withdrawal; readTx(data, offset, withdrawal); // Read the NFT data if we're withdrawing an NFT NftDataTransaction.NftData memory nftData; if (withdrawal.tokenID.isNFT() && withdrawal.amount > 0) { NftDataTransaction.readDualNftData( ctx, withdrawal.fromAccountID, withdrawal.tokenID, ctx.txIndex.sub(2), nftData ); } WithdrawalAuxiliaryData memory auxData = abi.decode(auxiliaryData, (WithdrawalAuxiliaryData)); // Validate the withdrawal data not directly part of the DA bytes20 onchainDataHash = hashOnchainData( auxData.minGas, auxData.to, auxData.extraData ); // Only the 20 MSB are used, which is still 80-bit of security, which is more // than enough, especially when combined with validUntil. require(withdrawal.onchainDataHash == onchainDataHash, "INVALID_WITHDRAWAL_DATA"); // Fill in withdrawal data missing from DA withdrawal.to = auxData.to; withdrawal.minGas = auxData.minGas; withdrawal.extraData = auxData.extraData; withdrawal.maxFee = auxData.maxFee == 0 ? withdrawal.fee : auxData.maxFee; withdrawal.validUntil = auxData.validUntil; // If the account has an owner, don't allow withdrawing to the zero address // (which will be the protocol fee vault contract). require(withdrawal.from == address(0) || withdrawal.to != address(0), "INVALID_WITHDRAWAL_RECIPIENT"); if (withdrawal.withdrawalType == 0) { // Signature checked offchain, nothing to do } else if (withdrawal.withdrawalType == 1) { // Validate require(ctx.timestamp < withdrawal.validUntil, "WITHDRAWAL_EXPIRED"); require(withdrawal.fee <= withdrawal.maxFee, "WITHDRAWAL_FEE_TOO_HIGH"); // Check appproval onchain // Calculate the tx hash bytes32 txHash = hashTx(ctx.DOMAIN_SEPARATOR, withdrawal); // Check onchain authorization S.requireAuthorizedTx(withdrawal.from, auxData.signature, txHash); } else if (withdrawal.withdrawalType == 2 || withdrawal.withdrawalType == 3) { // Forced withdrawals cannot make use of certain features because the // necessary data is not authorized by the account owner. // For protocol fee withdrawals, `owner` and `to` are both address(0). require(withdrawal.from == withdrawal.to, "INVALID_WITHDRAWAL_ADDRESS"); // Forced withdrawal fees are charged when the request is submitted. require(withdrawal.fee == 0, "FEE_NOT_ZERO"); require(withdrawal.extraData.length == 0, "AUXILIARY_DATA_NOT_ALLOWED"); ExchangeData.ForcedWithdrawal memory forcedWithdrawal = S.pendingForcedWithdrawals[withdrawal.fromAccountID][withdrawal.tokenID]; if (forcedWithdrawal.timestamp != 0) { if (withdrawal.withdrawalType == 2) { require(withdrawal.from == forcedWithdrawal.owner, "INCONSISENT_OWNER"); } else { //withdrawal.withdrawalType == 3 require(withdrawal.from != forcedWithdrawal.owner, "INCONSISENT_OWNER"); require(withdrawal.amount == 0, "UNAUTHORIZED_WITHDRAWAL"); } // delete the withdrawal request and free a slot delete S.pendingForcedWithdrawals[withdrawal.fromAccountID][withdrawal.tokenID]; S.numPendingForcedTransactions--; } else { // Allow the owner to submit full withdrawals without authorization // - when in shutdown mode // - to withdraw protocol fees require( withdrawal.fromAccountID == ExchangeData.ACCOUNTID_PROTOCOLFEE || S.isShutdown(), "FULL_WITHDRAWAL_UNAUTHORIZED" ); } } else { revert("INVALID_WITHDRAWAL_TYPE"); } // Check if there is a withdrawal recipient address recipient = S.withdrawalRecipient[withdrawal.from][withdrawal.to][withdrawal.tokenID][withdrawal.amount][withdrawal.storageID]; if (recipient != address(0)) { // Auxiliary data is not supported require (withdrawal.extraData.length == 0, "AUXILIARY_DATA_NOT_ALLOWED"); // Set the new recipient address withdrawal.to = recipient; // Allow any amount of gas to be used on this withdrawal (which allows the transfer to be skipped) withdrawal.minGas = 0; // Do NOT delete the recipient to prevent replay attack // delete S.withdrawalRecipient[withdrawal.owner][withdrawal.to][withdrawal.tokenID][withdrawal.amount][withdrawal.storageID]; } else if (auxData.storeRecipient) { // Store the destination address to mark the withdrawal as done require(withdrawal.to != address(0), "INVALID_DESTINATION_ADDRESS"); S.withdrawalRecipient[withdrawal.from][withdrawal.to][withdrawal.tokenID][withdrawal.amount][withdrawal.storageID] = withdrawal.to; } // Validate gas provided require(auxData.gasLimit >= withdrawal.minGas, "OUT_OF_GAS_FOR_WITHDRAWAL"); // Try to transfer the tokens with the provided gas limit S.distributeWithdrawal( withdrawal.from, withdrawal.to, withdrawal.tokenID, withdrawal.amount, withdrawal.extraData, auxData.gasLimit, nftData.nft ); } function readTx( bytes memory data, uint offset, Withdrawal memory withdrawal ) internal pure { uint _offset = offset; require(data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.WITHDRAWAL), "INVALID_TX_TYPE"); _offset += 1; // Extract the transfer data // We don't use abi.decode for this because of the large amount of zero-padding // bytes the circuit would also have to hash. withdrawal.withdrawalType = data.toUint8Unsafe(_offset); _offset += 1; withdrawal.from = data.toAddressUnsafe(_offset); _offset += 20; withdrawal.fromAccountID = data.toUint32Unsafe(_offset); _offset += 4; withdrawal.tokenID = data.toUint16Unsafe(_offset); _offset += 2; withdrawal.amount = data.toUint96Unsafe(_offset); _offset += 12; withdrawal.feeTokenID = data.toUint16Unsafe(_offset); _offset += 2; withdrawal.fee = data.toUint16Unsafe(_offset).decodeFloat16(); _offset += 2; withdrawal.storageID = data.toUint32Unsafe(_offset); _offset += 4; withdrawal.onchainDataHash = data.toBytes20Unsafe(_offset); _offset += 20; } function hashTx( bytes32 DOMAIN_SEPARATOR, Withdrawal memory withdrawal ) internal pure returns (bytes32) { return EIP712.hashPacked( DOMAIN_SEPARATOR, keccak256( abi.encode( WITHDRAWAL_TYPEHASH, withdrawal.from, withdrawal.fromAccountID, withdrawal.tokenID, withdrawal.amount, withdrawal.feeTokenID, withdrawal.maxFee, withdrawal.to, keccak256(withdrawal.extraData), withdrawal.minGas, withdrawal.validUntil, withdrawal.storageID ) ) ); } function hashOnchainData( uint minGas, address to, bytes memory extraData ) internal pure returns (bytes20) { // Only the 20 MSB are used, which is still 80-bit of security, which is more // than enough, especially when combined with validUntil. return bytes20(keccak256( abi.encodePacked( minGas, to, extraData ) )); } } // File: contracts/core/impl/libtransactions/NftMintTransaction.sol // Copyright 2017 Loopring Technology Limited. /// @title NftMintTransaction /// @author Brecht Devos - <[email protected]> library NftMintTransaction { using BlockReader for bytes; using BytesUtil for bytes; using ExchangeSignatures for ExchangeData.State; using FloatUtil for uint16; using MathUint96 for uint96; using MathUint for uint; bytes32 constant public NFTMINT_TYPEHASH = keccak256( "NftMint(address minter,address to,uint8 nftType,address token,uint256 nftID,uint8 creatorFeeBips,uint96 amount,uint16 feeTokenID,uint96 maxFee,uint32 validUntil,uint32 storageID)" ); // This structure represents either a L2 NFT mint or a L1-to-L2 NFT deposit. struct NftMint { uint mintType; uint32 minterAccountID; uint32 toAccountID; uint16 toTokenID; // slot uint96 amount; uint16 feeTokenID; uint96 maxFee; uint96 fee; uint32 validUntil; uint32 storageID; address to; ExchangeData.Nft nft; } // Auxiliary data for each NFT mint struct NftMintAuxiliaryData { bytes signature; uint96 maxFee; uint32 validUntil; } function process( ExchangeData.State storage S, ExchangeData.BlockContext memory ctx, bytes memory data, uint offset, bytes memory auxiliaryData ) internal { // Read in the mint NftMint memory mint; readTx(data, offset, mint); // Read the NFT data if we're minting or depositing an NFT // // Note that EdDSA-based minting has the following restrictions due // to storage limit: // 1) It's only possible to mint to the minter's own account. // 2) The max amount that can be minted is limited to 65535 (2**16 - 1) per mint. // // ECDSA and onchain approval hash-based minting do not have the above restrictions. { // Read the NFT data NftDataTransaction.NftData memory nftData; NftDataTransaction.readDualNftData( ctx, mint.toAccountID, mint.toTokenID, ctx.txIndex.add(1), nftData ); // Copy the data to the mint struct mint.nft = nftData.nft; } if (mint.mintType == 2) { // No fee allowed for deposits require(mint.fee == 0, "DEPOSIT_FEE_DISALLOWED"); require(mint.nft.creatorFeeBips == 0, "CREATORFEEBIPS_NONZERO"); // The minter should be the NFT token contract for deposits require(mint.nft.minter == mint.nft.token, "MINTER_NOT_TOKEN_CONTRACT"); // Process the deposit ExchangeData.Deposit memory pendingDeposit = S.pendingNFTDeposits[mint.to][mint.nft.nftType][mint.nft.token][mint.nft.nftID]; // Make sure the deposit was actually done require(pendingDeposit.timestamp > 0, "DEPOSIT_NOT_EXIST"); // Processing partial amounts of the deposited amount is allowed. // This is done to ensure the user can do multiple deposits after each other // without invalidating work done by the exchange owner for previous deposit amounts. require(pendingDeposit.amount >= mint.amount, "INVALID_AMOUNT"); pendingDeposit.amount = pendingDeposit.amount.sub(mint.amount); // If the deposit was fully consumed, reset it so the storage is freed up // and the owner receives a gas refund. if (pendingDeposit.amount == 0) { delete S.pendingNFTDeposits[mint.to][mint.nft.nftType][mint.nft.token][mint.nft.nftID]; } else { S.pendingNFTDeposits[mint.to][mint.nft.nftType][mint.nft.token][mint.nft.nftID] = pendingDeposit; } } else { // The minter should NOT be the NFT token contract for L2 mints require(mint.nft.minter != mint.nft.token, "MINTER_EQUALS_TOKEN_CONTRACT"); NftMintAuxiliaryData memory auxData = abi.decode(auxiliaryData, (NftMintAuxiliaryData)); // Fill in withdrawal data missing from DA or only available in the NftData // Fill in withdrawal data missing from DA mint.validUntil = auxData.validUntil; mint.maxFee = auxData.maxFee == 0 ? mint.fee : auxData.maxFee; // Validate require(ctx.timestamp < mint.validUntil, "NFTMINT_EXPIRED"); require(mint.fee <= mint.maxFee, "NFTMINT_FEE_TOO_HIGH"); // Calculate the tx hash bytes32 txHash = hashTx(ctx.DOMAIN_SEPARATOR, mint); // Check the on-chain authorization S.requireAuthorizedTx(mint.nft.minter, auxData.signature, txHash); } } function readTx( bytes memory data, uint offset, NftMint memory mint ) internal pure { uint _offset = offset; require( data.toUint8Unsafe(_offset) == uint8(ExchangeData.TransactionType.NFT_MINT), "INVALID_TX_TYPE" ); _offset += 1; mint.mintType = data.toUint8Unsafe(_offset); _offset += 1; // Check that this is a conditional mint require(mint.mintType > 0, "INVALID_AUXILIARY_DATA"); // We don't use abi.decode for this because of the large amount of zero-padding // bytes the circuit would also have to hash. mint.minterAccountID = data.toUint32Unsafe(_offset); _offset += 4; mint.toTokenID = data.toUint16Unsafe(_offset); _offset += 2; mint.feeTokenID = data.toUint16Unsafe(_offset); _offset += 2; mint.fee = data.toUint16Unsafe(_offset).decodeFloat16(); _offset += 2; mint.amount = data.toUint96Unsafe(_offset); _offset += 12; mint.storageID = data.toUint32Unsafe(_offset); _offset += 4; mint.toAccountID = data.toUint32Unsafe(_offset); _offset += 4; mint.to = data.toAddressUnsafe(_offset); _offset += 20; } function hashTx( bytes32 DOMAIN_SEPARATOR, NftMint memory mint ) internal pure returns (bytes32) { return EIP712.hashPacked( DOMAIN_SEPARATOR, keccak256( abi.encode( NFTMINT_TYPEHASH, mint.nft.minter, mint.to, mint.nft.nftType, mint.nft.token, mint.nft.nftID, mint.nft.creatorFeeBips, mint.amount, mint.feeTokenID, mint.maxFee, mint.validUntil, mint.storageID ) ) ); } } // File: contracts/core/impl/libexchange/ExchangeBlocks.sol // Copyright 2017 Loopring Technology Limited. /// @title ExchangeBlocks. /// @author Brecht Devos - <[email protected]> /// @author Daniel Wang - <[email protected]> library ExchangeBlocks { using AddressUtil for address; using AddressUtil for address payable; using BlockReader for bytes; using BytesUtil for bytes; using MathUint for uint; using ExchangeMode for ExchangeData.State; using ExchangeWithdrawals for ExchangeData.State; using SignatureUtil for bytes32; event BlockSubmitted( uint indexed blockIdx, bytes32 merkleRoot, bytes32 publicDataHash ); event ProtocolFeesUpdated( uint8 takerFeeBips, uint8 makerFeeBips, uint8 previousTakerFeeBips, uint8 previousMakerFeeBips ); function submitBlocks( ExchangeData.State storage S, ExchangeData.Block[] memory blocks ) public { // Exchange cannot be in withdrawal mode require(!S.isInWithdrawalMode(), "INVALID_MODE"); // Commit the blocks bytes32[] memory publicDataHashes = new bytes32[](blocks.length); for (uint i = 0; i < blocks.length; i++) { // Hash all the public data to a single value which is used as the input for the circuit publicDataHashes[i] = blocks[i].data.fastSHA256(); // Commit the block commitBlock(S, blocks[i], publicDataHashes[i]); } // Verify the blocks - blocks are verified in a batch to save gas. verifyBlocks(S, blocks, publicDataHashes); } // == Internal Functions == function commitBlock( ExchangeData.State storage S, ExchangeData.Block memory _block, bytes32 _publicDataHash ) private { // Read the block header BlockReader.BlockHeader memory header = _block.data.readHeader(); // Validate the exchange require(header.exchange == address(this), "INVALID_EXCHANGE"); // Validate the Merkle roots require(header.merkleRootBefore == S.merkleRoot, "INVALID_MERKLE_ROOT"); require(header.merkleRootAfter != header.merkleRootBefore, "EMPTY_BLOCK_DISABLED"); require(uint(header.merkleRootAfter) < ExchangeData.SNARK_SCALAR_FIELD, "INVALID_MERKLE_ROOT"); // Validate the timestamp require( header.timestamp > block.timestamp - ExchangeData.TIMESTAMP_HALF_WINDOW_SIZE_IN_SECONDS && header.timestamp < block.timestamp + ExchangeData.TIMESTAMP_HALF_WINDOW_SIZE_IN_SECONDS, "INVALID_TIMESTAMP" ); // Validate the protocol fee values require( validateAndSyncProtocolFees(S, header.protocolTakerFeeBips, header.protocolMakerFeeBips), "INVALID_PROTOCOL_FEES" ); // Process conditional transactions processConditionalTransactions( S, _block, header ); // Emit an event uint numBlocks = S.numBlocks; emit BlockSubmitted(numBlocks, header.merkleRootAfter, _publicDataHash); S.merkleRoot = header.merkleRootAfter; if (_block.storeBlockInfoOnchain) { S.blocks[numBlocks] = ExchangeData.BlockInfo( uint32(block.timestamp), bytes28(_publicDataHash) ); } S.numBlocks = numBlocks + 1; } function verifyBlocks( ExchangeData.State storage S, ExchangeData.Block[] memory blocks, bytes32[] memory publicDataHashes ) private view { IBlockVerifier blockVerifier = S.blockVerifier; uint numBlocksVerified = 0; bool[] memory blockVerified = new bool[](blocks.length); ExchangeData.Block memory firstBlock; uint[] memory batch = new uint[](blocks.length); while (numBlocksVerified < blocks.length) { // Find all blocks of the same type uint batchLength = 0; for (uint i = 0; i < blocks.length; i++) { if (blockVerified[i] == false) { if (batchLength == 0) { firstBlock = blocks[i]; batch[batchLength++] = i; } else { ExchangeData.Block memory _block = blocks[i]; if (_block.blockType == firstBlock.blockType && _block.blockSize == firstBlock.blockSize && _block.blockVersion == firstBlock.blockVersion) { batch[batchLength++] = i; } } } } // Prepare the data for batch verification uint[] memory publicInputs = new uint[](batchLength); uint[] memory proofs = new uint[](batchLength * 8); for (uint i = 0; i < batchLength; i++) { uint blockIdx = batch[i]; // Mark the block as verified blockVerified[blockIdx] = true; // Strip the 3 least significant bits of the public data hash // so we don't have any overflow in the snark field publicInputs[i] = uint(publicDataHashes[blockIdx]) >> 3; // Copy proof ExchangeData.Block memory _block = blocks[blockIdx]; for (uint j = 0; j < 8; j++) { proofs[i*8 + j] = _block.proof[j]; } } // Verify the proofs require( blockVerifier.verifyProofs( uint8(firstBlock.blockType), firstBlock.blockSize, firstBlock.blockVersion, publicInputs, proofs ), "INVALID_PROOF" ); numBlocksVerified += batchLength; } } function processConditionalTransactions( ExchangeData.State storage S, ExchangeData.Block memory _block, BlockReader.BlockHeader memory header ) private { if (header.numConditionalTransactions > 0) { // Cache the domain separator to save on SLOADs each time it is accessed. ExchangeData.BlockContext memory ctx = ExchangeData.BlockContext({ DOMAIN_SEPARATOR: S.DOMAIN_SEPARATOR, timestamp: header.timestamp, block: _block, txIndex: 0 }); ExchangeData.AuxiliaryData[] memory block_auxiliaryData; bytes memory blockAuxData = _block.auxiliaryData; assembly { block_auxiliaryData := add(blockAuxData, 64) } require( block_auxiliaryData.length == header.numConditionalTransactions, "AUXILIARYDATA_INVALID_LENGTH" ); // Run over all conditional transactions uint minTxIndex = 0; bytes memory txData = new bytes(ExchangeData.TX_DATA_AVAILABILITY_SIZE); for (uint i = 0; i < block_auxiliaryData.length; i++) { // Load the data from auxiliaryData, which is still encoded as calldata uint txIndex; bool approved; bytes memory auxData; assembly { // Offset to block_auxiliaryData[i] let auxOffset := mload(add(block_auxiliaryData, add(32, mul(32, i)))) // Load `txIndex` (pos 0) and `approved` (pos 1) in block_auxiliaryData[i] txIndex := mload(add(add(32, block_auxiliaryData), auxOffset)) approved := mload(add(add(64, block_auxiliaryData), auxOffset)) // Load `data` (pos 2) let auxDataOffset := mload(add(add(96, block_auxiliaryData), auxOffset)) auxData := add(add(32, block_auxiliaryData), add(auxOffset, auxDataOffset)) } ctx.txIndex = txIndex; // Each conditional transaction needs to be processed from left to right require(txIndex >= minTxIndex, "AUXILIARYDATA_INVALID_ORDER"); minTxIndex = txIndex + 1; if (approved) { continue; } // Get the transaction data _block.data.readTransactionData(txIndex, _block.blockSize, txData); // Process the transaction ExchangeData.TransactionType txType = ExchangeData.TransactionType( txData.toUint8(0) ); uint txDataOffset = 0; if (txType == ExchangeData.TransactionType.DEPOSIT) { DepositTransaction.process( S, ctx, txData, txDataOffset, auxData ); } else if (txType == ExchangeData.TransactionType.WITHDRAWAL) { WithdrawTransaction.process( S, ctx, txData, txDataOffset, auxData ); } else if (txType == ExchangeData.TransactionType.TRANSFER) { TransferTransaction.process( S, ctx, txData, txDataOffset, auxData ); } else if (txType == ExchangeData.TransactionType.ACCOUNT_UPDATE) { AccountUpdateTransaction.process( S, ctx, txData, txDataOffset, auxData ); } else if (txType == ExchangeData.TransactionType.AMM_UPDATE) { AmmUpdateTransaction.process( S, ctx, txData, txDataOffset, auxData ); } else if (txType == ExchangeData.TransactionType.NFT_MINT) { NftMintTransaction.process( S, ctx, txData, txDataOffset, auxData ); } else { // ExchangeData.TransactionType.NOOP, // ExchangeData.TransactionType.SPOT_TRADE and // ExchangeData.TransactionType.SIGNATURE_VERIFICATION // are not supported revert("UNSUPPORTED_TX_TYPE"); } } } } function validateAndSyncProtocolFees( ExchangeData.State storage S, uint8 takerFeeBips, uint8 makerFeeBips ) private returns (bool) { ExchangeData.ProtocolFeeData memory data = S.protocolFeeData; if (block.timestamp > data.syncedAt + ExchangeData.MIN_AGE_PROTOCOL_FEES_UNTIL_UPDATED) { // Store the current protocol fees in the previous protocol fees data.previousTakerFeeBips = data.takerFeeBips; data.previousMakerFeeBips = data.makerFeeBips; // Get the latest protocol fees for this exchange (data.takerFeeBips, data.makerFeeBips) = S.loopring.getProtocolFeeValues(); data.syncedAt = uint32(block.timestamp); if (data.takerFeeBips != data.previousTakerFeeBips || data.makerFeeBips != data.previousMakerFeeBips) { emit ProtocolFeesUpdated( data.takerFeeBips, data.makerFeeBips, data.previousTakerFeeBips, data.previousMakerFeeBips ); } // Update the data in storage S.protocolFeeData = data; } // The given fee values are valid if they are the current or previous protocol fee values return (takerFeeBips == data.takerFeeBips && makerFeeBips == data.makerFeeBips) || (takerFeeBips == data.previousTakerFeeBips && makerFeeBips == data.previousMakerFeeBips); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"blockIdx","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"publicDataHash","type":"bytes32"}],"name":"BlockSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"takerFeeBips","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"makerFeeBips","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"previousTakerFeeBips","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"previousMakerFeeBips","type":"uint8"}],"name":"ProtocolFeesUpdated","type":"event"}]
Contract Creation Code
6154e1610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100355760003560e01c80635ee5495b1461003a575b600080fd5b81801561004657600080fd5b5061005a61005536600461411d565b61005c565b005b6100658261017a565b156100a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ccf565b60405180910390fd5b6000815167ffffffffffffffff811180156100bf57600080fd5b506040519080825280602002602001820160405280156100e9578160200160208202803683370190505b50905060005b82518110156101695761011883828151811061010757fe5b602002602001015160600151610183565b82828151811061012457fe5b6020026020010181815250506101618484838151811061014057fe5b602002602001015184848151811061015457fe5b6020026020010151610217565b6001016100ef565b506101758383836104e7565b505050565b60140154151590565b60408051600180825281830190925260009182919060208083019080368337019050509050600060208401602080840186518360026107d05a03fa915050806101f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061529c565b8160008151811061020557fe5b6020026020010151925050505b919050565b6000610226836060015161090b565b805190915073ffffffffffffffffffffffffffffffffffffffff163014610279576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c2a565b83600601548160200151146102ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061503f565b8060200151816040015114156102fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614de2565b60408101517f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000111610359576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061503f565b62093a804203816060015163ffffffff16118015610385575062093a804201816060015163ffffffff16105b6103bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ae0565b6103ce8482608001518360a001516109f6565b610404576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614d06565b61040f848483610d23565b600084600801549050807fcc86d9ed29ebae540f9d25a4976d4da36ea4161b854b8ecf18f491cf6b0feb5c83604001518560405161044e9291906147e1565b60405180910390a26040820151600686015560a0840151156104d65760408051808201825263ffffffff42811682527fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000008087166020808501918252600087815260078c0182529590952093518454915190951c64010000000002948316911617169190911790555b600101600890940193909355505050565b6003830154825173ffffffffffffffffffffffffffffffffffffffff90911690600090819067ffffffffffffffff8111801561052257600080fd5b5060405190808252806020026020018201604052801561054c578160200160208202803683370190505b509050610557613bd2565b6000865167ffffffffffffffff8111801561057157600080fd5b5060405190808252806020026020018201604052801561059b578160200160208202803683370190505b5090505b8651841015610901576000805b885181101561069b578481815181106105c157fe5b6020908102919091010151610693578161060f578881815181106105e157fe5b60200260200101519350808383806001019450815181106105fe57fe5b602002602001018181525050610693565b600089828151811061061d57fe5b60200260200101519050846000015160ff16816000015160ff161480156106535750846020015161ffff16816020015161ffff16145b801561066c5750846040015160ff16816040015160ff16145b15610691578184848060010195508151811061068457fe5b6020026020010181815250505b505b6001016105ac565b5060008167ffffffffffffffff811180156106b557600080fd5b506040519080825280602002602001820160405280156106df578160200160208202803683370190505b50905060008260080267ffffffffffffffff811180156106fe57600080fd5b50604051908082528060200260200182016040528015610728578160200160208202803683370190505b50905060005b8381101561080957600085828151811061074457fe5b60200260200101519050600188828151811061075c57fe5b60200260200101901515908115158152505060038b828151811061077c57fe5b602002602001015160001c901c84838151811061079557fe5b60200260200101818152505060008c82815181106107af57fe5b6020026020010151905060005b60088110156107fe57816080015181600881106107d557fe5b602002015185828660080201815181106107eb57fe5b60209081029190910101526001016107bc565b50505060010161072e565b508451602086015160408088015190517fdc77295b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c169363dc77295b9361086f93919290919088908890600401615389565b60206040518083038186803b15801561088757600080fd5b505afa15801561089b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bf9190614044565b6108f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a3b565b5050939093019261059f565b5050505050505050565b610913613c1b565b600061091f8382610fb6565b73ffffffffffffffffffffffffffffffffffffffff1682526014016109448382610fe8565b602080840191909152016109588382610fe8565b604083015260200161096a8382611004565b63ffffffff90811660608401526004919091019061098c908490839061102016565b60ff1660808301526001016109a18382611020565b60ff1660a08301526001016109b68382611004565b63ffffffff90811660c0840152600491909101906109d8908490839061100416565b63ffffffff1660e0830152600401606281146109f057fe5b50919050565b6040805160a081018252601285015463ffffffff811680835260ff6401000000008304811660208501526501000000000083048116948401949094526601000000000000820484166060840152670100000000000000909104909216608082015260009162093a8001421115610cce57602081015160ff90811660608301526040808301519091166080830152600286015481517f4597d3ce000000000000000000000000000000000000000000000000000000008152825173ffffffffffffffffffffffffffffffffffffffff90921692634597d3ce92600480840193829003018186803b158015610ae857600080fd5b505afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2091906143a0565b60ff90811660408401529081166020830181905263ffffffff421683526060830151909116141580610b605750806080015160ff16816040015160ff1614155b15610bb3577ff953e7a938acd4ba0571a50770e0a53fdb8d8618fe5afb1519ab7c76323ac70b8160200151826040015183606001518460800151604051610baa94939291906153d6565b60405180910390a15b805160128601805460208401516040850151606086015160808701517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000090941663ffffffff909616959095177fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff1664010000000060ff93841602177fffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffff166501000000000091831691909102177fffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffff16660100000000000094821694909402939093177fffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffff1667010000000000000093909116929092029190911790555b806020015160ff168460ff16148015610cf05750806040015160ff168360ff16145b80610d185750806060015160ff168460ff16148015610d185750806080015160ff168360ff16145b9150505b9392505050565b60c081015163ffffffff1615610175576000604051806080016040528085600101548152602001836060015163ffffffff16815260200184815260200160008152509050606060008460c0015190506040810191508360c0015163ffffffff16825114610dbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614d3d565b6040805160448082526080820190925260009182919060208201818036833701905050905060005b8451811015610fab5760208082028601810151808701808301516040820151606092830151928b01829052909390929190910188010185831015610e54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614f2c565b8260010195508115610e6857505050610fa3565b60208b015160608c0151610e8291859061ffff168861103c565b6000610e8e8682611020565b60ff166009811115610e9c57fe5b905060006001826009811115610eae57fe5b1415610ec657610ec18e8c8984876110ab565b610f9d565b6002826009811115610ed457fe5b1415610ee757610ec18e8c898487611345565b6003826009811115610ef557fe5b1415610f0857610ec18e8c898487611d03565b6005826009811115610f1657fe5b1415610f2957610ec18e8c898487611e4e565b6006826009811115610f3757fe5b1415610f4a57610ec18e8c898487611f92565b6008826009811115610f5857fe5b1415610f6b57610ec18e8c898487612029565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614928565b50505050505b600101610de4565b505050505050505050565b60008160140183511015610fc957600080fd5b50818101602001516c0100000000000000000000000090045b92915050565b60008160200183511015610ffb57600080fd5b50016020015190565b6000816004018351101561101757600080fd5b50016004015190565b6000816001018351101561103357600080fd5b50016001015190565b818310611075576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614996565b6082601d848102860182015160208401526027909402929093029190910190920190810151603d83015260890151604490910152565b6110b3613c5f565b6110be8484836126ab565b60608101516bffffffffffffffffffffffff166110db575061133e565b805173ffffffffffffffffffffffffffffffffffffffff166000908152600e8701602090815260408083208185015161ffff1684528252918290208251808401909352546bffffffffffffffffffffffff811683526c01000000000000000000000000900467ffffffffffffffff16908201819052611186576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614883565b81606001516bffffffffffffffffffffffff1681600001516bffffffffffffffffffffffff1610156111e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906151c0565b60608201518151611205916bffffffffffffffffffffffff90911690612778565b6bffffffffffffffffffffffff1680825261127f57815173ffffffffffffffffffffffffffffffffffffffff166000908152600e8801602090815260408083208186015161ffff168452909152902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905561133b565b815173ffffffffffffffffffffffffffffffffffffffff166000908152600e8801602090815260408083208186015161ffff1684528252909120825181549284015167ffffffffffffffff166c01000000000000000000000000027fffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffff6bffffffffffffffffffffffff9092167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090941693909317169190911790555b50505b5050505050565b61134d613c86565b6113588484836127d6565b611360613cf9565b611371826060015161ffff16612952565b801561138f5750600082608001516bffffffffffffffffffffffff16115b156113c0576113c086836040015184606001516113ba60028b6060015161296190919063ffffffff16565b8561299d565b6000838060200190518101906113d691906142b6565b905060006113f1826060015183608001518460a001516129be565b9050806bffffffffffffffffffffffff1916846101a001516bffffffffffffffffffffffff19161461144f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614d74565b608082015173ffffffffffffffffffffffffffffffffffffffff16610100850152606082015161014085015260a082015161012085015260c08201516bffffffffffffffffffffffff16156114a8578160c001516114ae565b8360e001515b6bffffffffffffffffffffffff1660c085015260e082015163ffffffff16610160850152602084015173ffffffffffffffffffffffffffffffffffffffff161580611513575061010084015173ffffffffffffffffffffffffffffffffffffffff1615155b611549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061522e565b835161155457611a2c565b83516001141561163a5783610160015163ffffffff16886020015163ffffffff16106115ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906148f1565b8360c001516bffffffffffffffffffffffff168460e001516bffffffffffffffffffffffff16111561160a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615076565b600061161a8960000151866129f4565b60208601516040850151919250611634918c919084612a94565b50611a2c565b83516002148061164b575083516003145b156119fa5783610100015173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff16146116be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614e50565b60e08401516bffffffffffffffffffffffff1615611708576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614f9a565b6101208401515115611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906150ad565b60408481015163ffffffff166000908152600d8b016020908152828220606088015161ffff16835281529082902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900467ffffffffffffffff16908201819052156119a95784516002141561183f57806000015173ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161461183a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c98565b6118f7565b806000015173ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff1614156118ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c98565b60808501516bffffffffffffffffffffffff16156118f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615265565b60408581015163ffffffff9081166000908152600d8d01602090815283822060608a015161ffff16835290529190912080547fffffffff0000000000000000000000000000000000000000000000000000000016905560118b0180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000081169083167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909216919091179055611634565b604085015163ffffffff1615806119c457506119c48a612bf9565b611634576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614dab565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ebe565b60208085015173ffffffffffffffffffffffffffffffffffffffff908116600090815260108c0183526040808220610100890151841683528452808220606089015161ffff168352845280822060808901516bffffffffffffffffffffffff168352845280822061018089015163ffffffff1683529093529190912054168015611b18576101208501515115611aee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906150ad565b73ffffffffffffffffffffffffffffffffffffffff81166101008601526000610140860152611c1f565b825115611c1f5761010085015173ffffffffffffffffffffffffffffffffffffffff16611b71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614e87565b6101008501805160208088015173ffffffffffffffffffffffffffffffffffffffff908116600090815260108f018352604080822095518316825294835284812060608b015161ffff168252835284812060808b01516bffffffffffffffffffffffff16825283528481206101808b015163ffffffff16825290925292902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016929091169190911790555b84610140015183602001511015611c62576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615152565b897346a71e786c34714928390782e9e50ee1c2fa99896328da23b69091876020015188610100015189606001518a608001518b61012001518a602001518c606001516040518963ffffffff1660e01b8152600401611cc79897969594939291906152d3565b60006040518083038186803b158015611cdf57600080fd5b505af4158015611cf3573d6000803e3d6000fd5b5050505050505050505050505050565b611d0b613d27565b611d16848483612c02565b600082806020019051810190611d2c9190614060565b604081015163ffffffff1661012084015260208101519091506bffffffffffffffffffffffff1615611d62578060200151611d69565b8161010001515b6bffffffffffffffffffffffff1660e0830152610120820151602087015163ffffffff918216911610611dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615189565b8160e001516bffffffffffffffffffffffff168261010001516bffffffffffffffffffffffff161115611e27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906149cd565b6000611e37876000015184612dcc565b60408401518351919250610901918a919084612a94565b611e56613c1b565b611e61848483612e35565b600082806020019051810190611e779190614060565b604081015163ffffffff1660c084015260208101519091506bffffffffffffffffffffffff1615611eac578060200151611eb2565b81608001515b6bffffffffffffffffffffffff16606083015260c0820151602087015163ffffffff918216911610611f10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ef5565b81606001516bffffffffffffffffffffffff1682608001516bffffffffffffffffffffffff161115611f6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614b4e565b6000611f7e876000015184612f78565b83518351919250610901918a919084612a94565b611f9a613c1b565b611fa5848483612fd9565b600082806020019051810190611fbb9190614093565b9050806020015163ffffffff16866020015163ffffffff161061200a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614aa9565b602081015163ffffffff1660a08301528551600090611f7e90846130fd565b612031613d83565b61203c84848361315e565b612044613cf9565b61206a86836040015184606001516113ba60018b606001516132fa90919063ffffffff16565b6060015161016082015280516002141561250c5760e08101516bffffffffffffffffffffffff16156120c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c61565b6101608101516080015160ff161561210c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614b17565b6101608101516040810151905173ffffffffffffffffffffffffffffffffffffffff90811691161461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906150e4565b61014081015173ffffffffffffffffffffffffffffffffffffffff1660009081526017870160209081526040822061016084015190910151829060018111156121af57fe5b60018111156121ba57fe5b8152602080820192909252604090810160009081206101608601805184015173ffffffffffffffffffffffffffffffffffffffff168352908452828220905160600151825283528190208151808301909252546bffffffffffffffffffffffff811682526c01000000000000000000000000900467ffffffffffffffff169181018290529150612276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614883565b81608001516bffffffffffffffffffffffff1681600001516bffffffffffffffffffffffff1610156122d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906151c0565b608082015181516122f5916bffffffffffffffffffffffff90911690612778565b6bffffffffffffffffffffffff168082526123e75786601701600083610140015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083610160015160200151600181111561236757fe5b600181111561237257fe5b8152602080820192909252604090810160009081206101608601805184015173ffffffffffffffffffffffffffffffffffffffff1683529084528282209051606001518252909252902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055612506565b61014082015173ffffffffffffffffffffffffffffffffffffffff1660009081526017880160209081526040822061016085015190910151839290600181111561242d57fe5b600181111561243857fe5b8152602080820192909252604090810160009081206101608701805184015173ffffffffffffffffffffffffffffffffffffffff168352908452828220905160600151825283522082518154939092015167ffffffffffffffff166c01000000000000000000000000027fffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffff6bffffffffffffffffffffffff9093167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090941693909317919091169190911790555b506126a3565b6101608101516040810151905173ffffffffffffffffffffffffffffffffffffffff9081169116141561256b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615008565b6000828060200190518101906125819190614060565b604081015163ffffffff1661010084015260208101519091506bffffffffffffffffffffffff16156125b75780602001516125bd565b8160e001515b6bffffffffffffffffffffffff1660c0830152610100820151602087015163ffffffff91821691161061261c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061511b565b8160c001516bffffffffffffffffffffffff168260e001516bffffffffffffffffffffffff16111561267a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614e19565b600061268a876000015184613337565b610160840151518351919250610901918a919084612a94565b505050505050565b8160016126b885836133cc565b60ff16146126f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b6001016126ff84826133d4565b73ffffffffffffffffffffffffffffffffffffffff16825260140161272484826133ec565b63ffffffff90811660208401526004919091019061274690859083906133f416565b61ffff16604083015260020161275c84826133fc565b6bffffffffffffffffffffffff16606090920191909152505050565b6000826bffffffffffffffffffffffff16826bffffffffffffffffffffffff1611156127d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614bf3565b50900390565b8160026127e385836133cc565b60ff161461281d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b60010161282a84826133cc565b60ff16825260010161283c84826133d4565b73ffffffffffffffffffffffffffffffffffffffff16602083015260140161286484826133ec565b63ffffffff90811660408401526004919091019061288690859083906133f416565b61ffff16606083015260020161289c84826133fc565b6bffffffffffffffffffffffff166080830152600c016128bc84826133f4565b61ffff1660a08301526002016128de6128d585836133f4565b61ffff16613404565b6bffffffffffffffffffffffff1660e08301526002016128fe84826133ec565b63ffffffff90811661018084015260049190910190612921908590839061345d16565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166101a090920191909152505050565b61800061ffff82161015919050565b6000828211156127d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614bf3565b6129ac85858585600086613465565b61133e85858585600101600186613465565b60008383836040516020016129d593929190614515565b6040516020818303038152906040528051906020012090509392505050565b6000610d1c837f53e76288406dcc28b678b1729d44357c9cad2b88390a0e9fe2d0aa7c6c6eb15e84602001518560400151866060015187608001518860a001518960c001518a61010001518b6101200151805190602001208c61014001518d61016001518e6101800151604051602001612a799c9b9a999897969594939291906146f0565b60405160208183030381529060405280519060200120613534565b73ffffffffffffffffffffffffffffffffffffffff8316612ae1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614fd1565b815115612b2e57612af381848461359e565b612b29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614b85565b612bf3565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f85016020908152604080832084845290915290205460ff16612b9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906151f7565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f850160209081526040808320848452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b50505050565b60130154151590565b816003612c0f85836133cc565b60ff1614612c49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b600101612c5684826133cc565b60ff16600114612c92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a04565b600101612c9f84826133ec565b63ffffffff908116835260049190910190612cbe90859083906133ec16565b63ffffffff908116602084015260049190910190612ce090859083906133f416565b61ffff166080830152600201612d03612cf98583613609565b62ffffff16613611565b6bffffffffffffffffffffffff1660a0830152600301612d2384826133f4565b61ffff1660c0830152600201612d3c6128d585836133f4565b6bffffffffffffffffffffffff16610100830152600201612d5d84826133ec565b63ffffffff90811661014084015260049190910190612d8090859083906133d416565b73ffffffffffffffffffffffffffffffffffffffff166060830152601401612da884826133d4565b73ffffffffffffffffffffffffffffffffffffffff16604090920191909152505050565b6000610d1c837f1dc39c675b372f8b007ec97afefd94ca728f5fa07a299187ebda40d9d1ee0d758460400151856060015186608001518760a001518860c001518960e001518a61012001518b6101400151604051602001612a7999989796959493929190614613565b816005612e4285836133cc565b60ff1614612e7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b600101612e8984826133cc565b60ff16600114612ec5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a04565b600101612ed284826133d4565b73ffffffffffffffffffffffffffffffffffffffff168252601401612ef784826133ec565b63ffffffff908116602084015260049190910190612f1990859083906133f416565b61ffff166040830152600201612f326128d585836133f4565b6bffffffffffffffffffffffff166080830152600201612f52848261345d565b60a0830152602001612f6484826133ec565b63ffffffff1660e090920191909152505050565b6000610d1c837f2572067ba53186333170716cc2af5287d9ade832878652f81a464bfa2a5f67b784600001518560200151866040015187606001518860a001518960c001518a60e00151604051602001612a79989796959493929190614778565b816006612fe685836133cc565b60ff1614613020576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b60010161302d84826133d4565b73ffffffffffffffffffffffffffffffffffffffff16825260140161305284826133ec565b63ffffffff90811660208401526004919091019061307490859083906133f416565b61ffff16604083015260020161308a84826133cc565b60ff16606083015260010161309f84826133fc565b6bffffffffffffffffffffffff166080830152600c016130bf84826133ec565b63ffffffff90811660c0840152600491909101906130e190859083906133fc16565b6bffffffffffffffffffffffff1660e090920191909152505050565b6000610d1c837f7dc289b0f90ae57018b1ccfdd612f5c94c91dd5a6535e5e51a09a209f1b0d9d5846000015185602001518660400151876060015188608001518960a001518a60c00151604051602001612a79989796959493929190614684565b81600861316b85836133cc565b60ff16146131a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b6001016131b284826133cc565b60ff16808352600191909101906131f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061495f565b6131ff84826133ec565b63ffffffff90811660208401526004919091019061322190859083906133f416565b61ffff16606083015260020161323784826133f4565b61ffff1660a08301526002016132506128d585836133f4565b6bffffffffffffffffffffffff1660e083015260020161327084826133fc565b6bffffffffffffffffffffffff166080830152600c0161329084826133ec565b63ffffffff908116610120840152600491909101906132b390859083906133ec16565b63ffffffff9081166040840152600491909101906132d590859083906133d416565b73ffffffffffffffffffffffffffffffffffffffff1661014090920191909152505050565b81810182811015610fe2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614f63565b6000610d1c837fa733ae45da5f48636103bf8262fdd161a6a6284b12918c8118962f911ab4d56284610160015160000151856101400151866101600151602001518761016001516040015188610160015160600151896101600151608001518a608001518b60a001518c60c001518d61010001518e6101200151604051602001612a799c9b9a99989796959493929190614567565b016001015190565b01602001516c01000000000000000000000000900490565b016004015190565b016002015190565b01600c015190565b60006107ff8216601f600b84901c16600a0a026c010000000000000000000000008110610fe2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614826565b016020015190565b60408051604480825260808201909252600091602082018180368337505050604088015160208101516060909101519192506134a89190869061ffff168461103c565b6134b48160008461366b565b8260018111156134c057fe5b60ff16826000015160ff161480156134e757508563ffffffff16826020015163ffffffff16145b80156134fe57508461ffff16826040015161ffff16145b61133b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906148ba565b60006040518060400160405280600281526020017f19010000000000000000000000000000000000000000000000000000000000008152508383604051602001613580939291906144bd565b60405160208183030381529060405280519060200120905092915050565b600073ffffffffffffffffffffffffffffffffffffffff83166135c357506000610d1c565b6135e28373ffffffffffffffffffffffffffffffffffffffff1661381c565b6135f6576135f1848484613853565b613601565b61360184848461398d565b949350505050565b016003015190565b60006207ffff8216601f601384901c16600a0a026c010000000000000000000000008110610fe2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614826565b81600961367885836133cc565b60ff16146136b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b6001016136bf84826133cc565b60ff1682526001016136d184826133ec565b63ffffffff9081166020840152600491909101906136f390859083906133f416565b61ffff166040830152600201613709848261345d565b606080840151015260200161371e84826133cc565b606083015160ff90911660809091015260010161373b84826133cc565b60ff16600181111561374957fe5b826060015160200190600181111561375d57fe5b9081600181111561376a57fe5b90525081516001919091019060ff166137ab5761378784826133d4565b606083015173ffffffffffffffffffffffffffffffffffffffff9091169052612bf3565b815160ff16600114156137ea576137c284826133d4565b606083015173ffffffffffffffffffffffffffffffffffffffff909116604090910152612bf3565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614bbc565b6000813f8015801590610d1c57507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141592915050565b600073ffffffffffffffffffffffffffffffffffffffff831661387857506000610d1c565b8151600090613888906001612961565b905060006138968483611020565b60ff1660048111156138a457fe5b828552905060028160048111156138b757fe5b14156138fc576138c78685613ae7565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149250613980565b600381600481111561390a57fe5b141561397b5760008660405160200161392391906144e4565b6040516020818303038152906040528051906020012090506139458186613ae7565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614935050613980565b600092505b5060010182529392505050565b600080631626ba7e60e01b85846040516024016139ab9291906147ef565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1683604051613a3291906144a1565b600060405180830381855afa9150503d8060008114613a6d576040519150601f19603f3d011682016040523d82523d6000602084013e613a72565b606091505b5091509150818015613a85575080516020145b8015613adc57507f1626ba7e00000000000000000000000000000000000000000000000000000000613ab8826000613bbf565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b979650505050505050565b60008151604114613afa57506000610fe2565b60208201516040830151604184015160ff167f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115613b405760009350505050610fe2565b8060ff16601b1480613b5557508060ff16601c145b15613bb35760018682858560405160008152602001604052604051613b7d9493929190614808565b6020604051602081039080840390855afa158015613b9f573d6000803e3d6000fd5b505050602060405103519350505050610fe2565b60009350505050610fe2565b60008160040183511015610ffb57600080fd5b60408051610100810182526000808252602082018190529181019190915260608082015260808101613c02613de9565b8152600060208201526060604082018190529081015290565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604080516101c08101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e0820183905261010082018390526101208201526101408101829052610160810182905261018081018290526101a081019190915290565b604080516080810182526000808252602082018190529181019190915260608101613d22613e08565b905290565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081019190915290565b6040805161018081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101919091526101608101613d22613e08565b6040518061010001604052806008906020820280368337509192915050565b6040805160a081019091526000808252602082019081526000602082018190526040820181905260609091015290565b805173ffffffffffffffffffffffffffffffffffffffff8116811461021257600080fd5b600082601f830112613e6c578081fd5b60405161010080820182811067ffffffffffffffff82111715613e8b57fe5b6040528184828101871015613e9e578485fd5b8492505b6008831015613ec257803582526001929092019160209182019101613ea2565b509195945050505050565b80356102128161548b565b80516102128161548b565b600082601f830112613ef3578081fd5b8135613f06613f018261541f565b6153fb565b818152846020838601011115613f1a578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112613f44578081fd5b8151613f52613f018261541f565b818152846020838601011115613f66578283fd5b61360182602083016020870161545f565b600060608284031215613f88578081fd5b6040516060810167ffffffffffffffff8282108183111715613fa657fe5b816040528293508451915080821115613fbe57600080fd5b50613fcb85828601613f34565b825250613fda60208401614028565b6020820152613feb60408401614009565b60408201525092915050565b803561ffff8116811461021257600080fd5b805163ffffffff8116811461021257600080fd5b80356102128161549c565b80516bffffffffffffffffffffffff8116811461021257600080fd5b600060208284031215614055578081fd5b8151610d1c8161548b565b600060208284031215614071578081fd5b815167ffffffffffffffff811115614087578182fd5b61360184828501613f77565b6000602082840312156140a4578081fd5b815167ffffffffffffffff808211156140bb578283fd5b90830190604082860312156140ce578283fd5b6040516040810181811083821117156140e357fe5b6040528251828111156140f4578485fd5b61410087828601613f34565b82525061410f60208401614009565b602082015295945050505050565b6000806040838503121561412f578081fd5b8235915060208084013567ffffffffffffffff8082111561414e578384fd5b818601915086601f830112614161578384fd5b81358181111561416d57fe5b61417a84858302016153fb565b81815284810190848601875b848110156142a557813587016101e07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828f030112156141c457898afd5b6141cf6101006153fb565b6141da8a830161401d565b81526141e860408301613ff7565b8a8201526141f86060830161401d565b604082015260808201358881111561420e578b8cfd5b61421c8f8c83860101613ee3565b60608301525061422f8e60a08401613e5c565b60808201526142416101a08301613ecd565b60a08201526101c082013588811115614258578b8cfd5b6142668f8c83860101613ee3565b60c0830152506101e08201358881111561427e578b8cfd5b61428c8f8c83860101613ee3565b60e0830152508552509287019290870190600101614186565b50979a909950975050505050505050565b6000602082840312156142c7578081fd5b815167ffffffffffffffff808211156142de578283fd5b81840191506101008083870312156142f4578384fd5b6142fd816153fb565b905061430883613ed8565b815260208301516020820152604083015182811115614325578485fd5b61433187828601613f34565b6040830152506060830151606082015261434d60808401613e38565b608082015260a083015182811115614363578485fd5b61436f87828601613f34565b60a08301525061438160c08401614028565b60c082015261439260e08401614009565b60e082015295945050505050565b600080604083850312156143b2578182fd5b82516143bd8161549c565b60208401519092506143ce8161549c565b809150509250929050565b73ffffffffffffffffffffffffffffffffffffffff169052565b6000815180845260208085019450808401835b8381101561442257815187529582019590820190600101614406565b509495945050505050565b6000815180845261444581602086016020860161545f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6002811061448157fe5b9052565b63ffffffff169052565b6bffffffffffffffffffffffff169052565b600082516144b381846020870161545f565b9190910192915050565b600084516144cf81846020890161545f565b91909101928352506020820152604001919050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60008482527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008460601b166020830152825161455881603485016020870161545f565b91909101603401949350505050565b8c815273ffffffffffffffffffffffffffffffffffffffff8c811660208301528b811660408301526101808201906145a2606084018d614477565b8a16608083015260a0820189905260ff881660c08301526bffffffffffffffffffffffff871660e083015261ffff86166101008301526145e661012083018661448f565b6145f4610140830185614485565b614602610160830184614485565b9d9c50505050505050505050505050565b98895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295909616604088015261ffff93841660608801526bffffffffffffffffffffffff9283166080880152921660a08601521660c084015263ffffffff91821660e0840152166101008201526101200190565b97885273ffffffffffffffffffffffffffffffffffffffff96909616602088015263ffffffff948516604088015261ffff93909316606087015260ff9190911660808601526bffffffffffffffffffffffff1660a0850152811660c08401521660e08201526101000190565b8c815273ffffffffffffffffffffffffffffffffffffffff8c16602082015263ffffffff8b16604082015261ffff8a811660608301526bffffffffffffffffffffffff8a8116608084015290891660a0830152871660c0820152610180810161475c60e08301886143d9565b85610100830152846101208301526145f4610140830185614485565b97885273ffffffffffffffffffffffffffffffffffffffff96909616602088015263ffffffff948516604088015261ffff9390931660608701526bffffffffffffffffffffffff91909116608086015260a0850152811660c08401521660e08201526101000190565b918252602082015260400190565b600083825260406020830152613601604083018461442d565b93845260ff9290921660208401526040830152606082015260800190565b60208082526026908201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960408201527f3620626974730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f4445504f5349545f4e4f545f4558495354000000000000000000000000000000604082015260600190565b60208082526010908201527f494e56414c49445f4e46545f4441544100000000000000000000000000000000604082015260600190565b60208082526012908201527f5749544844524157414c5f455850495245440000000000000000000000000000604082015260600190565b60208082526013908201527f554e535550504f525445445f54585f5459504500000000000000000000000000604082015260600190565b60208082526016908201527f494e56414c49445f415558494c494152595f4441544100000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f54585f494458000000000000000000000000000000000000604082015260600190565b60208082526015908201527f5452414e534645525f4645455f544f4f5f484947480000000000000000000000604082015260600190565b6020808252601a908201527f494e56414c49445f415558494c49415259444154415f44415441000000000000604082015260600190565b6020808252600d908201527f494e56414c49445f50524f4f4600000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f494e56414c49445f54585f545950450000000000000000000000000000000000604082015260600190565b60208082526012908201527f414d4d5f5550444154455f455850495245440000000000000000000000000000604082015260600190565b60208082526011908201527f494e56414c49445f54494d455354414d50000000000000000000000000000000604082015260600190565b60208082526016908201527f43524541544f52464545424950535f4e4f4e5a45524f00000000000000000000604082015260600190565b6020808252601b908201527f4143434f554e545f5550444154455f4645455f544f4f5f484947480000000000604082015260600190565b60208082526011908201527f494e56414c49445f5349474e4154555245000000000000000000000000000000604082015260600190565b60208082526018908201527f494e56414c49445f4e46545f444154415f535542545950450000000000000000604082015260600190565b6020808252600d908201527f5355425f554e444552464c4f5700000000000000000000000000000000000000604082015260600190565b60208082526010908201527f494e56414c49445f45584348414e474500000000000000000000000000000000604082015260600190565b60208082526016908201527f4445504f5349545f4645455f444953414c4c4f57454400000000000000000000604082015260600190565b60208082526011908201527f494e434f4e534953454e545f4f574e4552000000000000000000000000000000604082015260600190565b6020808252600c908201527f494e56414c49445f4d4f44450000000000000000000000000000000000000000604082015260600190565b60208082526015908201527f494e56414c49445f50524f544f434f4c5f464545530000000000000000000000604082015260600190565b6020808252601c908201527f415558494c49415259444154415f494e56414c49445f4c454e47544800000000604082015260600190565b60208082526017908201527f494e56414c49445f5749544844524157414c5f44415441000000000000000000604082015260600190565b6020808252601c908201527f46554c4c5f5749544844524157414c5f554e415554484f52495a454400000000604082015260600190565b60208082526014908201527f454d5054595f424c4f434b5f44495341424c4544000000000000000000000000604082015260600190565b60208082526014908201527f4e46544d494e545f4645455f544f4f5f48494748000000000000000000000000604082015260600190565b6020808252601a908201527f494e56414c49445f5749544844524157414c5f41444452455353000000000000604082015260600190565b6020808252601b908201527f494e56414c49445f44455354494e4154494f4e5f414444524553530000000000604082015260600190565b60208082526017908201527f494e56414c49445f5749544844524157414c5f54595045000000000000000000604082015260600190565b60208082526016908201527f4143434f554e545f5550444154455f4558504952454400000000000000000000604082015260600190565b6020808252601b908201527f415558494c49415259444154415f494e56414c49445f4f524445520000000000604082015260600190565b6020808252600c908201527f4144445f4f564552464c4f570000000000000000000000000000000000000000604082015260600190565b6020808252600c908201527f4645455f4e4f545f5a45524f0000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f5349474e4552000000000000000000000000000000000000604082015260600190565b6020808252601c908201527f4d494e5445525f455155414c535f544f4b454e5f434f4e545241435400000000604082015260600190565b60208082526013908201527f494e56414c49445f4d45524b4c455f524f4f5400000000000000000000000000604082015260600190565b60208082526017908201527f5749544844524157414c5f4645455f544f4f5f48494748000000000000000000604082015260600190565b6020808252601a908201527f415558494c494152595f444154415f4e4f545f414c4c4f574544000000000000604082015260600190565b60208082526019908201527f4d494e5445525f4e4f545f544f4b454e5f434f4e545241435400000000000000604082015260600190565b6020808252600f908201527f4e46544d494e545f455850495245440000000000000000000000000000000000604082015260600190565b60208082526019908201527f4f55545f4f465f4741535f464f525f5749544844524157414c00000000000000604082015260600190565b60208082526010908201527f5452414e534645525f4558504952454400000000000000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f414d4f554e54000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f54585f4e4f545f415050524f5645440000000000000000000000000000000000604082015260600190565b6020808252601c908201527f494e56414c49445f5749544844524157414c5f524543495049454e5400000000604082015260600190565b60208082526017908201527f554e415554484f52495a45445f5749544844524157414c000000000000000000604082015260600190565b6020808252600d908201527f5348413235365f4641494c454400000000000000000000000000000000000000604082015260600190565b60006101808a835273ffffffffffffffffffffffffffffffffffffffff808b166020850152808a16604085015261ffff891660608501526bffffffffffffffffffffffff881660808501528160a08501526153308285018861442d565b92508560c08501528085511660e085015260208501519150615356610100850183614477565b60408501511661012084015250606083015161014083015260809092015160ff1661016090910152979650505050505050565b600060ff8716825261ffff8616602083015260ff8516604083015260a060608301526153b860a08301856143f3565b82810360808401526153ca81856143f3565b98975050505050505050565b60ff948516815292841660208401529083166040830152909116606082015260800190565b60405181810167ffffffffffffffff8111828210171561541757fe5b604052919050565b600067ffffffffffffffff82111561543357fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b8381101561547a578181015183820152602001615462565b83811115612bf35750506000910152565b801515811461549957600080fd5b50565b60ff8116811461549957600080fdfea26469706673582212202fa17e5ad75ede6e36cfb5b8f3888bfd34c0f8af5c29ff87ae2a91dc1e18642664736f6c63430007060033
Deployed Bytecode
0x7394cdf6621c190f5950ed9e16debb19e6a8d2e84e30146080604052600436106100355760003560e01c80635ee5495b1461003a575b600080fd5b81801561004657600080fd5b5061005a61005536600461411d565b61005c565b005b6100658261017a565b156100a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ccf565b60405180910390fd5b6000815167ffffffffffffffff811180156100bf57600080fd5b506040519080825280602002602001820160405280156100e9578160200160208202803683370190505b50905060005b82518110156101695761011883828151811061010757fe5b602002602001015160600151610183565b82828151811061012457fe5b6020026020010181815250506101618484838151811061014057fe5b602002602001015184848151811061015457fe5b6020026020010151610217565b6001016100ef565b506101758383836104e7565b505050565b60140154151590565b60408051600180825281830190925260009182919060208083019080368337019050509050600060208401602080840186518360026107d05a03fa915050806101f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061529c565b8160008151811061020557fe5b6020026020010151925050505b919050565b6000610226836060015161090b565b805190915073ffffffffffffffffffffffffffffffffffffffff163014610279576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c2a565b83600601548160200151146102ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061503f565b8060200151816040015114156102fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614de2565b60408101517f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000111610359576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061503f565b62093a804203816060015163ffffffff16118015610385575062093a804201816060015163ffffffff16105b6103bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ae0565b6103ce8482608001518360a001516109f6565b610404576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614d06565b61040f848483610d23565b600084600801549050807fcc86d9ed29ebae540f9d25a4976d4da36ea4161b854b8ecf18f491cf6b0feb5c83604001518560405161044e9291906147e1565b60405180910390a26040820151600686015560a0840151156104d65760408051808201825263ffffffff42811682527fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000008087166020808501918252600087815260078c0182529590952093518454915190951c64010000000002948316911617169190911790555b600101600890940193909355505050565b6003830154825173ffffffffffffffffffffffffffffffffffffffff90911690600090819067ffffffffffffffff8111801561052257600080fd5b5060405190808252806020026020018201604052801561054c578160200160208202803683370190505b509050610557613bd2565b6000865167ffffffffffffffff8111801561057157600080fd5b5060405190808252806020026020018201604052801561059b578160200160208202803683370190505b5090505b8651841015610901576000805b885181101561069b578481815181106105c157fe5b6020908102919091010151610693578161060f578881815181106105e157fe5b60200260200101519350808383806001019450815181106105fe57fe5b602002602001018181525050610693565b600089828151811061061d57fe5b60200260200101519050846000015160ff16816000015160ff161480156106535750846020015161ffff16816020015161ffff16145b801561066c5750846040015160ff16816040015160ff16145b15610691578184848060010195508151811061068457fe5b6020026020010181815250505b505b6001016105ac565b5060008167ffffffffffffffff811180156106b557600080fd5b506040519080825280602002602001820160405280156106df578160200160208202803683370190505b50905060008260080267ffffffffffffffff811180156106fe57600080fd5b50604051908082528060200260200182016040528015610728578160200160208202803683370190505b50905060005b8381101561080957600085828151811061074457fe5b60200260200101519050600188828151811061075c57fe5b60200260200101901515908115158152505060038b828151811061077c57fe5b602002602001015160001c901c84838151811061079557fe5b60200260200101818152505060008c82815181106107af57fe5b6020026020010151905060005b60088110156107fe57816080015181600881106107d557fe5b602002015185828660080201815181106107eb57fe5b60209081029190910101526001016107bc565b50505060010161072e565b508451602086015160408088015190517fdc77295b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c169363dc77295b9361086f93919290919088908890600401615389565b60206040518083038186803b15801561088757600080fd5b505afa15801561089b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108bf9190614044565b6108f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a3b565b5050939093019261059f565b5050505050505050565b610913613c1b565b600061091f8382610fb6565b73ffffffffffffffffffffffffffffffffffffffff1682526014016109448382610fe8565b602080840191909152016109588382610fe8565b604083015260200161096a8382611004565b63ffffffff90811660608401526004919091019061098c908490839061102016565b60ff1660808301526001016109a18382611020565b60ff1660a08301526001016109b68382611004565b63ffffffff90811660c0840152600491909101906109d8908490839061100416565b63ffffffff1660e0830152600401606281146109f057fe5b50919050565b6040805160a081018252601285015463ffffffff811680835260ff6401000000008304811660208501526501000000000083048116948401949094526601000000000000820484166060840152670100000000000000909104909216608082015260009162093a8001421115610cce57602081015160ff90811660608301526040808301519091166080830152600286015481517f4597d3ce000000000000000000000000000000000000000000000000000000008152825173ffffffffffffffffffffffffffffffffffffffff90921692634597d3ce92600480840193829003018186803b158015610ae857600080fd5b505afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2091906143a0565b60ff90811660408401529081166020830181905263ffffffff421683526060830151909116141580610b605750806080015160ff16816040015160ff1614155b15610bb3577ff953e7a938acd4ba0571a50770e0a53fdb8d8618fe5afb1519ab7c76323ac70b8160200151826040015183606001518460800151604051610baa94939291906153d6565b60405180910390a15b805160128601805460208401516040850151606086015160808701517fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000090941663ffffffff909616959095177fffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffff1664010000000060ff93841602177fffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffff166501000000000091831691909102177fffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffff16660100000000000094821694909402939093177fffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffff1667010000000000000093909116929092029190911790555b806020015160ff168460ff16148015610cf05750806040015160ff168360ff16145b80610d185750806060015160ff168460ff16148015610d185750806080015160ff168360ff16145b9150505b9392505050565b60c081015163ffffffff1615610175576000604051806080016040528085600101548152602001836060015163ffffffff16815260200184815260200160008152509050606060008460c0015190506040810191508360c0015163ffffffff16825114610dbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614d3d565b6040805160448082526080820190925260009182919060208201818036833701905050905060005b8451811015610fab5760208082028601810151808701808301516040820151606092830151928b01829052909390929190910188010185831015610e54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614f2c565b8260010195508115610e6857505050610fa3565b60208b015160608c0151610e8291859061ffff168861103c565b6000610e8e8682611020565b60ff166009811115610e9c57fe5b905060006001826009811115610eae57fe5b1415610ec657610ec18e8c8984876110ab565b610f9d565b6002826009811115610ed457fe5b1415610ee757610ec18e8c898487611345565b6003826009811115610ef557fe5b1415610f0857610ec18e8c898487611d03565b6005826009811115610f1657fe5b1415610f2957610ec18e8c898487611e4e565b6006826009811115610f3757fe5b1415610f4a57610ec18e8c898487611f92565b6008826009811115610f5857fe5b1415610f6b57610ec18e8c898487612029565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614928565b50505050505b600101610de4565b505050505050505050565b60008160140183511015610fc957600080fd5b50818101602001516c0100000000000000000000000090045b92915050565b60008160200183511015610ffb57600080fd5b50016020015190565b6000816004018351101561101757600080fd5b50016004015190565b6000816001018351101561103357600080fd5b50016001015190565b818310611075576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614996565b6082601d848102860182015160208401526027909402929093029190910190920190810151603d83015260890151604490910152565b6110b3613c5f565b6110be8484836126ab565b60608101516bffffffffffffffffffffffff166110db575061133e565b805173ffffffffffffffffffffffffffffffffffffffff166000908152600e8701602090815260408083208185015161ffff1684528252918290208251808401909352546bffffffffffffffffffffffff811683526c01000000000000000000000000900467ffffffffffffffff16908201819052611186576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614883565b81606001516bffffffffffffffffffffffff1681600001516bffffffffffffffffffffffff1610156111e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906151c0565b60608201518151611205916bffffffffffffffffffffffff90911690612778565b6bffffffffffffffffffffffff1680825261127f57815173ffffffffffffffffffffffffffffffffffffffff166000908152600e8801602090815260408083208186015161ffff168452909152902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905561133b565b815173ffffffffffffffffffffffffffffffffffffffff166000908152600e8801602090815260408083208186015161ffff1684528252909120825181549284015167ffffffffffffffff166c01000000000000000000000000027fffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffff6bffffffffffffffffffffffff9092167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090941693909317169190911790555b50505b5050505050565b61134d613c86565b6113588484836127d6565b611360613cf9565b611371826060015161ffff16612952565b801561138f5750600082608001516bffffffffffffffffffffffff16115b156113c0576113c086836040015184606001516113ba60028b6060015161296190919063ffffffff16565b8561299d565b6000838060200190518101906113d691906142b6565b905060006113f1826060015183608001518460a001516129be565b9050806bffffffffffffffffffffffff1916846101a001516bffffffffffffffffffffffff19161461144f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614d74565b608082015173ffffffffffffffffffffffffffffffffffffffff16610100850152606082015161014085015260a082015161012085015260c08201516bffffffffffffffffffffffff16156114a8578160c001516114ae565b8360e001515b6bffffffffffffffffffffffff1660c085015260e082015163ffffffff16610160850152602084015173ffffffffffffffffffffffffffffffffffffffff161580611513575061010084015173ffffffffffffffffffffffffffffffffffffffff1615155b611549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061522e565b835161155457611a2c565b83516001141561163a5783610160015163ffffffff16886020015163ffffffff16106115ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906148f1565b8360c001516bffffffffffffffffffffffff168460e001516bffffffffffffffffffffffff16111561160a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615076565b600061161a8960000151866129f4565b60208601516040850151919250611634918c919084612a94565b50611a2c565b83516002148061164b575083516003145b156119fa5783610100015173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff16146116be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614e50565b60e08401516bffffffffffffffffffffffff1615611708576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614f9a565b6101208401515115611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906150ad565b60408481015163ffffffff166000908152600d8b016020908152828220606088015161ffff16835281529082902082518084019093525473ffffffffffffffffffffffffffffffffffffffff8116835274010000000000000000000000000000000000000000900467ffffffffffffffff16908201819052156119a95784516002141561183f57806000015173ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161461183a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c98565b6118f7565b806000015173ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff1614156118ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c98565b60808501516bffffffffffffffffffffffff16156118f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615265565b60408581015163ffffffff9081166000908152600d8d01602090815283822060608a015161ffff16835290529190912080547fffffffff0000000000000000000000000000000000000000000000000000000016905560118b0180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000081169083167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909216919091179055611634565b604085015163ffffffff1615806119c457506119c48a612bf9565b611634576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614dab565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ebe565b60208085015173ffffffffffffffffffffffffffffffffffffffff908116600090815260108c0183526040808220610100890151841683528452808220606089015161ffff168352845280822060808901516bffffffffffffffffffffffff168352845280822061018089015163ffffffff1683529093529190912054168015611b18576101208501515115611aee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906150ad565b73ffffffffffffffffffffffffffffffffffffffff81166101008601526000610140860152611c1f565b825115611c1f5761010085015173ffffffffffffffffffffffffffffffffffffffff16611b71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614e87565b6101008501805160208088015173ffffffffffffffffffffffffffffffffffffffff908116600090815260108f018352604080822095518316825294835284812060608b015161ffff168252835284812060808b01516bffffffffffffffffffffffff16825283528481206101808b015163ffffffff16825290925292902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016929091169190911790555b84610140015183602001511015611c62576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615152565b897346a71e786c34714928390782e9e50ee1c2fa99896328da23b69091876020015188610100015189606001518a608001518b61012001518a602001518c606001516040518963ffffffff1660e01b8152600401611cc79897969594939291906152d3565b60006040518083038186803b158015611cdf57600080fd5b505af4158015611cf3573d6000803e3d6000fd5b5050505050505050505050505050565b611d0b613d27565b611d16848483612c02565b600082806020019051810190611d2c9190614060565b604081015163ffffffff1661012084015260208101519091506bffffffffffffffffffffffff1615611d62578060200151611d69565b8161010001515b6bffffffffffffffffffffffff1660e0830152610120820151602087015163ffffffff918216911610611dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615189565b8160e001516bffffffffffffffffffffffff168261010001516bffffffffffffffffffffffff161115611e27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906149cd565b6000611e37876000015184612dcc565b60408401518351919250610901918a919084612a94565b611e56613c1b565b611e61848483612e35565b600082806020019051810190611e779190614060565b604081015163ffffffff1660c084015260208101519091506bffffffffffffffffffffffff1615611eac578060200151611eb2565b81608001515b6bffffffffffffffffffffffff16606083015260c0820151602087015163ffffffff918216911610611f10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614ef5565b81606001516bffffffffffffffffffffffff1682608001516bffffffffffffffffffffffff161115611f6e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614b4e565b6000611f7e876000015184612f78565b83518351919250610901918a919084612a94565b611f9a613c1b565b611fa5848483612fd9565b600082806020019051810190611fbb9190614093565b9050806020015163ffffffff16866020015163ffffffff161061200a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614aa9565b602081015163ffffffff1660a08301528551600090611f7e90846130fd565b612031613d83565b61203c84848361315e565b612044613cf9565b61206a86836040015184606001516113ba60018b606001516132fa90919063ffffffff16565b6060015161016082015280516002141561250c5760e08101516bffffffffffffffffffffffff16156120c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614c61565b6101608101516080015160ff161561210c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614b17565b6101608101516040810151905173ffffffffffffffffffffffffffffffffffffffff90811691161461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906150e4565b61014081015173ffffffffffffffffffffffffffffffffffffffff1660009081526017870160209081526040822061016084015190910151829060018111156121af57fe5b60018111156121ba57fe5b8152602080820192909252604090810160009081206101608601805184015173ffffffffffffffffffffffffffffffffffffffff168352908452828220905160600151825283528190208151808301909252546bffffffffffffffffffffffff811682526c01000000000000000000000000900467ffffffffffffffff169181018290529150612276576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614883565b81608001516bffffffffffffffffffffffff1681600001516bffffffffffffffffffffffff1610156122d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906151c0565b608082015181516122f5916bffffffffffffffffffffffff90911690612778565b6bffffffffffffffffffffffff168082526123e75786601701600083610140015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083610160015160200151600181111561236757fe5b600181111561237257fe5b8152602080820192909252604090810160009081206101608601805184015173ffffffffffffffffffffffffffffffffffffffff1683529084528282209051606001518252909252902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055612506565b61014082015173ffffffffffffffffffffffffffffffffffffffff1660009081526017880160209081526040822061016085015190910151839290600181111561242d57fe5b600181111561243857fe5b8152602080820192909252604090810160009081206101608701805184015173ffffffffffffffffffffffffffffffffffffffff168352908452828220905160600151825283522082518154939092015167ffffffffffffffff166c01000000000000000000000000027fffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffff6bffffffffffffffffffffffff9093167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090941693909317919091169190911790555b506126a3565b6101608101516040810151905173ffffffffffffffffffffffffffffffffffffffff9081169116141561256b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90615008565b6000828060200190518101906125819190614060565b604081015163ffffffff1661010084015260208101519091506bffffffffffffffffffffffff16156125b75780602001516125bd565b8160e001515b6bffffffffffffffffffffffff1660c0830152610100820151602087015163ffffffff91821691161061261c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061511b565b8160c001516bffffffffffffffffffffffff168260e001516bffffffffffffffffffffffff16111561267a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614e19565b600061268a876000015184613337565b610160840151518351919250610901918a919084612a94565b505050505050565b8160016126b885836133cc565b60ff16146126f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b6001016126ff84826133d4565b73ffffffffffffffffffffffffffffffffffffffff16825260140161272484826133ec565b63ffffffff90811660208401526004919091019061274690859083906133f416565b61ffff16604083015260020161275c84826133fc565b6bffffffffffffffffffffffff16606090920191909152505050565b6000826bffffffffffffffffffffffff16826bffffffffffffffffffffffff1611156127d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614bf3565b50900390565b8160026127e385836133cc565b60ff161461281d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b60010161282a84826133cc565b60ff16825260010161283c84826133d4565b73ffffffffffffffffffffffffffffffffffffffff16602083015260140161286484826133ec565b63ffffffff90811660408401526004919091019061288690859083906133f416565b61ffff16606083015260020161289c84826133fc565b6bffffffffffffffffffffffff166080830152600c016128bc84826133f4565b61ffff1660a08301526002016128de6128d585836133f4565b61ffff16613404565b6bffffffffffffffffffffffff1660e08301526002016128fe84826133ec565b63ffffffff90811661018084015260049190910190612921908590839061345d16565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166101a090920191909152505050565b61800061ffff82161015919050565b6000828211156127d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614bf3565b6129ac85858585600086613465565b61133e85858585600101600186613465565b60008383836040516020016129d593929190614515565b6040516020818303038152906040528051906020012090509392505050565b6000610d1c837f53e76288406dcc28b678b1729d44357c9cad2b88390a0e9fe2d0aa7c6c6eb15e84602001518560400151866060015187608001518860a001518960c001518a61010001518b6101200151805190602001208c61014001518d61016001518e6101800151604051602001612a799c9b9a999897969594939291906146f0565b60405160208183030381529060405280519060200120613534565b73ffffffffffffffffffffffffffffffffffffffff8316612ae1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614fd1565b815115612b2e57612af381848461359e565b612b29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614b85565b612bf3565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f85016020908152604080832084845290915290205460ff16612b9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906151f7565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f850160209081526040808320848452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b50505050565b60130154151590565b816003612c0f85836133cc565b60ff1614612c49576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b600101612c5684826133cc565b60ff16600114612c92576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a04565b600101612c9f84826133ec565b63ffffffff908116835260049190910190612cbe90859083906133ec16565b63ffffffff908116602084015260049190910190612ce090859083906133f416565b61ffff166080830152600201612d03612cf98583613609565b62ffffff16613611565b6bffffffffffffffffffffffff1660a0830152600301612d2384826133f4565b61ffff1660c0830152600201612d3c6128d585836133f4565b6bffffffffffffffffffffffff16610100830152600201612d5d84826133ec565b63ffffffff90811661014084015260049190910190612d8090859083906133d416565b73ffffffffffffffffffffffffffffffffffffffff166060830152601401612da884826133d4565b73ffffffffffffffffffffffffffffffffffffffff16604090920191909152505050565b6000610d1c837f1dc39c675b372f8b007ec97afefd94ca728f5fa07a299187ebda40d9d1ee0d758460400151856060015186608001518760a001518860c001518960e001518a61012001518b6101400151604051602001612a7999989796959493929190614613565b816005612e4285836133cc565b60ff1614612e7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b600101612e8984826133cc565b60ff16600114612ec5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a04565b600101612ed284826133d4565b73ffffffffffffffffffffffffffffffffffffffff168252601401612ef784826133ec565b63ffffffff908116602084015260049190910190612f1990859083906133f416565b61ffff166040830152600201612f326128d585836133f4565b6bffffffffffffffffffffffff166080830152600201612f52848261345d565b60a0830152602001612f6484826133ec565b63ffffffff1660e090920191909152505050565b6000610d1c837f2572067ba53186333170716cc2af5287d9ade832878652f81a464bfa2a5f67b784600001518560200151866040015187606001518860a001518960c001518a60e00151604051602001612a79989796959493929190614778565b816006612fe685836133cc565b60ff1614613020576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b60010161302d84826133d4565b73ffffffffffffffffffffffffffffffffffffffff16825260140161305284826133ec565b63ffffffff90811660208401526004919091019061307490859083906133f416565b61ffff16604083015260020161308a84826133cc565b60ff16606083015260010161309f84826133fc565b6bffffffffffffffffffffffff166080830152600c016130bf84826133ec565b63ffffffff90811660c0840152600491909101906130e190859083906133fc16565b6bffffffffffffffffffffffff1660e090920191909152505050565b6000610d1c837f7dc289b0f90ae57018b1ccfdd612f5c94c91dd5a6535e5e51a09a209f1b0d9d5846000015185602001518660400151876060015188608001518960a001518a60c00151604051602001612a79989796959493929190614684565b81600861316b85836133cc565b60ff16146131a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b6001016131b284826133cc565b60ff16808352600191909101906131f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c9061495f565b6131ff84826133ec565b63ffffffff90811660208401526004919091019061322190859083906133f416565b61ffff16606083015260020161323784826133f4565b61ffff1660a08301526002016132506128d585836133f4565b6bffffffffffffffffffffffff1660e083015260020161327084826133fc565b6bffffffffffffffffffffffff166080830152600c0161329084826133ec565b63ffffffff908116610120840152600491909101906132b390859083906133ec16565b63ffffffff9081166040840152600491909101906132d590859083906133d416565b73ffffffffffffffffffffffffffffffffffffffff1661014090920191909152505050565b81810182811015610fe2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614f63565b6000610d1c837fa733ae45da5f48636103bf8262fdd161a6a6284b12918c8118962f911ab4d56284610160015160000151856101400151866101600151602001518761016001516040015188610160015160600151896101600151608001518a608001518b60a001518c60c001518d61010001518e6101200151604051602001612a799c9b9a99989796959493929190614567565b016001015190565b01602001516c01000000000000000000000000900490565b016004015190565b016002015190565b01600c015190565b60006107ff8216601f600b84901c16600a0a026c010000000000000000000000008110610fe2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614826565b016020015190565b60408051604480825260808201909252600091602082018180368337505050604088015160208101516060909101519192506134a89190869061ffff168461103c565b6134b48160008461366b565b8260018111156134c057fe5b60ff16826000015160ff161480156134e757508563ffffffff16826020015163ffffffff16145b80156134fe57508461ffff16826040015161ffff16145b61133b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c906148ba565b60006040518060400160405280600281526020017f19010000000000000000000000000000000000000000000000000000000000008152508383604051602001613580939291906144bd565b60405160208183030381529060405280519060200120905092915050565b600073ffffffffffffffffffffffffffffffffffffffff83166135c357506000610d1c565b6135e28373ffffffffffffffffffffffffffffffffffffffff1661381c565b6135f6576135f1848484613853565b613601565b61360184848461398d565b949350505050565b016003015190565b60006207ffff8216601f601384901c16600a0a026c010000000000000000000000008110610fe2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614826565b81600961367885836133cc565b60ff16146136b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614a72565b6001016136bf84826133cc565b60ff1682526001016136d184826133ec565b63ffffffff9081166020840152600491909101906136f390859083906133f416565b61ffff166040830152600201613709848261345d565b606080840151015260200161371e84826133cc565b606083015160ff90911660809091015260010161373b84826133cc565b60ff16600181111561374957fe5b826060015160200190600181111561375d57fe5b9081600181111561376a57fe5b90525081516001919091019060ff166137ab5761378784826133d4565b606083015173ffffffffffffffffffffffffffffffffffffffff9091169052612bf3565b815160ff16600114156137ea576137c284826133d4565b606083015173ffffffffffffffffffffffffffffffffffffffff909116604090910152612bf3565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161009c90614bbc565b6000813f8015801590610d1c57507fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470141592915050565b600073ffffffffffffffffffffffffffffffffffffffff831661387857506000610d1c565b8151600090613888906001612961565b905060006138968483611020565b60ff1660048111156138a457fe5b828552905060028160048111156138b757fe5b14156138fc576138c78685613ae7565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149250613980565b600381600481111561390a57fe5b141561397b5760008660405160200161392391906144e4565b6040516020818303038152906040528051906020012090506139458186613ae7565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614935050613980565b600092505b5060010182529392505050565b600080631626ba7e60e01b85846040516024016139ab9291906147ef565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1683604051613a3291906144a1565b600060405180830381855afa9150503d8060008114613a6d576040519150601f19603f3d011682016040523d82523d6000602084013e613a72565b606091505b5091509150818015613a85575080516020145b8015613adc57507f1626ba7e00000000000000000000000000000000000000000000000000000000613ab8826000613bbf565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b979650505050505050565b60008151604114613afa57506000610fe2565b60208201516040830151604184015160ff167f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115613b405760009350505050610fe2565b8060ff16601b1480613b5557508060ff16601c145b15613bb35760018682858560405160008152602001604052604051613b7d9493929190614808565b6020604051602081039080840390855afa158015613b9f573d6000803e3d6000fd5b505050602060405103519350505050610fe2565b60009350505050610fe2565b60008160040183511015610ffb57600080fd5b60408051610100810182526000808252602082018190529181019190915260608082015260808101613c02613de9565b8152600060208201526060604082018190529081015290565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915290565b60408051608081018252600080825260208201819052918101829052606081019190915290565b604080516101c08101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e0820183905261010082018390526101208201526101408101829052610160810182905261018081018290526101a081019190915290565b604080516080810182526000808252602082018190529181019190915260608101613d22613e08565b905290565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081019190915290565b6040805161018081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101919091526101608101613d22613e08565b6040518061010001604052806008906020820280368337509192915050565b6040805160a081019091526000808252602082019081526000602082018190526040820181905260609091015290565b805173ffffffffffffffffffffffffffffffffffffffff8116811461021257600080fd5b600082601f830112613e6c578081fd5b60405161010080820182811067ffffffffffffffff82111715613e8b57fe5b6040528184828101871015613e9e578485fd5b8492505b6008831015613ec257803582526001929092019160209182019101613ea2565b509195945050505050565b80356102128161548b565b80516102128161548b565b600082601f830112613ef3578081fd5b8135613f06613f018261541f565b6153fb565b818152846020838601011115613f1a578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112613f44578081fd5b8151613f52613f018261541f565b818152846020838601011115613f66578283fd5b61360182602083016020870161545f565b600060608284031215613f88578081fd5b6040516060810167ffffffffffffffff8282108183111715613fa657fe5b816040528293508451915080821115613fbe57600080fd5b50613fcb85828601613f34565b825250613fda60208401614028565b6020820152613feb60408401614009565b60408201525092915050565b803561ffff8116811461021257600080fd5b805163ffffffff8116811461021257600080fd5b80356102128161549c565b80516bffffffffffffffffffffffff8116811461021257600080fd5b600060208284031215614055578081fd5b8151610d1c8161548b565b600060208284031215614071578081fd5b815167ffffffffffffffff811115614087578182fd5b61360184828501613f77565b6000602082840312156140a4578081fd5b815167ffffffffffffffff808211156140bb578283fd5b90830190604082860312156140ce578283fd5b6040516040810181811083821117156140e357fe5b6040528251828111156140f4578485fd5b61410087828601613f34565b82525061410f60208401614009565b602082015295945050505050565b6000806040838503121561412f578081fd5b8235915060208084013567ffffffffffffffff8082111561414e578384fd5b818601915086601f830112614161578384fd5b81358181111561416d57fe5b61417a84858302016153fb565b81815284810190848601875b848110156142a557813587016101e07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828f030112156141c457898afd5b6141cf6101006153fb565b6141da8a830161401d565b81526141e860408301613ff7565b8a8201526141f86060830161401d565b604082015260808201358881111561420e578b8cfd5b61421c8f8c83860101613ee3565b60608301525061422f8e60a08401613e5c565b60808201526142416101a08301613ecd565b60a08201526101c082013588811115614258578b8cfd5b6142668f8c83860101613ee3565b60c0830152506101e08201358881111561427e578b8cfd5b61428c8f8c83860101613ee3565b60e0830152508552509287019290870190600101614186565b50979a909950975050505050505050565b6000602082840312156142c7578081fd5b815167ffffffffffffffff808211156142de578283fd5b81840191506101008083870312156142f4578384fd5b6142fd816153fb565b905061430883613ed8565b815260208301516020820152604083015182811115614325578485fd5b61433187828601613f34565b6040830152506060830151606082015261434d60808401613e38565b608082015260a083015182811115614363578485fd5b61436f87828601613f34565b60a08301525061438160c08401614028565b60c082015261439260e08401614009565b60e082015295945050505050565b600080604083850312156143b2578182fd5b82516143bd8161549c565b60208401519092506143ce8161549c565b809150509250929050565b73ffffffffffffffffffffffffffffffffffffffff169052565b6000815180845260208085019450808401835b8381101561442257815187529582019590820190600101614406565b509495945050505050565b6000815180845261444581602086016020860161545f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6002811061448157fe5b9052565b63ffffffff169052565b6bffffffffffffffffffffffff169052565b600082516144b381846020870161545f565b9190910192915050565b600084516144cf81846020890161545f565b91909101928352506020820152604001919050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b60008482527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008460601b166020830152825161455881603485016020870161545f565b91909101603401949350505050565b8c815273ffffffffffffffffffffffffffffffffffffffff8c811660208301528b811660408301526101808201906145a2606084018d614477565b8a16608083015260a0820189905260ff881660c08301526bffffffffffffffffffffffff871660e083015261ffff86166101008301526145e661012083018661448f565b6145f4610140830185614485565b614602610160830184614485565b9d9c50505050505050505050505050565b98895273ffffffffffffffffffffffffffffffffffffffff97881660208a015295909616604088015261ffff93841660608801526bffffffffffffffffffffffff9283166080880152921660a08601521660c084015263ffffffff91821660e0840152166101008201526101200190565b97885273ffffffffffffffffffffffffffffffffffffffff96909616602088015263ffffffff948516604088015261ffff93909316606087015260ff9190911660808601526bffffffffffffffffffffffff1660a0850152811660c08401521660e08201526101000190565b8c815273ffffffffffffffffffffffffffffffffffffffff8c16602082015263ffffffff8b16604082015261ffff8a811660608301526bffffffffffffffffffffffff8a8116608084015290891660a0830152871660c0820152610180810161475c60e08301886143d9565b85610100830152846101208301526145f4610140830185614485565b97885273ffffffffffffffffffffffffffffffffffffffff96909616602088015263ffffffff948516604088015261ffff9390931660608701526bffffffffffffffffffffffff91909116608086015260a0850152811660c08401521660e08201526101000190565b918252602082015260400190565b600083825260406020830152613601604083018461442d565b93845260ff9290921660208401526040830152606082015260800190565b60208082526026908201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960408201527f3620626974730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f4445504f5349545f4e4f545f4558495354000000000000000000000000000000604082015260600190565b60208082526010908201527f494e56414c49445f4e46545f4441544100000000000000000000000000000000604082015260600190565b60208082526012908201527f5749544844524157414c5f455850495245440000000000000000000000000000604082015260600190565b60208082526013908201527f554e535550504f525445445f54585f5459504500000000000000000000000000604082015260600190565b60208082526016908201527f494e56414c49445f415558494c494152595f4441544100000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f54585f494458000000000000000000000000000000000000604082015260600190565b60208082526015908201527f5452414e534645525f4645455f544f4f5f484947480000000000000000000000604082015260600190565b6020808252601a908201527f494e56414c49445f415558494c49415259444154415f44415441000000000000604082015260600190565b6020808252600d908201527f494e56414c49445f50524f4f4600000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f494e56414c49445f54585f545950450000000000000000000000000000000000604082015260600190565b60208082526012908201527f414d4d5f5550444154455f455850495245440000000000000000000000000000604082015260600190565b60208082526011908201527f494e56414c49445f54494d455354414d50000000000000000000000000000000604082015260600190565b60208082526016908201527f43524541544f52464545424950535f4e4f4e5a45524f00000000000000000000604082015260600190565b6020808252601b908201527f4143434f554e545f5550444154455f4645455f544f4f5f484947480000000000604082015260600190565b60208082526011908201527f494e56414c49445f5349474e4154555245000000000000000000000000000000604082015260600190565b60208082526018908201527f494e56414c49445f4e46545f444154415f535542545950450000000000000000604082015260600190565b6020808252600d908201527f5355425f554e444552464c4f5700000000000000000000000000000000000000604082015260600190565b60208082526010908201527f494e56414c49445f45584348414e474500000000000000000000000000000000604082015260600190565b60208082526016908201527f4445504f5349545f4645455f444953414c4c4f57454400000000000000000000604082015260600190565b60208082526011908201527f494e434f4e534953454e545f4f574e4552000000000000000000000000000000604082015260600190565b6020808252600c908201527f494e56414c49445f4d4f44450000000000000000000000000000000000000000604082015260600190565b60208082526015908201527f494e56414c49445f50524f544f434f4c5f464545530000000000000000000000604082015260600190565b6020808252601c908201527f415558494c49415259444154415f494e56414c49445f4c454e47544800000000604082015260600190565b60208082526017908201527f494e56414c49445f5749544844524157414c5f44415441000000000000000000604082015260600190565b6020808252601c908201527f46554c4c5f5749544844524157414c5f554e415554484f52495a454400000000604082015260600190565b60208082526014908201527f454d5054595f424c4f434b5f44495341424c4544000000000000000000000000604082015260600190565b60208082526014908201527f4e46544d494e545f4645455f544f4f5f48494748000000000000000000000000604082015260600190565b6020808252601a908201527f494e56414c49445f5749544844524157414c5f41444452455353000000000000604082015260600190565b6020808252601b908201527f494e56414c49445f44455354494e4154494f4e5f414444524553530000000000604082015260600190565b60208082526017908201527f494e56414c49445f5749544844524157414c5f54595045000000000000000000604082015260600190565b60208082526016908201527f4143434f554e545f5550444154455f4558504952454400000000000000000000604082015260600190565b6020808252601b908201527f415558494c49415259444154415f494e56414c49445f4f524445520000000000604082015260600190565b6020808252600c908201527f4144445f4f564552464c4f570000000000000000000000000000000000000000604082015260600190565b6020808252600c908201527f4645455f4e4f545f5a45524f0000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f5349474e4552000000000000000000000000000000000000604082015260600190565b6020808252601c908201527f4d494e5445525f455155414c535f544f4b454e5f434f4e545241435400000000604082015260600190565b60208082526013908201527f494e56414c49445f4d45524b4c455f524f4f5400000000000000000000000000604082015260600190565b60208082526017908201527f5749544844524157414c5f4645455f544f4f5f48494748000000000000000000604082015260600190565b6020808252601a908201527f415558494c494152595f444154415f4e4f545f414c4c4f574544000000000000604082015260600190565b60208082526019908201527f4d494e5445525f4e4f545f544f4b454e5f434f4e545241435400000000000000604082015260600190565b6020808252600f908201527f4e46544d494e545f455850495245440000000000000000000000000000000000604082015260600190565b60208082526019908201527f4f55545f4f465f4741535f464f525f5749544844524157414c00000000000000604082015260600190565b60208082526010908201527f5452414e534645525f4558504952454400000000000000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f414d4f554e54000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f54585f4e4f545f415050524f5645440000000000000000000000000000000000604082015260600190565b6020808252601c908201527f494e56414c49445f5749544844524157414c5f524543495049454e5400000000604082015260600190565b60208082526017908201527f554e415554484f52495a45445f5749544844524157414c000000000000000000604082015260600190565b6020808252600d908201527f5348413235365f4641494c454400000000000000000000000000000000000000604082015260600190565b60006101808a835273ffffffffffffffffffffffffffffffffffffffff808b166020850152808a16604085015261ffff891660608501526bffffffffffffffffffffffff881660808501528160a08501526153308285018861442d565b92508560c08501528085511660e085015260208501519150615356610100850183614477565b60408501511661012084015250606083015161014083015260809092015160ff1661016090910152979650505050505050565b600060ff8716825261ffff8616602083015260ff8516604083015260a060608301526153b860a08301856143f3565b82810360808401526153ca81856143f3565b98975050505050505050565b60ff948516815292841660208401529083166040830152909116606082015260800190565b60405181810167ffffffffffffffff8111828210171561541757fe5b604052919050565b600067ffffffffffffffff82111561543357fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b8381101561547a578181015183820152602001615462565b83811115612bf35750506000910152565b801515811461549957600080fd5b50565b60ff8116811461549957600080fdfea26469706673582212202fa17e5ad75ede6e36cfb5b8f3888bfd34c0f8af5c29ff87ae2a91dc1e18642664736f6c63430007060033
Deployed Bytecode Sourcemap
207625:12795:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;208363:818;;;;;;;;;;-1:-1:-1;208363:818:0;;;;;:::i;:::-;;:::i;:::-;;;208574:22;:1;:20;:22::i;:::-;208573:23;208565:48;;;;;;;;;;;;:::i;:::-;;;;;;;;;208656:33;208706:6;:13;208692:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;208692:28:0;;208656:64;;208736:6;208731:313;208752:6;:13;208748:1;:17;208731:313;;;208911:27;:6;208918:1;208911:9;;;;;;;;;;;;;;:14;;;:25;:27::i;:::-;208889:16;208906:1;208889:19;;;;;;;;;;;;;:49;;;;;208986:46;208998:1;209001:6;209008:1;209001:9;;;;;;;;;;;;;;209012:16;209029:1;209012:19;;;;;;;;;;;;;;208986:11;:46::i;:::-;208767:3;;208731:313;;;;209132:41;209145:1;209148:6;209156:16;209132:12;:41::i;:::-;208363:818;;;:::o;80912:218::-;81093:25;;;:29;;;80912:218::o;17285:444::-;17445:16;;;17459:1;17445:16;;;;;;;;;17394:7;;;;17445:16;;;;;;;;;;;;-1:-1:-1;17445:16:0;17419:42;;17472:12;17541:2;17535:4;17531:13;17637:2;17632;17624:6;17620:15;17613:4;17607:11;17602:3;17599:1;17592:4;17585:5;17581:16;17570:70;17559:81;;;17669:7;17661:33;;;;;;;;;;;;:::i;:::-;17712:6;17719:1;17712:9;;;;;;;;;;;;;;17705:16;;;;17285:444;;;;:::o;209224:1865::-;209459:37;209499:24;:6;:11;;;:22;:24::i;:::-;209578:15;;209459:64;;-1:-1:-1;209578:32:0;;209605:4;209578:32;209570:61;;;;;;;;;;;;:::i;:::-;209715:1;:12;;;209688:6;:23;;;:39;209680:71;;;;;;;;;;;;:::i;:::-;209796:6;:23;;;209770:6;:22;;;:49;;209762:82;;;;;;;;;;;;:::i;:::-;209868:22;;;;38424:77;-1:-1:-1;209855:94:0;;;;;;;;;;;;:::i;:::-;38710:6;210036:15;:68;210017:6;:16;;;:87;;;:191;;;;;38710:6;210140:15;:68;210121:6;:16;;;:87;;;210017:191;209995:258;;;;;;;;;;;;:::i;:::-;210331:88;210359:1;210362:6;:27;;;210391:6;:27;;;210331;:88::i;:::-;210309:159;;;;;;;;;;;;:::i;:::-;210526:99;210571:1;210587:6;210608;210526:30;:99::i;:::-;210664:14;210681:1;:11;;;210664:28;;210723:9;210708:66;210734:6;:22;;;210758:15;210708:66;;;;;;;:::i;:::-;;;;;;;;210802:22;;;;210787:12;;;:37;210841:28;;;;210837:205;;;210908:122;;;;;;;;;210956:15;210908:122;;;;;;;;;;;;;;;-1:-1:-1;210886:19:0;;;:8;;;:19;;;;;;:144;;;;;;;;;;;;;;;;;;;;;;;;210837:205;211080:1;211068:13;211054:11;;;;:27;;;;-1:-1:-1;;;209224:1865:0:o;211097:2620::-;211351:15;;;;211455:13;;211351:15;;;;;211320:28;;;;211444:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;211444:25:0;;211414:55;;211480:36;;:::i;:::-;211527:19;211560:6;:13;211549:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;211549:25:0;;211527:47;;211587:2123;211614:6;:13;211594:17;:33;211587:2123;;;211693:16;211733:6;211728:702;211749:6;:13;211745:1;:17;211728:702;;;211792:13;211806:1;211792:16;;;;;;;;;;;;;;;;;;211788:627;;211846:16;211842:554;;211904:6;211911:1;211904:9;;;;;;;;;;;;;;211891:22;;211963:1;211940:5;211946:13;;;;;;211940:20;;;;;;;;;;;;;:24;;;;;211842:554;;;212021:32;212056:6;212063:1;212056:9;;;;;;;;;;;;;;212021:44;;212116:10;:20;;;212096:40;;:6;:16;;;:40;;;:113;;;;;212189:10;:20;;;212169:40;;:6;:16;;;:40;;;212096:113;:192;;;;;212265:10;:23;;;212242:46;;:6;:19;;;:46;;;212096:192;212092:281;;;212344:1;212321:5;212327:13;;;;;;212321:20;;;;;;;;;;;;;:24;;;;;212092:281;211842:554;;211764:3;;211728:702;;;;212502:26;212542:11;212531:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;212531:23:0;;212502:52;;212569:20;212603:11;212617:1;212603:15;212592:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;212592:27:0;;212569:50;;212641:6;212636:640;212657:11;212653:1;:15;212636:640;;;212694:13;212710:5;212716:1;212710:8;;;;;;;;;;;;;;212694:24;;212810:4;212784:13;212798:8;212784:23;;;;;;;;;;;;;:30;;;;;;;;;;;213035:1;213004:16;213021:8;213004:26;;;;;;;;;;;;;;212999:32;;:37;;212981:12;212994:1;212981:15;;;;;;;;;;;;;:55;;;;;213086:32;213121:6;213128:8;213121:16;;;;;;;;;;;;;;213086:51;;213161:6;213156:105;213177:1;213173;:5;213156:105;;;213226:6;:12;;;213239:1;213226:15;;;;;;;;;;;213208:6;213221:1;213215;213217;213215:3;:7;213208:15;;;;;;;;;;;;;;;;;:33;213180:3;;213156:105;;;-1:-1:-1;;;212670:3:0;;212636:640;;;-1:-1:-1;213407:20:0;;213451;;;;213494:23;;;;;213352:248;;;;;:26;;;;;;:248;;213407:20;;213451;;213494:23;213540:12;;213575:6;;213352:248;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;213326:323;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;213666:32:0;;;;;211587:2123;;;211097:2620;;;;;;;;:::o;44878:927::-;44993:25;;:::i;:::-;45036:11;45080:28;:10;45036:11;45080:20;:28::i;:::-;45062:46;;;;45129:2;45119:12;45168:28;:10;45119:12;45168:20;:28::i;:::-;45142:23;;;;:54;;;;45207:12;45255:28;:10;45207:12;45255:20;:28::i;:::-;45230:22;;;:53;45304:2;45294:12;45336:27;:10;45294:12;45336:19;:27::i;:::-;45317:46;;;;:16;;;:46;45384:1;45374:11;;;;;45426:26;;:10;;45374:11;;45426:18;:26;:::i;:::-;45396:56;;:27;;;:56;45473:1;45463:11;45515:26;:10;45463:11;45515:18;:26::i;:::-;45485:56;;:27;;;:56;45562:1;45552:11;45610:27;:10;45552:11;45610:19;:27::i;:::-;45574:63;;;;:33;;;:63;45658:1;45648:11;;;;;45697:27;;:10;;45648:11;;45697:19;:27;:::i;:::-;45670:54;;:24;;;:54;45745:1;45735:11;44514:32;45764;;45757:40;;;;44878:927;;;;:::o;218866:1551::-;219068:60;;;;;;;;219111:17;;;219068:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;219046:4;;38888:6;219161:64;219143:15;:82;219139:977;;;219348:17;;;;219320:45;;;;:25;;;:45;219408:17;;;;;219380:45;;;:25;;;:45;219544:10;;;;:33;;;;;;;:10;;;;;:31;;:33;;;;;;;;;;:10;:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;219503:74;;;;219523:17;;;219503:74;;;;219504:17;;;219503:74;;;219592:39;219615:15;219592:39;;;219673:25;;;;219652:46;;;;;;:113;;;219740:4;:25;;;219719:46;;:4;:17;;;:46;;;;219652:113;219648:373;;;219791:214;219833:4;:17;;;219873:4;:17;;;219913:4;:25;;;219961:4;:25;;;219791:214;;;;;;;;;:::i;:::-;;;;;;;;219648:373;220080:24;;:17;;;:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;219139:977;220249:4;:17;;;220233:33;;:12;:33;;;:70;;;;;220286:4;:17;;;220270:33;;:12;:33;;;220233:70;220232:177;;;;220338:4;:25;;;220322:41;;:12;:41;;;:86;;;;;220383:4;:25;;;220367:41;;:12;:41;;;220322:86;220225:184;;;218866:1551;;;;;;:::o;213725:5133::-;213953:33;;;;:37;;;213949:4902;;214094:36;214133:204;;;;;;;;214196:1;:18;;;214133:204;;;;214244:6;:16;;;214133:204;;;;;;214286:6;214133:204;;;;214320:1;214133:204;;;214094:243;;214354:55;214424:25;214452:6;:20;;;214424:48;;214556:2;214542:12;214538:21;214515:44;;214646:6;:33;;;214616:63;;:19;:26;:63;214590:153;;;;;;;;;;;;:::i;:::-;214870:49;;;39328:2;214870:49;;;;;;;;;214814:15;;;;214870:49;;;;;;;;;;;-1:-1:-1;214870:49:0;214848:71;;214939:6;214934:3906;214955:19;:26;214951:1;:30;214934:3906;;;215347:2;215343:10;;;215310:45;;;;215304:52;215491:44;;;;;;215485:51;215584:2;215576:44;;215570:51;215159:20;215714:44;;;215708:51;215893:11;;;:21;;;215485:51;;215570;;215826:29;;;;215792:64;;;216033:21;;;;216025:61;;;;;;;;;;;;:::i;:::-;216120:7;216130:1;216120:11;216107:24;;216156:8;216152:65;;;216189:8;;;;;216152:65;216323:16;;;;216282:11;;;;:66;;216314:7;;216282:66;;216341:6;216282:31;:66::i;:::-;216413:35;216502:17;:6;216413:35;216502:14;:17::i;:::-;216451:87;;;;;;;;;;216413:125;-1:-1:-1;216557:17:0;216613:36;216603:6;:46;;;;;;;;;216599:2226;;;216674:213;216727:1;216755:3;216785:6;216818:12;216857:7;216674:26;:213::i;:::-;216599:2226;;;216927:39;216917:6;:49;;;;;;;;;216913:1912;;;216991:214;217045:1;217073:3;217103:6;217136:12;217175:7;216991:27;:214::i;216913:1912::-;217245:37;217235:6;:47;;;;;;;;;217231:1594;;;217307:214;217361:1;217389:3;217419:6;217452:12;217491:7;217307:27;:214::i;217231:1594::-;217561:43;217551:6;:53;;;;;;;;;217547:1278;;;217629:219;217688:1;217716:3;217746:6;217779:12;217818:7;217629:32;:219::i;217547:1278::-;217888:39;217878:6;:49;;;;;;;;;217874:951;;;217952:215;218007:1;218035:3;218065:6;218098:12;218137:7;217952:28;:215::i;217874:951::-;218207:37;218197:6;:47;;;;;;;;;218193:632;;;218269:213;218322:1;218350:3;218380:6;218413:12;218452:7;218269:26;:213::i;218193:632::-;218776:29;;;;;;;;;;:::i;218193:632::-;214934:3906;;;;;;214983:3;;214934:3906;;;;213949:4902;;;;;213725:5133;;;:::o;10475:338::-;10552:7;10598:6;10607:2;10598:11;10580:6;:13;:30;;10572:39;;;;;;-1:-1:-1;10703:30:0;;;10719:4;10703:30;10697:37;10736:27;10693:71;;10475:338;;;;;:::o;13827:304::-;13904:7;13950:6;13959:2;13950:11;13932:6;:13;:30;;13924:39;;;;;;-1:-1:-1;14051:30:0;14067:4;14051:30;14045:37;;13827:304::o;11712:290::-;11788:6;11833;11842:1;11833:10;11815:6;:13;:29;;11807:38;;;;;;-1:-1:-1;11926:29:0;11942:3;11926:29;11920:36;;11712:290::o;10821:287::-;10896:5;10940:6;10949:1;10940:10;10922:6;:13;:29;;10914:38;;;;;;-1:-1:-1;11032:29:0;11048:3;11032:29;11026:36;;10821:287::o;45813:1027::-;46021:9;46013:5;:17;46005:44;;;;;;;;;;;;:::i;:::-;46378:21;39393:2;46250:53;;;46368:32;;;;46362:39;46396:2;46345:15;;46338:64;39458:2;46568:53;;;46495:57;;;;46457:164;;;;46698:32;;;;;;46692:39;46675:2;46663:27;;46656:76;46798:21;46788:32;46782:39;46765:2;46753:27;;;46746:76;46641:192::o;73706:1514::-;74060:22;;:::i;:::-;74093:29;74100:4;74106:6;74114:7;74093:6;:29::i;:::-;74137:14;;;;:19;;74133:58;;74173:7;;;74133:58;74298:10;;74280:29;;74235:42;74280:29;;;:17;;;:29;;;;;;;;74310:15;;;;74280:46;;;;;;;;;;74235:91;;;;;;;;;;;;;;;;;;;;;;;;;74389:58;;;;;;;;;;;;:::i;:::-;74751:7;:14;;;74726:39;;:14;:21;;;:39;;;;74718:66;;;;;;;;;;;;:::i;:::-;74845:14;;;;74819:21;;:41;;:25;;;;;;:41::i;:::-;74795:65;;;;;75005:208;;75077:10;;75059:29;;;;;;:17;;;:29;;;;;;;;75089:15;;;;75059:46;;;;;;;;;75052:53;;;;;;75005:208;;;75156:10;;75138:29;;;;;;:17;;;:29;;;;;;;;75168:15;;;;75138:46;;;;;;;;;:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;75005:208;73706:1514;;;;;;;;:::o;190873:6224::-;191187:28;;:::i;:::-;191226:32;191233:4;191239:6;191247:10;191226:6;:32::i;:::-;191329:41;;:::i;:::-;191385:26;:10;:18;;;:24;;;:26::i;:::-;:51;;;;;191435:1;191415:10;:17;;;:21;;;191385:51;191381:298;;;191453:214;191506:3;191528:10;:24;;;191571:10;:18;;;191608;191624:1;191608:3;:11;;;:15;;:18;;;;:::i;:::-;191645:7;191453:34;:214::i;:::-;191691:38;191743:13;191732:52;;;;;;;;;;;;:::i;:::-;191691:93;;191866:23;191892:112;191922:7;:14;;;191951:7;:10;;;191976:7;:17;;;191892:15;:112::i;:::-;191866:138;;192207:15;192177:45;;;:10;:26;;;:45;;;;192169:81;;;;;;;;;;;;:::i;:::-;192331:10;;;;192315:26;;:13;;;:26;192372:14;;;;192352:17;;;:34;192420:17;;;;192397:20;;;:40;192468:14;;;;:19;;;:53;;192507:7;:14;;;192468:53;;;192490:10;:14;;;192468:53;192448:73;;:17;;;:73;192556:18;;;;192532:42;;:21;;;:42;192741:15;;;;:29;;;;:60;;-1:-1:-1;192774:13:0;;;;:27;;;;192741:60;192733:101;;;;;;;;;;;;:::i;:::-;192851:25;;192847:2610;;;;;192963:25;;192992:1;192963:30;192959:2498;;;193059:10;:21;;;193043:37;;:3;:13;;;:37;;;193035:68;;;;;;;;;;;;:::i;:::-;193144:10;:17;;;193126:35;;:10;:14;;;:35;;;;193118:71;;;;;;;;;;;;:::i;:::-;193284:14;193301:40;193308:3;:20;;;193330:10;193301:6;:40::i;:::-;193422:15;;;;193439:17;;;;193284:57;;-1:-1:-1;193400:65:0;;:1;;193422:15;193284:57;193400:21;:65::i;:::-;192959:2498;;;;193487:25;;193516:1;193487:30;;:64;;-1:-1:-1;193521:25:0;;193550:1;193521:30;193487:64;193483:1974;;;193833:10;:13;;;193814:32;;:10;:15;;;:32;;;193806:71;;;;;;;;;;;;:::i;:::-;193984:14;;;;:19;;;193976:44;;;;;;;;;;;;:::i;:::-;194045:20;;;;:27;:32;194037:71;;;;;;;;;;;;:::i;:::-;194225:24;;;;;194198:52;;194125:53;194198:52;;;:26;;;:52;;;;;;;194251:18;;;;194198:72;;;;;;;;;;194125:145;;;;;;;;;;;;;;;;;;;;;;;;;194291:31;194287:1093;;194347:25;;194376:1;194347:30;194343:384;;;194429:16;:22;;;194410:41;;:10;:15;;;:41;;;194402:71;;;;;;;;;;;;:::i;:::-;194343:384;;;194582:16;:22;;;194563:41;;:10;:15;;;:41;;;;194555:71;;;;;;;;;;;;:::i;:::-;194657:17;;;;:22;;;194649:58;;;;;;;;;;;;:::i;:::-;194847:24;;;;;194820:52;;;;;;;;:26;;;:52;;;;;;;194873:18;;;;194820:72;;;;;;;;;;194813:79;;;;;;194911:30;;;:32;;;;;;;;;;;;;;;;;;;194287:1093;;;195191:24;;;;:62;;;;:101;;;195278:14;:1;:12;:14::i;:::-;195161:203;;;;;;;;;;;;:::i;193483:1974::-;195412:33;;;;;;;;;;:::i;193483:1974::-;195564:15;;;;;195542:38;;;;195522:17;195542:38;;;:21;;;:38;;;;;;195581:13;;;;195542:53;;;;;;;;;195596:18;;;;195542:73;;;;;;;;;195616:17;;;;195542:92;;;;;;;;;195635:20;;;;195542:114;;;;;;;;;;;;;195671:23;;195667:973;;195768:20;;;;:27;:32;195759:72;;;;;;;;;;;;:::i;:::-;195894:25;;;:13;;;:25;196066:1;196046:17;;;:21;195667:973;;;196300:22;;196296:344;;;196424:13;;;;:27;;196416:67;;;;;;;;;;;;:::i;:::-;196615:13;;;;;196520:15;;;;;196498:38;;;;;;;;:21;;;:38;;;;;;196537:13;;196498:53;;;;;;;;;;196552:18;;;;196498:73;;;;;;;;;196572:17;;;;196498:92;;;;;;;;;196591:20;;;;196498:114;;;;;;;;;;:130;;;;;;;;;;;;;;196296:344;196714:10;:17;;;196694:7;:16;;;:37;;196686:75;;;;;;;;;;;;:::i;:::-;196841:1;:22;;;;196878:10;:15;;;196908:10;:13;;;196936:10;:18;;;196969:10;:17;;;197001:10;:20;;;197036:7;:16;;;197067:7;:11;;;196841:248;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;190873:6224;;;;;;;;;;:::o;77232:1097::-;77576:24;;:::i;:::-;77611:30;77618:4;77624:6;77632:8;77611:6;:30::i;:::-;77652:36;77702:13;77691:50;;;;;;;;;;;;:::i;:::-;77828:18;;;;77806:40;;:19;;;:40;77875:14;;;;77652:89;;-1:-1:-1;77875:19:0;;;:51;;77912:7;:14;;;77875:51;;;77897:8;:12;;;77875:51;77857:69;;:15;;;:69;77982:19;;;;77966:13;;;;:35;;;;;;;77958:64;;;;;;;;;;;;:::i;:::-;78057:8;:15;;;78041:31;;:8;:12;;;:31;;;;78033:65;;;;;;;;;;;;:::i;:::-;78145:14;78162:38;78169:3;:20;;;78191:8;78162:6;:38::i;:::-;78280:13;;;;78295:17;;78145:55;;-1:-1:-1;78258:63:0;;:1;;78280:13;78145:55;78258:21;:63::i;65891:1176::-;66241:34;;:::i;:::-;66286:35;66293:4;66299:6;66307:13;66286:6;:35::i;:::-;66332:41;66387:13;66376:55;;;;;;;;;;;;:::i;:::-;66523:18;;;;66496:45;;:24;;;:45;66575:14;;;;66332:99;;-1:-1:-1;66575:19:0;;;:56;;66617:7;:14;;;66575:56;;;66597:13;:17;;;66575:56;66552:79;;:20;;;:79;66687:24;;;;66671:13;;;;:40;;;;;;;66663:75;;;;;;;;;;;;:::i;:::-;66778:13;:20;;;66757:41;;:13;:17;;;:41;;;;66749:81;;;;;;;;;;;;:::i;:::-;66877:14;66894:43;66901:3;:20;;;66923:13;66894:6;:43::i;:::-;67012:19;;67033:17;;66877:60;;-1:-1:-1;66990:69:0;;:1;;67012:19;66877:60;66990:21;:69::i;70029:897::-;70378:23;;:::i;:::-;70412:28;70419:4;70425:6;70433;70412;:28::i;:::-;70451:37;70502:13;70491:51;;;;;;;;;;;;:::i;:::-;70451:91;;70608:7;:18;;;70592:34;;:3;:13;;;:34;;;70584:65;;;;;;;;;;;;:::i;:::-;70680:18;;;;70660:38;;:17;;;:38;70769:20;;70745:14;;70762:36;;70660:6;70762;:36::i;201370:3825::-;201713:19;;:::i;:::-;201743:26;201750:4;201756:6;201764:4;201743:6;:26::i;:::-;202288:41;;:::i;:::-;202344:202;202397:3;202419:4;:16;;;202454:4;:14;;;202487:18;202503:1;202487:3;:11;;;:15;;:18;;;;:::i;202344:202::-;202621:11;;;202610:8;;;:22;202660:13;;202677:1;202660:18;202656:2532;;;202747:8;;;;:13;;;202739:48;;;;;;;;;;;;:::i;:::-;202810:8;;;;:23;;;:28;;;202802:63;;;;;;;;;;;;:::i;:::-;202982:8;;;;:14;;;;202963:15;;:33;;;;;;;202955:71;;;;;;;;;;;;:::i;:::-;203145:7;;;;203124:29;;203079:42;203124:29;;;:20;;;:29;;;;;;;203154:8;;;;:16;;;;203079:42;;203124:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;203124:47:0;;;203172:8;;;;;:14;;;203124:63;;;;;;;;;;203188:8;;:14;;;203124:79;;;;;;;203079:124;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;203276:58:0;;;;;;;;;;;;:::i;:::-;203654:4;:11;;;203629:36;;:14;:21;;;:36;;;;203621:63;;;;;;;;;;;;:::i;:::-;203749:11;;;;203723:21;;:38;;:25;;;;;;:38::i;:::-;203699:62;;;;;203918:290;;203976:1;:20;;:29;203997:4;:7;;;203976:29;;;;;;;;;;;;;;;:47;204006:4;:8;;;:16;;;203976:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;203976:47:0;;;204024:8;;;;;:14;;;203976:63;;;;;;;;;;204040:8;;:14;;;203976:79;;;;;;;203969:86;;;;;;203918:290;;;204117:7;;;;204096:29;;;;;;:20;;;:29;;;;;;;204126:8;;;;:16;;;;204178:14;;204096:29;:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;204096:47:0;;;204144:8;;;;;:14;;;204096:63;;;;;;;;;;204160:8;;:14;;;204096:79;;;;;:96;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;203918:290;202656:2532;;;;204344:8;;;;:14;;;;204325:15;;:33;;;;;;;;204317:74;;;;;;;;;;;;:::i;:::-;204408:35;204457:13;204446:49;;;;;;;;;;;;:::i;:::-;204675:18;;;;204657:36;;:15;;;:36;204722:14;;;;204408:87;;-1:-1:-1;204722:19:0;;;:47;;204755:7;:14;;;204722:47;;;204744:4;:8;;;204722:47;204708:61;;:11;;;:61;204833:15;;;;204817:13;;;;:31;;;;;;;204809:59;;;;;;;;;;;;:::i;:::-;204903:4;:11;;;204891:23;;:4;:8;;;:23;;;;204883:56;;;;;;;;;;;;:::i;:::-;204994:14;205011:34;205018:3;:20;;;205040:4;205011:6;:34::i;:::-;205133:8;;;;:15;205150:17;;204994:51;;-1:-1:-1;205111:65:0;;:1;;205133:15;204994:51;205111:21;:65::i;202656:2532::-;201370:3825;;;;;;:::o;75228:804::-;75413:6;75477:36;75440:27;:4;75413:6;75440:18;:27::i;:::-;:74;;;75432:102;;;;;;;;;;;;:::i;:::-;75556:1;75545:12;75727:29;:4;75545:12;75727:20;:29::i;:::-;75714:42;;;;75778:2;75767:13;75813:28;:4;75767:13;75813:19;:28::i;:::-;75791:50;;;;:19;;;:50;75863:1;75852:12;;;;;75893:28;;:4;;75852:12;;75893:19;:28;:::i;:::-;75875:46;;:15;;;:46;75943:1;75932:12;75972:28;:4;75932:12;75972:19;:28::i;:::-;75955:45;;:14;;;;:45;;;;-1:-1:-1;;;75228:804:0:o;73040:201::-;73152:8;73191:1;73186:6;;:1;:6;;;;73178:32;;;;;;;;;;;;:::i;:::-;-1:-1:-1;73228:5:0;;;73040:201::o;197105:1321::-;197302:6;197366:39;197329:27;:4;197302:6;197329:18;:27::i;:::-;:77;;;197321:105;;;;;;;;;;;;:::i;:::-;197448:1;197437:12;197672:27;:4;197437:12;197672:18;:27::i;:::-;197644:55;;;;197721:1;197710:12;197751:29;:4;197710:12;197751:20;:29::i;:::-;197733:47;;:15;;;:47;197802:2;197791:13;197842:28;:4;197791:13;197842:19;:28::i;:::-;197815:55;;;;:24;;;:55;197892:1;197881:12;;;;;197925:28;;:4;;197881:12;;197925:19;:28;:::i;:::-;197904:49;;:18;;;:49;197975:1;197964:12;198007:28;:4;197964:12;198007:19;:28::i;:::-;197987:48;;:17;;;:48;198057:2;198046:13;198094:28;:4;198046:13;198094:19;:28::i;:::-;198070:52;;:21;;;:52;198144:1;198133:12;198173:44;:28;:4;198133:12;198173:19;:28::i;:::-;:42;;;:44::i;:::-;198156:61;;:14;;;:61;198239:1;198228:12;198274:28;:4;198228:12;198274:19;:28::i;:::-;198251:51;;;;:20;;;:51;198324:1;198313:12;;;;;198365:29;;:4;;198313:12;;198365:20;:29;:::i;:::-;198336:58;;:26;;;;:58;;;;-1:-1:-1;;;197105:1321:0:o;88835:176::-;39511:7;88961:42;;;;;88835:176;;;:::o;4045:193::-;4153:4;4188:1;4183;:6;;4175:32;;;;;;;;;;;;:::i;186494:1152::-;187256:183;187282:3;187300:9;187324:7;187346:5;187366:40;187421:7;187256:11;:183::i;:::-;187452:186;187478:3;187496:9;187520:7;187542:5;187550:1;187542:9;187566:39;187620:7;187452:11;:186::i;199288:510::-;199455:7;199708:6;199733:2;199754:9;199673:105;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;199649:140;;;;;;199634:156;;199288:510;;;;;:::o;198434:846::-;198585:7;198617:655;198649:16;189929:209;198783:10;:15;;;198821:10;:24;;;198868:10;:18;;;198909:10;:17;;;198949:10;:21;;;198993:10;:17;;;199033:10;:13;;;199079:10;:20;;;199069:31;;;;;;199123:10;:17;;;199163:10;:21;;;199207:10;:20;;;198708:538;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;198680:581;;;;;;198617:17;:655::i;64197:630::-;64416:20;;;64408:47;;;;;;;;;;;;:::i;:::-;64561:16;;:20;64557:263;;64606:41;:6;64629;64637:9;64606:22;:41::i;:::-;64598:71;;;;;;;;;;;;:::i;:::-;64557:263;;;64710:20;;;;;;;:12;;;:20;;;;;;;;:28;;;;;;;;;;;64702:56;;;;;;;;;;;;:::i;:::-;64780:20;;;;;;;:12;;;:20;;;;;;;;:28;;;;;;;;64773:35;;;;;;64557:263;64197:630;;;;:::o;81138:199::-;81302:23;;;:27;;;81138:199::o;78337:1448::-;78520:6;78584:37;78547:27;:4;78520:6;78547:18;:27::i;:::-;:75;;;78539:103;;;;;;;;;;;;:::i;:::-;78664:1;78653:12;78740:27;:4;78653:12;78740:18;:27::i;:::-;:32;;78771:1;78740:32;78732:71;;;;;;;;;;;;:::i;:::-;78825:1;78814:12;79046:28;:4;78814:12;79046:19;:28::i;:::-;79021:53;;;;;;79096:1;79085:12;;;;;79131:28;;:4;;79085:12;;79131:19;:28;:::i;:::-;79108:51;;;;:20;;;:51;79181:1;79170:12;;;;;79212:28;;:4;;79170:12;;79212:19;:28;:::i;:::-;79193:47;;:16;;;:47;79262:1;79251:12;79292:44;:28;:4;79251:12;79292:19;:28::i;:::-;:42;;;:44::i;:::-;79274:62;;:15;;;:62;79358:1;79347:12;79392:28;:4;79347:12;79392:19;:28::i;:::-;79370:50;;:19;;;:50;79442:1;79431:12;79469:44;:28;:4;79431:12;79469:19;:28::i;:44::-;79454:59;;:12;;;:59;79535:1;79524:12;79568:28;:4;79524:12;79568:19;:28::i;:::-;79547:49;;;;:18;;;:49;79618:1;79607:12;;;;;79644:29;;:4;;79607:12;;79644:20;:29;:::i;:::-;79630:43;;:11;;;:43;79695:2;79684:13;79724:29;:4;79684:13;79724:20;:29::i;:::-;79708:45;;:13;;;;:45;;;;-1:-1:-1;;;78337:1448:0:o;79793:683::-;79940:7;79972:496;80004:16;76568:158;80136:8;:13;;;80172:8;:11;;;80206:8;:16;;;80245:8;:15;;;80283:8;:19;;;80325:8;:15;;;80363:8;:19;;;80405:8;:18;;;80063:379;;;;;;;;;;;;;;;;:::i;67075:1235::-;67268:6;67332:43;67295:27;:4;67268:6;67295:18;:27::i;:::-;:81;;;67287:109;;;;;;;;;;;;:::i;:::-;67418:1;67407:12;67492:27;:4;67407:12;67492:18;:27::i;:::-;:32;;67523:1;67492:32;67484:71;;;;;;;;;;;;:::i;:::-;67577:1;67566:12;67803:29;:4;67566:12;67803:20;:29::i;:::-;67781:51;;;;67854:2;67843:13;67893:28;:4;67843:13;67893:19;:28::i;:::-;67867:54;;;;:23;;;:54;67943:1;67932:12;;;;;67982:28;;:4;;67932:12;;67982:19;:28;:::i;:::-;67955:55;;:24;;;:55;68032:1;68021:12;68064:44;:28;:4;68021:12;68064:19;:28::i;:44::-;68044:64;;:17;;;:64;68130:1;68119:12;68168:26;:4;68119:12;68168:17;:26::i;:::-;68142:23;;;:52;68216:2;68205:13;68251:28;:4;68205:13;68251:19;:28::i;:::-;68229:50;;:19;;;;:50;;;;-1:-1:-1;;;67075:1235:0:o;68318:701::-;68475:7;68507:504;68539:16;65295:155;68676:13;:19;;;68718:13;:23;;;68764:13;:24;;;68811:13;:20;;;68854:13;:23;;;68900:13;:24;;;68947:13;:19;;;68598:387;;;;;;;;;;;;;;;:::i;70934:1041::-;71116:6;71180:39;71143:27;:4;71116:6;71143:18;:27::i;:::-;:77;;;71135:105;;;;;;;;;;;;:::i;:::-;71262:1;71251:12;71435:29;:4;71251:12;71435:20;:29::i;:::-;71420:44;;;;71486:2;71475:13;71518:28;:4;71475:13;71518:19;:28::i;:::-;71499:47;;;;:16;;;:47;71568:1;71557:12;;;;;71597:28;;:4;;71557:12;;71597:19;:28;:::i;:::-;71580:45;;:14;;;:45;71647:1;71636:12;71676:27;:4;71636:12;71676:18;:27::i;:::-;71659:44;;:14;;;:44;71725:1;71714:12;71758:28;:4;71714:12;71758:19;:28::i;:::-;71737:49;;:18;;;:49;71808:2;71797:13;71836:28;:4;71797:13;71836:19;:28::i;:::-;71821:43;;;;:12;;;:43;71886:1;71875:12;;;;;71915:28;;:4;;71875:12;;71915:19;:28;:::i;:::-;71898:45;;:14;;;;:45;;;;-1:-1:-1;;;70934:1041:0:o;71983:637::-;72129:7;72161:451;72193:16;69471:149;72326:6;:12;;;72361:6;:16;;;72400:6;:14;;;72437:6;:14;;;72474:6;:18;;;72515:6;:17;;;72555:6;:12;;;72252:334;;;;;;;;;;;;;;;:::i;205203:1354::-;205385:6;205463:37;205426:27;:4;205385:6;205426:18;:27::i;:::-;:75;;;205404:140;;;;;;;;;;;;:::i;:::-;205566:1;205555:12;205596:27;:4;205555:12;205596:18;:27::i;:::-;205580:43;;;;;205645:1;205634:12;;;;;205707:52;;;;;;;;;;;;:::i;:::-;205939:28;:4;205959:7;205939:19;:28::i;:::-;205916:51;;;;:20;;;:51;205989:1;205978:12;;;;;206018:28;;:4;;205978:12;;206018:19;:28;:::i;:::-;206001:45;;:14;;;:45;206068:1;206057:12;206098:28;:4;206057:12;206098:19;:28::i;:::-;206080:46;;:15;;;:46;206148:1;206137:12;206171:44;:28;:4;206137:12;206171:19;:28::i;:44::-;206160:55;;:8;;;:55;206237:1;206226:12;206263:28;:4;206226:12;206263:19;:28::i;:::-;206249:42;;:11;;;:42;206313:2;206302:13;206343:28;:4;206302:13;206343:19;:28::i;:::-;206326:45;;;;:14;;;:45;206393:1;206382:12;;;;;206424:28;;:4;;206382:12;;206424:19;:28;:::i;:::-;206405:47;;;;:16;;;:47;206474:1;206463:12;;;;;206496:29;;:4;;206463:12;;206496:20;:29;:::i;:::-;206486:39;;:7;;;;:39;;;;-1:-1:-1;;;205203:1354:0:o;4246:191::-;4382:5;;;4406:6;;;;4398:31;;;;;;;;;;;;:::i;206565:782::-;206714:7;206746:593;206778:16;200381:207;206909:4;:8;;;:15;;;206947:4;:7;;;206977:4;:8;;;:16;;;207016:4;:8;;;:14;;;207053:4;:8;;;:14;;;207090:4;:8;;;:23;;;207136:4;:11;;;207170:4;:15;;;207208:4;:11;;;207242:4;:15;;;207280:4;:14;;;206837:476;;;;;;;;;;;;;;;;;;;:::i;14443:244::-;14611:29;14627:3;14611:29;14605:36;;14443:244::o;14141:294::-;14325:30;14341:4;14325:30;14319:37;14358:27;14315:71;;;14141:294::o;15205:247::-;15376:29;15392:3;15376:29;15370:36;;15205:247::o;14695:::-;14866:29;14882:3;14866:29;14860:36;;14695:247::o;15715:::-;15886:29;15902:3;15886:29;15880:36;;15715:247::o;57603:299::-;57706:6;57755:4;57745:14;;57771:13;57782:2;57771:13;;;;57764:2;:21;57744:42;57814:5;57806:13;;57798:65;;;;;;;;;;;;:::i;16747:260::-;16927:30;16943:4;16927:30;16921:37;;16747:260::o;187654:1001::-;188115:49;;;39328:2;188115:49;;;;;;;;;188093:19;;188115:49;;;;;;;;-1:-1:-1;;;188220:9:0;;;;:19;;;;188175:14;;;;;188093:71;;-1:-1:-1;188175:73:0;;:14;188210:8;;188175:73;;188093:71;188175:34;:73::i;:::-;188259:45;188285:6;188293:1;188296:7;188259:25;:45::i;:::-;188498:14;188492:21;;;;;;;;188474:39;;:7;:14;;;:39;;;:86;;;;;188551:9;188530:30;;:7;:17;;;:30;;;188474:86;:129;;;;;188596:7;188577:26;;:7;:15;;;:26;;;188474:129;188452:195;;;;;;;;;;;;:::i;47779:341::-;47921:7;48012:13;;;;;;;;;;;;;;;;;48044:15;48078:8;47977:124;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;47953:159;;;;;;47946:166;;47779:341;;;;:::o;60335:448::-;60522:4;60548:20;;;60544:65;;-1:-1:-1;60592:5:0;60585:12;;60544:65;60628:19;:6;:17;;;:19::i;:::-;:147;;60728:47;60747:8;60757:6;60765:9;60728:18;:47::i;:::-;60628:147;;;60662:51;60685:8;60695:6;60703:9;60662:22;:51::i;:::-;60621:154;60335:448;-1:-1:-1;;;;60335:448:0:o;14950:247::-;15121:29;15137:3;15121:29;15115:36;;14950:247::o;58305:301::-;58408:6;58457;58447:16;;58475:13;58486:2;58475:13;;;;58468:2;:21;58446:44;58518:5;58510:13;;58502:65;;;;;;;;;;;;:::i;185006:1480::-;185191:6;185269:37;185232:27;:4;185191:6;185232:18;:27::i;:::-;:75;;;185210:140;;;;;;;;;;;;:::i;:::-;185372:1;185361:12;185403:27;:4;185361:12;185403:18;:27::i;:::-;185386:44;;;;185452:1;185441:12;185668:28;:4;185441:12;185668:19;:28::i;:::-;185648:48;;;;:17;;;:48;185718:1;185707:12;;;;;185748:28;;:4;;185707:12;;185748:19;:28;:::i;:::-;185730:46;;:15;;;:46;185798:1;185787:12;185830:26;:4;185787:12;185830:17;:26::i;:::-;185810:11;;;;;:17;:46;185878:2;185867:13;185920:27;:4;185867:13;185920:18;:27::i;:::-;185891:11;;;;:56;;;;:26;;;;:56;185969:1;185958:12;186024:27;:4;185958:12;186024:18;:27::i;:::-;186003:49;;;;;;;;;;185981:7;:11;;;:19;;:71;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;186092:14:0;;186074:1;186063:12;;;;;186092:65;;186088:367;;186195:29;:4;186216:7;186195:20;:29::i;:::-;186174:11;;;;:50;;;;;;186088:367;;;186246:14;;:64;;186270:39;186246:64;186242:213;;;186347:29;:4;186368:7;186347:20;:29::i;:::-;186327:11;;;;:49;;;;:17;;;;:49;186242:213;;;186409:34;;;;;;;;;;:::i;397:638::-;501:4;875:17;;912:15;;;;;:114;;-1:-1:-1;960:66:0;948:78;;;904:123;-1:-1:-1;;397:638:0:o;61915:1232::-;62104:12;62138:20;;;62134:65;;-1:-1:-1;62182:5:0;62175:12;;62134:65;62238:16;;62211:24;;62238:23;;62259:1;62238:20;:23::i;:::-;62211:50;-1:-1:-1;62272:27:0;62316:38;:9;62211:50;62316:17;:38::i;:::-;62302:53;;;;;;;;;;62468:38;;;62272:83;-1:-1:-1;62550:21:0;62533:13;:38;;;;;;;;;62529:450;;;62609:39;62628:8;62638:9;62609:18;:39::i;:::-;62599:49;;:6;:49;;;62588:61;;62529:450;;;62688:22;62671:13;:39;;;;;;;;;62667:312;;;62727:12;62823:8;62770:62;;;;;;;;:::i;:::-;;;;;;;;;;;;;62742:105;;;;;;62727:120;;62883:35;62902:4;62908:9;62883:18;:35::i;:::-;62873:45;;:6;:45;;;62862:57;;62667:312;;;;62962:5;62952:15;;62667:312;-1:-1:-1;63099:1:0;63074:27;63056:46;;61915:1232;;;;;:::o;63155:581::-;63334:4;63356:21;63417:33;;;63465:8;63488:9;63380:128;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;63356:152;;63520:12;63534:19;63557:6;:17;;63575:8;63557:27;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;63519:65;;;;63617:7;:43;;;;;63641:6;:13;63658:2;63641:19;63617:43;:100;;;;-1:-1:-1;63699:18:0;63677;:6;63693:1;63677:15;:18::i;:::-;:40;;;63617:100;63595:133;63155:581;-1:-1:-1;;;;;;;63155:581:0:o;60791:1116::-;60945:7;60974:9;:16;60994:2;60974:22;60970:72;;-1:-1:-1;61028:1:0;61013:17;;60970:72;61379:4;61364:20;;61358:27;61425:4;61410:20;;61404:27;61475:4;61460:20;;61454:27;61483:4;61450:38;61642:66;61629:79;;61625:129;;;61740:1;61725:17;;;;;;;61625:129;61768:1;:7;;61773:2;61768:7;:18;;;;61779:1;:7;;61784:2;61779:7;61768:18;61764:136;;;61810:28;61820:8;61830:1;61833;61836;61810:28;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;61803:35;;;;;;;61764:136;61886:1;61871:17;;;;;;;13210:297;13286:6;13331;13340:1;13331:10;13313:6;:13;:29;;13305:38;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;14:202:1:-;95:13;;148:42;137:54;;127:65;;117:2;;206:1;203;196:12;221:720;;329:3;322:4;314:6;310:17;306:27;296:2;;351:5;344;337:20;296:2;388;382:9;410:3;452:2;444:6;440:15;521:6;509:10;506:22;485:18;473:10;470:34;467:62;464:2;;;532:9;464:2;559;552:22;594:6;620;641:15;;;638:24;-1:-1:-1;635:2:1;;;679:5;672;665:20;635:2;705:5;696:14;;719:192;733:4;730:1;727:11;719:192;;;792:17;;780:30;;753:1;746:9;;;;;833:4;857:12;;;;889;719:192;;;-1:-1:-1;929:6:1;;286:655;-1:-1:-1;;;;;286:655:1:o;946:132::-;1013:20;;1042:30;1013:20;1042:30;:::i;1083:136::-;1161:13;;1183:30;1161:13;1183:30;:::i;1224:485::-;;1321:3;1314:4;1306:6;1302:17;1298:27;1288:2;;1343:5;1336;1329:20;1288:2;1383:6;1370:20;1414:49;1429:33;1459:2;1429:33;:::i;:::-;1414:49;:::i;:::-;1488:2;1479:7;1472:19;1534:3;1527:4;1522:2;1514:6;1510:15;1506:26;1503:35;1500:2;;;1555:5;1548;1541:20;1500:2;1624;1617:4;1609:6;1605:17;1598:4;1589:7;1585:18;1572:55;1647:16;;;1665:4;1643:27;1636:42;;;;1651:7;1278:431;-1:-1:-1;;1278:431:1:o;1714:447::-;;1822:3;1815:4;1807:6;1803:17;1799:27;1789:2;;1844:5;1837;1830:20;1789:2;1877:6;1871:13;1908:49;1923:33;1953:2;1923:33;:::i;1908:49::-;1982:2;1973:7;1966:19;2028:3;2021:4;2016:2;2008:6;2004:15;2000:26;1997:35;1994:2;;;2049:5;2042;2035:20;1994:2;2066:64;2127:2;2120:4;2111:7;2107:18;2100:4;2092:6;2088:17;2066:64;:::i;2166:744::-;;2301:4;2289:9;2284:3;2280:19;2276:30;2273:2;;;2323:5;2316;2309:20;2273:2;2360;2354:9;2402:4;2394:6;2390:17;2426:18;2494:6;2482:10;2479:22;2474:2;2462:10;2459:18;2456:46;2453:2;;;2505:9;2453:2;2536:10;2532:2;2525:22;2565:6;2556:15;;2600:9;2594:16;2580:30;;2633:2;2625:6;2622:14;2619:2;;;2649:1;2646;2639:12;2619:2;;2677:58;2731:3;2722:6;2711:9;2707:22;2677:58;:::i;:::-;2669:6;2662:74;;2769:50;2815:2;2804:9;2800:18;2769:50;:::i;:::-;2764:2;2756:6;2752:15;2745:75;2853:50;2899:2;2888:9;2884:18;2853:50;:::i;:::-;2848:2;2840:6;2836:15;2829:75;;2263:647;;;;:::o;2915:161::-;2984:20;;3044:6;3033:18;;3023:29;;3013:2;;3066:1;3063;3056:12;3081:169;3161:13;;3214:10;3203:22;;3193:33;;3183:2;;3240:1;3237;3230:12;3255:134;3323:20;;3352:31;3323:20;3352:31;:::i;3394:185::-;3474:13;;3527:26;3516:38;;3506:49;;3496:2;;3569:1;3566;3559:12;3584:257;;3704:2;3692:9;3683:7;3679:23;3675:32;3672:2;;;3725:6;3717;3710:22;3672:2;3762:9;3756:16;3781:30;3805:5;3781:30;:::i;3846:421::-;;4013:2;4001:9;3992:7;3988:23;3984:32;3981:2;;;4034:6;4026;4019:22;3981:2;4072:9;4066:16;4105:18;4097:6;4094:30;4091:2;;;4142:6;4134;4127:22;4091:2;4170:91;4253:7;4244:6;4233:9;4229:22;4170:91;:::i;4272:891::-;;4435:2;4423:9;4414:7;4410:23;4406:32;4403:2;;;4456:6;4448;4441:22;4403:2;4494:9;4488:16;4523:18;4564:2;4556:6;4553:14;4550:2;;;4585:6;4577;4570:22;4550:2;4613:22;;;;4669:4;4651:16;;;4647:27;4644:2;;;4692:6;4684;4677:22;4644:2;4730:4;4724:11;4774:4;4766:6;4762:17;4829:6;4817:10;4814:22;4809:2;4797:10;4794:18;4791:46;4788:2;;;4840:9;4788:2;4867:4;4860:24;4909:9;;4930:16;;;4927:2;;;4964:6;4956;4949:22;4927:2;4997:57;5046:7;5035:8;5031:2;5027:17;4997:57;:::i;:::-;4989:6;4982:73;;5088:43;5127:2;5123;5119:11;5088:43;:::i;:::-;5083:2;5071:15;;5064:68;5075:6;4393:770;-1:-1:-1;;;;;4393:770:1:o;5589:2227::-;;;5790:2;5778:9;5769:7;5765:23;5761:32;5758:2;;;5811:6;5803;5796:22;5758:2;5852:9;5839:23;5829:33;;5881:2;5934;5923:9;5919:18;5906:32;5957:18;5998:2;5990:6;5987:14;5984:2;;;6019:6;6011;6004:22;5984:2;6062:6;6051:9;6047:22;6037:32;;6107:7;6100:4;6096:2;6092:13;6088:27;6078:2;;6134:6;6126;6119:22;6078:2;6175;6162:16;6197:2;6193;6190:10;6187:2;;;6203:9;6187:2;6234:36;6266:2;6261;6257;6253:11;6249:20;6234:36;:::i;:::-;6304:15;;;6335:12;;;;6367:11;;;6396:6;6411:1375;6425:2;6422:1;6419:9;6411:1375;;;6501:3;6488:17;6484:2;6480:26;6617:6;6548:66;6543:2;6534:7;6530:16;6526:89;6522:102;6519:2;;;6642:6;6634;6627:22;6519:2;6677:22;6692:6;6677:22;:::i;:::-;6726:31;6753:2;6749;6745:11;6726:31;:::i;:::-;6719:5;6712:46;6794:32;6822:2;6818;6814:11;6794:32;:::i;:::-;6789:2;6782:5;6778:14;6771:56;6863:31;6890:2;6886;6882:11;6863:31;:::i;:::-;6858:2;6851:5;6847:14;6840:55;6945:3;6941:2;6937:12;6924:26;6979:2;6969:8;6966:16;6963:2;;;7000:6;6992;6985:22;6963:2;7045:55;7092:7;7087:2;7076:8;7072:2;7068:17;7064:26;7045:55;:::i;:::-;7040:2;7033:5;7029:14;7022:79;;7138:53;7183:7;7176:4;7172:2;7168:13;7138:53;:::i;:::-;7132:3;7125:5;7121:15;7114:78;7230:31;7256:3;7252:2;7248:12;7230:31;:::i;:::-;7223:4;7216:5;7212:16;7205:57;7312:3;7308:2;7304:12;7291:26;7346:2;7336:8;7333:16;7330:2;;;7367:6;7359;7352:22;7330:2;7414:55;7461:7;7456:2;7445:8;7441:2;7437:17;7433:26;7414:55;:::i;:::-;7407:4;7400:5;7396:16;7389:81;;7520:6;7516:2;7512:15;7499:29;7557:2;7547:8;7544:16;7541:2;;;7578:6;7570;7563:22;7541:2;7625:55;7672:7;7667:2;7656:8;7652:2;7648:17;7644:26;7625:55;:::i;:::-;7618:4;7607:16;;7600:81;-1:-1:-1;7694:18:1;;-1:-1:-1;7732:12:1;;;;7764;;;;6443:1;6436:9;6411:1375;;;-1:-1:-1;5748:2068:1;;7805:5;;-1:-1:-1;5748:2068:1;-1:-1:-1;;;;;;;;5748:2068:1:o;8242:1295::-;;8407:2;8395:9;8386:7;8382:23;8378:32;8375:2;;;8428:6;8420;8413:22;8375:2;8466:9;8460:16;8495:18;8536:2;8528:6;8525:14;8522:2;;;8557:6;8549;8542:22;8522:2;8600:6;8589:9;8585:22;8575:32;;8626:6;8666:2;8661;8652:7;8648:16;8644:25;8641:2;;;8687:6;8679;8672:22;8641:2;8718:18;8733:2;8718:18;:::i;:::-;8705:31;;8759:32;8788:2;8759:32;:::i;:::-;8752:5;8745:47;8838:2;8834;8830:11;8824:18;8819:2;8812:5;8808:14;8801:42;8882:2;8878;8874:11;8868:18;8911:2;8901:8;8898:16;8895:2;;;8932:6;8924;8917:22;8895:2;8973:57;9022:7;9011:8;9007:2;9003:17;8973:57;:::i;:::-;8968:2;8961:5;8957:14;8950:81;;9077:2;9073;9069:11;9063:18;9058:2;9051:5;9047:14;9040:42;9115:45;9155:3;9151:2;9147:12;9115:45;:::i;:::-;9109:3;9102:5;9098:15;9091:70;9200:3;9196:2;9192:12;9186:19;9230:2;9220:8;9217:16;9214:2;;;9251:6;9243;9236:22;9214:2;9293:57;9342:7;9331:8;9327:2;9323:17;9293:57;:::i;:::-;9287:3;9280:5;9276:15;9269:82;;9384:44;9423:3;9419:2;9415:12;9384:44;:::i;:::-;9378:3;9371:5;9367:15;9360:69;9462:44;9501:3;9497:2;9493:12;9462:44;:::i;:::-;9456:3;9445:15;;9438:69;9449:5;8365:1172;-1:-1:-1;;;;;8365:1172:1:o;9542:391::-;;;9678:2;9666:9;9657:7;9653:23;9649:32;9646:2;;;9699:6;9691;9684:22;9646:2;9736:9;9730:16;9755:31;9780:5;9755:31;:::i;:::-;9855:2;9840:18;;9834:25;9805:5;;-1:-1:-1;9868:33:1;9834:25;9868:33;:::i;:::-;9920:7;9910:17;;;9636:297;;;;;:::o;9938:129::-;10017:42;10006:54;9994:67;;9984:83::o;10072:443::-;;10169:5;10163:12;10196:6;10191:3;10184:19;10222:4;10251:2;10246:3;10242:12;10235:19;;10288:2;10281:5;10277:14;10309:3;10321:169;10335:6;10332:1;10329:13;10321:169;;;10396:13;;10384:26;;10430:12;;;;10465:15;;;;10357:1;10350:9;10321:169;;;-1:-1:-1;10506:3:1;;10139:376;-1:-1:-1;;;;;10139:376:1:o;10520:318::-;;10601:5;10595:12;10628:6;10623:3;10616:19;10644:63;10700:6;10693:4;10688:3;10684:14;10677:4;10670:5;10666:16;10644:63;:::i;:::-;10752:2;10740:15;10757:66;10736:88;10727:98;;;;10827:4;10723:109;;10571:267;-1:-1:-1;;10571:267:1:o;10843:132::-;10925:1;10918:5;10915:12;10905:2;;10931:9;10905:2;10951:18;;10895:80::o;10980:96::-;11058:10;11047:22;11035:35;;11025:51::o;11081:112::-;11159:26;11148:38;11136:51;;11126:67::o;11198:274::-;;11365:6;11359:13;11381:53;11427:6;11422:3;11415:4;11407:6;11403:17;11381:53;:::i;:::-;11450:16;;;;;11335:137;-1:-1:-1;;11335:137:1:o;11477:439::-;;11702:6;11696:13;11718:53;11764:6;11759:3;11752:4;11744:6;11740:17;11718:53;:::i;:::-;11793:16;;;;11818:21;;;-1:-1:-1;11866:4:1;11855:16;;11848:32;11907:2;11896:14;;11672:244;-1:-1:-1;11672:244:1:o;11921:380::-;12163:66;12151:79;;12255:2;12246:12;;12239:28;;;;12292:2;12283:12;;12141:160::o;12306:493::-;;12521:6;12516:3;12509:19;12579:66;12570:6;12566:2;12562:15;12558:88;12553:2;12548:3;12544:12;12537:110;12676:6;12670:13;12692:60;12745:6;12740:2;12735:3;12731:12;12726:2;12718:6;12714:15;12692:60;:::i;:::-;12772:16;;;;12790:2;12768:25;;12499:300;-1:-1:-1;;;;12499:300:1:o;12804:1171::-;13257:25;;;13301:42;13379:15;;;13374:2;13359:18;;13352:43;13431:15;;;13426:2;13411:18;;13404:43;13244:3;13229:19;;;13456:54;13506:2;13491:18;;13483:6;13456:54;:::i;:::-;13547:15;;13541:3;13526:19;;13519:44;13594:3;13579:19;;13572:35;;;13656:4;13644:17;;13638:3;13623:19;;13616:46;13711:26;13699:39;;13693:3;13678:19;;13671:68;13788:6;13776:19;;13770:3;13755:19;;13748:48;13805;13848:3;13833:19;;13825:6;13805:48;:::i;:::-;13862:49;13906:3;13895:9;13891:19;13882:7;13862:49;:::i;:::-;13920;13964:3;13953:9;13949:19;13940:7;13920:49;:::i;:::-;13211:764;;;;;;;;;;;;;;;:::o;13980:971::-;14339:25;;;14383:42;14461:15;;;14456:2;14441:18;;14434:43;14513:15;;;;14508:2;14493:18;;14486:43;14548:6;14590:15;;;14585:2;14570:18;;14563:43;14625:26;14688:15;;;14682:3;14667:19;;14660:44;14741:15;;14735:3;14720:19;;14713:44;14794:15;14788:3;14773:19;;14766:44;14829:10;14876:15;;;14870:3;14855:19;;14848:44;14929:15;14923:3;14908:19;;14901:44;14326:3;14311:19;;14293:658::o;14956:827::-;15285:25;;;15358:42;15346:55;;;;15341:2;15326:18;;15319:83;15421:10;15467:15;;;15462:2;15447:18;;15440:43;15531:6;15519:19;;;;15514:2;15499:18;;15492:47;15588:4;15576:17;;;;15570:3;15555:19;;15548:46;15643:26;15631:39;15625:3;15610:19;;15603:68;15708:15;;15702:3;15687:19;;15680:44;15761:15;15755:3;15740:19;;15733:44;15272:3;15257:19;;15239:544::o;15788:1169::-;16231:25;;;16304:42;16292:55;;16287:2;16272:18;;16265:83;16396:10;16384:23;;16379:2;16364:18;;16357:51;16427:6;16469:15;;;16464:2;16449:18;;16442:43;16504:26;16567:15;;;16561:3;16546:19;;16539:44;16620:15;;;16614:3;16599:19;;16592:44;16673:15;;16667:3;16652:19;;16645:44;16218:3;16203:19;;16698:49;16742:3;16727:19;;16719:6;16698:49;:::i;:::-;16784:6;16778:3;16767:9;16763:19;16756:35;16828:6;16822:3;16811:9;16807:19;16800:35;16844:49;16888:3;16877:9;16873:19;16864:7;16844:49;:::i;16962:820::-;17295:25;;;17368:42;17356:55;;;;17351:2;17336:18;;17329:83;17431:10;17477:15;;;17472:2;17457:18;;17450:43;17541:6;17529:19;;;;17524:2;17509:18;;17502:47;17598:26;17586:39;;;;17580:3;17565:19;;17558:68;17657:3;17642:19;;17635:35;17707:15;;17701:3;17686:19;;17679:44;17760:15;17754:3;17739:19;;17732:44;17282:3;17267:19;;17249:533::o;17787:248::-;17961:25;;;18017:2;18002:18;;17995:34;17949:2;17934:18;;17916:119::o;18040:290::-;;18215:6;18204:9;18197:25;18258:2;18253;18242:9;18238:18;18231:30;18278:46;18320:2;18309:9;18305:18;18297:6;18278:46;:::i;18335:398::-;18562:25;;;18635:4;18623:17;;;;18618:2;18603:18;;18596:45;18672:2;18657:18;;18650:34;18715:2;18700:18;;18693:34;18549:3;18534:19;;18516:217::o;18738:402::-;18940:2;18922:21;;;18979:2;18959:18;;;18952:30;19018:34;19013:2;18998:18;;18991:62;19089:8;19084:2;19069:18;;19062:36;19130:3;19115:19;;18912:228::o;19145:341::-;19347:2;19329:21;;;19386:2;19366:18;;;19359:30;19425:19;19420:2;19405:18;;19398:47;19477:2;19462:18;;19319:167::o;19491:340::-;19693:2;19675:21;;;19732:2;19712:18;;;19705:30;19771:18;19766:2;19751:18;;19744:46;19822:2;19807:18;;19665:166::o;19836:342::-;20038:2;20020:21;;;20077:2;20057:18;;;20050:30;20116:20;20111:2;20096:18;;20089:48;20169:2;20154:18;;20010:168::o;20183:343::-;20385:2;20367:21;;;20424:2;20404:18;;;20397:30;20463:21;20458:2;20443:18;;20436:49;20517:2;20502:18;;20357:169::o;20531:346::-;20733:2;20715:21;;;20772:2;20752:18;;;20745:30;20811:24;20806:2;20791:18;;20784:52;20868:2;20853:18;;20705:172::o;20882:338::-;21084:2;21066:21;;;21123:2;21103:18;;;21096:30;21162:16;21157:2;21142:18;;21135:44;21211:2;21196:18;;21056:164::o;21225:345::-;21427:2;21409:21;;;21466:2;21446:18;;;21439:30;21505:23;21500:2;21485:18;;21478:51;21561:2;21546:18;;21399:171::o;21575:350::-;21777:2;21759:21;;;21816:2;21796:18;;;21789:30;21855:28;21850:2;21835:18;;21828:56;21916:2;21901:18;;21749:176::o;21930:337::-;22132:2;22114:21;;;22171:2;22151:18;;;22144:30;22210:15;22205:2;22190:18;;22183:43;22258:2;22243:18;;22104:163::o;22272:339::-;22474:2;22456:21;;;22513:2;22493:18;;;22486:30;22552:17;22547:2;22532:18;;22525:45;22602:2;22587:18;;22446:165::o;22616:342::-;22818:2;22800:21;;;22857:2;22837:18;;;22830:30;22896:20;22891:2;22876:18;;22869:48;22949:2;22934:18;;22790:168::o;22963:341::-;23165:2;23147:21;;;23204:2;23184:18;;;23177:30;23243:19;23238:2;23223:18;;23216:47;23295:2;23280:18;;23137:167::o;23309:346::-;23511:2;23493:21;;;23550:2;23530:18;;;23523:30;23589:24;23584:2;23569:18;;23562:52;23646:2;23631:18;;23483:172::o;23660:351::-;23862:2;23844:21;;;23901:2;23881:18;;;23874:30;23940:29;23935:2;23920:18;;23913:57;24002:2;23987:18;;23834:177::o;24016:341::-;24218:2;24200:21;;;24257:2;24237:18;;;24230:30;24296:19;24291:2;24276:18;;24269:47;24348:2;24333:18;;24190:167::o;24362:348::-;24564:2;24546:21;;;24603:2;24583:18;;;24576:30;24642:26;24637:2;24622:18;;24615:54;24701:2;24686:18;;24536:174::o;24715:337::-;24917:2;24899:21;;;24956:2;24936:18;;;24929:30;24995:15;24990:2;24975:18;;24968:43;25043:2;25028:18;;24889:163::o;25057:340::-;25259:2;25241:21;;;25298:2;25278:18;;;25271:30;25337:18;25332:2;25317:18;;25310:46;25388:2;25373:18;;25231:166::o;25402:346::-;25604:2;25586:21;;;25643:2;25623:18;;;25616:30;25682:24;25677:2;25662:18;;25655:52;25739:2;25724:18;;25576:172::o;25753:341::-;25955:2;25937:21;;;25994:2;25974:18;;;25967:30;26033:19;26028:2;26013:18;;26006:47;26085:2;26070:18;;25927:167::o;26099:336::-;26301:2;26283:21;;;26340:2;26320:18;;;26313:30;26379:14;26374:2;26359:18;;26352:42;26426:2;26411:18;;26273:162::o;26440:345::-;26642:2;26624:21;;;26681:2;26661:18;;;26654:30;26720:23;26715:2;26700:18;;26693:51;26776:2;26761:18;;26614:171::o;26790:352::-;26992:2;26974:21;;;27031:2;27011:18;;;27004:30;27070;27065:2;27050:18;;27043:58;27133:2;27118:18;;26964:178::o;27147:347::-;27349:2;27331:21;;;27388:2;27368:18;;;27361:30;27427:25;27422:2;27407:18;;27400:53;27485:2;27470:18;;27321:173::o;27499:352::-;27701:2;27683:21;;;27740:2;27720:18;;;27713:30;27779;27774:2;27759:18;;27752:58;27842:2;27827:18;;27673:178::o;27856:344::-;28058:2;28040:21;;;28097:2;28077:18;;;28070:30;28136:22;28131:2;28116:18;;28109:50;28191:2;28176:18;;28030:170::o;28205:344::-;28407:2;28389:21;;;28446:2;28426:18;;;28419:30;28485:22;28480:2;28465:18;;28458:50;28540:2;28525:18;;28379:170::o;28554:350::-;28756:2;28738:21;;;28795:2;28775:18;;;28768:30;28834:28;28829:2;28814:18;;28807:56;28895:2;28880:18;;28728:176::o;28909:351::-;29111:2;29093:21;;;29150:2;29130:18;;;29123:30;29189:29;29184:2;29169:18;;29162:57;29251:2;29236:18;;29083:177::o;29265:347::-;29467:2;29449:21;;;29506:2;29486:18;;;29479:30;29545:25;29540:2;29525:18;;29518:53;29603:2;29588:18;;29439:173::o;29617:346::-;29819:2;29801:21;;;29858:2;29838:18;;;29831:30;29897:24;29892:2;29877:18;;29870:52;29954:2;29939:18;;29791:172::o;29968:351::-;30170:2;30152:21;;;30209:2;30189:18;;;30182:30;30248:29;30243:2;30228:18;;30221:57;30310:2;30295:18;;30142:177::o;30324:336::-;30526:2;30508:21;;;30565:2;30545:18;;;30538:30;30604:14;30599:2;30584:18;;30577:42;30651:2;30636:18;;30498:162::o;30665:336::-;30867:2;30849:21;;;30906:2;30886:18;;;30879:30;30945:14;30940:2;30925:18;;30918:42;30992:2;30977:18;;30839:162::o;31006:338::-;31208:2;31190:21;;;31247:2;31227:18;;;31220:30;31286:16;31281:2;31266:18;;31259:44;31335:2;31320:18;;31180:164::o;31349:352::-;31551:2;31533:21;;;31590:2;31570:18;;;31563:30;31629;31624:2;31609:18;;31602:58;31692:2;31677:18;;31523:178::o;31706:343::-;31908:2;31890:21;;;31947:2;31927:18;;;31920:30;31986:21;31981:2;31966:18;;31959:49;32040:2;32025:18;;31880:169::o;32054:347::-;32256:2;32238:21;;;32295:2;32275:18;;;32268:30;32334:25;32329:2;32314:18;;32307:53;32392:2;32377:18;;32228:173::o;32406:350::-;32608:2;32590:21;;;32647:2;32627:18;;;32620:30;32686:28;32681:2;32666:18;;32659:56;32747:2;32732:18;;32580:176::o;32761:349::-;32963:2;32945:21;;;33002:2;32982:18;;;32975:30;33041:27;33036:2;33021:18;;33014:55;33101:2;33086:18;;32935:175::o;33115:339::-;33317:2;33299:21;;;33356:2;33336:18;;;33329:30;33395:17;33390:2;33375:18;;33368:45;33445:2;33430:18;;33289:165::o;33459:349::-;33661:2;33643:21;;;33700:2;33680:18;;;33673:30;33739:27;33734:2;33719:18;;33712:55;33799:2;33784:18;;33633:175::o;33813:340::-;34015:2;33997:21;;;34054:2;34034:18;;;34027:30;34093:18;34088:2;34073:18;;34066:46;34144:2;34129:18;;33987:166::o;34158:338::-;34360:2;34342:21;;;34399:2;34379:18;;;34372:30;34438:16;34433:2;34418:18;;34411:44;34487:2;34472:18;;34332:164::o;34501:339::-;34703:2;34685:21;;;34742:2;34722:18;;;34715:30;34781:17;34776:2;34761:18;;34754:45;34831:2;34816:18;;34675:165::o;34845:352::-;35047:2;35029:21;;;35086:2;35066:18;;;35059:30;35125;35120:2;35105:18;;35098:58;35188:2;35173:18;;35019:178::o;35202:347::-;35404:2;35386:21;;;35443:2;35423:18;;;35416:30;35482:25;35477:2;35462:18;;35455:53;35540:2;35525:18;;35376:173::o;35554:337::-;35756:2;35738:21;;;35795:2;35775:18;;;35768:30;35834:15;35829:2;35814:18;;35807:43;35882:2;35867:18;;35728:163::o;35896:1276::-;;36302:3;36332:6;36321:9;36314:25;36358:42;36448:2;36440:6;36436:15;36431:2;36420:9;36416:18;36409:43;36500:2;36492:6;36488:15;36483:2;36472:9;36468:18;36461:43;36552:6;36544;36540:19;36535:2;36524:9;36520:18;36513:47;36609:26;36601:6;36597:39;36591:3;36580:9;36576:19;36569:68;36674:2;36668:3;36657:9;36653:19;36646:31;36694:46;36736:2;36725:9;36721:18;36713:6;36694:46;:::i;:::-;36686:54;;36777:6;36771:3;36760:9;36756:19;36749:35;36840:2;36831:6;36825:13;36821:22;36815:3;36804:9;36800:19;36793:51;36891:2;36883:6;36879:15;36873:22;36853:42;;36904:61;36960:3;36949:9;36945:19;36931:12;36904:61;:::i;:::-;37024:2;37012:15;;37006:22;37002:31;36996:3;36981:19;;36974:60;-1:-1:-1;37089:2:1;37077:15;;37071:22;37065:3;37050:19;;37043:51;37153:3;37141:16;;;37135:23;37160:4;37131:34;37125:3;37110:19;;;37103:63;36282:890;;-1:-1:-1;;;;;;;36282:890:1:o;37177:718::-;;37520:4;37512:6;37508:17;37497:9;37490:36;37574:6;37566;37562:19;37557:2;37546:9;37542:18;37535:47;37630:4;37622:6;37618:17;37613:2;37602:9;37598:18;37591:45;37672:3;37667:2;37656:9;37652:18;37645:31;37699:63;37757:3;37746:9;37742:19;37734:6;37699:63;:::i;:::-;37811:9;37803:6;37799:22;37793:3;37782:9;37778:19;37771:51;37839:50;37882:6;37874;37839:50;:::i;:::-;37831:58;37480:415;-1:-1:-1;;;;;;;;37480:415:1:o;37900:419::-;38145:4;38133:17;;;38115:36;;38187:17;;;38182:2;38167:18;;38160:45;38241:17;;;38236:2;38221:18;;38214:45;38295:17;;;38290:2;38275:18;;38268:45;38102:3;38087:19;;38069:250::o;38324:242::-;38394:2;38388:9;38424:17;;;38471:18;38456:34;;38492:22;;;38453:62;38450:2;;;38518:9;38450:2;38545;38538:22;38368:198;;-1:-1:-1;38368:198:1:o;38571:240::-;;38654:18;38646:6;38643:30;38640:2;;;38676:9;38640:2;-1:-1:-1;38724:4:1;38712:17;38731:66;38708:90;38800:4;38704:101;;38630:181::o;38816:258::-;38888:1;38898:113;38912:6;38909:1;38906:13;38898:113;;;38988:11;;;38982:18;38969:11;;;38962:39;38934:2;38927:10;38898:113;;;39029:6;39026:1;39023:13;39020:2;;;-1:-1:-1;;39064:1:1;39046:16;;39039:27;38869:205::o;39079:120::-;39167:5;39160:13;39153:21;39146:5;39143:32;39133:2;;39189:1;39186;39179:12;39133:2;39123:76;:::o;39204:116::-;39290:4;39283:5;39279:16;39272:5;39269:27;39259:2;;39310:1;39307;39300:12
Swarm Source
ipfs://2fa17e5ad75ede6e36cfb5b8f3888bfd34c0f8af5c29ff87ae2a91dc1e186426
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.