diff --git a/deploy/deploy_settlement_only.js b/deploy/deploy_settlement_only.js index 95920be..e2f0d57 100644 --- a/deploy/deploy_settlement_only.js +++ b/deploy/deploy_settlement_only.js @@ -13,6 +13,7 @@ const INCH = { 250: '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', // FTM (USDC) 1313161554: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802', // Aurora (USDC) 8217: '0x754288077d0ff82af7a5317c7cb8c444d421d103', // Klaytn (USDC) + 8453: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // Base (USDC) 31337: '0x111111111117dC0aa78b770fA6A738034120C302', // Hardhat }; diff --git a/deployments/base/.chainId b/deployments/base/.chainId new file mode 100644 index 0000000..2a0c263 --- /dev/null +++ b/deployments/base/.chainId @@ -0,0 +1 @@ +8453 \ No newline at end of file diff --git a/deployments/base/Settlement.json b/deployments/base/Settlement.json new file mode 100644 index 0000000..501eaac --- /dev/null +++ b/deployments/base/Settlement.json @@ -0,0 +1,288 @@ +{ + "address": "0x7F069df72b7A39bCE9806e3AfaF579E54D8CF2b9", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IOrderMixin", + "name": "limitOrderProtocol", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AccessDenied", + "type": "error" + }, + { + "inputs": [], + "name": "FailedExternalCall", + "type": "error" + }, + { + "inputs": [], + "name": "ForceApproveFailed", + "type": "error" + }, + { + "inputs": [], + "name": "IncorrectCalldataParams", + "type": "error" + }, + { + "inputs": [], + "name": "NotEnoughCredit", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyFeeBankAccess", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverIsNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "SafeTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "WrongInteractionTarget", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "availableCredit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "decreaseAvailableCredit", + "outputs": [ + { + "internalType": "uint256", + "name": "allowance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "feeBank", + "outputs": [ + { + "internalType": "contract IFeeBank", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "taker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "takingAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "interactiveData", + "type": "bytes" + } + ], + "name": "fillOrderInteraction", + "outputs": [ + { + "internalType": "uint256", + "name": "result", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "increaseAvailableCredit", + "outputs": [ + { + "internalType": "uint256", + "name": "allowance", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "settleOrders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x044d5ebf5cc28f5dfd588a0718c9a81913f2ee886a0f46137512f5dd7b0f4b53", + "receipt": { + "to": null, + "from": "0x11799622F4D98A24514011E8527B969f7488eF47", + "contractAddress": "0x7F069df72b7A39bCE9806e3AfaF579E54D8CF2b9", + "transactionIndex": 7, + "gasUsed": "1853354", + "logsBloom": "0x00000100000000000000000000000000000000000000008000800000200000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000808000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040028000001000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x76e09718af7892a0ba4a4963b048897cffe413cc577fb24ae091c3a4cd1f968e", + "transactionHash": "0x044d5ebf5cc28f5dfd588a0718c9a81913f2ee886a0f46137512f5dd7b0f4b53", + "logs": [ + { + "transactionIndex": 7, + "blockNumber": 3598222, + "transactionHash": "0x044d5ebf5cc28f5dfd588a0718c9a81913f2ee886a0f46137512f5dd7b0f4b53", + "address": "0x494C52d908Ae68d4c1C6f831b0DFb52Bd3649997", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000007f069df72b7a39bce9806e3afaf579e54d8cf2b9" + ], + "data": "0x", + "logIndex": 11, + "blockHash": "0x76e09718af7892a0ba4a4963b048897cffe413cc577fb24ae091c3a4cd1f968e" + }, + { + "transactionIndex": 7, + "blockNumber": 3598222, + "transactionHash": "0x044d5ebf5cc28f5dfd588a0718c9a81913f2ee886a0f46137512f5dd7b0f4b53", + "address": "0x494C52d908Ae68d4c1C6f831b0DFb52Bd3649997", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000007f069df72b7a39bce9806e3afaf579e54d8cf2b9", + "0x00000000000000000000000011799622f4d98a24514011e8527b969f7488ef47" + ], + "data": "0x", + "logIndex": 12, + "blockHash": "0x76e09718af7892a0ba4a4963b048897cffe413cc577fb24ae091c3a4cd1f968e" + } + ], + "blockNumber": 3598222, + "cumulativeGasUsed": "2577693", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1111111254EEB25477B68fb85Ed929f73A960582", + "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" + ], + "numDeployments": 1, + "solcInputHash": "fcb7b0e966107246605e4bce79c71d06", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IOrderMixin\",\"name\":\"limitOrderProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"token\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessDenied\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedExternalCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ForceApproveFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"IncorrectCalldataParams\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotEnoughCredit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyFeeBankAccess\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ResolverIsNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SafeTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"WrongInteractionTarget\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"availableCredit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"decreaseAvailableCredit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeBank\",\"outputs\":[{\"internalType\":\"contract IFeeBank\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"taker\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"takingAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"interactiveData\",\"type\":\"bytes\"}],\"name\":\"fillOrderInteraction\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"result\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"increaseAvailableCredit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"settleOrders\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Settlement.sol\":\"Settlement\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@1inch/limit-order-protocol-contract/contracts/OrderLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@1inch/solidity-utils/contracts/libraries/ECDSA.sol\\\";\\n\\nlibrary OrderLib {\\n struct Order {\\n uint256 salt;\\n address makerAsset;\\n address takerAsset;\\n address maker;\\n address receiver;\\n address allowedSender; // equals to Zero address on public orders\\n uint256 makingAmount;\\n uint256 takingAmount;\\n uint256 offsets;\\n // bytes makerAssetData;\\n // bytes takerAssetData;\\n // bytes getMakingAmount; // this.staticcall(abi.encodePacked(bytes, swapTakerAmount)) => (swapMakerAmount)\\n // bytes getTakingAmount; // this.staticcall(abi.encodePacked(bytes, swapMakerAmount)) => (swapTakerAmount)\\n // bytes predicate; // this.staticcall(bytes) => (bool)\\n // bytes permit; // On first fill: permit.1.call(abi.encodePacked(permit.selector, permit.2))\\n // bytes preInteraction;\\n // bytes postInteraction;\\n bytes interactions; // concat(makerAssetData, takerAssetData, getMakingAmount, getTakingAmount, predicate, permit, preIntercation, postInteraction)\\n }\\n\\n bytes32 constant internal _LIMIT_ORDER_TYPEHASH = keccak256(\\n \\\"Order(\\\"\\n \\\"uint256 salt,\\\"\\n \\\"address makerAsset,\\\"\\n \\\"address takerAsset,\\\"\\n \\\"address maker,\\\"\\n \\\"address receiver,\\\"\\n \\\"address allowedSender,\\\"\\n \\\"uint256 makingAmount,\\\"\\n \\\"uint256 takingAmount,\\\"\\n \\\"uint256 offsets,\\\"\\n \\\"bytes interactions\\\"\\n \\\")\\\"\\n );\\n\\n enum DynamicField {\\n MakerAssetData,\\n TakerAssetData,\\n GetMakingAmount,\\n GetTakingAmount,\\n Predicate,\\n Permit,\\n PreInteraction,\\n PostInteraction\\n }\\n\\n function getterIsFrozen(bytes calldata getter) internal pure returns(bool) {\\n return getter.length == 1 && getter[0] == \\\"x\\\";\\n }\\n\\n function _get(Order calldata order, DynamicField field) private pure returns(bytes calldata) {\\n uint256 bitShift = uint256(field) << 5; // field * 32\\n return order.interactions[\\n uint32((order.offsets << 32) >> bitShift):\\n uint32(order.offsets >> bitShift)\\n ];\\n }\\n\\n function makerAssetData(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.MakerAssetData);\\n }\\n\\n function takerAssetData(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.TakerAssetData);\\n }\\n\\n function getMakingAmount(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.GetMakingAmount);\\n }\\n\\n function getTakingAmount(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.GetTakingAmount);\\n }\\n\\n function predicate(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.Predicate);\\n }\\n\\n function permit(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.Permit);\\n }\\n\\n function preInteraction(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.PreInteraction);\\n }\\n\\n function postInteraction(Order calldata order) internal pure returns(bytes calldata) {\\n return _get(order, DynamicField.PostInteraction);\\n }\\n\\n function hash(Order calldata order, bytes32 domainSeparator) internal pure returns(bytes32 result) {\\n bytes calldata interactions = order.interactions;\\n bytes32 typehash = _LIMIT_ORDER_TYPEHASH;\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n\\n // keccak256(abi.encode(_LIMIT_ORDER_TYPEHASH, orderWithoutInteractions, keccak256(order.interactions)));\\n calldatacopy(ptr, interactions.offset, interactions.length)\\n mstore(add(ptr, 0x140), keccak256(ptr, interactions.length))\\n calldatacopy(add(ptr, 0x20), order, 0x120)\\n mstore(ptr, typehash)\\n result := keccak256(ptr, 0x160)\\n }\\n result = ECDSA.toTypedDataHash(domainSeparator, result);\\n }\\n}\\n\",\"keccak256\":\"0x7e44db5eed20f3314d588f75e0d9b582d50c0f2ed7cdfe7124b24b37b8567f1f\",\"license\":\"MIT\"},\"@1inch/limit-order-protocol-contract/contracts/interfaces/IInteractionNotificationReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\npragma abicoder v1;\\n\\n/**\\n * @title Interface for interactor which acts after `taker -> maker` transfers.\\n * @notice The order filling steps are `preInteraction` =>` Transfer \\\"maker -> taker\\\"` => **`Interaction`** => `Transfer \\\"taker -> maker\\\"` => `postInteraction`\\n */\\ninterface IInteractionNotificationReceiver {\\n /**\\n * @notice Callback method that gets called after all funds transfers\\n * @param taker Taker address (tx sender)\\n * @param makingAmount Actual making amount\\n * @param takingAmount Actual taking amount\\n * @param interactionData Interaction calldata\\n * @return offeredTakingAmount Suggested amount. Order is filled with this amount if maker or taker getter functions are not defined.\\n */\\n function fillOrderInteraction(\\n address taker,\\n uint256 makingAmount,\\n uint256 takingAmount,\\n bytes memory interactionData\\n ) external returns(uint256 offeredTakingAmount);\\n}\\n\",\"keccak256\":\"0x3fe00a26adc187512280a771cca46401269636e79104f713f87ab349fa7c9dfd\",\"license\":\"MIT\"},\"@1inch/limit-order-protocol-contract/contracts/interfaces/IOrderMixin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"../OrderLib.sol\\\";\\n\\ninterface IOrderMixin {\\n /**\\n * @notice Returns unfilled amount for order. Throws if order does not exist\\n * @param orderHash Order's hash. Can be obtained by the `hashOrder` function\\n * @return amount Unfilled amount\\n */\\n function remaining(bytes32 orderHash) external view returns(uint256 amount);\\n\\n /**\\n * @notice Returns unfilled amount for order\\n * @param orderHash Order's hash. Can be obtained by the `hashOrder` function\\n * @return rawAmount Unfilled amount of order plus one if order exists. Otherwise 0\\n */\\n function remainingRaw(bytes32 orderHash) external view returns(uint256 rawAmount);\\n\\n /**\\n * @notice Same as `remainingRaw` but for multiple orders\\n * @param orderHashes Array of hashes\\n * @return rawAmounts Array of amounts for each order plus one if order exists or 0 otherwise\\n */\\n function remainingsRaw(bytes32[] memory orderHashes) external view returns(uint256[] memory rawAmounts);\\n\\n /**\\n * @notice Checks order predicate\\n * @param order Order to check predicate for\\n * @return result Predicate evaluation result. True if predicate allows to fill the order, false otherwise\\n */\\n function checkPredicate(OrderLib.Order calldata order) external view returns(bool result);\\n\\n /**\\n * @notice Returns order hash according to EIP712 standard\\n * @param order Order to get hash for\\n * @return orderHash Hash of the order\\n */\\n function hashOrder(OrderLib.Order calldata order) external view returns(bytes32 orderHash);\\n\\n /**\\n * @notice Delegates execution to custom implementation. Could be used to validate if `transferFrom` works properly\\n * @dev The function always reverts and returns the simulation results in revert data.\\n * @param target Addresses that will be delegated\\n * @param data Data that will be passed to delegatee\\n */\\n function simulate(address target, bytes calldata data) external;\\n\\n /**\\n * @notice Cancels order.\\n * @dev Order is cancelled by setting remaining amount to _ORDER_FILLED value\\n * @param order Order quote to cancel\\n * @return orderRemaining Unfilled amount of order before cancellation\\n * @return orderHash Hash of the filled order\\n */\\n function cancelOrder(OrderLib.Order calldata order) external returns(uint256 orderRemaining, bytes32 orderHash);\\n\\n /**\\n * @notice Fills an order. If one doesn't exist (first fill) it will be created using order.makerAssetData\\n * @param order Order quote to fill\\n * @param signature Signature to confirm quote ownership\\n * @param interaction A call data for InteractiveNotificationReceiver. Taker may execute interaction after getting maker assets and before sending taker assets.\\n * @param makingAmount Making amount\\n * @param takingAmount Taking amount\\n * @param skipPermitAndThresholdAmount Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount. Top-most bit specifies whether taker wants to skip maker's permit.\\n * @return actualMakingAmount Actual amount transferred from maker to taker\\n * @return actualTakingAmount Actual amount transferred from taker to maker\\n * @return orderHash Hash of the filled order\\n */\\n function fillOrder(\\n OrderLib.Order calldata order,\\n bytes calldata signature,\\n bytes calldata interaction,\\n uint256 makingAmount,\\n uint256 takingAmount,\\n uint256 skipPermitAndThresholdAmount\\n ) external payable returns(uint256 actualMakingAmount, uint256 actualTakingAmount, bytes32 orderHash);\\n\\n /**\\n * @notice Same as `fillOrderTo` but calls permit first,\\n * allowing to approve token spending and make a swap in one transaction.\\n * Also allows to specify funds destination instead of `msg.sender`\\n * @dev See tests for examples\\n * @param order Order quote to fill\\n * @param signature Signature to confirm quote ownership\\n * @param interaction A call data for InteractiveNotificationReceiver. Taker may execute interaction after getting maker assets and before sending taker assets.\\n * @param makingAmount Making amount\\n * @param takingAmount Taking amount\\n * @param skipPermitAndThresholdAmount Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount. Top-most bit specifies whether taker wants to skip maker's permit.\\n * @param target Address that will receive swap funds\\n * @param permit Should consist of abiencoded token address and encoded `IERC20Permit.permit` call.\\n * @return actualMakingAmount Actual amount transferred from maker to taker\\n * @return actualTakingAmount Actual amount transferred from taker to maker\\n * @return orderHash Hash of the filled order\\n */\\n function fillOrderToWithPermit(\\n OrderLib.Order calldata order,\\n bytes calldata signature,\\n bytes calldata interaction,\\n uint256 makingAmount,\\n uint256 takingAmount,\\n uint256 skipPermitAndThresholdAmount,\\n address target,\\n bytes calldata permit\\n ) external returns(uint256 actualMakingAmount, uint256 actualTakingAmount, bytes32 orderHash);\\n\\n /**\\n * @notice Same as `fillOrder` but allows to specify funds destination instead of `msg.sender`\\n * @param order_ Order quote to fill\\n * @param signature Signature to confirm quote ownership\\n * @param interaction A call data for InteractiveNotificationReceiver. Taker may execute interaction after getting maker assets and before sending taker assets.\\n * @param makingAmount Making amount\\n * @param takingAmount Taking amount\\n * @param skipPermitAndThresholdAmount Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount. Top-most bit specifies whether taker wants to skip maker's permit.\\n * @param target Address that will receive swap funds\\n * @return actualMakingAmount Actual amount transferred from maker to taker\\n * @return actualTakingAmount Actual amount transferred from taker to maker\\n * @return orderHash Hash of the filled order\\n */\\n function fillOrderTo(\\n OrderLib.Order calldata order_,\\n bytes calldata signature,\\n bytes calldata interaction,\\n uint256 makingAmount,\\n uint256 takingAmount,\\n uint256 skipPermitAndThresholdAmount,\\n address target\\n ) external payable returns(uint256 actualMakingAmount, uint256 actualTakingAmount, bytes32 orderHash);\\n}\\n\",\"keccak256\":\"0x34a8187abeac349befc056db6f87c6f19a5b1a288d7ae42ebe485071a4e7c3de\",\"license\":\"MIT\"},\"@1inch/solidity-utils/contracts/interfaces/IDaiLikePermit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\npragma abicoder v1;\\n\\ninterface IDaiLikePermit {\\n function permit(\\n address holder,\\n address spender,\\n uint256 nonce,\\n uint256 expiry,\\n bool allowed,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\",\"keccak256\":\"0x10105446e709abf11b13721a516ffa24d3c5bec39c7925a367968a6a7519579f\",\"license\":\"MIT\"},\"@1inch/solidity-utils/contracts/libraries/AddressLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\npragma abicoder v1;\\n\\ntype Address is uint256;\\n\\nlibrary AddressLib {\\n function get(Address a) internal pure returns (address) {\\n return address(uint160(Address.unwrap(a)));\\n }\\n\\n function getFlag(Address a, uint256 flag) internal pure returns (bool) {\\n return (Address.unwrap(a) & flag) != 0;\\n }\\n\\n function getUint32(Address a, uint256 offset) internal pure returns (uint32) {\\n return uint32(Address.unwrap(a) >> offset);\\n }\\n\\n function getUint64(Address a, uint256 offset) internal pure returns (uint64) {\\n return uint64(Address.unwrap(a) >> offset);\\n }\\n}\\n\",\"keccak256\":\"0xf734f74336f517ffb6b604e578a97055e38f34c124ff7ad8e748e1ec4ac2ae28\",\"license\":\"MIT\"},\"@1inch/solidity-utils/contracts/libraries/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\npragma abicoder v1;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC1271.sol\\\";\\n\\nlibrary ECDSA {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n uint256 private constant _S_BOUNDARY = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 + 1;\\n uint256 private constant _COMPACT_S_MASK = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\\n uint256 private constant _COMPACT_V_SHIFT = 255;\\n\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal view returns (address signer) {\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n if lt(s, _S_BOUNDARY) {\\n let ptr := mload(0x40)\\n\\n mstore(ptr, hash)\\n mstore(add(ptr, 0x20), v)\\n mstore(add(ptr, 0x40), r)\\n mstore(add(ptr, 0x60), s)\\n mstore(0, 0)\\n pop(staticcall(gas(), 0x1, ptr, 0x80, 0, 0x20))\\n signer := mload(0)\\n }\\n }\\n }\\n\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal view returns (address signer) {\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let s := and(vs, _COMPACT_S_MASK)\\n if lt(s, _S_BOUNDARY) {\\n let ptr := mload(0x40)\\n\\n mstore(ptr, hash)\\n mstore(add(ptr, 0x20), add(27, shr(_COMPACT_V_SHIFT, vs)))\\n mstore(add(ptr, 0x40), r)\\n mstore(add(ptr, 0x60), s)\\n mstore(0, 0)\\n pop(staticcall(gas(), 0x1, ptr, 0x80, 0, 0x20))\\n signer := mload(0)\\n }\\n }\\n }\\n\\n /// @dev WARNING!!!\\n /// There is a known signature malleability issue with two representations of signatures!\\n /// Even though this function is able to verify both standard 65-byte and compact 64-byte EIP-2098 signatures\\n /// one should never use raw signatures for any kind of invalidation logic in their code.\\n /// As the standard and compact representations are interchangeable any invalidation logic that relies on\\n /// signature uniqueness will get rekt.\\n /// More info: https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-4h98-2769-gh6h\\n function recover(bytes32 hash, bytes calldata signature) internal view returns (address signer) {\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n\\n // memory[ptr:ptr+0x80] = (hash, v, r, s)\\n switch signature.length\\n case 65 {\\n // memory[ptr+0x20:ptr+0x80] = (v, r, s)\\n mstore(add(ptr, 0x20), byte(0, calldataload(add(signature.offset, 0x40))))\\n calldatacopy(add(ptr, 0x40), signature.offset, 0x40)\\n }\\n case 64 {\\n // memory[ptr+0x20:ptr+0x80] = (v, r, s)\\n let vs := calldataload(add(signature.offset, 0x20))\\n mstore(add(ptr, 0x20), add(27, shr(_COMPACT_V_SHIFT, vs)))\\n calldatacopy(add(ptr, 0x40), signature.offset, 0x20)\\n mstore(add(ptr, 0x60), and(vs, _COMPACT_S_MASK))\\n }\\n default {\\n ptr := 0\\n }\\n\\n if ptr {\\n if lt(mload(add(ptr, 0x60)), _S_BOUNDARY) {\\n // memory[ptr:ptr+0x20] = (hash)\\n mstore(ptr, hash)\\n\\n mstore(0, 0)\\n pop(staticcall(gas(), 0x1, ptr, 0x80, 0, 0x20))\\n signer := mload(0)\\n }\\n }\\n }\\n }\\n\\n function recoverOrIsValidSignature(\\n address signer,\\n bytes32 hash,\\n bytes calldata signature\\n ) internal view returns (bool success) {\\n if (signer == address(0)) return false;\\n if ((signature.length == 64 || signature.length == 65) && recover(hash, signature) == signer) {\\n return true;\\n }\\n return isValidSignature(signer, hash, signature);\\n }\\n\\n function recoverOrIsValidSignature(\\n address signer,\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal view returns (bool success) {\\n if (signer == address(0)) return false;\\n if (recover(hash, v, r, s) == signer) {\\n return true;\\n }\\n return isValidSignature(signer, hash, v, r, s);\\n }\\n\\n function recoverOrIsValidSignature(\\n address signer,\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal view returns (bool success) {\\n if (signer == address(0)) return false;\\n if (recover(hash, r, vs) == signer) {\\n return true;\\n }\\n return isValidSignature(signer, hash, r, vs);\\n }\\n\\n function recoverOrIsValidSignature65(\\n address signer,\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal view returns (bool success) {\\n if (signer == address(0)) return false;\\n if (recover(hash, r, vs) == signer) {\\n return true;\\n }\\n return isValidSignature65(signer, hash, r, vs);\\n }\\n\\n function isValidSignature(\\n address signer,\\n bytes32 hash,\\n bytes calldata signature\\n ) internal view returns (bool success) {\\n // (bool success, bytes memory data) = signer.staticcall(abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature));\\n // return success && data.length >= 4 && abi.decode(data, (bytes4)) == IERC1271.isValidSignature.selector;\\n bytes4 selector = IERC1271.isValidSignature.selector;\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n\\n mstore(ptr, selector)\\n mstore(add(ptr, 0x04), hash)\\n mstore(add(ptr, 0x24), 0x40)\\n mstore(add(ptr, 0x44), signature.length)\\n calldatacopy(add(ptr, 0x64), signature.offset, signature.length)\\n if staticcall(gas(), signer, ptr, add(0x64, signature.length), 0, 0x20) {\\n success := and(eq(selector, mload(0)), eq(returndatasize(), 0x20))\\n }\\n }\\n }\\n\\n function isValidSignature(\\n address signer,\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal view returns (bool success) {\\n bytes4 selector = IERC1271.isValidSignature.selector;\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n\\n mstore(ptr, selector)\\n mstore(add(ptr, 0x04), hash)\\n mstore(add(ptr, 0x24), 0x40)\\n mstore(add(ptr, 0x44), 65)\\n mstore(add(ptr, 0x64), r)\\n mstore(add(ptr, 0x84), s)\\n mstore8(add(ptr, 0xa4), v)\\n if staticcall(gas(), signer, ptr, 0xa5, 0, 0x20) {\\n success := and(eq(selector, mload(0)), eq(returndatasize(), 0x20))\\n }\\n }\\n }\\n\\n function isValidSignature(\\n address signer,\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal view returns (bool success) {\\n // (bool success, bytes memory data) = signer.staticcall(abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, abi.encodePacked(r, vs)));\\n // return success && data.length >= 4 && abi.decode(data, (bytes4)) == IERC1271.isValidSignature.selector;\\n bytes4 selector = IERC1271.isValidSignature.selector;\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n\\n mstore(ptr, selector)\\n mstore(add(ptr, 0x04), hash)\\n mstore(add(ptr, 0x24), 0x40)\\n mstore(add(ptr, 0x44), 64)\\n mstore(add(ptr, 0x64), r)\\n mstore(add(ptr, 0x84), vs)\\n if staticcall(gas(), signer, ptr, 0xa4, 0, 0x20) {\\n success := and(eq(selector, mload(0)), eq(returndatasize(), 0x20))\\n }\\n }\\n }\\n\\n function isValidSignature65(\\n address signer,\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal view returns (bool success) {\\n // (bool success, bytes memory data) = signer.staticcall(abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, abi.encodePacked(r, vs & ~uint256(1 << 255), uint8(vs >> 255))));\\n // return success && data.length >= 4 && abi.decode(data, (bytes4)) == IERC1271.isValidSignature.selector;\\n bytes4 selector = IERC1271.isValidSignature.selector;\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n\\n mstore(ptr, selector)\\n mstore(add(ptr, 0x04), hash)\\n mstore(add(ptr, 0x24), 0x40)\\n mstore(add(ptr, 0x44), 65)\\n mstore(add(ptr, 0x64), r)\\n mstore(add(ptr, 0x84), and(vs, _COMPACT_S_MASK))\\n mstore8(add(ptr, 0xa4), add(27, shr(_COMPACT_V_SHIFT, vs)))\\n if staticcall(gas(), signer, ptr, 0xa5, 0, 0x20) {\\n success := and(eq(selector, mload(0)), eq(returndatasize(), 0x20))\\n }\\n }\\n }\\n\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 res) {\\n // 32 is the length in bytes of hash, enforced by the type signature above\\n // return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n mstore(0, 0x19457468657265756d205369676e6564204d6573736167653a0a333200000000) // \\\"\\\\x19Ethereum Signed Message:\\\\n32\\\"\\n mstore(28, hash)\\n res := keccak256(0, 60)\\n }\\n }\\n\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 res) {\\n // return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n mstore(ptr, 0x1901000000000000000000000000000000000000000000000000000000000000) // \\\"\\\\x19\\\\x01\\\"\\n mstore(add(ptr, 0x02), domainSeparator)\\n mstore(add(ptr, 0x22), structHash)\\n res := keccak256(ptr, 66)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x79d793267d686a33e3882c4b16b478fff0df3cc0320e65a305cb31f762312d80\",\"license\":\"MIT\"},\"@1inch/solidity-utils/contracts/libraries/RevertReasonForwarder.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\npragma abicoder v1;\\n\\n/// @title Revert reason forwarder.\\nlibrary RevertReasonForwarder {\\n /// @dev Forwards latest externall call revert.\\n function reRevert() internal pure {\\n // bubble up revert reason from latest external call\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let ptr := mload(0x40)\\n returndatacopy(ptr, 0, returndatasize())\\n revert(ptr, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0x990c989e0ffba370a27b90b917a1cf86db79e370b9ba2b0f9076895b232744f8\",\"license\":\"MIT\"},\"@1inch/solidity-utils/contracts/libraries/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\npragma abicoder v1;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../interfaces/IDaiLikePermit.sol\\\";\\nimport \\\"../libraries/RevertReasonForwarder.sol\\\";\\n\\n/// @title Implements efficient safe methods for ERC20 interface.\\nlibrary SafeERC20 {\\n error SafeTransferFailed();\\n error SafeTransferFromFailed();\\n error ForceApproveFailed();\\n error SafeIncreaseAllowanceFailed();\\n error SafeDecreaseAllowanceFailed();\\n error SafePermitBadLength();\\n\\n /// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 amount\\n ) internal {\\n bytes4 selector = token.transferFrom.selector;\\n bool success;\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let data := mload(0x40)\\n\\n mstore(data, selector)\\n mstore(add(data, 0x04), from)\\n mstore(add(data, 0x24), to)\\n mstore(add(data, 0x44), amount)\\n success := call(gas(), token, 0, data, 100, 0x0, 0x20)\\n if success {\\n switch returndatasize()\\n case 0 {\\n success := gt(extcodesize(token), 0)\\n }\\n default {\\n success := and(gt(returndatasize(), 31), eq(mload(0), 1))\\n }\\n }\\n }\\n if (!success) revert SafeTransferFromFailed();\\n }\\n\\n /// @dev Ensures method do not revert or return boolean `true`, admits call to non-smart-contract.\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n if (!_makeCall(token, token.transfer.selector, to, value)) {\\n revert SafeTransferFailed();\\n }\\n }\\n\\n /// @dev If `approve(from, to, amount)` fails, try to `approve(from, to, 0)` before retry.\\n function forceApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n if (!_makeCall(token, token.approve.selector, spender, value)) {\\n if (\\n !_makeCall(token, token.approve.selector, spender, 0) ||\\n !_makeCall(token, token.approve.selector, spender, value)\\n ) {\\n revert ForceApproveFailed();\\n }\\n }\\n }\\n\\n /// @dev Allowance increase with safe math check.\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 allowance = token.allowance(address(this), spender);\\n if (value > type(uint256).max - allowance) revert SafeIncreaseAllowanceFailed();\\n forceApprove(token, spender, allowance + value);\\n }\\n\\n /// @dev Allowance decrease with safe math check.\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 allowance = token.allowance(address(this), spender);\\n if (value > allowance) revert SafeDecreaseAllowanceFailed();\\n forceApprove(token, spender, allowance - value);\\n }\\n\\n /// @dev Calls either ERC20 or Dai `permit` for `token`, if unsuccessful forwards revert from external call.\\n function safePermit(IERC20 token, bytes calldata permit) internal {\\n if (!tryPermit(token, permit)) RevertReasonForwarder.reRevert();\\n }\\n\\n function tryPermit(IERC20 token, bytes calldata permit) internal returns(bool) {\\n if (permit.length == 32 * 7) {\\n return _makeCalldataCall(token, IERC20Permit.permit.selector, permit);\\n }\\n if (permit.length == 32 * 8) {\\n return _makeCalldataCall(token, IDaiLikePermit.permit.selector, permit);\\n }\\n revert SafePermitBadLength();\\n }\\n\\n function _makeCall(\\n IERC20 token,\\n bytes4 selector,\\n address to,\\n uint256 amount\\n ) private returns (bool success) {\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let data := mload(0x40)\\n\\n mstore(data, selector)\\n mstore(add(data, 0x04), to)\\n mstore(add(data, 0x24), amount)\\n success := call(gas(), token, 0, data, 0x44, 0x0, 0x20)\\n if success {\\n switch returndatasize()\\n case 0 {\\n success := gt(extcodesize(token), 0)\\n }\\n default {\\n success := and(gt(returndatasize(), 31), eq(mload(0), 1))\\n }\\n }\\n }\\n }\\n\\n function _makeCalldataCall(\\n IERC20 token,\\n bytes4 selector,\\n bytes calldata args\\n ) private returns (bool success) {\\n /// @solidity memory-safe-assembly\\n assembly { // solhint-disable-line no-inline-assembly\\n let len := add(4, args.length)\\n let data := mload(0x40)\\n\\n mstore(data, selector)\\n calldatacopy(add(data, 0x04), args.offset, args.length)\\n success := call(gas(), token, 0, data, len, 0x0, 0x20)\\n if success {\\n switch returndatasize()\\n case 0 {\\n success := gt(extcodesize(token), 0)\\n }\\n default {\\n success := and(gt(returndatasize(), 31), eq(mload(0), 1))\\n }\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x11014aec6238c642e58667a3ace2bb16a165bfe7bb475047c971bafdb1da92d0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable is Context {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n constructor() {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1271.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271 {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x0705a4b1b86d7b0bd8432118f226ba139c44b9dcaba0a6eafba2dd7d0639c544\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"contracts/FeeBank.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@1inch/solidity-utils/contracts/libraries/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\nimport \\\"./interfaces/IFeeBankCharger.sol\\\";\\nimport \\\"./interfaces/IFeeBank.sol\\\";\\n\\n/// @title Contract with fee mechanism for solvers to pay for using the system\\ncontract FeeBank is IFeeBank, Ownable {\\n using SafeERC20 for IERC20;\\n\\n error ZeroAddress();\\n\\n IERC20 private immutable _token;\\n IFeeBankCharger private immutable _charger;\\n\\n mapping(address => uint256) private _accountDeposits;\\n\\n constructor(IFeeBankCharger charger_, IERC20 inch_, address owner_) {\\n if (address(charger_) == address(0)) revert ZeroAddress();\\n if (address(inch_) == address(0)) revert ZeroAddress();\\n _charger = charger_;\\n _token = inch_;\\n transferOwnership(owner_);\\n }\\n\\n function availableCredit(address account) external view returns (uint256) {\\n return _charger.availableCredit(account);\\n }\\n\\n /**\\n * @notice Increment sender's availableCredit in Settlement contract.\\n * @param amount The amount of 1INCH sender pay for incresing.\\n * @return totalAvailableCredit The total sender's availableCredit after deposit.\\n */\\n function deposit(uint256 amount) external returns (uint256 totalAvailableCredit) {\\n return _depositFor(msg.sender, amount);\\n }\\n\\n /**\\n * @notice Increases account's availableCredit in Settlement contract.\\n * @param account The account whose availableCredit is increased by the sender.\\n * @param amount The amount of 1INCH sender pay for incresing.\\n * @return totalAvailableCredit The total account's availableCredit after deposit.\\n */\\n function depositFor(address account, uint256 amount) external returns (uint256 totalAvailableCredit) {\\n return _depositFor(account, amount);\\n }\\n\\n /**\\n * @notice See {deposit}. This method uses permit for deposit without prior approves.\\n * @param amount The amount of 1INCH sender pay for incresing.\\n * @param permit The data with sender's permission via token.\\n * @return totalAvailableCredit The total sender's availableCredit after deposit.\\n */\\n function depositWithPermit(uint256 amount, bytes calldata permit) external returns (uint256 totalAvailableCredit) {\\n return depositForWithPermit(msg.sender, amount, permit);\\n }\\n\\n /**\\n * @notice See {depositFor} and {depositWithPermit}.\\n */\\n function depositForWithPermit(\\n address account,\\n uint256 amount,\\n bytes calldata permit\\n ) public returns (uint256 totalAvailableCredit) {\\n _token.safePermit(permit);\\n return _depositFor(account, amount);\\n }\\n\\n /**\\n * @notice Returns unspent availableCredit.\\n * @param amount The amount of 1INCH sender returns.\\n * @return totalAvailableCredit The total sender's availableCredit after withdrawal.\\n */\\n function withdraw(uint256 amount) external returns (uint256 totalAvailableCredit) {\\n return _withdrawTo(msg.sender, amount);\\n }\\n\\n /**\\n * @notice Returns unspent availableCredit to specific account.\\n * @param account The account which get withdrawaled tokens.\\n * @param amount The amount of withdrawaled tokens.\\n * @return totalAvailableCredit The total sender's availableCredit after withdrawal.\\n */\\n function withdrawTo(address account, uint256 amount) external returns (uint256 totalAvailableCredit) {\\n return _withdrawTo(account, amount);\\n }\\n\\n /**\\n * @notice Admin method returns commissions spent by users.\\n * @param accounts Accounts whose commissions are being withdrawn.\\n * @return totalAccountFees The total amount of accounts commissions.\\n */\\n function gatherFees(address[] memory accounts) external onlyOwner returns (uint256 totalAccountFees) {\\n uint256 accountsLength = accounts.length;\\n unchecked {\\n for (uint256 i = 0; i < accountsLength; ++i) {\\n address account = accounts[i];\\n uint256 accountDeposit = _accountDeposits[account];\\n uint256 availableCredit_ = _charger.availableCredit(account);\\n _accountDeposits[account] = availableCredit_;\\n totalAccountFees += accountDeposit - availableCredit_; // overflow is impossible due to checks in FeeBankCharger\\n }\\n }\\n _token.safeTransfer(msg.sender, totalAccountFees);\\n }\\n\\n function _depositFor(address account, uint256 amount) internal returns (uint256 totalAvailableCredit) {\\n if (account == address(0)) revert ZeroAddress();\\n _token.safeTransferFrom(msg.sender, address(this), amount);\\n unchecked {\\n _accountDeposits[account] += amount; // overflow is impossible due to limited _token supply\\n }\\n totalAvailableCredit = _charger.increaseAvailableCredit(account, amount);\\n }\\n\\n function _withdrawTo(address account, uint256 amount) internal returns (uint256 totalAvailableCredit) {\\n totalAvailableCredit = _charger.decreaseAvailableCredit(msg.sender, amount);\\n unchecked {\\n _accountDeposits[msg.sender] -= amount; // overflow is impossible due to checks in FeeBankCharger\\n }\\n _token.safeTransfer(account, amount);\\n }\\n}\\n\",\"keccak256\":\"0xe5cb93f78da4947d2e5cea3c83f05b1d3d8fe78502888a7bb7a1a7f0bd892c6e\",\"license\":\"MIT\"},\"contracts/FeeBankCharger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./interfaces/IFeeBankCharger.sol\\\";\\nimport \\\"./FeeBank.sol\\\";\\n\\ncontract FeeBankCharger is IFeeBankCharger {\\n error OnlyFeeBankAccess();\\n error NotEnoughCredit();\\n\\n IFeeBank public immutable feeBank;\\n mapping(address => uint256) private _creditAllowance;\\n\\n modifier onlyFeeBank() {\\n if (msg.sender != address(feeBank)) revert OnlyFeeBankAccess();\\n _;\\n }\\n\\n constructor(IERC20 token) {\\n feeBank = new FeeBank(this, token, msg.sender);\\n }\\n\\n function availableCredit(address account) external view returns (uint256) {\\n return _creditAllowance[account];\\n }\\n\\n function increaseAvailableCredit(address account, uint256 amount) external onlyFeeBank returns (uint256 allowance) {\\n allowance = _creditAllowance[account];\\n unchecked {\\n allowance += amount; // overflow is impossible due to limited _token supply\\n }\\n _creditAllowance[account] = allowance;\\n }\\n\\n function decreaseAvailableCredit(address account, uint256 amount) external onlyFeeBank returns (uint256 allowance) {\\n allowance = _creditAllowance[account];\\n allowance -= amount; // checked math is needed to prevent underflow\\n _creditAllowance[account] = allowance;\\n }\\n\\n function _chargeFee(address account, uint256 fee) internal {\\n if (fee > 0) {\\n uint256 currentAllowance = _creditAllowance[account];\\n if (currentAllowance < fee) revert NotEnoughCredit();\\n unchecked {\\n _creditAllowance[account] = currentAllowance - fee;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5c779f5ce4afbcbbf779fc5e7f31dd4b3a1ee640d65ea0aba5d87b31109bcf45\",\"license\":\"MIT\"},\"contracts/Settlement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@1inch/limit-order-protocol-contract/contracts/interfaces/IOrderMixin.sol\\\";\\nimport \\\"@1inch/solidity-utils/contracts/libraries/SafeERC20.sol\\\";\\nimport \\\"./interfaces/ISettlement.sol\\\";\\nimport \\\"./interfaces/IResolver.sol\\\";\\nimport \\\"./libraries/DynamicSuffix.sol\\\";\\nimport \\\"./libraries/OrderSaltParser.sol\\\";\\nimport \\\"./libraries/OrderSuffix.sol\\\";\\nimport \\\"./FeeBankCharger.sol\\\";\\n\\ncontract Settlement is ISettlement, FeeBankCharger {\\n using SafeERC20 for IERC20;\\n using OrderSaltParser for uint256;\\n using DynamicSuffix for bytes;\\n using AddressLib for Address;\\n using OrderSuffix for OrderLib.Order;\\n using TakingFee for TakingFee.Data;\\n\\n error AccessDenied();\\n error IncorrectCalldataParams();\\n error FailedExternalCall();\\n error ResolverIsNotWhitelisted();\\n error WrongInteractionTarget();\\n\\n bytes1 private constant _FINALIZE_INTERACTION = 0x01;\\n uint256 private constant _ORDER_FEE_BASE_POINTS = 1e15;\\n uint256 private constant _BASE_POINTS = 10_000_000; // 100%\\n\\n IOrderMixin private immutable _limitOrderProtocol;\\n\\n modifier onlyThis(address account) {\\n if (account != address(this)) revert AccessDenied();\\n _;\\n }\\n\\n modifier onlyLimitOrderProtocol {\\n if (msg.sender != address(_limitOrderProtocol)) revert AccessDenied();\\n _;\\n }\\n\\n constructor(IOrderMixin limitOrderProtocol, IERC20 token)\\n FeeBankCharger(token)\\n {\\n _limitOrderProtocol = limitOrderProtocol;\\n }\\n\\n function settleOrders(bytes calldata data) external {\\n _settleOrder(data, msg.sender, 0, new bytes(0));\\n }\\n\\n function fillOrderInteraction(\\n address taker,\\n uint256, /* makingAmount */\\n uint256 takingAmount,\\n bytes calldata interactiveData\\n ) external onlyThis(taker) onlyLimitOrderProtocol returns (uint256 result) {\\n (DynamicSuffix.Data calldata suffix, bytes calldata tokensAndAmounts, bytes calldata interaction) = interactiveData.decodeSuffix();\\n IERC20 token = IERC20(suffix.token.get());\\n result = takingAmount * (_BASE_POINTS + suffix.rateBump) / _BASE_POINTS;\\n uint256 takingFee = result * suffix.takingFee.ratio() / TakingFee._TAKING_FEE_BASE;\\n\\n bytes memory allTokensAndAmounts = new bytes(tokensAndAmounts.length + 0x40);\\n assembly {\\n let ptr := add(allTokensAndAmounts, 0x20)\\n calldatacopy(ptr, tokensAndAmounts.offset, tokensAndAmounts.length)\\n ptr := add(ptr, tokensAndAmounts.length)\\n mstore(ptr, token)\\n mstore(add(ptr, 0x20), add(result, takingFee))\\n }\\n\\n if (interactiveData[0] == _FINALIZE_INTERACTION) {\\n _chargeFee(suffix.resolver.get(), suffix.totalFee);\\n address target = address(bytes20(interaction));\\n bytes calldata data = interaction[20:];\\n IResolver(target).resolveOrders(suffix.resolver.get(), allTokensAndAmounts, data);\\n } else {\\n _settleOrder(\\n interaction,\\n suffix.resolver.get(),\\n suffix.totalFee,\\n allTokensAndAmounts\\n );\\n }\\n\\n if (takingFee > 0) {\\n token.safeTransfer(suffix.takingFee.receiver(), takingFee);\\n }\\n token.forceApprove(address(_limitOrderProtocol), result);\\n }\\n\\n bytes4 private constant _FILL_ORDER_TO_SELECTOR = 0xe5d7bde6; // IOrderMixin.fillOrderTo.selector\\n bytes4 private constant _WRONG_INTERACTION_TARGET_SELECTOR = 0x5b34bf89; // WrongInteractionTarget.selector\\n\\n function _settleOrder(bytes calldata data, address resolver, uint256 totalFee, bytes memory tokensAndAmounts) private {\\n OrderLib.Order calldata order;\\n assembly {\\n order := add(data.offset, calldataload(data.offset))\\n }\\n if (!order.checkResolver(resolver)) revert ResolverIsNotWhitelisted();\\n TakingFee.Data takingFeeData = order.takingFee();\\n totalFee += order.salt.getFee() * _ORDER_FEE_BASE_POINTS;\\n\\n uint256 rateBump = order.rateBump();\\n uint256 suffixLength = DynamicSuffix._STATIC_DATA_SIZE + tokensAndAmounts.length + 0x20;\\n IOrderMixin limitOrderProtocol = _limitOrderProtocol;\\n\\n assembly {\\n function memcpy(dst, src, len) {\\n pop(staticcall(gas(), 0x4, src, len, dst, len))\\n }\\n\\n let interactionLengthOffset := calldataload(add(data.offset, 0x40))\\n let interactionOffset := add(interactionLengthOffset, 0x20)\\n let interactionLength := calldataload(add(data.offset, interactionLengthOffset))\\n\\n { // stack too deep\\n let target := shr(96, calldataload(add(data.offset, interactionOffset)))\\n if or(lt(interactionLength, 20), iszero(eq(target, address()))) {\\n mstore(0, _WRONG_INTERACTION_TARGET_SELECTOR)\\n revert(0, 4)\\n }\\n }\\n\\n // Copy calldata and patch interaction.length\\n let ptr := mload(0x40)\\n mstore(ptr, _FILL_ORDER_TO_SELECTOR)\\n calldatacopy(add(ptr, 4), data.offset, data.length)\\n mstore(add(add(ptr, interactionLengthOffset), 4), add(interactionLength, suffixLength))\\n\\n { // stack too deep\\n // Append suffix fields\\n let offset := add(add(ptr, interactionOffset), interactionLength)\\n mstore(add(offset, 0x04), totalFee)\\n mstore(add(offset, 0x24), resolver)\\n mstore(add(offset, 0x44), calldataload(add(order, 0x40))) // takerAsset\\n mstore(add(offset, 0x64), rateBump)\\n mstore(add(offset, 0x84), takingFeeData)\\n let tokensAndAmountsLength := mload(tokensAndAmounts)\\n memcpy(add(offset, 0xa4), add(tokensAndAmounts, 0x20), tokensAndAmountsLength)\\n mstore(add(offset, add(0xa4, tokensAndAmountsLength)), tokensAndAmountsLength)\\n }\\n\\n // Call fillOrderTo\\n if iszero(call(gas(), limitOrderProtocol, 0, ptr, add(add(4, suffixLength), data.length), ptr, 0)) {\\n returndatacopy(ptr, 0, returndatasize())\\n revert(ptr, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xe6dc182b50f3f7f534d49ad2d20328ef786b91b281580a93180560dafdd9f377\",\"license\":\"MIT\"},\"contracts/interfaces/IFeeBank.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\ninterface IFeeBank {\\n function availableCredit(address account) external view returns (uint256);\\n function deposit(uint256 amount) external returns (uint256 totalAvailableCredit);\\n function depositFor(address account, uint256 amount) external returns (uint256 totalAvailableCredit);\\n function depositWithPermit(uint256 amount, bytes calldata permit) external returns (uint256 totalAvailableCredit);\\n function depositForWithPermit(address account, uint256 amount, bytes calldata permit) external returns (uint256 totalAvailableCredit);\\n function withdraw(uint256 amount) external returns (uint256 totalAvailableCredit);\\n function withdrawTo(address account, uint256 amount) external returns (uint256 totalAvailableCredit);\\n}\\n\",\"keccak256\":\"0x5397b10487c19677fd3658d8ecf07f00facd19cfb7f924fe9f893018902221ef\",\"license\":\"MIT\"},\"contracts/interfaces/IFeeBankCharger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"./IFeeBank.sol\\\";\\n\\ninterface IFeeBankCharger {\\n function feeBank() external view returns (IFeeBank);\\n function availableCredit(address account) external view returns (uint256);\\n function increaseAvailableCredit(address account, uint256 amount) external returns (uint256 allowance);\\n function decreaseAvailableCredit(address account, uint256 amount) external returns (uint256 allowance);\\n}\\n\",\"keccak256\":\"0xf4fa7a9f3a5f85e5de5538097900870b418fd66c547484112fb742a7f468a2a0\",\"license\":\"MIT\"},\"contracts/interfaces/IResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\ninterface IResolver {\\n function resolveOrders(address resolver, bytes calldata tokensAndAmounts, bytes calldata data) external;\\n}\\n\",\"keccak256\":\"0x1cb45871766afa0874db74eb51dd1a44a0d4adf28306335a89901ef24af9bcdc\",\"license\":\"MIT\"},\"contracts/interfaces/ISettlement.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@1inch/limit-order-protocol-contract/contracts/interfaces/IInteractionNotificationReceiver.sol\\\";\\nimport \\\"./IFeeBankCharger.sol\\\";\\n\\ninterface ISettlement is IInteractionNotificationReceiver, IFeeBankCharger {\\n function settleOrders(bytes calldata order) external;\\n}\\n\",\"keccak256\":\"0x99bc548a08547026af9f32df5df8ee2b6841f55a09351888dc3dc653cd4d438b\",\"license\":\"MIT\"},\"contracts/libraries/DynamicSuffix.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@1inch/solidity-utils/contracts/libraries/AddressLib.sol\\\";\\nimport \\\"./TakingFee.sol\\\";\\n\\n// layout of dynamic suffix is as follows:\\n// 0x00 - 0x19: totalFee\\n// 0x20 - 0x39: resolver\\n// 0x40 - 0x59: token\\n// 0x60 - 0x79: rateBump\\n// 0x80 - 0x99: takingFee\\n// 0xa0 - 0x..: tokensAndAmounts bytes\\n// 0x.. - 0x..: tokensAndAmounts length in bytes\\nlibrary DynamicSuffix {\\n struct Data {\\n uint256 totalFee;\\n Address resolver;\\n Address token;\\n uint256 rateBump;\\n TakingFee.Data takingFee;\\n }\\n\\n uint256 internal constant _STATIC_DATA_SIZE = 0xa0;\\n\\n function decodeSuffix(bytes calldata cd) internal pure returns(Data calldata suffix, bytes calldata tokensAndAmounts, bytes calldata interaction) {\\n assembly {\\n let lengthOffset := sub(add(cd.offset, cd.length), 0x20)\\n tokensAndAmounts.length := calldataload(lengthOffset)\\n tokensAndAmounts.offset := sub(lengthOffset, tokensAndAmounts.length)\\n suffix := sub(tokensAndAmounts.offset, _STATIC_DATA_SIZE)\\n interaction.offset := add(cd.offset, 1)\\n interaction.length := sub(suffix, interaction.offset)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2f58676d9770d939978afa88717dddf9cf2155e10c556eed92c58d2234840888\",\"license\":\"MIT\"},\"contracts/libraries/OrderSaltParser.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\n/// @title Library for parsing parameters from salt.\\nlibrary OrderSaltParser {\\n uint256 private constant _TIME_START_MASK = 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000; // prettier-ignore\\n uint256 private constant _DURATION_MASK = 0x00000000FFFFFF00000000000000000000000000000000000000000000000000; // prettier-ignore\\n uint256 private constant _INITIAL_RATE_BUMP_MASK = 0x00000000000000FFFFFF00000000000000000000000000000000000000000000; // prettier-ignore\\n uint256 private constant _FEE_MASK = 0x00000000000000000000FFFFFFFF000000000000000000000000000000000000; // prettier-ignore\\n uint256 private constant _SALT_MASK = 0x0000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore\\n\\n uint256 private constant _TIME_START_SHIFT = 224; // orderTimeMask 224-255\\n uint256 private constant _DURATION_SHIFT = 200; // durationMask 200-223\\n uint256 private constant _INITIAL_RATE_BUMP_SHIFT = 176; // initialRateMask 176-200\\n uint256 private constant _FEE_SHIFT = 144; // orderFee 144-175\\n\\n function getStartTime(uint256 salt) internal pure returns (uint256) {\\n return (salt & _TIME_START_MASK) >> _TIME_START_SHIFT;\\n }\\n\\n function getDuration(uint256 salt) internal pure returns (uint256) {\\n return (salt & _DURATION_MASK) >> _DURATION_SHIFT;\\n }\\n\\n function getInitialRateBump(uint256 salt) internal pure returns (uint256) {\\n return (salt & _INITIAL_RATE_BUMP_MASK) >> _INITIAL_RATE_BUMP_SHIFT;\\n }\\n\\n function getFee(uint256 salt) internal pure returns (uint256) {\\n return (salt & _FEE_MASK) >> _FEE_SHIFT;\\n }\\n\\n function getSalt(uint256 salt) internal pure returns (uint256) {\\n return salt & _SALT_MASK;\\n }\\n}\\n\",\"keccak256\":\"0xa8be8397d5b9f930575fbcbcecd44965500bd783dac07390dd61a2e281cfdd04\",\"license\":\"MIT\"},\"contracts/libraries/OrderSuffix.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@1inch/limit-order-protocol-contract/contracts/OrderLib.sol\\\";\\nimport \\\"./OrderSaltParser.sol\\\";\\nimport \\\"./TakingFee.sol\\\";\\n\\n// Placed in the end of the order interactions data\\n// Last byte contains flags and lengths, can have up to 15 resolvers and 7 points\\nlibrary OrderSuffix {\\n using OrderSaltParser for uint256;\\n\\n // `Order.interactions` suffix structure:\\n // M*(2 + 3 bytes) - auction points coefficients with seconds delays\\n // N*(4 + 20 bytes) - resolver with corresponding time limit\\n // 4 bytes - public time limit\\n // 32 bytes - taking fee (optional if flags has _HAS_TAKING_FEE_FLAG)\\n // 1 bytes - flags\\n\\n uint256 private constant _HAS_TAKING_FEE_FLAG = 0x80;\\n uint256 private constant _RESOLVERS_LENGTH_MASK = 0x78;\\n uint256 private constant _RESOLVERS_LENGTH_BIT_SHIFT = 3;\\n uint256 private constant _POINTS_LENGTH_MASK = 0x07;\\n uint256 private constant _POINTS_LENGTH_BIT_SHIFT = 0;\\n\\n uint256 private constant _TAKING_FEE_BYTES_SIZE = 32;\\n\\n uint256 private constant _PUBLIC_TIME_LIMIT_BYTES_SIZE = 4;\\n uint256 private constant _PUBLIC_TIME_LIMIT_BIT_SHIFT = 224; // 256 - _PUBLIC_TIME_LIMIT_BYTES_SIZE * 8\\n\\n uint256 private constant _AUCTION_POINT_DELAY_BYTES_SIZE = 2;\\n uint256 private constant _AUCTION_POINT_BUMP_BYTES_SIZE = 3;\\n uint256 private constant _AUCTION_POINT_BYTES_SIZE = 5; // _AUCTION_POINT_DELAY_BYTES_SIZE + _AUCTION_POINT_BUMP_BYTES_SIZE;\\n uint256 private constant _AUCTION_POINT_DELAY_BIT_SHIFT = 240; // 256 - _AUCTION_POINT_DELAY_BYTES_SIZE * 8;\\n uint256 private constant _AUCTION_POINT_BUMP_BIT_SHIFT = 232; // 256 - _AUCTION_POINT_BUMP_BYTES_SIZE * 8;\\n\\n uint256 private constant _RESOLVER_TIME_LIMIT_BYTES_SIZE = 4;\\n uint256 private constant _RESOLVER_ADDRESS_BYTES_SIZE = 20;\\n uint256 private constant _RESOLVER_BYTES_SIZE = 24; // _RESOLVER_TIME_LIMIT_BYTES_SIZE + _RESOLVER_ADDRESS_BYTES_SIZE;\\n uint256 private constant _RESOLVER_TIME_LIMIT_BIT_SHIFT = 224; // 256 - _RESOLVER_TIME_LIMIT_BYTES_SIZE * 8;\\n uint256 private constant _RESOLVER_ADDRESS_BIT_SHIFT = 96; // 256 - _RESOLVER_ADDRESS_BYTES_SIZE * 8;\\n\\n function takingFee(OrderLib.Order calldata order) internal pure returns (TakingFee.Data ret) {\\n bytes calldata interactions = order.interactions;\\n assembly {\\n let ptr := sub(add(interactions.offset, interactions.length), 1)\\n if and(_HAS_TAKING_FEE_FLAG, byte(0, calldataload(ptr))) {\\n ret := calldataload(sub(ptr, _TAKING_FEE_BYTES_SIZE))\\n }\\n }\\n }\\n\\n function checkResolver(OrderLib.Order calldata order, address resolver) internal view returns (bool valid) {\\n bytes calldata interactions = order.interactions;\\n assembly {\\n let ptr := sub(add(interactions.offset, interactions.length), 1)\\n let flags := byte(0, calldataload(ptr))\\n ptr := sub(ptr, _PUBLIC_TIME_LIMIT_BYTES_SIZE)\\n if and(flags, _HAS_TAKING_FEE_FLAG) {\\n ptr := sub(ptr, _TAKING_FEE_BYTES_SIZE)\\n }\\n\\n let resolversCount := shr(_RESOLVERS_LENGTH_BIT_SHIFT, and(flags, _RESOLVERS_LENGTH_MASK))\\n\\n // Check public time limit\\n let publicLimit := shr(_PUBLIC_TIME_LIMIT_BIT_SHIFT, calldataload(ptr))\\n valid := gt(timestamp(), publicLimit)\\n\\n // Check resolvers and corresponding time limits\\n if iszero(valid) {\\n for { let end := sub(ptr, mul(_RESOLVER_BYTES_SIZE, resolversCount)) } gt(ptr, end) { } {\\n ptr := sub(ptr, _RESOLVER_ADDRESS_BYTES_SIZE)\\n let account := shr(_RESOLVER_ADDRESS_BIT_SHIFT, calldataload(ptr))\\n ptr := sub(ptr, _RESOLVER_TIME_LIMIT_BYTES_SIZE)\\n let limit := shr(_RESOLVER_TIME_LIMIT_BIT_SHIFT, calldataload(ptr))\\n if eq(account, resolver) {\\n valid := iszero(lt(timestamp(), limit))\\n break\\n }\\n }\\n }\\n }\\n }\\n\\n function rateBump(OrderLib.Order calldata order) internal view returns (uint256 bump) {\\n uint256 startBump = order.salt.getInitialRateBump();\\n uint256 cumulativeTime = order.salt.getStartTime();\\n uint256 lastTime = cumulativeTime + order.salt.getDuration();\\n if (block.timestamp <= cumulativeTime) {\\n return startBump;\\n } else if (block.timestamp >= lastTime) {\\n return 0;\\n }\\n\\n bytes calldata interactions = order.interactions;\\n assembly {\\n function linearInterpolation(t1, t2, v1, v2, t) -> v {\\n v := div(\\n add(mul(sub(t, t1), v2), mul(sub(t2, t), v1)),\\n sub(t2, t1)\\n )\\n }\\n\\n let ptr := sub(add(interactions.offset, interactions.length), 1)\\n\\n // move ptr to the last point\\n let pointsCount\\n { // stack too deep\\n let flags := byte(0, calldataload(ptr))\\n let resolversCount := shr(_RESOLVERS_LENGTH_BIT_SHIFT, and(flags, _RESOLVERS_LENGTH_MASK))\\n pointsCount := and(flags, _POINTS_LENGTH_MASK)\\n if and(flags, _HAS_TAKING_FEE_FLAG) {\\n ptr := sub(ptr, _TAKING_FEE_BYTES_SIZE)\\n }\\n ptr := sub(ptr, add(mul(_RESOLVER_BYTES_SIZE, resolversCount), _PUBLIC_TIME_LIMIT_BYTES_SIZE)) // 24 byte for each wl entry + 4 bytes for public time limit\\n }\\n\\n // Check points sequentially\\n let prevCoefficient := startBump\\n let prevCumulativeTime := cumulativeTime\\n for { let end := sub(ptr, mul(_AUCTION_POINT_BYTES_SIZE, pointsCount)) } gt(ptr, end) { } {\\n ptr := sub(ptr, _AUCTION_POINT_BUMP_BYTES_SIZE)\\n let coefficient := shr(_AUCTION_POINT_BUMP_BIT_SHIFT, calldataload(ptr))\\n ptr := sub(ptr, _AUCTION_POINT_DELAY_BYTES_SIZE)\\n let delay := shr(_AUCTION_POINT_DELAY_BIT_SHIFT, calldataload(ptr))\\n cumulativeTime := add(cumulativeTime, delay)\\n if gt(cumulativeTime, timestamp()) {\\n // prevCumulativeTime time cumulativeTime\\n // prevCoefficient X coefficient\\n bump := linearInterpolation(\\n prevCumulativeTime,\\n cumulativeTime,\\n prevCoefficient,\\n coefficient,\\n timestamp()\\n )\\n break\\n }\\n prevCumulativeTime := cumulativeTime\\n prevCoefficient := coefficient\\n }\\n\\n if iszero(bump) {\\n bump := linearInterpolation(\\n prevCumulativeTime,\\n lastTime,\\n prevCoefficient,\\n 0,\\n timestamp()\\n )\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x79e0e8e4b6eaa218b49b45d4860fb3843ecf0db92fae955213c68bc12a3433c7\",\"license\":\"MIT\"},\"contracts/libraries/TakingFee.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity 0.8.17;\\n\\nlibrary TakingFee {\\n type Data is uint256;\\n\\n uint256 internal constant _TAKING_FEE_BASE = 1e9;\\n uint256 private constant _TAKING_FEE_RATIO_OFFSET = 160;\\n\\n function enabled(Data self) internal pure returns (bool) {\\n return ratio(self) != 0;\\n }\\n\\n function ratio(Data self) internal pure returns (uint256) {\\n return uint32(Data.unwrap(self) >> _TAKING_FEE_RATIO_OFFSET);\\n }\\n\\n function receiver(Data self) internal pure returns (address) {\\n return address(uint160(Data.unwrap(self)));\\n }\\n}\\n\",\"keccak256\":\"0x93250a86e29b64eb3f3e4764a664eb27930df58e3fd31d53b95a38f6d3c0c571\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b506040516200236638038062002366833981016040819052610031916100c1565b803081336040516100419061009b565b6001600160a01b03938416815291831660208301529091166040820152606001604051809103906000f08015801561007d573d6000803e3d6000fd5b506001600160a01b039081166080529290921660a052506100fb9050565b6110e5806200128183390190565b6001600160a01b03811681146100be57600080fd5b50565b600080604083850312156100d457600080fd5b82516100df816100a9565b60208401519092506100f0816100a9565b809150509250929050565b60805160a0516111446200013d6000396000818161035e015281816106a7015261078201526000818161010001528181610197015261023c01526111446000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c806385eda2de1161005057806385eda2de146100e8578063af15d786146100fb578063ccee33d71461014757600080fd5b80630965d04b146100775780633ee5ef1f1461008c5780635886216f146100b2575b600080fd5b61008a610085366004610d53565b61015a565b005b61009f61009a366004610dbe565b61017d565b6040519081526020015b60405180910390f35b61009f6100c0366004610de8565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61009f6100f6366004610dbe565b610222565b6101227f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100a9565b61009f610155366004610e0a565b6102f4565b60408051600080825260208201909252610179918491849133916106de565b5050565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146101ee576040517fa454419900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5073ffffffffffffffffffffffffffffffffffffffff90911660009081526020819052604090208054919091019081905590565b60003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610293576040517fa454419900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020546102c48282610ed0565b73ffffffffffffffffffffffffffffffffffffffff90931660009081526020819052604090208390555090919050565b60008573ffffffffffffffffffffffffffffffffffffffff81163014610346576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146103b5576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8284017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081810135918290037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff40810192918101919060018801908881037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f01907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8081013590629896809061048c907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0013582610ee9565b610496908d610efc565b6104a09190610f13565b97506000633b9aca006104c063ffffffff60808a013560a01c168b610efc565b6104ca9190610f13565b905060006104d9866040610ee9565b67ffffffffffffffff8111156104f1576104f1610e72565b6040519080825280601f01601f19166020018201604052801561051b576020820181803683370190505b509050602081018688823786018381528a83016020909101527f01000000000000000000000000000000000000000000000000000000000000008c8c60008161056657610566610f4e565b9050013560f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361064e576105a6602089013589356108a6565b60006105b28587610f7d565b60601c90503660006105c7876014818b610fc5565b915091508273ffffffffffffffffffffffffffffffffffffffff16631944799f6105f28d6020013590565b8685856040518563ffffffff1660e01b81526004016106149493929190610fef565b600060405180830381600087803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050505050610660565b610660858560208b01358b35856106de565b811561068b5761068b73ffffffffffffffffffffffffffffffffffffffff841660808a013584610939565b6106cc73ffffffffffffffffffffffffffffffffffffffff84167f00000000000000000000000000000000000000000000000000000000000000008c6109a0565b50505050505050505095945050505050565b843585016106ec8185610a69565b610722576040517f4b57606900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061072d82610b38565b905061074a66038d7ea4c6800063ffffffff843560901c16610efc565b6107549085610ee9565b9350600061076183610b71565b90506000845160a06107739190610ee9565b61077e906020610ee9565b90507f00000000000000000000000000000000000000000000000000000000000000006107b4565b8281848460045afa50505050565b60408a013560208101818c0135818d013560601c30811415601483101715610800577f5b34bf890000000000000000000000000000000000000000000000000000000060005260046000fd5b506040517fe5d7bde60000000000000000000000000000000000000000000000000000000081528c8e600483013785820160048583010152818382010193508a60048501528b60248501526040890135604485015286606485015287608485015289516108748160208d0160a488016107a6565b84810160a40152600081878f016004018183895af1610896573d6000823e3d81fd5b5050505050505050505050505050565b80156101795773ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561090c576040517fa7fd379200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff92909216600090815260208190526040902091039055565b610965837fa9059cbb000000000000000000000000000000000000000000000000000000008484610cb6565b61099b576040517ffb7f507900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6109cc837f095ea7b3000000000000000000000000000000000000000000000000000000008484610cb6565b61099b576109fd837f095ea7b300000000000000000000000000000000000000000000000000000000846000610cb6565b1580610a325750610a30837f095ea7b3000000000000000000000000000000000000000000000000000000008484610cb6565b155b1561099b576040517f19be9a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60003681610a7b6101208601866110a9565b91509150600181830103803560001a6004820391506080811615610aa0576020820391505b813560e01c4211945060031c600f1684610b2e578060180282035b80831115610b2c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88301927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec013560601c833560e01c888203610b25574210159650610b2c9050565b5050610abb565b505b5050505092915050565b60003681610b4a6101208501856110a9565b91509150600181830103803560001a60801615610b6957602081033593505b505050919050565b600062ffffff823560b081901c82169160e082901c918491610b979160c81c1683610ee9565b9050814211610ba95750909392505050565b804210610bbb57506000949350505050565b366000610bcc6101208801886110a9565b915091506001818301036000813560001a6078811660031c6007821692506080821615610bfa576020840393505b6004816018020184039350505086868260050284035b80851115610c96577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb8501803560f01c9990990198947ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd013560e81c428a1115610c8c57828a03428481038302908c03860201049b5050610c96565b9250889150610c10565b5089610ca85780870342880383020499505b505050505050505050919050565b60006040518481528360048201528260248201526020600060448360008a5af19150508015610d02573d8015610cf857600160005114601f3d11169150610d00565b6000863b1191505b505b949350505050565b60008083601f840112610d1c57600080fd5b50813567ffffffffffffffff811115610d3457600080fd5b602083019150836020828501011115610d4c57600080fd5b9250929050565b60008060208385031215610d6657600080fd5b823567ffffffffffffffff811115610d7d57600080fd5b610d8985828601610d0a565b90969095509350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610db957600080fd5b919050565b60008060408385031215610dd157600080fd5b610dda83610d95565b946020939093013593505050565b600060208284031215610dfa57600080fd5b610e0382610d95565b9392505050565b600080600080600060808688031215610e2257600080fd5b610e2b86610d95565b94506020860135935060408601359250606086013567ffffffffffffffff811115610e5557600080fd5b610e6188828901610d0a565b969995985093965092949392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610ee357610ee3610ea1565b92915050565b80820180821115610ee357610ee3610ea1565b8082028115828204841417610ee357610ee3610ea1565b600082610f49577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008135818116916014851015610fbd5780818660140360031b1b83161692505b505092915050565b60008085851115610fd557600080fd5b83861115610fe257600080fd5b5050820193919092039150565b73ffffffffffffffffffffffffffffffffffffffff8516815260006020606081840152855180606085015260005b818110156110395787810183015185820160800152820161101d565b506000608082860101527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0915081601f820116840190506080848203016040850152846080820152848660a0830137600060a0868301015260a082601f8701168201019250505095945050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126110de57600080fd5b83018035915067ffffffffffffffff8211156110f957600080fd5b602001915036819003821315610d4c57600080fdfea26469706673582212209decfda13c061892c85ec07dd2e0a4f106537e3073a714dfed9b8127d7c4460564736f6c6343000811003360c06040523480156200001157600080fd5b50604051620010e5380380620010e58339810160408190526200003491620001fd565b6200003f33620000b6565b6001600160a01b038316620000675760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0382166200008f5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0380841660a0528216608052620000ad8162000106565b50505062000251565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200011062000189565b6001600160a01b0381166200017b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b6200018681620000b6565b50565b6000546001600160a01b03163314620001e55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000172565b565b6001600160a01b03811681146200018657600080fd5b6000806000606084860312156200021357600080fd5b83516200022081620001e7565b60208501519093506200023381620001e7565b60408501519092506200024681620001e7565b809150509250925092565b60805160a051610e44620002a16000396000818161028b015281816103a0015281816105a90152610778015260008181610207015281816104640152818161064801526106ed0152610e446000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063715018a611610081578063b6b55f251161005b578063b6b55f2514610185578063bfe9173414610198578063f2fde38b146101ab57600080fd5b8063715018a6146101405780638da5cb5b1461014a57806397a2cb641461017257600080fd5b80632f4f21e2116100b25780632f4f21e21461010757806332d323a51461011a5780635886216f1461012d57600080fd5b8063205c2878146100ce5780632e1a7d4d146100f4575b600080fd5b6100e16100dc366004610b67565b6101be565b6040519081526020015b60405180910390f35b6100e1610102366004610b91565b6101d3565b6100e1610115366004610b67565b6101df565b6100e1610128366004610bf3565b6101eb565b6100e161013b366004610c4d565b610243565b6101486102f8565b005b60005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100eb565b6100e1610180366004610c97565b61030c565b6100e1610193366004610b91565b610491565b6100e16101a6366004610d7a565b61049d565b6101486101b9366004610c4d565b6104b5565b60006101ca8383610571565b90505b92915050565b60006101cd3383610571565b60006101ca8383610684565b600061022e73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001684846107e7565b6102388585610684565b90505b949350505050565b6040517f5886216f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301526000917f000000000000000000000000000000000000000000000000000000000000000090911690635886216f90602401602060405180830381865afa1580156102d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101cd9190610dc6565b610300610803565b61030a6000610884565b565b6000610316610803565b815160005b8181101561044957600084828151811061033757610337610ddf565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff8082166000818152600190945260408085205490517f5886216f00000000000000000000000000000000000000000000000000000000815260048101929092529294509192917f000000000000000000000000000000000000000000000000000000000000000090911690635886216f90602401602060405180830381865afa1580156103e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040d9190610dc6565b73ffffffffffffffffffffffffffffffffffffffff9093166000908152600160208190526040909120849055929091039490940193500161031b565b5061048b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633846108f9565b50919050565b60006101cd3383610684565b60006104ab338585856101eb565b90505b9392505050565b6104bd610803565b73ffffffffffffffffffffffffffffffffffffffff8116610565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61056e81610884565b50565b6040517f85eda2de000000000000000000000000000000000000000000000000000000008152336004820152602481018290526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906385eda2de906044016020604051808303816000875af1158015610607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062b9190610dc6565b3360009081526001602052604090208054849003905590506101cd7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1684846108f9565b600073ffffffffffffffffffffffffffffffffffffffff83166106d3576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61071573ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633308561095b565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602052604090819020805486019055517f3ee5ef1f0000000000000000000000000000000000000000000000000000000081526004810191909152602481018490527f000000000000000000000000000000000000000000000000000000000000000090911690633ee5ef1f906044016020604051808303816000875af11580156107c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101ca9190610dc6565b6107f28383836109f8565b6107fe576107fe610a9e565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461030a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161055c565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610925837fa9059cbb000000000000000000000000000000000000000000000000000000008484610aaa565b6107fe576040517ffb7f507900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006323b872dd60e01b905060006040518281528560048201528460248201528360448201526020600060648360008b5af191505080156109b9573d80156109af57600160005114601f3d111691506109b7565b6000873b1191505b505b806109f0576040517ff405907100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050505050565b600060e0829003610a3657610a2f847fd505accf000000000000000000000000000000000000000000000000000000008585610afd565b90506104ae565b610100829003610a6c57610a2f847f8fcbaf0c000000000000000000000000000000000000000000000000000000008585610afd565b6040517f6827585700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040513d6000823e3d81fd5b60006040518481528360048201528260248201526020600060448360008a5af1915050801561023b573d8015610aec57600160005114601f3d11169150610af4565b6000863b1191505b50949350505050565b6000816004016040518581528385600483013760206000838360008b5af192505050801561023b573d8015610aec57600160005114601f3d11169150610af4565b803573ffffffffffffffffffffffffffffffffffffffff81168114610b6257600080fd5b919050565b60008060408385031215610b7a57600080fd5b610b8383610b3e565b946020939093013593505050565b600060208284031215610ba357600080fd5b5035919050565b60008083601f840112610bbc57600080fd5b50813567ffffffffffffffff811115610bd457600080fd5b602083019150836020828501011115610bec57600080fd5b9250929050565b60008060008060608587031215610c0957600080fd5b610c1285610b3e565b935060208501359250604085013567ffffffffffffffff811115610c3557600080fd5b610c4187828801610baa565b95989497509550505050565b600060208284031215610c5f57600080fd5b6101ca82610b3e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020808385031215610caa57600080fd5b823567ffffffffffffffff80821115610cc257600080fd5b818501915085601f830112610cd657600080fd5b813581811115610ce857610ce8610c68565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715610d2b57610d2b610c68565b604052918252848201925083810185019188831115610d4957600080fd5b938501935b82851015610d6e57610d5f85610b3e565b84529385019392850192610d4e565b98975050505050505050565b600080600060408486031215610d8f57600080fd5b83359250602084013567ffffffffffffffff811115610dad57600080fd5b610db986828701610baa565b9497909650939450505050565b600060208284031215610dd857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea26469706673582212208d58d4bb957ed2fe42a7ba782899d50c9dc88ce2310ca1b0e54f0e02540a897a64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c806385eda2de1161005057806385eda2de146100e8578063af15d786146100fb578063ccee33d71461014757600080fd5b80630965d04b146100775780633ee5ef1f1461008c5780635886216f146100b2575b600080fd5b61008a610085366004610d53565b61015a565b005b61009f61009a366004610dbe565b61017d565b6040519081526020015b60405180910390f35b61009f6100c0366004610de8565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b61009f6100f6366004610dbe565b610222565b6101227f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100a9565b61009f610155366004610e0a565b6102f4565b60408051600080825260208201909252610179918491849133916106de565b5050565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146101ee576040517fa454419900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5073ffffffffffffffffffffffffffffffffffffffff90911660009081526020819052604090208054919091019081905590565b60003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610293576040517fa454419900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5073ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020546102c48282610ed0565b73ffffffffffffffffffffffffffffffffffffffff90931660009081526020819052604090208390555090919050565b60008573ffffffffffffffffffffffffffffffffffffffff81163014610346576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146103b5576040517f4ca8886700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8284017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081810135918290037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff40810192918101919060018801908881037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3f01907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8081013590629896809061048c907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0013582610ee9565b610496908d610efc565b6104a09190610f13565b97506000633b9aca006104c063ffffffff60808a013560a01c168b610efc565b6104ca9190610f13565b905060006104d9866040610ee9565b67ffffffffffffffff8111156104f1576104f1610e72565b6040519080825280601f01601f19166020018201604052801561051b576020820181803683370190505b509050602081018688823786018381528a83016020909101527f01000000000000000000000000000000000000000000000000000000000000008c8c60008161056657610566610f4e565b9050013560f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361064e576105a6602089013589356108a6565b60006105b28587610f7d565b60601c90503660006105c7876014818b610fc5565b915091508273ffffffffffffffffffffffffffffffffffffffff16631944799f6105f28d6020013590565b8685856040518563ffffffff1660e01b81526004016106149493929190610fef565b600060405180830381600087803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050505050610660565b610660858560208b01358b35856106de565b811561068b5761068b73ffffffffffffffffffffffffffffffffffffffff841660808a013584610939565b6106cc73ffffffffffffffffffffffffffffffffffffffff84167f00000000000000000000000000000000000000000000000000000000000000008c6109a0565b50505050505050505095945050505050565b843585016106ec8185610a69565b610722576040517f4b57606900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061072d82610b38565b905061074a66038d7ea4c6800063ffffffff843560901c16610efc565b6107549085610ee9565b9350600061076183610b71565b90506000845160a06107739190610ee9565b61077e906020610ee9565b90507f00000000000000000000000000000000000000000000000000000000000000006107b4565b8281848460045afa50505050565b60408a013560208101818c0135818d013560601c30811415601483101715610800577f5b34bf890000000000000000000000000000000000000000000000000000000060005260046000fd5b506040517fe5d7bde60000000000000000000000000000000000000000000000000000000081528c8e600483013785820160048583010152818382010193508a60048501528b60248501526040890135604485015286606485015287608485015289516108748160208d0160a488016107a6565b84810160a40152600081878f016004018183895af1610896573d6000823e3d81fd5b5050505050505050505050505050565b80156101795773ffffffffffffffffffffffffffffffffffffffff82166000908152602081905260409020548181101561090c576040517fa7fd379200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff92909216600090815260208190526040902091039055565b610965837fa9059cbb000000000000000000000000000000000000000000000000000000008484610cb6565b61099b576040517ffb7f507900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6109cc837f095ea7b3000000000000000000000000000000000000000000000000000000008484610cb6565b61099b576109fd837f095ea7b300000000000000000000000000000000000000000000000000000000846000610cb6565b1580610a325750610a30837f095ea7b3000000000000000000000000000000000000000000000000000000008484610cb6565b155b1561099b576040517f19be9a9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60003681610a7b6101208601866110a9565b91509150600181830103803560001a6004820391506080811615610aa0576020820391505b813560e01c4211945060031c600f1684610b2e578060180282035b80831115610b2c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe88301927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec013560601c833560e01c888203610b25574210159650610b2c9050565b5050610abb565b505b5050505092915050565b60003681610b4a6101208501856110a9565b91509150600181830103803560001a60801615610b6957602081033593505b505050919050565b600062ffffff823560b081901c82169160e082901c918491610b979160c81c1683610ee9565b9050814211610ba95750909392505050565b804210610bbb57506000949350505050565b366000610bcc6101208801886110a9565b915091506001818301036000813560001a6078811660031c6007821692506080821615610bfa576020840393505b6004816018020184039350505086868260050284035b80851115610c96577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb8501803560f01c9990990198947ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd013560e81c428a1115610c8c57828a03428481038302908c03860201049b5050610c96565b9250889150610c10565b5089610ca85780870342880383020499505b505050505050505050919050565b60006040518481528360048201528260248201526020600060448360008a5af19150508015610d02573d8015610cf857600160005114601f3d11169150610d00565b6000863b1191505b505b949350505050565b60008083601f840112610d1c57600080fd5b50813567ffffffffffffffff811115610d3457600080fd5b602083019150836020828501011115610d4c57600080fd5b9250929050565b60008060208385031215610d6657600080fd5b823567ffffffffffffffff811115610d7d57600080fd5b610d8985828601610d0a565b90969095509350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610db957600080fd5b919050565b60008060408385031215610dd157600080fd5b610dda83610d95565b946020939093013593505050565b600060208284031215610dfa57600080fd5b610e0382610d95565b9392505050565b600080600080600060808688031215610e2257600080fd5b610e2b86610d95565b94506020860135935060408601359250606086013567ffffffffffffffff811115610e5557600080fd5b610e6188828901610d0a565b969995985093965092949392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610ee357610ee3610ea1565b92915050565b80820180821115610ee357610ee3610ea1565b8082028115828204841417610ee357610ee3610ea1565b600082610f49577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008135818116916014851015610fbd5780818660140360031b1b83161692505b505092915050565b60008085851115610fd557600080fd5b83861115610fe257600080fd5b5050820193919092039150565b73ffffffffffffffffffffffffffffffffffffffff8516815260006020606081840152855180606085015260005b818110156110395787810183015185820160800152820161101d565b506000608082860101527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0915081601f820116840190506080848203016040850152846080820152848660a0830137600060a0868301015260a082601f8701168201019250505095945050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126110de57600080fd5b83018035915067ffffffffffffffff8211156110f957600080fd5b602001915036819003821315610d4c57600080fdfea26469706673582212209decfda13c061892c85ec07dd2e0a4f106537e3073a714dfed9b8127d7c4460564736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 12690, + "contract": "contracts/Settlement.sol:Settlement", + "label": "_creditAllowance", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/hardhat.networks.js b/hardhat.networks.js index 9b283e5..6e2a7f4 100644 --- a/hardhat.networks.js +++ b/hardhat.networks.js @@ -45,6 +45,7 @@ register('xdai', 100, process.env.XDAI_RPC_URL, process.env.XDAI_PRIVATE_KEY, 'g register('avax', 43114, process.env.AVAX_RPC_URL, process.env.AVAX_PRIVATE_KEY, 'avalanche', process.env.AVAX_ETHERSCAN_KEY); register('fantom', 250, process.env.FANTOM_RPC_URL, process.env.FANTOM_PRIVATE_KEY, 'opera', process.env.FANTOM_ETHERSCAN_KEY); register('aurora', 1313161554, process.env.AURORA_RPC_URL, process.env.AURORA_PRIVATE_KEY, 'aurora', process.env.AURORA_ETHERSCAN_KEY); +register('base', 8453, process.env.BASE_RPC_URL, process.env.BASE_PRIVATE_KEY, 'base', process.env.BASE_ETHERSCAN_KEY); registerCustom('klaytn', 8217, process.env.KLAYTN_RPC_URL, process.env.KLAYTN_PRIVATE_KEY, process.env.KLAYTN_ETHERSCAN_KEY, 'https://scope.klaytn.com/', 'https://scope.klaytn.com/'); module.exports = {