From a7b1f13a162858cd6c41dab44c4a6095e03dfac5 Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 28 Aug 2024 16:20:50 +0900 Subject: [PATCH] feat: deploy new controller --- deploy/Controller.ts | 2 +- deployments/421614/Controller.json | 38 +- deployments/80084/.chainId | 1 + deployments/80084/BookViewer.json | 642 +++++++++ deployments/80084/Controller.json | 1244 +++++++++++++++++ .../8ab01b92ea083f19aa223a9d45d915fe.json | 168 +++ .../bc262cef2a9e7c4c429d3b8e35df889c.json | 186 +++ deployments/8453/Controller.json | 6 +- hardhat.config.ts | 21 +- package-lock.json | 313 ++--- package.json | 10 +- utils/constants.ts | 10 +- 12 files changed, 2412 insertions(+), 229 deletions(-) create mode 100644 deployments/80084/.chainId create mode 100644 deployments/80084/BookViewer.json create mode 100644 deployments/80084/Controller.json create mode 100644 deployments/80084/solcInputs/8ab01b92ea083f19aa223a9d45d915fe.json create mode 100644 deployments/80084/solcInputs/bc262cef2a9e7c4c429d3b8e35df889c.json diff --git a/deploy/Controller.ts b/deploy/Controller.ts index 0c0396e..b123c98 100644 --- a/deploy/Controller.ts +++ b/deploy/Controller.ts @@ -13,7 +13,7 @@ const deployFunction: DeployFunction = async function (hre: HardhatRuntimeEnviro const chain = await getChain(network.provider) const deployer = (await getNamedAccounts())['deployer'] as Address - await deployCreate3WithVerify(deployer, 0xffffn + 2n, 'Controller', [BOOK_MANAGER[chain.id]]) + await deployCreate3WithVerify(deployer, 0xfffffn, 'Controller', [BOOK_MANAGER[chain.id]]) } deployFunction.tags = ['Controller'] diff --git a/deployments/421614/Controller.json b/deployments/421614/Controller.json index e69f627..690cba0 100644 --- a/deployments/421614/Controller.json +++ b/deployments/421614/Controller.json @@ -1,5 +1,5 @@ { - "address": "0x42D9B8eFB54d0d763c4219e1B9E1846C60A56463", + "address": "0x747b1D740B51f458568A24448162F51B933aa68d", "abi": [ { "inputs": [ @@ -12,6 +12,17 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, { "inputs": [], "name": "ControllerSlippage", @@ -27,6 +38,27 @@ "name": "ERC20TransferFailed", "type": "error" }, + { + "inputs": [], + "name": "FailedCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "InsufficientBalance", + "type": "error" + }, { "inputs": [], "name": "InvalidAccess", @@ -971,10 +1003,10 @@ "type": "receive" } ], - "transactionHash": "0xd590262bd9e43beaf0bb5b9f9eae34f77800eb38ee6b8f9b48e081300081ed3b", + "transactionHash": "0x", "args": [ "0xC528b9ED5d56d1D0d3C18A2342954CE1069138a4" ], "numDeployments": 1, - "bytecode": "0x60a0604052348015600e575f80fd5b506040516156ee3803806156ee833981016040819052602b91603b565b6001600160a01b03166080526066565b5f60208284031215604a575f80fd5b81516001600160a01b0381168114605f575f80fd5b9392505050565b60805161555f61018f5f395f818161017a015281816104e601528181610585015281816107690152818161094701528181610a8e01528181610c1e01528181610caf01528181610d7901528181610ed401528181611147015281816113ac01528181611769015281816119b101528181611a7401528181611ed001528181611f5801528181612038015281816121ec0152818161228f0152818161232a015281816124370152818161257b0152818161261e015281816126b9015281816127d2015281816129200152818161299a01528181612a3e01528181612b3901528181612bb101528181612c0901528181612c9a01528181612d5401528181612dfe01528181612e7901528181612ef301528181612f8401528181612ff901526135dd015261555f5ff3fe6080604052600436106100e7575f3560e01c80637658ab0511610087578063a183a10411610057578063a183a10414610295578063c0e8e89a146102b4578063d09ef241146102c7578063fe81574614610310575f80fd5b80637658ab05146102245780637d773110146102445780638feb85b714610257578063a04c796b14610276575f80fd5b80633f322bc9116100c25780633f322bc91461016957806341a8bb88146101b4578063483f9f2f146101d35780635083585814610205575f80fd5b806309ae2c13146100f257806315c7afb4146101075780631ae45a121461013c575f80fd5b366100ee57005b5f80fd5b610105610100366004613d1f565b610323565b005b348015610112575f80fd5b50610126610121366004613ed0565b610570565b6040516101339190613f8a565b60405180910390f35b348015610147575f80fd5b5061015b610156366004613fb0565b610bf2565b604051908152602001610133565b348015610174575f80fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610133565b3480156101bf575f80fd5b5061015b6101ce366004613fe4565b610c8f565b3480156101de575f80fd5b506101f26101ed36600461401b565b610dfc565b60405160029190910b8152602001610133565b348015610210575f80fd5b5061015b61021f366004614032565b610e06565b61023761023236600461408d565b610e13565b6040516101339190614181565b610237610252366004613d1f565b610f80565b348015610262575f80fd5b506101056102713660046141c4565b6111eb565b348015610281575f80fd5b506101056102903660046141c4565b611434565b3480156102a0575f80fd5b506101056102af366004614245565b6115b3565b6101056102c2366004613d1f565b6117ee565b3480156102d2575f80fd5b506102e66102e136600461401b565b61196f565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610133565b61023761031e366004613d1f565b611b90565b80806001600160401b031642111561034e5760405163637910d560e11b815260040160405180910390fd5b838361035a8282611d13565b885f816001600160401b0381111561037457610374613dd8565b60405190808252806020026020018201604052801561039d578160200160208202803683370190505b5090505f826001600160401b038111156103b9576103b9613dd8565b6040519080825280602002602001820160405280156103ec57816020015b60608152602001906001900390816103d75790505b5090505f5b838110156104a457600383828151811061040d5761040d614297565b60200260200101906006811115610426576104266142ab565b90816006811115610439576104396142ab565b9052508d8d8281811061044e5761044e614297565b905060200281019061046091906142bf565b60405160200161047091906143a8565b60405160208183030381529060405282828151811061049157610491614297565b60209081029190910101526001016103f1565b505f3383838e8e6040516020016104bf9594939291906144b3565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061051d90309085906004016144fb565b5f604051808303815f875af1158015610538573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261055f9190810190614569565b505050505050505050505050505050565b606061057a611e1a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415806105bb57506001600160a01b0383163014155b156105f2576040517fc0185c6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805f808580602001905181019061060a91906146b2565b8251939750919550935091505f816001600160401b0381111561062f5761062f613dd8565b604051908082528060200260200182016040528015610658578160200160208202803683370190505b5090505f805b83811015610bad575f87828151811061067957610679614297565b602002602001015190505f6006811115610695576106956142ab565b8160068111156106a7576106a76142ab565b036106e6576106e18783815181106106c1576106c1614297565b60200260200101518060200190518101906106dc9190614865565b611e99565b610ba4565b60018160068111156106fa576106fa6142ab565b036107f2575f61073588848151811061071557610715614297565b602002602001015180602001905181019061073091906148f4565b611f33565b905080156107ec576040516323b872dd60e01b81523060048201526001600160a01b038b81166024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064015f604051808303815f87803b1580156107aa575f80fd5b505af11580156107bc573d5f803e3d5ffd5b50505050808585806107cd9061499f565b9650815181106107df576107df614297565b6020026020010181815250505b50610ba4565b6002816006811115610806576108066142ab565b03610841575f61073588848151811061082157610821614297565b602002602001015180602001905181019061083c91906149b7565b61210c565b6003816006811115610855576108556142ab565b036108965761088f87838151811061086f5761086f614297565b602002602001015180602001905181019061088a9190614b1d565b6121c5565b5050610ba4565b60048160068111156108aa576108aa6142ab565b036108e45761088f8783815181106108c4576108c4614297565b60200260200101518060200190518101906108df9190614b1d565b612554565b60058160068111156108f8576108f86142ab565b03610a2b575f87838151811061091057610910614297565b602002602001015180602001905181019061092b9190614b4e565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa15801561099c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c09190614ba4565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610a0c575f80fd5b505afa158015610a1e573d5f803e3d5ffd5b5050505061088f826128e9565b6006816006811115610a3f57610a3f6142ab565b03610b72575f878381518110610a5757610a57614297565b6020026020010151806020019051810190610a729190614bbf565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa158015610ae3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b079190614ba4565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610b53575f80fd5b505afa158015610b65573d5f803e3d5ffd5b5050505061088f82612997565b6040517f4a7f394f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060010161065e565b50610bb88785612b11565b80825281604051602001610bcc9190614181565b604051602081830303815290604052975050505050505050610bec613202565b92915050565b60405163cdc92f2d60e01b81526001600160c01b03821660048201525f90610bec906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cdc92f2d90602401602060405180830381865afa158015610c63573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c879190614c3a565b60020b613227565b604051639b22917d60e01b81526001600160c01b03831660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190614c55565b602001516040517f41a8bb880000000000000000000000000000000000000000000000000000000081526001600160c01b0385166004820152600284900b60248201526001600160401b03909116906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610dbe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de29190614c6f565b6001600160401b0316610df59190614c8a565b9392505050565b5f610bec826134ef565b5f610bec8260020b613227565b606081806001600160401b0316421115610e405760405163637910d560e11b815260040160405180910390fd5b8b8a14610e79576040517f947d5a8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e838787611d13565b610e8d858561359b565b5f338e8e8e8e8e8e604051602001610eab9796959493929190614ca1565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca1799890610f0b90309086906004016144fb565b5f604051808303815f875af1158015610f26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f4d9190810190614569565b905080515f14610f6e5780806020019051810190610f6b9190614d70565b93505b5050509b9a5050505050505050505050565b606081806001600160401b0316421115610fad5760405163637910d560e11b815260040160405180910390fd5b8484610fb98282611d13565b895f816001600160401b03811115610fd357610fd3613dd8565b604051908082528060200260200182016040528015610ffc578160200160208202803683370190505b5090505f826001600160401b0381111561101857611018613dd8565b60405190808252806020026020018201604052801561104b57816020015b60608152602001906001900390816110365790505b5090505f5b8381101561110357600183828151811061106c5761106c614297565b60200260200101906006811115611085576110856142ab565b90816006811115611098576110986142ab565b9052508e8e828181106110ad576110ad614297565b90506020028101906110bf9190614dfb565b6040516020016110cf9190614e0f565b6040516020818303038152906040528282815181106110f0576110f0614297565b6020908102919091010152600101611050565b505f3383838f8f60405160200161111e9594939291906144b3565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061117e90309086906004016144fb565b5f604051808303815f875af1158015611199573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111c09190810190614569565b9050808060200190518101906111d69190614d70565b98505050505050505050979650505050505050565b80806001600160401b03164211156112165760405163637910d560e11b815260040160405180910390fd5b611220848461359b565b865f816001600160401b0381111561123a5761123a613dd8565b604051908082528060200260200182016040528015611263578160200160208202803683370190505b5090505f826001600160401b0381111561127f5761127f613dd8565b6040519080825280602002602001820160405280156112b257816020015b606081526020019060019003908161129d5790505b5090505f5b8381101561136a5760058382815181106112d3576112d3614297565b602002602001019060068111156112ec576112ec6142ab565b908160068111156112ff576112ff6142ab565b9052508b8b8281811061131457611314614297565b90506020028101906113269190614e72565b6040516020016113369190614e86565b60405160208183030381529060405282828151811061135757611357614297565b60209081029190910101526001016112b7565b505f3383838c8c6040516020016113859594939291906144b3565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906113e390309085906004016144fb565b5f604051808303815f875af11580156113fe573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114259190810190614569565b50505050505050505050505050565b80806001600160401b031642111561145f5760405163637910d560e11b815260040160405180910390fd5b611469848461359b565b865f816001600160401b0381111561148357611483613dd8565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b5090505f826001600160401b038111156114c8576114c8613dd8565b6040519080825280602002602001820160405280156114fb57816020015b60608152602001906001900390816114e65790505b5090505f5b8381101561136a57600683828151811061151c5761151c614297565b60200260200101906006811115611535576115356142ab565b90816006811115611548576115486142ab565b9052508b8b8281811061155d5761155d614297565b905060200281019061156f9190614eb3565b60405160200161157f9190614ec7565b6040516020818303038152906040528282815181106115a0576115a0614297565b6020908102919091010152600101611500565b80806001600160401b03164211156115de5760405163637910d560e11b815260040160405180910390fd5b825f816001600160401b038111156115f8576115f8613dd8565b604051908082528060200260200182016040528015611621578160200160208202803683370190505b5090505f826001600160401b0381111561163d5761163d613dd8565b60405190808252806020026020018201604052801561167057816020015b606081526020019060019003908161165b5790505b5090505f5b83811015611727575f83828151811061169057611690614297565b602002602001019060068111156116a9576116a96142ab565b908160068111156116bc576116bc6142ab565b9052508787828181106116d1576116d1614297565b90506020028101906116e39190614efe565b6040516020016116f39190614f28565b60405160208183030381529060405282828151811061171457611714614297565b6020908102919091010152600101611675565b5060605f338484846040516020016117429493929190614fef565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906117a090309085906004016144fb565b5f604051808303815f875af11580156117bb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117e29190810190614569565b50505050505050505050565b80806001600160401b03164211156118195760405163637910d560e11b815260040160405180910390fd5b83836118258282611d13565b885f816001600160401b0381111561183f5761183f613dd8565b604051908082528060200260200182016040528015611868578160200160208202803683370190505b5090505f826001600160401b0381111561188457611884613dd8565b6040519080825280602002602001820160405280156118b757816020015b60608152602001906001900390816118a25790505b5090505f5b838110156104a45760048382815181106118d8576118d8614297565b602002602001019060068111156118f1576118f16142ab565b90816006811115611904576119046142ab565b9052508d8d8281811061191957611919614297565b905060200281019061192b91906142bf565b60405160200161193b91906143a8565b60405160208183030381529060405282828151811061195c5761195c614297565b60209081029190910101526001016118bc565b5f8080808080604087901c62ffffff602889901c16604051639b22917d60e01b81526001600160c01b038316600482015291935091505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156119f6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1a9190614c55565b60208101519091506001600160401b0316611a38600284900b613227565b6040517fd09ef241000000000000000000000000000000000000000000000000000000008152600481018b90529097505f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d09ef24190602401606060405180830381865afa158015611ab9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611add919061506d565b80516020820151909a50909150611afd906001600160401b031683614c8a565b6060840151604083015191985090611b2e90611b22906001600160401b031685614c8a565b600287900b905f6136b2565b9650611b3f8162ffffff1660171c90565b611b83575f611b5462ffffff831689836136dc565b90505f8113611b7557611b66816150bf565b611b7090896150f5565b611b7f565b611b7f8189615108565b9750505b5050505050509193509193565b606081806001600160401b0316421115611bbd5760405163637910d560e11b815260040160405180910390fd5b8484611bc98282611d13565b895f816001600160401b03811115611be357611be3613dd8565b604051908082528060200260200182016040528015611c0c578160200160208202803683370190505b5090505f826001600160401b03811115611c2857611c28613dd8565b604051908082528060200260200182016040528015611c5b57816020015b6060815260200190600190039081611c465790505b5090505f5b83811015611103576002838281518110611c7c57611c7c614297565b60200260200101906006811115611c9557611c956142ab565b90816006811115611ca857611ca86142ab565b9052508e8e82818110611cbd57611cbd614297565b9050602002810190611ccf9190614efe565b604051602001611cdf919061511b565b604051602081830303815290604052828281518110611d0057611d00614297565b6020908102919091010152600101611c60565b5f5b81811015611e15575f838383818110611d3057611d30614297565b905060c00201803603810190611d469190615225565b60408101515190915015611e0c5780516020808301516040808501518051938101518183015160609092015192517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810194909452606484019490945260ff909316608483015260a482019290925260c48101919091526001600160a01b039091169063d505accf9060e4015f604051808303815f87803b158015611df9575f80fd5b505af1925050508015611e0a575060015b505b50600101611d15565b505050565b7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45c15611e73576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60017f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b805160208201516040517ffefc7c510000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263fefc7c5192611f0392600401615261565b5f604051808303815f87803b158015611f1a575f80fd5b505af1158015611f2c573d5f803e3d5ffd5b5050505050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f9081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015611fa5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc99190614c55565b90505f83604001519050611fe6826060015162ffffff1660171c90565b156120035760608201516120009062ffffff16825f61375c565b90505b5f61202583602001516001600160401b03168361202091906152ec565b6137a0565b90506001600160401b03811615612104577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631dbef4886040518060800160405280868152602001886020015160020b8152602001846001600160401b031681526020015f6001600160a01b031681525087606001516040518363ffffffff1660e01b81526004016120c192919061530b565b60408051808303815f875af11580156120dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061210091906153b9565b5093505b505050919050565b5f806121556040518060a00160405280855f01516001600160c01b0316815260200185604001518152602001856080015181526020015f81526020018560a00151815250612554565b915050808360800181815161216a9190615108565b9052506080830151156121bf576121bc604051806080016040528085602001516001600160c01b03168152602001856060015160020b8152602001856080015181526020018560c00151815250611f33565b91505b50919050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015612239573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061225d9190614c55565b90505b8284604001511180156123025750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156122dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061230091906153db565b155b1561252957835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612377573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239b9190614c3a565b90506123a98160020b613227565b856020015111156123ba5750612529565b5f6123ce8360a0015162ffffff1660171c90565b156123ff576123f88587604001510360018560a0015162ffffff1661375c9092919063ffffffff16565b9050612409565b8486604001510390505b60208301516001600160401b03168082049082061515600116019050805f03612433575050612529565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612487876137a0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b81526004016124b59291906153fa565b60408051808303815f875af11580156124d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124f491906153b9565b91509150815f036125085750505050612529565b61251282886150f5565b965061251e81876150f5565b955050505050612260565b818460600151101561254e57604051630f271b5560e41b815260040160405180910390fd5b50915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa1580156125c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125ec9190614c55565b90505b8360400151821080156126915750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa15801561266b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061268f91906153db565b155b156128c457835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612706573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061272a9190614c3a565b90506127388160020b613227565b8560200151111561274957506128c4565b5f61275d8360a0015162ffffff1660171c90565b1561277057838660400151039050612797565b612794848760400151035f8560a0015162ffffff1661375c9092919063ffffffff16565b90505b60208301516001600160401b03166127b4600284900b835f6137f7565b6127be91906152ec565b9050805f036127ce5750506128c4565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612822876137a0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b81526004016128509291906153fa565b60408051808303815f875af115801561286b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061288f91906153b9565b91509150805f036128a357505050506128c4565b6128ad82886150f5565b96506128b981876150f5565b9550505050506125ef565b828460600151111561254e57604051630f271b5560e41b815260040160405180910390fd5b805160208201516040517f38926b6d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926338926b6d9261295392600401615494565b6020604051808303815f875af115801561296f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061299391906154ac565b5050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b22917d6129d4845f015160401c90565b6040516001600160e01b031960e084901b1681526001600160c01b03909116600482015260240160c060405180830381865afa158015612a16573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a3a9190614c55565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166314d6a9eb6040518060400160405280855f01518152602001612a9f85602001516001600160401b0316876020015161202091906152ec565b6001600160401b031681525084604001516040518363ffffffff1660e01b8152600401612acd9291906154c3565b6020604051808303815f875af1925050508015612b07575060408051601f3d908101601f19168201909252612b04918101906154ac565b60015b1561299357505050565b60405163258473db60e21b81523060048201525f602482018190529081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612b7e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ba291906154ac565b90505f811215612c7557612bea7f0000000000000000000000000000000000000000000000000000000000000000612bd9836150bf565b6001600160a01b0385169190613839565b604051636a256b2960e01b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612c4f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c7391906154ac565b505b60405163258473db60e21b81523060048201526001600160a01b0383811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612cdf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d0391906154ac565b90505f811315612dac576040517fd9caed120000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528581166024830152604482018390527f0000000000000000000000000000000000000000000000000000000000000000169063d9caed12906064015f604051808303815f87803b158015612d95575f80fd5b505af1158015612da7573d5f803e3d5ffd5b505050505b82515f5b818110156131e7575f858281518110612dcb57612dcb614297565b602090810291909101015160405163258473db60e21b81523060048201526001600160a01b0380831660248301529192507f000000000000000000000000000000000000000000000000000000000000000090911690639611cf6c90604401602060405180830381865afa158015612e45573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e6991906154ac565b93505f841215612f5f57612ed4877f0000000000000000000000000000000000000000000000000000000000000000612ea1876150bf565b898681518110612eb357612eb3614297565b60200260200101516001600160a01b0316613908909392919063ffffffff16565b604051636a256b2960e01b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612f39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f5d91906154ac565b505b60405163258473db60e21b81523060048201526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612fc9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fed91906154ac565b93505f8413156130a7577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed1287848151811061303857613038614297565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908a166024820152604481018790526064015f604051808303815f87803b158015613090575f80fd5b505af11580156130a2573d5f803e3d5ffd5b505050505b5f8683815181106130ba576130ba614297565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613121573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061314591906154ac565b905080156131dd5786838151811061315f5761315f614297565b602090810291909101015160405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af11580156131b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131db91906153db565b505b5050600101612db0565b504715611f2c57611f2c6001600160a01b0384168647613839565b5f7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b5f61323182613977565b815f600282900b8113613244578161324d565b61324d826154ef565b62ffffff8116915060011615613271576bfff97272373d413259a469909250613282565b6c0100000000000000000000000092505b60028116156132a15760606bfff2e50f5f656932ef12357c8402901c92505b60048116156132c05760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156132df5760606bffcb9843d60f6159c9db58838402901c92505b60108116156132fe5760606bff973b41fa98c081472e68968402901c92505b602081161561331d5760606bff2ea16466c96a3843ec78b38402901c92505b604081161561333c5760606bfe5dee046a99a2a811c461f18402901c92505b608081161561335b5760606bfcbe86c7900a88aedcffc83b8402901c92505b61010081161561337b5760606bf987a7253ac413176f2b074c8402901c92505b61020081161561339b5760606bf3392b0822b70005940c7a398402901c92505b6104008116156133bb5760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156133db5760606bd097f3bdfd2022b8845ad8f78402901c92505b6110008116156133fb5760606ba9f746462d870fdf8a65dc1f8402901c92505b61200081161561341b5760606b70d869a156d2a1b890bb3df68402901c92505b61400081161561343b5760606b31be135f97d08fd9812315058402901c92505b61800081161561345b5760606b09aa508b5b7a84e1c677de548402901c92505b6201000081161561347b5760606a5d6af8dedb81196699c3298402901c92505b6202000081161561349a576060692216e584f5fa1ea926048402901c92505b620400008116156134b757606067048a170391f7dc428402901c92505b5f8260020b13156134e8576134e58378010000000000000000000000000000000000000000000000006152ec565b92505b5050919050565b5f81750c6c1313451aab317fb9b67e11777e9a5a6ccdb2ebae811180613517575062149bbb81105b1561354d576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f700100000000000000000000000000000000613569856139d6565b6527107fff7434028161357e5761357e6152d8565b0590508361358b82613227565b11156121bc575f190191506121bf565b5f5b81811015611e15575f8383838181106135b8576135b8614297565b905060a002016020018036038101906135d1919061550f565b8051909150156136a9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637ac2ff7b3086868681811061361d5761361d614297565b865160208801516040808a015160608b015191516001600160e01b031960e08b901b1681526001600160a01b03909816600489015260a090940295909501356024870152604486019190915260ff16606485015260848401525060a482015260c4015f604051808303815f87803b158015613696575f80fd5b505af19250505080156136a7575060015b505b5060010161359d565b5f6136d4606084901b6136c78660020b613227565b8082061515851691040190565b949350505050565b5f6207a11f19627fffff851601600281900b821282816136fe57825f03613700565b825b62ffffff1690505f6137396137158389614c8a565b620f42408861372b578581830615151691040190565b808206151586151691040190565b90508261374e57613749816150bf565b613750565b805b98975050505050505050565b5f6207a11f19627fffff85160181831561377657815f0391505b81620f4240019050613796620f4240866137909190614c8a565b82900490565b9695505050505050565b5f6001600160401b038211156137f357604080517f6dfcc6500000000000000000000000000000000000000000000000000000000081526004810191909152602481018390526044015b60405180910390fd5b5090565b5f6136d46138078560020b613227565b6138119085614c8a565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b5f6001600160a01b03841661388e575f805f8085875af1905080613889576040517ff4b3b1bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613902565b60405163a9059cbb60e01b81526001600160a01b038416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080613902576040517ff27f64e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b179052613902908590613bef565b6207ffff600282900b138061399c57506139936207ffff6154ef565b60020b8160020b125b156139d3576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6fffffffffffffffffffffffffffffffff811160071b81811c6001600160401b031060061b1781811c63ffffffff1060051b1781811c61ffff1060041b1781811c60ff1060031b175f8213613a3257631615e6385f526004601cfd5b7103782dace9d90000000000000000000000007ff8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff6f8421084210842108cc6318c6db6d54be84841c1c601f161a90911891821b609f90811c6c465772b2bbbb5f824b15207a3081018102606090811d6d0388eaa27412d5aca026815d636e018202811d6d0df99ac502031bf953eff472fdcc018202811d6d13cdffb29d51d99322bdff5f2211018202811d6d0a0f742023def783a307a986912e018202811d6d01920d8043ca89b5239253284e42018202811d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7883018302821d6d0139601a2efabe717e604cbb4894018302821d6d02247f7a7b6594320649aa03aba1018302821d6c8c3f38e95a6b1ff2ab1c3b343619018302821d6d02384773bdf1ac5676facced60901901830290911d6cb9a025d814b29c212b8b1a07cd19019091027ffffffffffffffff5f6af8f7b3396644f18e157960000000000000000000000000105711340daa0d5f769dba1915cef59f0815a5506029290037d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302919091010590565b5f8060205f8451602086015f885af180613c0e576040513d5f823e3d81fd5b50505f513d91508115613c25578060011415613c32565b6001600160a01b0384163b155b15613902576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016137ea565b5f8083601f840112613c84575f80fd5b5081356001600160401b03811115613c9a575f80fd5b6020830191508360208260051b8501011115613cb4575f80fd5b9250929050565b5f8083601f840112613ccb575f80fd5b5081356001600160401b03811115613ce1575f80fd5b60208301915083602060c083028501011115613cb4575f80fd5b6001600160401b03811681146139d3575f80fd5b8035613d1a81613cfb565b919050565b5f805f805f805f6080888a031215613d35575f80fd5b87356001600160401b0380821115613d4b575f80fd5b613d578b838c01613c74565b909950975060208a0135915080821115613d6f575f80fd5b613d7b8b838c01613c74565b909750955060408a0135915080821115613d93575f80fd5b50613da08a828b01613cbb565b9094509250506060880135613db481613cfb565b8091505092959891949750929550565b6001600160a01b03811681146139d3575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b0381118282101715613e0e57613e0e613dd8565b60405290565b604051608081016001600160401b0381118282101715613e0e57613e0e613dd8565b60405160e081016001600160401b0381118282101715613e0e57613e0e613dd8565b604051606081016001600160401b0381118282101715613e0e57613e0e613dd8565b604051601f8201601f191681016001600160401b0381118282101715613ea257613ea2613dd8565b604052919050565b5f6001600160401b03821115613ec257613ec2613dd8565b50601f01601f191660200190565b5f8060408385031215613ee1575f80fd5b8235613eec81613dc4565b915060208301356001600160401b03811115613f06575f80fd5b8301601f81018513613f16575f80fd5b8035613f29613f2482613eaa565b613e7a565b818152866020838501011115613f3d575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610df56020830184613f5c565b6001600160c01b03811681146139d3575f80fd5b5f60208284031215613fc0575f80fd5b8135610df581613f9c565b8060020b81146139d3575f80fd5b8035613d1a81613fcb565b5f8060408385031215613ff5575f80fd5b823561400081613f9c565b9150602083013561401081613fcb565b809150509250929050565b5f6020828403121561402b575f80fd5b5035919050565b5f60208284031215614042575f80fd5b8135610df581613fcb565b5f8083601f84011261405d575f80fd5b5081356001600160401b03811115614073575f80fd5b60208301915083602060a083028501011115613cb4575f80fd5b5f805f805f805f805f805f60c08c8e0312156140a7575f80fd5b6001600160401b03808d3511156140bc575f80fd5b6140c98e8e358f01613c74565b909c509a5060208d01358110156140de575f80fd5b6140ee8e60208f01358f01613c74565b909a50985060408d0135811015614103575f80fd5b6141138e60408f01358f01613c74565b909850965060608d0135811015614128575f80fd5b6141388e60608f01358f01613cbb565b909650945060808d013581101561414d575f80fd5b5061415e8d60808e01358e0161404d565b909350915061416f60a08d01613d0f565b90509295989b509295989b9093969950565b602080825282518282018190525f9190848201906040850190845b818110156141b85783518352928401929184019160010161419c565b50909695505050505050565b5f805f805f805f6080888a0312156141da575f80fd5b87356001600160401b03808211156141f0575f80fd5b6141fc8b838c01613c74565b909950975060208a0135915080821115614214575f80fd5b6142208b838c01613c74565b909750955060408a0135915080821115614238575f80fd5b50613da08a828b0161404d565b5f805f60408486031215614257575f80fd5b83356001600160401b0381111561426c575f80fd5b61427886828701613c74565b909450925050602084013561428c81613cfb565b809150509250925092565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f8235609e198336030181126142d3575f80fd5b9190910192915050565b5f808335601e198436030181126142f2575f80fd5b83016020810192503590506001600160401b03811115614310575f80fd5b803603821315613cb4575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f813561435281613f9c565b6001600160c01b03811684525060208201356020840152604082013560408401526060820135606084015261438a60808301836142dd565b60a0608086015261439f60a08601828461431e565b95945050505050565b602081525f610df56020830184614346565b5f600782106143d757634e487b7160e01b5f52602160045260245ffd5b50815260200190565b5f815180845260208085019450602084015f5b83811015614414576144068783516143ba565b9650908201906001016143f3565b509495945050505050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101561446a57601f19868403018952614458838351613f5c565b9884019892509083019060010161443c565b5090979650505050505050565b8183525f60208085019450825f5b8581101561441457813561449881613dc4565b6001600160a01b031687529582019590820190600101614485565b6001600160a01b0386168152608060208201525f6144d460808301876143e0565b82810360408401526144e6818761441f565b90508281036060840152613750818587614477565b6001600160a01b0383168152604060208201525f6136d46040830184613f5c565b5f82601f83011261452b575f80fd5b8151614539613f2482613eaa565b81815284602083860101111561454d575f80fd5b8160208501602083015e5f918101602001919091529392505050565b5f60208284031215614579575f80fd5b81516001600160401b0381111561458e575f80fd5b6136d48482850161451c565b5f6001600160401b038211156145b2576145b2613dd8565b5060051b60200190565b600781106139d3575f80fd5b5f82601f8301126145d7575f80fd5b815160206145e7613f248361459a565b82815260059290921b84018101918181019086841115614605575f80fd5b8286015b848110156146425780516001600160401b03811115614626575f80fd5b6146348986838b010161451c565b845250918301918301614609565b509695505050505050565b5f82601f83011261465c575f80fd5b8151602061466c613f248361459a565b8083825260208201915060208460051b87010193508684111561468d575f80fd5b602086015b848110156146425780516146a581613dc4565b8352918301918301614692565b5f805f80608085870312156146c5575f80fd5b84516146d081613dc4565b809450506020808601516001600160401b03808211156146ee575f80fd5b818801915088601f830112614701575f80fd5b815161470f613f248261459a565b81815260059190911b8301840190848101908b83111561472d575f80fd5b938501935b82851015614754578451614745816145bc565b82529385019390850190614732565b60408b0151909850945050508083111561476c575f80fd5b61477889848a016145c8565b9450606088015192508083111561478d575f80fd5b505061479b8782880161464d565b91505092959194509250565b62ffffff811681146139d3575f80fd5b5f60c082840312156147c7575f80fd5b60405160c081018181106001600160401b03821117156147e9576147e9613dd8565b806040525080915082516147fc81613dc4565b8152602083015161480c81613cfb565b6020820152604083015161481f81613dc4565b60408201526060830151614832816147a7565b6060820152608083015161484581613dc4565b608082015260a0830151614858816147a7565b60a0919091015292915050565b5f60208284031215614875575f80fd5b81516001600160401b038082111561488b575f80fd5b9083019060e0828603121561489e575f80fd5b6148a6613dec565b6148b086846147b7565b815260c0830151828111156148c3575f80fd5b6148cf8782860161451c565b60208301525095945050505050565b8051613d1a81613f9c565b8051613d1a81613fcb565b5f60208284031215614904575f80fd5b81516001600160401b038082111561491a575f80fd5b908301906080828603121561492d575f80fd5b614935613e14565b825161494081613f9c565b8152602083015161495081613fcb565b602082015260408381015190820152606083015182811115614970575f80fd5b61497c8782860161451c565b60608301525095945050505050565b634e487b7160e01b5f52601160045260245ffd5b5f600182016149b0576149b061498b565b5060010190565b5f602082840312156149c7575f80fd5b81516001600160401b03808211156149dd575f80fd5b9083019060e082860312156149f0575f80fd5b6149f8613e36565b614a01836148de565b8152614a0f602084016148de565b602082015260408301516040820152614a2a606084016148e9565b60608201526080830151608082015260a083015182811115614a4a575f80fd5b614a568782860161451c565b60a08301525060c083015182811115614a6d575f80fd5b614a798782860161451c565b60c08301525095945050505050565b5f60a08284031215614a98575f80fd5b60405160a081016001600160401b038282108183111715614abb57614abb613dd8565b8160405282935084519150614acf82613f9c565b8183526020850151602084015260408501516040840152606085015160608401526080850151915080821115614b03575f80fd5b50614b108582860161451c565b6080830152505092915050565b5f60208284031215614b2d575f80fd5b81516001600160401b03811115614b42575f80fd5b6136d484828501614a88565b5f60208284031215614b5e575f80fd5b81516001600160401b0380821115614b74575f80fd5b9083019060408286031215614b87575f80fd5b614b8f613dec565b825181526020830151828111156148c3575f80fd5b5f60208284031215614bb4575f80fd5b8151610df581613dc4565b5f60208284031215614bcf575f80fd5b81516001600160401b0380821115614be5575f80fd5b9083019060608286031215614bf8575f80fd5b614c00613e58565b8251815260208301516020820152604083015182811115614c1f575f80fd5b614c2b8782860161451c565b60408301525095945050505050565b5f60208284031215614c4a575f80fd5b8151610df581613fcb565b5f60c08284031215614c65575f80fd5b610df583836147b7565b5f60208284031215614c7f575f80fd5b8151610df581613cfb565b8082028115828204841417610bec57610bec61498b565b6001600160a01b0388168152608060208083018290529082018790525f90889060a08401835b8a811015614cf3578335614cda816145bc565b614ce483826143ba565b94840194925050600101614cc7565b5084810360408601528781528181019250600588901b81018201895f5b8a811015614d4a57838303601f19018652614d2b828d6142dd565b614d3685828461431e565b978701979450505090840190600101614d10565b50508581036060870152614d5f81888a614477565b9d9c50505050505050505050505050565b5f6020808385031215614d81575f80fd5b82516001600160401b03811115614d96575f80fd5b8301601f81018513614da6575f80fd5b8051614db4613f248261459a565b81815260059190911b82018301908381019087831115614dd2575f80fd5b928401925b82841015614df057835182529284019290840190614dd7565b979650505050505050565b5f8235607e198336030181126142d3575f80fd5b602081525f8235614e1f81613f9c565b6001600160c01b0381166020840152506020830135614e3d81613fcb565b8060020b60408401525060408301356060830152614e5e60608401846142dd565b60808085015261439f60a08501828461431e565b5f8235603e198336030181126142d3575f80fd5b60208152813560208201525f614e9f60208401846142dd565b60408085015261439f60608501828461431e565b5f8235605e198336030181126142d3575f80fd5b6020815281356020820152602082013560408201525f614eea60408401846142dd565b60608085015261439f60808501828461431e565b5f823560de198336030181126142d3575f80fd5b8035613d1a816147a7565b8035613d1a81613dc4565b602081525f8235614f3881613dc4565b6001600160a01b03808216602085015260208501359150614f5882613cfb565b6001600160401b038216604085015260408501359150614f7782613dc4565b16606083810191909152830135614f8d816147a7565b62ffffff8116608084015250614fa560808401614f1d565b6001600160a01b03811660a084015250614fc160a08401614f12565b62ffffff811660c084015250614fda60c08401846142dd565b60e08085015261439f6101008501828461431e565b5f6001600160a01b03808716835260206080602085015261501360808501886143e0565b8481036040860152615025818861441f565b8581036060870152865180825260208089019350909101905f5b8181101561505d57835186168352928401929184019160010161503f565b50909a9950505050505050505050565b5f6060828403121561507d575f80fd5b615085613e58565b825161509081613dc4565b815260208301516150a081613cfb565b602082015260408301516150b381613cfb565b60408201529392505050565b5f7f800000000000000000000000000000000000000000000000000000000000000082036150ef576150ef61498b565b505f0390565b80820180821115610bec57610bec61498b565b81810381811115610bec57610bec61498b565b602081525f823561512b81613f9c565b6001600160c01b038116602084015250602083013561514981613f9c565b6001600160c01b0381166040840152506040830135606083015261516f60608401613fd9565b61517e608084018260020b9052565b50608083013560a083015261519660a08401846142dd565b60e060c08501526151ac6101008501828461431e565b9150506151bc60c08501856142dd565b848303601f190160e086015261379683828461431e565b5f608082840312156151e3575f80fd5b6151eb613e14565b905081358152602082013560ff81168114615204575f80fd5b80602083015250604082013560408201526060820135606082015292915050565b5f60c08284031215615235575f80fd5b61523d613e58565b823561524881613dc4565b8152602083810135908201526150b384604085016151d3565b6152c381846001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b60e060c08201525f6136d460e0830184613f5c565b634e487b7160e01b5f52601260045260245ffd5b5f8261530657634e487b7160e01b5f52601260045260245ffd5b500490565b5f6101406153728386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e08401526001600160a01b036060860151166101008401528061012084015261439f81840185613f5c565b5f80604083850312156153ca575f80fd5b505080516020909101519092909150565b5f602082840312156153eb575f80fd5b81518015158114610df5575f80fd5b5f6101206154618386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e08401528061010084015261439f81840185613f5c565b828152604060208201525f6136d46040830184613f5c565b5f602082840312156154bc575f80fd5b5051919050565b825181526001600160401b036020840151166020820152606060408201525f6136d46060830184613f5c565b5f8160020b627fffff1981036155075761550761498b565b5f0392915050565b5f6080828403121561551f575f80fd5b610df583836151d356fea26469706673582212203e29aa7b98d1328d0d49eb1218f6ff8d751e76ba58eadc29a30bffc66bb3a1e764736f6c63430008190033" + "bytecode": "0x60a0604052348015600e575f80fd5b5060405161582e38038061582e833981016040819052602b91603b565b6001600160a01b03166080526066565b5f60208284031215604a575f80fd5b81516001600160a01b0381168114605f575f80fd5b9392505050565b60805161569f61018f5f395f818161017a015281816104e601528181610585015281816107690152818161094701528181610a8e01528181610c1e01528181610caf01528181610d7901528181610ed401528181611147015281816113ac01528181611769015281816119b101528181611a7401528181611ed001528181611f5801528181612038015281816121eb0152818161228e0152818161232901528181612436015281816125840152818161261d015281816126bf015281816127dc01528181612931015281816129ab01528181612a4f01528181612b4a01528181612bc201528181612c1a01528181612cab01528181612d6501528181612e0f01528181612e8a01528181612f0401528181612f950152818161300a01526135ed015261569f5ff3fe6080604052600436106100e7575f3560e01c80637658ab0511610087578063a183a10411610057578063a183a10414610295578063c0e8e89a146102b4578063d09ef241146102c7578063fe81574614610310575f80fd5b80637658ab05146102245780637d773110146102445780638feb85b714610257578063a04c796b14610276575f80fd5b80633f322bc9116100c25780633f322bc91461016957806341a8bb88146101b4578063483f9f2f146101d35780635083585814610205575f80fd5b806309ae2c13146100f257806315c7afb4146101075780631ae45a121461013c575f80fd5b366100ee57005b5f80fd5b610105610100366004613e49565b610323565b005b348015610112575f80fd5b50610126610121366004613ffa565b610570565b60405161013391906140b4565b60405180910390f35b348015610147575f80fd5b5061015b6101563660046140da565b610bf2565b604051908152602001610133565b348015610174575f80fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610133565b3480156101bf575f80fd5b5061015b6101ce36600461410e565b610c8f565b3480156101de575f80fd5b506101f26101ed366004614145565b610dfc565b60405160029190910b8152602001610133565b348015610210575f80fd5b5061015b61021f36600461415c565b610e06565b6102376102323660046141b7565b610e13565b60405161013391906142ab565b610237610252366004613e49565b610f80565b348015610262575f80fd5b506101056102713660046142ee565b6111eb565b348015610281575f80fd5b506101056102903660046142ee565b611434565b3480156102a0575f80fd5b506101056102af36600461436f565b6115b3565b6101056102c2366004613e49565b6117ee565b3480156102d2575f80fd5b506102e66102e1366004614145565b61196f565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610133565b61023761031e366004613e49565b611b90565b80806001600160401b031642111561034e5760405163637910d560e11b815260040160405180910390fd5b838361035a8282611d13565b885f816001600160401b0381111561037457610374613f02565b60405190808252806020026020018201604052801561039d578160200160208202803683370190505b5090505f826001600160401b038111156103b9576103b9613f02565b6040519080825280602002602001820160405280156103ec57816020015b60608152602001906001900390816103d75790505b5090505f5b838110156104a457600383828151811061040d5761040d6143c1565b60200260200101906006811115610426576104266143d5565b90816006811115610439576104396143d5565b9052508d8d8281811061044e5761044e6143c1565b905060200281019061046091906143e9565b60405160200161047091906144d2565b604051602081830303815290604052828281518110610491576104916143c1565b60209081029190910101526001016103f1565b505f3383838e8e6040516020016104bf9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061051d9030908590600401614625565b5f604051808303815f875af1158015610538573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261055f9190810190614693565b505050505050505050505050505050565b606061057a611e1a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415806105bb57506001600160a01b0383163014155b156105f2576040517fc0185c6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805f808580602001905181019061060a91906147dc565b8251939750919550935091505f816001600160401b0381111561062f5761062f613f02565b604051908082528060200260200182016040528015610658578160200160208202803683370190505b5090505f805b83811015610bad575f878281518110610679576106796143c1565b602002602001015190505f6006811115610695576106956143d5565b8160068111156106a7576106a76143d5565b036106e6576106e18783815181106106c1576106c16143c1565b60200260200101518060200190518101906106dc919061498f565b611e99565b610ba4565b60018160068111156106fa576106fa6143d5565b036107f2575f610735888481518110610715576107156143c1565b60200260200101518060200190518101906107309190614a1e565b611f33565b905080156107ec576040516323b872dd60e01b81523060048201526001600160a01b038b81166024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064015f604051808303815f87803b1580156107aa575f80fd5b505af11580156107bc573d5f803e3d5ffd5b50505050808585806107cd90614ac9565b9650815181106107df576107df6143c1565b6020026020010181815250505b50610ba4565b6002816006811115610806576108066143d5565b03610841575f610735888481518110610821576108216143c1565b602002602001015180602001905181019061083c9190614ae1565b61210c565b6003816006811115610855576108556143d5565b036108965761088f87838151811061086f5761086f6143c1565b602002602001015180602001905181019061088a9190614c47565b6121c4565b5050610ba4565b60048160068111156108aa576108aa6143d5565b036108e45761088f8783815181106108c4576108c46143c1565b60200260200101518060200190518101906108df9190614c47565b612553565b60058160068111156108f8576108f86143d5565b03610a2b575f878381518110610910576109106143c1565b602002602001015180602001905181019061092b9190614c78565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa15801561099c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c09190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610a0c575f80fd5b505afa158015610a1e573d5f803e3d5ffd5b5050505061088f826128fa565b6006816006811115610a3f57610a3f6143d5565b03610b72575f878381518110610a5757610a576143c1565b6020026020010151806020019051810190610a729190614ce9565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa158015610ae3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b079190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610b53575f80fd5b505afa158015610b65573d5f803e3d5ffd5b5050505061088f826129a8565b6040517f4a7f394f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060010161065e565b50610bb88785612b22565b80825281604051602001610bcc91906142ab565b604051602081830303815290604052975050505050505050610bec613213565b92915050565b60405163cdc92f2d60e01b81526001600160c01b03821660048201525f90610bec906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cdc92f2d90602401602060405180830381865afa158015610c63573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c879190614d64565b60020b613238565b604051639b22917d60e01b81526001600160c01b03831660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190614d7f565b602001516040517f41a8bb880000000000000000000000000000000000000000000000000000000081526001600160c01b0385166004820152600284900b60248201526001600160401b03909116906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610dbe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de29190614d99565b6001600160401b0316610df59190614db4565b9392505050565b5f610bec826134f6565b5f610bec8260020b613238565b606081806001600160401b0316421115610e405760405163637910d560e11b815260040160405180910390fd5b8b8a14610e79576040517f947d5a8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e838787611d13565b610e8d85856135ab565b5f338e8e8e8e8e8e604051602001610eab9796959493929190614dcb565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca1799890610f0b9030908690600401614625565b5f604051808303815f875af1158015610f26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f4d9190810190614693565b905080515f14610f6e5780806020019051810190610f6b9190614e9a565b93505b5050509b9a5050505050505050505050565b606081806001600160401b0316421115610fad5760405163637910d560e11b815260040160405180910390fd5b8484610fb98282611d13565b895f816001600160401b03811115610fd357610fd3613f02565b604051908082528060200260200182016040528015610ffc578160200160208202803683370190505b5090505f826001600160401b0381111561101857611018613f02565b60405190808252806020026020018201604052801561104b57816020015b60608152602001906001900390816110365790505b5090505f5b8381101561110357600183828151811061106c5761106c6143c1565b60200260200101906006811115611085576110856143d5565b90816006811115611098576110986143d5565b9052508e8e828181106110ad576110ad6143c1565b90506020028101906110bf9190614f25565b6040516020016110cf9190614f39565b6040516020818303038152906040528282815181106110f0576110f06143c1565b6020908102919091010152600101611050565b505f3383838f8f60405160200161111e9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061117e9030908690600401614625565b5f604051808303815f875af1158015611199573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111c09190810190614693565b9050808060200190518101906111d69190614e9a565b98505050505050505050979650505050505050565b80806001600160401b03164211156112165760405163637910d560e11b815260040160405180910390fd5b61122084846135ab565b865f816001600160401b0381111561123a5761123a613f02565b604051908082528060200260200182016040528015611263578160200160208202803683370190505b5090505f826001600160401b0381111561127f5761127f613f02565b6040519080825280602002602001820160405280156112b257816020015b606081526020019060019003908161129d5790505b5090505f5b8381101561136a5760058382815181106112d3576112d36143c1565b602002602001019060068111156112ec576112ec6143d5565b908160068111156112ff576112ff6143d5565b9052508b8b82818110611314576113146143c1565b90506020028101906113269190614f9c565b6040516020016113369190614fb0565b604051602081830303815290604052828281518110611357576113576143c1565b60209081029190910101526001016112b7565b505f3383838c8c6040516020016113859594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906113e39030908590600401614625565b5f604051808303815f875af11580156113fe573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114259190810190614693565b50505050505050505050505050565b80806001600160401b031642111561145f5760405163637910d560e11b815260040160405180910390fd5b61146984846135ab565b865f816001600160401b0381111561148357611483613f02565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b5090505f826001600160401b038111156114c8576114c8613f02565b6040519080825280602002602001820160405280156114fb57816020015b60608152602001906001900390816114e65790505b5090505f5b8381101561136a57600683828151811061151c5761151c6143c1565b60200260200101906006811115611535576115356143d5565b90816006811115611548576115486143d5565b9052508b8b8281811061155d5761155d6143c1565b905060200281019061156f9190614fdd565b60405160200161157f9190614ff1565b6040516020818303038152906040528282815181106115a0576115a06143c1565b6020908102919091010152600101611500565b80806001600160401b03164211156115de5760405163637910d560e11b815260040160405180910390fd5b825f816001600160401b038111156115f8576115f8613f02565b604051908082528060200260200182016040528015611621578160200160208202803683370190505b5090505f826001600160401b0381111561163d5761163d613f02565b60405190808252806020026020018201604052801561167057816020015b606081526020019060019003908161165b5790505b5090505f5b83811015611727575f838281518110611690576116906143c1565b602002602001019060068111156116a9576116a96143d5565b908160068111156116bc576116bc6143d5565b9052508787828181106116d1576116d16143c1565b90506020028101906116e39190615028565b6040516020016116f39190615052565b604051602081830303815290604052828281518110611714576117146143c1565b6020908102919091010152600101611675565b5060605f338484846040516020016117429493929190615119565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906117a09030908590600401614625565b5f604051808303815f875af11580156117bb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117e29190810190614693565b50505050505050505050565b80806001600160401b03164211156118195760405163637910d560e11b815260040160405180910390fd5b83836118258282611d13565b885f816001600160401b0381111561183f5761183f613f02565b604051908082528060200260200182016040528015611868578160200160208202803683370190505b5090505f826001600160401b0381111561188457611884613f02565b6040519080825280602002602001820160405280156118b757816020015b60608152602001906001900390816118a25790505b5090505f5b838110156104a45760048382815181106118d8576118d86143c1565b602002602001019060068111156118f1576118f16143d5565b90816006811115611904576119046143d5565b9052508d8d82818110611919576119196143c1565b905060200281019061192b91906143e9565b60405160200161193b91906144d2565b60405160208183030381529060405282828151811061195c5761195c6143c1565b60209081029190910101526001016118bc565b5f8080808080604087901c62ffffff602889901c16604051639b22917d60e01b81526001600160c01b038316600482015291935091505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156119f6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1a9190614d7f565b60208101519091506001600160401b0316611a38600284900b613238565b6040517fd09ef241000000000000000000000000000000000000000000000000000000008152600481018b90529097505f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d09ef24190602401606060405180830381865afa158015611ab9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611add9190615197565b80516020820151909a50909150611afd906001600160401b031683614db4565b6060840151604083015191985090611b2e90611b22906001600160401b031685614db4565b600287900b905f6136c2565b9650611b3f8162ffffff1660171c90565b611b83575f611b5462ffffff831689836136ec565b90505f8113611b7557611b66816151e9565b611b70908961521f565b611b7f565b611b7f8189615232565b9750505b5050505050509193509193565b606081806001600160401b0316421115611bbd5760405163637910d560e11b815260040160405180910390fd5b8484611bc98282611d13565b895f816001600160401b03811115611be357611be3613f02565b604051908082528060200260200182016040528015611c0c578160200160208202803683370190505b5090505f826001600160401b03811115611c2857611c28613f02565b604051908082528060200260200182016040528015611c5b57816020015b6060815260200190600190039081611c465790505b5090505f5b83811015611103576002838281518110611c7c57611c7c6143c1565b60200260200101906006811115611c9557611c956143d5565b90816006811115611ca857611ca86143d5565b9052508e8e82818110611cbd57611cbd6143c1565b9050602002810190611ccf9190615028565b604051602001611cdf9190615245565b604051602081830303815290604052828281518110611d0057611d006143c1565b6020908102919091010152600101611c60565b5f5b81811015611e15575f838383818110611d3057611d306143c1565b905060c00201803603810190611d46919061534f565b60408101515190915015611e0c5780516020808301516040808501518051938101518183015160609092015192517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810194909452606484019490945260ff909316608483015260a482019290925260c48101919091526001600160a01b039091169063d505accf9060e4015f604051808303815f87803b158015611df9575f80fd5b505af1925050508015611e0a575060015b505b50600101611d15565b505050565b7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45c15611e73576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60017f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b805160208201516040517ffefc7c510000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263fefc7c5192611f039260040161538b565b5f604051808303815f87803b158015611f1a575f80fd5b505af1158015611f2c573d5f803e3d5ffd5b5050505050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f9081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015611fa5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc99190614d7f565b90505f83604001519050611fe6826060015162ffffff1660171c90565b156120035760608201516120009062ffffff16825f61376c565b90505b5f61202583602001516001600160401b0316836120209190615416565b6137b0565b90506001600160401b03811615612104577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631dbef4886040518060800160405280868152602001886020015160020b8152602001846001600160401b031681526020015f6001600160a01b031681525087606001516040518363ffffffff1660e01b81526004016120c1929190615435565b60408051808303815f875af11580156120dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061210091906154e3565b5093505b505050919050565b5f805f6121566040518060a00160405280865f01516001600160c01b0316815260200186604001518152602001866080015181526020015f81526020018660a00151815250612553565b91509150808460800181815161216c9190615232565b90525081156121bd576121ba604051806080016040528086602001516001600160c01b03168152602001866060015160020b8152602001866080015181526020018660c00151815250611f33565b92505b5050919050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015612238573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061225c9190614d7f565b90505b8284604001511180156123015750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156122db573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122ff9190615505565b155b1561252857835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612376573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239a9190614d64565b90506123a88160020b613238565b856020015111156123b95750612528565b5f6123cd8360a0015162ffffff1660171c90565b156123fe576123f78587604001510360018560a0015162ffffff1661376c9092919063ffffffff16565b9050612408565b8486604001510390505b60208301516001600160401b03168082049082061515600116019050805f03612432575050612528565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612486876137b0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b81526004016124b4929190615524565b60408051808303815f875af11580156124cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124f391906154e3565b91509150815f036125075750505050612528565b612511828861521f565b965061251d818761521f565b95505050505061225f565b818460600151101561254d57604051630f271b5560e41b815260040160405180910390fd5b50915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f908190819081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156125c9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125ed9190614d7f565b90505b84604001518310156128ce57845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa15801561266a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061268e9190615505565b1561269c57600193506128ce565b845160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa15801561270c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127309190614d64565b905061273e8160020b613238565b866020015111156127535760019450506128ce565b5f6127678360a0015162ffffff1660171c90565b1561277a578487604001510390506127a1565b61279e858860400151035f8560a0015162ffffff1661376c9092919063ffffffff16565b90505b60208301516001600160401b03166127be600284900b835f613807565b6127c89190615416565b9050805f036127d85750506128ce565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b815260200161282c876137b0565b6001600160401b03168152508b608001516040518363ffffffff1660e01b815260040161285a929190615524565b60408051808303815f875af1158015612875573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061289991906154e3565b91509150805f036128ad57505050506128ce565b6128b7828761521f565b95506128c3818861521f565b9650505050506125f0565b81856060015111156128f357604051630f271b5560e41b815260040160405180910390fd5b5050915091565b805160208201516040517f38926b6d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926338926b6d92612964926004016155be565b6020604051808303815f875af1158015612980573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129a491906155d6565b5050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b22917d6129e5845f015160401c90565b6040516001600160e01b031960e084901b1681526001600160c01b03909116600482015260240160c060405180830381865afa158015612a27573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a4b9190614d7f565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166314d6a9eb6040518060400160405280855f01518152602001612ab085602001516001600160401b031687602001516120209190615416565b6001600160401b031681525084604001516040518363ffffffff1660e01b8152600401612ade9291906155ed565b6020604051808303815f875af1925050508015612b18575060408051601f3d908101601f19168201909252612b15918101906155d6565b60015b156129a457505050565b60405163258473db60e21b81523060048201525f602482018190529081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612b8f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612bb391906155d6565b90505f811215612c8657612bfb7f0000000000000000000000000000000000000000000000000000000000000000612bea836151e9565b6001600160a01b0385169190613849565b604051636a256b2960e01b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612c60573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c8491906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0383811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612cf0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d1491906155d6565b90505f811315612dbd576040517fd9caed120000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528581166024830152604482018390527f0000000000000000000000000000000000000000000000000000000000000000169063d9caed12906064015f604051808303815f87803b158015612da6575f80fd5b505af1158015612db8573d5f803e3d5ffd5b505050505b82515f5b818110156131f8575f858281518110612ddc57612ddc6143c1565b602090810291909101015160405163258473db60e21b81523060048201526001600160a01b0380831660248301529192507f000000000000000000000000000000000000000000000000000000000000000090911690639611cf6c90604401602060405180830381865afa158015612e56573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e7a91906155d6565b93505f841215612f7057612ee5877f0000000000000000000000000000000000000000000000000000000000000000612eb2876151e9565b898681518110612ec457612ec46143c1565b60200260200101516001600160a01b0316613918909392919063ffffffff16565b604051636a256b2960e01b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612f4a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f6e91906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612fda573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ffe91906155d6565b93505f8413156130b8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed12878481518110613049576130496143c1565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908a166024820152604481018790526064015f604051808303815f87803b1580156130a1575f80fd5b505af11580156130b3573d5f803e3d5ffd5b505050505b5f8683815181106130cb576130cb6143c1565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613132573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061315691906155d6565b905080156131ee57868381518110613170576131706143c1565b602090810291909101015160405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af11580156131c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ec9190615505565b505b5050600101612dc1565b504715611f2c57611f2c6001600160a01b0384168647613849565b5f7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b5f61324282613987565b815f600282900b8113613255578161325e565b61325e82615619565b62ffffff8116915060011615613282576bfff97272373d413259a469909250613293565b6c0100000000000000000000000092505b60028116156132b25760606bfff2e50f5f656932ef12357c8402901c92505b60048116156132d15760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156132f05760606bffcb9843d60f6159c9db58838402901c92505b601081161561330f5760606bff973b41fa98c081472e68968402901c92505b602081161561332e5760606bff2ea16466c96a3843ec78b38402901c92505b604081161561334d5760606bfe5dee046a99a2a811c461f18402901c92505b608081161561336c5760606bfcbe86c7900a88aedcffc83b8402901c92505b61010081161561338c5760606bf987a7253ac413176f2b074c8402901c92505b6102008116156133ac5760606bf3392b0822b70005940c7a398402901c92505b6104008116156133cc5760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156133ec5760606bd097f3bdfd2022b8845ad8f78402901c92505b61100081161561340c5760606ba9f746462d870fdf8a65dc1f8402901c92505b61200081161561342c5760606b70d869a156d2a1b890bb3df68402901c92505b61400081161561344c5760606b31be135f97d08fd9812315058402901c92505b61800081161561346c5760606b09aa508b5b7a84e1c677de548402901c92505b6201000081161561348c5760606a5d6af8dedb81196699c3298402901c92505b620200008116156134ab576060692216e584f5fa1ea926048402901c92505b620400008116156134c857606067048a170391f7dc428402901c92505b5f8260020b13156121bd576121ba837801000000000000000000000000000000000000000000000000615416565b5f81750c6c1313451aab317fb9b67e11777e9a5a6ccdb2ebae81118061351e575062149bbb81105b15613554576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f700100000000000000000000000000000000613570856139e6565b6527107fff7434028161358557613585615402565b0590508361359282613238565b11156135a2575f190191506135a5565b91505b50919050565b5f5b81811015611e15575f8383838181106135c8576135c86143c1565b905060a002016020018036038101906135e19190615639565b8051909150156136b9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637ac2ff7b3086868681811061362d5761362d6143c1565b865160208801516040808a015160608b015191516001600160e01b031960e08b901b1681526001600160a01b03909816600489015260a090940295909501356024870152604486019190915260ff16606485015260848401525060a482015260c4015f604051808303815f87803b1580156136a6575f80fd5b505af19250505080156136b7575060015b505b506001016135ad565b5f6136e4606084901b6136d78660020b613238565b8082061515851691040190565b949350505050565b5f6207a11f19627fffff851601600281900b8212828161370e57825f03613710565b825b62ffffff1690505f6137496137258389614db4565b620f42408861373b578581830615151691040190565b808206151586151691040190565b90508261375e57613759816151e9565b613760565b805b98975050505050505050565b5f6207a11f19627fffff85160181831561378657815f0391505b81620f42400190506137a6620f4240866137a09190614db4565b82900490565b9695505050505050565b5f6001600160401b0382111561380357604080517f6dfcc6500000000000000000000000000000000000000000000000000000000081526004810191909152602481018390526044015b60405180910390fd5b5090565b5f6136e46138178560020b613238565b6138219085614db4565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b5f6001600160a01b03841661389e575f805f8085875af1905080613899576040517ff4b3b1bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613912565b60405163a9059cbb60e01b81526001600160a01b038416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080613912576040517ff27f64e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b179052613912908590613bff565b6207ffff600282900b13806139ac57506139a36207ffff615619565b60020b8160020b125b156139e3576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6fffffffffffffffffffffffffffffffff811160071b81811c6001600160401b031060061b1781811c63ffffffff1060051b1781811c61ffff1060041b1781811c60ff1060031b175f8213613a4257631615e6385f526004601cfd5b7103782dace9d90000000000000000000000007ff8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff6f8421084210842108cc6318c6db6d54be84841c1c601f161a90911891821b609f90811c6c465772b2bbbb5f824b15207a3081018102606090811d6d0388eaa27412d5aca026815d636e018202811d6d0df99ac502031bf953eff472fdcc018202811d6d13cdffb29d51d99322bdff5f2211018202811d6d0a0f742023def783a307a986912e018202811d6d01920d8043ca89b5239253284e42018202811d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7883018302821d6d0139601a2efabe717e604cbb4894018302821d6d02247f7a7b6594320649aa03aba1018302821d6c8c3f38e95a6b1ff2ab1c3b343619018302821d6d02384773bdf1ac5676facced60901901830290911d6cb9a025d814b29c212b8b1a07cd19019091027ffffffffffffffff5f6af8f7b3396644f18e157960000000000000000000000000105711340daa0d5f769dba1915cef59f0815a5506029290037d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302919091010590565b5f613c136001600160a01b03841683613c79565b905080515f14158015613c37575080806020019051810190613c359190615505565b155b15611e15576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016137fa565b6060610df583835f845f80856001600160a01b03168486604051613c9d9190615653565b5f6040518083038185875af1925050503d805f8114613cd7576040519150601f19603f3d011682016040523d82523d5f602084013e613cdc565b606091505b50915091506137a6868383606082613cfc57613cf782613d5c565b610df5565b8151158015613d1357506001600160a01b0384163b155b15613d55576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016137fa565b5080610df5565b805115613d6c5780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8083601f840112613dae575f80fd5b5081356001600160401b03811115613dc4575f80fd5b6020830191508360208260051b8501011115613dde575f80fd5b9250929050565b5f8083601f840112613df5575f80fd5b5081356001600160401b03811115613e0b575f80fd5b60208301915083602060c083028501011115613dde575f80fd5b6001600160401b03811681146139e3575f80fd5b8035613e4481613e25565b919050565b5f805f805f805f6080888a031215613e5f575f80fd5b87356001600160401b0380821115613e75575f80fd5b613e818b838c01613d9e565b909950975060208a0135915080821115613e99575f80fd5b613ea58b838c01613d9e565b909750955060408a0135915080821115613ebd575f80fd5b50613eca8a828b01613de5565b9094509250506060880135613ede81613e25565b8091505092959891949750929550565b6001600160a01b03811681146139e3575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b0381118282101715613f3857613f38613f02565b60405290565b604051608081016001600160401b0381118282101715613f3857613f38613f02565b60405160e081016001600160401b0381118282101715613f3857613f38613f02565b604051606081016001600160401b0381118282101715613f3857613f38613f02565b604051601f8201601f191681016001600160401b0381118282101715613fcc57613fcc613f02565b604052919050565b5f6001600160401b03821115613fec57613fec613f02565b50601f01601f191660200190565b5f806040838503121561400b575f80fd5b823561401681613eee565b915060208301356001600160401b03811115614030575f80fd5b8301601f81018513614040575f80fd5b803561405361404e82613fd4565b613fa4565b818152866020838501011115614067575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610df56020830184614086565b6001600160c01b03811681146139e3575f80fd5b5f602082840312156140ea575f80fd5b8135610df5816140c6565b8060020b81146139e3575f80fd5b8035613e44816140f5565b5f806040838503121561411f575f80fd5b823561412a816140c6565b9150602083013561413a816140f5565b809150509250929050565b5f60208284031215614155575f80fd5b5035919050565b5f6020828403121561416c575f80fd5b8135610df5816140f5565b5f8083601f840112614187575f80fd5b5081356001600160401b0381111561419d575f80fd5b60208301915083602060a083028501011115613dde575f80fd5b5f805f805f805f805f805f60c08c8e0312156141d1575f80fd5b6001600160401b03808d3511156141e6575f80fd5b6141f38e8e358f01613d9e565b909c509a5060208d0135811015614208575f80fd5b6142188e60208f01358f01613d9e565b909a50985060408d013581101561422d575f80fd5b61423d8e60408f01358f01613d9e565b909850965060608d0135811015614252575f80fd5b6142628e60608f01358f01613de5565b909650945060808d0135811015614277575f80fd5b506142888d60808e01358e01614177565b909350915061429960a08d01613e39565b90509295989b509295989b9093969950565b602080825282518282018190525f9190848201906040850190845b818110156142e2578351835292840192918401916001016142c6565b50909695505050505050565b5f805f805f805f6080888a031215614304575f80fd5b87356001600160401b038082111561431a575f80fd5b6143268b838c01613d9e565b909950975060208a013591508082111561433e575f80fd5b61434a8b838c01613d9e565b909750955060408a0135915080821115614362575f80fd5b50613eca8a828b01614177565b5f805f60408486031215614381575f80fd5b83356001600160401b03811115614396575f80fd5b6143a286828701613d9e565b90945092505060208401356143b681613e25565b809150509250925092565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f8235609e198336030181126143fd575f80fd5b9190910192915050565b5f808335601e1984360301811261441c575f80fd5b83016020810192503590506001600160401b0381111561443a575f80fd5b803603821315613dde575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f813561447c816140c6565b6001600160c01b0381168452506020820135602084015260408201356040840152606082013560608401526144b46080830183614407565b60a060808601526144c960a086018284614448565b95945050505050565b602081525f610df56020830184614470565b5f6007821061450157634e487b7160e01b5f52602160045260245ffd5b50815260200190565b5f815180845260208085019450602084015f5b8381101561453e576145308783516144e4565b96509082019060010161451d565b509495945050505050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101561459457601f19868403018952614582838351614086565b98840198925090830190600101614566565b5090979650505050505050565b8183525f60208085019450825f5b8581101561453e5781356145c281613eee565b6001600160a01b0316875295820195908201906001016145af565b6001600160a01b0386168152608060208201525f6145fe608083018761450a565b82810360408401526146108187614549565b905082810360608401526137608185876145a1565b6001600160a01b0383168152604060208201525f6136e46040830184614086565b5f82601f830112614655575f80fd5b815161466361404e82613fd4565b818152846020838601011115614677575f80fd5b8160208501602083015e5f918101602001919091529392505050565b5f602082840312156146a3575f80fd5b81516001600160401b038111156146b8575f80fd5b6136e484828501614646565b5f6001600160401b038211156146dc576146dc613f02565b5060051b60200190565b600781106139e3575f80fd5b5f82601f830112614701575f80fd5b8151602061471161404e836146c4565b82815260059290921b8401810191818101908684111561472f575f80fd5b8286015b8481101561476c5780516001600160401b03811115614750575f80fd5b61475e8986838b0101614646565b845250918301918301614733565b509695505050505050565b5f82601f830112614786575f80fd5b8151602061479661404e836146c4565b8083825260208201915060208460051b8701019350868411156147b7575f80fd5b602086015b8481101561476c5780516147cf81613eee565b83529183019183016147bc565b5f805f80608085870312156147ef575f80fd5b84516147fa81613eee565b809450506020808601516001600160401b0380821115614818575f80fd5b818801915088601f83011261482b575f80fd5b815161483961404e826146c4565b81815260059190911b8301840190848101908b831115614857575f80fd5b938501935b8285101561487e57845161486f816146e6565b8252938501939085019061485c565b60408b01519098509450505080831115614896575f80fd5b6148a289848a016146f2565b945060608801519250808311156148b7575f80fd5b50506148c587828801614777565b91505092959194509250565b62ffffff811681146139e3575f80fd5b5f60c082840312156148f1575f80fd5b60405160c081018181106001600160401b038211171561491357614913613f02565b8060405250809150825161492681613eee565b8152602083015161493681613e25565b6020820152604083015161494981613eee565b6040820152606083015161495c816148d1565b6060820152608083015161496f81613eee565b608082015260a0830151614982816148d1565b60a0919091015292915050565b5f6020828403121561499f575f80fd5b81516001600160401b03808211156149b5575f80fd5b9083019060e082860312156149c8575f80fd5b6149d0613f16565b6149da86846148e1565b815260c0830151828111156149ed575f80fd5b6149f987828601614646565b60208301525095945050505050565b8051613e44816140c6565b8051613e44816140f5565b5f60208284031215614a2e575f80fd5b81516001600160401b0380821115614a44575f80fd5b9083019060808286031215614a57575f80fd5b614a5f613f3e565b8251614a6a816140c6565b81526020830151614a7a816140f5565b602082015260408381015190820152606083015182811115614a9a575f80fd5b614aa687828601614646565b60608301525095945050505050565b634e487b7160e01b5f52601160045260245ffd5b5f60018201614ada57614ada614ab5565b5060010190565b5f60208284031215614af1575f80fd5b81516001600160401b0380821115614b07575f80fd5b9083019060e08286031215614b1a575f80fd5b614b22613f60565b614b2b83614a08565b8152614b3960208401614a08565b602082015260408301516040820152614b5460608401614a13565b60608201526080830151608082015260a083015182811115614b74575f80fd5b614b8087828601614646565b60a08301525060c083015182811115614b97575f80fd5b614ba387828601614646565b60c08301525095945050505050565b5f60a08284031215614bc2575f80fd5b60405160a081016001600160401b038282108183111715614be557614be5613f02565b8160405282935084519150614bf9826140c6565b8183526020850151602084015260408501516040840152606085015160608401526080850151915080821115614c2d575f80fd5b50614c3a85828601614646565b6080830152505092915050565b5f60208284031215614c57575f80fd5b81516001600160401b03811115614c6c575f80fd5b6136e484828501614bb2565b5f60208284031215614c88575f80fd5b81516001600160401b0380821115614c9e575f80fd5b9083019060408286031215614cb1575f80fd5b614cb9613f16565b825181526020830151828111156149ed575f80fd5b5f60208284031215614cde575f80fd5b8151610df581613eee565b5f60208284031215614cf9575f80fd5b81516001600160401b0380821115614d0f575f80fd5b9083019060608286031215614d22575f80fd5b614d2a613f82565b8251815260208301516020820152604083015182811115614d49575f80fd5b614d5587828601614646565b60408301525095945050505050565b5f60208284031215614d74575f80fd5b8151610df5816140f5565b5f60c08284031215614d8f575f80fd5b610df583836148e1565b5f60208284031215614da9575f80fd5b8151610df581613e25565b8082028115828204841417610bec57610bec614ab5565b6001600160a01b0388168152608060208083018290529082018790525f90889060a08401835b8a811015614e1d578335614e04816146e6565b614e0e83826144e4565b94840194925050600101614df1565b5084810360408601528781528181019250600588901b81018201895f5b8a811015614e7457838303601f19018652614e55828d614407565b614e60858284614448565b978701979450505090840190600101614e3a565b50508581036060870152614e8981888a6145a1565b9d9c50505050505050505050505050565b5f6020808385031215614eab575f80fd5b82516001600160401b03811115614ec0575f80fd5b8301601f81018513614ed0575f80fd5b8051614ede61404e826146c4565b81815260059190911b82018301908381019087831115614efc575f80fd5b928401925b82841015614f1a57835182529284019290840190614f01565b979650505050505050565b5f8235607e198336030181126143fd575f80fd5b602081525f8235614f49816140c6565b6001600160c01b0381166020840152506020830135614f67816140f5565b8060020b60408401525060408301356060830152614f886060840184614407565b6080808501526144c960a085018284614448565b5f8235603e198336030181126143fd575f80fd5b60208152813560208201525f614fc96020840184614407565b6040808501526144c9606085018284614448565b5f8235605e198336030181126143fd575f80fd5b6020815281356020820152602082013560408201525f6150146040840184614407565b6060808501526144c9608085018284614448565b5f823560de198336030181126143fd575f80fd5b8035613e44816148d1565b8035613e4481613eee565b602081525f823561506281613eee565b6001600160a01b0380821660208501526020850135915061508282613e25565b6001600160401b0382166040850152604085013591506150a182613eee565b166060838101919091528301356150b7816148d1565b62ffffff81166080840152506150cf60808401615047565b6001600160a01b03811660a0840152506150eb60a0840161503c565b62ffffff811660c08401525061510460c0840184614407565b60e0808501526144c961010085018284614448565b5f6001600160a01b03808716835260206080602085015261513d608085018861450a565b848103604086015261514f8188614549565b8581036060870152865180825260208089019350909101905f5b81811015615187578351861683529284019291840191600101615169565b50909a9950505050505050505050565b5f606082840312156151a7575f80fd5b6151af613f82565b82516151ba81613eee565b815260208301516151ca81613e25565b602082015260408301516151dd81613e25565b60408201529392505050565b5f7f8000000000000000000000000000000000000000000000000000000000000000820361521957615219614ab5565b505f0390565b80820180821115610bec57610bec614ab5565b81810381811115610bec57610bec614ab5565b602081525f8235615255816140c6565b6001600160c01b0381166020840152506020830135615273816140c6565b6001600160c01b0381166040840152506040830135606083015261529960608401614103565b6152a8608084018260020b9052565b50608083013560a08301526152c060a0840184614407565b60e060c08501526152d661010085018284614448565b9150506152e660c0850185614407565b848303601f190160e08601526137a6838284614448565b5f6080828403121561530d575f80fd5b615315613f3e565b905081358152602082013560ff8116811461532e575f80fd5b80602083015250604082013560408201526060820135606082015292915050565b5f60c0828403121561535f575f80fd5b615367613f82565b823561537281613eee565b8152602083810135908201526151dd84604085016152fd565b6153ed81846001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b60e060c08201525f6136e460e0830184614086565b634e487b7160e01b5f52601260045260245ffd5b5f8261543057634e487b7160e01b5f52601260045260245ffd5b500490565b5f61014061549c8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e08401526001600160a01b03606086015116610100840152806101208401526144c981840185614086565b5f80604083850312156154f4575f80fd5b505080516020909101519092909150565b5f60208284031215615515575f80fd5b81518015158114610df5575f80fd5b5f61012061558b8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e0840152806101008401526144c981840185614086565b828152604060208201525f6136e46040830184614086565b5f602082840312156155e6575f80fd5b5051919050565b825181526001600160401b036020840151166020820152606060408201525f6136e46060830184614086565b5f8160020b627fffff19810361563157615631614ab5565b5f0392915050565b5f60808284031215615649575f80fd5b610df583836152fd565b5f82518060208501845e5f92019182525091905056fea26469706673582212205d030babface628d41af975b2b7119f20ba2d315229ba63974efbe1f93407df064736f6c63430008190033" } \ No newline at end of file diff --git a/deployments/80084/.chainId b/deployments/80084/.chainId new file mode 100644 index 0000000..3951327 --- /dev/null +++ b/deployments/80084/.chainId @@ -0,0 +1 @@ +80084 \ No newline at end of file diff --git a/deployments/80084/BookViewer.json b/deployments/80084/BookViewer.json new file mode 100644 index 0000000..39f2105 --- /dev/null +++ b/deployments/80084/BookViewer.json @@ -0,0 +1,642 @@ +{ + "address": "0x5C91A02B8B5D10597fc6cA23faF56F9718D1feD0", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IBookManager", + "name": "bookManager_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "ERC1967InvalidImplementation", + "type": "error" + }, + { + "inputs": [], + "name": "ERC1967NonPayable", + "type": "error" + }, + { + "inputs": [], + "name": "FailedCall", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTick", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintToInt", + "type": "error" + }, + { + "inputs": [], + "name": "UUPSUnauthorizedCallContext", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "slot", + "type": "bytes32" + } + ], + "name": "UUPSUnsupportedProxiableUUID", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "UPGRADE_INTERFACE_VERSION", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "__BookViewer_init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "acceptOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "bookManager", + "outputs": [ + { + "internalType": "contract IBookManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + }, + { + "internalType": "uint256", + "name": "limitPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "quoteAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBaseAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.TakeOrderParams", + "name": "params", + "type": "tuple" + } + ], + "name": "getExpectedInput", + "outputs": [ + { + "internalType": "uint256", + "name": "takenQuoteAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "spentBaseAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + }, + { + "internalType": "uint256", + "name": "limitPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minQuoteAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.SpendOrderParams", + "name": "params", + "type": "tuple" + } + ], + "name": "getExpectedOutput", + "outputs": [ + { + "internalType": "uint256", + "name": "takenQuoteAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "spentBaseAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + }, + { + "internalType": "Tick", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint256", + "name": "n", + "type": "uint256" + } + ], + "name": "getLiquidity", + "outputs": [ + { + "components": [ + { + "internalType": "Tick", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint64", + "name": "depth", + "type": "uint64" + } + ], + "internalType": "struct IBookViewer.Liquidity[]", + "name": "liquidity", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0xa7b7dad37339050383ff931ab6100f2bcc98bef1e964dc9883a42d2cfbe1eb7c", + "receipt": { + "to": null, + "from": "0x5F79EE8f8fA862E98201120d83c4eC39D9468D49", + "contractAddress": "0x5C91A02B8B5D10597fc6cA23faF56F9718D1feD0", + "transactionIndex": 21, + "gasUsed": "1858637", + "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000008000001000000000000000000000000000000000000020100000000000000000800000000010000000000000000000000400000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000040000000000", + "blockHash": "0xe60a543d26c9355e1679d5d6138f25f5869041b574f9a41894d3a63cce777dce", + "transactionHash": "0xa7b7dad37339050383ff931ab6100f2bcc98bef1e964dc9883a42d2cfbe1eb7c", + "logs": [ + { + "transactionIndex": 21, + "blockNumber": 3310599, + "transactionHash": "0xa7b7dad37339050383ff931ab6100f2bcc98bef1e964dc9883a42d2cfbe1eb7c", + "address": "0x5C91A02B8B5D10597fc6cA23faF56F9718D1feD0", + "topics": [ + "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000005f79ee8f8fa862e98201120d83c4ec39d9468d49" + ], + "data": "0x", + "logIndex": 66, + "blockHash": "0xe60a543d26c9355e1679d5d6138f25f5869041b574f9a41894d3a63cce777dce" + } + ], + "blockNumber": 3310599, + "cumulativeGasUsed": "4191757", + "status": 1, + "byzantium": true + }, + "args": [ + "0x874b1B795993653fbFC3f1c1fc0469214cC9F4A5" + ], + "numDeployments": 1, + "solcInputHash": "bc262cef2a9e7c4c429d3b8e35df889c", + "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IBookManager\",\"name\":\"bookManager_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"ERC1967InvalidImplementation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ERC1967NonPayable\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedCall\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTick\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintToInt\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"UUPSUnauthorizedCallContext\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"slot\",\"type\":\"bytes32\"}],\"name\":\"UUPSUnsupportedProxiableUUID\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"UPGRADE_INTERFACE_VERSION\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"__BookViewer_init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bookManager\",\"outputs\":[{\"internalType\":\"contract IBookManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"},{\"internalType\":\"uint256\",\"name\":\"limitPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBaseAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.TakeOrderParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"getExpectedInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"takenQuoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"spentBaseAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"},{\"internalType\":\"uint256\",\"name\":\"limitPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minQuoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.SpendOrderParams\",\"name\":\"params\",\"type\":\"tuple\"}],\"name\":\"getExpectedOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"takenQuoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"spentBaseAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"},{\"internalType\":\"Tick\",\"name\":\"tick\",\"type\":\"int24\"},{\"internalType\":\"uint256\",\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"getLiquidity\",\"outputs\":[{\"components\":[{\"internalType\":\"Tick\",\"name\":\"tick\",\"type\":\"int24\"},{\"internalType\":\"uint64\",\"name\":\"depth\",\"type\":\"uint64\"}],\"internalType\":\"struct IBookViewer.Liquidity[]\",\"name\":\"liquidity\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"ERC1967InvalidImplementation(address)\":[{\"details\":\"The `implementation` of the proxy is invalid.\"}],\"ERC1967NonPayable()\":[{\"details\":\"An upgrade function sees `msg.value > 0` that may be lost.\"}],\"FailedCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"InvalidInitialization()\":[{\"details\":\"The contract is already initialized.\"}],\"NotInitializing()\":[{\"details\":\"The contract is not initializing.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}],\"SafeCastOverflowedUintToInt(uint256)\":[{\"details\":\"An uint value doesn't fit in an int of `bits` size.\"}],\"UUPSUnauthorizedCallContext()\":[{\"details\":\"The call is from an unauthorized context.\"}],\"UUPSUnsupportedProxiableUUID(bytes32)\":[{\"details\":\"The storage `slot` is unsupported as a UUID.\"}]},\"events\":{\"Initialized(uint64)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Upgraded(address)\":{\"details\":\"Emitted when the implementation is upgraded.\"}},\"kind\":\"dev\",\"methods\":{\"acceptOwnership()\":{\"details\":\"The new owner accepts the ownership transfer.\"},\"getExpectedInput((uint192,uint256,uint256,uint256,bytes))\":{\"params\":{\"params\":\"The parameters of the take order\"},\"returns\":{\"spentBaseAmount\":\"The expected spend base amount\",\"takenQuoteAmount\":\"The expected taken quote amount\"}},\"getExpectedOutput((uint192,uint256,uint256,uint256,bytes))\":{\"params\":{\"params\":\"The parameters of the spend order\"},\"returns\":{\"spentBaseAmount\":\"The expected spend base amount\",\"takenQuoteAmount\":\"The expected taken quote amount\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"details\":\"Returns the address of the pending owner.\"},\"proxiableUUID()\":{\"details\":\"Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.\"},\"upgradeToAndCall(address,bytes)\":{\"custom:oz-upgrades-unsafe-allow-reachable\":\"delegatecall\",\"details\":\"Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event.\"}},\"stateVariables\":{\"bookManager\":{\"return\":\"The instance of the book manager\",\"returns\":{\"_0\":\"The instance of the book manager\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"bookManager()\":{\"notice\":\"Returns the book manager\"},\"getExpectedInput((uint192,uint256,uint256,uint256,bytes))\":{\"notice\":\"Returns the expected input for a take order\"},\"getExpectedOutput((uint192,uint256,uint256,uint256,bytes))\":{\"notice\":\"Returns the expected output for a spend order\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/BookViewer.sol\":\"BookViewer\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Context} from \\\"../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 * The initial owner is set to the address provided by the deployer. This can\\n * 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 /**\\n * @dev The caller account is not authorized to perform an operation.\\n */\\n error OwnableUnauthorizedAccount(address account);\\n\\n /**\\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\\n */\\n error OwnableInvalidOwner(address owner);\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\\n */\\n constructor(address initialOwner) {\\n if (initialOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\n _transferOwnership(initialOwner);\\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 if (owner() != _msgSender()) {\\n revert OwnableUnauthorizedAccount(_msgSender());\\n }\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby disabling 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 if (newOwner == address(0)) {\\n revert OwnableInvalidOwner(address(0));\\n }\\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\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable2Step.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Ownable} from \\\"./Ownable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * This extension of the {Ownable} contract includes a two-step mechanism to transfer\\n * ownership, where the new owner must call {acceptOwnership} in order to replace the\\n * old one. This can help prevent common mistakes, such as transfers of ownership to\\n * incorrect accounts, or to contracts that are unable to interact with the\\n * permission system.\\n *\\n * The initial owner is specified at deployment time in the constructor for `Ownable`. This\\n * can later be changed with {transferOwnership} and {acceptOwnership}.\\n *\\n * This module is used through inheritance. It will make available all functions\\n * from parent (Ownable).\\n */\\nabstract contract Ownable2Step is Ownable {\\n address private _pendingOwner;\\n\\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Returns the address of the pending owner.\\n */\\n function pendingOwner() public view virtual returns (address) {\\n return _pendingOwner;\\n }\\n\\n /**\\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual override onlyOwner {\\n _pendingOwner = newOwner;\\n emit OwnershipTransferStarted(owner(), newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual override {\\n delete _pendingOwner;\\n super._transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev The new owner accepts the ownership transfer.\\n */\\n function acceptOwnership() public virtual {\\n address sender = _msgSender();\\n if (pendingOwner() != sender) {\\n revert OwnableUnauthorizedAccount(sender);\\n }\\n _transferOwnership(sender);\\n }\\n}\\n\",\"keccak256\":\"0x08b074ae1b12e70ce24d1335086ec5a418934311a6771d9f61fe24d392050e12\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1967.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\\n */\\ninterface IERC1967 {\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Emitted when the beacon is changed.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n}\\n\",\"keccak256\":\"0xb25a4f11fa80c702bf5cd85adec90e6f6f507f32f4a8e6f5dbc31e8c10029486\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf5c04a8bf51755681f7db413095377dfd1a05b98b6326fb1da0e9a297057caf0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Proxy} from \\\"../Proxy.sol\\\";\\nimport {ERC1967Utils} from \\\"./ERC1967Utils.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an\\n * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n *\\n * Requirements:\\n *\\n * - If `data` is empty, `msg.value` must be zero.\\n */\\n constructor(address implementation, bytes memory _data) payable {\\n ERC1967Utils.upgradeToAndCall(implementation, _data);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function _implementation() internal view virtual override returns (address) {\\n return ERC1967Utils.getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0x31b7f755099238afdf101d132e356ca59a2f5aa3c9d6957bc320c3a89c6b29a8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\\n\\npragma solidity ^0.8.21;\\n\\nimport {IBeacon} from \\\"../beacon/IBeacon.sol\\\";\\nimport {IERC1967} from \\\"../../interfaces/IERC1967.sol\\\";\\nimport {Address} from \\\"../../utils/Address.sol\\\";\\nimport {StorageSlot} from \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.\\n */\\nlibrary ERC1967Utils {\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1.\\n */\\n // solhint-disable-next-line private-vars-leading-underscore\\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev The `implementation` of the proxy is invalid.\\n */\\n error ERC1967InvalidImplementation(address implementation);\\n\\n /**\\n * @dev The `admin` of the proxy is invalid.\\n */\\n error ERC1967InvalidAdmin(address admin);\\n\\n /**\\n * @dev The `beacon` of the proxy is invalid.\\n */\\n error ERC1967InvalidBeacon(address beacon);\\n\\n /**\\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\\n */\\n error ERC1967NonPayable();\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the ERC-1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n if (newImplementation.code.length == 0) {\\n revert ERC1967InvalidImplementation(newImplementation);\\n }\\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\\n * to avoid stuck value in the contract.\\n *\\n * Emits an {IERC1967-Upgraded} event.\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\\n _setImplementation(newImplementation);\\n emit IERC1967.Upgraded(newImplementation);\\n\\n if (data.length > 0) {\\n Address.functionDelegateCall(newImplementation, data);\\n } else {\\n _checkNonPayable();\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1.\\n */\\n // solhint-disable-next-line private-vars-leading-underscore\\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the ERC-1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n if (newAdmin == address(0)) {\\n revert ERC1967InvalidAdmin(address(0));\\n }\\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {IERC1967-AdminChanged} event.\\n */\\n function changeAdmin(address newAdmin) internal {\\n emit IERC1967.AdminChanged(getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.beacon\\\" subtracted by 1.\\n */\\n // solhint-disable-next-line private-vars-leading-underscore\\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the ERC-1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n if (newBeacon.code.length == 0) {\\n revert ERC1967InvalidBeacon(newBeacon);\\n }\\n\\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\\n\\n address beaconImplementation = IBeacon(newBeacon).implementation();\\n if (beaconImplementation.code.length == 0) {\\n revert ERC1967InvalidImplementation(beaconImplementation);\\n }\\n }\\n\\n /**\\n * @dev Change the beacon and trigger a setup call if data is nonempty.\\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\\n * to avoid stuck value in the contract.\\n *\\n * Emits an {IERC1967-BeaconUpgraded} event.\\n *\\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\\n * efficiency.\\n */\\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\\n _setBeacon(newBeacon);\\n emit IERC1967.BeaconUpgraded(newBeacon);\\n\\n if (data.length > 0) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n } else {\\n _checkNonPayable();\\n }\\n }\\n\\n /**\\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\\n * if an upgrade doesn't perform an initialization call.\\n */\\n function _checkNonPayable() private {\\n if (msg.value > 0) {\\n revert ERC1967NonPayable();\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5f3770f82f75d132e210b43c071d3feec1bef13c385d1d799763a366e8bda311\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback\\n * function and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n}\\n\",\"keccak256\":\"0xc3f2ec76a3de8ed7a7007c46166f5550c72c7709e3fc7e8bb3111a7191cdedbd\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {UpgradeableBeacon} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xc59a78b07b44b2cf2e8ab4175fca91e8eca1eee2df7357b8d2a8833e5ea1f64c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```solidity\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n *\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Storage of the initializable contract.\\n *\\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\\n * when using with upgradeable contracts.\\n *\\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\\n */\\n struct InitializableStorage {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n uint64 _initialized;\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool _initializing;\\n }\\n\\n // keccak256(abi.encode(uint256(keccak256(\\\"openzeppelin.storage.Initializable\\\")) - 1)) & ~bytes32(uint256(0xff))\\n bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\\n\\n /**\\n * @dev The contract is already initialized.\\n */\\n error InvalidInitialization();\\n\\n /**\\n * @dev The contract is not initializing.\\n */\\n error NotInitializing();\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint64 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\\n * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\\n * production.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n // Cache values to avoid duplicated sloads\\n bool isTopLevelCall = !$._initializing;\\n uint64 initialized = $._initialized;\\n\\n // Allowed calls:\\n // - initialSetup: the contract is not in the initializing state and no previous version was\\n // initialized\\n // - construction: the contract is initialized at version 1 (no reininitialization) and the\\n // current contract is just being deployed\\n bool initialSetup = initialized == 0 && isTopLevelCall;\\n bool construction = initialized == 1 && address(this).code.length == 0;\\n\\n if (!initialSetup && !construction) {\\n revert InvalidInitialization();\\n }\\n $._initialized = 1;\\n if (isTopLevelCall) {\\n $._initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n $._initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint64 version) {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing || $._initialized >= version) {\\n revert InvalidInitialization();\\n }\\n $._initialized = version;\\n $._initializing = true;\\n _;\\n $._initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n _checkInitializing();\\n _;\\n }\\n\\n /**\\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\\n */\\n function _checkInitializing() internal view virtual {\\n if (!_isInitializing()) {\\n revert NotInitializing();\\n }\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n // solhint-disable-next-line var-name-mixedcase\\n InitializableStorage storage $ = _getInitializableStorage();\\n\\n if ($._initializing) {\\n revert InvalidInitialization();\\n }\\n if ($._initialized != type(uint64).max) {\\n $._initialized = type(uint64).max;\\n emit Initialized(type(uint64).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint64) {\\n return _getInitializableStorage()._initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _getInitializableStorage()._initializing;\\n }\\n\\n /**\\n * @dev Returns a pointer to the storage namespace.\\n */\\n // solhint-disable-next-line var-name-mixedcase\\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\\n assembly {\\n $.slot := INITIALIZABLE_STORAGE\\n }\\n }\\n}\\n\",\"keccak256\":\"0x631188737069917d2f909d29ce62c4d48611d326686ba6683e26b72a23bfac0b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC1822Proxiable} from \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport {ERC1967Utils} from \\\"../ERC1967/ERC1967Utils.sol\\\";\\n\\n/**\\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\\n *\\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\\n * `UUPSUpgradeable` with a custom implementation of upgrades.\\n *\\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\\n */\\nabstract contract UUPSUpgradeable is IERC1822Proxiable {\\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\\n address private immutable __self = address(this);\\n\\n /**\\n * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`\\n * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\\n * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.\\n * If the getter returns `\\\"5.0.0\\\"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must\\n * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\\n * during an upgrade.\\n */\\n string public constant UPGRADE_INTERFACE_VERSION = \\\"5.0.0\\\";\\n\\n /**\\n * @dev The call is from an unauthorized context.\\n */\\n error UUPSUnauthorizedCallContext();\\n\\n /**\\n * @dev The storage `slot` is unsupported as a UUID.\\n */\\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\\n\\n /**\\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\\n * a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case\\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\\n * function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\\n * fail.\\n */\\n modifier onlyProxy() {\\n _checkProxy();\\n _;\\n }\\n\\n /**\\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\\n * callable on the implementing contract but not through proxies.\\n */\\n modifier notDelegated() {\\n _checkNotDelegated();\\n _;\\n }\\n\\n /**\\n * @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the\\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\\n */\\n function proxiableUUID() external view virtual notDelegated returns (bytes32) {\\n return ERC1967Utils.IMPLEMENTATION_SLOT;\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\\n * encoded in `data`.\\n *\\n * Calls {_authorizeUpgrade}.\\n *\\n * Emits an {Upgraded} event.\\n *\\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\\n */\\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\\n _authorizeUpgrade(newImplementation);\\n _upgradeToAndCallUUPS(newImplementation, data);\\n }\\n\\n /**\\n * @dev Reverts if the execution is not performed via delegatecall or the execution\\n * context is not of a proxy with an ERC-1967 compliant implementation pointing to self.\\n * See {_onlyProxy}.\\n */\\n function _checkProxy() internal view virtual {\\n if (\\n address(this) == __self || // Must be called through delegatecall\\n ERC1967Utils.getImplementation() != __self // Must be called through an active proxy\\n ) {\\n revert UUPSUnauthorizedCallContext();\\n }\\n }\\n\\n /**\\n * @dev Reverts if the execution is performed via delegatecall.\\n * See {notDelegated}.\\n */\\n function _checkNotDelegated() internal view virtual {\\n if (address(this) != __self) {\\n // Must not be called through delegatecall\\n revert UUPSUnauthorizedCallContext();\\n }\\n }\\n\\n /**\\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\\n * {upgradeToAndCall}.\\n *\\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\\n *\\n * ```solidity\\n * function _authorizeUpgrade(address) internal onlyOwner {}\\n * ```\\n */\\n function _authorizeUpgrade(address newImplementation) internal virtual;\\n\\n /**\\n * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.\\n *\\n * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value\\n * is expected to be the implementation slot in ERC-1967.\\n *\\n * Emits an {IERC1967-Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {\\n revert UUPSUnsupportedProxiableUUID(slot);\\n }\\n ERC1967Utils.upgradeToAndCall(newImplementation, data);\\n } catch {\\n // The implementation is not UUPS\\n revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xdf82790845884c125731cfc95bf0ecd7b4bc53ccc9ed5f5f3a254feac16b3923\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC-721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xe0e3a2099f2e2ce3579dd35548f613928739642058dfec95b1745f93364ce3de\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC721} from \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x37d1aaaa5a2908a09e9dcf56a26ddf762ecf295afb5964695937344fc6802ce1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Errors} from \\\"./Errors.sol\\\";\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev There's no code at `target` (it is not a contract).\\n */\\n error AddressEmptyCode(address target);\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n if (address(this).balance < amount) {\\n revert Errors.InsufficientBalance(address(this).balance, amount);\\n }\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n if (!success) {\\n revert Errors.FailedCall();\\n }\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason or custom error, it is bubbled\\n * up by this function (like regular Solidity function calls). However, if\\n * the call reverted with no returned reason, this function reverts with a\\n * {Errors.FailedCall} error.\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n if (address(this).balance < value) {\\n revert Errors.InsufficientBalance(address(this).balance, value);\\n }\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\\n * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case\\n * of an unsuccessful call.\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata\\n ) internal view returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n // only check if target is a contract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n if (returndata.length == 0 && target.code.length == 0) {\\n revert AddressEmptyCode(target);\\n }\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\\n * revert reason or with a default {Errors.FailedCall} error.\\n */\\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.\\n */\\n function _revert(bytes memory returndata) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert Errors.FailedCall();\\n }\\n }\\n}\\n\",\"keccak256\":\"0x80b4189de089dc632b752b365a16c5063b58cc24da0dd38b82f2c25f56d25c84\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\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 function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Collection of common custom errors used in multiple contracts\\n *\\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\\n * It is recommended to avoid relying on the error API for critical functionality.\\n */\\nlibrary Errors {\\n /**\\n * @dev The ETH balance of the account is not enough to perform the operation.\\n */\\n error InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev A call to an address target failed. The target may have reverted.\\n */\\n error FailedCall();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error FailedDeployment();\\n}\\n\",\"keccak256\":\"0x1b0625096e82d06abdcf1844172ef78ef54a5e878761f4d905fda07eaf098424\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\\n\\npragma solidity ^0.8.24;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC-1967 implementation slot:\\n * ```solidity\\n * contract ERC1967 {\\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(newImplementation.code.length > 0);\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * Since version 5.1, this library also support writing and reading value types to and from transient storage.\\n *\\n * * Example using transient storage:\\n * ```solidity\\n * contract Lock {\\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\\n * bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;\\n *\\n * modifier locked() {\\n * require(!_LOCK_SLOT.asBoolean().tload());\\n *\\n * _LOCK_SLOT.asBoolean().tstore(true);\\n * _;\\n * _LOCK_SLOT.asBoolean().tstore(false);\\n * }\\n * }\\n * ```\\n *\\n * TIP: Consider using this library along with {SlotDerivation}.\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n struct Int256Slot {\\n int256 value;\\n }\\n\\n struct StringSlot {\\n string value;\\n }\\n\\n struct BytesSlot {\\n bytes value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Int256Slot` with member `value` located at `slot`.\\n */\\n function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\\n */\\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\\n */\\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\\n */\\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\\n */\\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := store.slot\\n }\\n }\\n\\n /**\\n * @dev UDVT that represent a slot holding a address.\\n */\\n type AddressSlotType is bytes32;\\n\\n /**\\n * @dev Cast an arbitrary slot to a AddressSlotType.\\n */\\n function asAddress(bytes32 slot) internal pure returns (AddressSlotType) {\\n return AddressSlotType.wrap(slot);\\n }\\n\\n /**\\n * @dev UDVT that represent a slot holding a bool.\\n */\\n type BooleanSlotType is bytes32;\\n\\n /**\\n * @dev Cast an arbitrary slot to a BooleanSlotType.\\n */\\n function asBoolean(bytes32 slot) internal pure returns (BooleanSlotType) {\\n return BooleanSlotType.wrap(slot);\\n }\\n\\n /**\\n * @dev UDVT that represent a slot holding a bytes32.\\n */\\n type Bytes32SlotType is bytes32;\\n\\n /**\\n * @dev Cast an arbitrary slot to a Bytes32SlotType.\\n */\\n function asBytes32(bytes32 slot) internal pure returns (Bytes32SlotType) {\\n return Bytes32SlotType.wrap(slot);\\n }\\n\\n /**\\n * @dev UDVT that represent a slot holding a uint256.\\n */\\n type Uint256SlotType is bytes32;\\n\\n /**\\n * @dev Cast an arbitrary slot to a Uint256SlotType.\\n */\\n function asUint256(bytes32 slot) internal pure returns (Uint256SlotType) {\\n return Uint256SlotType.wrap(slot);\\n }\\n\\n /**\\n * @dev UDVT that represent a slot holding a int256.\\n */\\n type Int256SlotType is bytes32;\\n\\n /**\\n * @dev Cast an arbitrary slot to a Int256SlotType.\\n */\\n function asInt256(bytes32 slot) internal pure returns (Int256SlotType) {\\n return Int256SlotType.wrap(slot);\\n }\\n\\n /**\\n * @dev Load the value held at location `slot` in transient storage.\\n */\\n function tload(AddressSlotType slot) internal view returns (address value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n value := tload(slot)\\n }\\n }\\n\\n /**\\n * @dev Store `value` at location `slot` in transient storage.\\n */\\n function tstore(AddressSlotType slot, address value) internal {\\n /// @solidity memory-safe-assembly\\n assembly {\\n tstore(slot, value)\\n }\\n }\\n\\n /**\\n * @dev Load the value held at location `slot` in transient storage.\\n */\\n function tload(BooleanSlotType slot) internal view returns (bool value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n value := tload(slot)\\n }\\n }\\n\\n /**\\n * @dev Store `value` at location `slot` in transient storage.\\n */\\n function tstore(BooleanSlotType slot, bool value) internal {\\n /// @solidity memory-safe-assembly\\n assembly {\\n tstore(slot, value)\\n }\\n }\\n\\n /**\\n * @dev Load the value held at location `slot` in transient storage.\\n */\\n function tload(Bytes32SlotType slot) internal view returns (bytes32 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n value := tload(slot)\\n }\\n }\\n\\n /**\\n * @dev Store `value` at location `slot` in transient storage.\\n */\\n function tstore(Bytes32SlotType slot, bytes32 value) internal {\\n /// @solidity memory-safe-assembly\\n assembly {\\n tstore(slot, value)\\n }\\n }\\n\\n /**\\n * @dev Load the value held at location `slot` in transient storage.\\n */\\n function tload(Uint256SlotType slot) internal view returns (uint256 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n value := tload(slot)\\n }\\n }\\n\\n /**\\n * @dev Store `value` at location `slot` in transient storage.\\n */\\n function tstore(Uint256SlotType slot, uint256 value) internal {\\n /// @solidity memory-safe-assembly\\n assembly {\\n tstore(slot, value)\\n }\\n }\\n\\n /**\\n * @dev Load the value held at location `slot` in transient storage.\\n */\\n function tload(Int256SlotType slot) internal view returns (int256 value) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n value := tload(slot)\\n }\\n }\\n\\n /**\\n * @dev Store `value` at location `slot` in transient storage.\\n */\\n function tstore(Int256SlotType slot, int256 value) internal {\\n /// @solidity memory-safe-assembly\\n assembly {\\n tstore(slot, value)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfd29ed7a01e9ef109cc31542ca0f51ba3e793740570b69172ec3d8bfbb1643b4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc859863e3bda7ec3cddf6dafe2ffe91bcbe648d1395b856b839c32ee9617c44c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Value doesn't fit in an uint of `bits` size.\\n */\\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\\n\\n /**\\n * @dev An int value doesn't fit in an uint of `bits` size.\\n */\\n error SafeCastOverflowedIntToUint(int256 value);\\n\\n /**\\n * @dev Value doesn't fit in an int of `bits` size.\\n */\\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\\n\\n /**\\n * @dev An uint value doesn't fit in an int of `bits` size.\\n */\\n error SafeCastOverflowedUintToInt(uint256 value);\\n\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n if (value > type(uint248).max) {\\n revert SafeCastOverflowedUintDowncast(248, value);\\n }\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n if (value > type(uint240).max) {\\n revert SafeCastOverflowedUintDowncast(240, value);\\n }\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n if (value > type(uint232).max) {\\n revert SafeCastOverflowedUintDowncast(232, value);\\n }\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n if (value > type(uint224).max) {\\n revert SafeCastOverflowedUintDowncast(224, value);\\n }\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n if (value > type(uint216).max) {\\n revert SafeCastOverflowedUintDowncast(216, value);\\n }\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n if (value > type(uint208).max) {\\n revert SafeCastOverflowedUintDowncast(208, value);\\n }\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n if (value > type(uint200).max) {\\n revert SafeCastOverflowedUintDowncast(200, value);\\n }\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n if (value > type(uint192).max) {\\n revert SafeCastOverflowedUintDowncast(192, value);\\n }\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n if (value > type(uint184).max) {\\n revert SafeCastOverflowedUintDowncast(184, value);\\n }\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n if (value > type(uint176).max) {\\n revert SafeCastOverflowedUintDowncast(176, value);\\n }\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n if (value > type(uint168).max) {\\n revert SafeCastOverflowedUintDowncast(168, value);\\n }\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n if (value > type(uint160).max) {\\n revert SafeCastOverflowedUintDowncast(160, value);\\n }\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n if (value > type(uint152).max) {\\n revert SafeCastOverflowedUintDowncast(152, value);\\n }\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n if (value > type(uint144).max) {\\n revert SafeCastOverflowedUintDowncast(144, value);\\n }\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n if (value > type(uint136).max) {\\n revert SafeCastOverflowedUintDowncast(136, value);\\n }\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n if (value > type(uint128).max) {\\n revert SafeCastOverflowedUintDowncast(128, value);\\n }\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n if (value > type(uint120).max) {\\n revert SafeCastOverflowedUintDowncast(120, value);\\n }\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n if (value > type(uint112).max) {\\n revert SafeCastOverflowedUintDowncast(112, value);\\n }\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n if (value > type(uint104).max) {\\n revert SafeCastOverflowedUintDowncast(104, value);\\n }\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n if (value > type(uint96).max) {\\n revert SafeCastOverflowedUintDowncast(96, value);\\n }\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n if (value > type(uint88).max) {\\n revert SafeCastOverflowedUintDowncast(88, value);\\n }\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n if (value > type(uint80).max) {\\n revert SafeCastOverflowedUintDowncast(80, value);\\n }\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n if (value > type(uint72).max) {\\n revert SafeCastOverflowedUintDowncast(72, value);\\n }\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n if (value > type(uint64).max) {\\n revert SafeCastOverflowedUintDowncast(64, value);\\n }\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n if (value > type(uint56).max) {\\n revert SafeCastOverflowedUintDowncast(56, value);\\n }\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n if (value > type(uint48).max) {\\n revert SafeCastOverflowedUintDowncast(48, value);\\n }\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n if (value > type(uint40).max) {\\n revert SafeCastOverflowedUintDowncast(40, value);\\n }\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n if (value > type(uint32).max) {\\n revert SafeCastOverflowedUintDowncast(32, value);\\n }\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n if (value > type(uint24).max) {\\n revert SafeCastOverflowedUintDowncast(24, value);\\n }\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n if (value > type(uint16).max) {\\n revert SafeCastOverflowedUintDowncast(16, value);\\n }\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n if (value > type(uint8).max) {\\n revert SafeCastOverflowedUintDowncast(8, value);\\n }\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n if (value < 0) {\\n revert SafeCastOverflowedIntToUint(value);\\n }\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(248, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(240, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(232, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(224, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(216, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(208, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(200, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(192, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(184, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(176, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(168, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(160, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(152, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(144, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(136, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(128, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(120, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(112, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(104, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(96, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(88, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(80, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(72, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(64, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(56, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(48, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(40, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(32, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(24, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(16, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(8, value);\\n }\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n if (value > uint256(type(int256).max)) {\\n revert SafeCastOverflowedUintToInt(value);\\n }\\n return int256(value);\\n }\\n\\n /**\\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\\n */\\n function toUint(bool b) internal pure returns (uint256 u) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n u := iszero(iszero(b))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8cd59334ed58b8884cd1f775afc9400db702e674e5d6a7a438c655b9de788d7e\",\"license\":\"MIT\"},\"src/BookViewer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {SafeCast} from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport {UUPSUpgradeable} from \\\"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\\\";\\nimport {ERC1967Proxy} from \\\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\\\"; // To generate artifacts\\nimport {Ownable, Ownable2Step} from \\\"@openzeppelin/contracts/access/Ownable2Step.sol\\\";\\nimport {Initializable} from \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport {IBookManager} from \\\"v2-core/interfaces/IBookManager.sol\\\";\\nimport {SignificantBit} from \\\"v2-core/libraries/SignificantBit.sol\\\";\\nimport {Math} from \\\"v2-core/libraries/Math.sol\\\";\\nimport {Lockers} from \\\"v2-core/libraries/Lockers.sol\\\";\\nimport {BookId} from \\\"v2-core/libraries/BookId.sol\\\";\\nimport {Tick, TickLibrary} from \\\"v2-core/libraries/Tick.sol\\\";\\nimport {FeePolicy, FeePolicyLibrary} from \\\"v2-core/libraries/FeePolicy.sol\\\";\\n\\nimport {IBookViewer} from \\\"./interfaces/IBookViewer.sol\\\";\\nimport {IController} from \\\"./interfaces/IController.sol\\\";\\n\\ncontract BookViewer is IBookViewer, UUPSUpgradeable, Ownable2Step, Initializable {\\n using SafeCast for *;\\n using TickLibrary for *;\\n using Math for uint256;\\n using SignificantBit for uint256;\\n using FeePolicyLibrary for FeePolicy;\\n\\n IBookManager public immutable bookManager;\\n\\n constructor(IBookManager bookManager_) Ownable(msg.sender) {\\n bookManager = bookManager_;\\n }\\n\\n function __BookViewer_init(address owner) external initializer {\\n _transferOwnership(owner);\\n }\\n\\n function _authorizeUpgrade(address) internal override onlyOwner {}\\n\\n function getLiquidity(BookId id, Tick tick, uint256 n) external view returns (Liquidity[] memory liquidity) {\\n liquidity = new Liquidity[](n);\\n if (bookManager.getDepth(id, tick) == 0) tick = bookManager.maxLessThan(id, tick);\\n uint256 i;\\n while (i < n) {\\n if (Tick.unwrap(tick) == type(int24).min) break;\\n liquidity[i] = Liquidity({tick: tick, depth: bookManager.getDepth(id, tick)});\\n tick = bookManager.maxLessThan(id, tick);\\n unchecked {\\n ++i;\\n }\\n }\\n assembly {\\n mstore(liquidity, i)\\n }\\n }\\n\\n function getExpectedInput(IController.TakeOrderParams memory params)\\n external\\n view\\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\\n {\\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\\n\\n if (bookManager.isEmpty(params.id)) return (0, 0);\\n\\n Tick tick = bookManager.getHighest(params.id);\\n\\n while (Tick.unwrap(tick) > type(int24).min) {\\n unchecked {\\n if (params.limitPrice > tick.toPrice()) break;\\n uint256 maxAmount;\\n if (key.takerPolicy.usesQuote()) {\\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.quoteAmount - takenQuoteAmount, true);\\n } else {\\n maxAmount = params.quoteAmount - takenQuoteAmount;\\n }\\n maxAmount = maxAmount.divide(key.unitSize, true);\\n\\n if (maxAmount == 0) break;\\n uint256 currentDepth = bookManager.getDepth(params.id, tick);\\n uint256 quoteAmount = (currentDepth > maxAmount ? maxAmount : currentDepth) * key.unitSize;\\n uint256 baseAmount = tick.quoteToBase(quoteAmount, true);\\n if (key.takerPolicy.usesQuote()) {\\n quoteAmount = uint256(int256(quoteAmount) - key.takerPolicy.calculateFee(quoteAmount, false));\\n } else {\\n baseAmount = uint256(baseAmount.toInt256() + key.takerPolicy.calculateFee(baseAmount, false));\\n }\\n if (quoteAmount == 0) break;\\n\\n takenQuoteAmount += quoteAmount;\\n spentBaseAmount += baseAmount;\\n if (params.quoteAmount <= takenQuoteAmount) break;\\n tick = bookManager.maxLessThan(params.id, tick);\\n }\\n }\\n }\\n\\n function getExpectedOutput(IController.SpendOrderParams memory params)\\n external\\n view\\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\\n {\\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\\n\\n if (bookManager.isEmpty(params.id)) return (0, 0);\\n\\n Tick tick = bookManager.getHighest(params.id);\\n\\n unchecked {\\n while (spentBaseAmount <= params.baseAmount && Tick.unwrap(tick) > type(int24).min) {\\n if (params.limitPrice > tick.toPrice()) break;\\n uint256 maxAmount;\\n if (key.takerPolicy.usesQuote()) {\\n maxAmount = params.baseAmount - spentBaseAmount;\\n } else {\\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.baseAmount - spentBaseAmount, false);\\n }\\n maxAmount = tick.baseToQuote(maxAmount, false) / key.unitSize;\\n\\n if (maxAmount == 0) break;\\n uint256 currentDepth = bookManager.getDepth(params.id, tick);\\n uint256 quoteAmount = (currentDepth > maxAmount ? maxAmount : currentDepth) * key.unitSize;\\n uint256 baseAmount = tick.quoteToBase(quoteAmount, true);\\n if (key.takerPolicy.usesQuote()) {\\n quoteAmount = uint256(int256(quoteAmount) - key.takerPolicy.calculateFee(quoteAmount, false));\\n } else {\\n baseAmount = uint256(baseAmount.toInt256() + key.takerPolicy.calculateFee(baseAmount, false));\\n }\\n if (baseAmount == 0) break;\\n\\n takenQuoteAmount += quoteAmount;\\n spentBaseAmount += baseAmount;\\n tick = bookManager.maxLessThan(params.id, tick);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2c070a850af5fa3367224395f80e24b5516fd2df5b47a0cd32a2fe05dbd45340\",\"license\":\"GPL-2.0-or-later\"},\"src/interfaces/IBookViewer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport {BookId} from \\\"v2-core/libraries/BookId.sol\\\";\\nimport {IBookManager} from \\\"v2-core/interfaces/IBookManager.sol\\\";\\nimport {Tick} from \\\"v2-core/libraries/Tick.sol\\\";\\n\\nimport {IController} from \\\"./IController.sol\\\";\\n\\n/**\\n * @title IBookViewer\\n * @notice Interface for the book viewer contract\\n */\\ninterface IBookViewer {\\n struct Liquidity {\\n Tick tick;\\n uint64 depth;\\n }\\n\\n /**\\n * @notice Returns the book manager\\n * @return The instance of the book manager\\n */\\n function bookManager() external view returns (IBookManager);\\n\\n /**\\n * @notice Returns the liquidity for a specific book\\n * @param id The id of the book\\n * @param from The starting tick\\n * @param n The number of ticks to return\\n * @return liquidity An array of liquidity data\\n */\\n function getLiquidity(BookId id, Tick from, uint256 n) external view returns (Liquidity[] memory liquidity);\\n\\n /**\\n * @notice Returns the expected input for a take order\\n * @param params The parameters of the take order\\n * @return takenQuoteAmount The expected taken quote amount\\n * @return spentBaseAmount The expected spend base amount\\n */\\n function getExpectedInput(IController.TakeOrderParams memory params)\\n external\\n view\\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount);\\n\\n /**\\n * @notice Returns the expected output for a spend order\\n * @param params The parameters of the spend order\\n * @return takenQuoteAmount The expected taken quote amount\\n * @return spentBaseAmount The expected spend base amount\\n */\\n function getExpectedOutput(IController.SpendOrderParams memory params)\\n external\\n view\\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount);\\n}\\n\",\"keccak256\":\"0xa11c7956e26997a39cfb8387970f57eaaa890f7c7f0b0ef234b15527a6dfee83\",\"license\":\"MIT\"},\"src/interfaces/IController.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport {OrderId} from \\\"v2-core/libraries/OrderId.sol\\\";\\nimport {BookId} from \\\"v2-core/libraries/BookId.sol\\\";\\nimport {Tick} from \\\"v2-core/libraries/Tick.sol\\\";\\nimport {IBookManager} from \\\"v2-core/interfaces/IBookManager.sol\\\";\\n\\n/**\\n * @title IController\\n * @notice Interface for the controller contract\\n */\\ninterface IController {\\n // Error messages\\n error InvalidAccess();\\n error InvalidLength();\\n error Deadline();\\n error ControllerSlippage();\\n error InvalidAction();\\n\\n /**\\n * @notice Enum for the different actions that can be performed\\n */\\n enum Action {\\n OPEN,\\n MAKE,\\n LIMIT,\\n TAKE,\\n SPEND,\\n CLAIM,\\n CANCEL\\n }\\n\\n /**\\n * @notice Struct for the parameters of the ERC20 permit\\n */\\n struct ERC20PermitParams {\\n address token;\\n uint256 permitAmount;\\n PermitSignature signature;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the ERC721 permit\\n */\\n struct ERC721PermitParams {\\n uint256 tokenId;\\n PermitSignature signature;\\n }\\n\\n /**\\n * @notice Struct for the signature of the permit\\n */\\n struct PermitSignature {\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the open book action\\n */\\n struct OpenBookParams {\\n IBookManager.BookKey key;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the make order action\\n */\\n struct MakeOrderParams {\\n BookId id;\\n Tick tick;\\n uint256 quoteAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the limit order action\\n */\\n struct LimitOrderParams {\\n BookId takeBookId;\\n BookId makeBookId;\\n uint256 limitPrice;\\n Tick tick;\\n uint256 quoteAmount;\\n bytes takeHookData;\\n bytes makeHookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the take order action\\n */\\n struct TakeOrderParams {\\n BookId id;\\n uint256 limitPrice;\\n uint256 quoteAmount;\\n uint256 maxBaseAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the spend order action\\n */\\n struct SpendOrderParams {\\n BookId id;\\n uint256 limitPrice;\\n uint256 baseAmount;\\n uint256 minQuoteAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the claim order action\\n */\\n struct ClaimOrderParams {\\n OrderId id;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the cancel order action\\n */\\n struct CancelOrderParams {\\n OrderId id;\\n uint256 leftQuoteAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Returns the book manager\\n * @return The instance of the book manager\\n */\\n function bookManager() external view returns (IBookManager);\\n\\n /**\\n * @notice Opens a book\\n * @param openBookParamsList The parameters of the open book action\\n * @param deadline The deadline for the action\\n */\\n function open(OpenBookParams[] calldata openBookParamsList, uint64 deadline) external;\\n\\n /**\\n * @notice Returns the depth of a book\\n * @param id The id of the book\\n * @param tick The tick of the book\\n * @return The depth of the book in quote amount\\n */\\n function getDepth(BookId id, Tick tick) external view returns (uint256);\\n\\n /**\\n * @notice Returns the highest price of a book\\n * @param id The id of the book\\n * @return The highest price of the book with 2**96 precision\\n */\\n function getHighestPrice(BookId id) external view returns (uint256);\\n\\n /**\\n * @notice Returns the details of an order\\n * @param orderId The id of the order\\n * @return provider The provider of the order\\n * @return price The price of the order with 2**96 precision\\n * @return openAmount The open quote amount of the order\\n * @return claimableAmount The claimable base amount of the order\\n */\\n function getOrder(OrderId orderId)\\n external\\n view\\n returns (address provider, uint256 price, uint256 openAmount, uint256 claimableAmount);\\n\\n /**\\n * @notice Converts a price to a tick\\n * @param price The price to convert\\n * @return The tick\\n */\\n function fromPrice(uint256 price) external pure returns (Tick);\\n\\n /**\\n * @notice Converts a tick to a price\\n * @param tick The tick to convert\\n * @return The price with 2**96 precision\\n */\\n function toPrice(Tick tick) external pure returns (uint256);\\n\\n /**\\n * @notice Executes a list of actions\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param actionList The list of actions to execute\\n * @param paramsDataList The parameters of the actions\\n * @param tokensToSettle The tokens to settle\\n * @param erc20PermitParamsList The parameters of the ERC20 permits\\n * @param erc721PermitParamsList The parameters of the ERC721 permits\\n * @param deadline The deadline for the actions\\n * @return ids The ids of the orders\\n */\\n function execute(\\n Action[] calldata actionList,\\n bytes[] calldata paramsDataList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata erc20PermitParamsList,\\n ERC721PermitParams[] calldata erc721PermitParamsList,\\n uint64 deadline\\n ) external payable returns (OrderId[] memory ids);\\n\\n /**\\n * @notice Makes a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to make\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n * @return ids The ids of the orders\\n */\\n function make(\\n MakeOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable returns (OrderId[] memory ids);\\n\\n /**\\n * @notice Takes a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to take\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function take(\\n TakeOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable;\\n\\n /**\\n * @notice Spends to take a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to spend\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function spend(\\n SpendOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable;\\n\\n /**\\n * @notice Claims a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to claim\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function claim(\\n ClaimOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC721PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external;\\n\\n /**\\n * @notice Cancels a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to cancel\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function cancel(\\n CancelOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC721PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x3734542b28d0f7ef6eca2dddfd1df1273307f0c346cdc5ec4128f94180705699\",\"license\":\"MIT\"},\"v2-core/interfaces/IBookManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\nimport {BookId} from \\\"../libraries/BookId.sol\\\";\\nimport {Currency} from \\\"../libraries/Currency.sol\\\";\\nimport {OrderId} from \\\"../libraries/OrderId.sol\\\";\\nimport {Tick} from \\\"../libraries/Tick.sol\\\";\\nimport {FeePolicy} from \\\"../libraries/FeePolicy.sol\\\";\\nimport {IERC721Permit} from \\\"./IERC721Permit.sol\\\";\\nimport {IHooks} from \\\"./IHooks.sol\\\";\\n\\n/**\\n * @title IBookManager\\n * @notice The interface for the BookManager contract\\n */\\ninterface IBookManager is IERC721Metadata, IERC721Permit {\\n error InvalidUnitSize();\\n error InvalidFeePolicy();\\n error InvalidProvider(address provider);\\n error LockedBy(address locker, address hook);\\n error CurrencyNotSettled();\\n\\n /**\\n * @notice Event emitted when a new book is opened\\n * @param id The book id\\n * @param base The base currency\\n * @param quote The quote currency\\n * @param unitSize The unit size of the book\\n * @param makerPolicy The maker fee policy\\n * @param takerPolicy The taker fee policy\\n * @param hooks The hooks contract\\n */\\n event Open(\\n BookId indexed id,\\n Currency indexed base,\\n Currency indexed quote,\\n uint64 unitSize,\\n FeePolicy makerPolicy,\\n FeePolicy takerPolicy,\\n IHooks hooks\\n );\\n\\n /**\\n * @notice Event emitted when a new order is made\\n * @param bookId The book id\\n * @param user The user address\\n * @param tick The order tick\\n * @param orderIndex The order index\\n * @param unit The order unit\\n * @param provider The provider address\\n */\\n event Make(\\n BookId indexed bookId, address indexed user, Tick tick, uint256 orderIndex, uint64 unit, address provider\\n );\\n\\n /**\\n * @notice Event emitted when an order is taken\\n * @param bookId The book id\\n * @param user The user address\\n * @param tick The order tick\\n * @param unit The order unit\\n */\\n event Take(BookId indexed bookId, address indexed user, Tick tick, uint64 unit);\\n\\n /**\\n * @notice Event emitted when an order is canceled\\n * @param orderId The order id\\n * @param unit The canceled unit\\n */\\n event Cancel(OrderId indexed orderId, uint64 unit);\\n\\n /**\\n * @notice Event emitted when an order is claimed\\n * @param orderId The order id\\n * @param unit The claimed unit\\n */\\n event Claim(OrderId indexed orderId, uint64 unit);\\n\\n /**\\n * @notice Event emitted when a provider is whitelisted\\n * @param provider The provider address\\n */\\n event Whitelist(address indexed provider);\\n\\n /**\\n * @notice Event emitted when a provider is delisted\\n * @param provider The provider address\\n */\\n event Delist(address indexed provider);\\n\\n /**\\n * @notice Event emitted when a provider collects fees\\n * @param provider The provider address\\n * @param recipient The recipient address\\n * @param currency The currency\\n * @param amount The collected amount\\n */\\n event Collect(address indexed provider, address indexed recipient, Currency indexed currency, uint256 amount);\\n\\n /**\\n * @notice Event emitted when new default provider is set\\n * @param newDefaultProvider The new default provider address\\n */\\n event SetDefaultProvider(address indexed newDefaultProvider);\\n\\n /**\\n * @notice This structure represents a unique identifier for a book in the BookManager.\\n * @param base The base currency of the book\\n * @param unitSize The unit size of the book\\n * @param quote The quote currency of the book\\n * @param makerPolicy The maker fee policy of the book\\n * @param hooks The hooks contract of the book\\n * @param takerPolicy The taker fee policy of the book\\n */\\n struct BookKey {\\n Currency base;\\n uint64 unitSize;\\n Currency quote;\\n FeePolicy makerPolicy;\\n IHooks hooks;\\n FeePolicy takerPolicy;\\n }\\n\\n /**\\n * @notice Returns the base URI\\n * @return The base URI\\n */\\n function baseURI() external view returns (string memory);\\n\\n /**\\n * @notice Returns the contract URI\\n * @return The contract URI\\n */\\n function contractURI() external view returns (string memory);\\n\\n /**\\n * @notice Returns the default provider\\n * @return The default provider\\n */\\n function defaultProvider() external view returns (address);\\n\\n /**\\n * @notice Returns the total reserves of a given currency\\n * @param currency The currency in question\\n * @return The total reserves amount\\n */\\n function reservesOf(Currency currency) external view returns (uint256);\\n\\n /**\\n * @notice Checks if a provider is whitelisted\\n * @param provider The address of the provider\\n * @return True if the provider is whitelisted, false otherwise\\n */\\n function isWhitelisted(address provider) external view returns (bool);\\n\\n /**\\n * @notice Verifies if an owner has authorized a spender for a token\\n * @param owner The address of the token owner\\n * @param spender The address of the spender\\n * @param tokenId The token ID\\n */\\n function checkAuthorized(address owner, address spender, uint256 tokenId) external view;\\n\\n /**\\n * @notice Calculates the amount owed to a provider in a given currency\\n * @param provider The provider's address\\n * @param currency The currency in question\\n * @return The owed amount\\n */\\n function tokenOwed(address provider, Currency currency) external view returns (uint256);\\n\\n /**\\n * @notice Calculates the currency balance changes for a given locker\\n * @param locker The address of the locker\\n * @param currency The currency in question\\n * @return The net change in currency balance\\n */\\n function getCurrencyDelta(address locker, Currency currency) external view returns (int256);\\n\\n /**\\n * @notice Retrieves the book key for a given book ID\\n * @param id The book ID\\n * @return The book key\\n */\\n function getBookKey(BookId id) external view returns (BookKey memory);\\n\\n /**\\n * @notice This structure represents a current status for an order in the BookManager.\\n * @param provider The provider of the order\\n * @param open The open unit of the order\\n * @param claimable The claimable unit of the order\\n */\\n struct OrderInfo {\\n address provider;\\n uint64 open;\\n uint64 claimable;\\n }\\n\\n /**\\n * @notice Provides information about an order\\n * @param id The order ID\\n * @return Order information including provider, open status, and claimable unit\\n */\\n function getOrder(OrderId id) external view returns (OrderInfo memory);\\n\\n /**\\n * @notice Retrieves the locker and caller addresses for a given lock\\n * @param i The index of the lock\\n * @return locker The locker's address\\n * @return lockCaller The caller's address\\n */\\n function getLock(uint256 i) external view returns (address locker, address lockCaller);\\n\\n /**\\n * @notice Provides the lock data\\n * @return The lock data including necessary numeric values\\n */\\n function getLockData() external view returns (uint128, uint128);\\n\\n /**\\n * @notice Returns the depth of a given book ID and tick\\n * @param id The book ID\\n * @param tick The tick\\n * @return The depth of the tick\\n */\\n function getDepth(BookId id, Tick tick) external view returns (uint64);\\n\\n /**\\n * @notice Retrieves the highest tick for a given book ID\\n * @param id The book ID\\n * @return tick The highest tick\\n */\\n function getHighest(BookId id) external view returns (Tick tick);\\n\\n /**\\n * @notice Finds the maximum tick less than a specified tick in a book\\n * @dev Returns `Tick.wrap(type(int24).min)` if the specified tick is the lowest\\n * @param id The book ID\\n * @param tick The specified tick\\n * @return The next lower tick\\n */\\n function maxLessThan(BookId id, Tick tick) external view returns (Tick);\\n\\n /**\\n * @notice Checks if a book is opened\\n * @param id The book ID\\n * @return True if the book is opened, false otherwise\\n */\\n function isOpened(BookId id) external view returns (bool);\\n\\n /**\\n * @notice Checks if a book is empty\\n * @param id The book ID\\n * @return True if the book is empty, false otherwise\\n */\\n function isEmpty(BookId id) external view returns (bool);\\n\\n /**\\n * @notice Encodes a BookKey into a BookId\\n * @param key The BookKey to encode\\n * @return The encoded BookId\\n */\\n function encodeBookKey(BookKey calldata key) external pure returns (BookId);\\n\\n /**\\n * @notice Loads a value from a specific storage slot\\n * @param slot The storage slot\\n * @return The value in the slot\\n */\\n function load(bytes32 slot) external view returns (bytes32);\\n\\n /**\\n * @notice Loads a sequence of values starting from a specific slot\\n * @param startSlot The starting slot\\n * @param nSlot The number of slots to load\\n * @return The sequence of values\\n */\\n function load(bytes32 startSlot, uint256 nSlot) external view returns (bytes memory);\\n\\n /**\\n * @notice Opens a new book\\n * @param key The book key\\n * @param hookData The hook data\\n */\\n function open(BookKey calldata key, bytes calldata hookData) external;\\n\\n /**\\n * @notice Locks a book manager function\\n * @param locker The locker address\\n * @param data The lock data\\n * @return The lock return data\\n */\\n function lock(address locker, bytes calldata data) external returns (bytes memory);\\n\\n /**\\n * @notice This structure represents the parameters for making an order.\\n * @param key The book key for the order\\n * @param tick The tick for the order\\n * @param unit The unit for the order. Times key.unitSize to get actual bid amount.\\n * @param provider The provider for the order. The limit order service provider address to collect fees.\\n */\\n struct MakeParams {\\n BookKey key;\\n Tick tick;\\n uint64 unit;\\n address provider;\\n }\\n\\n /**\\n * @notice Make a limit order\\n * @param params The order parameters\\n * @param hookData The hook data\\n * @return id The order id. Returns 0 if the order is not settled\\n * @return quoteAmount The amount of quote currency to be paid\\n */\\n function make(MakeParams calldata params, bytes calldata hookData)\\n external\\n returns (OrderId id, uint256 quoteAmount);\\n\\n /**\\n * @notice This structure represents the parameters for taking orders in the specified tick.\\n * @param key The book key for the order\\n * @param tick The tick for the order\\n * @param maxUnit The max unit to take\\n */\\n struct TakeParams {\\n BookKey key;\\n Tick tick;\\n uint64 maxUnit;\\n }\\n\\n /**\\n * @notice Take a limit order at specific tick\\n * @param params The order parameters\\n * @param hookData The hook data\\n * @return quoteAmount The amount of quote currency to be received\\n * @return baseAmount The amount of base currency to be paid\\n */\\n function take(TakeParams calldata params, bytes calldata hookData)\\n external\\n returns (uint256 quoteAmount, uint256 baseAmount);\\n\\n /**\\n * @notice This structure represents the parameters for canceling an order.\\n * @param id The order id for the order\\n * @param toUnit The remaining open unit for the order after cancellation. Must not exceed the current open unit.\\n */\\n struct CancelParams {\\n OrderId id;\\n uint64 toUnit;\\n }\\n\\n /**\\n * @notice Cancel a limit order\\n * @param params The order parameters\\n * @param hookData The hook data\\n * @return canceledAmount The amount of quote currency canceled\\n */\\n function cancel(CancelParams calldata params, bytes calldata hookData) external returns (uint256 canceledAmount);\\n\\n /**\\n * @notice Claims an order\\n * @param id The order ID\\n * @param hookData The hook data\\n * @return claimedAmount The amount claimed\\n */\\n function claim(OrderId id, bytes calldata hookData) external returns (uint256 claimedAmount);\\n\\n /**\\n * @notice Collects fees from a provider\\n * @param recipient The recipient address\\n * @param currency The currency\\n * @return The collected amount\\n */\\n function collect(address recipient, Currency currency) external returns (uint256);\\n\\n /**\\n * @notice Withdraws a currency\\n * @param currency The currency\\n * @param to The recipient address\\n * @param amount The amount\\n */\\n function withdraw(Currency currency, address to, uint256 amount) external;\\n\\n /**\\n * @notice Settles a currency\\n * @param currency The currency\\n * @return The settled amount\\n */\\n function settle(Currency currency) external payable returns (uint256);\\n\\n /**\\n * @notice Whitelists a provider\\n * @param provider The provider address\\n */\\n function whitelist(address provider) external;\\n\\n /**\\n * @notice Delists a provider\\n * @param provider The provider address\\n */\\n function delist(address provider) external;\\n\\n /**\\n * @notice Sets the default provider\\n * @param newDefaultProvider The new default provider address\\n */\\n function setDefaultProvider(address newDefaultProvider) external;\\n}\\n\",\"keccak256\":\"0xda8dffc751ac3554033e084919f1e431eb2585c80e1e30b9a0198366a8607086\",\"license\":\"MIT\"},\"v2-core/interfaces/IERC721Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/**\\n * @title IERC721Permit\\n * @notice An interface for the ERC721 permit extension\\n */\\ninterface IERC721Permit is IERC721 {\\n error InvalidSignature();\\n error PermitExpired();\\n\\n /**\\n * @notice The EIP-712 typehash for the permit struct used by the contract\\n */\\n function PERMIT_TYPEHASH() external pure returns (bytes32);\\n\\n /**\\n * @notice The EIP-712 domain separator for this contract\\n */\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n\\n /**\\n * @notice Approve the spender to transfer the given tokenId\\n * @param spender The address to approve\\n * @param tokenId The tokenId to approve\\n * @param deadline The deadline for the signature\\n * @param v The recovery id of the signature\\n * @param r The r value of the signature\\n * @param s The s value of the signature\\n */\\n function permit(address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;\\n\\n /**\\n * @notice Get the current nonce for a token\\n * @param tokenId The tokenId to get the nonce for\\n * @return The current nonce\\n */\\n function nonces(uint256 tokenId) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xd6baab4710fa674981395f428bd6550c4e288ac44a1a5d38c2a58fd67234d57e\",\"license\":\"MIT\"},\"v2-core/interfaces/IHooks.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.20;\\n\\nimport {IBookManager} from \\\"./IBookManager.sol\\\";\\nimport {OrderId} from \\\"../libraries/OrderId.sol\\\";\\n\\n/**\\n * @title IHooks\\n * @notice Interface for the hooks contract\\n */\\ninterface IHooks {\\n /**\\n * @notice Hook called before opening a new book\\n * @param sender The sender of the open transaction\\n * @param key The key of the book being opened\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after opening a new book\\n * @param sender The sender of the open transaction\\n * @param key The key of the book being opened\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called before making a new order\\n * @param sender The sender of the make transaction\\n * @param params The parameters of the make transaction\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeMake(address sender, IBookManager.MakeParams calldata params, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after making a new order\\n * @param sender The sender of the make transaction\\n * @param params The parameters of the make transaction\\n * @param orderId The id of the order that was made\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterMake(\\n address sender,\\n IBookManager.MakeParams calldata params,\\n OrderId orderId,\\n bytes calldata hookData\\n ) external returns (bytes4);\\n\\n /**\\n * @notice Hook called before taking an order\\n * @param sender The sender of the take transaction\\n * @param params The parameters of the take transaction\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeTake(address sender, IBookManager.TakeParams calldata params, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after taking an order\\n * @param sender The sender of the take transaction\\n * @param params The parameters of the take transaction\\n * @param takenUnit The unit that was taken\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterTake(\\n address sender,\\n IBookManager.TakeParams calldata params,\\n uint64 takenUnit,\\n bytes calldata hookData\\n ) external returns (bytes4);\\n\\n /**\\n * @notice Hook called before canceling an order\\n * @param sender The sender of the cancel transaction\\n * @param params The parameters of the cancel transaction\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeCancel(address sender, IBookManager.CancelParams calldata params, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after canceling an order\\n * @param sender The sender of the cancel transaction\\n * @param params The parameters of the cancel transaction\\n * @param canceledUnit The unit that was canceled\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterCancel(\\n address sender,\\n IBookManager.CancelParams calldata params,\\n uint64 canceledUnit,\\n bytes calldata hookData\\n ) external returns (bytes4);\\n\\n /**\\n * @notice Hook called before claiming an order\\n * @param sender The sender of the claim transaction\\n * @param orderId The id of the order being claimed\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeClaim(address sender, OrderId orderId, bytes calldata hookData) external returns (bytes4);\\n\\n /**\\n * @notice Hook called after claiming an order\\n * @param sender The sender of the claim transaction\\n * @param orderId The id of the order being claimed\\n * @param claimedUnit The unit that was claimed\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterClaim(address sender, OrderId orderId, uint64 claimedUnit, bytes calldata hookData)\\n external\\n returns (bytes4);\\n}\\n\",\"keccak256\":\"0xbff95e07debd7d51cb3aa79172fd3c31efb57cea1c03d21b5740a565198d8343\",\"license\":\"MIT\"},\"v2-core/libraries/BookId.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {IBookManager} from \\\"../interfaces/IBookManager.sol\\\";\\n\\ntype BookId is uint192;\\n\\nlibrary BookIdLibrary {\\n function toId(IBookManager.BookKey memory bookKey) internal pure returns (BookId id) {\\n bytes32 hash = keccak256(abi.encode(bookKey));\\n assembly {\\n id := and(hash, 0xffffffffffffffffffffffffffffffffffffffffffffffff)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x60f9ed99dfb9a5ce14c29359a5ad8b43de0c756e44b2e5f581e8ea6db7cacbeb\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/Currency.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ntype Currency is address;\\n\\n/// @title CurrencyLibrary\\n/// @dev This library allows for transferring and holding native tokens and ERC20 tokens\\nlibrary CurrencyLibrary {\\n using CurrencyLibrary for Currency;\\n\\n /// @notice Thrown when a native transfer fails\\n error NativeTransferFailed();\\n\\n /// @notice Thrown when an ERC20 transfer fails\\n error ERC20TransferFailed();\\n\\n Currency public constant NATIVE = Currency.wrap(address(0));\\n\\n function transfer(Currency currency, address to, uint256 amount) internal {\\n // implementation from\\n // https://github.com/transmissions11/solmate/blob/e8f96f25d48fe702117ce76c79228ca4f20206cb/src/utils/SafeTransferLib.sol\\n\\n bool success;\\n if (currency.isNative()) {\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n\\n if (!success) revert NativeTransferFailed();\\n } else {\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 36), amount) // Append the \\\"amount\\\" argument. Masking not required as it's a full 32 byte type.\\n\\n success :=\\n and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), currency, 0, freeMemoryPointer, 68, 0, 32)\\n )\\n }\\n\\n if (!success) revert ERC20TransferFailed();\\n }\\n }\\n\\n function balanceOfSelf(Currency currency) internal view returns (uint256) {\\n if (currency.isNative()) return address(this).balance;\\n else return IERC20(Currency.unwrap(currency)).balanceOf(address(this));\\n }\\n\\n function equals(Currency currency, Currency other) internal pure returns (bool) {\\n return Currency.unwrap(currency) == Currency.unwrap(other);\\n }\\n\\n function isNative(Currency currency) internal pure returns (bool) {\\n return Currency.unwrap(currency) == Currency.unwrap(NATIVE);\\n }\\n\\n function toId(Currency currency) internal pure returns (uint256) {\\n return uint160(Currency.unwrap(currency));\\n }\\n\\n function fromId(uint256 id) internal pure returns (Currency) {\\n return Currency.wrap(address(uint160(id)));\\n }\\n}\\n\",\"keccak256\":\"0xf04f76015a51981ad0f84fd3ebb0a4eb6c31685604c22584669915aa8dd7ac54\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/FeePolicy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"./Math.sol\\\";\\n\\ntype FeePolicy is uint24;\\n\\nlibrary FeePolicyLibrary {\\n uint256 internal constant RATE_PRECISION = 10 ** 6;\\n int256 internal constant MAX_FEE_RATE = 500000;\\n int256 internal constant MIN_FEE_RATE = -500000;\\n\\n uint256 internal constant RATE_MASK = 0x7fffff; // 23 bits\\n\\n error InvalidFeePolicy();\\n\\n function encode(bool usesQuote_, int24 rate_) internal pure returns (FeePolicy feePolicy) {\\n if (rate_ > MAX_FEE_RATE || rate_ < MIN_FEE_RATE) {\\n revert InvalidFeePolicy();\\n }\\n\\n uint256 mask = usesQuote_ ? 1 << 23 : 0;\\n assembly {\\n feePolicy := or(mask, add(and(rate_, 0xffffff), MAX_FEE_RATE))\\n }\\n }\\n\\n function isValid(FeePolicy self) internal pure returns (bool) {\\n int24 r = rate(self);\\n\\n return !(r > MAX_FEE_RATE || r < MIN_FEE_RATE);\\n }\\n\\n function usesQuote(FeePolicy self) internal pure returns (bool f) {\\n assembly {\\n f := shr(23, self)\\n }\\n }\\n\\n function rate(FeePolicy self) internal pure returns (int24 r) {\\n assembly {\\n r := sub(and(self, RATE_MASK), MAX_FEE_RATE)\\n }\\n }\\n\\n function calculateFee(FeePolicy self, uint256 amount, bool reverseRounding) internal pure returns (int256 fee) {\\n int24 r = rate(self);\\n\\n bool positive = r > 0;\\n uint256 absRate;\\n unchecked {\\n absRate = uint256(uint24(positive ? r : -r));\\n }\\n // @dev absFee must be less than type(int256).max\\n uint256 absFee = Math.divide(amount * absRate, RATE_PRECISION, reverseRounding ? !positive : positive);\\n fee = positive ? int256(absFee) : -int256(absFee);\\n }\\n\\n function calculateOriginalAmount(FeePolicy self, uint256 amount, bool reverseFee)\\n internal\\n pure\\n returns (uint256 originalAmount)\\n {\\n int24 r = rate(self);\\n\\n uint256 divider;\\n assembly {\\n if reverseFee { r := sub(0, r) }\\n divider := add(RATE_PRECISION, r)\\n }\\n originalAmount = Math.divide(amount * RATE_PRECISION, divider, false);\\n }\\n}\\n\",\"keccak256\":\"0x45537a74dd592cf875aa0270a0833dfe76f710a94c85d1ef58f450f1195f5887\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/Lockers.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity ^0.8.23;\\n\\nimport {IHooks} from \\\"../interfaces/IHooks.sol\\\";\\n\\n/// @author Clober\\n/// @author Modified from Uniswap V4 (https://github.com/Uniswap/v4-core/tree/98680ebc1a654120e995d53a5b10ec6fe153066f)\\n/// @notice Contains data about pool lockers.\\n\\n/// @dev This library manages a custom storage implementation for a queue\\n/// that tracks current lockers. The \\\"sentinel\\\" storage slot for this data structure,\\n/// always passed in as IPoolManager.LockData storage self, stores not just the current\\n/// length of the queue but also the global count of non-zero deltas across all lockers.\\n/// The values of the data structure start at OFFSET, and each value is a locker address.\\nlibrary Lockers {\\n /// struct LockData {\\n /// /// @notice The current number of active lockers\\n /// uint128 length;\\n /// /// @notice The total number of nonzero deltas over all active + completed lockers\\n /// uint128 nonzeroDeltaCount;\\n /// }\\n // uint256(keccak256(\\\"LockData\\\")) + 1\\n uint256 internal constant LOCK_DATA_SLOT = 0x760a9a962ae3d184e99c0483cf5684fb3170f47116ca4f445c50209da4f4f907;\\n\\n // uint256(keccak256(\\\"Lockers\\\")) + 1\\n uint256 internal constant LOCKERS_SLOT = 0x722b431450ce53c44434ec138439e45a0639fe031b803ee019b776fae5cfa2b1;\\n\\n // The number of slots per item in the lockers array\\n uint256 internal constant LOCKER_STRUCT_SIZE = 2;\\n\\n // uint256(keccak256(\\\"HookAddress\\\")) + 1\\n uint256 internal constant HOOK_ADDRESS_SLOT = 0xfcac7593714b88fec0c578a53e9f3f6e4b47eb26c9dcaa7eff23a3ac156be422;\\n\\n uint256 internal constant NONZERO_DELTA_COUNT_OFFSET = 2 ** 128;\\n\\n uint256 internal constant LENGTH_MASK = (1 << 128) - 1;\\n\\n /// @dev Pushes a locker onto the end of the queue, and updates the sentinel storage slot.\\n function push(address locker, address lockCaller) internal {\\n assembly {\\n let data := tload(LOCK_DATA_SLOT)\\n let l := and(data, LENGTH_MASK)\\n\\n // LOCKERS_SLOT + l * LOCKER_STRUCT_SIZE\\n let indexToWrite := add(LOCKERS_SLOT, mul(l, LOCKER_STRUCT_SIZE))\\n\\n // in the next storage slot, write the locker and lockCaller\\n tstore(indexToWrite, locker)\\n tstore(add(indexToWrite, 1), lockCaller)\\n\\n // increase the length\\n tstore(LOCK_DATA_SLOT, add(data, 1))\\n }\\n }\\n\\n function lockData() internal view returns (uint128 l, uint128 nonzeroDeltaCount) {\\n assembly {\\n let data := tload(LOCK_DATA_SLOT)\\n l := and(data, LENGTH_MASK)\\n nonzeroDeltaCount := shr(128, data)\\n }\\n }\\n\\n function length() internal view returns (uint128 l) {\\n assembly {\\n l := and(tload(LOCK_DATA_SLOT), LENGTH_MASK)\\n }\\n }\\n\\n /// @dev Pops a locker off the end of the queue. Note that no storage gets cleared.\\n function pop() internal {\\n assembly {\\n let data := tload(LOCK_DATA_SLOT)\\n let l := and(data, LENGTH_MASK)\\n if iszero(l) {\\n mstore(0x00, 0xf1c77ed0) // LockersPopFailed()\\n revert(0x1c, 0x04)\\n }\\n\\n // LOCKERS_SLOT + (l - 1) * LOCKER_STRUCT_SIZE\\n let indexToWrite := add(LOCKERS_SLOT, mul(sub(l, 1), LOCKER_STRUCT_SIZE))\\n\\n // in the next storage slot, delete the locker and lockCaller\\n tstore(indexToWrite, 0)\\n tstore(add(indexToWrite, 1), 0)\\n\\n // decrease the length\\n tstore(LOCK_DATA_SLOT, sub(data, 1))\\n }\\n }\\n\\n function getLocker(uint256 i) internal view returns (address locker) {\\n assembly {\\n // LOCKERS_SLOT + (i * LOCKER_STRUCT_SIZE)\\n locker := tload(add(LOCKERS_SLOT, mul(i, LOCKER_STRUCT_SIZE)))\\n }\\n }\\n\\n function getLockCaller(uint256 i) internal view returns (address locker) {\\n assembly {\\n // LOCKERS_SLOT + (i * LOCKER_STRUCT_SIZE + 1)\\n locker := tload(add(LOCKERS_SLOT, add(mul(i, LOCKER_STRUCT_SIZE), 1)))\\n }\\n }\\n\\n function getCurrentLocker() internal view returns (address) {\\n unchecked {\\n uint256 l = length();\\n return l > 0 ? getLocker(l - 1) : address(0);\\n }\\n }\\n\\n function getCurrentLockCaller() internal view returns (address) {\\n unchecked {\\n uint256 l = length();\\n return l > 0 ? getLockCaller(l - 1) : address(0);\\n }\\n }\\n\\n function incrementNonzeroDeltaCount() internal {\\n assembly {\\n tstore(LOCK_DATA_SLOT, add(tload(LOCK_DATA_SLOT), NONZERO_DELTA_COUNT_OFFSET))\\n }\\n }\\n\\n function decrementNonzeroDeltaCount() internal {\\n assembly {\\n tstore(LOCK_DATA_SLOT, sub(tload(LOCK_DATA_SLOT), NONZERO_DELTA_COUNT_OFFSET))\\n }\\n }\\n\\n function getCurrentHook() internal view returns (IHooks currentHook) {\\n return IHooks(getHook(length()));\\n }\\n\\n function getHook(uint256 i) internal view returns (address hook) {\\n assembly {\\n hook := tload(add(HOOK_ADDRESS_SLOT, i))\\n }\\n }\\n\\n function setCurrentHook(IHooks currentHook) internal returns (bool set) {\\n // Set the hook address for the current locker if the address is 0.\\n // If the address is nonzero, a hook has already been set for this lock, and is not allowed to be updated or cleared at the end of the call.\\n if (address(getCurrentHook()) == address(0)) {\\n uint256 l = length();\\n assembly {\\n tstore(add(HOOK_ADDRESS_SLOT, l), currentHook)\\n }\\n return true;\\n }\\n }\\n\\n function clearCurrentHook() internal {\\n uint256 l = length();\\n assembly {\\n tstore(add(HOOK_ADDRESS_SLOT, l), 0)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfa5e13e7a4f27efe2ea85cabd5c047b390fac76f201ec2d5c8c2a3b84268ff6e\",\"license\":\"BUSL-1.1\"},\"v2-core/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n function divide(uint256 a, uint256 b, bool roundingUp) internal pure returns (uint256 ret) {\\n // In the OrderBook contract code, b is never zero.\\n assembly {\\n ret := add(div(a, b), and(gt(mod(a, b), 0), roundingUp))\\n }\\n }\\n\\n /// @dev Returns `ln(x)`, denominated in `WAD`.\\n /// Credit to Remco Bloemen under MIT license: https://2\\u03c0.com/22/exp-ln\\n function lnWad(int256 x) internal pure returns (int256 r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // We want to convert `x` from `10**18` fixed point to `2**96` fixed point.\\n // We do this by multiplying by `2**96 / 10**18`. But since\\n // `ln(x * C) = ln(x) + ln(C)`, we can simply do nothing here\\n // and add `ln(2**96 / 10**18)` at the end.\\n\\n // Compute `k = log2(x) - 96`, `r = 159 - k = 255 - log2(x) = 255 ^ log2(x)`.\\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\\n r := or(r, shl(3, lt(0xff, shr(r, x))))\\n // We place the check here for more optimal stack operations.\\n if iszero(sgt(x, 0)) {\\n mstore(0x00, 0x1615e638) // `LnWadUndefined()`.\\n revert(0x1c, 0x04)\\n }\\n // forgefmt: disable-next-item\\n r := xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)),\\n 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff))\\n\\n // Reduce range of x to (1, 2) * 2**96\\n // ln(2^k * x) = k * ln(2) + ln(x)\\n x := shr(159, shl(r, x))\\n\\n // Evaluate using a (8, 8)-term rational approximation.\\n // `p` is made monic, we will multiply by a scale factor later.\\n // forgefmt: disable-next-item\\n let p := sub( // This heavily nested expression is to avoid stack-too-deep for via-ir.\\n sar(96, mul(add(43456485725739037958740375743393,\\n sar(96, mul(add(24828157081833163892658089445524,\\n sar(96, mul(add(3273285459638523848632254066296,\\n x), x))), x))), x)), 11111509109440967052023855526967)\\n p := sub(sar(96, mul(p, x)), 45023709667254063763336534515857)\\n p := sub(sar(96, mul(p, x)), 14706773417378608786704636184526)\\n p := sub(mul(p, x), shl(96, 795164235651350426258249787498))\\n // We leave `p` in `2**192` basis so we don't need to scale it back up for the division.\\n\\n // `q` is monic by convention.\\n let q := add(5573035233440673466300451813936, x)\\n q := add(71694874799317883764090561454958, sar(96, mul(x, q)))\\n q := add(283447036172924575727196451306956, sar(96, mul(x, q)))\\n q := add(401686690394027663651624208769553, sar(96, mul(x, q)))\\n q := add(204048457590392012362485061816622, sar(96, mul(x, q)))\\n q := add(31853899698501571402653359427138, sar(96, mul(x, q)))\\n q := add(909429971244387300277376558375, sar(96, mul(x, q)))\\n\\n // `p / q` is in the range `(0, 0.125) * 2**96`.\\n\\n // Finalization, we need to:\\n // - Multiply by the scale factor `s = 5.549\\u2026`.\\n // - Add `ln(2**96 / 10**18)`.\\n // - Add `k * ln(2)`.\\n // - Multiply by `10**18 / 2**96 = 5**18 >> 78`.\\n\\n // The q polynomial is known not to have zeros in the domain.\\n // No scaling required because p is already `2**96` too large.\\n p := sdiv(p, q)\\n // Multiply by the scaling factor: `s * 5**18 * 2**96`, base is now `5**18 * 2**192`.\\n p := mul(1677202110996718588342820967067443963516166, p)\\n // Add `ln(2) * k * 5**18 * 2**192`.\\n // forgefmt: disable-next-item\\n p := add(mul(16597577552685614221487285958193947469193820559219878177908093499208371, sub(159, r)), p)\\n // Base conversion: mul `2**96 / (5**18 * 2**192)`.\\n r := sdiv(p, 302231454903657293676544000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb2dc502dd66a9e36e6c4bb8c4fb3d21120f9f0ff7a934dcfe21ec820cac72275\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/OrderId.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.0;\\n\\nimport {Tick} from \\\"./Tick.sol\\\";\\nimport {BookId} from \\\"./BookId.sol\\\";\\n\\ntype OrderId is uint256;\\n\\nlibrary OrderIdLibrary {\\n /**\\n * @dev Encode the order id.\\n * @param bookId The book id.\\n * @param tick The tick.\\n * @param index The index.\\n * @return id The order id.\\n */\\n function encode(BookId bookId, Tick tick, uint40 index) internal pure returns (OrderId id) {\\n // @dev If we just use tick at the assembly code, the code will convert tick into bytes32.\\n // e.g. When index == -2, the shifted value( shl(40, tick) ) will be\\n // 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000 instead of 0xfffffffe0000000000\\n // Therefore, we have to safely cast tick into uint256 first.\\n uint256 _tick = uint256(uint24(Tick.unwrap(tick)));\\n assembly {\\n id := add(index, add(shl(40, _tick), shl(64, bookId)))\\n }\\n }\\n\\n function decode(OrderId id) internal pure returns (BookId bookId, Tick tick, uint40 index) {\\n assembly {\\n bookId := shr(64, id)\\n tick := and(shr(40, id), 0xffffff)\\n index := and(id, 0xffffffffff)\\n }\\n }\\n\\n function getBookId(OrderId id) internal pure returns (BookId bookId) {\\n assembly {\\n bookId := shr(64, id)\\n }\\n }\\n\\n function getTick(OrderId id) internal pure returns (Tick tick) {\\n assembly {\\n tick := and(shr(40, id), 0xffffff)\\n }\\n }\\n\\n function getIndex(OrderId id) internal pure returns (uint40 index) {\\n assembly {\\n index := and(id, 0xffffffffff)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x78c384badc4971d774987c6f5bce9d578712c7469688735b3c1eafaf2e748fe6\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/SignificantBit.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.0;\\n\\nlibrary SignificantBit {\\n // http://supertech.csail.mit.edu/papers/debruijn.pdf\\n uint256 internal constant DEBRUIJN_SEQ = 0x818283848586878898A8B8C8D8E8F929395969799A9B9D9E9FAAEB6BEDEEFF;\\n bytes internal constant DEBRUIJN_INDEX =\\n hex\\\"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8\\\";\\n\\n /**\\n * @notice Finds the index of the least significant bit.\\n * @param x The value to compute the least significant bit for. Must be a non-zero value.\\n * @return ret The index of the least significant bit.\\n */\\n function leastSignificantBit(uint256 x) internal pure returns (uint8) {\\n require(x > 0);\\n uint256 index;\\n assembly {\\n index := shr(248, mul(and(x, add(not(x), 1)), DEBRUIJN_SEQ))\\n }\\n return uint8(DEBRUIJN_INDEX[index]); // can optimize with CODECOPY opcode\\n }\\n\\n function mostSignificantBit(uint256 x) internal pure returns (uint8 msb) {\\n require(x > 0);\\n assembly {\\n let f := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n x := shr(f, x)\\n f := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n msb := or(msb, f)\\n x := shr(f, x)\\n f := shl(5, gt(x, 0xFFFFFFFF))\\n msb := or(msb, f)\\n x := shr(f, x)\\n f := shl(4, gt(x, 0xFFFF))\\n msb := or(msb, f)\\n x := shr(f, x)\\n f := shl(3, gt(x, 0xFF))\\n msb := or(msb, f)\\n x := shr(f, x)\\n f := shl(2, gt(x, 0xF))\\n msb := or(msb, f)\\n x := shr(f, x)\\n f := shl(1, gt(x, 0x3))\\n msb := or(msb, f)\\n x := shr(f, x)\\n f := gt(x, 0x1)\\n msb := or(msb, f)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7ffeb68f2f666cdbefa20efc0376c922f049a8765d9a25871c9ade4fabc9e604\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/Tick.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"./Math.sol\\\";\\n\\ntype Tick is int24;\\n\\nlibrary TickLibrary {\\n using Math for *;\\n using TickLibrary for Tick;\\n\\n error InvalidTick();\\n error InvalidPrice();\\n error TickOverflow();\\n\\n int24 internal constant MAX_TICK = 2 ** 19 - 1;\\n int24 internal constant MIN_TICK = -MAX_TICK;\\n\\n uint256 internal constant MIN_PRICE = 1350587;\\n uint256 internal constant MAX_PRICE = 4647684107270898330752324302845848816923571339324334;\\n\\n uint256 private constant _R0 = 0xfff97272373d413259a46990;\\n uint256 private constant _R1 = 0xfff2e50f5f656932ef12357c;\\n uint256 private constant _R2 = 0xffe5caca7e10e4e61c3624ea;\\n uint256 private constant _R3 = 0xffcb9843d60f6159c9db5883;\\n uint256 private constant _R4 = 0xff973b41fa98c081472e6896;\\n uint256 private constant _R5 = 0xff2ea16466c96a3843ec78b3;\\n uint256 private constant _R6 = 0xfe5dee046a99a2a811c461f1;\\n uint256 private constant _R7 = 0xfcbe86c7900a88aedcffc83b;\\n uint256 private constant _R8 = 0xf987a7253ac413176f2b074c;\\n uint256 private constant _R9 = 0xf3392b0822b70005940c7a39;\\n uint256 private constant _R10 = 0xe7159475a2c29b7443b29c7f;\\n uint256 private constant _R11 = 0xd097f3bdfd2022b8845ad8f7;\\n uint256 private constant _R12 = 0xa9f746462d870fdf8a65dc1f;\\n uint256 private constant _R13 = 0x70d869a156d2a1b890bb3df6;\\n uint256 private constant _R14 = 0x31be135f97d08fd981231505;\\n uint256 private constant _R15 = 0x9aa508b5b7a84e1c677de54;\\n uint256 private constant _R16 = 0x5d6af8dedb81196699c329;\\n uint256 private constant _R17 = 0x2216e584f5fa1ea92604;\\n uint256 private constant _R18 = 0x48a170391f7dc42;\\n uint256 private constant _R19 = 0x149b34;\\n\\n function validateTick(Tick tick) internal pure {\\n if (Tick.unwrap(tick) > MAX_TICK || Tick.unwrap(tick) < MIN_TICK) revert InvalidTick();\\n }\\n\\n modifier validatePrice(uint256 price) {\\n if (price > MAX_PRICE || price < MIN_PRICE) revert InvalidPrice();\\n _;\\n }\\n\\n function fromPrice(uint256 price) internal pure validatePrice(price) returns (Tick) {\\n unchecked {\\n int24 tick = int24((int256(price).lnWad() * 42951820407860) / 2 ** 128);\\n if (toPrice(Tick.wrap(tick)) > price) return Tick.wrap(tick - 1);\\n return Tick.wrap(tick);\\n }\\n }\\n\\n function toPrice(Tick tick) internal pure returns (uint256 price) {\\n validateTick(tick);\\n int24 tickValue = Tick.unwrap(tick);\\n uint256 absTick = uint24(tickValue < 0 ? -tickValue : tickValue);\\n\\n unchecked {\\n if (absTick & 0x1 != 0) price = _R0;\\n else price = 1 << 96;\\n if (absTick & 0x2 != 0) price = (price * _R1) >> 96;\\n if (absTick & 0x4 != 0) price = (price * _R2) >> 96;\\n if (absTick & 0x8 != 0) price = (price * _R3) >> 96;\\n if (absTick & 0x10 != 0) price = (price * _R4) >> 96;\\n if (absTick & 0x20 != 0) price = (price * _R5) >> 96;\\n if (absTick & 0x40 != 0) price = (price * _R6) >> 96;\\n if (absTick & 0x80 != 0) price = (price * _R7) >> 96;\\n if (absTick & 0x100 != 0) price = (price * _R8) >> 96;\\n if (absTick & 0x200 != 0) price = (price * _R9) >> 96;\\n if (absTick & 0x400 != 0) price = (price * _R10) >> 96;\\n if (absTick & 0x800 != 0) price = (price * _R11) >> 96;\\n if (absTick & 0x1000 != 0) price = (price * _R12) >> 96;\\n if (absTick & 0x2000 != 0) price = (price * _R13) >> 96;\\n if (absTick & 0x4000 != 0) price = (price * _R14) >> 96;\\n if (absTick & 0x8000 != 0) price = (price * _R15) >> 96;\\n if (absTick & 0x10000 != 0) price = (price * _R16) >> 96;\\n if (absTick & 0x20000 != 0) price = (price * _R17) >> 96;\\n if (absTick & 0x40000 != 0) price = (price * _R18) >> 96;\\n }\\n if (tickValue > 0) price = 0x1000000000000000000000000000000000000000000000000 / price;\\n }\\n\\n function gt(Tick a, Tick b) internal pure returns (bool) {\\n return Tick.unwrap(a) > Tick.unwrap(b);\\n }\\n\\n function baseToQuote(Tick tick, uint256 base, bool roundingUp) internal pure returns (uint256) {\\n return Math.divide((base * tick.toPrice()), 1 << 96, roundingUp);\\n }\\n\\n function quoteToBase(Tick tick, uint256 quote, bool roundingUp) internal pure returns (uint256) {\\n // @dev quote = unit(uint64) * unitSize(uint64) < 2^96\\n // We don't need to check overflow here\\n return Math.divide(quote << 96, tick.toPrice(), roundingUp);\\n }\\n}\\n\",\"keccak256\":\"0xffbe19efd2b2e4e1eee3ed15c9363f5c45d70a6058b0b85ec9199e34de3b6b9b\",\"license\":\"GPL-2.0-or-later\"}},\"version\":1}", + "bytecode": "0x60c060405230608052348015610013575f80fd5b506040516121d23803806121d2833981016040819052610032916100dd565b338061005757604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61006081610072565b506001600160a01b031660a05261010a565b600180546001600160a01b031916905561008b8161008e565b50565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156100ed575f80fd5b81516001600160a01b0381168114610103575f80fd5b9392505050565b60805160a05161203761019b5f395f818161013b015281816102f3015281816103880152818161042c0152818161058c015281816106d90152818161078301528181610818015281816108bc015281816109fc01528181610b5d01528181610dec01528181610e9501528181610f66015261102101525f81816115e50152818161160e01526117b701526120375ff3fe6080604052600436106100ce575f3560e01c8063694d8a291161007c5780638da5cb5b116100575780638da5cb5b1461021f578063ad3cb1cc1461023b578063e30c397814610290578063f2fde38b146102ad575f80fd5b8063694d8a29146101cb578063715018a6146101f757806379ba50971461020b575f80fd5b80634f1ef286116100ac5780634f1ef2861461017557806350a216c61461018a57806352d1902d146101a9575f80fd5b80630202121a146100d2578063130391b61461010b5780633f322bc91461012a575b5f80fd5b3480156100dd575f80fd5b506100f16100ec366004611c5d565b6102cc565b604080519283526020830191909152015b60405180910390f35b348015610116575f80fd5b506100f1610125366004611c5d565b61075c565b348015610135575f80fd5b5061015d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610102565b610188610183366004611cab565b610bd9565b005b348015610195575f80fd5b506101886101a4366004611cf8565b610bf8565b3480156101b4575f80fd5b506101bd610d33565b604051908152602001610102565b3480156101d6575f80fd5b506101ea6101e5366004611d21565b610d61565b6040516101029190611d5d565b348015610202575f80fd5b506101886110a5565b348015610216575f80fd5b506101886110b8565b34801561022a575f80fd5b505f546001600160a01b031661015d565b348015610246575f80fd5b506102836040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516101029190611db8565b34801561029b575f80fd5b506001546001600160a01b031661015d565b3480156102b8575f80fd5b506101886102c7366004611cf8565b611101565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610340573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103649190611e16565b845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156103d5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103f99190611eb9565b1561040957505f93849350915050565b835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015610479573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061049d9190611ed8565b90505b846040015183111580156104bb5750627fffff19600282900b135b15610755576104cc8160020b61117e565b856020015111610755575f6104ea8360a0015162ffffff1660171c90565b156104fd57838660400151039050610524565b610521848760400151035f8560a0015162ffffff166114469092919063ffffffff16565b90505b602083015167ffffffffffffffff16610542600284900b835f61148a565b8161054f5761054f611ef3565b049050805f0361055f5750610755565b8551604051630835177160e31b81526001600160c01b039091166004820152600283900b60248201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906341a8bb8890604401602060405180830381865afa1580156105d9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105fd9190611f07565b67ffffffffffffffff1690505f846020015167ffffffffffffffff168383116106265782610628565b835b0290505f61063c600286900b8360016114d6565b90506106518660a0015162ffffff1660171c90565b156106745760a086015161066b9062ffffff16835f6114f8565b82039150610696565b60a08601516106899062ffffff16825f6114f8565b61069282611578565b0190505b805f036106a65750505050610755565b885160405163285e76b760e21b81526001600160c01b039091166004820152600286900b602482015297820197968101967f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa158015610726573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061074a9190611ed8565b9450505050506104a0565b5050915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa1580156107d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107f49190611e16565b845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa158015610865573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108899190611eb9565b1561089957505f93849350915050565b835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015610909573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061092d9190611ed8565b90505b627fffff19600282900b13156107555761094c8160020b61117e565b856020015111610755575f61096a8360a0015162ffffff1660171c90565b1561099b576109948587604001510360018560a0015162ffffff166114469092919063ffffffff16565b90506109a5565b8486604001510390505b602083015167ffffffffffffffff168082049082061515600116019050805f036109cf5750610755565b8551604051630835177160e31b81526001600160c01b039091166004820152600283900b60248201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906341a8bb8890604401602060405180830381865afa158015610a49573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a6d9190611f07565b67ffffffffffffffff1690505f846020015167ffffffffffffffff16838311610a965782610a98565b835b0290505f610aac600286900b8360016114d6565b9050610ac18660a0015162ffffff1660171c90565b15610ae45760a0860151610adb9062ffffff16835f6114f8565b82039150610b06565b60a0860151610af99062ffffff16825f6114f8565b610b0282611578565b0190505b815f03610b165750505050610755565b604089015197820197968101968810610b325750505050610755565b885160405163285e76b760e21b81526001600160c01b039091166004820152600286900b60248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa158015610baa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bce9190611ed8565b945050505050610930565b610be16115da565b610bea82611691565b610bf48282611699565b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff165f81158015610c425750825b90505f8267ffffffffffffffff166001148015610c5e5750303b155b905081158015610c6c575080155b15610ca3576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cd757845468ff00000000000000001916680100000000000000001785555b610ce086611786565b8315610d2b57845468ff000000000000000019168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b5f610d3c6117ac565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b60608167ffffffffffffffff811115610d7c57610d7c611b14565b604051908082528060200260200182016040528015610dc057816020015b604080518082019091525f8082526020820152815260200190600190039081610d9a5790505b50604051630835177160e31b81526001600160c01b0386166004820152600285900b60248201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906341a8bb8890604401602060405180830381865afa158015610e39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e5d9190611f07565b67ffffffffffffffff165f03610f095760405163285e76b760e21b81526001600160c01b0385166004820152600284900b60248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa158015610ee2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f069190611ed8565b92505b5f5b8281101561109c5762800000600285900b011561109c57604080518082018252600286900b8082529151630835177160e31b81526001600160c01b038816600482015260248101929092529060208201906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610fab573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fcf9190611f07565b67ffffffffffffffff16815250828281518110610fee57610fee611f20565b602090810291909101015260405163285e76b760e21b81526001600160c01b0386166004820152600285900b60248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa15801561106e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110929190611ed8565b9350600101610f0b565b81529392505050565b6110ad6117f5565b6110b65f611786565b565b60015433906001600160a01b031681146110f55760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6110fe81611786565b50565b6111096117f5565b600180546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff1990911681179091556111465f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f61118882611821565b815f600282900b811361119b57816111a4565b6111a482611f48565b62ffffff81169150600116156111c8576bfff97272373d413259a4699092506111d9565b6c0100000000000000000000000092505b60028116156111f85760606bfff2e50f5f656932ef12357c8402901c92505b60048116156112175760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156112365760606bffcb9843d60f6159c9db58838402901c92505b60108116156112555760606bff973b41fa98c081472e68968402901c92505b60208116156112745760606bff2ea16466c96a3843ec78b38402901c92505b60408116156112935760606bfe5dee046a99a2a811c461f18402901c92505b60808116156112b25760606bfcbe86c7900a88aedcffc83b8402901c92505b6101008116156112d25760606bf987a7253ac413176f2b074c8402901c92505b6102008116156112f25760606bf3392b0822b70005940c7a398402901c92505b6104008116156113125760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156113325760606bd097f3bdfd2022b8845ad8f78402901c92505b6110008116156113525760606ba9f746462d870fdf8a65dc1f8402901c92505b6120008116156113725760606b70d869a156d2a1b890bb3df68402901c92505b6140008116156113925760606b31be135f97d08fd9812315058402901c92505b6180008116156113b25760606b09aa508b5b7a84e1c677de548402901c92505b620100008116156113d25760606a5d6af8dedb81196699c3298402901c92505b620200008116156113f1576060692216e584f5fa1ea926048402901c92505b6204000081161561140e57606067048a170391f7dc428402901c92505b5f8260020b131561143f5761143c837801000000000000000000000000000000000000000000000000611f68565b92505b5050919050565b5f6207a11f19627fffff85160181831561146057815f0391505b81620f4240019050611480620f42408661147a9190611f87565b82900490565b9695505050505050565b5f6114cc61149a8560020b61117e565b6114a49085611f87565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b90505b9392505050565b5f6114cc606084901b6114eb8660020b61117e565b8082061515851691040190565b5f6207a11f19627fffff851601600281900b8212828161151a57825f0361151c565b825b62ffffff1690505f6115556115318389611f87565b620f424088611547578581830615151691040190565b808206151586151691040190565b90508261156a5761156581611f9e565b61156c565b805b98975050505050505050565b5f7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8211156115d6576040517f24775e06000000000000000000000000000000000000000000000000000000008152600481018390526024016110ec565b5090565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061167357507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166116677f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614155b156110b65760405163703e46dd60e11b815260040160405180910390fd5b6110fe6117f5565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156116f3575060408051601f3d908101601f191682019092526116f091810190611fd4565b60015b61171b57604051634c9c8ce360e01b81526001600160a01b03831660048201526024016110ec565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611777576040517faa1d49a4000000000000000000000000000000000000000000000000000000008152600481018290526024016110ec565b611781838361187d565b505050565b6001805473ffffffffffffffffffffffffffffffffffffffff191690556110fe816118d2565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146110b65760405163703e46dd60e11b815260040160405180910390fd5b5f546001600160a01b031633146110b65760405163118cdaa760e01b81523360048201526024016110ec565b6207ffff600282900b1380611846575061183d6207ffff611f48565b60020b8160020b125b156110fe576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118868261192e565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156118ca5761178182826119b1565b610bf4611a25565b5f80546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b5f0361196357604051634c9c8ce360e01b81526001600160a01b03821660048201526024016110ec565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516119cd9190611feb565b5f60405180830381855af49150503d805f8114611a05576040519150601f19603f3d011682016040523d82523d5f602084013e611a0a565b606091505b5091509150611a1a858383611a5d565b925050505b92915050565b34156110b6576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082611a7257611a6d82611ad2565b6114cf565b8151158015611a8957506001600160a01b0384163b155b15611acb576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016110ec565b50806114cf565b805115611ae25780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b634e487b7160e01b5f52604160045260245ffd5b80356001600160c01b0381168114611b3e575f80fd5b919050565b5f82601f830112611b52575f80fd5b813567ffffffffffffffff80821115611b6d57611b6d611b14565b604051601f8301601f19908116603f01168101908282118183101715611b9557611b95611b14565b81604052838152866020858801011115611bad575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f60a08284031215611bdc575f80fd5b60405160a0810167ffffffffffffffff8282108183111715611c0057611c00611b14565b81604052829350611c1085611b28565b83526020850135602084015260408501356040840152606085013560608401526080850135915080821115611c43575f80fd5b50611c5085828601611b43565b6080830152505092915050565b5f60208284031215611c6d575f80fd5b813567ffffffffffffffff811115611c83575f80fd5b611c8f84828501611bcc565b949350505050565b6001600160a01b03811681146110fe575f80fd5b5f8060408385031215611cbc575f80fd5b8235611cc781611c97565b9150602083013567ffffffffffffffff811115611ce2575f80fd5b611cee85828601611b43565b9150509250929050565b5f60208284031215611d08575f80fd5b81356114cf81611c97565b8060020b81146110fe575f80fd5b5f805f60608486031215611d33575f80fd5b611d3c84611b28565b92506020840135611d4c81611d13565b929592945050506040919091013590565b602080825282518282018190525f919060409081850190868401855b82811015611dab578151805160020b855286015167ffffffffffffffff16868501529284019290850190600101611d79565b5091979650505050505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b805167ffffffffffffffff81168114611b3e575f80fd5b805162ffffff81168114611b3e575f80fd5b5f60c08284031215611e26575f80fd5b60405160c0810181811067ffffffffffffffff82111715611e4957611e49611b14565b6040528251611e5781611c97565b8152611e6560208401611ded565b60208201526040830151611e7881611c97565b6040820152611e8960608401611e04565b60608201526080830151611e9c81611c97565b6080820152611ead60a08401611e04565b60a08201529392505050565b5f60208284031215611ec9575f80fd5b815180151581146114cf575f80fd5b5f60208284031215611ee8575f80fd5b81516114cf81611d13565b634e487b7160e01b5f52601260045260245ffd5b5f60208284031215611f17575f80fd5b6114cf82611ded565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f8160020b627fffff198103611f6057611f60611f34565b5f0392915050565b5f82611f8257634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417611a1f57611a1f611f34565b5f7f80000000000000000000000000000000000000000000000000000000000000008203611fce57611fce611f34565b505f0390565b5f60208284031215611fe4575f80fd5b5051919050565b5f82518060208501845e5f92019182525091905056fea26469706673582212201384fec9d689ff8567ac4701a5d2f058cf3c4336dfc0d5f03515fa030466ea4064736f6c63430008190033", + "deployedBytecode": "0x6080604052600436106100ce575f3560e01c8063694d8a291161007c5780638da5cb5b116100575780638da5cb5b1461021f578063ad3cb1cc1461023b578063e30c397814610290578063f2fde38b146102ad575f80fd5b8063694d8a29146101cb578063715018a6146101f757806379ba50971461020b575f80fd5b80634f1ef286116100ac5780634f1ef2861461017557806350a216c61461018a57806352d1902d146101a9575f80fd5b80630202121a146100d2578063130391b61461010b5780633f322bc91461012a575b5f80fd5b3480156100dd575f80fd5b506100f16100ec366004611c5d565b6102cc565b604080519283526020830191909152015b60405180910390f35b348015610116575f80fd5b506100f1610125366004611c5d565b61075c565b348015610135575f80fd5b5061015d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610102565b610188610183366004611cab565b610bd9565b005b348015610195575f80fd5b506101886101a4366004611cf8565b610bf8565b3480156101b4575f80fd5b506101bd610d33565b604051908152602001610102565b3480156101d6575f80fd5b506101ea6101e5366004611d21565b610d61565b6040516101029190611d5d565b348015610202575f80fd5b506101886110a5565b348015610216575f80fd5b506101886110b8565b34801561022a575f80fd5b505f546001600160a01b031661015d565b348015610246575f80fd5b506102836040518060400160405280600581526020017f352e302e3000000000000000000000000000000000000000000000000000000081525081565b6040516101029190611db8565b34801561029b575f80fd5b506001546001600160a01b031661015d565b3480156102b8575f80fd5b506101886102c7366004611cf8565b611101565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610340573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103649190611e16565b845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156103d5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103f99190611eb9565b1561040957505f93849350915050565b835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015610479573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061049d9190611ed8565b90505b846040015183111580156104bb5750627fffff19600282900b135b15610755576104cc8160020b61117e565b856020015111610755575f6104ea8360a0015162ffffff1660171c90565b156104fd57838660400151039050610524565b610521848760400151035f8560a0015162ffffff166114469092919063ffffffff16565b90505b602083015167ffffffffffffffff16610542600284900b835f61148a565b8161054f5761054f611ef3565b049050805f0361055f5750610755565b8551604051630835177160e31b81526001600160c01b039091166004820152600283900b60248201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906341a8bb8890604401602060405180830381865afa1580156105d9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105fd9190611f07565b67ffffffffffffffff1690505f846020015167ffffffffffffffff168383116106265782610628565b835b0290505f61063c600286900b8360016114d6565b90506106518660a0015162ffffff1660171c90565b156106745760a086015161066b9062ffffff16835f6114f8565b82039150610696565b60a08601516106899062ffffff16825f6114f8565b61069282611578565b0190505b805f036106a65750505050610755565b885160405163285e76b760e21b81526001600160c01b039091166004820152600286900b602482015297820197968101967f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa158015610726573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061074a9190611ed8565b9450505050506104a0565b5050915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa1580156107d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107f49190611e16565b845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa158015610865573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108899190611eb9565b1561089957505f93849350915050565b835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015610909573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061092d9190611ed8565b90505b627fffff19600282900b13156107555761094c8160020b61117e565b856020015111610755575f61096a8360a0015162ffffff1660171c90565b1561099b576109948587604001510360018560a0015162ffffff166114469092919063ffffffff16565b90506109a5565b8486604001510390505b602083015167ffffffffffffffff168082049082061515600116019050805f036109cf5750610755565b8551604051630835177160e31b81526001600160c01b039091166004820152600283900b60248201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906341a8bb8890604401602060405180830381865afa158015610a49573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a6d9190611f07565b67ffffffffffffffff1690505f846020015167ffffffffffffffff16838311610a965782610a98565b835b0290505f610aac600286900b8360016114d6565b9050610ac18660a0015162ffffff1660171c90565b15610ae45760a0860151610adb9062ffffff16835f6114f8565b82039150610b06565b60a0860151610af99062ffffff16825f6114f8565b610b0282611578565b0190505b815f03610b165750505050610755565b604089015197820197968101968810610b325750505050610755565b885160405163285e76b760e21b81526001600160c01b039091166004820152600286900b60248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa158015610baa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bce9190611ed8565b945050505050610930565b610be16115da565b610bea82611691565b610bf48282611699565b5050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff165f81158015610c425750825b90505f8267ffffffffffffffff166001148015610c5e5750303b155b905081158015610c6c575080155b15610ca3576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cd757845468ff00000000000000001916680100000000000000001785555b610ce086611786565b8315610d2b57845468ff000000000000000019168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b5f610d3c6117ac565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b60608167ffffffffffffffff811115610d7c57610d7c611b14565b604051908082528060200260200182016040528015610dc057816020015b604080518082019091525f8082526020820152815260200190600190039081610d9a5790505b50604051630835177160e31b81526001600160c01b0386166004820152600285900b60248201529091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906341a8bb8890604401602060405180830381865afa158015610e39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e5d9190611f07565b67ffffffffffffffff165f03610f095760405163285e76b760e21b81526001600160c01b0385166004820152600284900b60248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa158015610ee2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f069190611ed8565b92505b5f5b8281101561109c5762800000600285900b011561109c57604080518082018252600286900b8082529151630835177160e31b81526001600160c01b038816600482015260248101929092529060208201906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610fab573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fcf9190611f07565b67ffffffffffffffff16815250828281518110610fee57610fee611f20565b602090810291909101015260405163285e76b760e21b81526001600160c01b0386166004820152600285900b60248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a179dadc90604401602060405180830381865afa15801561106e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110929190611ed8565b9350600101610f0b565b81529392505050565b6110ad6117f5565b6110b65f611786565b565b60015433906001600160a01b031681146110f55760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6110fe81611786565b50565b6111096117f5565b600180546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff1990911681179091556111465f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b5f61118882611821565b815f600282900b811361119b57816111a4565b6111a482611f48565b62ffffff81169150600116156111c8576bfff97272373d413259a4699092506111d9565b6c0100000000000000000000000092505b60028116156111f85760606bfff2e50f5f656932ef12357c8402901c92505b60048116156112175760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156112365760606bffcb9843d60f6159c9db58838402901c92505b60108116156112555760606bff973b41fa98c081472e68968402901c92505b60208116156112745760606bff2ea16466c96a3843ec78b38402901c92505b60408116156112935760606bfe5dee046a99a2a811c461f18402901c92505b60808116156112b25760606bfcbe86c7900a88aedcffc83b8402901c92505b6101008116156112d25760606bf987a7253ac413176f2b074c8402901c92505b6102008116156112f25760606bf3392b0822b70005940c7a398402901c92505b6104008116156113125760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156113325760606bd097f3bdfd2022b8845ad8f78402901c92505b6110008116156113525760606ba9f746462d870fdf8a65dc1f8402901c92505b6120008116156113725760606b70d869a156d2a1b890bb3df68402901c92505b6140008116156113925760606b31be135f97d08fd9812315058402901c92505b6180008116156113b25760606b09aa508b5b7a84e1c677de548402901c92505b620100008116156113d25760606a5d6af8dedb81196699c3298402901c92505b620200008116156113f1576060692216e584f5fa1ea926048402901c92505b6204000081161561140e57606067048a170391f7dc428402901c92505b5f8260020b131561143f5761143c837801000000000000000000000000000000000000000000000000611f68565b92505b5050919050565b5f6207a11f19627fffff85160181831561146057815f0391505b81620f4240019050611480620f42408661147a9190611f87565b82900490565b9695505050505050565b5f6114cc61149a8560020b61117e565b6114a49085611f87565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b90505b9392505050565b5f6114cc606084901b6114eb8660020b61117e565b8082061515851691040190565b5f6207a11f19627fffff851601600281900b8212828161151a57825f0361151c565b825b62ffffff1690505f6115556115318389611f87565b620f424088611547578581830615151691040190565b808206151586151691040190565b90508261156a5761156581611f9e565b61156c565b805b98975050505050505050565b5f7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8211156115d6576040517f24775e06000000000000000000000000000000000000000000000000000000008152600481018390526024016110ec565b5090565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061167357507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166116677f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614155b156110b65760405163703e46dd60e11b815260040160405180910390fd5b6110fe6117f5565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156116f3575060408051601f3d908101601f191682019092526116f091810190611fd4565b60015b61171b57604051634c9c8ce360e01b81526001600160a01b03831660048201526024016110ec565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114611777576040517faa1d49a4000000000000000000000000000000000000000000000000000000008152600481018290526024016110ec565b611781838361187d565b505050565b6001805473ffffffffffffffffffffffffffffffffffffffff191690556110fe816118d2565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146110b65760405163703e46dd60e11b815260040160405180910390fd5b5f546001600160a01b031633146110b65760405163118cdaa760e01b81523360048201526024016110ec565b6207ffff600282900b1380611846575061183d6207ffff611f48565b60020b8160020b125b156110fe576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118868261192e565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156118ca5761178182826119b1565b610bf4611a25565b5f80546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b5f0361196357604051634c9c8ce360e01b81526001600160a01b03821660048201526024016110ec565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60605f80846001600160a01b0316846040516119cd9190611feb565b5f60405180830381855af49150503d805f8114611a05576040519150601f19603f3d011682016040523d82523d5f602084013e611a0a565b606091505b5091509150611a1a858383611a5d565b925050505b92915050565b34156110b6576040517fb398979f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606082611a7257611a6d82611ad2565b6114cf565b8151158015611a8957506001600160a01b0384163b155b15611acb576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016110ec565b50806114cf565b805115611ae25780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b634e487b7160e01b5f52604160045260245ffd5b80356001600160c01b0381168114611b3e575f80fd5b919050565b5f82601f830112611b52575f80fd5b813567ffffffffffffffff80821115611b6d57611b6d611b14565b604051601f8301601f19908116603f01168101908282118183101715611b9557611b95611b14565b81604052838152866020858801011115611bad575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f60a08284031215611bdc575f80fd5b60405160a0810167ffffffffffffffff8282108183111715611c0057611c00611b14565b81604052829350611c1085611b28565b83526020850135602084015260408501356040840152606085013560608401526080850135915080821115611c43575f80fd5b50611c5085828601611b43565b6080830152505092915050565b5f60208284031215611c6d575f80fd5b813567ffffffffffffffff811115611c83575f80fd5b611c8f84828501611bcc565b949350505050565b6001600160a01b03811681146110fe575f80fd5b5f8060408385031215611cbc575f80fd5b8235611cc781611c97565b9150602083013567ffffffffffffffff811115611ce2575f80fd5b611cee85828601611b43565b9150509250929050565b5f60208284031215611d08575f80fd5b81356114cf81611c97565b8060020b81146110fe575f80fd5b5f805f60608486031215611d33575f80fd5b611d3c84611b28565b92506020840135611d4c81611d13565b929592945050506040919091013590565b602080825282518282018190525f919060409081850190868401855b82811015611dab578151805160020b855286015167ffffffffffffffff16868501529284019290850190600101611d79565b5091979650505050505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b805167ffffffffffffffff81168114611b3e575f80fd5b805162ffffff81168114611b3e575f80fd5b5f60c08284031215611e26575f80fd5b60405160c0810181811067ffffffffffffffff82111715611e4957611e49611b14565b6040528251611e5781611c97565b8152611e6560208401611ded565b60208201526040830151611e7881611c97565b6040820152611e8960608401611e04565b60608201526080830151611e9c81611c97565b6080820152611ead60a08401611e04565b60a08201529392505050565b5f60208284031215611ec9575f80fd5b815180151581146114cf575f80fd5b5f60208284031215611ee8575f80fd5b81516114cf81611d13565b634e487b7160e01b5f52601260045260245ffd5b5f60208284031215611f17575f80fd5b6114cf82611ded565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f8160020b627fffff198103611f6057611f60611f34565b5f0392915050565b5f82611f8257634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417611a1f57611a1f611f34565b5f7f80000000000000000000000000000000000000000000000000000000000000008203611fce57611fce611f34565b505f0390565b5f60208284031215611fe4575f80fd5b5051919050565b5f82518060208501845e5f92019182525091905056fea26469706673582212201384fec9d689ff8567ac4701a5d2f058cf3c4336dfc0d5f03515fa030466ea4064736f6c63430008190033", + "devdoc": { + "errors": { + "AddressEmptyCode(address)": [ + { + "details": "There's no code at `target` (it is not a contract)." + } + ], + "ERC1967InvalidImplementation(address)": [ + { + "details": "The `implementation` of the proxy is invalid." + } + ], + "ERC1967NonPayable()": [ + { + "details": "An upgrade function sees `msg.value > 0` that may be lost." + } + ], + "FailedCall()": [ + { + "details": "A call to an address target failed. The target may have reverted." + } + ], + "InvalidInitialization()": [ + { + "details": "The contract is already initialized." + } + ], + "NotInitializing()": [ + { + "details": "The contract is not initializing." + } + ], + "OwnableInvalidOwner(address)": [ + { + "details": "The owner is not a valid owner account. (eg. `address(0)`)" + } + ], + "OwnableUnauthorizedAccount(address)": [ + { + "details": "The caller account is not authorized to perform an operation." + } + ], + "SafeCastOverflowedUintToInt(uint256)": [ + { + "details": "An uint value doesn't fit in an int of `bits` size." + } + ], + "UUPSUnauthorizedCallContext()": [ + { + "details": "The call is from an unauthorized context." + } + ], + "UUPSUnsupportedProxiableUUID(bytes32)": [ + { + "details": "The storage `slot` is unsupported as a UUID." + } + ] + }, + "events": { + "Initialized(uint64)": { + "details": "Triggered when the contract has been initialized or reinitialized." + }, + "Upgraded(address)": { + "details": "Emitted when the implementation is upgraded." + } + }, + "kind": "dev", + "methods": { + "acceptOwnership()": { + "details": "The new owner accepts the ownership transfer." + }, + "getExpectedInput((uint192,uint256,uint256,uint256,bytes))": { + "params": { + "params": "The parameters of the take order" + }, + "returns": { + "spentBaseAmount": "The expected spend base amount", + "takenQuoteAmount": "The expected taken quote amount" + } + }, + "getExpectedOutput((uint192,uint256,uint256,uint256,bytes))": { + "params": { + "params": "The parameters of the spend order" + }, + "returns": { + "spentBaseAmount": "The expected spend base amount", + "takenQuoteAmount": "The expected taken quote amount" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "pendingOwner()": { + "details": "Returns the address of the pending owner." + }, + "proxiableUUID()": { + "details": "Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the implementation. It is used to validate the implementation's compatibility when performing an upgrade. IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier." + }, + "renounceOwnership()": { + "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." + }, + "transferOwnership(address)": { + "details": "Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner." + }, + "upgradeToAndCall(address,bytes)": { + "custom:oz-upgrades-unsafe-allow-reachable": "delegatecall", + "details": "Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call encoded in `data`. Calls {_authorizeUpgrade}. Emits an {Upgraded} event." + } + }, + "stateVariables": { + "bookManager": { + "return": "The instance of the book manager", + "returns": { + "_0": "The instance of the book manager" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "bookManager()": { + "notice": "Returns the book manager" + }, + "getExpectedInput((uint192,uint256,uint256,uint256,bytes))": { + "notice": "Returns the expected input for a take order" + }, + "getExpectedOutput((uint192,uint256,uint256,uint256,bytes))": { + "notice": "Returns the expected output for a spend order" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 8, + "contract": "src/BookViewer.sol:BookViewer", + "label": "_owner", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 156, + "contract": "src/BookViewer.sol:BookViewer", + "label": "_pendingOwner", + "offset": 0, + "slot": "1", + "type": "t_address" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + } + } + } +} \ No newline at end of file diff --git a/deployments/80084/Controller.json b/deployments/80084/Controller.json new file mode 100644 index 0000000..3289b03 --- /dev/null +++ b/deployments/80084/Controller.json @@ -0,0 +1,1244 @@ +{ + "address": "0x7588AFc469d95300C2206Bf8a6Ee9bf5d2719314", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "bookManager_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [], + "name": "ControllerSlippage", + "type": "error" + }, + { + "inputs": [], + "name": "Deadline", + "type": "error" + }, + { + "inputs": [], + "name": "ERC20TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "FailedCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "needed", + "type": "uint256" + } + ], + "name": "InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAccess", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAction", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidLength", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidPrice", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTick", + "type": "error" + }, + { + "inputs": [], + "name": "NativeTransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "bits", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "SafeCastOverflowedUintDowncast", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [], + "name": "bookManager", + "outputs": [ + { + "internalType": "contract IBookManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "OrderId", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "leftQuoteAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.CancelOrderParams[]", + "name": "orderParamsList", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "tokensToSettle", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC721PermitParams[]", + "name": "permitParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "cancel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "OrderId", + "name": "id", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.ClaimOrderParams[]", + "name": "orderParamsList", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "tokensToSettle", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC721PermitParams[]", + "name": "permitParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IController.Action[]", + "name": "actionList", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "paramsDataList", + "type": "bytes[]" + }, + { + "internalType": "address[]", + "name": "tokensToSettle", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "permitAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC20PermitParams[]", + "name": "erc20PermitParamsList", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC721PermitParams[]", + "name": "erc721PermitParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "execute", + "outputs": [ + { + "internalType": "OrderId[]", + "name": "ids", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + } + ], + "name": "fromPrice", + "outputs": [ + { + "internalType": "Tick", + "name": "", + "type": "int24" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + }, + { + "internalType": "Tick", + "name": "tick", + "type": "int24" + } + ], + "name": "getDepth", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + } + ], + "name": "getHighestPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "OrderId", + "name": "orderId", + "type": "uint256" + } + ], + "name": "getOrder", + "outputs": [ + { + "internalType": "address", + "name": "provider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "openAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "claimableAmount", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "BookId", + "name": "takeBookId", + "type": "uint192" + }, + { + "internalType": "BookId", + "name": "makeBookId", + "type": "uint192" + }, + { + "internalType": "uint256", + "name": "limitPrice", + "type": "uint256" + }, + { + "internalType": "Tick", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint256", + "name": "quoteAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "takeHookData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "makeHookData", + "type": "bytes" + } + ], + "internalType": "struct IController.LimitOrderParams[]", + "name": "orderParamsList", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "tokensToSettle", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "permitAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC20PermitParams[]", + "name": "permitParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "limit", + "outputs": [ + { + "internalType": "OrderId[]", + "name": "ids", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "lockAcquired", + "outputs": [ + { + "internalType": "bytes", + "name": "returnData", + "type": "bytes" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + }, + { + "internalType": "Tick", + "name": "tick", + "type": "int24" + }, + { + "internalType": "uint256", + "name": "quoteAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.MakeOrderParams[]", + "name": "orderParamsList", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "tokensToSettle", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "permitAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC20PermitParams[]", + "name": "permitParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "make", + "outputs": [ + { + "internalType": "OrderId[]", + "name": "ids", + "type": "uint256[]" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "Currency", + "name": "base", + "type": "address" + }, + { + "internalType": "uint64", + "name": "unitSize", + "type": "uint64" + }, + { + "internalType": "Currency", + "name": "quote", + "type": "address" + }, + { + "internalType": "FeePolicy", + "name": "makerPolicy", + "type": "uint24" + }, + { + "internalType": "contract IHooks", + "name": "hooks", + "type": "address" + }, + { + "internalType": "FeePolicy", + "name": "takerPolicy", + "type": "uint24" + } + ], + "internalType": "struct IBookManager.BookKey", + "name": "key", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.OpenBookParams[]", + "name": "openBookParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "open", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + }, + { + "internalType": "uint256", + "name": "limitPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minQuoteAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.SpendOrderParams[]", + "name": "orderParamsList", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "tokensToSettle", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "permitAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC20PermitParams[]", + "name": "permitParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "spend", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "BookId", + "name": "id", + "type": "uint192" + }, + { + "internalType": "uint256", + "name": "limitPrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "quoteAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxBaseAmount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "hookData", + "type": "bytes" + } + ], + "internalType": "struct IController.TakeOrderParams[]", + "name": "orderParamsList", + "type": "tuple[]" + }, + { + "internalType": "address[]", + "name": "tokensToSettle", + "type": "address[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "permitAmount", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct IController.PermitSignature", + "name": "signature", + "type": "tuple" + } + ], + "internalType": "struct IController.ERC20PermitParams[]", + "name": "permitParamsList", + "type": "tuple[]" + }, + { + "internalType": "uint64", + "name": "deadline", + "type": "uint64" + } + ], + "name": "take", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "Tick", + "name": "tick", + "type": "int24" + } + ], + "name": "toPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x670a1ffee66a28a514f97d5d857d9cc2ee44a1c513a1565858c1cf69a581b922", + "receipt": { + "to": null, + "from": "0x5F79EE8f8fA862E98201120d83c4eC39D9468D49", + "contractAddress": "0x7588AFc469d95300C2206Bf8a6Ee9bf5d2719314", + "transactionIndex": 62, + "gasUsed": "4833227", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x19ec46a0c00d68293944c4e7fdf526e1051c580c13d479db7f4e9cc65f970037", + "transactionHash": "0x670a1ffee66a28a514f97d5d857d9cc2ee44a1c513a1565858c1cf69a581b922", + "logs": [], + "blockNumber": 3554123, + "cumulativeGasUsed": "9314014", + "status": 1, + "byzantium": true + }, + "args": [ + "0x874b1B795993653fbFC3f1c1fc0469214cC9F4A5" + ], + "numDeployments": 1, + "solcInputHash": "8ab01b92ea083f19aa223a9d45d915fe", + "metadata": "{\"compiler\":{\"version\":\"0.8.25+commit.b61c2a91\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"bookManager_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ControllerSlippage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Deadline\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ERC20TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAccess\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidAction\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPrice\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTick\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NativeTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"bits\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"SafeCastOverflowedUintDowncast\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"bookManager\",\"outputs\":[{\"internalType\":\"contract IBookManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"OrderId\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"leftQuoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.CancelOrderParams[]\",\"name\":\"orderParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensToSettle\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC721PermitParams[]\",\"name\":\"permitParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"cancel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"OrderId\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.ClaimOrderParams[]\",\"name\":\"orderParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensToSettle\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC721PermitParams[]\",\"name\":\"permitParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum IController.Action[]\",\"name\":\"actionList\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"paramsDataList\",\"type\":\"bytes[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensToSettle\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"permitAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC20PermitParams[]\",\"name\":\"erc20PermitParamsList\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC721PermitParams[]\",\"name\":\"erc721PermitParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"execute\",\"outputs\":[{\"internalType\":\"OrderId[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"fromPrice\",\"outputs\":[{\"internalType\":\"Tick\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"},{\"internalType\":\"Tick\",\"name\":\"tick\",\"type\":\"int24\"}],\"name\":\"getDepth\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"}],\"name\":\"getHighestPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"OrderId\",\"name\":\"orderId\",\"type\":\"uint256\"}],\"name\":\"getOrder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"provider\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"openAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"claimableAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"BookId\",\"name\":\"takeBookId\",\"type\":\"uint192\"},{\"internalType\":\"BookId\",\"name\":\"makeBookId\",\"type\":\"uint192\"},{\"internalType\":\"uint256\",\"name\":\"limitPrice\",\"type\":\"uint256\"},{\"internalType\":\"Tick\",\"name\":\"tick\",\"type\":\"int24\"},{\"internalType\":\"uint256\",\"name\":\"quoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"takeHookData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"makeHookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.LimitOrderParams[]\",\"name\":\"orderParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensToSettle\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"permitAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC20PermitParams[]\",\"name\":\"permitParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"limit\",\"outputs\":[{\"internalType\":\"OrderId[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"lockAcquired\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"returnData\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"},{\"internalType\":\"Tick\",\"name\":\"tick\",\"type\":\"int24\"},{\"internalType\":\"uint256\",\"name\":\"quoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.MakeOrderParams[]\",\"name\":\"orderParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensToSettle\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"permitAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC20PermitParams[]\",\"name\":\"permitParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"make\",\"outputs\":[{\"internalType\":\"OrderId[]\",\"name\":\"ids\",\"type\":\"uint256[]\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"Currency\",\"name\":\"base\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"unitSize\",\"type\":\"uint64\"},{\"internalType\":\"Currency\",\"name\":\"quote\",\"type\":\"address\"},{\"internalType\":\"FeePolicy\",\"name\":\"makerPolicy\",\"type\":\"uint24\"},{\"internalType\":\"contract IHooks\",\"name\":\"hooks\",\"type\":\"address\"},{\"internalType\":\"FeePolicy\",\"name\":\"takerPolicy\",\"type\":\"uint24\"}],\"internalType\":\"struct IBookManager.BookKey\",\"name\":\"key\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.OpenBookParams[]\",\"name\":\"openBookParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"open\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"},{\"internalType\":\"uint256\",\"name\":\"limitPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minQuoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.SpendOrderParams[]\",\"name\":\"orderParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensToSettle\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"permitAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC20PermitParams[]\",\"name\":\"permitParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"spend\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"BookId\",\"name\":\"id\",\"type\":\"uint192\"},{\"internalType\":\"uint256\",\"name\":\"limitPrice\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quoteAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBaseAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"hookData\",\"type\":\"bytes\"}],\"internalType\":\"struct IController.TakeOrderParams[]\",\"name\":\"orderParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensToSettle\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"permitAmount\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct IController.PermitSignature\",\"name\":\"signature\",\"type\":\"tuple\"}],\"internalType\":\"struct IController.ERC20PermitParams[]\",\"name\":\"permitParamsList\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"deadline\",\"type\":\"uint64\"}],\"name\":\"take\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"Tick\",\"name\":\"tick\",\"type\":\"int24\"}],\"name\":\"toPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"AddressEmptyCode(address)\":[{\"details\":\"There's no code at `target` (it is not a contract).\"}],\"FailedCall()\":[{\"details\":\"A call to an address target failed. The target may have reverted.\"}],\"InsufficientBalance(uint256,uint256)\":[{\"details\":\"The ETH balance of the account is not enough to perform the operation.\"}],\"SafeCastOverflowedUintDowncast(uint8,uint256)\":[{\"details\":\"Value doesn't fit in an uint of `bits` size.\"}],\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"kind\":\"dev\",\"methods\":{\"cancel((uint256,uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"details\":\"IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\",\"params\":{\"deadline\":\"The deadline for the actions\",\"orderParamsList\":\"The list of actions to cancel\",\"permitParamsList\":\"The parameters of the permits\",\"tokensToSettle\":\"The tokens to settle\"}},\"claim((uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"details\":\"IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\",\"params\":{\"deadline\":\"The deadline for the actions\",\"orderParamsList\":\"The list of actions to claim\",\"permitParamsList\":\"The parameters of the permits\",\"tokensToSettle\":\"The tokens to settle\"}},\"execute(uint8[],bytes[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"details\":\"IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\",\"params\":{\"actionList\":\"The list of actions to execute\",\"deadline\":\"The deadline for the actions\",\"erc20PermitParamsList\":\"The parameters of the ERC20 permits\",\"erc721PermitParamsList\":\"The parameters of the ERC721 permits\",\"paramsDataList\":\"The parameters of the actions\",\"tokensToSettle\":\"The tokens to settle\"},\"returns\":{\"ids\":\"The ids of the orders\"}},\"fromPrice(uint256)\":{\"params\":{\"price\":\"The price to convert\"},\"returns\":{\"_0\":\"The tick\"}},\"getDepth(uint192,int24)\":{\"params\":{\"id\":\"The id of the book\",\"tick\":\"The tick of the book\"},\"returns\":{\"_0\":\"The depth of the book in quote amount\"}},\"getHighestPrice(uint192)\":{\"params\":{\"id\":\"The id of the book\"},\"returns\":{\"_0\":\"The highest price of the book with 2**96 precision\"}},\"getOrder(uint256)\":{\"params\":{\"orderId\":\"The id of the order\"},\"returns\":{\"claimableAmount\":\"The claimable base amount of the order\",\"openAmount\":\"The open quote amount of the order\",\"price\":\"The price of the order with 2**96 precision\",\"provider\":\"The provider of the order\"}},\"make((uint192,int24,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"details\":\"IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\",\"params\":{\"deadline\":\"The deadline for the actions\",\"orderParamsList\":\"The list of actions to make\",\"permitParamsList\":\"The parameters of the permits\",\"tokensToSettle\":\"The tokens to settle\"},\"returns\":{\"ids\":\"The ids of the orders\"}},\"open(((address,uint64,address,uint24,address,uint24),bytes)[],uint64)\":{\"params\":{\"deadline\":\"The deadline for the action\",\"openBookParamsList\":\"The parameters of the open book action\"}},\"spend((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"details\":\"IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\",\"params\":{\"deadline\":\"The deadline for the actions\",\"orderParamsList\":\"The list of actions to spend\",\"permitParamsList\":\"The parameters of the permits\",\"tokensToSettle\":\"The tokens to settle\"}},\"take((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"details\":\"IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\",\"params\":{\"deadline\":\"The deadline for the actions\",\"orderParamsList\":\"The list of actions to take\",\"permitParamsList\":\"The parameters of the permits\",\"tokensToSettle\":\"The tokens to settle\"}},\"toPrice(int24)\":{\"params\":{\"tick\":\"The tick to convert\"},\"returns\":{\"_0\":\"The price with 2**96 precision\"}}},\"stateVariables\":{\"bookManager\":{\"return\":\"The instance of the book manager\",\"returns\":{\"_0\":\"The instance of the book manager\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"ERC20TransferFailed()\":[{\"notice\":\"Thrown when an ERC20 transfer fails\"}],\"NativeTransferFailed()\":[{\"notice\":\"Thrown when a native transfer fails\"}]},\"kind\":\"user\",\"methods\":{\"bookManager()\":{\"notice\":\"Returns the book manager\"},\"cancel((uint256,uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"notice\":\"Cancels a list of orders\"},\"claim((uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"notice\":\"Claims a list of orders\"},\"execute(uint8[],bytes[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"notice\":\"Executes a list of actions\"},\"fromPrice(uint256)\":{\"notice\":\"Converts a price to a tick\"},\"getDepth(uint192,int24)\":{\"notice\":\"Returns the depth of a book\"},\"getHighestPrice(uint192)\":{\"notice\":\"Returns the highest price of a book\"},\"getOrder(uint256)\":{\"notice\":\"Returns the details of an order\"},\"make((uint192,int24,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"notice\":\"Makes a list of orders\"},\"open(((address,uint64,address,uint24,address,uint24),bytes)[],uint64)\":{\"notice\":\"Opens a book\"},\"spend((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"notice\":\"Spends to take a list of orders\"},\"take((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)\":{\"notice\":\"Takes a list of orders\"},\"toPrice(int24)\":{\"notice\":\"Converts a tick to a price\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/Controller.sol\":\"Controller\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1363.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"./IERC20.sol\\\";\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @title IERC1363\\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\\n *\\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\\n */\\ninterface IERC1363 is IERC20, IERC165 {\\n /*\\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\\n * 0xb0202a11 ===\\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\\n */\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @param data Additional data with no specified format, sent in call to `spender`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9f21f1bcc51daf7fe3998608d7eeb96b16a9c3816898a0cf6a9407bd105c9253\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xde7e9fd9aee8d4f40772f96bb3b58836cbc6dfc0227014a061947f8821ea9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0xce41876e78d1badc0512229b4d14e4daf83bc1003d7f83978d18e0e56f965b9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\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 value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\\n * 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 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` 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(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xee2337af2dc162a973b4be6d3f7c16f06298259e0af48c5470d2839bfa8a22f4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC-20 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 *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n * doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n * token.safeTransferFrom(msg.sender, address(this), value);\\n * ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\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 * CAUTION: See Security Considerations above.\\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\":\"0xe9d36d0c892aea68546d53f21e02223f7f542295c10110a0764336f9ffeab6d1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../IERC20.sol\\\";\\nimport {IERC1363} from \\\"../../../interfaces/IERC1363.sol\\\";\\nimport {Address} from \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n /**\\n * @dev An operation with an ERC-20 token failed.\\n */\\n error SafeERC20FailedOperation(address token);\\n\\n /**\\n * @dev Indicates a failed `decreaseAllowance` request.\\n */\\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\\n\\n /**\\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\\n }\\n\\n /**\\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n */\\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\\n }\\n\\n /**\\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful.\\n */\\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n forceApprove(token, spender, oldAllowance + value);\\n }\\n\\n /**\\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\\n * value, non-reverting calls are assumed to be successful.\\n */\\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\\n unchecked {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n if (currentAllowance < requestedDecrease) {\\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\\n }\\n forceApprove(token, spender, currentAllowance - requestedDecrease);\\n }\\n }\\n\\n /**\\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n * to be set to zero before setting it to a non-zero value, such as USDT.\\n */\\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\\n\\n if (!_callOptionalReturnBool(token, approvalCall)) {\\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\\n _callOptionalReturn(token, approvalCall);\\n }\\n }\\n\\n /**\\n * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\\n * targeting contracts.\\n *\\n * Reverts if the returned value is other than `true`.\\n */\\n function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\\n if (to.code.length == 0) {\\n safeTransfer(token, to, value);\\n } else if (!token.transferAndCall(to, value, data)) {\\n revert SafeERC20FailedOperation(address(token));\\n }\\n }\\n\\n /**\\n * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\\n * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\\n * targeting contracts.\\n *\\n * Reverts if the returned value is other than `true`.\\n */\\n function transferFromAndCallRelaxed(\\n IERC1363 token,\\n address from,\\n address to,\\n uint256 value,\\n bytes memory data\\n ) internal {\\n if (to.code.length == 0) {\\n safeTransferFrom(token, from, to, value);\\n } else if (!token.transferFromAndCall(from, to, value, data)) {\\n revert SafeERC20FailedOperation(address(token));\\n }\\n }\\n\\n /**\\n * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\\n * targeting contracts.\\n *\\n * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\\n * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\\n * once without retrying, and relies on the returned value to be true.\\n *\\n * Reverts if the returned value is other than `true`.\\n */\\n function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\\n if (to.code.length == 0) {\\n forceApprove(token, to, value);\\n } else if (!token.approveAndCall(to, value, data)) {\\n revert SafeERC20FailedOperation(address(token));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data);\\n if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\\n revert SafeERC20FailedOperation(address(token));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n *\\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n */\\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n // and not revert is the subcall reverts.\\n\\n (bool success, bytes memory returndata) = address(token).call(data);\\n return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\\n }\\n}\\n\",\"keccak256\":\"0xde02e3a80c5c3b3a2187fbfbdfc7ed7c8c0d5b2e4a0ff5671611674b6c96bd91\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC-721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\\n * {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\\n * a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the address zero.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xe0e3a2099f2e2ce3579dd35548f613928739642058dfec95b1745f93364ce3de\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC721} from \\\"../IERC721.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721Metadata is IERC721 {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x37d1aaaa5a2908a09e9dcf56a26ddf762ecf295afb5964695937344fc6802ce1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Errors} from \\\"./Errors.sol\\\";\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev There's no code at `target` (it is not a contract).\\n */\\n error AddressEmptyCode(address target);\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n if (address(this).balance < amount) {\\n revert Errors.InsufficientBalance(address(this).balance, amount);\\n }\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n if (!success) {\\n revert Errors.FailedCall();\\n }\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason or custom error, it is bubbled\\n * up by this function (like regular Solidity function calls). However, if\\n * the call reverted with no returned reason, this function reverts with a\\n * {Errors.FailedCall} error.\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n if (address(this).balance < value) {\\n revert Errors.InsufficientBalance(address(this).balance, value);\\n }\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\\n * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case\\n * of an unsuccessful call.\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata\\n ) internal view returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n // only check if target is a contract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n if (returndata.length == 0 && target.code.length == 0) {\\n revert AddressEmptyCode(target);\\n }\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\\n * revert reason or with a default {Errors.FailedCall} error.\\n */\\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\\n if (!success) {\\n _revert(returndata);\\n } else {\\n return returndata;\\n }\\n }\\n\\n /**\\n * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.\\n */\\n function _revert(bytes memory returndata) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert Errors.FailedCall();\\n }\\n }\\n}\\n\",\"keccak256\":\"0x80b4189de089dc632b752b365a16c5063b58cc24da0dd38b82f2c25f56d25c84\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Collection of common custom errors used in multiple contracts\\n *\\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\\n * It is recommended to avoid relying on the error API for critical functionality.\\n */\\nlibrary Errors {\\n /**\\n * @dev The ETH balance of the account is not enough to perform the operation.\\n */\\n error InsufficientBalance(uint256 balance, uint256 needed);\\n\\n /**\\n * @dev A call to an address target failed. The target may have reverted.\\n */\\n error FailedCall();\\n\\n /**\\n * @dev The deployment failed.\\n */\\n error FailedDeployment();\\n}\\n\",\"keccak256\":\"0x1b0625096e82d06abdcf1844172ef78ef54a5e878761f4d905fda07eaf098424\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc859863e3bda7ec3cddf6dafe2ffe91bcbe648d1395b856b839c32ee9617c44c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)\\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\\n * checks.\\n *\\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\\n * easily result in undesired exploitation or bugs, since developers usually\\n * assume that overflows raise errors. `SafeCast` restores this intuition by\\n * reverting the transaction when such an operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeCast {\\n /**\\n * @dev Value doesn't fit in an uint of `bits` size.\\n */\\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\\n\\n /**\\n * @dev An int value doesn't fit in an uint of `bits` size.\\n */\\n error SafeCastOverflowedIntToUint(int256 value);\\n\\n /**\\n * @dev Value doesn't fit in an int of `bits` size.\\n */\\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\\n\\n /**\\n * @dev An uint value doesn't fit in an int of `bits` size.\\n */\\n error SafeCastOverflowedUintToInt(uint256 value);\\n\\n /**\\n * @dev Returns the downcasted uint248 from uint256, reverting on\\n * overflow (when the input is greater than largest uint248).\\n *\\n * Counterpart to Solidity's `uint248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n */\\n function toUint248(uint256 value) internal pure returns (uint248) {\\n if (value > type(uint248).max) {\\n revert SafeCastOverflowedUintDowncast(248, value);\\n }\\n return uint248(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint240 from uint256, reverting on\\n * overflow (when the input is greater than largest uint240).\\n *\\n * Counterpart to Solidity's `uint240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n */\\n function toUint240(uint256 value) internal pure returns (uint240) {\\n if (value > type(uint240).max) {\\n revert SafeCastOverflowedUintDowncast(240, value);\\n }\\n return uint240(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint232 from uint256, reverting on\\n * overflow (when the input is greater than largest uint232).\\n *\\n * Counterpart to Solidity's `uint232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n */\\n function toUint232(uint256 value) internal pure returns (uint232) {\\n if (value > type(uint232).max) {\\n revert SafeCastOverflowedUintDowncast(232, value);\\n }\\n return uint232(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint224 from uint256, reverting on\\n * overflow (when the input is greater than largest uint224).\\n *\\n * Counterpart to Solidity's `uint224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n */\\n function toUint224(uint256 value) internal pure returns (uint224) {\\n if (value > type(uint224).max) {\\n revert SafeCastOverflowedUintDowncast(224, value);\\n }\\n return uint224(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint216 from uint256, reverting on\\n * overflow (when the input is greater than largest uint216).\\n *\\n * Counterpart to Solidity's `uint216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n */\\n function toUint216(uint256 value) internal pure returns (uint216) {\\n if (value > type(uint216).max) {\\n revert SafeCastOverflowedUintDowncast(216, value);\\n }\\n return uint216(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint208 from uint256, reverting on\\n * overflow (when the input is greater than largest uint208).\\n *\\n * Counterpart to Solidity's `uint208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n */\\n function toUint208(uint256 value) internal pure returns (uint208) {\\n if (value > type(uint208).max) {\\n revert SafeCastOverflowedUintDowncast(208, value);\\n }\\n return uint208(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint200 from uint256, reverting on\\n * overflow (when the input is greater than largest uint200).\\n *\\n * Counterpart to Solidity's `uint200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n */\\n function toUint200(uint256 value) internal pure returns (uint200) {\\n if (value > type(uint200).max) {\\n revert SafeCastOverflowedUintDowncast(200, value);\\n }\\n return uint200(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint192 from uint256, reverting on\\n * overflow (when the input is greater than largest uint192).\\n *\\n * Counterpart to Solidity's `uint192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n */\\n function toUint192(uint256 value) internal pure returns (uint192) {\\n if (value > type(uint192).max) {\\n revert SafeCastOverflowedUintDowncast(192, value);\\n }\\n return uint192(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint184 from uint256, reverting on\\n * overflow (when the input is greater than largest uint184).\\n *\\n * Counterpart to Solidity's `uint184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n */\\n function toUint184(uint256 value) internal pure returns (uint184) {\\n if (value > type(uint184).max) {\\n revert SafeCastOverflowedUintDowncast(184, value);\\n }\\n return uint184(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint176 from uint256, reverting on\\n * overflow (when the input is greater than largest uint176).\\n *\\n * Counterpart to Solidity's `uint176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n */\\n function toUint176(uint256 value) internal pure returns (uint176) {\\n if (value > type(uint176).max) {\\n revert SafeCastOverflowedUintDowncast(176, value);\\n }\\n return uint176(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint168 from uint256, reverting on\\n * overflow (when the input is greater than largest uint168).\\n *\\n * Counterpart to Solidity's `uint168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n */\\n function toUint168(uint256 value) internal pure returns (uint168) {\\n if (value > type(uint168).max) {\\n revert SafeCastOverflowedUintDowncast(168, value);\\n }\\n return uint168(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint160 from uint256, reverting on\\n * overflow (when the input is greater than largest uint160).\\n *\\n * Counterpart to Solidity's `uint160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n */\\n function toUint160(uint256 value) internal pure returns (uint160) {\\n if (value > type(uint160).max) {\\n revert SafeCastOverflowedUintDowncast(160, value);\\n }\\n return uint160(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint152 from uint256, reverting on\\n * overflow (when the input is greater than largest uint152).\\n *\\n * Counterpart to Solidity's `uint152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n */\\n function toUint152(uint256 value) internal pure returns (uint152) {\\n if (value > type(uint152).max) {\\n revert SafeCastOverflowedUintDowncast(152, value);\\n }\\n return uint152(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint144 from uint256, reverting on\\n * overflow (when the input is greater than largest uint144).\\n *\\n * Counterpart to Solidity's `uint144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n */\\n function toUint144(uint256 value) internal pure returns (uint144) {\\n if (value > type(uint144).max) {\\n revert SafeCastOverflowedUintDowncast(144, value);\\n }\\n return uint144(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint136 from uint256, reverting on\\n * overflow (when the input is greater than largest uint136).\\n *\\n * Counterpart to Solidity's `uint136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n */\\n function toUint136(uint256 value) internal pure returns (uint136) {\\n if (value > type(uint136).max) {\\n revert SafeCastOverflowedUintDowncast(136, value);\\n }\\n return uint136(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint128 from uint256, reverting on\\n * overflow (when the input is greater than largest uint128).\\n *\\n * Counterpart to Solidity's `uint128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n */\\n function toUint128(uint256 value) internal pure returns (uint128) {\\n if (value > type(uint128).max) {\\n revert SafeCastOverflowedUintDowncast(128, value);\\n }\\n return uint128(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint120 from uint256, reverting on\\n * overflow (when the input is greater than largest uint120).\\n *\\n * Counterpart to Solidity's `uint120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n */\\n function toUint120(uint256 value) internal pure returns (uint120) {\\n if (value > type(uint120).max) {\\n revert SafeCastOverflowedUintDowncast(120, value);\\n }\\n return uint120(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint112 from uint256, reverting on\\n * overflow (when the input is greater than largest uint112).\\n *\\n * Counterpart to Solidity's `uint112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n */\\n function toUint112(uint256 value) internal pure returns (uint112) {\\n if (value > type(uint112).max) {\\n revert SafeCastOverflowedUintDowncast(112, value);\\n }\\n return uint112(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint104 from uint256, reverting on\\n * overflow (when the input is greater than largest uint104).\\n *\\n * Counterpart to Solidity's `uint104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n */\\n function toUint104(uint256 value) internal pure returns (uint104) {\\n if (value > type(uint104).max) {\\n revert SafeCastOverflowedUintDowncast(104, value);\\n }\\n return uint104(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint96 from uint256, reverting on\\n * overflow (when the input is greater than largest uint96).\\n *\\n * Counterpart to Solidity's `uint96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n */\\n function toUint96(uint256 value) internal pure returns (uint96) {\\n if (value > type(uint96).max) {\\n revert SafeCastOverflowedUintDowncast(96, value);\\n }\\n return uint96(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint88 from uint256, reverting on\\n * overflow (when the input is greater than largest uint88).\\n *\\n * Counterpart to Solidity's `uint88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n */\\n function toUint88(uint256 value) internal pure returns (uint88) {\\n if (value > type(uint88).max) {\\n revert SafeCastOverflowedUintDowncast(88, value);\\n }\\n return uint88(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint80 from uint256, reverting on\\n * overflow (when the input is greater than largest uint80).\\n *\\n * Counterpart to Solidity's `uint80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n */\\n function toUint80(uint256 value) internal pure returns (uint80) {\\n if (value > type(uint80).max) {\\n revert SafeCastOverflowedUintDowncast(80, value);\\n }\\n return uint80(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint72 from uint256, reverting on\\n * overflow (when the input is greater than largest uint72).\\n *\\n * Counterpart to Solidity's `uint72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n */\\n function toUint72(uint256 value) internal pure returns (uint72) {\\n if (value > type(uint72).max) {\\n revert SafeCastOverflowedUintDowncast(72, value);\\n }\\n return uint72(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint64 from uint256, reverting on\\n * overflow (when the input is greater than largest uint64).\\n *\\n * Counterpart to Solidity's `uint64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n */\\n function toUint64(uint256 value) internal pure returns (uint64) {\\n if (value > type(uint64).max) {\\n revert SafeCastOverflowedUintDowncast(64, value);\\n }\\n return uint64(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint56 from uint256, reverting on\\n * overflow (when the input is greater than largest uint56).\\n *\\n * Counterpart to Solidity's `uint56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n */\\n function toUint56(uint256 value) internal pure returns (uint56) {\\n if (value > type(uint56).max) {\\n revert SafeCastOverflowedUintDowncast(56, value);\\n }\\n return uint56(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint48 from uint256, reverting on\\n * overflow (when the input is greater than largest uint48).\\n *\\n * Counterpart to Solidity's `uint48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n */\\n function toUint48(uint256 value) internal pure returns (uint48) {\\n if (value > type(uint48).max) {\\n revert SafeCastOverflowedUintDowncast(48, value);\\n }\\n return uint48(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint40 from uint256, reverting on\\n * overflow (when the input is greater than largest uint40).\\n *\\n * Counterpart to Solidity's `uint40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n */\\n function toUint40(uint256 value) internal pure returns (uint40) {\\n if (value > type(uint40).max) {\\n revert SafeCastOverflowedUintDowncast(40, value);\\n }\\n return uint40(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint32 from uint256, reverting on\\n * overflow (when the input is greater than largest uint32).\\n *\\n * Counterpart to Solidity's `uint32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n */\\n function toUint32(uint256 value) internal pure returns (uint32) {\\n if (value > type(uint32).max) {\\n revert SafeCastOverflowedUintDowncast(32, value);\\n }\\n return uint32(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint24 from uint256, reverting on\\n * overflow (when the input is greater than largest uint24).\\n *\\n * Counterpart to Solidity's `uint24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n */\\n function toUint24(uint256 value) internal pure returns (uint24) {\\n if (value > type(uint24).max) {\\n revert SafeCastOverflowedUintDowncast(24, value);\\n }\\n return uint24(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint16 from uint256, reverting on\\n * overflow (when the input is greater than largest uint16).\\n *\\n * Counterpart to Solidity's `uint16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n */\\n function toUint16(uint256 value) internal pure returns (uint16) {\\n if (value > type(uint16).max) {\\n revert SafeCastOverflowedUintDowncast(16, value);\\n }\\n return uint16(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted uint8 from uint256, reverting on\\n * overflow (when the input is greater than largest uint8).\\n *\\n * Counterpart to Solidity's `uint8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n */\\n function toUint8(uint256 value) internal pure returns (uint8) {\\n if (value > type(uint8).max) {\\n revert SafeCastOverflowedUintDowncast(8, value);\\n }\\n return uint8(value);\\n }\\n\\n /**\\n * @dev Converts a signed int256 into an unsigned uint256.\\n *\\n * Requirements:\\n *\\n * - input must be greater than or equal to 0.\\n */\\n function toUint256(int256 value) internal pure returns (uint256) {\\n if (value < 0) {\\n revert SafeCastOverflowedIntToUint(value);\\n }\\n return uint256(value);\\n }\\n\\n /**\\n * @dev Returns the downcasted int248 from int256, reverting on\\n * overflow (when the input is less than smallest int248 or\\n * greater than largest int248).\\n *\\n * Counterpart to Solidity's `int248` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 248 bits\\n */\\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\\n downcasted = int248(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(248, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int240 from int256, reverting on\\n * overflow (when the input is less than smallest int240 or\\n * greater than largest int240).\\n *\\n * Counterpart to Solidity's `int240` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 240 bits\\n */\\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\\n downcasted = int240(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(240, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int232 from int256, reverting on\\n * overflow (when the input is less than smallest int232 or\\n * greater than largest int232).\\n *\\n * Counterpart to Solidity's `int232` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 232 bits\\n */\\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\\n downcasted = int232(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(232, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int224 from int256, reverting on\\n * overflow (when the input is less than smallest int224 or\\n * greater than largest int224).\\n *\\n * Counterpart to Solidity's `int224` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 224 bits\\n */\\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\\n downcasted = int224(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(224, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int216 from int256, reverting on\\n * overflow (when the input is less than smallest int216 or\\n * greater than largest int216).\\n *\\n * Counterpart to Solidity's `int216` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 216 bits\\n */\\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\\n downcasted = int216(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(216, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int208 from int256, reverting on\\n * overflow (when the input is less than smallest int208 or\\n * greater than largest int208).\\n *\\n * Counterpart to Solidity's `int208` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 208 bits\\n */\\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\\n downcasted = int208(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(208, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int200 from int256, reverting on\\n * overflow (when the input is less than smallest int200 or\\n * greater than largest int200).\\n *\\n * Counterpart to Solidity's `int200` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 200 bits\\n */\\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\\n downcasted = int200(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(200, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int192 from int256, reverting on\\n * overflow (when the input is less than smallest int192 or\\n * greater than largest int192).\\n *\\n * Counterpart to Solidity's `int192` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 192 bits\\n */\\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\\n downcasted = int192(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(192, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int184 from int256, reverting on\\n * overflow (when the input is less than smallest int184 or\\n * greater than largest int184).\\n *\\n * Counterpart to Solidity's `int184` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 184 bits\\n */\\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\\n downcasted = int184(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(184, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int176 from int256, reverting on\\n * overflow (when the input is less than smallest int176 or\\n * greater than largest int176).\\n *\\n * Counterpart to Solidity's `int176` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 176 bits\\n */\\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\\n downcasted = int176(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(176, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int168 from int256, reverting on\\n * overflow (when the input is less than smallest int168 or\\n * greater than largest int168).\\n *\\n * Counterpart to Solidity's `int168` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 168 bits\\n */\\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\\n downcasted = int168(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(168, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int160 from int256, reverting on\\n * overflow (when the input is less than smallest int160 or\\n * greater than largest int160).\\n *\\n * Counterpart to Solidity's `int160` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 160 bits\\n */\\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\\n downcasted = int160(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(160, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int152 from int256, reverting on\\n * overflow (when the input is less than smallest int152 or\\n * greater than largest int152).\\n *\\n * Counterpart to Solidity's `int152` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 152 bits\\n */\\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\\n downcasted = int152(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(152, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int144 from int256, reverting on\\n * overflow (when the input is less than smallest int144 or\\n * greater than largest int144).\\n *\\n * Counterpart to Solidity's `int144` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 144 bits\\n */\\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\\n downcasted = int144(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(144, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int136 from int256, reverting on\\n * overflow (when the input is less than smallest int136 or\\n * greater than largest int136).\\n *\\n * Counterpart to Solidity's `int136` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 136 bits\\n */\\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\\n downcasted = int136(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(136, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int128 from int256, reverting on\\n * overflow (when the input is less than smallest int128 or\\n * greater than largest int128).\\n *\\n * Counterpart to Solidity's `int128` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 128 bits\\n */\\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\\n downcasted = int128(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(128, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int120 from int256, reverting on\\n * overflow (when the input is less than smallest int120 or\\n * greater than largest int120).\\n *\\n * Counterpart to Solidity's `int120` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 120 bits\\n */\\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\\n downcasted = int120(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(120, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int112 from int256, reverting on\\n * overflow (when the input is less than smallest int112 or\\n * greater than largest int112).\\n *\\n * Counterpart to Solidity's `int112` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 112 bits\\n */\\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\\n downcasted = int112(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(112, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int104 from int256, reverting on\\n * overflow (when the input is less than smallest int104 or\\n * greater than largest int104).\\n *\\n * Counterpart to Solidity's `int104` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 104 bits\\n */\\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\\n downcasted = int104(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(104, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int96 from int256, reverting on\\n * overflow (when the input is less than smallest int96 or\\n * greater than largest int96).\\n *\\n * Counterpart to Solidity's `int96` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 96 bits\\n */\\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\\n downcasted = int96(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(96, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int88 from int256, reverting on\\n * overflow (when the input is less than smallest int88 or\\n * greater than largest int88).\\n *\\n * Counterpart to Solidity's `int88` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 88 bits\\n */\\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\\n downcasted = int88(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(88, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int80 from int256, reverting on\\n * overflow (when the input is less than smallest int80 or\\n * greater than largest int80).\\n *\\n * Counterpart to Solidity's `int80` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 80 bits\\n */\\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\\n downcasted = int80(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(80, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int72 from int256, reverting on\\n * overflow (when the input is less than smallest int72 or\\n * greater than largest int72).\\n *\\n * Counterpart to Solidity's `int72` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 72 bits\\n */\\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\\n downcasted = int72(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(72, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int64 from int256, reverting on\\n * overflow (when the input is less than smallest int64 or\\n * greater than largest int64).\\n *\\n * Counterpart to Solidity's `int64` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 64 bits\\n */\\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\\n downcasted = int64(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(64, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int56 from int256, reverting on\\n * overflow (when the input is less than smallest int56 or\\n * greater than largest int56).\\n *\\n * Counterpart to Solidity's `int56` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 56 bits\\n */\\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\\n downcasted = int56(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(56, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int48 from int256, reverting on\\n * overflow (when the input is less than smallest int48 or\\n * greater than largest int48).\\n *\\n * Counterpart to Solidity's `int48` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 48 bits\\n */\\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\\n downcasted = int48(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(48, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int40 from int256, reverting on\\n * overflow (when the input is less than smallest int40 or\\n * greater than largest int40).\\n *\\n * Counterpart to Solidity's `int40` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 40 bits\\n */\\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\\n downcasted = int40(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(40, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int32 from int256, reverting on\\n * overflow (when the input is less than smallest int32 or\\n * greater than largest int32).\\n *\\n * Counterpart to Solidity's `int32` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 32 bits\\n */\\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\\n downcasted = int32(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(32, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int24 from int256, reverting on\\n * overflow (when the input is less than smallest int24 or\\n * greater than largest int24).\\n *\\n * Counterpart to Solidity's `int24` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 24 bits\\n */\\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\\n downcasted = int24(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(24, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int16 from int256, reverting on\\n * overflow (when the input is less than smallest int16 or\\n * greater than largest int16).\\n *\\n * Counterpart to Solidity's `int16` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 16 bits\\n */\\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\\n downcasted = int16(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(16, value);\\n }\\n }\\n\\n /**\\n * @dev Returns the downcasted int8 from int256, reverting on\\n * overflow (when the input is less than smallest int8 or\\n * greater than largest int8).\\n *\\n * Counterpart to Solidity's `int8` operator.\\n *\\n * Requirements:\\n *\\n * - input must fit into 8 bits\\n */\\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\\n downcasted = int8(value);\\n if (downcasted != value) {\\n revert SafeCastOverflowedIntDowncast(8, value);\\n }\\n }\\n\\n /**\\n * @dev Converts an unsigned uint256 into a signed int256.\\n *\\n * Requirements:\\n *\\n * - input must be less than or equal to maxInt256.\\n */\\n function toInt256(uint256 value) internal pure returns (int256) {\\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\\n if (value > uint256(type(int256).max)) {\\n revert SafeCastOverflowedUintToInt(value);\\n }\\n return int256(value);\\n }\\n\\n /**\\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\\n */\\n function toUint(bool b) internal pure returns (uint256 u) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n u := iszero(iszero(b))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8cd59334ed58b8884cd1f775afc9400db702e674e5d6a7a438c655b9de788d7e\",\"license\":\"MIT\"},\"src/Controller.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.0;\\n\\nimport {IERC20Permit} from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {SafeCast} from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport {ILocker} from \\\"v2-core/interfaces/ILocker.sol\\\";\\nimport {IBookManager} from \\\"v2-core/interfaces/IBookManager.sol\\\";\\nimport {IERC721Permit} from \\\"v2-core/interfaces/IERC721Permit.sol\\\";\\nimport {Math} from \\\"v2-core/libraries/Math.sol\\\";\\nimport {BookId, BookIdLibrary} from \\\"v2-core/libraries/BookId.sol\\\";\\nimport {OrderId, OrderIdLibrary} from \\\"v2-core/libraries/OrderId.sol\\\";\\nimport {Currency, CurrencyLibrary} from \\\"v2-core/libraries/Currency.sol\\\";\\nimport {FeePolicy, FeePolicyLibrary} from \\\"v2-core/libraries/FeePolicy.sol\\\";\\nimport {Tick, TickLibrary} from \\\"v2-core/libraries/Tick.sol\\\";\\nimport {OrderId, OrderIdLibrary} from \\\"v2-core/libraries/OrderId.sol\\\";\\n\\nimport {IController} from \\\"./interfaces/IController.sol\\\";\\nimport {ReentrancyGuard} from \\\"./libraries/ReentrancyGuard.sol\\\";\\n\\ncontract Controller is IController, ILocker, ReentrancyGuard {\\n using TickLibrary for *;\\n using OrderIdLibrary for OrderId;\\n using BookIdLibrary for IBookManager.BookKey;\\n using SafeERC20 for IERC20;\\n using SafeCast for uint256;\\n using Math for uint256;\\n using CurrencyLibrary for Currency;\\n using FeePolicyLibrary for FeePolicy;\\n\\n IBookManager public immutable bookManager;\\n\\n constructor(address bookManager_) {\\n bookManager = IBookManager(bookManager_);\\n }\\n\\n modifier checkDeadline(uint64 deadline) {\\n if (block.timestamp > deadline) revert Deadline();\\n _;\\n }\\n\\n modifier permitERC20(ERC20PermitParams[] calldata permitParamsList) {\\n _permitERC20(permitParamsList);\\n _;\\n }\\n\\n function getDepth(BookId id, Tick tick) external view returns (uint256) {\\n return uint256(bookManager.getDepth(id, tick)) * bookManager.getBookKey(id).unitSize;\\n }\\n\\n function getHighestPrice(BookId id) external view returns (uint256) {\\n return bookManager.getHighest(id).toPrice();\\n }\\n\\n function getOrder(OrderId orderId)\\n external\\n view\\n returns (address provider, uint256 price, uint256 openAmount, uint256 claimableAmount)\\n {\\n (BookId bookId, Tick tick,) = orderId.decode();\\n IBookManager.BookKey memory key = bookManager.getBookKey(bookId);\\n uint256 unitSize = key.unitSize;\\n price = tick.toPrice();\\n IBookManager.OrderInfo memory orderInfo = bookManager.getOrder(orderId);\\n provider = orderInfo.provider;\\n openAmount = unitSize * orderInfo.open;\\n FeePolicy makerPolicy = key.makerPolicy;\\n claimableAmount = tick.quoteToBase(unitSize * orderInfo.claimable, false);\\n if (!makerPolicy.usesQuote()) {\\n int256 fee = makerPolicy.calculateFee(claimableAmount, false);\\n claimableAmount = fee > 0 ? claimableAmount - uint256(fee) : claimableAmount + uint256(-fee);\\n }\\n }\\n\\n function fromPrice(uint256 price) external pure returns (Tick) {\\n return price.fromPrice();\\n }\\n\\n function toPrice(Tick tick) external pure returns (uint256) {\\n return tick.toPrice();\\n }\\n\\n function lockAcquired(address sender, bytes memory data) external nonReentrant returns (bytes memory returnData) {\\n if (msg.sender != address(bookManager) || sender != address(this)) revert InvalidAccess();\\n (address user, Action[] memory actionList, bytes[] memory orderParamsList, address[] memory tokensToSettle) =\\n abi.decode(data, (address, Action[], bytes[], address[]));\\n\\n uint256 length = actionList.length;\\n OrderId[] memory ids = new OrderId[](length);\\n uint256 orderIdIndex;\\n\\n for (uint256 i = 0; i < length; ++i) {\\n Action action = actionList[i];\\n if (action == Action.OPEN) {\\n _open(abi.decode(orderParamsList[i], (OpenBookParams)));\\n } else if (action == Action.MAKE) {\\n OrderId id = _make(abi.decode(orderParamsList[i], (MakeOrderParams)));\\n if (OrderId.unwrap(id) != 0) {\\n bookManager.transferFrom(address(this), user, OrderId.unwrap(id));\\n ids[orderIdIndex++] = id;\\n }\\n } else if (action == Action.LIMIT) {\\n OrderId id = _limit(abi.decode(orderParamsList[i], (LimitOrderParams)));\\n if (OrderId.unwrap(id) != 0) {\\n bookManager.transferFrom(address(this), user, OrderId.unwrap(id));\\n ids[orderIdIndex++] = id;\\n }\\n } else if (action == Action.TAKE) {\\n _take(abi.decode(orderParamsList[i], (TakeOrderParams)));\\n } else if (action == Action.SPEND) {\\n _spend(abi.decode(orderParamsList[i], (SpendOrderParams)));\\n } else if (action == Action.CLAIM) {\\n ClaimOrderParams memory claimOrderParams = abi.decode(orderParamsList[i], (ClaimOrderParams));\\n uint256 orderId = OrderId.unwrap(claimOrderParams.id);\\n bookManager.checkAuthorized(bookManager.ownerOf(orderId), user, orderId);\\n _claim(claimOrderParams);\\n } else if (action == Action.CANCEL) {\\n CancelOrderParams memory cancelOrderParams = abi.decode(orderParamsList[i], (CancelOrderParams));\\n uint256 orderId = OrderId.unwrap(cancelOrderParams.id);\\n bookManager.checkAuthorized(bookManager.ownerOf(orderId), user, orderId);\\n _cancel(cancelOrderParams);\\n } else {\\n revert InvalidAction();\\n }\\n }\\n\\n _settleTokens(user, tokensToSettle);\\n\\n assembly {\\n mstore(ids, orderIdIndex)\\n }\\n returnData = abi.encode(ids);\\n }\\n\\n function execute(\\n Action[] calldata actionList,\\n bytes[] calldata paramsDataList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata erc20PermitParamsList,\\n ERC721PermitParams[] calldata erc721PermitParamsList,\\n uint64 deadline\\n ) external payable checkDeadline(deadline) returns (OrderId[] memory ids) {\\n if (actionList.length != paramsDataList.length) revert InvalidLength();\\n _permitERC20(erc20PermitParamsList);\\n _permitERC721(erc721PermitParamsList);\\n\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bytes memory result = bookManager.lock(address(this), lockData);\\n\\n if (result.length != 0) {\\n (ids) = abi.decode(result, (OrderId[]));\\n }\\n return ids;\\n }\\n\\n function open(OpenBookParams[] calldata openBookParamsList, uint64 deadline) external checkDeadline(deadline) {\\n uint256 length = openBookParamsList.length;\\n Action[] memory actionList = new Action[](length);\\n bytes[] memory paramsDataList = new bytes[](length);\\n for (uint256 i = 0; i < length; ++i) {\\n actionList[i] = Action.OPEN;\\n paramsDataList[i] = abi.encode(openBookParamsList[i]);\\n }\\n address[] memory tokensToSettle;\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bookManager.lock(address(this), lockData);\\n }\\n\\n function limit(\\n LimitOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) returns (OrderId[] memory ids) {\\n uint256 length = orderParamsList.length;\\n Action[] memory actionList = new Action[](length);\\n bytes[] memory paramsDataList = new bytes[](length);\\n for (uint256 i = 0; i < length; ++i) {\\n actionList[i] = Action.LIMIT;\\n paramsDataList[i] = abi.encode(orderParamsList[i]);\\n }\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bytes memory result = bookManager.lock(address(this), lockData);\\n (ids) = abi.decode(result, (OrderId[]));\\n }\\n\\n function make(\\n MakeOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) returns (OrderId[] memory ids) {\\n uint256 length = orderParamsList.length;\\n Action[] memory actionList = new Action[](length);\\n bytes[] memory paramsDataList = new bytes[](length);\\n for (uint256 i = 0; i < length; ++i) {\\n actionList[i] = Action.MAKE;\\n paramsDataList[i] = abi.encode(orderParamsList[i]);\\n }\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bytes memory result = bookManager.lock(address(this), lockData);\\n (ids) = abi.decode(result, (OrderId[]));\\n }\\n\\n function take(\\n TakeOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) {\\n uint256 length = orderParamsList.length;\\n Action[] memory actionList = new Action[](length);\\n bytes[] memory paramsDataList = new bytes[](length);\\n for (uint256 i = 0; i < length; ++i) {\\n actionList[i] = Action.TAKE;\\n paramsDataList[i] = abi.encode(orderParamsList[i]);\\n }\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bookManager.lock(address(this), lockData);\\n }\\n\\n function spend(\\n SpendOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) {\\n uint256 length = orderParamsList.length;\\n Action[] memory actionList = new Action[](length);\\n bytes[] memory paramsDataList = new bytes[](length);\\n for (uint256 i = 0; i < length; ++i) {\\n actionList[i] = Action.SPEND;\\n paramsDataList[i] = abi.encode(orderParamsList[i]);\\n }\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bookManager.lock(address(this), lockData);\\n }\\n\\n function claim(\\n ClaimOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC721PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external checkDeadline(deadline) {\\n _permitERC721(permitParamsList);\\n uint256 length = orderParamsList.length;\\n Action[] memory actionList = new Action[](length);\\n bytes[] memory paramsDataList = new bytes[](length);\\n for (uint256 i = 0; i < length; ++i) {\\n actionList[i] = Action.CLAIM;\\n paramsDataList[i] = abi.encode(orderParamsList[i]);\\n }\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bookManager.lock(address(this), lockData);\\n }\\n\\n function cancel(\\n CancelOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC721PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external checkDeadline(deadline) {\\n _permitERC721(permitParamsList);\\n uint256 length = orderParamsList.length;\\n Action[] memory actionList = new Action[](length);\\n bytes[] memory paramsDataList = new bytes[](length);\\n for (uint256 i = 0; i < length; ++i) {\\n actionList[i] = Action.CANCEL;\\n paramsDataList[i] = abi.encode(orderParamsList[i]);\\n }\\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\\n bookManager.lock(address(this), lockData);\\n }\\n\\n function _open(OpenBookParams memory params) internal {\\n bookManager.open(params.key, params.hookData);\\n }\\n\\n function _make(MakeOrderParams memory params) internal returns (OrderId id) {\\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\\n\\n uint256 quoteAmount = params.quoteAmount;\\n if (key.makerPolicy.usesQuote()) {\\n quoteAmount = key.makerPolicy.calculateOriginalAmount(quoteAmount, false);\\n }\\n uint64 unit = (quoteAmount / key.unitSize).toUint64();\\n if (unit > 0) {\\n (id,) = bookManager.make(\\n IBookManager.MakeParams({key: key, tick: params.tick, unit: unit, provider: address(0)}),\\n params.hookData\\n );\\n }\\n return id;\\n }\\n\\n function _limit(LimitOrderParams memory params) internal returns (OrderId id) {\\n (bool isQuoteRemained, uint256 spentQuoteAmount) = _spend(\\n SpendOrderParams({\\n id: params.takeBookId,\\n limitPrice: params.limitPrice,\\n baseAmount: params.quoteAmount,\\n minQuoteAmount: 0,\\n hookData: params.takeHookData\\n })\\n );\\n params.quoteAmount -= spentQuoteAmount;\\n if (isQuoteRemained) {\\n id = _make(\\n MakeOrderParams({\\n id: params.makeBookId,\\n quoteAmount: params.quoteAmount,\\n tick: params.tick,\\n hookData: params.makeHookData\\n })\\n );\\n }\\n }\\n\\n function _take(TakeOrderParams memory params)\\n internal\\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\\n {\\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\\n\\n while (params.quoteAmount > takenQuoteAmount && !bookManager.isEmpty(params.id)) {\\n Tick tick = bookManager.getHighest(params.id);\\n if (params.limitPrice > tick.toPrice()) break;\\n uint256 maxAmount;\\n unchecked {\\n if (key.takerPolicy.usesQuote()) {\\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.quoteAmount - takenQuoteAmount, true);\\n } else {\\n maxAmount = params.quoteAmount - takenQuoteAmount;\\n }\\n }\\n maxAmount = maxAmount.divide(key.unitSize, true);\\n\\n if (maxAmount == 0) break;\\n (uint256 quoteAmount, uint256 baseAmount) = bookManager.take(\\n IBookManager.TakeParams({key: key, tick: tick, maxUnit: maxAmount.toUint64()}), params.hookData\\n );\\n if (quoteAmount == 0) break;\\n\\n takenQuoteAmount += quoteAmount;\\n spentBaseAmount += baseAmount;\\n }\\n if (params.maxBaseAmount < spentBaseAmount) revert ControllerSlippage();\\n }\\n\\n function _spend(SpendOrderParams memory params) internal returns (bool isBaseRemained, uint256 spentBaseAmount) {\\n uint256 takenQuoteAmount;\\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\\n\\n while (spentBaseAmount < params.baseAmount) {\\n if (bookManager.isEmpty(params.id)) {\\n isBaseRemained = true;\\n break;\\n }\\n Tick tick = bookManager.getHighest(params.id);\\n if (params.limitPrice > tick.toPrice()) {\\n isBaseRemained = true;\\n break;\\n }\\n uint256 maxAmount;\\n unchecked {\\n if (key.takerPolicy.usesQuote()) {\\n maxAmount = params.baseAmount - spentBaseAmount;\\n } else {\\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.baseAmount - spentBaseAmount, false);\\n }\\n }\\n maxAmount = tick.baseToQuote(maxAmount, false) / key.unitSize;\\n if (maxAmount == 0) break;\\n (uint256 quoteAmount, uint256 baseAmount) = bookManager.take(\\n IBookManager.TakeParams({key: key, tick: tick, maxUnit: maxAmount.toUint64()}), params.hookData\\n );\\n if (baseAmount == 0) break;\\n takenQuoteAmount += quoteAmount;\\n spentBaseAmount += baseAmount;\\n }\\n if (params.minQuoteAmount > takenQuoteAmount) revert ControllerSlippage();\\n }\\n\\n function _claim(ClaimOrderParams memory params) internal {\\n bookManager.claim(params.id, params.hookData);\\n }\\n\\n function _cancel(CancelOrderParams memory params) internal {\\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id.getBookId());\\n try bookManager.cancel(\\n IBookManager.CancelParams({id: params.id, toUnit: (params.leftQuoteAmount / key.unitSize).toUint64()}),\\n params.hookData\\n ) {} catch {}\\n }\\n\\n function _settleTokens(address user, address[] memory tokensToSettle) internal {\\n Currency native = CurrencyLibrary.NATIVE;\\n int256 currencyDelta = bookManager.getCurrencyDelta(address(this), native);\\n if (currencyDelta < 0) {\\n native.transfer(address(bookManager), uint256(-currencyDelta));\\n bookManager.settle(native);\\n }\\n currencyDelta = bookManager.getCurrencyDelta(address(this), native);\\n if (currencyDelta > 0) {\\n bookManager.withdraw(native, user, uint256(currencyDelta));\\n }\\n\\n uint256 length = tokensToSettle.length;\\n for (uint256 i = 0; i < length; ++i) {\\n Currency currency = Currency.wrap(tokensToSettle[i]);\\n currencyDelta = bookManager.getCurrencyDelta(address(this), currency);\\n if (currencyDelta < 0) {\\n IERC20(tokensToSettle[i]).safeTransferFrom(user, address(bookManager), uint256(-currencyDelta));\\n bookManager.settle(currency);\\n }\\n currencyDelta = bookManager.getCurrencyDelta(address(this), currency);\\n if (currencyDelta > 0) {\\n bookManager.withdraw(Currency.wrap(tokensToSettle[i]), user, uint256(currencyDelta));\\n }\\n uint256 balance = IERC20(tokensToSettle[i]).balanceOf(address(this));\\n if (balance > 0) {\\n IERC20(tokensToSettle[i]).transfer(user, balance);\\n }\\n }\\n if (address(this).balance > 0) native.transfer(user, address(this).balance);\\n }\\n\\n function _permitERC20(ERC20PermitParams[] calldata permitParamsList) internal {\\n for (uint256 i = 0; i < permitParamsList.length; ++i) {\\n ERC20PermitParams memory permitParams = permitParamsList[i];\\n if (permitParams.signature.deadline > 0) {\\n try IERC20Permit(permitParams.token).permit(\\n msg.sender,\\n address(this),\\n permitParams.permitAmount,\\n permitParams.signature.deadline,\\n permitParams.signature.v,\\n permitParams.signature.r,\\n permitParams.signature.s\\n ) {} catch {}\\n }\\n }\\n }\\n\\n function _permitERC721(ERC721PermitParams[] calldata permitParamsList) internal {\\n for (uint256 i = 0; i < permitParamsList.length; ++i) {\\n PermitSignature memory signature = permitParamsList[i].signature;\\n if (signature.deadline > 0) {\\n try IERC721Permit(address(bookManager)).permit(\\n address(this),\\n permitParamsList[i].tokenId,\\n signature.deadline,\\n signature.v,\\n signature.r,\\n signature.s\\n ) {} catch {}\\n }\\n }\\n }\\n\\n receive() external payable {}\\n}\\n\",\"keccak256\":\"0x9275f57137918c7314fa3a8a8ea5c1de94ecbf15a4bf62762f1c5de6ef7c2d76\",\"license\":\"GPL-2.0-or-later\"},\"src/interfaces/IController.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport {OrderId} from \\\"v2-core/libraries/OrderId.sol\\\";\\nimport {BookId} from \\\"v2-core/libraries/BookId.sol\\\";\\nimport {Tick} from \\\"v2-core/libraries/Tick.sol\\\";\\nimport {IBookManager} from \\\"v2-core/interfaces/IBookManager.sol\\\";\\n\\n/**\\n * @title IController\\n * @notice Interface for the controller contract\\n */\\ninterface IController {\\n // Error messages\\n error InvalidAccess();\\n error InvalidLength();\\n error Deadline();\\n error ControllerSlippage();\\n error InvalidAction();\\n\\n /**\\n * @notice Enum for the different actions that can be performed\\n */\\n enum Action {\\n OPEN,\\n MAKE,\\n LIMIT,\\n TAKE,\\n SPEND,\\n CLAIM,\\n CANCEL\\n }\\n\\n /**\\n * @notice Struct for the parameters of the ERC20 permit\\n */\\n struct ERC20PermitParams {\\n address token;\\n uint256 permitAmount;\\n PermitSignature signature;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the ERC721 permit\\n */\\n struct ERC721PermitParams {\\n uint256 tokenId;\\n PermitSignature signature;\\n }\\n\\n /**\\n * @notice Struct for the signature of the permit\\n */\\n struct PermitSignature {\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the open book action\\n */\\n struct OpenBookParams {\\n IBookManager.BookKey key;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the make order action\\n */\\n struct MakeOrderParams {\\n BookId id;\\n Tick tick;\\n uint256 quoteAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the limit order action\\n */\\n struct LimitOrderParams {\\n BookId takeBookId;\\n BookId makeBookId;\\n uint256 limitPrice;\\n Tick tick;\\n uint256 quoteAmount;\\n bytes takeHookData;\\n bytes makeHookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the take order action\\n */\\n struct TakeOrderParams {\\n BookId id;\\n uint256 limitPrice;\\n uint256 quoteAmount;\\n uint256 maxBaseAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the spend order action\\n */\\n struct SpendOrderParams {\\n BookId id;\\n uint256 limitPrice;\\n uint256 baseAmount;\\n uint256 minQuoteAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the claim order action\\n */\\n struct ClaimOrderParams {\\n OrderId id;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Struct for the parameters of the cancel order action\\n */\\n struct CancelOrderParams {\\n OrderId id;\\n uint256 leftQuoteAmount;\\n bytes hookData;\\n }\\n\\n /**\\n * @notice Returns the book manager\\n * @return The instance of the book manager\\n */\\n function bookManager() external view returns (IBookManager);\\n\\n /**\\n * @notice Opens a book\\n * @param openBookParamsList The parameters of the open book action\\n * @param deadline The deadline for the action\\n */\\n function open(OpenBookParams[] calldata openBookParamsList, uint64 deadline) external;\\n\\n /**\\n * @notice Returns the depth of a book\\n * @param id The id of the book\\n * @param tick The tick of the book\\n * @return The depth of the book in quote amount\\n */\\n function getDepth(BookId id, Tick tick) external view returns (uint256);\\n\\n /**\\n * @notice Returns the highest price of a book\\n * @param id The id of the book\\n * @return The highest price of the book with 2**96 precision\\n */\\n function getHighestPrice(BookId id) external view returns (uint256);\\n\\n /**\\n * @notice Returns the details of an order\\n * @param orderId The id of the order\\n * @return provider The provider of the order\\n * @return price The price of the order with 2**96 precision\\n * @return openAmount The open quote amount of the order\\n * @return claimableAmount The claimable base amount of the order\\n */\\n function getOrder(OrderId orderId)\\n external\\n view\\n returns (address provider, uint256 price, uint256 openAmount, uint256 claimableAmount);\\n\\n /**\\n * @notice Converts a price to a tick\\n * @param price The price to convert\\n * @return The tick\\n */\\n function fromPrice(uint256 price) external pure returns (Tick);\\n\\n /**\\n * @notice Converts a tick to a price\\n * @param tick The tick to convert\\n * @return The price with 2**96 precision\\n */\\n function toPrice(Tick tick) external pure returns (uint256);\\n\\n /**\\n * @notice Executes a list of actions\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param actionList The list of actions to execute\\n * @param paramsDataList The parameters of the actions\\n * @param tokensToSettle The tokens to settle\\n * @param erc20PermitParamsList The parameters of the ERC20 permits\\n * @param erc721PermitParamsList The parameters of the ERC721 permits\\n * @param deadline The deadline for the actions\\n * @return ids The ids of the orders\\n */\\n function execute(\\n Action[] calldata actionList,\\n bytes[] calldata paramsDataList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata erc20PermitParamsList,\\n ERC721PermitParams[] calldata erc721PermitParamsList,\\n uint64 deadline\\n ) external payable returns (OrderId[] memory ids);\\n\\n /**\\n * @notice Makes a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to make\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n * @return ids The ids of the orders\\n */\\n function make(\\n MakeOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable returns (OrderId[] memory ids);\\n\\n /**\\n * @notice Takes a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to take\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function take(\\n TakeOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable;\\n\\n /**\\n * @notice Spends to take a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to spend\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function spend(\\n SpendOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC20PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external payable;\\n\\n /**\\n * @notice Claims a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to claim\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function claim(\\n ClaimOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC721PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external;\\n\\n /**\\n * @notice Cancels a list of orders\\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\\n * @param orderParamsList The list of actions to cancel\\n * @param tokensToSettle The tokens to settle\\n * @param permitParamsList The parameters of the permits\\n * @param deadline The deadline for the actions\\n */\\n function cancel(\\n CancelOrderParams[] calldata orderParamsList,\\n address[] calldata tokensToSettle,\\n ERC721PermitParams[] calldata permitParamsList,\\n uint64 deadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x3734542b28d0f7ef6eca2dddfd1df1273307f0c346cdc5ec4128f94180705699\",\"license\":\"MIT\"},\"src/libraries/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.24;\\n\\nabstract contract ReentrancyGuard {\\n // uint256(keccak256(\\\"ReentrancyGuard\\\")) - 1\\n uint256 internal constant REENTRANCY_GUARD_SLOT = 0x8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf4;\\n\\n error ReentrancyGuardReentrantCall();\\n\\n modifier nonReentrant() {\\n _nonReentrantBefore();\\n _;\\n _nonReentrantAfter();\\n }\\n\\n function _nonReentrantBefore() private {\\n if (_reentrancyGuardEntered()) {\\n revert ReentrancyGuardReentrantCall();\\n }\\n assembly {\\n // Any calls to nonReentrant after this point will fail\\n tstore(REENTRANCY_GUARD_SLOT, 1)\\n }\\n }\\n\\n function _nonReentrantAfter() private {\\n assembly {\\n tstore(REENTRANCY_GUARD_SLOT, 0)\\n }\\n }\\n\\n function _reentrancyGuardEntered() internal view returns (bool isEntered) {\\n assembly {\\n isEntered := tload(REENTRANCY_GUARD_SLOT)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4a29368336cca301ffb393ab2b667b311cca443f888bc4d2593261f47114ea1b\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/interfaces/IBookManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\nimport {BookId} from \\\"../libraries/BookId.sol\\\";\\nimport {Currency} from \\\"../libraries/Currency.sol\\\";\\nimport {OrderId} from \\\"../libraries/OrderId.sol\\\";\\nimport {Tick} from \\\"../libraries/Tick.sol\\\";\\nimport {FeePolicy} from \\\"../libraries/FeePolicy.sol\\\";\\nimport {IERC721Permit} from \\\"./IERC721Permit.sol\\\";\\nimport {IHooks} from \\\"./IHooks.sol\\\";\\n\\n/**\\n * @title IBookManager\\n * @notice The interface for the BookManager contract\\n */\\ninterface IBookManager is IERC721Metadata, IERC721Permit {\\n error InvalidUnitSize();\\n error InvalidFeePolicy();\\n error InvalidProvider(address provider);\\n error LockedBy(address locker, address hook);\\n error CurrencyNotSettled();\\n\\n /**\\n * @notice Event emitted when a new book is opened\\n * @param id The book id\\n * @param base The base currency\\n * @param quote The quote currency\\n * @param unitSize The unit size of the book\\n * @param makerPolicy The maker fee policy\\n * @param takerPolicy The taker fee policy\\n * @param hooks The hooks contract\\n */\\n event Open(\\n BookId indexed id,\\n Currency indexed base,\\n Currency indexed quote,\\n uint64 unitSize,\\n FeePolicy makerPolicy,\\n FeePolicy takerPolicy,\\n IHooks hooks\\n );\\n\\n /**\\n * @notice Event emitted when a new order is made\\n * @param bookId The book id\\n * @param user The user address\\n * @param tick The order tick\\n * @param orderIndex The order index\\n * @param unit The order unit\\n * @param provider The provider address\\n */\\n event Make(\\n BookId indexed bookId, address indexed user, Tick tick, uint256 orderIndex, uint64 unit, address provider\\n );\\n\\n /**\\n * @notice Event emitted when an order is taken\\n * @param bookId The book id\\n * @param user The user address\\n * @param tick The order tick\\n * @param unit The order unit\\n */\\n event Take(BookId indexed bookId, address indexed user, Tick tick, uint64 unit);\\n\\n /**\\n * @notice Event emitted when an order is canceled\\n * @param orderId The order id\\n * @param unit The canceled unit\\n */\\n event Cancel(OrderId indexed orderId, uint64 unit);\\n\\n /**\\n * @notice Event emitted when an order is claimed\\n * @param orderId The order id\\n * @param unit The claimed unit\\n */\\n event Claim(OrderId indexed orderId, uint64 unit);\\n\\n /**\\n * @notice Event emitted when a provider is whitelisted\\n * @param provider The provider address\\n */\\n event Whitelist(address indexed provider);\\n\\n /**\\n * @notice Event emitted when a provider is delisted\\n * @param provider The provider address\\n */\\n event Delist(address indexed provider);\\n\\n /**\\n * @notice Event emitted when a provider collects fees\\n * @param provider The provider address\\n * @param recipient The recipient address\\n * @param currency The currency\\n * @param amount The collected amount\\n */\\n event Collect(address indexed provider, address indexed recipient, Currency indexed currency, uint256 amount);\\n\\n /**\\n * @notice Event emitted when new default provider is set\\n * @param newDefaultProvider The new default provider address\\n */\\n event SetDefaultProvider(address indexed newDefaultProvider);\\n\\n /**\\n * @notice This structure represents a unique identifier for a book in the BookManager.\\n * @param base The base currency of the book\\n * @param unitSize The unit size of the book\\n * @param quote The quote currency of the book\\n * @param makerPolicy The maker fee policy of the book\\n * @param hooks The hooks contract of the book\\n * @param takerPolicy The taker fee policy of the book\\n */\\n struct BookKey {\\n Currency base;\\n uint64 unitSize;\\n Currency quote;\\n FeePolicy makerPolicy;\\n IHooks hooks;\\n FeePolicy takerPolicy;\\n }\\n\\n /**\\n * @notice Returns the base URI\\n * @return The base URI\\n */\\n function baseURI() external view returns (string memory);\\n\\n /**\\n * @notice Returns the contract URI\\n * @return The contract URI\\n */\\n function contractURI() external view returns (string memory);\\n\\n /**\\n * @notice Returns the default provider\\n * @return The default provider\\n */\\n function defaultProvider() external view returns (address);\\n\\n /**\\n * @notice Returns the total reserves of a given currency\\n * @param currency The currency in question\\n * @return The total reserves amount\\n */\\n function reservesOf(Currency currency) external view returns (uint256);\\n\\n /**\\n * @notice Checks if a provider is whitelisted\\n * @param provider The address of the provider\\n * @return True if the provider is whitelisted, false otherwise\\n */\\n function isWhitelisted(address provider) external view returns (bool);\\n\\n /**\\n * @notice Verifies if an owner has authorized a spender for a token\\n * @param owner The address of the token owner\\n * @param spender The address of the spender\\n * @param tokenId The token ID\\n */\\n function checkAuthorized(address owner, address spender, uint256 tokenId) external view;\\n\\n /**\\n * @notice Calculates the amount owed to a provider in a given currency\\n * @param provider The provider's address\\n * @param currency The currency in question\\n * @return The owed amount\\n */\\n function tokenOwed(address provider, Currency currency) external view returns (uint256);\\n\\n /**\\n * @notice Calculates the currency balance changes for a given locker\\n * @param locker The address of the locker\\n * @param currency The currency in question\\n * @return The net change in currency balance\\n */\\n function getCurrencyDelta(address locker, Currency currency) external view returns (int256);\\n\\n /**\\n * @notice Retrieves the book key for a given book ID\\n * @param id The book ID\\n * @return The book key\\n */\\n function getBookKey(BookId id) external view returns (BookKey memory);\\n\\n /**\\n * @notice This structure represents a current status for an order in the BookManager.\\n * @param provider The provider of the order\\n * @param open The open unit of the order\\n * @param claimable The claimable unit of the order\\n */\\n struct OrderInfo {\\n address provider;\\n uint64 open;\\n uint64 claimable;\\n }\\n\\n /**\\n * @notice Provides information about an order\\n * @param id The order ID\\n * @return Order information including provider, open status, and claimable unit\\n */\\n function getOrder(OrderId id) external view returns (OrderInfo memory);\\n\\n /**\\n * @notice Retrieves the locker and caller addresses for a given lock\\n * @param i The index of the lock\\n * @return locker The locker's address\\n * @return lockCaller The caller's address\\n */\\n function getLock(uint256 i) external view returns (address locker, address lockCaller);\\n\\n /**\\n * @notice Provides the lock data\\n * @return The lock data including necessary numeric values\\n */\\n function getLockData() external view returns (uint128, uint128);\\n\\n /**\\n * @notice Returns the depth of a given book ID and tick\\n * @param id The book ID\\n * @param tick The tick\\n * @return The depth of the tick\\n */\\n function getDepth(BookId id, Tick tick) external view returns (uint64);\\n\\n /**\\n * @notice Retrieves the highest tick for a given book ID\\n * @param id The book ID\\n * @return tick The highest tick\\n */\\n function getHighest(BookId id) external view returns (Tick tick);\\n\\n /**\\n * @notice Finds the maximum tick less than a specified tick in a book\\n * @dev Returns `Tick.wrap(type(int24).min)` if the specified tick is the lowest\\n * @param id The book ID\\n * @param tick The specified tick\\n * @return The next lower tick\\n */\\n function maxLessThan(BookId id, Tick tick) external view returns (Tick);\\n\\n /**\\n * @notice Checks if a book is opened\\n * @param id The book ID\\n * @return True if the book is opened, false otherwise\\n */\\n function isOpened(BookId id) external view returns (bool);\\n\\n /**\\n * @notice Checks if a book is empty\\n * @param id The book ID\\n * @return True if the book is empty, false otherwise\\n */\\n function isEmpty(BookId id) external view returns (bool);\\n\\n /**\\n * @notice Encodes a BookKey into a BookId\\n * @param key The BookKey to encode\\n * @return The encoded BookId\\n */\\n function encodeBookKey(BookKey calldata key) external pure returns (BookId);\\n\\n /**\\n * @notice Loads a value from a specific storage slot\\n * @param slot The storage slot\\n * @return The value in the slot\\n */\\n function load(bytes32 slot) external view returns (bytes32);\\n\\n /**\\n * @notice Loads a sequence of values starting from a specific slot\\n * @param startSlot The starting slot\\n * @param nSlot The number of slots to load\\n * @return The sequence of values\\n */\\n function load(bytes32 startSlot, uint256 nSlot) external view returns (bytes memory);\\n\\n /**\\n * @notice Opens a new book\\n * @param key The book key\\n * @param hookData The hook data\\n */\\n function open(BookKey calldata key, bytes calldata hookData) external;\\n\\n /**\\n * @notice Locks a book manager function\\n * @param locker The locker address\\n * @param data The lock data\\n * @return The lock return data\\n */\\n function lock(address locker, bytes calldata data) external returns (bytes memory);\\n\\n /**\\n * @notice This structure represents the parameters for making an order.\\n * @param key The book key for the order\\n * @param tick The tick for the order\\n * @param unit The unit for the order. Times key.unitSize to get actual bid amount.\\n * @param provider The provider for the order. The limit order service provider address to collect fees.\\n */\\n struct MakeParams {\\n BookKey key;\\n Tick tick;\\n uint64 unit;\\n address provider;\\n }\\n\\n /**\\n * @notice Make a limit order\\n * @param params The order parameters\\n * @param hookData The hook data\\n * @return id The order id. Returns 0 if the order is not settled\\n * @return quoteAmount The amount of quote currency to be paid\\n */\\n function make(MakeParams calldata params, bytes calldata hookData)\\n external\\n returns (OrderId id, uint256 quoteAmount);\\n\\n /**\\n * @notice This structure represents the parameters for taking orders in the specified tick.\\n * @param key The book key for the order\\n * @param tick The tick for the order\\n * @param maxUnit The max unit to take\\n */\\n struct TakeParams {\\n BookKey key;\\n Tick tick;\\n uint64 maxUnit;\\n }\\n\\n /**\\n * @notice Take a limit order at specific tick\\n * @param params The order parameters\\n * @param hookData The hook data\\n * @return quoteAmount The amount of quote currency to be received\\n * @return baseAmount The amount of base currency to be paid\\n */\\n function take(TakeParams calldata params, bytes calldata hookData)\\n external\\n returns (uint256 quoteAmount, uint256 baseAmount);\\n\\n /**\\n * @notice This structure represents the parameters for canceling an order.\\n * @param id The order id for the order\\n * @param toUnit The remaining open unit for the order after cancellation. Must not exceed the current open unit.\\n */\\n struct CancelParams {\\n OrderId id;\\n uint64 toUnit;\\n }\\n\\n /**\\n * @notice Cancel a limit order\\n * @param params The order parameters\\n * @param hookData The hook data\\n * @return canceledAmount The amount of quote currency canceled\\n */\\n function cancel(CancelParams calldata params, bytes calldata hookData) external returns (uint256 canceledAmount);\\n\\n /**\\n * @notice Claims an order\\n * @param id The order ID\\n * @param hookData The hook data\\n * @return claimedAmount The amount claimed\\n */\\n function claim(OrderId id, bytes calldata hookData) external returns (uint256 claimedAmount);\\n\\n /**\\n * @notice Collects fees from a provider\\n * @param recipient The recipient address\\n * @param currency The currency\\n * @return The collected amount\\n */\\n function collect(address recipient, Currency currency) external returns (uint256);\\n\\n /**\\n * @notice Withdraws a currency\\n * @param currency The currency\\n * @param to The recipient address\\n * @param amount The amount\\n */\\n function withdraw(Currency currency, address to, uint256 amount) external;\\n\\n /**\\n * @notice Settles a currency\\n * @param currency The currency\\n * @return The settled amount\\n */\\n function settle(Currency currency) external payable returns (uint256);\\n\\n /**\\n * @notice Whitelists a provider\\n * @param provider The provider address\\n */\\n function whitelist(address provider) external;\\n\\n /**\\n * @notice Delists a provider\\n * @param provider The provider address\\n */\\n function delist(address provider) external;\\n\\n /**\\n * @notice Sets the default provider\\n * @param newDefaultProvider The new default provider address\\n */\\n function setDefaultProvider(address newDefaultProvider) external;\\n}\\n\",\"keccak256\":\"0xda8dffc751ac3554033e084919f1e431eb2585c80e1e30b9a0198366a8607086\",\"license\":\"MIT\"},\"v2-core/interfaces/IERC721Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/**\\n * @title IERC721Permit\\n * @notice An interface for the ERC721 permit extension\\n */\\ninterface IERC721Permit is IERC721 {\\n error InvalidSignature();\\n error PermitExpired();\\n\\n /**\\n * @notice The EIP-712 typehash for the permit struct used by the contract\\n */\\n function PERMIT_TYPEHASH() external pure returns (bytes32);\\n\\n /**\\n * @notice The EIP-712 domain separator for this contract\\n */\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n\\n /**\\n * @notice Approve the spender to transfer the given tokenId\\n * @param spender The address to approve\\n * @param tokenId The tokenId to approve\\n * @param deadline The deadline for the signature\\n * @param v The recovery id of the signature\\n * @param r The r value of the signature\\n * @param s The s value of the signature\\n */\\n function permit(address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;\\n\\n /**\\n * @notice Get the current nonce for a token\\n * @param tokenId The tokenId to get the nonce for\\n * @return The current nonce\\n */\\n function nonces(uint256 tokenId) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xd6baab4710fa674981395f428bd6550c4e288ac44a1a5d38c2a58fd67234d57e\",\"license\":\"MIT\"},\"v2-core/interfaces/IHooks.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.20;\\n\\nimport {IBookManager} from \\\"./IBookManager.sol\\\";\\nimport {OrderId} from \\\"../libraries/OrderId.sol\\\";\\n\\n/**\\n * @title IHooks\\n * @notice Interface for the hooks contract\\n */\\ninterface IHooks {\\n /**\\n * @notice Hook called before opening a new book\\n * @param sender The sender of the open transaction\\n * @param key The key of the book being opened\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after opening a new book\\n * @param sender The sender of the open transaction\\n * @param key The key of the book being opened\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called before making a new order\\n * @param sender The sender of the make transaction\\n * @param params The parameters of the make transaction\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeMake(address sender, IBookManager.MakeParams calldata params, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after making a new order\\n * @param sender The sender of the make transaction\\n * @param params The parameters of the make transaction\\n * @param orderId The id of the order that was made\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterMake(\\n address sender,\\n IBookManager.MakeParams calldata params,\\n OrderId orderId,\\n bytes calldata hookData\\n ) external returns (bytes4);\\n\\n /**\\n * @notice Hook called before taking an order\\n * @param sender The sender of the take transaction\\n * @param params The parameters of the take transaction\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeTake(address sender, IBookManager.TakeParams calldata params, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after taking an order\\n * @param sender The sender of the take transaction\\n * @param params The parameters of the take transaction\\n * @param takenUnit The unit that was taken\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterTake(\\n address sender,\\n IBookManager.TakeParams calldata params,\\n uint64 takenUnit,\\n bytes calldata hookData\\n ) external returns (bytes4);\\n\\n /**\\n * @notice Hook called before canceling an order\\n * @param sender The sender of the cancel transaction\\n * @param params The parameters of the cancel transaction\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeCancel(address sender, IBookManager.CancelParams calldata params, bytes calldata hookData)\\n external\\n returns (bytes4);\\n\\n /**\\n * @notice Hook called after canceling an order\\n * @param sender The sender of the cancel transaction\\n * @param params The parameters of the cancel transaction\\n * @param canceledUnit The unit that was canceled\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterCancel(\\n address sender,\\n IBookManager.CancelParams calldata params,\\n uint64 canceledUnit,\\n bytes calldata hookData\\n ) external returns (bytes4);\\n\\n /**\\n * @notice Hook called before claiming an order\\n * @param sender The sender of the claim transaction\\n * @param orderId The id of the order being claimed\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function beforeClaim(address sender, OrderId orderId, bytes calldata hookData) external returns (bytes4);\\n\\n /**\\n * @notice Hook called after claiming an order\\n * @param sender The sender of the claim transaction\\n * @param orderId The id of the order being claimed\\n * @param claimedUnit The unit that was claimed\\n * @param hookData The data passed to the hook\\n * @return Returns the function selector if the hook is successful\\n */\\n function afterClaim(address sender, OrderId orderId, uint64 claimedUnit, bytes calldata hookData)\\n external\\n returns (bytes4);\\n}\\n\",\"keccak256\":\"0xbff95e07debd7d51cb3aa79172fd3c31efb57cea1c03d21b5740a565198d8343\",\"license\":\"MIT\"},\"v2-core/interfaces/ILocker.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ILocker\\n * @notice Interface for the locker contract\\n */\\ninterface ILocker {\\n /**\\n * @notice Called by the book manager on `msg.sender` when a lock is acquired\\n * @param data The data that was passed to the call to lock\\n * @return Any data that you want to be returned from the lock call\\n */\\n function lockAcquired(address lockCaller, bytes calldata data) external returns (bytes memory);\\n}\\n\",\"keccak256\":\"0x664833ea7804ad5cbbe89f5b36169c6a2c19ef577c1dfb9418ddea290ed19106\",\"license\":\"MIT\"},\"v2-core/libraries/BookId.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {IBookManager} from \\\"../interfaces/IBookManager.sol\\\";\\n\\ntype BookId is uint192;\\n\\nlibrary BookIdLibrary {\\n function toId(IBookManager.BookKey memory bookKey) internal pure returns (BookId id) {\\n bytes32 hash = keccak256(abi.encode(bookKey));\\n assembly {\\n id := and(hash, 0xffffffffffffffffffffffffffffffffffffffffffffffff)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x60f9ed99dfb9a5ce14c29359a5ad8b43de0c756e44b2e5f581e8ea6db7cacbeb\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/Currency.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ntype Currency is address;\\n\\n/// @title CurrencyLibrary\\n/// @dev This library allows for transferring and holding native tokens and ERC20 tokens\\nlibrary CurrencyLibrary {\\n using CurrencyLibrary for Currency;\\n\\n /// @notice Thrown when a native transfer fails\\n error NativeTransferFailed();\\n\\n /// @notice Thrown when an ERC20 transfer fails\\n error ERC20TransferFailed();\\n\\n Currency public constant NATIVE = Currency.wrap(address(0));\\n\\n function transfer(Currency currency, address to, uint256 amount) internal {\\n // implementation from\\n // https://github.com/transmissions11/solmate/blob/e8f96f25d48fe702117ce76c79228ca4f20206cb/src/utils/SafeTransferLib.sol\\n\\n bool success;\\n if (currency.isNative()) {\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n\\n if (!success) revert NativeTransferFailed();\\n } else {\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \\\"to\\\" argument.\\n mstore(add(freeMemoryPointer, 36), amount) // Append the \\\"amount\\\" argument. Masking not required as it's a full 32 byte type.\\n\\n success :=\\n and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), currency, 0, freeMemoryPointer, 68, 0, 32)\\n )\\n }\\n\\n if (!success) revert ERC20TransferFailed();\\n }\\n }\\n\\n function balanceOfSelf(Currency currency) internal view returns (uint256) {\\n if (currency.isNative()) return address(this).balance;\\n else return IERC20(Currency.unwrap(currency)).balanceOf(address(this));\\n }\\n\\n function equals(Currency currency, Currency other) internal pure returns (bool) {\\n return Currency.unwrap(currency) == Currency.unwrap(other);\\n }\\n\\n function isNative(Currency currency) internal pure returns (bool) {\\n return Currency.unwrap(currency) == Currency.unwrap(NATIVE);\\n }\\n\\n function toId(Currency currency) internal pure returns (uint256) {\\n return uint160(Currency.unwrap(currency));\\n }\\n\\n function fromId(uint256 id) internal pure returns (Currency) {\\n return Currency.wrap(address(uint160(id)));\\n }\\n}\\n\",\"keccak256\":\"0xf04f76015a51981ad0f84fd3ebb0a4eb6c31685604c22584669915aa8dd7ac54\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/FeePolicy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"./Math.sol\\\";\\n\\ntype FeePolicy is uint24;\\n\\nlibrary FeePolicyLibrary {\\n uint256 internal constant RATE_PRECISION = 10 ** 6;\\n int256 internal constant MAX_FEE_RATE = 500000;\\n int256 internal constant MIN_FEE_RATE = -500000;\\n\\n uint256 internal constant RATE_MASK = 0x7fffff; // 23 bits\\n\\n error InvalidFeePolicy();\\n\\n function encode(bool usesQuote_, int24 rate_) internal pure returns (FeePolicy feePolicy) {\\n if (rate_ > MAX_FEE_RATE || rate_ < MIN_FEE_RATE) {\\n revert InvalidFeePolicy();\\n }\\n\\n uint256 mask = usesQuote_ ? 1 << 23 : 0;\\n assembly {\\n feePolicy := or(mask, add(and(rate_, 0xffffff), MAX_FEE_RATE))\\n }\\n }\\n\\n function isValid(FeePolicy self) internal pure returns (bool) {\\n int24 r = rate(self);\\n\\n return !(r > MAX_FEE_RATE || r < MIN_FEE_RATE);\\n }\\n\\n function usesQuote(FeePolicy self) internal pure returns (bool f) {\\n assembly {\\n f := shr(23, self)\\n }\\n }\\n\\n function rate(FeePolicy self) internal pure returns (int24 r) {\\n assembly {\\n r := sub(and(self, RATE_MASK), MAX_FEE_RATE)\\n }\\n }\\n\\n function calculateFee(FeePolicy self, uint256 amount, bool reverseRounding) internal pure returns (int256 fee) {\\n int24 r = rate(self);\\n\\n bool positive = r > 0;\\n uint256 absRate;\\n unchecked {\\n absRate = uint256(uint24(positive ? r : -r));\\n }\\n // @dev absFee must be less than type(int256).max\\n uint256 absFee = Math.divide(amount * absRate, RATE_PRECISION, reverseRounding ? !positive : positive);\\n fee = positive ? int256(absFee) : -int256(absFee);\\n }\\n\\n function calculateOriginalAmount(FeePolicy self, uint256 amount, bool reverseFee)\\n internal\\n pure\\n returns (uint256 originalAmount)\\n {\\n int24 r = rate(self);\\n\\n uint256 divider;\\n assembly {\\n if reverseFee { r := sub(0, r) }\\n divider := add(RATE_PRECISION, r)\\n }\\n originalAmount = Math.divide(amount * RATE_PRECISION, divider, false);\\n }\\n}\\n\",\"keccak256\":\"0x45537a74dd592cf875aa0270a0833dfe76f710a94c85d1ef58f450f1195f5887\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n function divide(uint256 a, uint256 b, bool roundingUp) internal pure returns (uint256 ret) {\\n // In the OrderBook contract code, b is never zero.\\n assembly {\\n ret := add(div(a, b), and(gt(mod(a, b), 0), roundingUp))\\n }\\n }\\n\\n /// @dev Returns `ln(x)`, denominated in `WAD`.\\n /// Credit to Remco Bloemen under MIT license: https://2\\u03c0.com/22/exp-ln\\n function lnWad(int256 x) internal pure returns (int256 r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n // We want to convert `x` from `10**18` fixed point to `2**96` fixed point.\\n // We do this by multiplying by `2**96 / 10**18`. But since\\n // `ln(x * C) = ln(x) + ln(C)`, we can simply do nothing here\\n // and add `ln(2**96 / 10**18)` at the end.\\n\\n // Compute `k = log2(x) - 96`, `r = 159 - k = 255 - log2(x) = 255 ^ log2(x)`.\\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\\n r := or(r, shl(3, lt(0xff, shr(r, x))))\\n // We place the check here for more optimal stack operations.\\n if iszero(sgt(x, 0)) {\\n mstore(0x00, 0x1615e638) // `LnWadUndefined()`.\\n revert(0x1c, 0x04)\\n }\\n // forgefmt: disable-next-item\\n r := xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)),\\n 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff))\\n\\n // Reduce range of x to (1, 2) * 2**96\\n // ln(2^k * x) = k * ln(2) + ln(x)\\n x := shr(159, shl(r, x))\\n\\n // Evaluate using a (8, 8)-term rational approximation.\\n // `p` is made monic, we will multiply by a scale factor later.\\n // forgefmt: disable-next-item\\n let p := sub( // This heavily nested expression is to avoid stack-too-deep for via-ir.\\n sar(96, mul(add(43456485725739037958740375743393,\\n sar(96, mul(add(24828157081833163892658089445524,\\n sar(96, mul(add(3273285459638523848632254066296,\\n x), x))), x))), x)), 11111509109440967052023855526967)\\n p := sub(sar(96, mul(p, x)), 45023709667254063763336534515857)\\n p := sub(sar(96, mul(p, x)), 14706773417378608786704636184526)\\n p := sub(mul(p, x), shl(96, 795164235651350426258249787498))\\n // We leave `p` in `2**192` basis so we don't need to scale it back up for the division.\\n\\n // `q` is monic by convention.\\n let q := add(5573035233440673466300451813936, x)\\n q := add(71694874799317883764090561454958, sar(96, mul(x, q)))\\n q := add(283447036172924575727196451306956, sar(96, mul(x, q)))\\n q := add(401686690394027663651624208769553, sar(96, mul(x, q)))\\n q := add(204048457590392012362485061816622, sar(96, mul(x, q)))\\n q := add(31853899698501571402653359427138, sar(96, mul(x, q)))\\n q := add(909429971244387300277376558375, sar(96, mul(x, q)))\\n\\n // `p / q` is in the range `(0, 0.125) * 2**96`.\\n\\n // Finalization, we need to:\\n // - Multiply by the scale factor `s = 5.549\\u2026`.\\n // - Add `ln(2**96 / 10**18)`.\\n // - Add `k * ln(2)`.\\n // - Multiply by `10**18 / 2**96 = 5**18 >> 78`.\\n\\n // The q polynomial is known not to have zeros in the domain.\\n // No scaling required because p is already `2**96` too large.\\n p := sdiv(p, q)\\n // Multiply by the scaling factor: `s * 5**18 * 2**96`, base is now `5**18 * 2**192`.\\n p := mul(1677202110996718588342820967067443963516166, p)\\n // Add `ln(2) * k * 5**18 * 2**192`.\\n // forgefmt: disable-next-item\\n p := add(mul(16597577552685614221487285958193947469193820559219878177908093499208371, sub(159, r)), p)\\n // Base conversion: mul `2**96 / (5**18 * 2**192)`.\\n r := sdiv(p, 302231454903657293676544000000000000000000)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb2dc502dd66a9e36e6c4bb8c4fb3d21120f9f0ff7a934dcfe21ec820cac72275\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/OrderId.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.0;\\n\\nimport {Tick} from \\\"./Tick.sol\\\";\\nimport {BookId} from \\\"./BookId.sol\\\";\\n\\ntype OrderId is uint256;\\n\\nlibrary OrderIdLibrary {\\n /**\\n * @dev Encode the order id.\\n * @param bookId The book id.\\n * @param tick The tick.\\n * @param index The index.\\n * @return id The order id.\\n */\\n function encode(BookId bookId, Tick tick, uint40 index) internal pure returns (OrderId id) {\\n // @dev If we just use tick at the assembly code, the code will convert tick into bytes32.\\n // e.g. When index == -2, the shifted value( shl(40, tick) ) will be\\n // 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000 instead of 0xfffffffe0000000000\\n // Therefore, we have to safely cast tick into uint256 first.\\n uint256 _tick = uint256(uint24(Tick.unwrap(tick)));\\n assembly {\\n id := add(index, add(shl(40, _tick), shl(64, bookId)))\\n }\\n }\\n\\n function decode(OrderId id) internal pure returns (BookId bookId, Tick tick, uint40 index) {\\n assembly {\\n bookId := shr(64, id)\\n tick := and(shr(40, id), 0xffffff)\\n index := and(id, 0xffffffffff)\\n }\\n }\\n\\n function getBookId(OrderId id) internal pure returns (BookId bookId) {\\n assembly {\\n bookId := shr(64, id)\\n }\\n }\\n\\n function getTick(OrderId id) internal pure returns (Tick tick) {\\n assembly {\\n tick := and(shr(40, id), 0xffffff)\\n }\\n }\\n\\n function getIndex(OrderId id) internal pure returns (uint40 index) {\\n assembly {\\n index := and(id, 0xffffffffff)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x78c384badc4971d774987c6f5bce9d578712c7469688735b3c1eafaf2e748fe6\",\"license\":\"GPL-2.0-or-later\"},\"v2-core/libraries/Tick.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"./Math.sol\\\";\\n\\ntype Tick is int24;\\n\\nlibrary TickLibrary {\\n using Math for *;\\n using TickLibrary for Tick;\\n\\n error InvalidTick();\\n error InvalidPrice();\\n error TickOverflow();\\n\\n int24 internal constant MAX_TICK = 2 ** 19 - 1;\\n int24 internal constant MIN_TICK = -MAX_TICK;\\n\\n uint256 internal constant MIN_PRICE = 1350587;\\n uint256 internal constant MAX_PRICE = 4647684107270898330752324302845848816923571339324334;\\n\\n uint256 private constant _R0 = 0xfff97272373d413259a46990;\\n uint256 private constant _R1 = 0xfff2e50f5f656932ef12357c;\\n uint256 private constant _R2 = 0xffe5caca7e10e4e61c3624ea;\\n uint256 private constant _R3 = 0xffcb9843d60f6159c9db5883;\\n uint256 private constant _R4 = 0xff973b41fa98c081472e6896;\\n uint256 private constant _R5 = 0xff2ea16466c96a3843ec78b3;\\n uint256 private constant _R6 = 0xfe5dee046a99a2a811c461f1;\\n uint256 private constant _R7 = 0xfcbe86c7900a88aedcffc83b;\\n uint256 private constant _R8 = 0xf987a7253ac413176f2b074c;\\n uint256 private constant _R9 = 0xf3392b0822b70005940c7a39;\\n uint256 private constant _R10 = 0xe7159475a2c29b7443b29c7f;\\n uint256 private constant _R11 = 0xd097f3bdfd2022b8845ad8f7;\\n uint256 private constant _R12 = 0xa9f746462d870fdf8a65dc1f;\\n uint256 private constant _R13 = 0x70d869a156d2a1b890bb3df6;\\n uint256 private constant _R14 = 0x31be135f97d08fd981231505;\\n uint256 private constant _R15 = 0x9aa508b5b7a84e1c677de54;\\n uint256 private constant _R16 = 0x5d6af8dedb81196699c329;\\n uint256 private constant _R17 = 0x2216e584f5fa1ea92604;\\n uint256 private constant _R18 = 0x48a170391f7dc42;\\n uint256 private constant _R19 = 0x149b34;\\n\\n function validateTick(Tick tick) internal pure {\\n if (Tick.unwrap(tick) > MAX_TICK || Tick.unwrap(tick) < MIN_TICK) revert InvalidTick();\\n }\\n\\n modifier validatePrice(uint256 price) {\\n if (price > MAX_PRICE || price < MIN_PRICE) revert InvalidPrice();\\n _;\\n }\\n\\n function fromPrice(uint256 price) internal pure validatePrice(price) returns (Tick) {\\n unchecked {\\n int24 tick = int24((int256(price).lnWad() * 42951820407860) / 2 ** 128);\\n if (toPrice(Tick.wrap(tick)) > price) return Tick.wrap(tick - 1);\\n return Tick.wrap(tick);\\n }\\n }\\n\\n function toPrice(Tick tick) internal pure returns (uint256 price) {\\n validateTick(tick);\\n int24 tickValue = Tick.unwrap(tick);\\n uint256 absTick = uint24(tickValue < 0 ? -tickValue : tickValue);\\n\\n unchecked {\\n if (absTick & 0x1 != 0) price = _R0;\\n else price = 1 << 96;\\n if (absTick & 0x2 != 0) price = (price * _R1) >> 96;\\n if (absTick & 0x4 != 0) price = (price * _R2) >> 96;\\n if (absTick & 0x8 != 0) price = (price * _R3) >> 96;\\n if (absTick & 0x10 != 0) price = (price * _R4) >> 96;\\n if (absTick & 0x20 != 0) price = (price * _R5) >> 96;\\n if (absTick & 0x40 != 0) price = (price * _R6) >> 96;\\n if (absTick & 0x80 != 0) price = (price * _R7) >> 96;\\n if (absTick & 0x100 != 0) price = (price * _R8) >> 96;\\n if (absTick & 0x200 != 0) price = (price * _R9) >> 96;\\n if (absTick & 0x400 != 0) price = (price * _R10) >> 96;\\n if (absTick & 0x800 != 0) price = (price * _R11) >> 96;\\n if (absTick & 0x1000 != 0) price = (price * _R12) >> 96;\\n if (absTick & 0x2000 != 0) price = (price * _R13) >> 96;\\n if (absTick & 0x4000 != 0) price = (price * _R14) >> 96;\\n if (absTick & 0x8000 != 0) price = (price * _R15) >> 96;\\n if (absTick & 0x10000 != 0) price = (price * _R16) >> 96;\\n if (absTick & 0x20000 != 0) price = (price * _R17) >> 96;\\n if (absTick & 0x40000 != 0) price = (price * _R18) >> 96;\\n }\\n if (tickValue > 0) price = 0x1000000000000000000000000000000000000000000000000 / price;\\n }\\n\\n function gt(Tick a, Tick b) internal pure returns (bool) {\\n return Tick.unwrap(a) > Tick.unwrap(b);\\n }\\n\\n function baseToQuote(Tick tick, uint256 base, bool roundingUp) internal pure returns (uint256) {\\n return Math.divide((base * tick.toPrice()), 1 << 96, roundingUp);\\n }\\n\\n function quoteToBase(Tick tick, uint256 quote, bool roundingUp) internal pure returns (uint256) {\\n // @dev quote = unit(uint64) * unitSize(uint64) < 2^96\\n // We don't need to check overflow here\\n return Math.divide(quote << 96, tick.toPrice(), roundingUp);\\n }\\n}\\n\",\"keccak256\":\"0xffbe19efd2b2e4e1eee3ed15c9363f5c45d70a6058b0b85ec9199e34de3b6b9b\",\"license\":\"GPL-2.0-or-later\"}},\"version\":1}", + "bytecode": "0x60a0604052348015600e575f80fd5b5060405161582e38038061582e833981016040819052602b91603b565b6001600160a01b03166080526066565b5f60208284031215604a575f80fd5b81516001600160a01b0381168114605f575f80fd5b9392505050565b60805161569f61018f5f395f818161017a015281816104e601528181610585015281816107690152818161094701528181610a8e01528181610c1e01528181610caf01528181610d7901528181610ed401528181611147015281816113ac01528181611769015281816119b101528181611a7401528181611ed001528181611f5801528181612038015281816121eb0152818161228e0152818161232901528181612436015281816125840152818161261d015281816126bf015281816127dc01528181612931015281816129ab01528181612a4f01528181612b4a01528181612bc201528181612c1a01528181612cab01528181612d6501528181612e0f01528181612e8a01528181612f0401528181612f950152818161300a01526135ed015261569f5ff3fe6080604052600436106100e7575f3560e01c80637658ab0511610087578063a183a10411610057578063a183a10414610295578063c0e8e89a146102b4578063d09ef241146102c7578063fe81574614610310575f80fd5b80637658ab05146102245780637d773110146102445780638feb85b714610257578063a04c796b14610276575f80fd5b80633f322bc9116100c25780633f322bc91461016957806341a8bb88146101b4578063483f9f2f146101d35780635083585814610205575f80fd5b806309ae2c13146100f257806315c7afb4146101075780631ae45a121461013c575f80fd5b366100ee57005b5f80fd5b610105610100366004613e49565b610323565b005b348015610112575f80fd5b50610126610121366004613ffa565b610570565b60405161013391906140b4565b60405180910390f35b348015610147575f80fd5b5061015b6101563660046140da565b610bf2565b604051908152602001610133565b348015610174575f80fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610133565b3480156101bf575f80fd5b5061015b6101ce36600461410e565b610c8f565b3480156101de575f80fd5b506101f26101ed366004614145565b610dfc565b60405160029190910b8152602001610133565b348015610210575f80fd5b5061015b61021f36600461415c565b610e06565b6102376102323660046141b7565b610e13565b60405161013391906142ab565b610237610252366004613e49565b610f80565b348015610262575f80fd5b506101056102713660046142ee565b6111eb565b348015610281575f80fd5b506101056102903660046142ee565b611434565b3480156102a0575f80fd5b506101056102af36600461436f565b6115b3565b6101056102c2366004613e49565b6117ee565b3480156102d2575f80fd5b506102e66102e1366004614145565b61196f565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610133565b61023761031e366004613e49565b611b90565b80806001600160401b031642111561034e5760405163637910d560e11b815260040160405180910390fd5b838361035a8282611d13565b885f816001600160401b0381111561037457610374613f02565b60405190808252806020026020018201604052801561039d578160200160208202803683370190505b5090505f826001600160401b038111156103b9576103b9613f02565b6040519080825280602002602001820160405280156103ec57816020015b60608152602001906001900390816103d75790505b5090505f5b838110156104a457600383828151811061040d5761040d6143c1565b60200260200101906006811115610426576104266143d5565b90816006811115610439576104396143d5565b9052508d8d8281811061044e5761044e6143c1565b905060200281019061046091906143e9565b60405160200161047091906144d2565b604051602081830303815290604052828281518110610491576104916143c1565b60209081029190910101526001016103f1565b505f3383838e8e6040516020016104bf9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061051d9030908590600401614625565b5f604051808303815f875af1158015610538573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261055f9190810190614693565b505050505050505050505050505050565b606061057a611e1a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415806105bb57506001600160a01b0383163014155b156105f2576040517fc0185c6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805f808580602001905181019061060a91906147dc565b8251939750919550935091505f816001600160401b0381111561062f5761062f613f02565b604051908082528060200260200182016040528015610658578160200160208202803683370190505b5090505f805b83811015610bad575f878281518110610679576106796143c1565b602002602001015190505f6006811115610695576106956143d5565b8160068111156106a7576106a76143d5565b036106e6576106e18783815181106106c1576106c16143c1565b60200260200101518060200190518101906106dc919061498f565b611e99565b610ba4565b60018160068111156106fa576106fa6143d5565b036107f2575f610735888481518110610715576107156143c1565b60200260200101518060200190518101906107309190614a1e565b611f33565b905080156107ec576040516323b872dd60e01b81523060048201526001600160a01b038b81166024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064015f604051808303815f87803b1580156107aa575f80fd5b505af11580156107bc573d5f803e3d5ffd5b50505050808585806107cd90614ac9565b9650815181106107df576107df6143c1565b6020026020010181815250505b50610ba4565b6002816006811115610806576108066143d5565b03610841575f610735888481518110610821576108216143c1565b602002602001015180602001905181019061083c9190614ae1565b61210c565b6003816006811115610855576108556143d5565b036108965761088f87838151811061086f5761086f6143c1565b602002602001015180602001905181019061088a9190614c47565b6121c4565b5050610ba4565b60048160068111156108aa576108aa6143d5565b036108e45761088f8783815181106108c4576108c46143c1565b60200260200101518060200190518101906108df9190614c47565b612553565b60058160068111156108f8576108f86143d5565b03610a2b575f878381518110610910576109106143c1565b602002602001015180602001905181019061092b9190614c78565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa15801561099c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c09190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610a0c575f80fd5b505afa158015610a1e573d5f803e3d5ffd5b5050505061088f826128fa565b6006816006811115610a3f57610a3f6143d5565b03610b72575f878381518110610a5757610a576143c1565b6020026020010151806020019051810190610a729190614ce9565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa158015610ae3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b079190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610b53575f80fd5b505afa158015610b65573d5f803e3d5ffd5b5050505061088f826129a8565b6040517f4a7f394f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060010161065e565b50610bb88785612b22565b80825281604051602001610bcc91906142ab565b604051602081830303815290604052975050505050505050610bec613213565b92915050565b60405163cdc92f2d60e01b81526001600160c01b03821660048201525f90610bec906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cdc92f2d90602401602060405180830381865afa158015610c63573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c879190614d64565b60020b613238565b604051639b22917d60e01b81526001600160c01b03831660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190614d7f565b602001516040517f41a8bb880000000000000000000000000000000000000000000000000000000081526001600160c01b0385166004820152600284900b60248201526001600160401b03909116906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610dbe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de29190614d99565b6001600160401b0316610df59190614db4565b9392505050565b5f610bec826134f6565b5f610bec8260020b613238565b606081806001600160401b0316421115610e405760405163637910d560e11b815260040160405180910390fd5b8b8a14610e79576040517f947d5a8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e838787611d13565b610e8d85856135ab565b5f338e8e8e8e8e8e604051602001610eab9796959493929190614dcb565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca1799890610f0b9030908690600401614625565b5f604051808303815f875af1158015610f26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f4d9190810190614693565b905080515f14610f6e5780806020019051810190610f6b9190614e9a565b93505b5050509b9a5050505050505050505050565b606081806001600160401b0316421115610fad5760405163637910d560e11b815260040160405180910390fd5b8484610fb98282611d13565b895f816001600160401b03811115610fd357610fd3613f02565b604051908082528060200260200182016040528015610ffc578160200160208202803683370190505b5090505f826001600160401b0381111561101857611018613f02565b60405190808252806020026020018201604052801561104b57816020015b60608152602001906001900390816110365790505b5090505f5b8381101561110357600183828151811061106c5761106c6143c1565b60200260200101906006811115611085576110856143d5565b90816006811115611098576110986143d5565b9052508e8e828181106110ad576110ad6143c1565b90506020028101906110bf9190614f25565b6040516020016110cf9190614f39565b6040516020818303038152906040528282815181106110f0576110f06143c1565b6020908102919091010152600101611050565b505f3383838f8f60405160200161111e9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061117e9030908690600401614625565b5f604051808303815f875af1158015611199573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111c09190810190614693565b9050808060200190518101906111d69190614e9a565b98505050505050505050979650505050505050565b80806001600160401b03164211156112165760405163637910d560e11b815260040160405180910390fd5b61122084846135ab565b865f816001600160401b0381111561123a5761123a613f02565b604051908082528060200260200182016040528015611263578160200160208202803683370190505b5090505f826001600160401b0381111561127f5761127f613f02565b6040519080825280602002602001820160405280156112b257816020015b606081526020019060019003908161129d5790505b5090505f5b8381101561136a5760058382815181106112d3576112d36143c1565b602002602001019060068111156112ec576112ec6143d5565b908160068111156112ff576112ff6143d5565b9052508b8b82818110611314576113146143c1565b90506020028101906113269190614f9c565b6040516020016113369190614fb0565b604051602081830303815290604052828281518110611357576113576143c1565b60209081029190910101526001016112b7565b505f3383838c8c6040516020016113859594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906113e39030908590600401614625565b5f604051808303815f875af11580156113fe573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114259190810190614693565b50505050505050505050505050565b80806001600160401b031642111561145f5760405163637910d560e11b815260040160405180910390fd5b61146984846135ab565b865f816001600160401b0381111561148357611483613f02565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b5090505f826001600160401b038111156114c8576114c8613f02565b6040519080825280602002602001820160405280156114fb57816020015b60608152602001906001900390816114e65790505b5090505f5b8381101561136a57600683828151811061151c5761151c6143c1565b60200260200101906006811115611535576115356143d5565b90816006811115611548576115486143d5565b9052508b8b8281811061155d5761155d6143c1565b905060200281019061156f9190614fdd565b60405160200161157f9190614ff1565b6040516020818303038152906040528282815181106115a0576115a06143c1565b6020908102919091010152600101611500565b80806001600160401b03164211156115de5760405163637910d560e11b815260040160405180910390fd5b825f816001600160401b038111156115f8576115f8613f02565b604051908082528060200260200182016040528015611621578160200160208202803683370190505b5090505f826001600160401b0381111561163d5761163d613f02565b60405190808252806020026020018201604052801561167057816020015b606081526020019060019003908161165b5790505b5090505f5b83811015611727575f838281518110611690576116906143c1565b602002602001019060068111156116a9576116a96143d5565b908160068111156116bc576116bc6143d5565b9052508787828181106116d1576116d16143c1565b90506020028101906116e39190615028565b6040516020016116f39190615052565b604051602081830303815290604052828281518110611714576117146143c1565b6020908102919091010152600101611675565b5060605f338484846040516020016117429493929190615119565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906117a09030908590600401614625565b5f604051808303815f875af11580156117bb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117e29190810190614693565b50505050505050505050565b80806001600160401b03164211156118195760405163637910d560e11b815260040160405180910390fd5b83836118258282611d13565b885f816001600160401b0381111561183f5761183f613f02565b604051908082528060200260200182016040528015611868578160200160208202803683370190505b5090505f826001600160401b0381111561188457611884613f02565b6040519080825280602002602001820160405280156118b757816020015b60608152602001906001900390816118a25790505b5090505f5b838110156104a45760048382815181106118d8576118d86143c1565b602002602001019060068111156118f1576118f16143d5565b90816006811115611904576119046143d5565b9052508d8d82818110611919576119196143c1565b905060200281019061192b91906143e9565b60405160200161193b91906144d2565b60405160208183030381529060405282828151811061195c5761195c6143c1565b60209081029190910101526001016118bc565b5f8080808080604087901c62ffffff602889901c16604051639b22917d60e01b81526001600160c01b038316600482015291935091505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156119f6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1a9190614d7f565b60208101519091506001600160401b0316611a38600284900b613238565b6040517fd09ef241000000000000000000000000000000000000000000000000000000008152600481018b90529097505f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d09ef24190602401606060405180830381865afa158015611ab9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611add9190615197565b80516020820151909a50909150611afd906001600160401b031683614db4565b6060840151604083015191985090611b2e90611b22906001600160401b031685614db4565b600287900b905f6136c2565b9650611b3f8162ffffff1660171c90565b611b83575f611b5462ffffff831689836136ec565b90505f8113611b7557611b66816151e9565b611b70908961521f565b611b7f565b611b7f8189615232565b9750505b5050505050509193509193565b606081806001600160401b0316421115611bbd5760405163637910d560e11b815260040160405180910390fd5b8484611bc98282611d13565b895f816001600160401b03811115611be357611be3613f02565b604051908082528060200260200182016040528015611c0c578160200160208202803683370190505b5090505f826001600160401b03811115611c2857611c28613f02565b604051908082528060200260200182016040528015611c5b57816020015b6060815260200190600190039081611c465790505b5090505f5b83811015611103576002838281518110611c7c57611c7c6143c1565b60200260200101906006811115611c9557611c956143d5565b90816006811115611ca857611ca86143d5565b9052508e8e82818110611cbd57611cbd6143c1565b9050602002810190611ccf9190615028565b604051602001611cdf9190615245565b604051602081830303815290604052828281518110611d0057611d006143c1565b6020908102919091010152600101611c60565b5f5b81811015611e15575f838383818110611d3057611d306143c1565b905060c00201803603810190611d46919061534f565b60408101515190915015611e0c5780516020808301516040808501518051938101518183015160609092015192517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810194909452606484019490945260ff909316608483015260a482019290925260c48101919091526001600160a01b039091169063d505accf9060e4015f604051808303815f87803b158015611df9575f80fd5b505af1925050508015611e0a575060015b505b50600101611d15565b505050565b7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45c15611e73576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60017f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b805160208201516040517ffefc7c510000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263fefc7c5192611f039260040161538b565b5f604051808303815f87803b158015611f1a575f80fd5b505af1158015611f2c573d5f803e3d5ffd5b5050505050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f9081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015611fa5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc99190614d7f565b90505f83604001519050611fe6826060015162ffffff1660171c90565b156120035760608201516120009062ffffff16825f61376c565b90505b5f61202583602001516001600160401b0316836120209190615416565b6137b0565b90506001600160401b03811615612104577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631dbef4886040518060800160405280868152602001886020015160020b8152602001846001600160401b031681526020015f6001600160a01b031681525087606001516040518363ffffffff1660e01b81526004016120c1929190615435565b60408051808303815f875af11580156120dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061210091906154e3565b5093505b505050919050565b5f805f6121566040518060a00160405280865f01516001600160c01b0316815260200186604001518152602001866080015181526020015f81526020018660a00151815250612553565b91509150808460800181815161216c9190615232565b90525081156121bd576121ba604051806080016040528086602001516001600160c01b03168152602001866060015160020b8152602001866080015181526020018660c00151815250611f33565b92505b5050919050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015612238573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061225c9190614d7f565b90505b8284604001511180156123015750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156122db573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122ff9190615505565b155b1561252857835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612376573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239a9190614d64565b90506123a88160020b613238565b856020015111156123b95750612528565b5f6123cd8360a0015162ffffff1660171c90565b156123fe576123f78587604001510360018560a0015162ffffff1661376c9092919063ffffffff16565b9050612408565b8486604001510390505b60208301516001600160401b03168082049082061515600116019050805f03612432575050612528565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612486876137b0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b81526004016124b4929190615524565b60408051808303815f875af11580156124cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124f391906154e3565b91509150815f036125075750505050612528565b612511828861521f565b965061251d818761521f565b95505050505061225f565b818460600151101561254d57604051630f271b5560e41b815260040160405180910390fd5b50915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f908190819081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156125c9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125ed9190614d7f565b90505b84604001518310156128ce57845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa15801561266a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061268e9190615505565b1561269c57600193506128ce565b845160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa15801561270c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127309190614d64565b905061273e8160020b613238565b866020015111156127535760019450506128ce565b5f6127678360a0015162ffffff1660171c90565b1561277a578487604001510390506127a1565b61279e858860400151035f8560a0015162ffffff1661376c9092919063ffffffff16565b90505b60208301516001600160401b03166127be600284900b835f613807565b6127c89190615416565b9050805f036127d85750506128ce565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b815260200161282c876137b0565b6001600160401b03168152508b608001516040518363ffffffff1660e01b815260040161285a929190615524565b60408051808303815f875af1158015612875573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061289991906154e3565b91509150805f036128ad57505050506128ce565b6128b7828761521f565b95506128c3818861521f565b9650505050506125f0565b81856060015111156128f357604051630f271b5560e41b815260040160405180910390fd5b5050915091565b805160208201516040517f38926b6d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926338926b6d92612964926004016155be565b6020604051808303815f875af1158015612980573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129a491906155d6565b5050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b22917d6129e5845f015160401c90565b6040516001600160e01b031960e084901b1681526001600160c01b03909116600482015260240160c060405180830381865afa158015612a27573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a4b9190614d7f565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166314d6a9eb6040518060400160405280855f01518152602001612ab085602001516001600160401b031687602001516120209190615416565b6001600160401b031681525084604001516040518363ffffffff1660e01b8152600401612ade9291906155ed565b6020604051808303815f875af1925050508015612b18575060408051601f3d908101601f19168201909252612b15918101906155d6565b60015b156129a457505050565b60405163258473db60e21b81523060048201525f602482018190529081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612b8f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612bb391906155d6565b90505f811215612c8657612bfb7f0000000000000000000000000000000000000000000000000000000000000000612bea836151e9565b6001600160a01b0385169190613849565b604051636a256b2960e01b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612c60573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c8491906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0383811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612cf0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d1491906155d6565b90505f811315612dbd576040517fd9caed120000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528581166024830152604482018390527f0000000000000000000000000000000000000000000000000000000000000000169063d9caed12906064015f604051808303815f87803b158015612da6575f80fd5b505af1158015612db8573d5f803e3d5ffd5b505050505b82515f5b818110156131f8575f858281518110612ddc57612ddc6143c1565b602090810291909101015160405163258473db60e21b81523060048201526001600160a01b0380831660248301529192507f000000000000000000000000000000000000000000000000000000000000000090911690639611cf6c90604401602060405180830381865afa158015612e56573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e7a91906155d6565b93505f841215612f7057612ee5877f0000000000000000000000000000000000000000000000000000000000000000612eb2876151e9565b898681518110612ec457612ec46143c1565b60200260200101516001600160a01b0316613918909392919063ffffffff16565b604051636a256b2960e01b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612f4a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f6e91906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612fda573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ffe91906155d6565b93505f8413156130b8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed12878481518110613049576130496143c1565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908a166024820152604481018790526064015f604051808303815f87803b1580156130a1575f80fd5b505af11580156130b3573d5f803e3d5ffd5b505050505b5f8683815181106130cb576130cb6143c1565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613132573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061315691906155d6565b905080156131ee57868381518110613170576131706143c1565b602090810291909101015160405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af11580156131c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ec9190615505565b505b5050600101612dc1565b504715611f2c57611f2c6001600160a01b0384168647613849565b5f7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b5f61324282613987565b815f600282900b8113613255578161325e565b61325e82615619565b62ffffff8116915060011615613282576bfff97272373d413259a469909250613293565b6c0100000000000000000000000092505b60028116156132b25760606bfff2e50f5f656932ef12357c8402901c92505b60048116156132d15760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156132f05760606bffcb9843d60f6159c9db58838402901c92505b601081161561330f5760606bff973b41fa98c081472e68968402901c92505b602081161561332e5760606bff2ea16466c96a3843ec78b38402901c92505b604081161561334d5760606bfe5dee046a99a2a811c461f18402901c92505b608081161561336c5760606bfcbe86c7900a88aedcffc83b8402901c92505b61010081161561338c5760606bf987a7253ac413176f2b074c8402901c92505b6102008116156133ac5760606bf3392b0822b70005940c7a398402901c92505b6104008116156133cc5760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156133ec5760606bd097f3bdfd2022b8845ad8f78402901c92505b61100081161561340c5760606ba9f746462d870fdf8a65dc1f8402901c92505b61200081161561342c5760606b70d869a156d2a1b890bb3df68402901c92505b61400081161561344c5760606b31be135f97d08fd9812315058402901c92505b61800081161561346c5760606b09aa508b5b7a84e1c677de548402901c92505b6201000081161561348c5760606a5d6af8dedb81196699c3298402901c92505b620200008116156134ab576060692216e584f5fa1ea926048402901c92505b620400008116156134c857606067048a170391f7dc428402901c92505b5f8260020b13156121bd576121ba837801000000000000000000000000000000000000000000000000615416565b5f81750c6c1313451aab317fb9b67e11777e9a5a6ccdb2ebae81118061351e575062149bbb81105b15613554576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f700100000000000000000000000000000000613570856139e6565b6527107fff7434028161358557613585615402565b0590508361359282613238565b11156135a2575f190191506135a5565b91505b50919050565b5f5b81811015611e15575f8383838181106135c8576135c86143c1565b905060a002016020018036038101906135e19190615639565b8051909150156136b9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637ac2ff7b3086868681811061362d5761362d6143c1565b865160208801516040808a015160608b015191516001600160e01b031960e08b901b1681526001600160a01b03909816600489015260a090940295909501356024870152604486019190915260ff16606485015260848401525060a482015260c4015f604051808303815f87803b1580156136a6575f80fd5b505af19250505080156136b7575060015b505b506001016135ad565b5f6136e4606084901b6136d78660020b613238565b8082061515851691040190565b949350505050565b5f6207a11f19627fffff851601600281900b8212828161370e57825f03613710565b825b62ffffff1690505f6137496137258389614db4565b620f42408861373b578581830615151691040190565b808206151586151691040190565b90508261375e57613759816151e9565b613760565b805b98975050505050505050565b5f6207a11f19627fffff85160181831561378657815f0391505b81620f42400190506137a6620f4240866137a09190614db4565b82900490565b9695505050505050565b5f6001600160401b0382111561380357604080517f6dfcc6500000000000000000000000000000000000000000000000000000000081526004810191909152602481018390526044015b60405180910390fd5b5090565b5f6136e46138178560020b613238565b6138219085614db4565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b5f6001600160a01b03841661389e575f805f8085875af1905080613899576040517ff4b3b1bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613912565b60405163a9059cbb60e01b81526001600160a01b038416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080613912576040517ff27f64e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b179052613912908590613bff565b6207ffff600282900b13806139ac57506139a36207ffff615619565b60020b8160020b125b156139e3576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6fffffffffffffffffffffffffffffffff811160071b81811c6001600160401b031060061b1781811c63ffffffff1060051b1781811c61ffff1060041b1781811c60ff1060031b175f8213613a4257631615e6385f526004601cfd5b7103782dace9d90000000000000000000000007ff8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff6f8421084210842108cc6318c6db6d54be84841c1c601f161a90911891821b609f90811c6c465772b2bbbb5f824b15207a3081018102606090811d6d0388eaa27412d5aca026815d636e018202811d6d0df99ac502031bf953eff472fdcc018202811d6d13cdffb29d51d99322bdff5f2211018202811d6d0a0f742023def783a307a986912e018202811d6d01920d8043ca89b5239253284e42018202811d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7883018302821d6d0139601a2efabe717e604cbb4894018302821d6d02247f7a7b6594320649aa03aba1018302821d6c8c3f38e95a6b1ff2ab1c3b343619018302821d6d02384773bdf1ac5676facced60901901830290911d6cb9a025d814b29c212b8b1a07cd19019091027ffffffffffffffff5f6af8f7b3396644f18e157960000000000000000000000000105711340daa0d5f769dba1915cef59f0815a5506029290037d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302919091010590565b5f613c136001600160a01b03841683613c79565b905080515f14158015613c37575080806020019051810190613c359190615505565b155b15611e15576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016137fa565b6060610df583835f845f80856001600160a01b03168486604051613c9d9190615653565b5f6040518083038185875af1925050503d805f8114613cd7576040519150601f19603f3d011682016040523d82523d5f602084013e613cdc565b606091505b50915091506137a6868383606082613cfc57613cf782613d5c565b610df5565b8151158015613d1357506001600160a01b0384163b155b15613d55576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016137fa565b5080610df5565b805115613d6c5780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8083601f840112613dae575f80fd5b5081356001600160401b03811115613dc4575f80fd5b6020830191508360208260051b8501011115613dde575f80fd5b9250929050565b5f8083601f840112613df5575f80fd5b5081356001600160401b03811115613e0b575f80fd5b60208301915083602060c083028501011115613dde575f80fd5b6001600160401b03811681146139e3575f80fd5b8035613e4481613e25565b919050565b5f805f805f805f6080888a031215613e5f575f80fd5b87356001600160401b0380821115613e75575f80fd5b613e818b838c01613d9e565b909950975060208a0135915080821115613e99575f80fd5b613ea58b838c01613d9e565b909750955060408a0135915080821115613ebd575f80fd5b50613eca8a828b01613de5565b9094509250506060880135613ede81613e25565b8091505092959891949750929550565b6001600160a01b03811681146139e3575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b0381118282101715613f3857613f38613f02565b60405290565b604051608081016001600160401b0381118282101715613f3857613f38613f02565b60405160e081016001600160401b0381118282101715613f3857613f38613f02565b604051606081016001600160401b0381118282101715613f3857613f38613f02565b604051601f8201601f191681016001600160401b0381118282101715613fcc57613fcc613f02565b604052919050565b5f6001600160401b03821115613fec57613fec613f02565b50601f01601f191660200190565b5f806040838503121561400b575f80fd5b823561401681613eee565b915060208301356001600160401b03811115614030575f80fd5b8301601f81018513614040575f80fd5b803561405361404e82613fd4565b613fa4565b818152866020838501011115614067575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610df56020830184614086565b6001600160c01b03811681146139e3575f80fd5b5f602082840312156140ea575f80fd5b8135610df5816140c6565b8060020b81146139e3575f80fd5b8035613e44816140f5565b5f806040838503121561411f575f80fd5b823561412a816140c6565b9150602083013561413a816140f5565b809150509250929050565b5f60208284031215614155575f80fd5b5035919050565b5f6020828403121561416c575f80fd5b8135610df5816140f5565b5f8083601f840112614187575f80fd5b5081356001600160401b0381111561419d575f80fd5b60208301915083602060a083028501011115613dde575f80fd5b5f805f805f805f805f805f60c08c8e0312156141d1575f80fd5b6001600160401b03808d3511156141e6575f80fd5b6141f38e8e358f01613d9e565b909c509a5060208d0135811015614208575f80fd5b6142188e60208f01358f01613d9e565b909a50985060408d013581101561422d575f80fd5b61423d8e60408f01358f01613d9e565b909850965060608d0135811015614252575f80fd5b6142628e60608f01358f01613de5565b909650945060808d0135811015614277575f80fd5b506142888d60808e01358e01614177565b909350915061429960a08d01613e39565b90509295989b509295989b9093969950565b602080825282518282018190525f9190848201906040850190845b818110156142e2578351835292840192918401916001016142c6565b50909695505050505050565b5f805f805f805f6080888a031215614304575f80fd5b87356001600160401b038082111561431a575f80fd5b6143268b838c01613d9e565b909950975060208a013591508082111561433e575f80fd5b61434a8b838c01613d9e565b909750955060408a0135915080821115614362575f80fd5b50613eca8a828b01614177565b5f805f60408486031215614381575f80fd5b83356001600160401b03811115614396575f80fd5b6143a286828701613d9e565b90945092505060208401356143b681613e25565b809150509250925092565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f8235609e198336030181126143fd575f80fd5b9190910192915050565b5f808335601e1984360301811261441c575f80fd5b83016020810192503590506001600160401b0381111561443a575f80fd5b803603821315613dde575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f813561447c816140c6565b6001600160c01b0381168452506020820135602084015260408201356040840152606082013560608401526144b46080830183614407565b60a060808601526144c960a086018284614448565b95945050505050565b602081525f610df56020830184614470565b5f6007821061450157634e487b7160e01b5f52602160045260245ffd5b50815260200190565b5f815180845260208085019450602084015f5b8381101561453e576145308783516144e4565b96509082019060010161451d565b509495945050505050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101561459457601f19868403018952614582838351614086565b98840198925090830190600101614566565b5090979650505050505050565b8183525f60208085019450825f5b8581101561453e5781356145c281613eee565b6001600160a01b0316875295820195908201906001016145af565b6001600160a01b0386168152608060208201525f6145fe608083018761450a565b82810360408401526146108187614549565b905082810360608401526137608185876145a1565b6001600160a01b0383168152604060208201525f6136e46040830184614086565b5f82601f830112614655575f80fd5b815161466361404e82613fd4565b818152846020838601011115614677575f80fd5b8160208501602083015e5f918101602001919091529392505050565b5f602082840312156146a3575f80fd5b81516001600160401b038111156146b8575f80fd5b6136e484828501614646565b5f6001600160401b038211156146dc576146dc613f02565b5060051b60200190565b600781106139e3575f80fd5b5f82601f830112614701575f80fd5b8151602061471161404e836146c4565b82815260059290921b8401810191818101908684111561472f575f80fd5b8286015b8481101561476c5780516001600160401b03811115614750575f80fd5b61475e8986838b0101614646565b845250918301918301614733565b509695505050505050565b5f82601f830112614786575f80fd5b8151602061479661404e836146c4565b8083825260208201915060208460051b8701019350868411156147b7575f80fd5b602086015b8481101561476c5780516147cf81613eee565b83529183019183016147bc565b5f805f80608085870312156147ef575f80fd5b84516147fa81613eee565b809450506020808601516001600160401b0380821115614818575f80fd5b818801915088601f83011261482b575f80fd5b815161483961404e826146c4565b81815260059190911b8301840190848101908b831115614857575f80fd5b938501935b8285101561487e57845161486f816146e6565b8252938501939085019061485c565b60408b01519098509450505080831115614896575f80fd5b6148a289848a016146f2565b945060608801519250808311156148b7575f80fd5b50506148c587828801614777565b91505092959194509250565b62ffffff811681146139e3575f80fd5b5f60c082840312156148f1575f80fd5b60405160c081018181106001600160401b038211171561491357614913613f02565b8060405250809150825161492681613eee565b8152602083015161493681613e25565b6020820152604083015161494981613eee565b6040820152606083015161495c816148d1565b6060820152608083015161496f81613eee565b608082015260a0830151614982816148d1565b60a0919091015292915050565b5f6020828403121561499f575f80fd5b81516001600160401b03808211156149b5575f80fd5b9083019060e082860312156149c8575f80fd5b6149d0613f16565b6149da86846148e1565b815260c0830151828111156149ed575f80fd5b6149f987828601614646565b60208301525095945050505050565b8051613e44816140c6565b8051613e44816140f5565b5f60208284031215614a2e575f80fd5b81516001600160401b0380821115614a44575f80fd5b9083019060808286031215614a57575f80fd5b614a5f613f3e565b8251614a6a816140c6565b81526020830151614a7a816140f5565b602082015260408381015190820152606083015182811115614a9a575f80fd5b614aa687828601614646565b60608301525095945050505050565b634e487b7160e01b5f52601160045260245ffd5b5f60018201614ada57614ada614ab5565b5060010190565b5f60208284031215614af1575f80fd5b81516001600160401b0380821115614b07575f80fd5b9083019060e08286031215614b1a575f80fd5b614b22613f60565b614b2b83614a08565b8152614b3960208401614a08565b602082015260408301516040820152614b5460608401614a13565b60608201526080830151608082015260a083015182811115614b74575f80fd5b614b8087828601614646565b60a08301525060c083015182811115614b97575f80fd5b614ba387828601614646565b60c08301525095945050505050565b5f60a08284031215614bc2575f80fd5b60405160a081016001600160401b038282108183111715614be557614be5613f02565b8160405282935084519150614bf9826140c6565b8183526020850151602084015260408501516040840152606085015160608401526080850151915080821115614c2d575f80fd5b50614c3a85828601614646565b6080830152505092915050565b5f60208284031215614c57575f80fd5b81516001600160401b03811115614c6c575f80fd5b6136e484828501614bb2565b5f60208284031215614c88575f80fd5b81516001600160401b0380821115614c9e575f80fd5b9083019060408286031215614cb1575f80fd5b614cb9613f16565b825181526020830151828111156149ed575f80fd5b5f60208284031215614cde575f80fd5b8151610df581613eee565b5f60208284031215614cf9575f80fd5b81516001600160401b0380821115614d0f575f80fd5b9083019060608286031215614d22575f80fd5b614d2a613f82565b8251815260208301516020820152604083015182811115614d49575f80fd5b614d5587828601614646565b60408301525095945050505050565b5f60208284031215614d74575f80fd5b8151610df5816140f5565b5f60c08284031215614d8f575f80fd5b610df583836148e1565b5f60208284031215614da9575f80fd5b8151610df581613e25565b8082028115828204841417610bec57610bec614ab5565b6001600160a01b0388168152608060208083018290529082018790525f90889060a08401835b8a811015614e1d578335614e04816146e6565b614e0e83826144e4565b94840194925050600101614df1565b5084810360408601528781528181019250600588901b81018201895f5b8a811015614e7457838303601f19018652614e55828d614407565b614e60858284614448565b978701979450505090840190600101614e3a565b50508581036060870152614e8981888a6145a1565b9d9c50505050505050505050505050565b5f6020808385031215614eab575f80fd5b82516001600160401b03811115614ec0575f80fd5b8301601f81018513614ed0575f80fd5b8051614ede61404e826146c4565b81815260059190911b82018301908381019087831115614efc575f80fd5b928401925b82841015614f1a57835182529284019290840190614f01565b979650505050505050565b5f8235607e198336030181126143fd575f80fd5b602081525f8235614f49816140c6565b6001600160c01b0381166020840152506020830135614f67816140f5565b8060020b60408401525060408301356060830152614f886060840184614407565b6080808501526144c960a085018284614448565b5f8235603e198336030181126143fd575f80fd5b60208152813560208201525f614fc96020840184614407565b6040808501526144c9606085018284614448565b5f8235605e198336030181126143fd575f80fd5b6020815281356020820152602082013560408201525f6150146040840184614407565b6060808501526144c9608085018284614448565b5f823560de198336030181126143fd575f80fd5b8035613e44816148d1565b8035613e4481613eee565b602081525f823561506281613eee565b6001600160a01b0380821660208501526020850135915061508282613e25565b6001600160401b0382166040850152604085013591506150a182613eee565b166060838101919091528301356150b7816148d1565b62ffffff81166080840152506150cf60808401615047565b6001600160a01b03811660a0840152506150eb60a0840161503c565b62ffffff811660c08401525061510460c0840184614407565b60e0808501526144c961010085018284614448565b5f6001600160a01b03808716835260206080602085015261513d608085018861450a565b848103604086015261514f8188614549565b8581036060870152865180825260208089019350909101905f5b81811015615187578351861683529284019291840191600101615169565b50909a9950505050505050505050565b5f606082840312156151a7575f80fd5b6151af613f82565b82516151ba81613eee565b815260208301516151ca81613e25565b602082015260408301516151dd81613e25565b60408201529392505050565b5f7f8000000000000000000000000000000000000000000000000000000000000000820361521957615219614ab5565b505f0390565b80820180821115610bec57610bec614ab5565b81810381811115610bec57610bec614ab5565b602081525f8235615255816140c6565b6001600160c01b0381166020840152506020830135615273816140c6565b6001600160c01b0381166040840152506040830135606083015261529960608401614103565b6152a8608084018260020b9052565b50608083013560a08301526152c060a0840184614407565b60e060c08501526152d661010085018284614448565b9150506152e660c0850185614407565b848303601f190160e08601526137a6838284614448565b5f6080828403121561530d575f80fd5b615315613f3e565b905081358152602082013560ff8116811461532e575f80fd5b80602083015250604082013560408201526060820135606082015292915050565b5f60c0828403121561535f575f80fd5b615367613f82565b823561537281613eee565b8152602083810135908201526151dd84604085016152fd565b6153ed81846001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b60e060c08201525f6136e460e0830184614086565b634e487b7160e01b5f52601260045260245ffd5b5f8261543057634e487b7160e01b5f52601260045260245ffd5b500490565b5f61014061549c8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e08401526001600160a01b03606086015116610100840152806101208401526144c981840185614086565b5f80604083850312156154f4575f80fd5b505080516020909101519092909150565b5f60208284031215615515575f80fd5b81518015158114610df5575f80fd5b5f61012061558b8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e0840152806101008401526144c981840185614086565b828152604060208201525f6136e46040830184614086565b5f602082840312156155e6575f80fd5b5051919050565b825181526001600160401b036020840151166020820152606060408201525f6136e46060830184614086565b5f8160020b627fffff19810361563157615631614ab5565b5f0392915050565b5f60808284031215615649575f80fd5b610df583836152fd565b5f82518060208501845e5f92019182525091905056fea26469706673582212205d030babface628d41af975b2b7119f20ba2d315229ba63974efbe1f93407df064736f6c63430008190033", + "deployedBytecode": "0x6080604052600436106100e7575f3560e01c80637658ab0511610087578063a183a10411610057578063a183a10414610295578063c0e8e89a146102b4578063d09ef241146102c7578063fe81574614610310575f80fd5b80637658ab05146102245780637d773110146102445780638feb85b714610257578063a04c796b14610276575f80fd5b80633f322bc9116100c25780633f322bc91461016957806341a8bb88146101b4578063483f9f2f146101d35780635083585814610205575f80fd5b806309ae2c13146100f257806315c7afb4146101075780631ae45a121461013c575f80fd5b366100ee57005b5f80fd5b610105610100366004613e49565b610323565b005b348015610112575f80fd5b50610126610121366004613ffa565b610570565b60405161013391906140b4565b60405180910390f35b348015610147575f80fd5b5061015b6101563660046140da565b610bf2565b604051908152602001610133565b348015610174575f80fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610133565b3480156101bf575f80fd5b5061015b6101ce36600461410e565b610c8f565b3480156101de575f80fd5b506101f26101ed366004614145565b610dfc565b60405160029190910b8152602001610133565b348015610210575f80fd5b5061015b61021f36600461415c565b610e06565b6102376102323660046141b7565b610e13565b60405161013391906142ab565b610237610252366004613e49565b610f80565b348015610262575f80fd5b506101056102713660046142ee565b6111eb565b348015610281575f80fd5b506101056102903660046142ee565b611434565b3480156102a0575f80fd5b506101056102af36600461436f565b6115b3565b6101056102c2366004613e49565b6117ee565b3480156102d2575f80fd5b506102e66102e1366004614145565b61196f565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610133565b61023761031e366004613e49565b611b90565b80806001600160401b031642111561034e5760405163637910d560e11b815260040160405180910390fd5b838361035a8282611d13565b885f816001600160401b0381111561037457610374613f02565b60405190808252806020026020018201604052801561039d578160200160208202803683370190505b5090505f826001600160401b038111156103b9576103b9613f02565b6040519080825280602002602001820160405280156103ec57816020015b60608152602001906001900390816103d75790505b5090505f5b838110156104a457600383828151811061040d5761040d6143c1565b60200260200101906006811115610426576104266143d5565b90816006811115610439576104396143d5565b9052508d8d8281811061044e5761044e6143c1565b905060200281019061046091906143e9565b60405160200161047091906144d2565b604051602081830303815290604052828281518110610491576104916143c1565b60209081029190910101526001016103f1565b505f3383838e8e6040516020016104bf9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061051d9030908590600401614625565b5f604051808303815f875af1158015610538573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261055f9190810190614693565b505050505050505050505050505050565b606061057a611e1a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415806105bb57506001600160a01b0383163014155b156105f2576040517fc0185c6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805f808580602001905181019061060a91906147dc565b8251939750919550935091505f816001600160401b0381111561062f5761062f613f02565b604051908082528060200260200182016040528015610658578160200160208202803683370190505b5090505f805b83811015610bad575f878281518110610679576106796143c1565b602002602001015190505f6006811115610695576106956143d5565b8160068111156106a7576106a76143d5565b036106e6576106e18783815181106106c1576106c16143c1565b60200260200101518060200190518101906106dc919061498f565b611e99565b610ba4565b60018160068111156106fa576106fa6143d5565b036107f2575f610735888481518110610715576107156143c1565b60200260200101518060200190518101906107309190614a1e565b611f33565b905080156107ec576040516323b872dd60e01b81523060048201526001600160a01b038b81166024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064015f604051808303815f87803b1580156107aa575f80fd5b505af11580156107bc573d5f803e3d5ffd5b50505050808585806107cd90614ac9565b9650815181106107df576107df6143c1565b6020026020010181815250505b50610ba4565b6002816006811115610806576108066143d5565b03610841575f610735888481518110610821576108216143c1565b602002602001015180602001905181019061083c9190614ae1565b61210c565b6003816006811115610855576108556143d5565b036108965761088f87838151811061086f5761086f6143c1565b602002602001015180602001905181019061088a9190614c47565b6121c4565b5050610ba4565b60048160068111156108aa576108aa6143d5565b036108e45761088f8783815181106108c4576108c46143c1565b60200260200101518060200190518101906108df9190614c47565b612553565b60058160068111156108f8576108f86143d5565b03610a2b575f878381518110610910576109106143c1565b602002602001015180602001905181019061092b9190614c78565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa15801561099c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c09190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610a0c575f80fd5b505afa158015610a1e573d5f803e3d5ffd5b5050505061088f826128fa565b6006816006811115610a3f57610a3f6143d5565b03610b72575f878381518110610a5757610a576143c1565b6020026020010151806020019051810190610a729190614ce9565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa158015610ae3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b079190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610b53575f80fd5b505afa158015610b65573d5f803e3d5ffd5b5050505061088f826129a8565b6040517f4a7f394f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060010161065e565b50610bb88785612b22565b80825281604051602001610bcc91906142ab565b604051602081830303815290604052975050505050505050610bec613213565b92915050565b60405163cdc92f2d60e01b81526001600160c01b03821660048201525f90610bec906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cdc92f2d90602401602060405180830381865afa158015610c63573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c879190614d64565b60020b613238565b604051639b22917d60e01b81526001600160c01b03831660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190614d7f565b602001516040517f41a8bb880000000000000000000000000000000000000000000000000000000081526001600160c01b0385166004820152600284900b60248201526001600160401b03909116906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610dbe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de29190614d99565b6001600160401b0316610df59190614db4565b9392505050565b5f610bec826134f6565b5f610bec8260020b613238565b606081806001600160401b0316421115610e405760405163637910d560e11b815260040160405180910390fd5b8b8a14610e79576040517f947d5a8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e838787611d13565b610e8d85856135ab565b5f338e8e8e8e8e8e604051602001610eab9796959493929190614dcb565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca1799890610f0b9030908690600401614625565b5f604051808303815f875af1158015610f26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f4d9190810190614693565b905080515f14610f6e5780806020019051810190610f6b9190614e9a565b93505b5050509b9a5050505050505050505050565b606081806001600160401b0316421115610fad5760405163637910d560e11b815260040160405180910390fd5b8484610fb98282611d13565b895f816001600160401b03811115610fd357610fd3613f02565b604051908082528060200260200182016040528015610ffc578160200160208202803683370190505b5090505f826001600160401b0381111561101857611018613f02565b60405190808252806020026020018201604052801561104b57816020015b60608152602001906001900390816110365790505b5090505f5b8381101561110357600183828151811061106c5761106c6143c1565b60200260200101906006811115611085576110856143d5565b90816006811115611098576110986143d5565b9052508e8e828181106110ad576110ad6143c1565b90506020028101906110bf9190614f25565b6040516020016110cf9190614f39565b6040516020818303038152906040528282815181106110f0576110f06143c1565b6020908102919091010152600101611050565b505f3383838f8f60405160200161111e9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061117e9030908690600401614625565b5f604051808303815f875af1158015611199573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111c09190810190614693565b9050808060200190518101906111d69190614e9a565b98505050505050505050979650505050505050565b80806001600160401b03164211156112165760405163637910d560e11b815260040160405180910390fd5b61122084846135ab565b865f816001600160401b0381111561123a5761123a613f02565b604051908082528060200260200182016040528015611263578160200160208202803683370190505b5090505f826001600160401b0381111561127f5761127f613f02565b6040519080825280602002602001820160405280156112b257816020015b606081526020019060019003908161129d5790505b5090505f5b8381101561136a5760058382815181106112d3576112d36143c1565b602002602001019060068111156112ec576112ec6143d5565b908160068111156112ff576112ff6143d5565b9052508b8b82818110611314576113146143c1565b90506020028101906113269190614f9c565b6040516020016113369190614fb0565b604051602081830303815290604052828281518110611357576113576143c1565b60209081029190910101526001016112b7565b505f3383838c8c6040516020016113859594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906113e39030908590600401614625565b5f604051808303815f875af11580156113fe573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114259190810190614693565b50505050505050505050505050565b80806001600160401b031642111561145f5760405163637910d560e11b815260040160405180910390fd5b61146984846135ab565b865f816001600160401b0381111561148357611483613f02565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b5090505f826001600160401b038111156114c8576114c8613f02565b6040519080825280602002602001820160405280156114fb57816020015b60608152602001906001900390816114e65790505b5090505f5b8381101561136a57600683828151811061151c5761151c6143c1565b60200260200101906006811115611535576115356143d5565b90816006811115611548576115486143d5565b9052508b8b8281811061155d5761155d6143c1565b905060200281019061156f9190614fdd565b60405160200161157f9190614ff1565b6040516020818303038152906040528282815181106115a0576115a06143c1565b6020908102919091010152600101611500565b80806001600160401b03164211156115de5760405163637910d560e11b815260040160405180910390fd5b825f816001600160401b038111156115f8576115f8613f02565b604051908082528060200260200182016040528015611621578160200160208202803683370190505b5090505f826001600160401b0381111561163d5761163d613f02565b60405190808252806020026020018201604052801561167057816020015b606081526020019060019003908161165b5790505b5090505f5b83811015611727575f838281518110611690576116906143c1565b602002602001019060068111156116a9576116a96143d5565b908160068111156116bc576116bc6143d5565b9052508787828181106116d1576116d16143c1565b90506020028101906116e39190615028565b6040516020016116f39190615052565b604051602081830303815290604052828281518110611714576117146143c1565b6020908102919091010152600101611675565b5060605f338484846040516020016117429493929190615119565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906117a09030908590600401614625565b5f604051808303815f875af11580156117bb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117e29190810190614693565b50505050505050505050565b80806001600160401b03164211156118195760405163637910d560e11b815260040160405180910390fd5b83836118258282611d13565b885f816001600160401b0381111561183f5761183f613f02565b604051908082528060200260200182016040528015611868578160200160208202803683370190505b5090505f826001600160401b0381111561188457611884613f02565b6040519080825280602002602001820160405280156118b757816020015b60608152602001906001900390816118a25790505b5090505f5b838110156104a45760048382815181106118d8576118d86143c1565b602002602001019060068111156118f1576118f16143d5565b90816006811115611904576119046143d5565b9052508d8d82818110611919576119196143c1565b905060200281019061192b91906143e9565b60405160200161193b91906144d2565b60405160208183030381529060405282828151811061195c5761195c6143c1565b60209081029190910101526001016118bc565b5f8080808080604087901c62ffffff602889901c16604051639b22917d60e01b81526001600160c01b038316600482015291935091505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156119f6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1a9190614d7f565b60208101519091506001600160401b0316611a38600284900b613238565b6040517fd09ef241000000000000000000000000000000000000000000000000000000008152600481018b90529097505f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d09ef24190602401606060405180830381865afa158015611ab9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611add9190615197565b80516020820151909a50909150611afd906001600160401b031683614db4565b6060840151604083015191985090611b2e90611b22906001600160401b031685614db4565b600287900b905f6136c2565b9650611b3f8162ffffff1660171c90565b611b83575f611b5462ffffff831689836136ec565b90505f8113611b7557611b66816151e9565b611b70908961521f565b611b7f565b611b7f8189615232565b9750505b5050505050509193509193565b606081806001600160401b0316421115611bbd5760405163637910d560e11b815260040160405180910390fd5b8484611bc98282611d13565b895f816001600160401b03811115611be357611be3613f02565b604051908082528060200260200182016040528015611c0c578160200160208202803683370190505b5090505f826001600160401b03811115611c2857611c28613f02565b604051908082528060200260200182016040528015611c5b57816020015b6060815260200190600190039081611c465790505b5090505f5b83811015611103576002838281518110611c7c57611c7c6143c1565b60200260200101906006811115611c9557611c956143d5565b90816006811115611ca857611ca86143d5565b9052508e8e82818110611cbd57611cbd6143c1565b9050602002810190611ccf9190615028565b604051602001611cdf9190615245565b604051602081830303815290604052828281518110611d0057611d006143c1565b6020908102919091010152600101611c60565b5f5b81811015611e15575f838383818110611d3057611d306143c1565b905060c00201803603810190611d46919061534f565b60408101515190915015611e0c5780516020808301516040808501518051938101518183015160609092015192517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810194909452606484019490945260ff909316608483015260a482019290925260c48101919091526001600160a01b039091169063d505accf9060e4015f604051808303815f87803b158015611df9575f80fd5b505af1925050508015611e0a575060015b505b50600101611d15565b505050565b7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45c15611e73576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60017f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b805160208201516040517ffefc7c510000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263fefc7c5192611f039260040161538b565b5f604051808303815f87803b158015611f1a575f80fd5b505af1158015611f2c573d5f803e3d5ffd5b5050505050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f9081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015611fa5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc99190614d7f565b90505f83604001519050611fe6826060015162ffffff1660171c90565b156120035760608201516120009062ffffff16825f61376c565b90505b5f61202583602001516001600160401b0316836120209190615416565b6137b0565b90506001600160401b03811615612104577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631dbef4886040518060800160405280868152602001886020015160020b8152602001846001600160401b031681526020015f6001600160a01b031681525087606001516040518363ffffffff1660e01b81526004016120c1929190615435565b60408051808303815f875af11580156120dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061210091906154e3565b5093505b505050919050565b5f805f6121566040518060a00160405280865f01516001600160c01b0316815260200186604001518152602001866080015181526020015f81526020018660a00151815250612553565b91509150808460800181815161216c9190615232565b90525081156121bd576121ba604051806080016040528086602001516001600160c01b03168152602001866060015160020b8152602001866080015181526020018660c00151815250611f33565b92505b5050919050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015612238573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061225c9190614d7f565b90505b8284604001511180156123015750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156122db573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122ff9190615505565b155b1561252857835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612376573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239a9190614d64565b90506123a88160020b613238565b856020015111156123b95750612528565b5f6123cd8360a0015162ffffff1660171c90565b156123fe576123f78587604001510360018560a0015162ffffff1661376c9092919063ffffffff16565b9050612408565b8486604001510390505b60208301516001600160401b03168082049082061515600116019050805f03612432575050612528565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612486876137b0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b81526004016124b4929190615524565b60408051808303815f875af11580156124cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124f391906154e3565b91509150815f036125075750505050612528565b612511828861521f565b965061251d818761521f565b95505050505061225f565b818460600151101561254d57604051630f271b5560e41b815260040160405180910390fd5b50915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f908190819081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156125c9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125ed9190614d7f565b90505b84604001518310156128ce57845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa15801561266a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061268e9190615505565b1561269c57600193506128ce565b845160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa15801561270c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127309190614d64565b905061273e8160020b613238565b866020015111156127535760019450506128ce565b5f6127678360a0015162ffffff1660171c90565b1561277a578487604001510390506127a1565b61279e858860400151035f8560a0015162ffffff1661376c9092919063ffffffff16565b90505b60208301516001600160401b03166127be600284900b835f613807565b6127c89190615416565b9050805f036127d85750506128ce565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b815260200161282c876137b0565b6001600160401b03168152508b608001516040518363ffffffff1660e01b815260040161285a929190615524565b60408051808303815f875af1158015612875573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061289991906154e3565b91509150805f036128ad57505050506128ce565b6128b7828761521f565b95506128c3818861521f565b9650505050506125f0565b81856060015111156128f357604051630f271b5560e41b815260040160405180910390fd5b5050915091565b805160208201516040517f38926b6d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926338926b6d92612964926004016155be565b6020604051808303815f875af1158015612980573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129a491906155d6565b5050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b22917d6129e5845f015160401c90565b6040516001600160e01b031960e084901b1681526001600160c01b03909116600482015260240160c060405180830381865afa158015612a27573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a4b9190614d7f565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166314d6a9eb6040518060400160405280855f01518152602001612ab085602001516001600160401b031687602001516120209190615416565b6001600160401b031681525084604001516040518363ffffffff1660e01b8152600401612ade9291906155ed565b6020604051808303815f875af1925050508015612b18575060408051601f3d908101601f19168201909252612b15918101906155d6565b60015b156129a457505050565b60405163258473db60e21b81523060048201525f602482018190529081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612b8f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612bb391906155d6565b90505f811215612c8657612bfb7f0000000000000000000000000000000000000000000000000000000000000000612bea836151e9565b6001600160a01b0385169190613849565b604051636a256b2960e01b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612c60573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c8491906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0383811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612cf0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d1491906155d6565b90505f811315612dbd576040517fd9caed120000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528581166024830152604482018390527f0000000000000000000000000000000000000000000000000000000000000000169063d9caed12906064015f604051808303815f87803b158015612da6575f80fd5b505af1158015612db8573d5f803e3d5ffd5b505050505b82515f5b818110156131f8575f858281518110612ddc57612ddc6143c1565b602090810291909101015160405163258473db60e21b81523060048201526001600160a01b0380831660248301529192507f000000000000000000000000000000000000000000000000000000000000000090911690639611cf6c90604401602060405180830381865afa158015612e56573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e7a91906155d6565b93505f841215612f7057612ee5877f0000000000000000000000000000000000000000000000000000000000000000612eb2876151e9565b898681518110612ec457612ec46143c1565b60200260200101516001600160a01b0316613918909392919063ffffffff16565b604051636a256b2960e01b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612f4a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f6e91906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612fda573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ffe91906155d6565b93505f8413156130b8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed12878481518110613049576130496143c1565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908a166024820152604481018790526064015f604051808303815f87803b1580156130a1575f80fd5b505af11580156130b3573d5f803e3d5ffd5b505050505b5f8683815181106130cb576130cb6143c1565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613132573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061315691906155d6565b905080156131ee57868381518110613170576131706143c1565b602090810291909101015160405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af11580156131c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ec9190615505565b505b5050600101612dc1565b504715611f2c57611f2c6001600160a01b0384168647613849565b5f7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b5f61324282613987565b815f600282900b8113613255578161325e565b61325e82615619565b62ffffff8116915060011615613282576bfff97272373d413259a469909250613293565b6c0100000000000000000000000092505b60028116156132b25760606bfff2e50f5f656932ef12357c8402901c92505b60048116156132d15760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156132f05760606bffcb9843d60f6159c9db58838402901c92505b601081161561330f5760606bff973b41fa98c081472e68968402901c92505b602081161561332e5760606bff2ea16466c96a3843ec78b38402901c92505b604081161561334d5760606bfe5dee046a99a2a811c461f18402901c92505b608081161561336c5760606bfcbe86c7900a88aedcffc83b8402901c92505b61010081161561338c5760606bf987a7253ac413176f2b074c8402901c92505b6102008116156133ac5760606bf3392b0822b70005940c7a398402901c92505b6104008116156133cc5760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156133ec5760606bd097f3bdfd2022b8845ad8f78402901c92505b61100081161561340c5760606ba9f746462d870fdf8a65dc1f8402901c92505b61200081161561342c5760606b70d869a156d2a1b890bb3df68402901c92505b61400081161561344c5760606b31be135f97d08fd9812315058402901c92505b61800081161561346c5760606b09aa508b5b7a84e1c677de548402901c92505b6201000081161561348c5760606a5d6af8dedb81196699c3298402901c92505b620200008116156134ab576060692216e584f5fa1ea926048402901c92505b620400008116156134c857606067048a170391f7dc428402901c92505b5f8260020b13156121bd576121ba837801000000000000000000000000000000000000000000000000615416565b5f81750c6c1313451aab317fb9b67e11777e9a5a6ccdb2ebae81118061351e575062149bbb81105b15613554576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f700100000000000000000000000000000000613570856139e6565b6527107fff7434028161358557613585615402565b0590508361359282613238565b11156135a2575f190191506135a5565b91505b50919050565b5f5b81811015611e15575f8383838181106135c8576135c86143c1565b905060a002016020018036038101906135e19190615639565b8051909150156136b9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637ac2ff7b3086868681811061362d5761362d6143c1565b865160208801516040808a015160608b015191516001600160e01b031960e08b901b1681526001600160a01b03909816600489015260a090940295909501356024870152604486019190915260ff16606485015260848401525060a482015260c4015f604051808303815f87803b1580156136a6575f80fd5b505af19250505080156136b7575060015b505b506001016135ad565b5f6136e4606084901b6136d78660020b613238565b8082061515851691040190565b949350505050565b5f6207a11f19627fffff851601600281900b8212828161370e57825f03613710565b825b62ffffff1690505f6137496137258389614db4565b620f42408861373b578581830615151691040190565b808206151586151691040190565b90508261375e57613759816151e9565b613760565b805b98975050505050505050565b5f6207a11f19627fffff85160181831561378657815f0391505b81620f42400190506137a6620f4240866137a09190614db4565b82900490565b9695505050505050565b5f6001600160401b0382111561380357604080517f6dfcc6500000000000000000000000000000000000000000000000000000000081526004810191909152602481018390526044015b60405180910390fd5b5090565b5f6136e46138178560020b613238565b6138219085614db4565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b5f6001600160a01b03841661389e575f805f8085875af1905080613899576040517ff4b3b1bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613912565b60405163a9059cbb60e01b81526001600160a01b038416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080613912576040517ff27f64e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b179052613912908590613bff565b6207ffff600282900b13806139ac57506139a36207ffff615619565b60020b8160020b125b156139e3576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6fffffffffffffffffffffffffffffffff811160071b81811c6001600160401b031060061b1781811c63ffffffff1060051b1781811c61ffff1060041b1781811c60ff1060031b175f8213613a4257631615e6385f526004601cfd5b7103782dace9d90000000000000000000000007ff8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff6f8421084210842108cc6318c6db6d54be84841c1c601f161a90911891821b609f90811c6c465772b2bbbb5f824b15207a3081018102606090811d6d0388eaa27412d5aca026815d636e018202811d6d0df99ac502031bf953eff472fdcc018202811d6d13cdffb29d51d99322bdff5f2211018202811d6d0a0f742023def783a307a986912e018202811d6d01920d8043ca89b5239253284e42018202811d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7883018302821d6d0139601a2efabe717e604cbb4894018302821d6d02247f7a7b6594320649aa03aba1018302821d6c8c3f38e95a6b1ff2ab1c3b343619018302821d6d02384773bdf1ac5676facced60901901830290911d6cb9a025d814b29c212b8b1a07cd19019091027ffffffffffffffff5f6af8f7b3396644f18e157960000000000000000000000000105711340daa0d5f769dba1915cef59f0815a5506029290037d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302919091010590565b5f613c136001600160a01b03841683613c79565b905080515f14158015613c37575080806020019051810190613c359190615505565b155b15611e15576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016137fa565b6060610df583835f845f80856001600160a01b03168486604051613c9d9190615653565b5f6040518083038185875af1925050503d805f8114613cd7576040519150601f19603f3d011682016040523d82523d5f602084013e613cdc565b606091505b50915091506137a6868383606082613cfc57613cf782613d5c565b610df5565b8151158015613d1357506001600160a01b0384163b155b15613d55576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016137fa565b5080610df5565b805115613d6c5780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8083601f840112613dae575f80fd5b5081356001600160401b03811115613dc4575f80fd5b6020830191508360208260051b8501011115613dde575f80fd5b9250929050565b5f8083601f840112613df5575f80fd5b5081356001600160401b03811115613e0b575f80fd5b60208301915083602060c083028501011115613dde575f80fd5b6001600160401b03811681146139e3575f80fd5b8035613e4481613e25565b919050565b5f805f805f805f6080888a031215613e5f575f80fd5b87356001600160401b0380821115613e75575f80fd5b613e818b838c01613d9e565b909950975060208a0135915080821115613e99575f80fd5b613ea58b838c01613d9e565b909750955060408a0135915080821115613ebd575f80fd5b50613eca8a828b01613de5565b9094509250506060880135613ede81613e25565b8091505092959891949750929550565b6001600160a01b03811681146139e3575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b0381118282101715613f3857613f38613f02565b60405290565b604051608081016001600160401b0381118282101715613f3857613f38613f02565b60405160e081016001600160401b0381118282101715613f3857613f38613f02565b604051606081016001600160401b0381118282101715613f3857613f38613f02565b604051601f8201601f191681016001600160401b0381118282101715613fcc57613fcc613f02565b604052919050565b5f6001600160401b03821115613fec57613fec613f02565b50601f01601f191660200190565b5f806040838503121561400b575f80fd5b823561401681613eee565b915060208301356001600160401b03811115614030575f80fd5b8301601f81018513614040575f80fd5b803561405361404e82613fd4565b613fa4565b818152866020838501011115614067575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610df56020830184614086565b6001600160c01b03811681146139e3575f80fd5b5f602082840312156140ea575f80fd5b8135610df5816140c6565b8060020b81146139e3575f80fd5b8035613e44816140f5565b5f806040838503121561411f575f80fd5b823561412a816140c6565b9150602083013561413a816140f5565b809150509250929050565b5f60208284031215614155575f80fd5b5035919050565b5f6020828403121561416c575f80fd5b8135610df5816140f5565b5f8083601f840112614187575f80fd5b5081356001600160401b0381111561419d575f80fd5b60208301915083602060a083028501011115613dde575f80fd5b5f805f805f805f805f805f60c08c8e0312156141d1575f80fd5b6001600160401b03808d3511156141e6575f80fd5b6141f38e8e358f01613d9e565b909c509a5060208d0135811015614208575f80fd5b6142188e60208f01358f01613d9e565b909a50985060408d013581101561422d575f80fd5b61423d8e60408f01358f01613d9e565b909850965060608d0135811015614252575f80fd5b6142628e60608f01358f01613de5565b909650945060808d0135811015614277575f80fd5b506142888d60808e01358e01614177565b909350915061429960a08d01613e39565b90509295989b509295989b9093969950565b602080825282518282018190525f9190848201906040850190845b818110156142e2578351835292840192918401916001016142c6565b50909695505050505050565b5f805f805f805f6080888a031215614304575f80fd5b87356001600160401b038082111561431a575f80fd5b6143268b838c01613d9e565b909950975060208a013591508082111561433e575f80fd5b61434a8b838c01613d9e565b909750955060408a0135915080821115614362575f80fd5b50613eca8a828b01614177565b5f805f60408486031215614381575f80fd5b83356001600160401b03811115614396575f80fd5b6143a286828701613d9e565b90945092505060208401356143b681613e25565b809150509250925092565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f8235609e198336030181126143fd575f80fd5b9190910192915050565b5f808335601e1984360301811261441c575f80fd5b83016020810192503590506001600160401b0381111561443a575f80fd5b803603821315613dde575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f813561447c816140c6565b6001600160c01b0381168452506020820135602084015260408201356040840152606082013560608401526144b46080830183614407565b60a060808601526144c960a086018284614448565b95945050505050565b602081525f610df56020830184614470565b5f6007821061450157634e487b7160e01b5f52602160045260245ffd5b50815260200190565b5f815180845260208085019450602084015f5b8381101561453e576145308783516144e4565b96509082019060010161451d565b509495945050505050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101561459457601f19868403018952614582838351614086565b98840198925090830190600101614566565b5090979650505050505050565b8183525f60208085019450825f5b8581101561453e5781356145c281613eee565b6001600160a01b0316875295820195908201906001016145af565b6001600160a01b0386168152608060208201525f6145fe608083018761450a565b82810360408401526146108187614549565b905082810360608401526137608185876145a1565b6001600160a01b0383168152604060208201525f6136e46040830184614086565b5f82601f830112614655575f80fd5b815161466361404e82613fd4565b818152846020838601011115614677575f80fd5b8160208501602083015e5f918101602001919091529392505050565b5f602082840312156146a3575f80fd5b81516001600160401b038111156146b8575f80fd5b6136e484828501614646565b5f6001600160401b038211156146dc576146dc613f02565b5060051b60200190565b600781106139e3575f80fd5b5f82601f830112614701575f80fd5b8151602061471161404e836146c4565b82815260059290921b8401810191818101908684111561472f575f80fd5b8286015b8481101561476c5780516001600160401b03811115614750575f80fd5b61475e8986838b0101614646565b845250918301918301614733565b509695505050505050565b5f82601f830112614786575f80fd5b8151602061479661404e836146c4565b8083825260208201915060208460051b8701019350868411156147b7575f80fd5b602086015b8481101561476c5780516147cf81613eee565b83529183019183016147bc565b5f805f80608085870312156147ef575f80fd5b84516147fa81613eee565b809450506020808601516001600160401b0380821115614818575f80fd5b818801915088601f83011261482b575f80fd5b815161483961404e826146c4565b81815260059190911b8301840190848101908b831115614857575f80fd5b938501935b8285101561487e57845161486f816146e6565b8252938501939085019061485c565b60408b01519098509450505080831115614896575f80fd5b6148a289848a016146f2565b945060608801519250808311156148b7575f80fd5b50506148c587828801614777565b91505092959194509250565b62ffffff811681146139e3575f80fd5b5f60c082840312156148f1575f80fd5b60405160c081018181106001600160401b038211171561491357614913613f02565b8060405250809150825161492681613eee565b8152602083015161493681613e25565b6020820152604083015161494981613eee565b6040820152606083015161495c816148d1565b6060820152608083015161496f81613eee565b608082015260a0830151614982816148d1565b60a0919091015292915050565b5f6020828403121561499f575f80fd5b81516001600160401b03808211156149b5575f80fd5b9083019060e082860312156149c8575f80fd5b6149d0613f16565b6149da86846148e1565b815260c0830151828111156149ed575f80fd5b6149f987828601614646565b60208301525095945050505050565b8051613e44816140c6565b8051613e44816140f5565b5f60208284031215614a2e575f80fd5b81516001600160401b0380821115614a44575f80fd5b9083019060808286031215614a57575f80fd5b614a5f613f3e565b8251614a6a816140c6565b81526020830151614a7a816140f5565b602082015260408381015190820152606083015182811115614a9a575f80fd5b614aa687828601614646565b60608301525095945050505050565b634e487b7160e01b5f52601160045260245ffd5b5f60018201614ada57614ada614ab5565b5060010190565b5f60208284031215614af1575f80fd5b81516001600160401b0380821115614b07575f80fd5b9083019060e08286031215614b1a575f80fd5b614b22613f60565b614b2b83614a08565b8152614b3960208401614a08565b602082015260408301516040820152614b5460608401614a13565b60608201526080830151608082015260a083015182811115614b74575f80fd5b614b8087828601614646565b60a08301525060c083015182811115614b97575f80fd5b614ba387828601614646565b60c08301525095945050505050565b5f60a08284031215614bc2575f80fd5b60405160a081016001600160401b038282108183111715614be557614be5613f02565b8160405282935084519150614bf9826140c6565b8183526020850151602084015260408501516040840152606085015160608401526080850151915080821115614c2d575f80fd5b50614c3a85828601614646565b6080830152505092915050565b5f60208284031215614c57575f80fd5b81516001600160401b03811115614c6c575f80fd5b6136e484828501614bb2565b5f60208284031215614c88575f80fd5b81516001600160401b0380821115614c9e575f80fd5b9083019060408286031215614cb1575f80fd5b614cb9613f16565b825181526020830151828111156149ed575f80fd5b5f60208284031215614cde575f80fd5b8151610df581613eee565b5f60208284031215614cf9575f80fd5b81516001600160401b0380821115614d0f575f80fd5b9083019060608286031215614d22575f80fd5b614d2a613f82565b8251815260208301516020820152604083015182811115614d49575f80fd5b614d5587828601614646565b60408301525095945050505050565b5f60208284031215614d74575f80fd5b8151610df5816140f5565b5f60c08284031215614d8f575f80fd5b610df583836148e1565b5f60208284031215614da9575f80fd5b8151610df581613e25565b8082028115828204841417610bec57610bec614ab5565b6001600160a01b0388168152608060208083018290529082018790525f90889060a08401835b8a811015614e1d578335614e04816146e6565b614e0e83826144e4565b94840194925050600101614df1565b5084810360408601528781528181019250600588901b81018201895f5b8a811015614e7457838303601f19018652614e55828d614407565b614e60858284614448565b978701979450505090840190600101614e3a565b50508581036060870152614e8981888a6145a1565b9d9c50505050505050505050505050565b5f6020808385031215614eab575f80fd5b82516001600160401b03811115614ec0575f80fd5b8301601f81018513614ed0575f80fd5b8051614ede61404e826146c4565b81815260059190911b82018301908381019087831115614efc575f80fd5b928401925b82841015614f1a57835182529284019290840190614f01565b979650505050505050565b5f8235607e198336030181126143fd575f80fd5b602081525f8235614f49816140c6565b6001600160c01b0381166020840152506020830135614f67816140f5565b8060020b60408401525060408301356060830152614f886060840184614407565b6080808501526144c960a085018284614448565b5f8235603e198336030181126143fd575f80fd5b60208152813560208201525f614fc96020840184614407565b6040808501526144c9606085018284614448565b5f8235605e198336030181126143fd575f80fd5b6020815281356020820152602082013560408201525f6150146040840184614407565b6060808501526144c9608085018284614448565b5f823560de198336030181126143fd575f80fd5b8035613e44816148d1565b8035613e4481613eee565b602081525f823561506281613eee565b6001600160a01b0380821660208501526020850135915061508282613e25565b6001600160401b0382166040850152604085013591506150a182613eee565b166060838101919091528301356150b7816148d1565b62ffffff81166080840152506150cf60808401615047565b6001600160a01b03811660a0840152506150eb60a0840161503c565b62ffffff811660c08401525061510460c0840184614407565b60e0808501526144c961010085018284614448565b5f6001600160a01b03808716835260206080602085015261513d608085018861450a565b848103604086015261514f8188614549565b8581036060870152865180825260208089019350909101905f5b81811015615187578351861683529284019291840191600101615169565b50909a9950505050505050505050565b5f606082840312156151a7575f80fd5b6151af613f82565b82516151ba81613eee565b815260208301516151ca81613e25565b602082015260408301516151dd81613e25565b60408201529392505050565b5f7f8000000000000000000000000000000000000000000000000000000000000000820361521957615219614ab5565b505f0390565b80820180821115610bec57610bec614ab5565b81810381811115610bec57610bec614ab5565b602081525f8235615255816140c6565b6001600160c01b0381166020840152506020830135615273816140c6565b6001600160c01b0381166040840152506040830135606083015261529960608401614103565b6152a8608084018260020b9052565b50608083013560a08301526152c060a0840184614407565b60e060c08501526152d661010085018284614448565b9150506152e660c0850185614407565b848303601f190160e08601526137a6838284614448565b5f6080828403121561530d575f80fd5b615315613f3e565b905081358152602082013560ff8116811461532e575f80fd5b80602083015250604082013560408201526060820135606082015292915050565b5f60c0828403121561535f575f80fd5b615367613f82565b823561537281613eee565b8152602083810135908201526151dd84604085016152fd565b6153ed81846001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b60e060c08201525f6136e460e0830184614086565b634e487b7160e01b5f52601260045260245ffd5b5f8261543057634e487b7160e01b5f52601260045260245ffd5b500490565b5f61014061549c8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e08401526001600160a01b03606086015116610100840152806101208401526144c981840185614086565b5f80604083850312156154f4575f80fd5b505080516020909101519092909150565b5f60208284031215615515575f80fd5b81518015158114610df5575f80fd5b5f61012061558b8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e0840152806101008401526144c981840185614086565b828152604060208201525f6136e46040830184614086565b5f602082840312156155e6575f80fd5b5051919050565b825181526001600160401b036020840151166020820152606060408201525f6136e46060830184614086565b5f8160020b627fffff19810361563157615631614ab5565b5f0392915050565b5f60808284031215615649575f80fd5b610df583836152fd565b5f82518060208501845e5f92019182525091905056fea26469706673582212205d030babface628d41af975b2b7119f20ba2d315229ba63974efbe1f93407df064736f6c63430008190033", + "devdoc": { + "errors": { + "AddressEmptyCode(address)": [ + { + "details": "There's no code at `target` (it is not a contract)." + } + ], + "FailedCall()": [ + { + "details": "A call to an address target failed. The target may have reverted." + } + ], + "InsufficientBalance(uint256,uint256)": [ + { + "details": "The ETH balance of the account is not enough to perform the operation." + } + ], + "SafeCastOverflowedUintDowncast(uint8,uint256)": [ + { + "details": "Value doesn't fit in an uint of `bits` size." + } + ], + "SafeERC20FailedOperation(address)": [ + { + "details": "An operation with an ERC-20 token failed." + } + ] + }, + "kind": "dev", + "methods": { + "cancel((uint256,uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "details": "IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.", + "params": { + "deadline": "The deadline for the actions", + "orderParamsList": "The list of actions to cancel", + "permitParamsList": "The parameters of the permits", + "tokensToSettle": "The tokens to settle" + } + }, + "claim((uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "details": "IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.", + "params": { + "deadline": "The deadline for the actions", + "orderParamsList": "The list of actions to claim", + "permitParamsList": "The parameters of the permits", + "tokensToSettle": "The tokens to settle" + } + }, + "execute(uint8[],bytes[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "details": "IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.", + "params": { + "actionList": "The list of actions to execute", + "deadline": "The deadline for the actions", + "erc20PermitParamsList": "The parameters of the ERC20 permits", + "erc721PermitParamsList": "The parameters of the ERC721 permits", + "paramsDataList": "The parameters of the actions", + "tokensToSettle": "The tokens to settle" + }, + "returns": { + "ids": "The ids of the orders" + } + }, + "fromPrice(uint256)": { + "params": { + "price": "The price to convert" + }, + "returns": { + "_0": "The tick" + } + }, + "getDepth(uint192,int24)": { + "params": { + "id": "The id of the book", + "tick": "The tick of the book" + }, + "returns": { + "_0": "The depth of the book in quote amount" + } + }, + "getHighestPrice(uint192)": { + "params": { + "id": "The id of the book" + }, + "returns": { + "_0": "The highest price of the book with 2**96 precision" + } + }, + "getOrder(uint256)": { + "params": { + "orderId": "The id of the order" + }, + "returns": { + "claimableAmount": "The claimable base amount of the order", + "openAmount": "The open quote amount of the order", + "price": "The price of the order with 2**96 precision", + "provider": "The provider of the order" + } + }, + "make((uint192,int24,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "details": "IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.", + "params": { + "deadline": "The deadline for the actions", + "orderParamsList": "The list of actions to make", + "permitParamsList": "The parameters of the permits", + "tokensToSettle": "The tokens to settle" + }, + "returns": { + "ids": "The ids of the orders" + } + }, + "open(((address,uint64,address,uint24,address,uint24),bytes)[],uint64)": { + "params": { + "deadline": "The deadline for the action", + "openBookParamsList": "The parameters of the open book action" + } + }, + "spend((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "details": "IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.", + "params": { + "deadline": "The deadline for the actions", + "orderParamsList": "The list of actions to spend", + "permitParamsList": "The parameters of the permits", + "tokensToSettle": "The tokens to settle" + } + }, + "take((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "details": "IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.", + "params": { + "deadline": "The deadline for the actions", + "orderParamsList": "The list of actions to take", + "permitParamsList": "The parameters of the permits", + "tokensToSettle": "The tokens to settle" + } + }, + "toPrice(int24)": { + "params": { + "tick": "The tick to convert" + }, + "returns": { + "_0": "The price with 2**96 precision" + } + } + }, + "stateVariables": { + "bookManager": { + "return": "The instance of the book manager", + "returns": { + "_0": "The instance of the book manager" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "ERC20TransferFailed()": [ + { + "notice": "Thrown when an ERC20 transfer fails" + } + ], + "NativeTransferFailed()": [ + { + "notice": "Thrown when a native transfer fails" + } + ] + }, + "kind": "user", + "methods": { + "bookManager()": { + "notice": "Returns the book manager" + }, + "cancel((uint256,uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "notice": "Cancels a list of orders" + }, + "claim((uint256,bytes)[],address[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "notice": "Claims a list of orders" + }, + "execute(uint8[],bytes[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],(uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "notice": "Executes a list of actions" + }, + "fromPrice(uint256)": { + "notice": "Converts a price to a tick" + }, + "getDepth(uint192,int24)": { + "notice": "Returns the depth of a book" + }, + "getHighestPrice(uint192)": { + "notice": "Returns the highest price of a book" + }, + "getOrder(uint256)": { + "notice": "Returns the details of an order" + }, + "make((uint192,int24,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "notice": "Makes a list of orders" + }, + "open(((address,uint64,address,uint24,address,uint24),bytes)[],uint64)": { + "notice": "Opens a book" + }, + "spend((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "notice": "Spends to take a list of orders" + }, + "take((uint192,uint256,uint256,uint256,bytes)[],address[],(address,uint256,(uint256,uint8,bytes32,bytes32))[],uint64)": { + "notice": "Takes a list of orders" + }, + "toPrice(int24)": { + "notice": "Converts a tick to a price" + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/80084/solcInputs/8ab01b92ea083f19aa223a9d45d915fe.json b/deployments/80084/solcInputs/8ab01b92ea083f19aa223a9d45d915fe.json new file mode 100644 index 0000000..c95bd30 --- /dev/null +++ b/deployments/80084/solcInputs/8ab01b92ea083f19aa223a9d45d915fe.json @@ -0,0 +1,168 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../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 * The initial owner is set to the address provided by the deployer. This can\n * 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 /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\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 if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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 if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\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" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.20;\n\nimport {Ownable} from \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * This extension of the {Ownable} contract includes a two-step mechanism to transfer\n * ownership, where the new owner must call {acceptOwnership} in order to replace the\n * old one. This can help prevent common mistakes, such as transfers of ownership to\n * incorrect accounts, or to contracts that are unable to interact with the\n * permission system.\n *\n * The initial owner is specified at deployment time in the constructor for `Ownable`. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n if (pendingOwner() != sender) {\n revert OwnableUnauthorizedAccount(sender);\n }\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1363.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n /*\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n * 0xb0202a11 ===\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n */\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @param data Additional data with no specified format, sent in call to `spender`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"./ERC1967Utils.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an\n * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address implementation, bytes memory _data) payable {\n ERC1967Utils.upgradeToAndCall(implementation, _data);\n }\n\n /**\n * @dev Returns the current implementation address.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function _implementation() internal view virtual override returns (address) {\n return ERC1967Utils.getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.21;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {IERC1967} from \"../../interfaces/IERC1967.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.\n */\nlibrary ERC1967Utils {\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev The `implementation` of the proxy is invalid.\n */\n error ERC1967InvalidImplementation(address implementation);\n\n /**\n * @dev The `admin` of the proxy is invalid.\n */\n error ERC1967InvalidAdmin(address admin);\n\n /**\n * @dev The `beacon` of the proxy is invalid.\n */\n error ERC1967InvalidBeacon(address beacon);\n\n /**\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\n */\n error ERC1967NonPayable();\n\n /**\n * @dev Returns the current implementation address.\n */\n function getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the ERC-1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n if (newImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(newImplementation);\n }\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n _setImplementation(newImplementation);\n emit IERC1967.Upgraded(newImplementation);\n\n if (data.length > 0) {\n Address.functionDelegateCall(newImplementation, data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the ERC-1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n if (newAdmin == address(0)) {\n revert ERC1967InvalidAdmin(address(0));\n }\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {IERC1967-AdminChanged} event.\n */\n function changeAdmin(address newAdmin) internal {\n emit IERC1967.AdminChanged(getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the ERC-1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n if (newBeacon.code.length == 0) {\n revert ERC1967InvalidBeacon(newBeacon);\n }\n\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n address beaconImplementation = IBeacon(newBeacon).implementation();\n if (beaconImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(beaconImplementation);\n }\n }\n\n /**\n * @dev Change the beacon and trigger a setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-BeaconUpgraded} event.\n *\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n * efficiency.\n */\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n _setBeacon(newBeacon);\n emit IERC1967.BeaconUpgraded(newBeacon);\n\n if (data.length > 0) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n * if an upgrade doesn't perform an initialization call.\n */\n function _checkNonPayable() private {\n if (msg.value > 0) {\n revert ERC1967NonPayable();\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback\n * function and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Storage of the initializable contract.\n *\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n * when using with upgradeable contracts.\n *\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n */\n struct InitializableStorage {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n uint64 _initialized;\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool _initializing;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n /**\n * @dev The contract is already initialized.\n */\n error InvalidInitialization();\n\n /**\n * @dev The contract is not initializing.\n */\n error NotInitializing();\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint64 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n * production.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n // Cache values to avoid duplicated sloads\n bool isTopLevelCall = !$._initializing;\n uint64 initialized = $._initialized;\n\n // Allowed calls:\n // - initialSetup: the contract is not in the initializing state and no previous version was\n // initialized\n // - construction: the contract is initialized at version 1 (no reininitialization) and the\n // current contract is just being deployed\n bool initialSetup = initialized == 0 && isTopLevelCall;\n bool construction = initialized == 1 && address(this).code.length == 0;\n\n if (!initialSetup && !construction) {\n revert InvalidInitialization();\n }\n $._initialized = 1;\n if (isTopLevelCall) {\n $._initializing = true;\n }\n _;\n if (isTopLevelCall) {\n $._initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint64 version) {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing || $._initialized >= version) {\n revert InvalidInitialization();\n }\n $._initialized = version;\n $._initializing = true;\n _;\n $._initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n _checkInitializing();\n _;\n }\n\n /**\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n */\n function _checkInitializing() internal view virtual {\n if (!_isInitializing()) {\n revert NotInitializing();\n }\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing) {\n revert InvalidInitialization();\n }\n if ($._initialized != type(uint64).max) {\n $._initialized = type(uint64).max;\n emit Initialized(type(uint64).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint64) {\n return _getInitializableStorage()._initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _getInitializableStorage()._initializing;\n }\n\n /**\n * @dev Returns a pointer to the storage namespace.\n */\n // solhint-disable-next-line var-name-mixedcase\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n assembly {\n $.slot := INITIALIZABLE_STORAGE\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC1822Proxiable} from \"../../interfaces/draft-IERC1822.sol\";\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n */\nabstract contract UUPSUpgradeable is IERC1822Proxiable {\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n address private immutable __self = address(this);\n\n /**\n * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`\n * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n * If the getter returns `\"5.0.0\"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must\n * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n * during an upgrade.\n */\n string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n /**\n * @dev The call is from an unauthorized context.\n */\n error UUPSUnauthorizedCallContext();\n\n /**\n * @dev The storage `slot` is unsupported as a UUID.\n */\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n _checkProxy();\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n _checkNotDelegated();\n _;\n }\n\n /**\n * @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual notDelegated returns (bytes32) {\n return ERC1967Utils.IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data);\n }\n\n /**\n * @dev Reverts if the execution is not performed via delegatecall or the execution\n * context is not of a proxy with an ERC-1967 compliant implementation pointing to self.\n * See {_onlyProxy}.\n */\n function _checkProxy() internal view virtual {\n if (\n address(this) == __self || // Must be called through delegatecall\n ERC1967Utils.getImplementation() != __self // Must be called through an active proxy\n ) {\n revert UUPSUnauthorizedCallContext();\n }\n }\n\n /**\n * @dev Reverts if the execution is performed via delegatecall.\n * See {notDelegated}.\n */\n function _checkNotDelegated() internal view virtual {\n if (address(this) != __self) {\n // Must not be called through delegatecall\n revert UUPSUnauthorizedCallContext();\n }\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.\n *\n * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value\n * is expected to be the implementation slot in ERC-1967.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {\n revert UUPSUnsupportedProxiableUUID(slot);\n }\n ERC1967Utils.upgradeToAndCall(newImplementation, data);\n } catch {\n // The implementation is not UUPS\n revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 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 *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\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 * CAUTION: See Security Considerations above.\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" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\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 value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\n * 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 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` 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(address from, address to, uint256 value) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n forceApprove(token, spender, oldAllowance + value);\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n * value, non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance < requestedDecrease) {\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n }\n forceApprove(token, spender, currentAllowance - requestedDecrease);\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n safeTransfer(token, to, value);\n } else if (!token.transferAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferFromAndCallRelaxed(\n IERC1363 token,\n address from,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n safeTransferFrom(token, from, to, value);\n } else if (!token.transferFromAndCall(from, to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n * once without retrying, and relies on the returned value to be true.\n *\n * Reverts if the returned value is other than `true`.\n */\n function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n forceApprove(token, to, value);\n } else if (!token.approveAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC-721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n * {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert Errors.InsufficientBalance(address(this).balance, amount);\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert Errors.FailedCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {Errors.FailedCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert Errors.InsufficientBalance(address(this).balance, value);\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case\n * of an unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {Errors.FailedCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert Errors.FailedCall();\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of common custom errors used in multiple contracts\n *\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\n * It is recommended to avoid relying on the error API for critical functionality.\n */\nlibrary Errors {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error InsufficientBalance(uint256 balance, uint256 needed);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedCall();\n\n /**\n * @dev The deployment failed.\n */\n error FailedDeployment();\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n /**\n * @dev Value doesn't fit in an uint of `bits` size.\n */\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n /**\n * @dev An int value doesn't fit in an uint of `bits` size.\n */\n error SafeCastOverflowedIntToUint(int256 value);\n\n /**\n * @dev Value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n /**\n * @dev An uint value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedUintToInt(uint256 value);\n\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n if (value > type(uint248).max) {\n revert SafeCastOverflowedUintDowncast(248, value);\n }\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n if (value > type(uint240).max) {\n revert SafeCastOverflowedUintDowncast(240, value);\n }\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n if (value > type(uint232).max) {\n revert SafeCastOverflowedUintDowncast(232, value);\n }\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n if (value > type(uint224).max) {\n revert SafeCastOverflowedUintDowncast(224, value);\n }\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n if (value > type(uint216).max) {\n revert SafeCastOverflowedUintDowncast(216, value);\n }\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n if (value > type(uint208).max) {\n revert SafeCastOverflowedUintDowncast(208, value);\n }\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n if (value > type(uint200).max) {\n revert SafeCastOverflowedUintDowncast(200, value);\n }\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n if (value > type(uint192).max) {\n revert SafeCastOverflowedUintDowncast(192, value);\n }\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n if (value > type(uint184).max) {\n revert SafeCastOverflowedUintDowncast(184, value);\n }\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n if (value > type(uint176).max) {\n revert SafeCastOverflowedUintDowncast(176, value);\n }\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n if (value > type(uint168).max) {\n revert SafeCastOverflowedUintDowncast(168, value);\n }\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n if (value > type(uint160).max) {\n revert SafeCastOverflowedUintDowncast(160, value);\n }\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n if (value > type(uint152).max) {\n revert SafeCastOverflowedUintDowncast(152, value);\n }\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n if (value > type(uint144).max) {\n revert SafeCastOverflowedUintDowncast(144, value);\n }\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n if (value > type(uint136).max) {\n revert SafeCastOverflowedUintDowncast(136, value);\n }\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n if (value > type(uint128).max) {\n revert SafeCastOverflowedUintDowncast(128, value);\n }\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n if (value > type(uint120).max) {\n revert SafeCastOverflowedUintDowncast(120, value);\n }\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n if (value > type(uint112).max) {\n revert SafeCastOverflowedUintDowncast(112, value);\n }\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n if (value > type(uint104).max) {\n revert SafeCastOverflowedUintDowncast(104, value);\n }\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n if (value > type(uint96).max) {\n revert SafeCastOverflowedUintDowncast(96, value);\n }\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n if (value > type(uint88).max) {\n revert SafeCastOverflowedUintDowncast(88, value);\n }\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n if (value > type(uint80).max) {\n revert SafeCastOverflowedUintDowncast(80, value);\n }\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n if (value > type(uint72).max) {\n revert SafeCastOverflowedUintDowncast(72, value);\n }\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n if (value > type(uint64).max) {\n revert SafeCastOverflowedUintDowncast(64, value);\n }\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n if (value > type(uint56).max) {\n revert SafeCastOverflowedUintDowncast(56, value);\n }\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n if (value > type(uint48).max) {\n revert SafeCastOverflowedUintDowncast(48, value);\n }\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n if (value > type(uint40).max) {\n revert SafeCastOverflowedUintDowncast(40, value);\n }\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n if (value > type(uint32).max) {\n revert SafeCastOverflowedUintDowncast(32, value);\n }\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n if (value > type(uint24).max) {\n revert SafeCastOverflowedUintDowncast(24, value);\n }\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n if (value > type(uint16).max) {\n revert SafeCastOverflowedUintDowncast(16, value);\n }\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n if (value > type(uint8).max) {\n revert SafeCastOverflowedUintDowncast(8, value);\n }\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n if (value < 0) {\n revert SafeCastOverflowedIntToUint(value);\n }\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(248, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(240, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(232, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(224, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(216, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(208, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(200, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(192, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(184, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(176, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(168, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(160, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(152, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(144, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(136, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(128, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(120, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(112, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(104, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(96, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(88, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(80, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(72, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(64, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(56, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(48, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(40, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(32, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(24, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(16, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(8, value);\n }\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n if (value > uint256(type(int256).max)) {\n revert SafeCastOverflowedUintToInt(value);\n }\n return int256(value);\n }\n\n /**\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n */\n function toUint(bool b) internal pure returns (uint256 u) {\n /// @solidity memory-safe-assembly\n assembly {\n u := iszero(iszero(b))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.24;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * Since version 5.1, this library also support writing and reading value types to and from transient storage.\n *\n * * Example using transient storage:\n * ```solidity\n * contract Lock {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;\n *\n * modifier locked() {\n * require(!_LOCK_SLOT.asBoolean().tload());\n *\n * _LOCK_SLOT.asBoolean().tstore(true);\n * _;\n * _LOCK_SLOT.asBoolean().tstore(false);\n * }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct Int256Slot {\n int256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Int256Slot` with member `value` located at `slot`.\n */\n function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev UDVT that represent a slot holding a address.\n */\n type AddressSlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a AddressSlotType.\n */\n function asAddress(bytes32 slot) internal pure returns (AddressSlotType) {\n return AddressSlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a bool.\n */\n type BooleanSlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a BooleanSlotType.\n */\n function asBoolean(bytes32 slot) internal pure returns (BooleanSlotType) {\n return BooleanSlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a bytes32.\n */\n type Bytes32SlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a Bytes32SlotType.\n */\n function asBytes32(bytes32 slot) internal pure returns (Bytes32SlotType) {\n return Bytes32SlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a uint256.\n */\n type Uint256SlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a Uint256SlotType.\n */\n function asUint256(bytes32 slot) internal pure returns (Uint256SlotType) {\n return Uint256SlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a int256.\n */\n type Int256SlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a Int256SlotType.\n */\n function asInt256(bytes32 slot) internal pure returns (Int256SlotType) {\n return Int256SlotType.wrap(slot);\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(AddressSlotType slot) internal view returns (address value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(AddressSlotType slot, address value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(BooleanSlotType slot) internal view returns (bool value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(BooleanSlotType slot, bool value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(Bytes32SlotType slot) internal view returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(Bytes32SlotType slot, bytes32 value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(Uint256SlotType slot) internal view returns (uint256 value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(Uint256SlotType slot, uint256 value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(Int256SlotType slot) internal view returns (int256 value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(Int256SlotType slot, int256 value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n}\n" + }, + "src/BookViewer.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\";\nimport {ERC1967Proxy} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\"; // To generate artifacts\nimport {Ownable, Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {SignificantBit} from \"v2-core/libraries/SignificantBit.sol\";\nimport {Math} from \"v2-core/libraries/Math.sol\";\nimport {Lockers} from \"v2-core/libraries/Lockers.sol\";\nimport {BookId} from \"v2-core/libraries/BookId.sol\";\nimport {Tick, TickLibrary} from \"v2-core/libraries/Tick.sol\";\nimport {FeePolicy, FeePolicyLibrary} from \"v2-core/libraries/FeePolicy.sol\";\n\nimport {IBookViewer} from \"./interfaces/IBookViewer.sol\";\nimport {IController} from \"./interfaces/IController.sol\";\n\ncontract BookViewer is IBookViewer, UUPSUpgradeable, Ownable2Step, Initializable {\n using SafeCast for *;\n using TickLibrary for *;\n using Math for uint256;\n using SignificantBit for uint256;\n using FeePolicyLibrary for FeePolicy;\n\n IBookManager public immutable bookManager;\n\n constructor(IBookManager bookManager_) Ownable(msg.sender) {\n bookManager = bookManager_;\n }\n\n function __BookViewer_init(address owner) external initializer {\n _transferOwnership(owner);\n }\n\n function _authorizeUpgrade(address) internal override onlyOwner {}\n\n function getLiquidity(BookId id, Tick tick, uint256 n) external view returns (Liquidity[] memory liquidity) {\n liquidity = new Liquidity[](n);\n if (bookManager.getDepth(id, tick) == 0) tick = bookManager.maxLessThan(id, tick);\n uint256 i;\n while (i < n) {\n if (Tick.unwrap(tick) == type(int24).min) break;\n liquidity[i] = Liquidity({tick: tick, depth: bookManager.getDepth(id, tick)});\n tick = bookManager.maxLessThan(id, tick);\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(liquidity, i)\n }\n }\n\n function getExpectedInput(IController.TakeOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\n {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n if (bookManager.isEmpty(params.id)) return (0, 0);\n\n Tick tick = bookManager.getHighest(params.id);\n\n while (Tick.unwrap(tick) > type(int24).min) {\n unchecked {\n if (params.limitPrice > tick.toPrice()) break;\n uint256 maxAmount;\n if (key.takerPolicy.usesQuote()) {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.quoteAmount - takenQuoteAmount, true);\n } else {\n maxAmount = params.quoteAmount - takenQuoteAmount;\n }\n maxAmount = maxAmount.divide(key.unitSize, true);\n\n if (maxAmount == 0) break;\n uint256 currentDepth = bookManager.getDepth(params.id, tick);\n uint256 quoteAmount = (currentDepth > maxAmount ? maxAmount : currentDepth) * key.unitSize;\n uint256 baseAmount = tick.quoteToBase(quoteAmount, true);\n if (key.takerPolicy.usesQuote()) {\n quoteAmount = uint256(int256(quoteAmount) - key.takerPolicy.calculateFee(quoteAmount, false));\n } else {\n baseAmount = uint256(baseAmount.toInt256() + key.takerPolicy.calculateFee(baseAmount, false));\n }\n if (quoteAmount == 0) break;\n\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n if (params.quoteAmount <= takenQuoteAmount) break;\n tick = bookManager.maxLessThan(params.id, tick);\n }\n }\n }\n\n function getExpectedOutput(IController.SpendOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\n {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n if (bookManager.isEmpty(params.id)) return (0, 0);\n\n Tick tick = bookManager.getHighest(params.id);\n\n unchecked {\n while (spentBaseAmount <= params.baseAmount && Tick.unwrap(tick) > type(int24).min) {\n if (params.limitPrice > tick.toPrice()) break;\n uint256 maxAmount;\n if (key.takerPolicy.usesQuote()) {\n maxAmount = params.baseAmount - spentBaseAmount;\n } else {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.baseAmount - spentBaseAmount, false);\n }\n maxAmount = tick.baseToQuote(maxAmount, false) / key.unitSize;\n\n if (maxAmount == 0) break;\n uint256 currentDepth = bookManager.getDepth(params.id, tick);\n uint256 quoteAmount = (currentDepth > maxAmount ? maxAmount : currentDepth) * key.unitSize;\n uint256 baseAmount = tick.quoteToBase(quoteAmount, true);\n if (key.takerPolicy.usesQuote()) {\n quoteAmount = uint256(int256(quoteAmount) - key.takerPolicy.calculateFee(quoteAmount, false));\n } else {\n baseAmount = uint256(baseAmount.toInt256() + key.takerPolicy.calculateFee(baseAmount, false));\n }\n if (baseAmount == 0) break;\n\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n tick = bookManager.maxLessThan(params.id, tick);\n }\n }\n }\n}\n" + }, + "src/Controller.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nimport {IERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport {ILocker} from \"v2-core/interfaces/ILocker.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {IERC721Permit} from \"v2-core/interfaces/IERC721Permit.sol\";\nimport {Math} from \"v2-core/libraries/Math.sol\";\nimport {BookId, BookIdLibrary} from \"v2-core/libraries/BookId.sol\";\nimport {OrderId, OrderIdLibrary} from \"v2-core/libraries/OrderId.sol\";\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {FeePolicy, FeePolicyLibrary} from \"v2-core/libraries/FeePolicy.sol\";\nimport {Tick, TickLibrary} from \"v2-core/libraries/Tick.sol\";\nimport {OrderId, OrderIdLibrary} from \"v2-core/libraries/OrderId.sol\";\n\nimport {IController} from \"./interfaces/IController.sol\";\nimport {ReentrancyGuard} from \"./libraries/ReentrancyGuard.sol\";\n\ncontract Controller is IController, ILocker, ReentrancyGuard {\n using TickLibrary for *;\n using OrderIdLibrary for OrderId;\n using BookIdLibrary for IBookManager.BookKey;\n using SafeERC20 for IERC20;\n using SafeCast for uint256;\n using Math for uint256;\n using CurrencyLibrary for Currency;\n using FeePolicyLibrary for FeePolicy;\n\n IBookManager public immutable bookManager;\n\n constructor(address bookManager_) {\n bookManager = IBookManager(bookManager_);\n }\n\n modifier checkDeadline(uint64 deadline) {\n if (block.timestamp > deadline) revert Deadline();\n _;\n }\n\n modifier permitERC20(ERC20PermitParams[] calldata permitParamsList) {\n _permitERC20(permitParamsList);\n _;\n }\n\n function getDepth(BookId id, Tick tick) external view returns (uint256) {\n return uint256(bookManager.getDepth(id, tick)) * bookManager.getBookKey(id).unitSize;\n }\n\n function getHighestPrice(BookId id) external view returns (uint256) {\n return bookManager.getHighest(id).toPrice();\n }\n\n function getOrder(OrderId orderId)\n external\n view\n returns (address provider, uint256 price, uint256 openAmount, uint256 claimableAmount)\n {\n (BookId bookId, Tick tick,) = orderId.decode();\n IBookManager.BookKey memory key = bookManager.getBookKey(bookId);\n uint256 unitSize = key.unitSize;\n price = tick.toPrice();\n IBookManager.OrderInfo memory orderInfo = bookManager.getOrder(orderId);\n provider = orderInfo.provider;\n openAmount = unitSize * orderInfo.open;\n FeePolicy makerPolicy = key.makerPolicy;\n claimableAmount = tick.quoteToBase(unitSize * orderInfo.claimable, false);\n if (!makerPolicy.usesQuote()) {\n int256 fee = makerPolicy.calculateFee(claimableAmount, false);\n claimableAmount = fee > 0 ? claimableAmount - uint256(fee) : claimableAmount + uint256(-fee);\n }\n }\n\n function fromPrice(uint256 price) external pure returns (Tick) {\n return price.fromPrice();\n }\n\n function toPrice(Tick tick) external pure returns (uint256) {\n return tick.toPrice();\n }\n\n function lockAcquired(address sender, bytes memory data) external nonReentrant returns (bytes memory returnData) {\n if (msg.sender != address(bookManager) || sender != address(this)) revert InvalidAccess();\n (address user, Action[] memory actionList, bytes[] memory orderParamsList, address[] memory tokensToSettle) =\n abi.decode(data, (address, Action[], bytes[], address[]));\n\n uint256 length = actionList.length;\n OrderId[] memory ids = new OrderId[](length);\n uint256 orderIdIndex;\n\n for (uint256 i = 0; i < length; ++i) {\n Action action = actionList[i];\n if (action == Action.OPEN) {\n _open(abi.decode(orderParamsList[i], (OpenBookParams)));\n } else if (action == Action.MAKE) {\n OrderId id = _make(abi.decode(orderParamsList[i], (MakeOrderParams)));\n if (OrderId.unwrap(id) != 0) {\n bookManager.transferFrom(address(this), user, OrderId.unwrap(id));\n ids[orderIdIndex++] = id;\n }\n } else if (action == Action.LIMIT) {\n OrderId id = _limit(abi.decode(orderParamsList[i], (LimitOrderParams)));\n if (OrderId.unwrap(id) != 0) {\n bookManager.transferFrom(address(this), user, OrderId.unwrap(id));\n ids[orderIdIndex++] = id;\n }\n } else if (action == Action.TAKE) {\n _take(abi.decode(orderParamsList[i], (TakeOrderParams)));\n } else if (action == Action.SPEND) {\n _spend(abi.decode(orderParamsList[i], (SpendOrderParams)));\n } else if (action == Action.CLAIM) {\n ClaimOrderParams memory claimOrderParams = abi.decode(orderParamsList[i], (ClaimOrderParams));\n uint256 orderId = OrderId.unwrap(claimOrderParams.id);\n bookManager.checkAuthorized(bookManager.ownerOf(orderId), user, orderId);\n _claim(claimOrderParams);\n } else if (action == Action.CANCEL) {\n CancelOrderParams memory cancelOrderParams = abi.decode(orderParamsList[i], (CancelOrderParams));\n uint256 orderId = OrderId.unwrap(cancelOrderParams.id);\n bookManager.checkAuthorized(bookManager.ownerOf(orderId), user, orderId);\n _cancel(cancelOrderParams);\n } else {\n revert InvalidAction();\n }\n }\n\n _settleTokens(user, tokensToSettle);\n\n assembly {\n mstore(ids, orderIdIndex)\n }\n returnData = abi.encode(ids);\n }\n\n function execute(\n Action[] calldata actionList,\n bytes[] calldata paramsDataList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata erc20PermitParamsList,\n ERC721PermitParams[] calldata erc721PermitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) returns (OrderId[] memory ids) {\n if (actionList.length != paramsDataList.length) revert InvalidLength();\n _permitERC20(erc20PermitParamsList);\n _permitERC721(erc721PermitParamsList);\n\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bytes memory result = bookManager.lock(address(this), lockData);\n\n if (result.length != 0) {\n (ids) = abi.decode(result, (OrderId[]));\n }\n return ids;\n }\n\n function open(OpenBookParams[] calldata openBookParamsList, uint64 deadline) external checkDeadline(deadline) {\n uint256 length = openBookParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.OPEN;\n paramsDataList[i] = abi.encode(openBookParamsList[i]);\n }\n address[] memory tokensToSettle;\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function limit(\n LimitOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) returns (OrderId[] memory ids) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.LIMIT;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bytes memory result = bookManager.lock(address(this), lockData);\n (ids) = abi.decode(result, (OrderId[]));\n }\n\n function make(\n MakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) returns (OrderId[] memory ids) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.MAKE;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bytes memory result = bookManager.lock(address(this), lockData);\n (ids) = abi.decode(result, (OrderId[]));\n }\n\n function take(\n TakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.TAKE;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function spend(\n SpendOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.SPEND;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function claim(\n ClaimOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external checkDeadline(deadline) {\n _permitERC721(permitParamsList);\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.CLAIM;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function cancel(\n CancelOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external checkDeadline(deadline) {\n _permitERC721(permitParamsList);\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.CANCEL;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function _open(OpenBookParams memory params) internal {\n bookManager.open(params.key, params.hookData);\n }\n\n function _make(MakeOrderParams memory params) internal returns (OrderId id) {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n uint256 quoteAmount = params.quoteAmount;\n if (key.makerPolicy.usesQuote()) {\n quoteAmount = key.makerPolicy.calculateOriginalAmount(quoteAmount, false);\n }\n uint64 unit = (quoteAmount / key.unitSize).toUint64();\n if (unit > 0) {\n (id,) = bookManager.make(\n IBookManager.MakeParams({key: key, tick: params.tick, unit: unit, provider: address(0)}),\n params.hookData\n );\n }\n return id;\n }\n\n function _limit(LimitOrderParams memory params) internal returns (OrderId id) {\n (bool isQuoteRemained, uint256 spentQuoteAmount) = _spend(\n SpendOrderParams({\n id: params.takeBookId,\n limitPrice: params.limitPrice,\n baseAmount: params.quoteAmount,\n minQuoteAmount: 0,\n hookData: params.takeHookData\n })\n );\n params.quoteAmount -= spentQuoteAmount;\n if (isQuoteRemained) {\n id = _make(\n MakeOrderParams({\n id: params.makeBookId,\n quoteAmount: params.quoteAmount,\n tick: params.tick,\n hookData: params.makeHookData\n })\n );\n }\n }\n\n function _take(TakeOrderParams memory params)\n internal\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\n {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n while (params.quoteAmount > takenQuoteAmount && !bookManager.isEmpty(params.id)) {\n Tick tick = bookManager.getHighest(params.id);\n if (params.limitPrice > tick.toPrice()) break;\n uint256 maxAmount;\n unchecked {\n if (key.takerPolicy.usesQuote()) {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.quoteAmount - takenQuoteAmount, true);\n } else {\n maxAmount = params.quoteAmount - takenQuoteAmount;\n }\n }\n maxAmount = maxAmount.divide(key.unitSize, true);\n\n if (maxAmount == 0) break;\n (uint256 quoteAmount, uint256 baseAmount) = bookManager.take(\n IBookManager.TakeParams({key: key, tick: tick, maxUnit: maxAmount.toUint64()}), params.hookData\n );\n if (quoteAmount == 0) break;\n\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n }\n if (params.maxBaseAmount < spentBaseAmount) revert ControllerSlippage();\n }\n\n function _spend(SpendOrderParams memory params) internal returns (bool isBaseRemained, uint256 spentBaseAmount) {\n uint256 takenQuoteAmount;\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n while (spentBaseAmount < params.baseAmount) {\n if (bookManager.isEmpty(params.id)) {\n isBaseRemained = true;\n break;\n }\n Tick tick = bookManager.getHighest(params.id);\n if (params.limitPrice > tick.toPrice()) {\n isBaseRemained = true;\n break;\n }\n uint256 maxAmount;\n unchecked {\n if (key.takerPolicy.usesQuote()) {\n maxAmount = params.baseAmount - spentBaseAmount;\n } else {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.baseAmount - spentBaseAmount, false);\n }\n }\n maxAmount = tick.baseToQuote(maxAmount, false) / key.unitSize;\n if (maxAmount == 0) break;\n (uint256 quoteAmount, uint256 baseAmount) = bookManager.take(\n IBookManager.TakeParams({key: key, tick: tick, maxUnit: maxAmount.toUint64()}), params.hookData\n );\n if (baseAmount == 0) break;\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n }\n if (params.minQuoteAmount > takenQuoteAmount) revert ControllerSlippage();\n }\n\n function _claim(ClaimOrderParams memory params) internal {\n bookManager.claim(params.id, params.hookData);\n }\n\n function _cancel(CancelOrderParams memory params) internal {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id.getBookId());\n try bookManager.cancel(\n IBookManager.CancelParams({id: params.id, toUnit: (params.leftQuoteAmount / key.unitSize).toUint64()}),\n params.hookData\n ) {} catch {}\n }\n\n function _settleTokens(address user, address[] memory tokensToSettle) internal {\n Currency native = CurrencyLibrary.NATIVE;\n int256 currencyDelta = bookManager.getCurrencyDelta(address(this), native);\n if (currencyDelta < 0) {\n native.transfer(address(bookManager), uint256(-currencyDelta));\n bookManager.settle(native);\n }\n currencyDelta = bookManager.getCurrencyDelta(address(this), native);\n if (currencyDelta > 0) {\n bookManager.withdraw(native, user, uint256(currencyDelta));\n }\n\n uint256 length = tokensToSettle.length;\n for (uint256 i = 0; i < length; ++i) {\n Currency currency = Currency.wrap(tokensToSettle[i]);\n currencyDelta = bookManager.getCurrencyDelta(address(this), currency);\n if (currencyDelta < 0) {\n IERC20(tokensToSettle[i]).safeTransferFrom(user, address(bookManager), uint256(-currencyDelta));\n bookManager.settle(currency);\n }\n currencyDelta = bookManager.getCurrencyDelta(address(this), currency);\n if (currencyDelta > 0) {\n bookManager.withdraw(Currency.wrap(tokensToSettle[i]), user, uint256(currencyDelta));\n }\n uint256 balance = IERC20(tokensToSettle[i]).balanceOf(address(this));\n if (balance > 0) {\n IERC20(tokensToSettle[i]).transfer(user, balance);\n }\n }\n if (address(this).balance > 0) native.transfer(user, address(this).balance);\n }\n\n function _permitERC20(ERC20PermitParams[] calldata permitParamsList) internal {\n for (uint256 i = 0; i < permitParamsList.length; ++i) {\n ERC20PermitParams memory permitParams = permitParamsList[i];\n if (permitParams.signature.deadline > 0) {\n try IERC20Permit(permitParams.token).permit(\n msg.sender,\n address(this),\n permitParams.permitAmount,\n permitParams.signature.deadline,\n permitParams.signature.v,\n permitParams.signature.r,\n permitParams.signature.s\n ) {} catch {}\n }\n }\n }\n\n function _permitERC721(ERC721PermitParams[] calldata permitParamsList) internal {\n for (uint256 i = 0; i < permitParamsList.length; ++i) {\n PermitSignature memory signature = permitParamsList[i].signature;\n if (signature.deadline > 0) {\n try IERC721Permit(address(bookManager)).permit(\n address(this),\n permitParamsList[i].tokenId,\n signature.deadline,\n signature.v,\n signature.r,\n signature.s\n ) {} catch {}\n }\n }\n }\n\n receive() external payable {}\n}\n" + }, + "src/interfaces/IBookViewer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {BookId} from \"v2-core/libraries/BookId.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Tick} from \"v2-core/libraries/Tick.sol\";\n\nimport {IController} from \"./IController.sol\";\n\n/**\n * @title IBookViewer\n * @notice Interface for the book viewer contract\n */\ninterface IBookViewer {\n struct Liquidity {\n Tick tick;\n uint64 depth;\n }\n\n /**\n * @notice Returns the book manager\n * @return The instance of the book manager\n */\n function bookManager() external view returns (IBookManager);\n\n /**\n * @notice Returns the liquidity for a specific book\n * @param id The id of the book\n * @param from The starting tick\n * @param n The number of ticks to return\n * @return liquidity An array of liquidity data\n */\n function getLiquidity(BookId id, Tick from, uint256 n) external view returns (Liquidity[] memory liquidity);\n\n /**\n * @notice Returns the expected input for a take order\n * @param params The parameters of the take order\n * @return takenQuoteAmount The expected taken quote amount\n * @return spentBaseAmount The expected spend base amount\n */\n function getExpectedInput(IController.TakeOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount);\n\n /**\n * @notice Returns the expected output for a spend order\n * @param params The parameters of the spend order\n * @return takenQuoteAmount The expected taken quote amount\n * @return spentBaseAmount The expected spend base amount\n */\n function getExpectedOutput(IController.SpendOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount);\n}\n" + }, + "src/interfaces/IController.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {OrderId} from \"v2-core/libraries/OrderId.sol\";\nimport {BookId} from \"v2-core/libraries/BookId.sol\";\nimport {Tick} from \"v2-core/libraries/Tick.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\n\n/**\n * @title IController\n * @notice Interface for the controller contract\n */\ninterface IController {\n // Error messages\n error InvalidAccess();\n error InvalidLength();\n error Deadline();\n error ControllerSlippage();\n error InvalidAction();\n\n /**\n * @notice Enum for the different actions that can be performed\n */\n enum Action {\n OPEN,\n MAKE,\n LIMIT,\n TAKE,\n SPEND,\n CLAIM,\n CANCEL\n }\n\n /**\n * @notice Struct for the parameters of the ERC20 permit\n */\n struct ERC20PermitParams {\n address token;\n uint256 permitAmount;\n PermitSignature signature;\n }\n\n /**\n * @notice Struct for the parameters of the ERC721 permit\n */\n struct ERC721PermitParams {\n uint256 tokenId;\n PermitSignature signature;\n }\n\n /**\n * @notice Struct for the signature of the permit\n */\n struct PermitSignature {\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n\n /**\n * @notice Struct for the parameters of the open book action\n */\n struct OpenBookParams {\n IBookManager.BookKey key;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the make order action\n */\n struct MakeOrderParams {\n BookId id;\n Tick tick;\n uint256 quoteAmount;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the limit order action\n */\n struct LimitOrderParams {\n BookId takeBookId;\n BookId makeBookId;\n uint256 limitPrice;\n Tick tick;\n uint256 quoteAmount;\n bytes takeHookData;\n bytes makeHookData;\n }\n\n /**\n * @notice Struct for the parameters of the take order action\n */\n struct TakeOrderParams {\n BookId id;\n uint256 limitPrice;\n uint256 quoteAmount;\n uint256 maxBaseAmount;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the spend order action\n */\n struct SpendOrderParams {\n BookId id;\n uint256 limitPrice;\n uint256 baseAmount;\n uint256 minQuoteAmount;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the claim order action\n */\n struct ClaimOrderParams {\n OrderId id;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the cancel order action\n */\n struct CancelOrderParams {\n OrderId id;\n uint256 leftQuoteAmount;\n bytes hookData;\n }\n\n /**\n * @notice Returns the book manager\n * @return The instance of the book manager\n */\n function bookManager() external view returns (IBookManager);\n\n /**\n * @notice Opens a book\n * @param openBookParamsList The parameters of the open book action\n * @param deadline The deadline for the action\n */\n function open(OpenBookParams[] calldata openBookParamsList, uint64 deadline) external;\n\n /**\n * @notice Returns the depth of a book\n * @param id The id of the book\n * @param tick The tick of the book\n * @return The depth of the book in quote amount\n */\n function getDepth(BookId id, Tick tick) external view returns (uint256);\n\n /**\n * @notice Returns the highest price of a book\n * @param id The id of the book\n * @return The highest price of the book with 2**96 precision\n */\n function getHighestPrice(BookId id) external view returns (uint256);\n\n /**\n * @notice Returns the details of an order\n * @param orderId The id of the order\n * @return provider The provider of the order\n * @return price The price of the order with 2**96 precision\n * @return openAmount The open quote amount of the order\n * @return claimableAmount The claimable base amount of the order\n */\n function getOrder(OrderId orderId)\n external\n view\n returns (address provider, uint256 price, uint256 openAmount, uint256 claimableAmount);\n\n /**\n * @notice Converts a price to a tick\n * @param price The price to convert\n * @return The tick\n */\n function fromPrice(uint256 price) external pure returns (Tick);\n\n /**\n * @notice Converts a tick to a price\n * @param tick The tick to convert\n * @return The price with 2**96 precision\n */\n function toPrice(Tick tick) external pure returns (uint256);\n\n /**\n * @notice Executes a list of actions\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param actionList The list of actions to execute\n * @param paramsDataList The parameters of the actions\n * @param tokensToSettle The tokens to settle\n * @param erc20PermitParamsList The parameters of the ERC20 permits\n * @param erc721PermitParamsList The parameters of the ERC721 permits\n * @param deadline The deadline for the actions\n * @return ids The ids of the orders\n */\n function execute(\n Action[] calldata actionList,\n bytes[] calldata paramsDataList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata erc20PermitParamsList,\n ERC721PermitParams[] calldata erc721PermitParamsList,\n uint64 deadline\n ) external payable returns (OrderId[] memory ids);\n\n /**\n * @notice Makes a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to make\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n * @return ids The ids of the orders\n */\n function make(\n MakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable returns (OrderId[] memory ids);\n\n /**\n * @notice Takes a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to take\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function take(\n TakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable;\n\n /**\n * @notice Spends to take a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to spend\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function spend(\n SpendOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable;\n\n /**\n * @notice Claims a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to claim\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function claim(\n ClaimOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external;\n\n /**\n * @notice Cancels a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to cancel\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function cancel(\n CancelOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external;\n}\n" + }, + "src/interfaces/IProvider.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {IProviderFactory} from \"./IProviderFactory.sol\";\n\ninterface IProvider {\n event Claim(\n address indexed broker,\n address indexed protocolTreasury,\n Currency indexed currency,\n uint256 brokerShare,\n uint256 protocolShare\n );\n\n function factory() external returns (IProviderFactory);\n\n function broker() external returns (address);\n\n function shareRatio() external returns (uint256);\n\n function claim(Currency[] calldata currencies) external;\n}\n" + }, + "src/interfaces/IProviderFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\n\ninterface IProviderFactory {\n event DeployProvider(address indexed provider, address indexed broker, uint256 shareRatio);\n\n event SetTreasury(address indexed treasury);\n\n function bookManager() external returns (IBookManager);\n\n function treasury() external returns (address);\n\n function deployProvider(address broker) external returns (address);\n\n function deployProvider(address broker, uint256 shareRatio) external returns (address);\n\n function setTreasury(address newTreasury) external;\n\n /**\n * @notice Whitelists a provider\n * @param provider The provider address\n */\n function whitelist(address provider) external;\n\n /**\n * @notice Delists a provider\n * @param provider The provider address\n */\n function delist(address provider) external;\n\n /**\n * @notice Sets the default provider\n * @param newDefaultProvider The new default provider address\n */\n function setDefaultProvider(address newDefaultProvider) external;\n\n function transferBookManagerOwnership(address newOwner) external;\n}\n" + }, + "src/libraries/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.24;\n\nabstract contract ReentrancyGuard {\n // uint256(keccak256(\"ReentrancyGuard\")) - 1\n uint256 internal constant REENTRANCY_GUARD_SLOT = 0x8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf4;\n\n error ReentrancyGuardReentrantCall();\n\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n if (_reentrancyGuardEntered()) {\n revert ReentrancyGuardReentrantCall();\n }\n assembly {\n // Any calls to nonReentrant after this point will fail\n tstore(REENTRANCY_GUARD_SLOT, 1)\n }\n }\n\n function _nonReentrantAfter() private {\n assembly {\n tstore(REENTRANCY_GUARD_SLOT, 0)\n }\n }\n\n function _reentrancyGuardEntered() internal view returns (bool isEntered) {\n assembly {\n isEntered := tload(REENTRANCY_GUARD_SLOT)\n }\n }\n}\n" + }, + "src/Provider.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {IProvider} from \"./interfaces/IProvider.sol\";\nimport {IProviderFactory} from \"./interfaces/IProviderFactory.sol\";\n\ncontract Provider is IProvider {\n using CurrencyLibrary for Currency;\n\n uint256 public constant RATE_PRECISION = 10 ** 6;\n\n IBookManager private immutable _bookManager;\n IProviderFactory public immutable factory;\n address public immutable broker;\n uint256 public immutable shareRatio;\n\n constructor(address broker_, uint256 shareRatio_) {\n factory = IProviderFactory(msg.sender);\n _bookManager = factory.bookManager();\n broker = broker_;\n shareRatio = shareRatio_;\n }\n\n function claim(Currency[] calldata currencies) external {\n address protocolTreasury = factory.treasury();\n for (uint256 i = 0; i < currencies.length; ++i) {\n Currency currency = currencies[i];\n _bookManager.collect(address(this), currency);\n uint256 balance = currency.balanceOfSelf();\n uint256 brokerShare = balance * shareRatio / RATE_PRECISION;\n uint256 protocolShare = balance - brokerShare;\n currency.transfer(broker, brokerShare);\n currency.transfer(protocolTreasury, protocolShare);\n emit Claim(broker, protocolTreasury, currency, brokerShare, protocolShare);\n }\n }\n\n receive() external payable {}\n}\n" + }, + "src/ProviderFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {Ownable2Step, Ownable} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport {IProviderFactory} from \"./interfaces/IProviderFactory.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Provider} from \"./Provider.sol\";\n\ncontract ProviderFactory is IProviderFactory, UUPSUpgradeable, Ownable2Step, Initializable {\n uint256 public defaultBrokerShareRatio;\n IBookManager public bookManager;\n address public treasury;\n\n constructor() Ownable(msg.sender) {}\n\n function __ProviderFactory_init(\n address owner_,\n address bookManager_,\n address treasury_,\n uint256 defaultBrokerShareRatio_\n ) public initializer {\n _transferOwnership(owner_);\n Ownable2Step(bookManager_).acceptOwnership();\n bookManager = IBookManager(bookManager_);\n treasury = treasury_;\n defaultBrokerShareRatio = defaultBrokerShareRatio_;\n }\n\n function _authorizeUpgrade(address) internal override onlyOwner {}\n\n function deployProvider(address broker) external returns (address) {\n return _deployProvider(broker, defaultBrokerShareRatio);\n }\n\n function deployProvider(address broker, uint256 shareRatio) public onlyOwner returns (address) {\n return _deployProvider(broker, shareRatio);\n }\n\n function _deployProvider(address broker, uint256 shareRatio) internal returns (address provider) {\n provider = address(new Provider(broker, shareRatio));\n bookManager.whitelist(provider);\n emit DeployProvider(provider, broker, shareRatio);\n }\n\n function setTreasury(address newTreasury) external onlyOwner {\n treasury = newTreasury;\n emit SetTreasury(newTreasury);\n }\n\n function whitelist(address provider) external onlyOwner {\n bookManager.whitelist(provider);\n }\n\n function delist(address provider) external onlyOwner {\n bookManager.delist(provider);\n }\n\n function setDefaultProvider(address newDefaultProvider) external onlyOwner {\n bookManager.setDefaultProvider(newDefaultProvider);\n }\n\n function transferBookManagerOwnership(address newOwner) external onlyOwner {\n Ownable2Step(address(bookManager)).transferOwnership(newOwner);\n }\n}\n" + }, + "v2-core/interfaces/IBookManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\n\nimport {BookId} from \"../libraries/BookId.sol\";\nimport {Currency} from \"../libraries/Currency.sol\";\nimport {OrderId} from \"../libraries/OrderId.sol\";\nimport {Tick} from \"../libraries/Tick.sol\";\nimport {FeePolicy} from \"../libraries/FeePolicy.sol\";\nimport {IERC721Permit} from \"./IERC721Permit.sol\";\nimport {IHooks} from \"./IHooks.sol\";\n\n/**\n * @title IBookManager\n * @notice The interface for the BookManager contract\n */\ninterface IBookManager is IERC721Metadata, IERC721Permit {\n error InvalidUnitSize();\n error InvalidFeePolicy();\n error InvalidProvider(address provider);\n error LockedBy(address locker, address hook);\n error CurrencyNotSettled();\n\n /**\n * @notice Event emitted when a new book is opened\n * @param id The book id\n * @param base The base currency\n * @param quote The quote currency\n * @param unitSize The unit size of the book\n * @param makerPolicy The maker fee policy\n * @param takerPolicy The taker fee policy\n * @param hooks The hooks contract\n */\n event Open(\n BookId indexed id,\n Currency indexed base,\n Currency indexed quote,\n uint64 unitSize,\n FeePolicy makerPolicy,\n FeePolicy takerPolicy,\n IHooks hooks\n );\n\n /**\n * @notice Event emitted when a new order is made\n * @param bookId The book id\n * @param user The user address\n * @param tick The order tick\n * @param orderIndex The order index\n * @param unit The order unit\n * @param provider The provider address\n */\n event Make(\n BookId indexed bookId, address indexed user, Tick tick, uint256 orderIndex, uint64 unit, address provider\n );\n\n /**\n * @notice Event emitted when an order is taken\n * @param bookId The book id\n * @param user The user address\n * @param tick The order tick\n * @param unit The order unit\n */\n event Take(BookId indexed bookId, address indexed user, Tick tick, uint64 unit);\n\n /**\n * @notice Event emitted when an order is canceled\n * @param orderId The order id\n * @param unit The canceled unit\n */\n event Cancel(OrderId indexed orderId, uint64 unit);\n\n /**\n * @notice Event emitted when an order is claimed\n * @param orderId The order id\n * @param unit The claimed unit\n */\n event Claim(OrderId indexed orderId, uint64 unit);\n\n /**\n * @notice Event emitted when a provider is whitelisted\n * @param provider The provider address\n */\n event Whitelist(address indexed provider);\n\n /**\n * @notice Event emitted when a provider is delisted\n * @param provider The provider address\n */\n event Delist(address indexed provider);\n\n /**\n * @notice Event emitted when a provider collects fees\n * @param provider The provider address\n * @param recipient The recipient address\n * @param currency The currency\n * @param amount The collected amount\n */\n event Collect(address indexed provider, address indexed recipient, Currency indexed currency, uint256 amount);\n\n /**\n * @notice Event emitted when new default provider is set\n * @param newDefaultProvider The new default provider address\n */\n event SetDefaultProvider(address indexed newDefaultProvider);\n\n /**\n * @notice This structure represents a unique identifier for a book in the BookManager.\n * @param base The base currency of the book\n * @param unitSize The unit size of the book\n * @param quote The quote currency of the book\n * @param makerPolicy The maker fee policy of the book\n * @param hooks The hooks contract of the book\n * @param takerPolicy The taker fee policy of the book\n */\n struct BookKey {\n Currency base;\n uint64 unitSize;\n Currency quote;\n FeePolicy makerPolicy;\n IHooks hooks;\n FeePolicy takerPolicy;\n }\n\n /**\n * @notice Returns the base URI\n * @return The base URI\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI\n * @return The contract URI\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the default provider\n * @return The default provider\n */\n function defaultProvider() external view returns (address);\n\n /**\n * @notice Returns the total reserves of a given currency\n * @param currency The currency in question\n * @return The total reserves amount\n */\n function reservesOf(Currency currency) external view returns (uint256);\n\n /**\n * @notice Checks if a provider is whitelisted\n * @param provider The address of the provider\n * @return True if the provider is whitelisted, false otherwise\n */\n function isWhitelisted(address provider) external view returns (bool);\n\n /**\n * @notice Verifies if an owner has authorized a spender for a token\n * @param owner The address of the token owner\n * @param spender The address of the spender\n * @param tokenId The token ID\n */\n function checkAuthorized(address owner, address spender, uint256 tokenId) external view;\n\n /**\n * @notice Calculates the amount owed to a provider in a given currency\n * @param provider The provider's address\n * @param currency The currency in question\n * @return The owed amount\n */\n function tokenOwed(address provider, Currency currency) external view returns (uint256);\n\n /**\n * @notice Calculates the currency balance changes for a given locker\n * @param locker The address of the locker\n * @param currency The currency in question\n * @return The net change in currency balance\n */\n function getCurrencyDelta(address locker, Currency currency) external view returns (int256);\n\n /**\n * @notice Retrieves the book key for a given book ID\n * @param id The book ID\n * @return The book key\n */\n function getBookKey(BookId id) external view returns (BookKey memory);\n\n /**\n * @notice This structure represents a current status for an order in the BookManager.\n * @param provider The provider of the order\n * @param open The open unit of the order\n * @param claimable The claimable unit of the order\n */\n struct OrderInfo {\n address provider;\n uint64 open;\n uint64 claimable;\n }\n\n /**\n * @notice Provides information about an order\n * @param id The order ID\n * @return Order information including provider, open status, and claimable unit\n */\n function getOrder(OrderId id) external view returns (OrderInfo memory);\n\n /**\n * @notice Retrieves the locker and caller addresses for a given lock\n * @param i The index of the lock\n * @return locker The locker's address\n * @return lockCaller The caller's address\n */\n function getLock(uint256 i) external view returns (address locker, address lockCaller);\n\n /**\n * @notice Provides the lock data\n * @return The lock data including necessary numeric values\n */\n function getLockData() external view returns (uint128, uint128);\n\n /**\n * @notice Returns the depth of a given book ID and tick\n * @param id The book ID\n * @param tick The tick\n * @return The depth of the tick\n */\n function getDepth(BookId id, Tick tick) external view returns (uint64);\n\n /**\n * @notice Retrieves the highest tick for a given book ID\n * @param id The book ID\n * @return tick The highest tick\n */\n function getHighest(BookId id) external view returns (Tick tick);\n\n /**\n * @notice Finds the maximum tick less than a specified tick in a book\n * @dev Returns `Tick.wrap(type(int24).min)` if the specified tick is the lowest\n * @param id The book ID\n * @param tick The specified tick\n * @return The next lower tick\n */\n function maxLessThan(BookId id, Tick tick) external view returns (Tick);\n\n /**\n * @notice Checks if a book is opened\n * @param id The book ID\n * @return True if the book is opened, false otherwise\n */\n function isOpened(BookId id) external view returns (bool);\n\n /**\n * @notice Checks if a book is empty\n * @param id The book ID\n * @return True if the book is empty, false otherwise\n */\n function isEmpty(BookId id) external view returns (bool);\n\n /**\n * @notice Encodes a BookKey into a BookId\n * @param key The BookKey to encode\n * @return The encoded BookId\n */\n function encodeBookKey(BookKey calldata key) external pure returns (BookId);\n\n /**\n * @notice Loads a value from a specific storage slot\n * @param slot The storage slot\n * @return The value in the slot\n */\n function load(bytes32 slot) external view returns (bytes32);\n\n /**\n * @notice Loads a sequence of values starting from a specific slot\n * @param startSlot The starting slot\n * @param nSlot The number of slots to load\n * @return The sequence of values\n */\n function load(bytes32 startSlot, uint256 nSlot) external view returns (bytes memory);\n\n /**\n * @notice Opens a new book\n * @param key The book key\n * @param hookData The hook data\n */\n function open(BookKey calldata key, bytes calldata hookData) external;\n\n /**\n * @notice Locks a book manager function\n * @param locker The locker address\n * @param data The lock data\n * @return The lock return data\n */\n function lock(address locker, bytes calldata data) external returns (bytes memory);\n\n /**\n * @notice This structure represents the parameters for making an order.\n * @param key The book key for the order\n * @param tick The tick for the order\n * @param unit The unit for the order. Times key.unitSize to get actual bid amount.\n * @param provider The provider for the order. The limit order service provider address to collect fees.\n */\n struct MakeParams {\n BookKey key;\n Tick tick;\n uint64 unit;\n address provider;\n }\n\n /**\n * @notice Make a limit order\n * @param params The order parameters\n * @param hookData The hook data\n * @return id The order id. Returns 0 if the order is not settled\n * @return quoteAmount The amount of quote currency to be paid\n */\n function make(MakeParams calldata params, bytes calldata hookData)\n external\n returns (OrderId id, uint256 quoteAmount);\n\n /**\n * @notice This structure represents the parameters for taking orders in the specified tick.\n * @param key The book key for the order\n * @param tick The tick for the order\n * @param maxUnit The max unit to take\n */\n struct TakeParams {\n BookKey key;\n Tick tick;\n uint64 maxUnit;\n }\n\n /**\n * @notice Take a limit order at specific tick\n * @param params The order parameters\n * @param hookData The hook data\n * @return quoteAmount The amount of quote currency to be received\n * @return baseAmount The amount of base currency to be paid\n */\n function take(TakeParams calldata params, bytes calldata hookData)\n external\n returns (uint256 quoteAmount, uint256 baseAmount);\n\n /**\n * @notice This structure represents the parameters for canceling an order.\n * @param id The order id for the order\n * @param toUnit The remaining open unit for the order after cancellation. Must not exceed the current open unit.\n */\n struct CancelParams {\n OrderId id;\n uint64 toUnit;\n }\n\n /**\n * @notice Cancel a limit order\n * @param params The order parameters\n * @param hookData The hook data\n * @return canceledAmount The amount of quote currency canceled\n */\n function cancel(CancelParams calldata params, bytes calldata hookData) external returns (uint256 canceledAmount);\n\n /**\n * @notice Claims an order\n * @param id The order ID\n * @param hookData The hook data\n * @return claimedAmount The amount claimed\n */\n function claim(OrderId id, bytes calldata hookData) external returns (uint256 claimedAmount);\n\n /**\n * @notice Collects fees from a provider\n * @param recipient The recipient address\n * @param currency The currency\n * @return The collected amount\n */\n function collect(address recipient, Currency currency) external returns (uint256);\n\n /**\n * @notice Withdraws a currency\n * @param currency The currency\n * @param to The recipient address\n * @param amount The amount\n */\n function withdraw(Currency currency, address to, uint256 amount) external;\n\n /**\n * @notice Settles a currency\n * @param currency The currency\n * @return The settled amount\n */\n function settle(Currency currency) external payable returns (uint256);\n\n /**\n * @notice Whitelists a provider\n * @param provider The provider address\n */\n function whitelist(address provider) external;\n\n /**\n * @notice Delists a provider\n * @param provider The provider address\n */\n function delist(address provider) external;\n\n /**\n * @notice Sets the default provider\n * @param newDefaultProvider The new default provider address\n */\n function setDefaultProvider(address newDefaultProvider) external;\n}\n" + }, + "v2-core/interfaces/IERC721Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/**\n * @title IERC721Permit\n * @notice An interface for the ERC721 permit extension\n */\ninterface IERC721Permit is IERC721 {\n error InvalidSignature();\n error PermitExpired();\n\n /**\n * @notice The EIP-712 typehash for the permit struct used by the contract\n */\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n /**\n * @notice The EIP-712 domain separator for this contract\n */\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n /**\n * @notice Approve the spender to transfer the given tokenId\n * @param spender The address to approve\n * @param tokenId The tokenId to approve\n * @param deadline The deadline for the signature\n * @param v The recovery id of the signature\n * @param r The r value of the signature\n * @param s The s value of the signature\n */\n function permit(address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;\n\n /**\n * @notice Get the current nonce for a token\n * @param tokenId The tokenId to get the nonce for\n * @return The current nonce\n */\n function nonces(uint256 tokenId) external view returns (uint256);\n}\n" + }, + "v2-core/interfaces/IHooks.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport {IBookManager} from \"./IBookManager.sol\";\nimport {OrderId} from \"../libraries/OrderId.sol\";\n\n/**\n * @title IHooks\n * @notice Interface for the hooks contract\n */\ninterface IHooks {\n /**\n * @notice Hook called before opening a new book\n * @param sender The sender of the open transaction\n * @param key The key of the book being opened\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after opening a new book\n * @param sender The sender of the open transaction\n * @param key The key of the book being opened\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called before making a new order\n * @param sender The sender of the make transaction\n * @param params The parameters of the make transaction\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeMake(address sender, IBookManager.MakeParams calldata params, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after making a new order\n * @param sender The sender of the make transaction\n * @param params The parameters of the make transaction\n * @param orderId The id of the order that was made\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterMake(\n address sender,\n IBookManager.MakeParams calldata params,\n OrderId orderId,\n bytes calldata hookData\n ) external returns (bytes4);\n\n /**\n * @notice Hook called before taking an order\n * @param sender The sender of the take transaction\n * @param params The parameters of the take transaction\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeTake(address sender, IBookManager.TakeParams calldata params, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after taking an order\n * @param sender The sender of the take transaction\n * @param params The parameters of the take transaction\n * @param takenUnit The unit that was taken\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterTake(\n address sender,\n IBookManager.TakeParams calldata params,\n uint64 takenUnit,\n bytes calldata hookData\n ) external returns (bytes4);\n\n /**\n * @notice Hook called before canceling an order\n * @param sender The sender of the cancel transaction\n * @param params The parameters of the cancel transaction\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeCancel(address sender, IBookManager.CancelParams calldata params, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after canceling an order\n * @param sender The sender of the cancel transaction\n * @param params The parameters of the cancel transaction\n * @param canceledUnit The unit that was canceled\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterCancel(\n address sender,\n IBookManager.CancelParams calldata params,\n uint64 canceledUnit,\n bytes calldata hookData\n ) external returns (bytes4);\n\n /**\n * @notice Hook called before claiming an order\n * @param sender The sender of the claim transaction\n * @param orderId The id of the order being claimed\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeClaim(address sender, OrderId orderId, bytes calldata hookData) external returns (bytes4);\n\n /**\n * @notice Hook called after claiming an order\n * @param sender The sender of the claim transaction\n * @param orderId The id of the order being claimed\n * @param claimedUnit The unit that was claimed\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterClaim(address sender, OrderId orderId, uint64 claimedUnit, bytes calldata hookData)\n external\n returns (bytes4);\n}\n" + }, + "v2-core/interfaces/ILocker.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title ILocker\n * @notice Interface for the locker contract\n */\ninterface ILocker {\n /**\n * @notice Called by the book manager on `msg.sender` when a lock is acquired\n * @param data The data that was passed to the call to lock\n * @return Any data that you want to be returned from the lock call\n */\n function lockAcquired(address lockCaller, bytes calldata data) external returns (bytes memory);\n}\n" + }, + "v2-core/libraries/BookId.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {IBookManager} from \"../interfaces/IBookManager.sol\";\n\ntype BookId is uint192;\n\nlibrary BookIdLibrary {\n function toId(IBookManager.BookKey memory bookKey) internal pure returns (BookId id) {\n bytes32 hash = keccak256(abi.encode(bookKey));\n assembly {\n id := and(hash, 0xffffffffffffffffffffffffffffffffffffffffffffffff)\n }\n }\n}\n" + }, + "v2-core/libraries/Currency.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ntype Currency is address;\n\n/// @title CurrencyLibrary\n/// @dev This library allows for transferring and holding native tokens and ERC20 tokens\nlibrary CurrencyLibrary {\n using CurrencyLibrary for Currency;\n\n /// @notice Thrown when a native transfer fails\n error NativeTransferFailed();\n\n /// @notice Thrown when an ERC20 transfer fails\n error ERC20TransferFailed();\n\n Currency public constant NATIVE = Currency.wrap(address(0));\n\n function transfer(Currency currency, address to, uint256 amount) internal {\n // implementation from\n // https://github.com/transmissions11/solmate/blob/e8f96f25d48fe702117ce76c79228ca4f20206cb/src/utils/SafeTransferLib.sol\n\n bool success;\n if (currency.isNative()) {\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n if (!success) revert NativeTransferFailed();\n } else {\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument. Masking not required as it's a full 32 byte type.\n\n success :=\n and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), currency, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n if (!success) revert ERC20TransferFailed();\n }\n }\n\n function balanceOfSelf(Currency currency) internal view returns (uint256) {\n if (currency.isNative()) return address(this).balance;\n else return IERC20(Currency.unwrap(currency)).balanceOf(address(this));\n }\n\n function equals(Currency currency, Currency other) internal pure returns (bool) {\n return Currency.unwrap(currency) == Currency.unwrap(other);\n }\n\n function isNative(Currency currency) internal pure returns (bool) {\n return Currency.unwrap(currency) == Currency.unwrap(NATIVE);\n }\n\n function toId(Currency currency) internal pure returns (uint256) {\n return uint160(Currency.unwrap(currency));\n }\n\n function fromId(uint256 id) internal pure returns (Currency) {\n return Currency.wrap(address(uint160(id)));\n }\n}\n" + }, + "v2-core/libraries/FeePolicy.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./Math.sol\";\n\ntype FeePolicy is uint24;\n\nlibrary FeePolicyLibrary {\n uint256 internal constant RATE_PRECISION = 10 ** 6;\n int256 internal constant MAX_FEE_RATE = 500000;\n int256 internal constant MIN_FEE_RATE = -500000;\n\n uint256 internal constant RATE_MASK = 0x7fffff; // 23 bits\n\n error InvalidFeePolicy();\n\n function encode(bool usesQuote_, int24 rate_) internal pure returns (FeePolicy feePolicy) {\n if (rate_ > MAX_FEE_RATE || rate_ < MIN_FEE_RATE) {\n revert InvalidFeePolicy();\n }\n\n uint256 mask = usesQuote_ ? 1 << 23 : 0;\n assembly {\n feePolicy := or(mask, add(and(rate_, 0xffffff), MAX_FEE_RATE))\n }\n }\n\n function isValid(FeePolicy self) internal pure returns (bool) {\n int24 r = rate(self);\n\n return !(r > MAX_FEE_RATE || r < MIN_FEE_RATE);\n }\n\n function usesQuote(FeePolicy self) internal pure returns (bool f) {\n assembly {\n f := shr(23, self)\n }\n }\n\n function rate(FeePolicy self) internal pure returns (int24 r) {\n assembly {\n r := sub(and(self, RATE_MASK), MAX_FEE_RATE)\n }\n }\n\n function calculateFee(FeePolicy self, uint256 amount, bool reverseRounding) internal pure returns (int256 fee) {\n int24 r = rate(self);\n\n bool positive = r > 0;\n uint256 absRate;\n unchecked {\n absRate = uint256(uint24(positive ? r : -r));\n }\n // @dev absFee must be less than type(int256).max\n uint256 absFee = Math.divide(amount * absRate, RATE_PRECISION, reverseRounding ? !positive : positive);\n fee = positive ? int256(absFee) : -int256(absFee);\n }\n\n function calculateOriginalAmount(FeePolicy self, uint256 amount, bool reverseFee)\n internal\n pure\n returns (uint256 originalAmount)\n {\n int24 r = rate(self);\n\n uint256 divider;\n assembly {\n if reverseFee { r := sub(0, r) }\n divider := add(RATE_PRECISION, r)\n }\n originalAmount = Math.divide(amount * RATE_PRECISION, divider, false);\n }\n}\n" + }, + "v2-core/libraries/Lockers.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.23;\n\nimport {IHooks} from \"../interfaces/IHooks.sol\";\n\n/// @author Clober\n/// @author Modified from Uniswap V4 (https://github.com/Uniswap/v4-core/tree/98680ebc1a654120e995d53a5b10ec6fe153066f)\n/// @notice Contains data about pool lockers.\n\n/// @dev This library manages a custom storage implementation for a queue\n/// that tracks current lockers. The \"sentinel\" storage slot for this data structure,\n/// always passed in as IPoolManager.LockData storage self, stores not just the current\n/// length of the queue but also the global count of non-zero deltas across all lockers.\n/// The values of the data structure start at OFFSET, and each value is a locker address.\nlibrary Lockers {\n /// struct LockData {\n /// /// @notice The current number of active lockers\n /// uint128 length;\n /// /// @notice The total number of nonzero deltas over all active + completed lockers\n /// uint128 nonzeroDeltaCount;\n /// }\n // uint256(keccak256(\"LockData\")) + 1\n uint256 internal constant LOCK_DATA_SLOT = 0x760a9a962ae3d184e99c0483cf5684fb3170f47116ca4f445c50209da4f4f907;\n\n // uint256(keccak256(\"Lockers\")) + 1\n uint256 internal constant LOCKERS_SLOT = 0x722b431450ce53c44434ec138439e45a0639fe031b803ee019b776fae5cfa2b1;\n\n // The number of slots per item in the lockers array\n uint256 internal constant LOCKER_STRUCT_SIZE = 2;\n\n // uint256(keccak256(\"HookAddress\")) + 1\n uint256 internal constant HOOK_ADDRESS_SLOT = 0xfcac7593714b88fec0c578a53e9f3f6e4b47eb26c9dcaa7eff23a3ac156be422;\n\n uint256 internal constant NONZERO_DELTA_COUNT_OFFSET = 2 ** 128;\n\n uint256 internal constant LENGTH_MASK = (1 << 128) - 1;\n\n /// @dev Pushes a locker onto the end of the queue, and updates the sentinel storage slot.\n function push(address locker, address lockCaller) internal {\n assembly {\n let data := tload(LOCK_DATA_SLOT)\n let l := and(data, LENGTH_MASK)\n\n // LOCKERS_SLOT + l * LOCKER_STRUCT_SIZE\n let indexToWrite := add(LOCKERS_SLOT, mul(l, LOCKER_STRUCT_SIZE))\n\n // in the next storage slot, write the locker and lockCaller\n tstore(indexToWrite, locker)\n tstore(add(indexToWrite, 1), lockCaller)\n\n // increase the length\n tstore(LOCK_DATA_SLOT, add(data, 1))\n }\n }\n\n function lockData() internal view returns (uint128 l, uint128 nonzeroDeltaCount) {\n assembly {\n let data := tload(LOCK_DATA_SLOT)\n l := and(data, LENGTH_MASK)\n nonzeroDeltaCount := shr(128, data)\n }\n }\n\n function length() internal view returns (uint128 l) {\n assembly {\n l := and(tload(LOCK_DATA_SLOT), LENGTH_MASK)\n }\n }\n\n /// @dev Pops a locker off the end of the queue. Note that no storage gets cleared.\n function pop() internal {\n assembly {\n let data := tload(LOCK_DATA_SLOT)\n let l := and(data, LENGTH_MASK)\n if iszero(l) {\n mstore(0x00, 0xf1c77ed0) // LockersPopFailed()\n revert(0x1c, 0x04)\n }\n\n // LOCKERS_SLOT + (l - 1) * LOCKER_STRUCT_SIZE\n let indexToWrite := add(LOCKERS_SLOT, mul(sub(l, 1), LOCKER_STRUCT_SIZE))\n\n // in the next storage slot, delete the locker and lockCaller\n tstore(indexToWrite, 0)\n tstore(add(indexToWrite, 1), 0)\n\n // decrease the length\n tstore(LOCK_DATA_SLOT, sub(data, 1))\n }\n }\n\n function getLocker(uint256 i) internal view returns (address locker) {\n assembly {\n // LOCKERS_SLOT + (i * LOCKER_STRUCT_SIZE)\n locker := tload(add(LOCKERS_SLOT, mul(i, LOCKER_STRUCT_SIZE)))\n }\n }\n\n function getLockCaller(uint256 i) internal view returns (address locker) {\n assembly {\n // LOCKERS_SLOT + (i * LOCKER_STRUCT_SIZE + 1)\n locker := tload(add(LOCKERS_SLOT, add(mul(i, LOCKER_STRUCT_SIZE), 1)))\n }\n }\n\n function getCurrentLocker() internal view returns (address) {\n unchecked {\n uint256 l = length();\n return l > 0 ? getLocker(l - 1) : address(0);\n }\n }\n\n function getCurrentLockCaller() internal view returns (address) {\n unchecked {\n uint256 l = length();\n return l > 0 ? getLockCaller(l - 1) : address(0);\n }\n }\n\n function incrementNonzeroDeltaCount() internal {\n assembly {\n tstore(LOCK_DATA_SLOT, add(tload(LOCK_DATA_SLOT), NONZERO_DELTA_COUNT_OFFSET))\n }\n }\n\n function decrementNonzeroDeltaCount() internal {\n assembly {\n tstore(LOCK_DATA_SLOT, sub(tload(LOCK_DATA_SLOT), NONZERO_DELTA_COUNT_OFFSET))\n }\n }\n\n function getCurrentHook() internal view returns (IHooks currentHook) {\n return IHooks(getHook(length()));\n }\n\n function getHook(uint256 i) internal view returns (address hook) {\n assembly {\n hook := tload(add(HOOK_ADDRESS_SLOT, i))\n }\n }\n\n function setCurrentHook(IHooks currentHook) internal returns (bool set) {\n // Set the hook address for the current locker if the address is 0.\n // If the address is nonzero, a hook has already been set for this lock, and is not allowed to be updated or cleared at the end of the call.\n if (address(getCurrentHook()) == address(0)) {\n uint256 l = length();\n assembly {\n tstore(add(HOOK_ADDRESS_SLOT, l), currentHook)\n }\n return true;\n }\n }\n\n function clearCurrentHook() internal {\n uint256 l = length();\n assembly {\n tstore(add(HOOK_ADDRESS_SLOT, l), 0)\n }\n }\n}\n" + }, + "v2-core/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n function divide(uint256 a, uint256 b, bool roundingUp) internal pure returns (uint256 ret) {\n // In the OrderBook contract code, b is never zero.\n assembly {\n ret := add(div(a, b), and(gt(mod(a, b), 0), roundingUp))\n }\n }\n\n /// @dev Returns `ln(x)`, denominated in `WAD`.\n /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln\n function lnWad(int256 x) internal pure returns (int256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n // We want to convert `x` from `10**18` fixed point to `2**96` fixed point.\n // We do this by multiplying by `2**96 / 10**18`. But since\n // `ln(x * C) = ln(x) + ln(C)`, we can simply do nothing here\n // and add `ln(2**96 / 10**18)` at the end.\n\n // Compute `k = log2(x) - 96`, `r = 159 - k = 255 - log2(x) = 255 ^ log2(x)`.\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\n r := or(r, shl(3, lt(0xff, shr(r, x))))\n // We place the check here for more optimal stack operations.\n if iszero(sgt(x, 0)) {\n mstore(0x00, 0x1615e638) // `LnWadUndefined()`.\n revert(0x1c, 0x04)\n }\n // forgefmt: disable-next-item\n r := xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)),\n 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff))\n\n // Reduce range of x to (1, 2) * 2**96\n // ln(2^k * x) = k * ln(2) + ln(x)\n x := shr(159, shl(r, x))\n\n // Evaluate using a (8, 8)-term rational approximation.\n // `p` is made monic, we will multiply by a scale factor later.\n // forgefmt: disable-next-item\n let p := sub( // This heavily nested expression is to avoid stack-too-deep for via-ir.\n sar(96, mul(add(43456485725739037958740375743393,\n sar(96, mul(add(24828157081833163892658089445524,\n sar(96, mul(add(3273285459638523848632254066296,\n x), x))), x))), x)), 11111509109440967052023855526967)\n p := sub(sar(96, mul(p, x)), 45023709667254063763336534515857)\n p := sub(sar(96, mul(p, x)), 14706773417378608786704636184526)\n p := sub(mul(p, x), shl(96, 795164235651350426258249787498))\n // We leave `p` in `2**192` basis so we don't need to scale it back up for the division.\n\n // `q` is monic by convention.\n let q := add(5573035233440673466300451813936, x)\n q := add(71694874799317883764090561454958, sar(96, mul(x, q)))\n q := add(283447036172924575727196451306956, sar(96, mul(x, q)))\n q := add(401686690394027663651624208769553, sar(96, mul(x, q)))\n q := add(204048457590392012362485061816622, sar(96, mul(x, q)))\n q := add(31853899698501571402653359427138, sar(96, mul(x, q)))\n q := add(909429971244387300277376558375, sar(96, mul(x, q)))\n\n // `p / q` is in the range `(0, 0.125) * 2**96`.\n\n // Finalization, we need to:\n // - Multiply by the scale factor `s = 5.549…`.\n // - Add `ln(2**96 / 10**18)`.\n // - Add `k * ln(2)`.\n // - Multiply by `10**18 / 2**96 = 5**18 >> 78`.\n\n // The q polynomial is known not to have zeros in the domain.\n // No scaling required because p is already `2**96` too large.\n p := sdiv(p, q)\n // Multiply by the scaling factor: `s * 5**18 * 2**96`, base is now `5**18 * 2**192`.\n p := mul(1677202110996718588342820967067443963516166, p)\n // Add `ln(2) * k * 5**18 * 2**192`.\n // forgefmt: disable-next-item\n p := add(mul(16597577552685614221487285958193947469193820559219878177908093499208371, sub(159, r)), p)\n // Base conversion: mul `2**96 / (5**18 * 2**192)`.\n r := sdiv(p, 302231454903657293676544000000000000000000)\n }\n }\n}\n" + }, + "v2-core/libraries/OrderId.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nimport {Tick} from \"./Tick.sol\";\nimport {BookId} from \"./BookId.sol\";\n\ntype OrderId is uint256;\n\nlibrary OrderIdLibrary {\n /**\n * @dev Encode the order id.\n * @param bookId The book id.\n * @param tick The tick.\n * @param index The index.\n * @return id The order id.\n */\n function encode(BookId bookId, Tick tick, uint40 index) internal pure returns (OrderId id) {\n // @dev If we just use tick at the assembly code, the code will convert tick into bytes32.\n // e.g. When index == -2, the shifted value( shl(40, tick) ) will be\n // 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000 instead of 0xfffffffe0000000000\n // Therefore, we have to safely cast tick into uint256 first.\n uint256 _tick = uint256(uint24(Tick.unwrap(tick)));\n assembly {\n id := add(index, add(shl(40, _tick), shl(64, bookId)))\n }\n }\n\n function decode(OrderId id) internal pure returns (BookId bookId, Tick tick, uint40 index) {\n assembly {\n bookId := shr(64, id)\n tick := and(shr(40, id), 0xffffff)\n index := and(id, 0xffffffffff)\n }\n }\n\n function getBookId(OrderId id) internal pure returns (BookId bookId) {\n assembly {\n bookId := shr(64, id)\n }\n }\n\n function getTick(OrderId id) internal pure returns (Tick tick) {\n assembly {\n tick := and(shr(40, id), 0xffffff)\n }\n }\n\n function getIndex(OrderId id) internal pure returns (uint40 index) {\n assembly {\n index := and(id, 0xffffffffff)\n }\n }\n}\n" + }, + "v2-core/libraries/SignificantBit.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nlibrary SignificantBit {\n // http://supertech.csail.mit.edu/papers/debruijn.pdf\n uint256 internal constant DEBRUIJN_SEQ = 0x818283848586878898A8B8C8D8E8F929395969799A9B9D9E9FAAEB6BEDEEFF;\n bytes internal constant DEBRUIJN_INDEX =\n hex\"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8\";\n\n /**\n * @notice Finds the index of the least significant bit.\n * @param x The value to compute the least significant bit for. Must be a non-zero value.\n * @return ret The index of the least significant bit.\n */\n function leastSignificantBit(uint256 x) internal pure returns (uint8) {\n require(x > 0);\n uint256 index;\n assembly {\n index := shr(248, mul(and(x, add(not(x), 1)), DEBRUIJN_SEQ))\n }\n return uint8(DEBRUIJN_INDEX[index]); // can optimize with CODECOPY opcode\n }\n\n function mostSignificantBit(uint256 x) internal pure returns (uint8 msb) {\n require(x > 0);\n assembly {\n let f := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(5, gt(x, 0xFFFFFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(4, gt(x, 0xFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(3, gt(x, 0xFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(2, gt(x, 0xF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(1, gt(x, 0x3))\n msb := or(msb, f)\n x := shr(f, x)\n f := gt(x, 0x1)\n msb := or(msb, f)\n }\n }\n}\n" + }, + "v2-core/libraries/Tick.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./Math.sol\";\n\ntype Tick is int24;\n\nlibrary TickLibrary {\n using Math for *;\n using TickLibrary for Tick;\n\n error InvalidTick();\n error InvalidPrice();\n error TickOverflow();\n\n int24 internal constant MAX_TICK = 2 ** 19 - 1;\n int24 internal constant MIN_TICK = -MAX_TICK;\n\n uint256 internal constant MIN_PRICE = 1350587;\n uint256 internal constant MAX_PRICE = 4647684107270898330752324302845848816923571339324334;\n\n uint256 private constant _R0 = 0xfff97272373d413259a46990;\n uint256 private constant _R1 = 0xfff2e50f5f656932ef12357c;\n uint256 private constant _R2 = 0xffe5caca7e10e4e61c3624ea;\n uint256 private constant _R3 = 0xffcb9843d60f6159c9db5883;\n uint256 private constant _R4 = 0xff973b41fa98c081472e6896;\n uint256 private constant _R5 = 0xff2ea16466c96a3843ec78b3;\n uint256 private constant _R6 = 0xfe5dee046a99a2a811c461f1;\n uint256 private constant _R7 = 0xfcbe86c7900a88aedcffc83b;\n uint256 private constant _R8 = 0xf987a7253ac413176f2b074c;\n uint256 private constant _R9 = 0xf3392b0822b70005940c7a39;\n uint256 private constant _R10 = 0xe7159475a2c29b7443b29c7f;\n uint256 private constant _R11 = 0xd097f3bdfd2022b8845ad8f7;\n uint256 private constant _R12 = 0xa9f746462d870fdf8a65dc1f;\n uint256 private constant _R13 = 0x70d869a156d2a1b890bb3df6;\n uint256 private constant _R14 = 0x31be135f97d08fd981231505;\n uint256 private constant _R15 = 0x9aa508b5b7a84e1c677de54;\n uint256 private constant _R16 = 0x5d6af8dedb81196699c329;\n uint256 private constant _R17 = 0x2216e584f5fa1ea92604;\n uint256 private constant _R18 = 0x48a170391f7dc42;\n uint256 private constant _R19 = 0x149b34;\n\n function validateTick(Tick tick) internal pure {\n if (Tick.unwrap(tick) > MAX_TICK || Tick.unwrap(tick) < MIN_TICK) revert InvalidTick();\n }\n\n modifier validatePrice(uint256 price) {\n if (price > MAX_PRICE || price < MIN_PRICE) revert InvalidPrice();\n _;\n }\n\n function fromPrice(uint256 price) internal pure validatePrice(price) returns (Tick) {\n unchecked {\n int24 tick = int24((int256(price).lnWad() * 42951820407860) / 2 ** 128);\n if (toPrice(Tick.wrap(tick)) > price) return Tick.wrap(tick - 1);\n return Tick.wrap(tick);\n }\n }\n\n function toPrice(Tick tick) internal pure returns (uint256 price) {\n validateTick(tick);\n int24 tickValue = Tick.unwrap(tick);\n uint256 absTick = uint24(tickValue < 0 ? -tickValue : tickValue);\n\n unchecked {\n if (absTick & 0x1 != 0) price = _R0;\n else price = 1 << 96;\n if (absTick & 0x2 != 0) price = (price * _R1) >> 96;\n if (absTick & 0x4 != 0) price = (price * _R2) >> 96;\n if (absTick & 0x8 != 0) price = (price * _R3) >> 96;\n if (absTick & 0x10 != 0) price = (price * _R4) >> 96;\n if (absTick & 0x20 != 0) price = (price * _R5) >> 96;\n if (absTick & 0x40 != 0) price = (price * _R6) >> 96;\n if (absTick & 0x80 != 0) price = (price * _R7) >> 96;\n if (absTick & 0x100 != 0) price = (price * _R8) >> 96;\n if (absTick & 0x200 != 0) price = (price * _R9) >> 96;\n if (absTick & 0x400 != 0) price = (price * _R10) >> 96;\n if (absTick & 0x800 != 0) price = (price * _R11) >> 96;\n if (absTick & 0x1000 != 0) price = (price * _R12) >> 96;\n if (absTick & 0x2000 != 0) price = (price * _R13) >> 96;\n if (absTick & 0x4000 != 0) price = (price * _R14) >> 96;\n if (absTick & 0x8000 != 0) price = (price * _R15) >> 96;\n if (absTick & 0x10000 != 0) price = (price * _R16) >> 96;\n if (absTick & 0x20000 != 0) price = (price * _R17) >> 96;\n if (absTick & 0x40000 != 0) price = (price * _R18) >> 96;\n }\n if (tickValue > 0) price = 0x1000000000000000000000000000000000000000000000000 / price;\n }\n\n function gt(Tick a, Tick b) internal pure returns (bool) {\n return Tick.unwrap(a) > Tick.unwrap(b);\n }\n\n function baseToQuote(Tick tick, uint256 base, bool roundingUp) internal pure returns (uint256) {\n return Math.divide((base * tick.toPrice()), 1 << 96, roundingUp);\n }\n\n function quoteToBase(Tick tick, uint256 quote, bool roundingUp) internal pure returns (uint256) {\n // @dev quote = unit(uint64) * unitSize(uint64) < 2^96\n // We don't need to check overflow here\n return Math.divide(quote << 96, tick.toPrice(), roundingUp);\n }\n}\n" + } + }, + "settings": { + "evmVersion": "cancun", + "optimizer": { + "enabled": true, + "runs": 1000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/80084/solcInputs/bc262cef2a9e7c4c429d3b8e35df889c.json b/deployments/80084/solcInputs/bc262cef2a9e7c4c429d3b8e35df889c.json new file mode 100644 index 0000000..feb8ab3 --- /dev/null +++ b/deployments/80084/solcInputs/bc262cef2a9e7c4c429d3b8e35df889c.json @@ -0,0 +1,186 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../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 * The initial owner is set to the address provided by the deployer. This can\n * 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 /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\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 if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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 if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\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" + }, + "@openzeppelin/contracts/access/Ownable2Step.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.20;\n\nimport {Ownable} from \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * This extension of the {Ownable} contract includes a two-step mechanism to transfer\n * ownership, where the new owner must call {acceptOwnership} in order to replace the\n * old one. This can help prevent common mistakes, such as transfers of ownership to\n * incorrect accounts, or to contracts that are unable to interact with the\n * permission system.\n *\n * The initial owner is specified at deployment time in the constructor for `Ownable`. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n if (pendingOwner() != sender) {\n revert OwnableUnauthorizedAccount(sender);\n }\n _transferOwnership(sender);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC1363.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1363.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @title IERC1363\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\n *\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\n */\ninterface IERC1363 is IERC20, IERC165 {\n /*\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\n * 0xb0202a11 ===\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\n */\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\n * @param from The address which you want to send tokens from.\n * @param to The address which you want to transfer to.\n * @param value The amount of tokens to be transferred.\n * @param data Additional data with no specified format, sent in call to `to`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\n * @param spender The address which will spend the funds.\n * @param value The amount of tokens to be spent.\n * @param data Additional data with no specified format, sent in call to `spender`.\n * @return A boolean value indicating whether the operation succeeded unless throwing.\n */\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC1967.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"./ERC1967Utils.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an\n * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address implementation, bytes memory _data) payable {\n ERC1967Utils.upgradeToAndCall(implementation, _data);\n }\n\n /**\n * @dev Returns the current implementation address.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function _implementation() internal view virtual override returns (address) {\n return ERC1967Utils.getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.21;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {IERC1967} from \"../../interfaces/IERC1967.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.\n */\nlibrary ERC1967Utils {\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev The `implementation` of the proxy is invalid.\n */\n error ERC1967InvalidImplementation(address implementation);\n\n /**\n * @dev The `admin` of the proxy is invalid.\n */\n error ERC1967InvalidAdmin(address admin);\n\n /**\n * @dev The `beacon` of the proxy is invalid.\n */\n error ERC1967InvalidBeacon(address beacon);\n\n /**\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\n */\n error ERC1967NonPayable();\n\n /**\n * @dev Returns the current implementation address.\n */\n function getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the ERC-1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n if (newImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(newImplementation);\n }\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n _setImplementation(newImplementation);\n emit IERC1967.Upgraded(newImplementation);\n\n if (data.length > 0) {\n Address.functionDelegateCall(newImplementation, data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the ERC-1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n if (newAdmin == address(0)) {\n revert ERC1967InvalidAdmin(address(0));\n }\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {IERC1967-AdminChanged} event.\n */\n function changeAdmin(address newAdmin) internal {\n emit IERC1967.AdminChanged(getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Returns the current beacon.\n */\n function getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the ERC-1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n if (newBeacon.code.length == 0) {\n revert ERC1967InvalidBeacon(newBeacon);\n }\n\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n address beaconImplementation = IBeacon(newBeacon).implementation();\n if (beaconImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(beaconImplementation);\n }\n }\n\n /**\n * @dev Change the beacon and trigger a setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-BeaconUpgraded} event.\n *\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n * efficiency.\n */\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n _setBeacon(newBeacon);\n emit IERC1967.BeaconUpgraded(newBeacon);\n\n if (data.length > 0) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n * if an upgrade doesn't perform an initialization call.\n */\n function _checkNonPayable() private {\n if (msg.value > 0) {\n revert ERC1967NonPayable();\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback\n * function and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Storage of the initializable contract.\n *\n * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions\n * when using with upgradeable contracts.\n *\n * @custom:storage-location erc7201:openzeppelin.storage.Initializable\n */\n struct InitializableStorage {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n uint64 _initialized;\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool _initializing;\n }\n\n // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Initializable\")) - 1)) & ~bytes32(uint256(0xff))\n bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;\n\n /**\n * @dev The contract is already initialized.\n */\n error InvalidInitialization();\n\n /**\n * @dev The contract is not initializing.\n */\n error NotInitializing();\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint64 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any\n * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in\n * production.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n // Cache values to avoid duplicated sloads\n bool isTopLevelCall = !$._initializing;\n uint64 initialized = $._initialized;\n\n // Allowed calls:\n // - initialSetup: the contract is not in the initializing state and no previous version was\n // initialized\n // - construction: the contract is initialized at version 1 (no reininitialization) and the\n // current contract is just being deployed\n bool initialSetup = initialized == 0 && isTopLevelCall;\n bool construction = initialized == 1 && address(this).code.length == 0;\n\n if (!initialSetup && !construction) {\n revert InvalidInitialization();\n }\n $._initialized = 1;\n if (isTopLevelCall) {\n $._initializing = true;\n }\n _;\n if (isTopLevelCall) {\n $._initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint64 version) {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing || $._initialized >= version) {\n revert InvalidInitialization();\n }\n $._initialized = version;\n $._initializing = true;\n _;\n $._initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n _checkInitializing();\n _;\n }\n\n /**\n * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.\n */\n function _checkInitializing() internal view virtual {\n if (!_isInitializing()) {\n revert NotInitializing();\n }\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n // solhint-disable-next-line var-name-mixedcase\n InitializableStorage storage $ = _getInitializableStorage();\n\n if ($._initializing) {\n revert InvalidInitialization();\n }\n if ($._initialized != type(uint64).max) {\n $._initialized = type(uint64).max;\n emit Initialized(type(uint64).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint64) {\n return _getInitializableStorage()._initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _getInitializableStorage()._initializing;\n }\n\n /**\n * @dev Returns a pointer to the storage namespace.\n */\n // solhint-disable-next-line var-name-mixedcase\n function _getInitializableStorage() private pure returns (InitializableStorage storage $) {\n assembly {\n $.slot := INITIALIZABLE_STORAGE\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC1822Proxiable} from \"../../interfaces/draft-IERC1822.sol\";\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\n\n/**\n * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an\n * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.\n *\n * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is\n * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing\n * `UUPSUpgradeable` with a custom implementation of upgrades.\n *\n * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.\n */\nabstract contract UUPSUpgradeable is IERC1822Proxiable {\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable\n address private immutable __self = address(this);\n\n /**\n * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`\n * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n * If the getter returns `\"5.0.0\"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must\n * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n * during an upgrade.\n */\n string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n /**\n * @dev The call is from an unauthorized context.\n */\n error UUPSUnauthorizedCallContext();\n\n /**\n * @dev The storage `slot` is unsupported as a UUID.\n */\n error UUPSUnsupportedProxiableUUID(bytes32 slot);\n\n /**\n * @dev Check that the execution is being performed through a delegatecall call and that the execution context is\n * a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case\n * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a\n * function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to\n * fail.\n */\n modifier onlyProxy() {\n _checkProxy();\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n _checkNotDelegated();\n _;\n }\n\n /**\n * @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the\n * implementation. It is used to validate the implementation's compatibility when performing an upgrade.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.\n */\n function proxiableUUID() external view virtual notDelegated returns (bytes32) {\n return ERC1967Utils.IMPLEMENTATION_SLOT;\n }\n\n /**\n * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call\n * encoded in `data`.\n *\n * Calls {_authorizeUpgrade}.\n *\n * Emits an {Upgraded} event.\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallUUPS(newImplementation, data);\n }\n\n /**\n * @dev Reverts if the execution is not performed via delegatecall or the execution\n * context is not of a proxy with an ERC-1967 compliant implementation pointing to self.\n * See {_onlyProxy}.\n */\n function _checkProxy() internal view virtual {\n if (\n address(this) == __self || // Must be called through delegatecall\n ERC1967Utils.getImplementation() != __self // Must be called through an active proxy\n ) {\n revert UUPSUnauthorizedCallContext();\n }\n }\n\n /**\n * @dev Reverts if the execution is performed via delegatecall.\n * See {notDelegated}.\n */\n function _checkNotDelegated() internal view virtual {\n if (address(this) != __self) {\n // Must not be called through delegatecall\n revert UUPSUnauthorizedCallContext();\n }\n }\n\n /**\n * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by\n * {upgradeToAndCall}.\n *\n * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.\n *\n * ```solidity\n * function _authorizeUpgrade(address) internal onlyOwner {}\n * ```\n */\n function _authorizeUpgrade(address newImplementation) internal virtual;\n\n /**\n * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.\n *\n * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value\n * is expected to be the implementation slot in ERC-1967.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {\n revert UUPSUnsupportedProxiableUUID(slot);\n }\n ERC1967Utils.upgradeToAndCall(newImplementation, data);\n } catch {\n // The implementation is not UUPS\n revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 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 *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\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 * CAUTION: See Security Considerations above.\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" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\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 value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens as the allowance of `spender` over the\n * 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 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` 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(address from, address to, uint256 value) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.sol\";\nimport {Address} from \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC-20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n /**\n * @dev An operation with an ERC-20 token failed.\n */\n error SafeERC20FailedOperation(address token);\n\n /**\n * @dev Indicates a failed `decreaseAllowance` request.\n */\n error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\n\n /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\n }\n\n /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n forceApprove(token, spender, oldAllowance + value);\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\n * value, non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\n unchecked {\n uint256 currentAllowance = token.allowance(address(this), spender);\n if (currentAllowance < requestedDecrease) {\n revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\n }\n forceApprove(token, spender, currentAllowance - requestedDecrease);\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\n * to be set to zero before setting it to a non-zero value, such as USDT.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n safeTransfer(token, to, value);\n } else if (!token.transferAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target\n * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * Reverts if the returned value is other than `true`.\n */\n function transferFromAndCallRelaxed(\n IERC1363 token,\n address from,\n address to,\n uint256 value,\n bytes memory data\n ) internal {\n if (to.code.length == 0) {\n safeTransferFrom(token, from, to, value);\n } else if (!token.transferFromAndCall(from, to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no\n * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when\n * targeting contracts.\n *\n * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.\n * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}\n * once without retrying, and relies on the returned value to be true.\n *\n * Reverts if the returned value is other than `true`.\n */\n function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {\n if (to.code.length == 0) {\n forceApprove(token, to, value);\n } else if (!token.approveAndCall(to, value, data)) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data);\n if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\n revert SafeERC20FailedOperation(address(token));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n *\n * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC721} from \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC-721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n * {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\nimport {Errors} from \"./Errors.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert Errors.InsufficientBalance(address(this).balance, amount);\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert Errors.FailedCall();\n }\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {Errors.FailedCall} error.\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert Errors.InsufficientBalance(address(this).balance, value);\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case\n * of an unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {Errors.FailedCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.\n */\n function _revert(bytes memory returndata) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert Errors.FailedCall();\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of common custom errors used in multiple contracts\n *\n * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.\n * It is recommended to avoid relying on the error API for critical functionality.\n */\nlibrary Errors {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error InsufficientBalance(uint256 balance, uint256 needed);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedCall();\n\n /**\n * @dev The deployment failed.\n */\n error FailedDeployment();\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n /**\n * @dev Value doesn't fit in an uint of `bits` size.\n */\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n /**\n * @dev An int value doesn't fit in an uint of `bits` size.\n */\n error SafeCastOverflowedIntToUint(int256 value);\n\n /**\n * @dev Value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n /**\n * @dev An uint value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedUintToInt(uint256 value);\n\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n if (value > type(uint248).max) {\n revert SafeCastOverflowedUintDowncast(248, value);\n }\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n if (value > type(uint240).max) {\n revert SafeCastOverflowedUintDowncast(240, value);\n }\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n if (value > type(uint232).max) {\n revert SafeCastOverflowedUintDowncast(232, value);\n }\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n if (value > type(uint224).max) {\n revert SafeCastOverflowedUintDowncast(224, value);\n }\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n if (value > type(uint216).max) {\n revert SafeCastOverflowedUintDowncast(216, value);\n }\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n if (value > type(uint208).max) {\n revert SafeCastOverflowedUintDowncast(208, value);\n }\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n if (value > type(uint200).max) {\n revert SafeCastOverflowedUintDowncast(200, value);\n }\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n if (value > type(uint192).max) {\n revert SafeCastOverflowedUintDowncast(192, value);\n }\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n if (value > type(uint184).max) {\n revert SafeCastOverflowedUintDowncast(184, value);\n }\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n if (value > type(uint176).max) {\n revert SafeCastOverflowedUintDowncast(176, value);\n }\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n if (value > type(uint168).max) {\n revert SafeCastOverflowedUintDowncast(168, value);\n }\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n if (value > type(uint160).max) {\n revert SafeCastOverflowedUintDowncast(160, value);\n }\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n if (value > type(uint152).max) {\n revert SafeCastOverflowedUintDowncast(152, value);\n }\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n if (value > type(uint144).max) {\n revert SafeCastOverflowedUintDowncast(144, value);\n }\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n if (value > type(uint136).max) {\n revert SafeCastOverflowedUintDowncast(136, value);\n }\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n if (value > type(uint128).max) {\n revert SafeCastOverflowedUintDowncast(128, value);\n }\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n if (value > type(uint120).max) {\n revert SafeCastOverflowedUintDowncast(120, value);\n }\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n if (value > type(uint112).max) {\n revert SafeCastOverflowedUintDowncast(112, value);\n }\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n if (value > type(uint104).max) {\n revert SafeCastOverflowedUintDowncast(104, value);\n }\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n if (value > type(uint96).max) {\n revert SafeCastOverflowedUintDowncast(96, value);\n }\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n if (value > type(uint88).max) {\n revert SafeCastOverflowedUintDowncast(88, value);\n }\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n if (value > type(uint80).max) {\n revert SafeCastOverflowedUintDowncast(80, value);\n }\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n if (value > type(uint72).max) {\n revert SafeCastOverflowedUintDowncast(72, value);\n }\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n if (value > type(uint64).max) {\n revert SafeCastOverflowedUintDowncast(64, value);\n }\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n if (value > type(uint56).max) {\n revert SafeCastOverflowedUintDowncast(56, value);\n }\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n if (value > type(uint48).max) {\n revert SafeCastOverflowedUintDowncast(48, value);\n }\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n if (value > type(uint40).max) {\n revert SafeCastOverflowedUintDowncast(40, value);\n }\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n if (value > type(uint32).max) {\n revert SafeCastOverflowedUintDowncast(32, value);\n }\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n if (value > type(uint24).max) {\n revert SafeCastOverflowedUintDowncast(24, value);\n }\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n if (value > type(uint16).max) {\n revert SafeCastOverflowedUintDowncast(16, value);\n }\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n if (value > type(uint8).max) {\n revert SafeCastOverflowedUintDowncast(8, value);\n }\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n if (value < 0) {\n revert SafeCastOverflowedIntToUint(value);\n }\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(248, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(240, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(232, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(224, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(216, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(208, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(200, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(192, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(184, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(176, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(168, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(160, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(152, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(144, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(136, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(128, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(120, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(112, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(104, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(96, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(88, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(80, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(72, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(64, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(56, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(48, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(40, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(32, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(24, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(16, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(8, value);\n }\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n if (value > uint256(type(int256).max)) {\n revert SafeCastOverflowedUintToInt(value);\n }\n return int256(value);\n }\n\n /**\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n */\n function toUint(bool b) internal pure returns (uint256 u) {\n /// @solidity memory-safe-assembly\n assembly {\n u := iszero(iszero(b))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.24;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * Since version 5.1, this library also support writing and reading value types to and from transient storage.\n *\n * * Example using transient storage:\n * ```solidity\n * contract Lock {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;\n *\n * modifier locked() {\n * require(!_LOCK_SLOT.asBoolean().tload());\n *\n * _LOCK_SLOT.asBoolean().tstore(true);\n * _;\n * _LOCK_SLOT.asBoolean().tstore(false);\n * }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct Int256Slot {\n int256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Int256Slot` with member `value` located at `slot`.\n */\n function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev UDVT that represent a slot holding a address.\n */\n type AddressSlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a AddressSlotType.\n */\n function asAddress(bytes32 slot) internal pure returns (AddressSlotType) {\n return AddressSlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a bool.\n */\n type BooleanSlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a BooleanSlotType.\n */\n function asBoolean(bytes32 slot) internal pure returns (BooleanSlotType) {\n return BooleanSlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a bytes32.\n */\n type Bytes32SlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a Bytes32SlotType.\n */\n function asBytes32(bytes32 slot) internal pure returns (Bytes32SlotType) {\n return Bytes32SlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a uint256.\n */\n type Uint256SlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a Uint256SlotType.\n */\n function asUint256(bytes32 slot) internal pure returns (Uint256SlotType) {\n return Uint256SlotType.wrap(slot);\n }\n\n /**\n * @dev UDVT that represent a slot holding a int256.\n */\n type Int256SlotType is bytes32;\n\n /**\n * @dev Cast an arbitrary slot to a Int256SlotType.\n */\n function asInt256(bytes32 slot) internal pure returns (Int256SlotType) {\n return Int256SlotType.wrap(slot);\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(AddressSlotType slot) internal view returns (address value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(AddressSlotType slot, address value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(BooleanSlotType slot) internal view returns (bool value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(BooleanSlotType slot, bool value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(Bytes32SlotType slot) internal view returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(Bytes32SlotType slot, bytes32 value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(Uint256SlotType slot) internal view returns (uint256 value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(Uint256SlotType slot, uint256 value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n\n /**\n * @dev Load the value held at location `slot` in transient storage.\n */\n function tload(Int256SlotType slot) internal view returns (int256 value) {\n /// @solidity memory-safe-assembly\n assembly {\n value := tload(slot)\n }\n }\n\n /**\n * @dev Store `value` at location `slot` in transient storage.\n */\n function tstore(Int256SlotType slot, int256 value) internal {\n /// @solidity memory-safe-assembly\n assembly {\n tstore(slot, value)\n }\n }\n}\n" + }, + "src/Arbitrage.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport {Ownable, Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {ILocker} from \"v2-core/interfaces/ILocker.sol\";\nimport {IHooks} from \"v2-core/interfaces/IHooks.sol\";\nimport {BookId, BookIdLibrary} from \"v2-core/libraries/BookId.sol\";\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {FeePolicy, FeePolicyLibrary} from \"v2-core/libraries/FeePolicy.sol\";\nimport {Tick, TickLibrary} from \"v2-core/libraries/Tick.sol\";\nimport {ReentrancyGuard} from \"./libraries/ReentrancyGuard.sol\";\nimport {IArbitrage} from \"./interfaces/IArbitrage.sol\";\n\ncontract Arbitrage is IArbitrage, Ownable2Step, ILocker, ReentrancyGuard {\n using TickLibrary for Tick;\n using SafeCast for uint256;\n using CurrencyLibrary for Currency;\n using FeePolicyLibrary for FeePolicy;\n\n IBookManager public immutable bookManager;\n\n mapping(address => bool) public isOperator;\n\n modifier onlyOperator() {\n if (!isOperator[msg.sender]) revert NotOperator();\n _;\n }\n\n constructor(address bookManager_, address initialOwner_) Ownable(initialOwner_) {\n bookManager = IBookManager(bookManager_);\n }\n\n function setOperator(address operator, bool status) external onlyOwner {\n isOperator[operator] = status;\n emit SetOperator(operator, status);\n }\n\n function lockAcquired(address sender, bytes memory data) external nonReentrant returns (bytes memory) {\n if (msg.sender != address(bookManager) || sender != address(this)) revert InvalidAccess();\n address user;\n BookId id;\n address router;\n (user, id, router, data) = abi.decode(data, (address, BookId, address, bytes));\n\n IBookManager.BookKey memory key = bookManager.getBookKey(id);\n uint256 max;\n bool success;\n bytes memory returnData;\n if (key.quote.isNative()) {\n max = address(bookManager).balance;\n bookManager.withdraw(key.quote, address(this), max);\n (success, returnData) = router.call{value: max}(data);\n } else {\n IERC20 quote = IERC20(Currency.unwrap(key.quote));\n max = quote.balanceOf(address(bookManager));\n bookManager.withdraw(key.quote, address(this), max);\n quote.approve(router, max);\n (success, returnData) = router.call(data);\n quote.approve(router, 0);\n }\n if (!success) revert(string(returnData));\n\n uint256 quoteAmount = max - key.quote.balanceOfSelf();\n uint256 baseAmount = key.base.balanceOfSelf();\n uint256 spentBaseAmount;\n uint256 price;\n if (key.takerPolicy.usesQuote()) {\n quoteAmount = uint256(quoteAmount.toInt256() + key.takerPolicy.calculateFee(quoteAmount, false));\n price = (quoteAmount << 96) / baseAmount;\n } else {\n price = (quoteAmount << 96) / key.takerPolicy.calculateOriginalAmount(baseAmount, false);\n }\n\n while (spentBaseAmount < baseAmount && !bookManager.isEmpty(id)) {\n Tick tick = bookManager.getHighest(id);\n if (price >= tick.toPrice()) break; // Did not consider fees.\n uint256 maxAmount;\n unchecked {\n if (key.takerPolicy.usesQuote()) {\n maxAmount = baseAmount - spentBaseAmount;\n } else {\n maxAmount = key.takerPolicy.calculateOriginalAmount(baseAmount - spentBaseAmount, false);\n }\n }\n maxAmount = tick.baseToQuote(maxAmount, false) / key.unitSize;\n if (maxAmount == 0) break;\n (, uint256 amount) =\n bookManager.take(IBookManager.TakeParams({key: key, tick: tick, maxUnit: maxAmount.toUint64()}), \"\");\n if (amount == 0) break;\n spentBaseAmount += amount;\n }\n\n _settleCurrency(user, key.quote);\n _settleCurrency(user, key.base);\n\n return \"\";\n }\n\n function arbitrage(BookId id, address router, bytes calldata data) external onlyOperator {\n bookManager.lock(address(this), abi.encode(msg.sender, id, router, data));\n }\n\n function _settleCurrency(address user, Currency currency) internal {\n int256 currencyDelta = -bookManager.getCurrencyDelta(address(this), currency);\n if (currencyDelta > 0) {\n currency.transfer(address(bookManager), uint256(currencyDelta));\n }\n bookManager.settle(currency);\n uint256 balance = currency.balanceOfSelf();\n if (balance > 0) {\n currency.transfer(user, balance);\n }\n }\n\n function withdrawToken(Currency currency, uint256 amount, address recipient) external onlyOwner {\n currency.transfer(recipient, amount);\n }\n\n receive() external payable {}\n}\n" + }, + "src/BookViewer.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\";\nimport {ERC1967Proxy} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\"; // To generate artifacts\nimport {Ownable, Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {SignificantBit} from \"v2-core/libraries/SignificantBit.sol\";\nimport {Math} from \"v2-core/libraries/Math.sol\";\nimport {Lockers} from \"v2-core/libraries/Lockers.sol\";\nimport {BookId} from \"v2-core/libraries/BookId.sol\";\nimport {Tick, TickLibrary} from \"v2-core/libraries/Tick.sol\";\nimport {FeePolicy, FeePolicyLibrary} from \"v2-core/libraries/FeePolicy.sol\";\n\nimport {IBookViewer} from \"./interfaces/IBookViewer.sol\";\nimport {IController} from \"./interfaces/IController.sol\";\n\ncontract BookViewer is IBookViewer, UUPSUpgradeable, Ownable2Step, Initializable {\n using SafeCast for *;\n using TickLibrary for *;\n using Math for uint256;\n using SignificantBit for uint256;\n using FeePolicyLibrary for FeePolicy;\n\n IBookManager public immutable bookManager;\n\n constructor(IBookManager bookManager_) Ownable(msg.sender) {\n bookManager = bookManager_;\n }\n\n function __BookViewer_init(address owner) external initializer {\n _transferOwnership(owner);\n }\n\n function _authorizeUpgrade(address) internal override onlyOwner {}\n\n function getLiquidity(BookId id, Tick tick, uint256 n) external view returns (Liquidity[] memory liquidity) {\n liquidity = new Liquidity[](n);\n if (bookManager.getDepth(id, tick) == 0) tick = bookManager.maxLessThan(id, tick);\n uint256 i;\n while (i < n) {\n if (Tick.unwrap(tick) == type(int24).min) break;\n liquidity[i] = Liquidity({tick: tick, depth: bookManager.getDepth(id, tick)});\n tick = bookManager.maxLessThan(id, tick);\n unchecked {\n ++i;\n }\n }\n assembly {\n mstore(liquidity, i)\n }\n }\n\n function getExpectedInput(IController.TakeOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\n {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n if (bookManager.isEmpty(params.id)) return (0, 0);\n\n Tick tick = bookManager.getHighest(params.id);\n\n while (Tick.unwrap(tick) > type(int24).min) {\n unchecked {\n if (params.limitPrice > tick.toPrice()) break;\n uint256 maxAmount;\n if (key.takerPolicy.usesQuote()) {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.quoteAmount - takenQuoteAmount, true);\n } else {\n maxAmount = params.quoteAmount - takenQuoteAmount;\n }\n maxAmount = maxAmount.divide(key.unitSize, true);\n\n if (maxAmount == 0) break;\n uint256 currentDepth = bookManager.getDepth(params.id, tick);\n uint256 quoteAmount = (currentDepth > maxAmount ? maxAmount : currentDepth) * key.unitSize;\n uint256 baseAmount = tick.quoteToBase(quoteAmount, true);\n if (key.takerPolicy.usesQuote()) {\n quoteAmount = uint256(int256(quoteAmount) - key.takerPolicy.calculateFee(quoteAmount, false));\n } else {\n baseAmount = uint256(baseAmount.toInt256() + key.takerPolicy.calculateFee(baseAmount, false));\n }\n if (quoteAmount == 0) break;\n\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n if (params.quoteAmount <= takenQuoteAmount) break;\n tick = bookManager.maxLessThan(params.id, tick);\n }\n }\n }\n\n function getExpectedOutput(IController.SpendOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\n {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n if (bookManager.isEmpty(params.id)) return (0, 0);\n\n Tick tick = bookManager.getHighest(params.id);\n\n unchecked {\n while (spentBaseAmount <= params.baseAmount && Tick.unwrap(tick) > type(int24).min) {\n if (params.limitPrice > tick.toPrice()) break;\n uint256 maxAmount;\n if (key.takerPolicy.usesQuote()) {\n maxAmount = params.baseAmount - spentBaseAmount;\n } else {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.baseAmount - spentBaseAmount, false);\n }\n maxAmount = tick.baseToQuote(maxAmount, false) / key.unitSize;\n\n if (maxAmount == 0) break;\n uint256 currentDepth = bookManager.getDepth(params.id, tick);\n uint256 quoteAmount = (currentDepth > maxAmount ? maxAmount : currentDepth) * key.unitSize;\n uint256 baseAmount = tick.quoteToBase(quoteAmount, true);\n if (key.takerPolicy.usesQuote()) {\n quoteAmount = uint256(int256(quoteAmount) - key.takerPolicy.calculateFee(quoteAmount, false));\n } else {\n baseAmount = uint256(baseAmount.toInt256() + key.takerPolicy.calculateFee(baseAmount, false));\n }\n if (baseAmount == 0) break;\n\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n tick = bookManager.maxLessThan(params.id, tick);\n }\n }\n }\n}\n" + }, + "src/Controller.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nimport {IERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\nimport {ILocker} from \"v2-core/interfaces/ILocker.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {IERC721Permit} from \"v2-core/interfaces/IERC721Permit.sol\";\nimport {Math} from \"v2-core/libraries/Math.sol\";\nimport {BookId, BookIdLibrary} from \"v2-core/libraries/BookId.sol\";\nimport {OrderId, OrderIdLibrary} from \"v2-core/libraries/OrderId.sol\";\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {FeePolicy, FeePolicyLibrary} from \"v2-core/libraries/FeePolicy.sol\";\nimport {Tick, TickLibrary} from \"v2-core/libraries/Tick.sol\";\nimport {OrderId, OrderIdLibrary} from \"v2-core/libraries/OrderId.sol\";\n\nimport {IController} from \"./interfaces/IController.sol\";\nimport {ReentrancyGuard} from \"./libraries/ReentrancyGuard.sol\";\n\ncontract Controller is IController, ILocker, ReentrancyGuard {\n using TickLibrary for *;\n using OrderIdLibrary for OrderId;\n using BookIdLibrary for IBookManager.BookKey;\n using SafeERC20 for IERC20;\n using SafeCast for uint256;\n using Math for uint256;\n using CurrencyLibrary for Currency;\n using FeePolicyLibrary for FeePolicy;\n\n IBookManager public immutable bookManager;\n\n constructor(address bookManager_) {\n bookManager = IBookManager(bookManager_);\n }\n\n modifier checkDeadline(uint64 deadline) {\n if (block.timestamp > deadline) revert Deadline();\n _;\n }\n\n modifier permitERC20(ERC20PermitParams[] calldata permitParamsList) {\n _permitERC20(permitParamsList);\n _;\n }\n\n function getDepth(BookId id, Tick tick) external view returns (uint256) {\n return uint256(bookManager.getDepth(id, tick)) * bookManager.getBookKey(id).unitSize;\n }\n\n function getHighestPrice(BookId id) external view returns (uint256) {\n return bookManager.getHighest(id).toPrice();\n }\n\n function getOrder(OrderId orderId)\n external\n view\n returns (address provider, uint256 price, uint256 openAmount, uint256 claimableAmount)\n {\n (BookId bookId, Tick tick,) = orderId.decode();\n IBookManager.BookKey memory key = bookManager.getBookKey(bookId);\n uint256 unitSize = key.unitSize;\n price = tick.toPrice();\n IBookManager.OrderInfo memory orderInfo = bookManager.getOrder(orderId);\n provider = orderInfo.provider;\n openAmount = unitSize * orderInfo.open;\n FeePolicy makerPolicy = key.makerPolicy;\n claimableAmount = tick.quoteToBase(unitSize * orderInfo.claimable, false);\n if (!makerPolicy.usesQuote()) {\n int256 fee = makerPolicy.calculateFee(claimableAmount, false);\n claimableAmount = fee > 0 ? claimableAmount - uint256(fee) : claimableAmount + uint256(-fee);\n }\n }\n\n function fromPrice(uint256 price) external pure returns (Tick) {\n return price.fromPrice();\n }\n\n function toPrice(Tick tick) external pure returns (uint256) {\n return tick.toPrice();\n }\n\n function lockAcquired(address sender, bytes memory data) external nonReentrant returns (bytes memory returnData) {\n if (msg.sender != address(bookManager) || sender != address(this)) revert InvalidAccess();\n (address user, Action[] memory actionList, bytes[] memory orderParamsList, address[] memory tokensToSettle) =\n abi.decode(data, (address, Action[], bytes[], address[]));\n\n uint256 length = actionList.length;\n OrderId[] memory ids = new OrderId[](length);\n uint256 orderIdIndex;\n\n for (uint256 i = 0; i < length; ++i) {\n Action action = actionList[i];\n if (action == Action.OPEN) {\n _open(abi.decode(orderParamsList[i], (OpenBookParams)));\n } else if (action == Action.MAKE) {\n OrderId id = _make(abi.decode(orderParamsList[i], (MakeOrderParams)));\n if (OrderId.unwrap(id) != 0) {\n bookManager.transferFrom(address(this), user, OrderId.unwrap(id));\n ids[orderIdIndex++] = id;\n }\n } else if (action == Action.LIMIT) {\n OrderId id = _limit(abi.decode(orderParamsList[i], (LimitOrderParams)));\n if (OrderId.unwrap(id) != 0) {\n bookManager.transferFrom(address(this), user, OrderId.unwrap(id));\n ids[orderIdIndex++] = id;\n }\n } else if (action == Action.TAKE) {\n _take(abi.decode(orderParamsList[i], (TakeOrderParams)));\n } else if (action == Action.SPEND) {\n _spend(abi.decode(orderParamsList[i], (SpendOrderParams)));\n } else if (action == Action.CLAIM) {\n ClaimOrderParams memory claimOrderParams = abi.decode(orderParamsList[i], (ClaimOrderParams));\n uint256 orderId = OrderId.unwrap(claimOrderParams.id);\n bookManager.checkAuthorized(bookManager.ownerOf(orderId), user, orderId);\n _claim(claimOrderParams);\n } else if (action == Action.CANCEL) {\n CancelOrderParams memory cancelOrderParams = abi.decode(orderParamsList[i], (CancelOrderParams));\n uint256 orderId = OrderId.unwrap(cancelOrderParams.id);\n bookManager.checkAuthorized(bookManager.ownerOf(orderId), user, orderId);\n _cancel(cancelOrderParams);\n } else {\n revert InvalidAction();\n }\n }\n\n _settleTokens(user, tokensToSettle);\n\n assembly {\n mstore(ids, orderIdIndex)\n }\n returnData = abi.encode(ids);\n }\n\n function execute(\n Action[] calldata actionList,\n bytes[] calldata paramsDataList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata erc20PermitParamsList,\n ERC721PermitParams[] calldata erc721PermitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) returns (OrderId[] memory ids) {\n if (actionList.length != paramsDataList.length) revert InvalidLength();\n _permitERC20(erc20PermitParamsList);\n _permitERC721(erc721PermitParamsList);\n\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bytes memory result = bookManager.lock(address(this), lockData);\n\n if (result.length != 0) {\n (ids) = abi.decode(result, (OrderId[]));\n }\n return ids;\n }\n\n function open(OpenBookParams[] calldata openBookParamsList, uint64 deadline) external checkDeadline(deadline) {\n uint256 length = openBookParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.OPEN;\n paramsDataList[i] = abi.encode(openBookParamsList[i]);\n }\n address[] memory tokensToSettle;\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function limit(\n LimitOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) returns (OrderId[] memory ids) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.LIMIT;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bytes memory result = bookManager.lock(address(this), lockData);\n (ids) = abi.decode(result, (OrderId[]));\n }\n\n function make(\n MakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) returns (OrderId[] memory ids) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.MAKE;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bytes memory result = bookManager.lock(address(this), lockData);\n (ids) = abi.decode(result, (OrderId[]));\n }\n\n function take(\n TakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.TAKE;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function spend(\n SpendOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable checkDeadline(deadline) permitERC20(permitParamsList) {\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.SPEND;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function claim(\n ClaimOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external checkDeadline(deadline) {\n _permitERC721(permitParamsList);\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.CLAIM;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function cancel(\n CancelOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external checkDeadline(deadline) {\n _permitERC721(permitParamsList);\n uint256 length = orderParamsList.length;\n Action[] memory actionList = new Action[](length);\n bytes[] memory paramsDataList = new bytes[](length);\n for (uint256 i = 0; i < length; ++i) {\n actionList[i] = Action.CANCEL;\n paramsDataList[i] = abi.encode(orderParamsList[i]);\n }\n bytes memory lockData = abi.encode(msg.sender, actionList, paramsDataList, tokensToSettle);\n bookManager.lock(address(this), lockData);\n }\n\n function _open(OpenBookParams memory params) internal {\n bookManager.open(params.key, params.hookData);\n }\n\n function _make(MakeOrderParams memory params) internal returns (OrderId id) {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n uint256 quoteAmount = params.quoteAmount;\n if (key.makerPolicy.usesQuote()) {\n quoteAmount = key.makerPolicy.calculateOriginalAmount(quoteAmount, false);\n }\n uint64 unit = (quoteAmount / key.unitSize).toUint64();\n if (unit > 0) {\n (id,) = bookManager.make(\n IBookManager.MakeParams({key: key, tick: params.tick, unit: unit, provider: address(0)}),\n params.hookData\n );\n }\n return id;\n }\n\n function _limit(LimitOrderParams memory params) internal returns (OrderId id) {\n (, uint256 spentBaseAmount) = _spend(\n SpendOrderParams({\n id: params.takeBookId,\n limitPrice: params.limitPrice,\n baseAmount: params.quoteAmount,\n minQuoteAmount: 0,\n hookData: params.takeHookData\n })\n );\n params.quoteAmount -= spentBaseAmount;\n if (params.quoteAmount > 0) {\n id = _make(\n MakeOrderParams({\n id: params.makeBookId,\n quoteAmount: params.quoteAmount,\n tick: params.tick,\n hookData: params.makeHookData\n })\n );\n }\n }\n\n function _take(TakeOrderParams memory params)\n internal\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\n {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n while (params.quoteAmount > takenQuoteAmount && !bookManager.isEmpty(params.id)) {\n Tick tick = bookManager.getHighest(params.id);\n if (params.limitPrice > tick.toPrice()) break;\n uint256 maxAmount;\n unchecked {\n if (key.takerPolicy.usesQuote()) {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.quoteAmount - takenQuoteAmount, true);\n } else {\n maxAmount = params.quoteAmount - takenQuoteAmount;\n }\n }\n maxAmount = maxAmount.divide(key.unitSize, true);\n\n if (maxAmount == 0) break;\n (uint256 quoteAmount, uint256 baseAmount) = bookManager.take(\n IBookManager.TakeParams({key: key, tick: tick, maxUnit: maxAmount.toUint64()}), params.hookData\n );\n if (quoteAmount == 0) break;\n\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n }\n if (params.maxBaseAmount < spentBaseAmount) revert ControllerSlippage();\n }\n\n function _spend(SpendOrderParams memory params)\n internal\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount)\n {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id);\n\n while (spentBaseAmount < params.baseAmount && !bookManager.isEmpty(params.id)) {\n Tick tick = bookManager.getHighest(params.id);\n if (params.limitPrice > tick.toPrice()) break;\n uint256 maxAmount;\n unchecked {\n if (key.takerPolicy.usesQuote()) {\n maxAmount = params.baseAmount - spentBaseAmount;\n } else {\n maxAmount = key.takerPolicy.calculateOriginalAmount(params.baseAmount - spentBaseAmount, false);\n }\n }\n maxAmount = tick.baseToQuote(maxAmount, false) / key.unitSize;\n if (maxAmount == 0) break;\n (uint256 quoteAmount, uint256 baseAmount) = bookManager.take(\n IBookManager.TakeParams({key: key, tick: tick, maxUnit: maxAmount.toUint64()}), params.hookData\n );\n if (baseAmount == 0) break;\n takenQuoteAmount += quoteAmount;\n spentBaseAmount += baseAmount;\n }\n if (params.minQuoteAmount > takenQuoteAmount) revert ControllerSlippage();\n }\n\n function _claim(ClaimOrderParams memory params) internal {\n bookManager.claim(params.id, params.hookData);\n }\n\n function _cancel(CancelOrderParams memory params) internal {\n IBookManager.BookKey memory key = bookManager.getBookKey(params.id.getBookId());\n try bookManager.cancel(\n IBookManager.CancelParams({id: params.id, toUnit: (params.leftQuoteAmount / key.unitSize).toUint64()}),\n params.hookData\n ) {} catch {}\n }\n\n function _settleTokens(address user, address[] memory tokensToSettle) internal {\n Currency native = CurrencyLibrary.NATIVE;\n int256 currencyDelta = bookManager.getCurrencyDelta(address(this), native);\n if (currencyDelta < 0) {\n native.transfer(address(bookManager), uint256(-currencyDelta));\n bookManager.settle(native);\n }\n currencyDelta = bookManager.getCurrencyDelta(address(this), native);\n if (currencyDelta > 0) {\n bookManager.withdraw(native, user, uint256(currencyDelta));\n }\n\n uint256 length = tokensToSettle.length;\n for (uint256 i = 0; i < length; ++i) {\n Currency currency = Currency.wrap(tokensToSettle[i]);\n currencyDelta = bookManager.getCurrencyDelta(address(this), currency);\n if (currencyDelta < 0) {\n IERC20(tokensToSettle[i]).safeTransferFrom(user, address(bookManager), uint256(-currencyDelta));\n bookManager.settle(currency);\n }\n currencyDelta = bookManager.getCurrencyDelta(address(this), currency);\n if (currencyDelta > 0) {\n bookManager.withdraw(Currency.wrap(tokensToSettle[i]), user, uint256(currencyDelta));\n }\n uint256 balance = IERC20(tokensToSettle[i]).balanceOf(address(this));\n if (balance > 0) {\n IERC20(tokensToSettle[i]).transfer(user, balance);\n }\n }\n if (address(this).balance > 0) native.transfer(user, address(this).balance);\n }\n\n function _permitERC20(ERC20PermitParams[] calldata permitParamsList) internal {\n for (uint256 i = 0; i < permitParamsList.length; ++i) {\n ERC20PermitParams memory permitParams = permitParamsList[i];\n if (permitParams.signature.deadline > 0) {\n try IERC20Permit(permitParams.token).permit(\n msg.sender,\n address(this),\n permitParams.permitAmount,\n permitParams.signature.deadline,\n permitParams.signature.v,\n permitParams.signature.r,\n permitParams.signature.s\n ) {} catch {}\n }\n }\n }\n\n function _permitERC721(ERC721PermitParams[] calldata permitParamsList) internal {\n for (uint256 i = 0; i < permitParamsList.length; ++i) {\n PermitSignature memory signature = permitParamsList[i].signature;\n if (signature.deadline > 0) {\n try IERC721Permit(address(bookManager)).permit(\n address(this),\n permitParamsList[i].tokenId,\n signature.deadline,\n signature.v,\n signature.r,\n signature.s\n ) {} catch {}\n }\n }\n }\n\n receive() external payable {}\n}\n" + }, + "src/hooks/BaseHook.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.19;\n\nimport {IHooks} from \"v2-core/interfaces/IHooks.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Hooks} from \"v2-core/libraries/Hooks.sol\";\nimport {OrderId} from \"v2-core/libraries/OrderId.sol\";\n\n/// @author Clober\n/// @author Modified from https://github.com/Uniswap/v4-periphery/blob/63d64fcd82bff9ec0bad89730ce28d7ffa8e4225/contracts/BaseHook.sol\n\nabstract contract BaseHook is IHooks {\n error InvalidAccess();\n error HookNotImplemented();\n\n IBookManager public immutable bookManager;\n\n constructor(IBookManager _bookManager) {\n bookManager = _bookManager;\n validateHookAddress(this);\n }\n\n modifier onlyBookManager() {\n if (msg.sender != address(bookManager)) revert InvalidAccess();\n _;\n }\n\n function getHooksCalls() public pure virtual returns (Hooks.Permissions memory);\n\n // this function is virtual so that we can override it during testing,\n // which allows us to deploy an implementation to any address\n // and then etch the bytecode into the correct address\n function validateHookAddress(BaseHook _this) internal pure virtual {\n Hooks.validateHookPermissions(_this, getHooksCalls());\n }\n\n function beforeOpen(address, IBookManager.BookKey calldata, bytes calldata) external virtual returns (bytes4) {\n revert HookNotImplemented();\n }\n\n function afterOpen(address, IBookManager.BookKey calldata, bytes calldata) external virtual returns (bytes4) {\n revert HookNotImplemented();\n }\n\n function beforeMake(address, IBookManager.MakeParams calldata, bytes calldata) external virtual returns (bytes4) {\n revert HookNotImplemented();\n }\n\n function afterMake(address, IBookManager.MakeParams calldata, OrderId, bytes calldata)\n external\n virtual\n returns (bytes4)\n {\n revert HookNotImplemented();\n }\n\n function beforeTake(address, IBookManager.TakeParams calldata, bytes calldata) external virtual returns (bytes4) {\n revert HookNotImplemented();\n }\n\n function afterTake(address, IBookManager.TakeParams calldata, uint64, bytes calldata)\n external\n virtual\n returns (bytes4)\n {\n revert HookNotImplemented();\n }\n\n function beforeCancel(address, IBookManager.CancelParams calldata, bytes calldata)\n external\n virtual\n returns (bytes4)\n {\n revert HookNotImplemented();\n }\n\n function afterCancel(address, IBookManager.CancelParams calldata, uint64, bytes calldata)\n external\n virtual\n returns (bytes4)\n {\n revert HookNotImplemented();\n }\n\n function beforeClaim(address, OrderId, bytes calldata) external virtual returns (bytes4) {\n revert HookNotImplemented();\n }\n\n function afterClaim(address, OrderId, uint64, bytes calldata) external virtual returns (bytes4) {\n revert HookNotImplemented();\n }\n}\n" + }, + "src/hooks/BountyPlatform.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nimport {Ownable2Step, Ownable} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Hooks} from \"v2-core/libraries/Hooks.sol\";\nimport {BookIdLibrary} from \"v2-core/libraries/BookId.sol\";\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {OrderId, OrderIdLibrary} from \"v2-core/libraries/OrderId.sol\";\n\nimport {IBountyPlatform} from \"../interfaces/IBountyPlatform.sol\";\nimport {BaseHook} from \"./BaseHook.sol\";\n\ncontract BountyPlatform is BaseHook, Ownable2Step, IBountyPlatform {\n using CurrencyLibrary for Currency;\n using OrderIdLibrary for OrderId;\n using BookIdLibrary for IBookManager.BookKey;\n\n address public override defaultClaimer;\n\n mapping(Currency => uint256) public override balance;\n mapping(OrderId => Bounty) private _bountyMap;\n\n constructor(IBookManager bookManager_, address owner_, address defaultClaimer_)\n BaseHook(bookManager_)\n Ownable(owner_)\n {\n defaultClaimer = defaultClaimer_;\n emit SetDefaultClaimer(defaultClaimer_);\n }\n\n function getHooksCalls() public pure override returns (Hooks.Permissions memory) {\n Hooks.Permissions memory permissions;\n permissions.afterMake = true;\n permissions.afterCancel = true;\n permissions.afterClaim = true;\n return permissions;\n }\n\n function afterMake(address, IBookManager.MakeParams calldata, OrderId id, bytes calldata hookData)\n external\n override\n onlyBookManager\n returns (bytes4)\n {\n if (hookData.length > 0) {\n Bounty memory bounty = abi.decode(hookData, (Bounty));\n uint256 amount = _getAmount(bounty);\n if (amount > 0) {\n uint256 currentBalance = balance[bounty.currency];\n if (bounty.currency.balanceOfSelf() - currentBalance < amount) revert NotEnoughBalance();\n balance[bounty.currency] = currentBalance + amount;\n _bountyMap[id] = bounty;\n emit BountyOffered(id, bounty.currency, amount);\n }\n }\n\n return BaseHook.afterMake.selector;\n }\n\n function afterClaim(address, OrderId id, uint64 claimedAmount, bytes calldata hookData)\n external\n override\n onlyBookManager\n returns (bytes4)\n {\n address claimer = hookData.length > 0 ? abi.decode(hookData, (address)) : defaultClaimer;\n if (claimedAmount > 0 && bookManager.getOrder(id).open == 0) {\n Bounty memory bounty = _bountyMap[id];\n uint256 amount = _getAmount(bounty);\n if (amount > 0) {\n unchecked {\n balance[bounty.currency] -= amount;\n }\n delete _bountyMap[id];\n bounty.currency.transfer(claimer, amount);\n emit BountyClaimed(id, claimer);\n }\n }\n return BaseHook.afterClaim.selector;\n }\n\n function afterCancel(address, IBookManager.CancelParams calldata params, uint64, bytes calldata hookData)\n external\n override\n onlyBookManager\n returns (bytes4)\n {\n address receiver = hookData.length > 0 ? abi.decode(hookData, (address)) : defaultClaimer;\n IBookManager.OrderInfo memory orderInfo = bookManager.getOrder(params.id);\n if (orderInfo.open == 0 && orderInfo.claimable == 0) {\n Bounty memory bounty = _bountyMap[params.id];\n uint256 amount = _getAmount(bounty);\n if (amount > 0) {\n unchecked {\n balance[bounty.currency] -= amount;\n }\n delete _bountyMap[params.id];\n bounty.currency.transfer(receiver, amount);\n emit BountyCanceled(params.id);\n }\n }\n return BaseHook.afterCancel.selector;\n }\n\n function _getAmount(Bounty memory bounty) internal pure returns (uint256) {\n return uint256(bounty.amount) << bounty.shifter;\n }\n\n function getBounty(OrderId orderId) external view returns (Currency, uint256) {\n Bounty memory bounty = _bountyMap[orderId];\n return (bounty.currency, _getAmount(bounty));\n }\n\n function setDefaultClaimer(address claimer) external onlyOwner {\n defaultClaimer = claimer;\n emit SetDefaultClaimer(claimer);\n }\n\n receive() external payable {}\n}\n" + }, + "src/interfaces/IArbitrage.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport {BookId} from \"v2-core/libraries/BookId.sol\";\nimport {Currency} from \"v2-core/libraries/Currency.sol\";\n\ninterface IArbitrage {\n error InvalidAccess();\n error NotOperator();\n\n event SetOperator(address indexed operator, bool status);\n\n function setOperator(address operator, bool status) external;\n\n function arbitrage(BookId id, address router, bytes calldata data) external;\n\n function withdrawToken(Currency currency, uint256 amount, address recipient) external;\n}\n" + }, + "src/interfaces/IBookViewer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {BookId} from \"v2-core/libraries/BookId.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Tick} from \"v2-core/libraries/Tick.sol\";\n\nimport {IController} from \"./IController.sol\";\n\n/**\n * @title IBookViewer\n * @notice Interface for the book viewer contract\n */\ninterface IBookViewer {\n struct Liquidity {\n Tick tick;\n uint64 depth;\n }\n\n /**\n * @notice Returns the book manager\n * @return The instance of the book manager\n */\n function bookManager() external view returns (IBookManager);\n\n /**\n * @notice Returns the liquidity for a specific book\n * @param id The id of the book\n * @param from The starting tick\n * @param n The number of ticks to return\n * @return liquidity An array of liquidity data\n */\n function getLiquidity(BookId id, Tick from, uint256 n) external view returns (Liquidity[] memory liquidity);\n\n /**\n * @notice Returns the expected input for a take order\n * @param params The parameters of the take order\n * @return takenQuoteAmount The expected taken quote amount\n * @return spentBaseAmount The expected spend base amount\n */\n function getExpectedInput(IController.TakeOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount);\n\n /**\n * @notice Returns the expected output for a spend order\n * @param params The parameters of the spend order\n * @return takenQuoteAmount The expected taken quote amount\n * @return spentBaseAmount The expected spend base amount\n */\n function getExpectedOutput(IController.SpendOrderParams memory params)\n external\n view\n returns (uint256 takenQuoteAmount, uint256 spentBaseAmount);\n}\n" + }, + "src/interfaces/IBountyPlatform.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Currency} from \"v2-core/libraries/Currency.sol\";\nimport {OrderId} from \"v2-core/libraries/OrderId.sol\";\n\n/**\n * @title IBountyPlatform\n * @notice Interface for the bounty platform contract\n */\ninterface IBountyPlatform {\n error NotEnoughBalance();\n\n /**\n * @notice Event emitted when a bounty is offered\n * @param orderId The id of the order to offer the bounty for\n * @param currency The currency of the bounty\n * @param amount The amount of the bounty\n */\n event BountyOffered(OrderId indexed orderId, Currency indexed currency, uint256 amount);\n\n /**\n * @notice Event emitted when a bounty is claimed\n * @param orderId The id of the order that the bounty was claimed for\n * @param claimer The address of the claimer\n */\n event BountyClaimed(OrderId indexed orderId, address indexed claimer);\n\n /**\n * @notice Event emitted when a bounty is canceled\n * @param orderId The id of the order that the bounty was canceled for\n */\n event BountyCanceled(OrderId indexed orderId);\n\n /**\n * @notice Event emitted when the default claimer is set\n * @param claimer The address of the default claimer\n */\n event SetDefaultClaimer(address indexed claimer);\n\n struct Bounty {\n Currency currency;\n uint88 amount;\n uint8 shifter;\n }\n\n /**\n * @notice Returns the default claimer\n * @return The address of the default claimer\n */\n function defaultClaimer() external view returns (address);\n\n /**\n * @notice Returns the balance of a specific currency\n * @param currency The currency to check the balance for\n * @return The balance of the specified currency\n */\n function balance(Currency currency) external view returns (uint256);\n\n /**\n * @notice Returns the bounty for a specific order\n * @param orderId The id of the order to get the bounty for\n * @return The currency and amount of the bounty\n */\n function getBounty(OrderId orderId) external view returns (Currency, uint256);\n\n /**\n * @notice Sets the default claimer\n * @param claimer The address to set as the default claimer\n */\n function setDefaultClaimer(address claimer) external;\n}\n" + }, + "src/interfaces/IController.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {OrderId} from \"v2-core/libraries/OrderId.sol\";\nimport {BookId} from \"v2-core/libraries/BookId.sol\";\nimport {Tick} from \"v2-core/libraries/Tick.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\n\n/**\n * @title IController\n * @notice Interface for the controller contract\n */\ninterface IController {\n // Error messages\n error InvalidAccess();\n error InvalidLength();\n error Deadline();\n error ControllerSlippage();\n error InvalidAction();\n\n /**\n * @notice Enum for the different actions that can be performed\n */\n enum Action {\n OPEN,\n MAKE,\n LIMIT,\n TAKE,\n SPEND,\n CLAIM,\n CANCEL\n }\n\n /**\n * @notice Struct for the parameters of the ERC20 permit\n */\n struct ERC20PermitParams {\n address token;\n uint256 permitAmount;\n PermitSignature signature;\n }\n\n /**\n * @notice Struct for the parameters of the ERC721 permit\n */\n struct ERC721PermitParams {\n uint256 tokenId;\n PermitSignature signature;\n }\n\n /**\n * @notice Struct for the signature of the permit\n */\n struct PermitSignature {\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n\n /**\n * @notice Struct for the parameters of the open book action\n */\n struct OpenBookParams {\n IBookManager.BookKey key;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the make order action\n */\n struct MakeOrderParams {\n BookId id;\n Tick tick;\n uint256 quoteAmount;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the limit order action\n */\n struct LimitOrderParams {\n BookId takeBookId;\n BookId makeBookId;\n uint256 limitPrice;\n Tick tick;\n uint256 quoteAmount;\n bytes takeHookData;\n bytes makeHookData;\n }\n\n /**\n * @notice Struct for the parameters of the take order action\n */\n struct TakeOrderParams {\n BookId id;\n uint256 limitPrice;\n uint256 quoteAmount;\n uint256 maxBaseAmount;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the spend order action\n */\n struct SpendOrderParams {\n BookId id;\n uint256 limitPrice;\n uint256 baseAmount;\n uint256 minQuoteAmount;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the claim order action\n */\n struct ClaimOrderParams {\n OrderId id;\n bytes hookData;\n }\n\n /**\n * @notice Struct for the parameters of the cancel order action\n */\n struct CancelOrderParams {\n OrderId id;\n uint256 leftQuoteAmount;\n bytes hookData;\n }\n\n /**\n * @notice Returns the book manager\n * @return The instance of the book manager\n */\n function bookManager() external view returns (IBookManager);\n\n /**\n * @notice Opens a book\n * @param openBookParamsList The parameters of the open book action\n * @param deadline The deadline for the action\n */\n function open(OpenBookParams[] calldata openBookParamsList, uint64 deadline) external;\n\n /**\n * @notice Returns the depth of a book\n * @param id The id of the book\n * @param tick The tick of the book\n * @return The depth of the book in quote amount\n */\n function getDepth(BookId id, Tick tick) external view returns (uint256);\n\n /**\n * @notice Returns the highest price of a book\n * @param id The id of the book\n * @return The highest price of the book with 2**96 precision\n */\n function getHighestPrice(BookId id) external view returns (uint256);\n\n /**\n * @notice Returns the details of an order\n * @param orderId The id of the order\n * @return provider The provider of the order\n * @return price The price of the order with 2**96 precision\n * @return openAmount The open quote amount of the order\n * @return claimableAmount The claimable base amount of the order\n */\n function getOrder(OrderId orderId)\n external\n view\n returns (address provider, uint256 price, uint256 openAmount, uint256 claimableAmount);\n\n /**\n * @notice Converts a price to a tick\n * @param price The price to convert\n * @return The tick\n */\n function fromPrice(uint256 price) external pure returns (Tick);\n\n /**\n * @notice Converts a tick to a price\n * @param tick The tick to convert\n * @return The price with 2**96 precision\n */\n function toPrice(Tick tick) external pure returns (uint256);\n\n /**\n * @notice Executes a list of actions\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param actionList The list of actions to execute\n * @param paramsDataList The parameters of the actions\n * @param tokensToSettle The tokens to settle\n * @param erc20PermitParamsList The parameters of the ERC20 permits\n * @param erc721PermitParamsList The parameters of the ERC721 permits\n * @param deadline The deadline for the actions\n * @return ids The ids of the orders\n */\n function execute(\n Action[] calldata actionList,\n bytes[] calldata paramsDataList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata erc20PermitParamsList,\n ERC721PermitParams[] calldata erc721PermitParamsList,\n uint64 deadline\n ) external payable returns (OrderId[] memory ids);\n\n /**\n * @notice Makes a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to make\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n * @return ids The ids of the orders\n */\n function make(\n MakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable returns (OrderId[] memory ids);\n\n /**\n * @notice Takes a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to take\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function take(\n TakeOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable;\n\n /**\n * @notice Spends to take a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to spend\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function spend(\n SpendOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC20PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external payable;\n\n /**\n * @notice Claims a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to claim\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function claim(\n ClaimOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external;\n\n /**\n * @notice Cancels a list of orders\n * @dev IMPORTANT: The caller must provide `tokensToSettle` to receive appropriate tokens after execution.\n * @param orderParamsList The list of actions to cancel\n * @param tokensToSettle The tokens to settle\n * @param permitParamsList The parameters of the permits\n * @param deadline The deadline for the actions\n */\n function cancel(\n CancelOrderParams[] calldata orderParamsList,\n address[] calldata tokensToSettle,\n ERC721PermitParams[] calldata permitParamsList,\n uint64 deadline\n ) external;\n}\n" + }, + "src/interfaces/IProvider.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {IProviderFactory} from \"./IProviderFactory.sol\";\n\ninterface IProvider {\n event Claim(\n address indexed broker,\n address indexed protocolTreasury,\n Currency indexed currency,\n uint256 brokerShare,\n uint256 protocolShare\n );\n\n function factory() external returns (IProviderFactory);\n\n function broker() external returns (address);\n\n function shareRatio() external returns (uint256);\n\n function claim(Currency[] calldata currencies) external;\n}\n" + }, + "src/interfaces/IProviderFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\n\ninterface IProviderFactory {\n event DeployProvider(address indexed provider, address indexed broker, uint256 shareRatio);\n\n event SetTreasury(address indexed treasury);\n\n function bookManager() external returns (IBookManager);\n\n function treasury() external returns (address);\n\n function deployProvider(address broker) external returns (address);\n\n function deployProvider(address broker, uint256 shareRatio) external returns (address);\n\n function setTreasury(address newTreasury) external;\n\n /**\n * @notice Whitelists a provider\n * @param provider The provider address\n */\n function whitelist(address provider) external;\n\n /**\n * @notice Delists a provider\n * @param provider The provider address\n */\n function delist(address provider) external;\n\n /**\n * @notice Sets the default provider\n * @param newDefaultProvider The new default provider address\n */\n function setDefaultProvider(address newDefaultProvider) external;\n\n function transferBookManagerOwnership(address newOwner) external;\n}\n" + }, + "src/libraries/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.24;\n\nabstract contract ReentrancyGuard {\n // uint256(keccak256(\"ReentrancyGuard\")) - 1\n uint256 internal constant REENTRANCY_GUARD_SLOT = 0x8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf4;\n\n error ReentrancyGuardReentrantCall();\n\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n if (_reentrancyGuardEntered()) {\n revert ReentrancyGuardReentrantCall();\n }\n assembly {\n // Any calls to nonReentrant after this point will fail\n tstore(REENTRANCY_GUARD_SLOT, 1)\n }\n }\n\n function _nonReentrantAfter() private {\n assembly {\n tstore(REENTRANCY_GUARD_SLOT, 0)\n }\n }\n\n function _reentrancyGuardEntered() internal view returns (bool isEntered) {\n assembly {\n isEntered := tload(REENTRANCY_GUARD_SLOT)\n }\n }\n}\n" + }, + "src/Provider.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Currency, CurrencyLibrary} from \"v2-core/libraries/Currency.sol\";\nimport {IProvider} from \"./interfaces/IProvider.sol\";\nimport {IProviderFactory} from \"./interfaces/IProviderFactory.sol\";\n\ncontract Provider is IProvider {\n using CurrencyLibrary for Currency;\n\n uint256 public constant RATE_PRECISION = 10 ** 6;\n\n IBookManager private immutable _bookManager;\n IProviderFactory public immutable factory;\n address public immutable broker;\n uint256 public immutable shareRatio;\n\n constructor(address broker_, uint256 shareRatio_) {\n factory = IProviderFactory(msg.sender);\n _bookManager = factory.bookManager();\n broker = broker_;\n shareRatio = shareRatio_;\n }\n\n function claim(Currency[] calldata currencies) external {\n address protocolTreasury = factory.treasury();\n for (uint256 i = 0; i < currencies.length; ++i) {\n Currency currency = currencies[i];\n _bookManager.collect(address(this), currency);\n uint256 balance = currency.balanceOfSelf();\n uint256 brokerShare = balance * shareRatio / RATE_PRECISION;\n uint256 protocolShare = balance - brokerShare;\n currency.transfer(broker, brokerShare);\n currency.transfer(protocolTreasury, protocolShare);\n emit Claim(broker, protocolTreasury, currency, brokerShare, protocolShare);\n }\n }\n\n receive() external payable {}\n}\n" + }, + "src/ProviderFactory.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {Ownable2Step, Ownable} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport {UUPSUpgradeable} from \"@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport {IProviderFactory} from \"./interfaces/IProviderFactory.sol\";\nimport {IBookManager} from \"v2-core/interfaces/IBookManager.sol\";\nimport {Provider} from \"./Provider.sol\";\n\ncontract ProviderFactory is IProviderFactory, UUPSUpgradeable, Ownable2Step, Initializable {\n uint256 public defaultBrokerShareRatio;\n IBookManager public bookManager;\n address public treasury;\n\n constructor() Ownable(msg.sender) {}\n\n function __ProviderFactory_init(\n address owner_,\n address bookManager_,\n address treasury_,\n uint256 defaultBrokerShareRatio_\n ) public initializer {\n _transferOwnership(owner_);\n Ownable2Step(bookManager_).acceptOwnership();\n bookManager = IBookManager(bookManager_);\n treasury = treasury_;\n defaultBrokerShareRatio = defaultBrokerShareRatio_;\n }\n\n function _authorizeUpgrade(address) internal override onlyOwner {}\n\n function deployProvider(address broker) external returns (address) {\n return _deployProvider(broker, defaultBrokerShareRatio);\n }\n\n function deployProvider(address broker, uint256 shareRatio) public onlyOwner returns (address) {\n return _deployProvider(broker, shareRatio);\n }\n\n function _deployProvider(address broker, uint256 shareRatio) internal returns (address provider) {\n provider = address(new Provider(broker, shareRatio));\n bookManager.whitelist(provider);\n emit DeployProvider(provider, broker, shareRatio);\n }\n\n function setTreasury(address newTreasury) external onlyOwner {\n treasury = newTreasury;\n emit SetTreasury(newTreasury);\n }\n\n function whitelist(address provider) external onlyOwner {\n bookManager.whitelist(provider);\n }\n\n function delist(address provider) external onlyOwner {\n bookManager.delist(provider);\n }\n\n function setDefaultProvider(address newDefaultProvider) external onlyOwner {\n bookManager.setDefaultProvider(newDefaultProvider);\n }\n\n function transferBookManagerOwnership(address newOwner) external onlyOwner {\n Ownable2Step(address(bookManager)).transferOwnership(newOwner);\n }\n}\n" + }, + "v2-core/interfaces/IBookManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\n\nimport {BookId} from \"../libraries/BookId.sol\";\nimport {Currency} from \"../libraries/Currency.sol\";\nimport {OrderId} from \"../libraries/OrderId.sol\";\nimport {Tick} from \"../libraries/Tick.sol\";\nimport {FeePolicy} from \"../libraries/FeePolicy.sol\";\nimport {IERC721Permit} from \"./IERC721Permit.sol\";\nimport {IHooks} from \"./IHooks.sol\";\n\n/**\n * @title IBookManager\n * @notice The interface for the BookManager contract\n */\ninterface IBookManager is IERC721Metadata, IERC721Permit {\n error InvalidUnitSize();\n error InvalidFeePolicy();\n error InvalidProvider(address provider);\n error LockedBy(address locker, address hook);\n error CurrencyNotSettled();\n\n /**\n * @notice Event emitted when a new book is opened\n * @param id The book id\n * @param base The base currency\n * @param quote The quote currency\n * @param unitSize The unit size of the book\n * @param makerPolicy The maker fee policy\n * @param takerPolicy The taker fee policy\n * @param hooks The hooks contract\n */\n event Open(\n BookId indexed id,\n Currency indexed base,\n Currency indexed quote,\n uint64 unitSize,\n FeePolicy makerPolicy,\n FeePolicy takerPolicy,\n IHooks hooks\n );\n\n /**\n * @notice Event emitted when a new order is made\n * @param bookId The book id\n * @param user The user address\n * @param tick The order tick\n * @param orderIndex The order index\n * @param unit The order unit\n * @param provider The provider address\n */\n event Make(\n BookId indexed bookId, address indexed user, Tick tick, uint256 orderIndex, uint64 unit, address provider\n );\n\n /**\n * @notice Event emitted when an order is taken\n * @param bookId The book id\n * @param user The user address\n * @param tick The order tick\n * @param unit The order unit\n */\n event Take(BookId indexed bookId, address indexed user, Tick tick, uint64 unit);\n\n /**\n * @notice Event emitted when an order is canceled\n * @param orderId The order id\n * @param unit The canceled unit\n */\n event Cancel(OrderId indexed orderId, uint64 unit);\n\n /**\n * @notice Event emitted when an order is claimed\n * @param orderId The order id\n * @param unit The claimed unit\n */\n event Claim(OrderId indexed orderId, uint64 unit);\n\n /**\n * @notice Event emitted when a provider is whitelisted\n * @param provider The provider address\n */\n event Whitelist(address indexed provider);\n\n /**\n * @notice Event emitted when a provider is delisted\n * @param provider The provider address\n */\n event Delist(address indexed provider);\n\n /**\n * @notice Event emitted when a provider collects fees\n * @param provider The provider address\n * @param recipient The recipient address\n * @param currency The currency\n * @param amount The collected amount\n */\n event Collect(address indexed provider, address indexed recipient, Currency indexed currency, uint256 amount);\n\n /**\n * @notice Event emitted when new default provider is set\n * @param newDefaultProvider The new default provider address\n */\n event SetDefaultProvider(address indexed newDefaultProvider);\n\n /**\n * @notice This structure represents a unique identifier for a book in the BookManager.\n * @param base The base currency of the book\n * @param unitSize The unit size of the book\n * @param quote The quote currency of the book\n * @param makerPolicy The maker fee policy of the book\n * @param hooks The hooks contract of the book\n * @param takerPolicy The taker fee policy of the book\n */\n struct BookKey {\n Currency base;\n uint64 unitSize;\n Currency quote;\n FeePolicy makerPolicy;\n IHooks hooks;\n FeePolicy takerPolicy;\n }\n\n /**\n * @notice Returns the base URI\n * @return The base URI\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI\n * @return The contract URI\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the default provider\n * @return The default provider\n */\n function defaultProvider() external view returns (address);\n\n /**\n * @notice Returns the total reserves of a given currency\n * @param currency The currency in question\n * @return The total reserves amount\n */\n function reservesOf(Currency currency) external view returns (uint256);\n\n /**\n * @notice Checks if a provider is whitelisted\n * @param provider The address of the provider\n * @return True if the provider is whitelisted, false otherwise\n */\n function isWhitelisted(address provider) external view returns (bool);\n\n /**\n * @notice Verifies if an owner has authorized a spender for a token\n * @param owner The address of the token owner\n * @param spender The address of the spender\n * @param tokenId The token ID\n */\n function checkAuthorized(address owner, address spender, uint256 tokenId) external view;\n\n /**\n * @notice Calculates the amount owed to a provider in a given currency\n * @param provider The provider's address\n * @param currency The currency in question\n * @return The owed amount\n */\n function tokenOwed(address provider, Currency currency) external view returns (uint256);\n\n /**\n * @notice Calculates the currency balance changes for a given locker\n * @param locker The address of the locker\n * @param currency The currency in question\n * @return The net change in currency balance\n */\n function getCurrencyDelta(address locker, Currency currency) external view returns (int256);\n\n /**\n * @notice Retrieves the book key for a given book ID\n * @param id The book ID\n * @return The book key\n */\n function getBookKey(BookId id) external view returns (BookKey memory);\n\n /**\n * @notice This structure represents a current status for an order in the BookManager.\n * @param provider The provider of the order\n * @param open The open unit of the order\n * @param claimable The claimable unit of the order\n */\n struct OrderInfo {\n address provider;\n uint64 open;\n uint64 claimable;\n }\n\n /**\n * @notice Provides information about an order\n * @param id The order ID\n * @return Order information including provider, open status, and claimable unit\n */\n function getOrder(OrderId id) external view returns (OrderInfo memory);\n\n /**\n * @notice Retrieves the locker and caller addresses for a given lock\n * @param i The index of the lock\n * @return locker The locker's address\n * @return lockCaller The caller's address\n */\n function getLock(uint256 i) external view returns (address locker, address lockCaller);\n\n /**\n * @notice Provides the lock data\n * @return The lock data including necessary numeric values\n */\n function getLockData() external view returns (uint128, uint128);\n\n /**\n * @notice Returns the depth of a given book ID and tick\n * @param id The book ID\n * @param tick The tick\n * @return The depth of the tick\n */\n function getDepth(BookId id, Tick tick) external view returns (uint64);\n\n /**\n * @notice Retrieves the highest tick for a given book ID\n * @param id The book ID\n * @return tick The highest tick\n */\n function getHighest(BookId id) external view returns (Tick tick);\n\n /**\n * @notice Finds the maximum tick less than a specified tick in a book\n * @dev Returns `Tick.wrap(type(int24).min)` if the specified tick is the lowest\n * @param id The book ID\n * @param tick The specified tick\n * @return The next lower tick\n */\n function maxLessThan(BookId id, Tick tick) external view returns (Tick);\n\n /**\n * @notice Checks if a book is opened\n * @param id The book ID\n * @return True if the book is opened, false otherwise\n */\n function isOpened(BookId id) external view returns (bool);\n\n /**\n * @notice Checks if a book is empty\n * @param id The book ID\n * @return True if the book is empty, false otherwise\n */\n function isEmpty(BookId id) external view returns (bool);\n\n /**\n * @notice Encodes a BookKey into a BookId\n * @param key The BookKey to encode\n * @return The encoded BookId\n */\n function encodeBookKey(BookKey calldata key) external pure returns (BookId);\n\n /**\n * @notice Loads a value from a specific storage slot\n * @param slot The storage slot\n * @return The value in the slot\n */\n function load(bytes32 slot) external view returns (bytes32);\n\n /**\n * @notice Loads a sequence of values starting from a specific slot\n * @param startSlot The starting slot\n * @param nSlot The number of slots to load\n * @return The sequence of values\n */\n function load(bytes32 startSlot, uint256 nSlot) external view returns (bytes memory);\n\n /**\n * @notice Opens a new book\n * @param key The book key\n * @param hookData The hook data\n */\n function open(BookKey calldata key, bytes calldata hookData) external;\n\n /**\n * @notice Locks a book manager function\n * @param locker The locker address\n * @param data The lock data\n * @return The lock return data\n */\n function lock(address locker, bytes calldata data) external returns (bytes memory);\n\n /**\n * @notice This structure represents the parameters for making an order.\n * @param key The book key for the order\n * @param tick The tick for the order\n * @param unit The unit for the order. Times key.unitSize to get actual bid amount.\n * @param provider The provider for the order. The limit order service provider address to collect fees.\n */\n struct MakeParams {\n BookKey key;\n Tick tick;\n uint64 unit;\n address provider;\n }\n\n /**\n * @notice Make a limit order\n * @param params The order parameters\n * @param hookData The hook data\n * @return id The order id. Returns 0 if the order is not settled\n * @return quoteAmount The amount of quote currency to be paid\n */\n function make(MakeParams calldata params, bytes calldata hookData)\n external\n returns (OrderId id, uint256 quoteAmount);\n\n /**\n * @notice This structure represents the parameters for taking orders in the specified tick.\n * @param key The book key for the order\n * @param tick The tick for the order\n * @param maxUnit The max unit to take\n */\n struct TakeParams {\n BookKey key;\n Tick tick;\n uint64 maxUnit;\n }\n\n /**\n * @notice Take a limit order at specific tick\n * @param params The order parameters\n * @param hookData The hook data\n * @return quoteAmount The amount of quote currency to be received\n * @return baseAmount The amount of base currency to be paid\n */\n function take(TakeParams calldata params, bytes calldata hookData)\n external\n returns (uint256 quoteAmount, uint256 baseAmount);\n\n /**\n * @notice This structure represents the parameters for canceling an order.\n * @param id The order id for the order\n * @param toUnit The remaining open unit for the order after cancellation. Must not exceed the current open unit.\n */\n struct CancelParams {\n OrderId id;\n uint64 toUnit;\n }\n\n /**\n * @notice Cancel a limit order\n * @param params The order parameters\n * @param hookData The hook data\n * @return canceledAmount The amount of quote currency canceled\n */\n function cancel(CancelParams calldata params, bytes calldata hookData) external returns (uint256 canceledAmount);\n\n /**\n * @notice Claims an order\n * @param id The order ID\n * @param hookData The hook data\n * @return claimedAmount The amount claimed\n */\n function claim(OrderId id, bytes calldata hookData) external returns (uint256 claimedAmount);\n\n /**\n * @notice Collects fees from a provider\n * @param recipient The recipient address\n * @param currency The currency\n * @return The collected amount\n */\n function collect(address recipient, Currency currency) external returns (uint256);\n\n /**\n * @notice Withdraws a currency\n * @param currency The currency\n * @param to The recipient address\n * @param amount The amount\n */\n function withdraw(Currency currency, address to, uint256 amount) external;\n\n /**\n * @notice Settles a currency\n * @param currency The currency\n * @return The settled amount\n */\n function settle(Currency currency) external payable returns (uint256);\n\n /**\n * @notice Whitelists a provider\n * @param provider The provider address\n */\n function whitelist(address provider) external;\n\n /**\n * @notice Delists a provider\n * @param provider The provider address\n */\n function delist(address provider) external;\n\n /**\n * @notice Sets the default provider\n * @param newDefaultProvider The new default provider address\n */\n function setDefaultProvider(address newDefaultProvider) external;\n}\n" + }, + "v2-core/interfaces/IERC721Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/**\n * @title IERC721Permit\n * @notice An interface for the ERC721 permit extension\n */\ninterface IERC721Permit is IERC721 {\n error InvalidSignature();\n error PermitExpired();\n\n /**\n * @notice The EIP-712 typehash for the permit struct used by the contract\n */\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n /**\n * @notice The EIP-712 domain separator for this contract\n */\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n /**\n * @notice Approve the spender to transfer the given tokenId\n * @param spender The address to approve\n * @param tokenId The tokenId to approve\n * @param deadline The deadline for the signature\n * @param v The recovery id of the signature\n * @param r The r value of the signature\n * @param s The s value of the signature\n */\n function permit(address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;\n\n /**\n * @notice Get the current nonce for a token\n * @param tokenId The tokenId to get the nonce for\n * @return The current nonce\n */\n function nonces(uint256 tokenId) external view returns (uint256);\n}\n" + }, + "v2-core/interfaces/IHooks.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport {IBookManager} from \"./IBookManager.sol\";\nimport {OrderId} from \"../libraries/OrderId.sol\";\n\n/**\n * @title IHooks\n * @notice Interface for the hooks contract\n */\ninterface IHooks {\n /**\n * @notice Hook called before opening a new book\n * @param sender The sender of the open transaction\n * @param key The key of the book being opened\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after opening a new book\n * @param sender The sender of the open transaction\n * @param key The key of the book being opened\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterOpen(address sender, IBookManager.BookKey calldata key, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called before making a new order\n * @param sender The sender of the make transaction\n * @param params The parameters of the make transaction\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeMake(address sender, IBookManager.MakeParams calldata params, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after making a new order\n * @param sender The sender of the make transaction\n * @param params The parameters of the make transaction\n * @param orderId The id of the order that was made\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterMake(\n address sender,\n IBookManager.MakeParams calldata params,\n OrderId orderId,\n bytes calldata hookData\n ) external returns (bytes4);\n\n /**\n * @notice Hook called before taking an order\n * @param sender The sender of the take transaction\n * @param params The parameters of the take transaction\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeTake(address sender, IBookManager.TakeParams calldata params, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after taking an order\n * @param sender The sender of the take transaction\n * @param params The parameters of the take transaction\n * @param takenUnit The unit that was taken\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterTake(\n address sender,\n IBookManager.TakeParams calldata params,\n uint64 takenUnit,\n bytes calldata hookData\n ) external returns (bytes4);\n\n /**\n * @notice Hook called before canceling an order\n * @param sender The sender of the cancel transaction\n * @param params The parameters of the cancel transaction\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeCancel(address sender, IBookManager.CancelParams calldata params, bytes calldata hookData)\n external\n returns (bytes4);\n\n /**\n * @notice Hook called after canceling an order\n * @param sender The sender of the cancel transaction\n * @param params The parameters of the cancel transaction\n * @param canceledUnit The unit that was canceled\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterCancel(\n address sender,\n IBookManager.CancelParams calldata params,\n uint64 canceledUnit,\n bytes calldata hookData\n ) external returns (bytes4);\n\n /**\n * @notice Hook called before claiming an order\n * @param sender The sender of the claim transaction\n * @param orderId The id of the order being claimed\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function beforeClaim(address sender, OrderId orderId, bytes calldata hookData) external returns (bytes4);\n\n /**\n * @notice Hook called after claiming an order\n * @param sender The sender of the claim transaction\n * @param orderId The id of the order being claimed\n * @param claimedUnit The unit that was claimed\n * @param hookData The data passed to the hook\n * @return Returns the function selector if the hook is successful\n */\n function afterClaim(address sender, OrderId orderId, uint64 claimedUnit, bytes calldata hookData)\n external\n returns (bytes4);\n}\n" + }, + "v2-core/interfaces/ILocker.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @title ILocker\n * @notice Interface for the locker contract\n */\ninterface ILocker {\n /**\n * @notice Called by the book manager on `msg.sender` when a lock is acquired\n * @param data The data that was passed to the call to lock\n * @return Any data that you want to be returned from the lock call\n */\n function lockAcquired(address lockCaller, bytes calldata data) external returns (bytes memory);\n}\n" + }, + "v2-core/libraries/BookId.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {IBookManager} from \"../interfaces/IBookManager.sol\";\n\ntype BookId is uint192;\n\nlibrary BookIdLibrary {\n function toId(IBookManager.BookKey memory bookKey) internal pure returns (BookId id) {\n bytes32 hash = keccak256(abi.encode(bookKey));\n assembly {\n id := and(hash, 0xffffffffffffffffffffffffffffffffffffffffffffffff)\n }\n }\n}\n" + }, + "v2-core/libraries/Currency.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ntype Currency is address;\n\n/// @title CurrencyLibrary\n/// @dev This library allows for transferring and holding native tokens and ERC20 tokens\nlibrary CurrencyLibrary {\n using CurrencyLibrary for Currency;\n\n /// @notice Thrown when a native transfer fails\n error NativeTransferFailed();\n\n /// @notice Thrown when an ERC20 transfer fails\n error ERC20TransferFailed();\n\n Currency public constant NATIVE = Currency.wrap(address(0));\n\n function transfer(Currency currency, address to, uint256 amount) internal {\n // implementation from\n // https://github.com/transmissions11/solmate/blob/e8f96f25d48fe702117ce76c79228ca4f20206cb/src/utils/SafeTransferLib.sol\n\n bool success;\n if (currency.isNative()) {\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n\n if (!success) revert NativeTransferFailed();\n } else {\n assembly {\n // Get a pointer to some free memory.\n let freeMemoryPointer := mload(0x40)\n\n // Write the abi-encoded calldata into memory, beginning with the function selector.\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\n mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \"to\" argument.\n mstore(add(freeMemoryPointer, 36), amount) // Append the \"amount\" argument. Masking not required as it's a full 32 byte type.\n\n success :=\n and(\n // Set success to whether the call reverted, if not we check it either\n // returned exactly 1 (can't just be non-zero data), or had no return data.\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\n // Counterintuitively, this call must be positioned second to the or() call in the\n // surrounding and() call or else returndatasize() will be zero during the computation.\n call(gas(), currency, 0, freeMemoryPointer, 68, 0, 32)\n )\n }\n\n if (!success) revert ERC20TransferFailed();\n }\n }\n\n function balanceOfSelf(Currency currency) internal view returns (uint256) {\n if (currency.isNative()) return address(this).balance;\n else return IERC20(Currency.unwrap(currency)).balanceOf(address(this));\n }\n\n function equals(Currency currency, Currency other) internal pure returns (bool) {\n return Currency.unwrap(currency) == Currency.unwrap(other);\n }\n\n function isNative(Currency currency) internal pure returns (bool) {\n return Currency.unwrap(currency) == Currency.unwrap(NATIVE);\n }\n\n function toId(Currency currency) internal pure returns (uint256) {\n return uint160(Currency.unwrap(currency));\n }\n\n function fromId(uint256 id) internal pure returns (Currency) {\n return Currency.wrap(address(uint160(id)));\n }\n}\n" + }, + "v2-core/libraries/FeePolicy.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./Math.sol\";\n\ntype FeePolicy is uint24;\n\nlibrary FeePolicyLibrary {\n uint256 internal constant RATE_PRECISION = 10 ** 6;\n int256 internal constant MAX_FEE_RATE = 500000;\n int256 internal constant MIN_FEE_RATE = -500000;\n\n uint256 internal constant RATE_MASK = 0x7fffff; // 23 bits\n\n error InvalidFeePolicy();\n\n function encode(bool usesQuote_, int24 rate_) internal pure returns (FeePolicy feePolicy) {\n if (rate_ > MAX_FEE_RATE || rate_ < MIN_FEE_RATE) {\n revert InvalidFeePolicy();\n }\n\n uint256 mask = usesQuote_ ? 1 << 23 : 0;\n assembly {\n feePolicy := or(mask, add(and(rate_, 0xffffff), MAX_FEE_RATE))\n }\n }\n\n function isValid(FeePolicy self) internal pure returns (bool) {\n int24 r = rate(self);\n\n return !(r > MAX_FEE_RATE || r < MIN_FEE_RATE);\n }\n\n function usesQuote(FeePolicy self) internal pure returns (bool f) {\n assembly {\n f := shr(23, self)\n }\n }\n\n function rate(FeePolicy self) internal pure returns (int24 r) {\n assembly {\n r := sub(and(self, RATE_MASK), MAX_FEE_RATE)\n }\n }\n\n function calculateFee(FeePolicy self, uint256 amount, bool reverseRounding) internal pure returns (int256 fee) {\n int24 r = rate(self);\n\n bool positive = r > 0;\n uint256 absRate;\n unchecked {\n absRate = uint256(uint24(positive ? r : -r));\n }\n // @dev absFee must be less than type(int256).max\n uint256 absFee = Math.divide(amount * absRate, RATE_PRECISION, reverseRounding ? !positive : positive);\n fee = positive ? int256(absFee) : -int256(absFee);\n }\n\n function calculateOriginalAmount(FeePolicy self, uint256 amount, bool reverseFee)\n internal\n pure\n returns (uint256 originalAmount)\n {\n int24 r = rate(self);\n\n uint256 divider;\n assembly {\n if reverseFee { r := sub(0, r) }\n divider := add(RATE_PRECISION, r)\n }\n originalAmount = Math.divide(amount * RATE_PRECISION, divider, false);\n }\n}\n" + }, + "v2-core/libraries/Hooks.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.20;\n\nimport {Lockers} from \"./Lockers.sol\";\nimport {IBookManager} from \"../interfaces/IBookManager.sol\";\nimport {IHooks} from \"../interfaces/IHooks.sol\";\nimport {OrderId} from \"../libraries/OrderId.sol\";\n\n/// @author Clober\n/// @author Modified from Uniswap V4 (https://github.com/Uniswap/v4-core/blob/1f350fa95e862ba8c56c8ff7e146d47c9043465e)\n/// @notice V4 decides whether to invoke specific hooks by inspecting the leading bits of the address that\n/// the hooks contract is deployed to.\n/// For example, a hooks contract deployed to address: 0x9000000000000000000000000000000000000000\n/// has leading bits '1001' which would cause the 'before open' and 'after make' hooks to be used.\nlibrary Hooks {\n using Hooks for IHooks;\n\n uint256 internal constant BEFORE_OPEN_FLAG = 1 << 159;\n uint256 internal constant AFTER_OPEN_FLAG = 1 << 158;\n uint256 internal constant BEFORE_MAKE_FLAG = 1 << 157;\n uint256 internal constant AFTER_MAKE_FLAG = 1 << 156;\n uint256 internal constant BEFORE_TAKE_FLAG = 1 << 155;\n uint256 internal constant AFTER_TAKE_FLAG = 1 << 154;\n uint256 internal constant BEFORE_CANCEL_FLAG = 1 << 153;\n uint256 internal constant AFTER_CANCEL_FLAG = 1 << 152;\n uint256 internal constant BEFORE_CLAIM_FLAG = 1 << 151;\n uint256 internal constant AFTER_CLAIM_FLAG = 1 << 150;\n\n struct Permissions {\n bool beforeOpen;\n bool afterOpen;\n bool beforeMake;\n bool afterMake;\n bool beforeTake;\n bool afterTake;\n bool beforeCancel;\n bool afterCancel;\n bool beforeClaim;\n bool afterClaim;\n }\n\n /// @notice Thrown if the address will not lead to the specified hook calls being called\n /// @param hooks The address of the hooks contract\n error HookAddressNotValid(address hooks);\n\n /// @notice Hook did not return its selector\n error InvalidHookResponse();\n\n /// @notice thrown when a hook call fails\n error FailedHookCall();\n\n /// @notice Utility function intended to be used in hook constructors to ensure\n /// the deployed hooks address causes the intended hooks to be called\n /// @param permissions The hooks that are intended to be called\n /// @dev permissions param is memory as the function will be called from constructors\n function validateHookPermissions(IHooks self, Permissions memory permissions) internal pure {\n if (\n permissions.beforeOpen != self.hasPermission(BEFORE_OPEN_FLAG)\n || permissions.afterOpen != self.hasPermission(AFTER_OPEN_FLAG)\n || permissions.beforeMake != self.hasPermission(BEFORE_MAKE_FLAG)\n || permissions.afterMake != self.hasPermission(AFTER_MAKE_FLAG)\n || permissions.beforeTake != self.hasPermission(BEFORE_TAKE_FLAG)\n || permissions.afterTake != self.hasPermission(AFTER_TAKE_FLAG)\n || permissions.beforeCancel != self.hasPermission(BEFORE_CANCEL_FLAG)\n || permissions.afterCancel != self.hasPermission(AFTER_CANCEL_FLAG)\n || permissions.beforeClaim != self.hasPermission(BEFORE_CLAIM_FLAG)\n || permissions.afterClaim != self.hasPermission(AFTER_CLAIM_FLAG)\n ) {\n revert HookAddressNotValid(address(self));\n }\n }\n\n /// @notice Ensures that the hook address includes at least one hook flag or is the 0 address\n /// @param hook The hook to verify\n function isValidHookAddress(IHooks hook) internal pure returns (bool) {\n // If a hook contract is set, it must have at least 1 flag set\n return address(hook) == address(0) || uint160(address(hook)) >= AFTER_CLAIM_FLAG;\n }\n\n /// @notice performs a hook call using the given calldata on the given hook\n /// @return expectedSelector The selector that the hook is expected to return\n /// @return selector The selector that the hook actually returned\n function _callHook(IHooks self, bytes memory data) private returns (bytes4 expectedSelector, bytes4 selector) {\n bool set = Lockers.setCurrentHook(self);\n\n assembly {\n expectedSelector := mload(add(data, 0x20))\n }\n\n (bool success, bytes memory result) = address(self).call(data);\n if (!success) _revert(result);\n\n selector = abi.decode(result, (bytes4));\n\n // We only want to clear the current hook if it was set in setCurrentHook in this execution frame.\n if (set) Lockers.clearCurrentHook();\n }\n\n /// @notice performs a hook call using the given calldata on the given hook\n function callHook(IHooks self, bytes memory data) internal {\n (bytes4 expectedSelector, bytes4 selector) = _callHook(self, data);\n\n if (selector != expectedSelector) revert InvalidHookResponse();\n }\n\n /// @notice calls beforeOpen hook if permissioned and validates return value\n function beforeOpen(IHooks self, IBookManager.BookKey memory key, bytes calldata hookData) internal {\n if (self.hasPermission(BEFORE_OPEN_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.beforeOpen.selector, msg.sender, key, hookData));\n }\n }\n\n /// @notice calls afterOpen hook if permissioned and validates return value\n function afterOpen(IHooks self, IBookManager.BookKey memory key, bytes calldata hookData) internal {\n if (self.hasPermission(AFTER_OPEN_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.afterOpen.selector, msg.sender, key, hookData));\n }\n }\n\n /// @notice calls beforeMake hook if permissioned and validates return value\n function beforeMake(IHooks self, IBookManager.MakeParams memory params, bytes calldata hookData) internal {\n if (self.hasPermission(BEFORE_MAKE_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.beforeMake.selector, msg.sender, params, hookData));\n }\n }\n\n /// @notice calls afterMake hook if permissioned and validates return value\n function afterMake(IHooks self, IBookManager.MakeParams memory params, OrderId orderId, bytes calldata hookData)\n internal\n {\n if (self.hasPermission(AFTER_MAKE_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.afterMake.selector, msg.sender, params, orderId, hookData));\n }\n }\n\n /// @notice calls beforeTake hook if permissioned and validates return value\n function beforeTake(IHooks self, IBookManager.TakeParams memory params, bytes calldata hookData) internal {\n if (self.hasPermission(BEFORE_TAKE_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.beforeTake.selector, msg.sender, params, hookData));\n }\n }\n\n /// @notice calls afterTake hook if permissioned and validates return value\n function afterTake(IHooks self, IBookManager.TakeParams memory params, uint64 takenAmount, bytes calldata hookData)\n internal\n {\n if (self.hasPermission(AFTER_TAKE_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.afterTake.selector, msg.sender, params, takenAmount, hookData));\n }\n }\n\n /// @notice calls beforeCancel hook if permissioned and validates return value\n function beforeCancel(IHooks self, IBookManager.CancelParams calldata params, bytes calldata hookData) internal {\n if (self.hasPermission(BEFORE_CANCEL_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.beforeCancel.selector, msg.sender, params, hookData));\n }\n }\n\n /// @notice calls afterCancel hook if permissioned and validates return value\n function afterCancel(\n IHooks self,\n IBookManager.CancelParams calldata params,\n uint64 canceledAmount,\n bytes calldata hookData\n ) internal {\n if (self.hasPermission(AFTER_CANCEL_FLAG)) {\n self.callHook(\n abi.encodeWithSelector(IHooks.afterCancel.selector, msg.sender, params, canceledAmount, hookData)\n );\n }\n }\n\n /// @notice calls beforeClaim hook if permissioned and validates return value\n function beforeClaim(IHooks self, OrderId orderId, bytes calldata hookData) internal {\n if (self.hasPermission(BEFORE_CLAIM_FLAG)) {\n self.callHook(abi.encodeWithSelector(IHooks.beforeClaim.selector, msg.sender, orderId, hookData));\n }\n }\n\n /// @notice calls afterClaim hook if permissioned and validates return value\n function afterClaim(IHooks self, OrderId orderId, uint64 claimedAmount, bytes calldata hookData) internal {\n if (self.hasPermission(AFTER_CLAIM_FLAG)) {\n self.callHook(\n abi.encodeWithSelector(IHooks.afterClaim.selector, msg.sender, orderId, claimedAmount, hookData)\n );\n }\n }\n\n function hasPermission(IHooks self, uint256 flag) internal pure returns (bool) {\n return uint256(uint160(address(self))) & flag != 0;\n }\n\n /// @notice bubble up revert if present. Else throw FailedHookCall\n function _revert(bytes memory result) private pure {\n if (result.length == 0) revert FailedHookCall();\n assembly {\n revert(add(0x20, result), mload(result))\n }\n }\n}\n" + }, + "v2-core/libraries/Lockers.sol": { + "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.23;\n\nimport {IHooks} from \"../interfaces/IHooks.sol\";\n\n/// @author Clober\n/// @author Modified from Uniswap V4 (https://github.com/Uniswap/v4-core/tree/98680ebc1a654120e995d53a5b10ec6fe153066f)\n/// @notice Contains data about pool lockers.\n\n/// @dev This library manages a custom storage implementation for a queue\n/// that tracks current lockers. The \"sentinel\" storage slot for this data structure,\n/// always passed in as IPoolManager.LockData storage self, stores not just the current\n/// length of the queue but also the global count of non-zero deltas across all lockers.\n/// The values of the data structure start at OFFSET, and each value is a locker address.\nlibrary Lockers {\n /// struct LockData {\n /// /// @notice The current number of active lockers\n /// uint128 length;\n /// /// @notice The total number of nonzero deltas over all active + completed lockers\n /// uint128 nonzeroDeltaCount;\n /// }\n // uint256(keccak256(\"LockData\")) + 1\n uint256 internal constant LOCK_DATA_SLOT = 0x760a9a962ae3d184e99c0483cf5684fb3170f47116ca4f445c50209da4f4f907;\n\n // uint256(keccak256(\"Lockers\")) + 1\n uint256 internal constant LOCKERS_SLOT = 0x722b431450ce53c44434ec138439e45a0639fe031b803ee019b776fae5cfa2b1;\n\n // The number of slots per item in the lockers array\n uint256 internal constant LOCKER_STRUCT_SIZE = 2;\n\n // uint256(keccak256(\"HookAddress\")) + 1\n uint256 internal constant HOOK_ADDRESS_SLOT = 0xfcac7593714b88fec0c578a53e9f3f6e4b47eb26c9dcaa7eff23a3ac156be422;\n\n uint256 internal constant NONZERO_DELTA_COUNT_OFFSET = 2 ** 128;\n\n uint256 internal constant LENGTH_MASK = (1 << 128) - 1;\n\n /// @dev Pushes a locker onto the end of the queue, and updates the sentinel storage slot.\n function push(address locker, address lockCaller) internal {\n assembly {\n let data := tload(LOCK_DATA_SLOT)\n let l := and(data, LENGTH_MASK)\n\n // LOCKERS_SLOT + l * LOCKER_STRUCT_SIZE\n let indexToWrite := add(LOCKERS_SLOT, mul(l, LOCKER_STRUCT_SIZE))\n\n // in the next storage slot, write the locker and lockCaller\n tstore(indexToWrite, locker)\n tstore(add(indexToWrite, 1), lockCaller)\n\n // increase the length\n tstore(LOCK_DATA_SLOT, add(data, 1))\n }\n }\n\n function lockData() internal view returns (uint128 l, uint128 nonzeroDeltaCount) {\n assembly {\n let data := tload(LOCK_DATA_SLOT)\n l := and(data, LENGTH_MASK)\n nonzeroDeltaCount := shr(128, data)\n }\n }\n\n function length() internal view returns (uint128 l) {\n assembly {\n l := and(tload(LOCK_DATA_SLOT), LENGTH_MASK)\n }\n }\n\n /// @dev Pops a locker off the end of the queue. Note that no storage gets cleared.\n function pop() internal {\n assembly {\n let data := tload(LOCK_DATA_SLOT)\n let l := and(data, LENGTH_MASK)\n if iszero(l) {\n mstore(0x00, 0xf1c77ed0) // LockersPopFailed()\n revert(0x1c, 0x04)\n }\n\n // LOCKERS_SLOT + (l - 1) * LOCKER_STRUCT_SIZE\n let indexToWrite := add(LOCKERS_SLOT, mul(sub(l, 1), LOCKER_STRUCT_SIZE))\n\n // in the next storage slot, delete the locker and lockCaller\n tstore(indexToWrite, 0)\n tstore(add(indexToWrite, 1), 0)\n\n // decrease the length\n tstore(LOCK_DATA_SLOT, sub(data, 1))\n }\n }\n\n function getLocker(uint256 i) internal view returns (address locker) {\n assembly {\n // LOCKERS_SLOT + (i * LOCKER_STRUCT_SIZE)\n locker := tload(add(LOCKERS_SLOT, mul(i, LOCKER_STRUCT_SIZE)))\n }\n }\n\n function getLockCaller(uint256 i) internal view returns (address locker) {\n assembly {\n // LOCKERS_SLOT + (i * LOCKER_STRUCT_SIZE + 1)\n locker := tload(add(LOCKERS_SLOT, add(mul(i, LOCKER_STRUCT_SIZE), 1)))\n }\n }\n\n function getCurrentLocker() internal view returns (address) {\n unchecked {\n uint256 l = length();\n return l > 0 ? getLocker(l - 1) : address(0);\n }\n }\n\n function getCurrentLockCaller() internal view returns (address) {\n unchecked {\n uint256 l = length();\n return l > 0 ? getLockCaller(l - 1) : address(0);\n }\n }\n\n function incrementNonzeroDeltaCount() internal {\n assembly {\n tstore(LOCK_DATA_SLOT, add(tload(LOCK_DATA_SLOT), NONZERO_DELTA_COUNT_OFFSET))\n }\n }\n\n function decrementNonzeroDeltaCount() internal {\n assembly {\n tstore(LOCK_DATA_SLOT, sub(tload(LOCK_DATA_SLOT), NONZERO_DELTA_COUNT_OFFSET))\n }\n }\n\n function getCurrentHook() internal view returns (IHooks currentHook) {\n return IHooks(getHook(length()));\n }\n\n function getHook(uint256 i) internal view returns (address hook) {\n assembly {\n hook := tload(add(HOOK_ADDRESS_SLOT, i))\n }\n }\n\n function setCurrentHook(IHooks currentHook) internal returns (bool set) {\n // Set the hook address for the current locker if the address is 0.\n // If the address is nonzero, a hook has already been set for this lock, and is not allowed to be updated or cleared at the end of the call.\n if (address(getCurrentHook()) == address(0)) {\n uint256 l = length();\n assembly {\n tstore(add(HOOK_ADDRESS_SLOT, l), currentHook)\n }\n return true;\n }\n }\n\n function clearCurrentHook() internal {\n uint256 l = length();\n assembly {\n tstore(add(HOOK_ADDRESS_SLOT, l), 0)\n }\n }\n}\n" + }, + "v2-core/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n function divide(uint256 a, uint256 b, bool roundingUp) internal pure returns (uint256 ret) {\n // In the OrderBook contract code, b is never zero.\n assembly {\n ret := add(div(a, b), and(gt(mod(a, b), 0), roundingUp))\n }\n }\n\n /// @dev Returns `ln(x)`, denominated in `WAD`.\n /// Credit to Remco Bloemen under MIT license: https://2π.com/22/exp-ln\n function lnWad(int256 x) internal pure returns (int256 r) {\n /// @solidity memory-safe-assembly\n assembly {\n // We want to convert `x` from `10**18` fixed point to `2**96` fixed point.\n // We do this by multiplying by `2**96 / 10**18`. But since\n // `ln(x * C) = ln(x) + ln(C)`, we can simply do nothing here\n // and add `ln(2**96 / 10**18)` at the end.\n\n // Compute `k = log2(x) - 96`, `r = 159 - k = 255 - log2(x) = 255 ^ log2(x)`.\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\n r := or(r, shl(3, lt(0xff, shr(r, x))))\n // We place the check here for more optimal stack operations.\n if iszero(sgt(x, 0)) {\n mstore(0x00, 0x1615e638) // `LnWadUndefined()`.\n revert(0x1c, 0x04)\n }\n // forgefmt: disable-next-item\n r := xor(r, byte(and(0x1f, shr(shr(r, x), 0x8421084210842108cc6318c6db6d54be)),\n 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff))\n\n // Reduce range of x to (1, 2) * 2**96\n // ln(2^k * x) = k * ln(2) + ln(x)\n x := shr(159, shl(r, x))\n\n // Evaluate using a (8, 8)-term rational approximation.\n // `p` is made monic, we will multiply by a scale factor later.\n // forgefmt: disable-next-item\n let p := sub( // This heavily nested expression is to avoid stack-too-deep for via-ir.\n sar(96, mul(add(43456485725739037958740375743393,\n sar(96, mul(add(24828157081833163892658089445524,\n sar(96, mul(add(3273285459638523848632254066296,\n x), x))), x))), x)), 11111509109440967052023855526967)\n p := sub(sar(96, mul(p, x)), 45023709667254063763336534515857)\n p := sub(sar(96, mul(p, x)), 14706773417378608786704636184526)\n p := sub(mul(p, x), shl(96, 795164235651350426258249787498))\n // We leave `p` in `2**192` basis so we don't need to scale it back up for the division.\n\n // `q` is monic by convention.\n let q := add(5573035233440673466300451813936, x)\n q := add(71694874799317883764090561454958, sar(96, mul(x, q)))\n q := add(283447036172924575727196451306956, sar(96, mul(x, q)))\n q := add(401686690394027663651624208769553, sar(96, mul(x, q)))\n q := add(204048457590392012362485061816622, sar(96, mul(x, q)))\n q := add(31853899698501571402653359427138, sar(96, mul(x, q)))\n q := add(909429971244387300277376558375, sar(96, mul(x, q)))\n\n // `p / q` is in the range `(0, 0.125) * 2**96`.\n\n // Finalization, we need to:\n // - Multiply by the scale factor `s = 5.549…`.\n // - Add `ln(2**96 / 10**18)`.\n // - Add `k * ln(2)`.\n // - Multiply by `10**18 / 2**96 = 5**18 >> 78`.\n\n // The q polynomial is known not to have zeros in the domain.\n // No scaling required because p is already `2**96` too large.\n p := sdiv(p, q)\n // Multiply by the scaling factor: `s * 5**18 * 2**96`, base is now `5**18 * 2**192`.\n p := mul(1677202110996718588342820967067443963516166, p)\n // Add `ln(2) * k * 5**18 * 2**192`.\n // forgefmt: disable-next-item\n p := add(mul(16597577552685614221487285958193947469193820559219878177908093499208371, sub(159, r)), p)\n // Base conversion: mul `2**96 / (5**18 * 2**192)`.\n r := sdiv(p, 302231454903657293676544000000000000000000)\n }\n }\n}\n" + }, + "v2-core/libraries/OrderId.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nimport {Tick} from \"./Tick.sol\";\nimport {BookId} from \"./BookId.sol\";\n\ntype OrderId is uint256;\n\nlibrary OrderIdLibrary {\n /**\n * @dev Encode the order id.\n * @param bookId The book id.\n * @param tick The tick.\n * @param index The index.\n * @return id The order id.\n */\n function encode(BookId bookId, Tick tick, uint40 index) internal pure returns (OrderId id) {\n // @dev If we just use tick at the assembly code, the code will convert tick into bytes32.\n // e.g. When index == -2, the shifted value( shl(40, tick) ) will be\n // 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0000000000 instead of 0xfffffffe0000000000\n // Therefore, we have to safely cast tick into uint256 first.\n uint256 _tick = uint256(uint24(Tick.unwrap(tick)));\n assembly {\n id := add(index, add(shl(40, _tick), shl(64, bookId)))\n }\n }\n\n function decode(OrderId id) internal pure returns (BookId bookId, Tick tick, uint40 index) {\n assembly {\n bookId := shr(64, id)\n tick := and(shr(40, id), 0xffffff)\n index := and(id, 0xffffffffff)\n }\n }\n\n function getBookId(OrderId id) internal pure returns (BookId bookId) {\n assembly {\n bookId := shr(64, id)\n }\n }\n\n function getTick(OrderId id) internal pure returns (Tick tick) {\n assembly {\n tick := and(shr(40, id), 0xffffff)\n }\n }\n\n function getIndex(OrderId id) internal pure returns (uint40 index) {\n assembly {\n index := and(id, 0xffffffffff)\n }\n }\n}\n" + }, + "v2-core/libraries/SignificantBit.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.0;\n\nlibrary SignificantBit {\n // http://supertech.csail.mit.edu/papers/debruijn.pdf\n uint256 internal constant DEBRUIJN_SEQ = 0x818283848586878898A8B8C8D8E8F929395969799A9B9D9E9FAAEB6BEDEEFF;\n bytes internal constant DEBRUIJN_INDEX =\n hex\"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8\";\n\n /**\n * @notice Finds the index of the least significant bit.\n * @param x The value to compute the least significant bit for. Must be a non-zero value.\n * @return ret The index of the least significant bit.\n */\n function leastSignificantBit(uint256 x) internal pure returns (uint8) {\n require(x > 0);\n uint256 index;\n assembly {\n index := shr(248, mul(and(x, add(not(x), 1)), DEBRUIJN_SEQ))\n }\n return uint8(DEBRUIJN_INDEX[index]); // can optimize with CODECOPY opcode\n }\n\n function mostSignificantBit(uint256 x) internal pure returns (uint8 msb) {\n require(x > 0);\n assembly {\n let f := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(5, gt(x, 0xFFFFFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(4, gt(x, 0xFFFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(3, gt(x, 0xFF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(2, gt(x, 0xF))\n msb := or(msb, f)\n x := shr(f, x)\n f := shl(1, gt(x, 0x3))\n msb := or(msb, f)\n x := shr(f, x)\n f := gt(x, 0x1)\n msb := or(msb, f)\n }\n }\n}\n" + }, + "v2-core/libraries/Tick.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./Math.sol\";\n\ntype Tick is int24;\n\nlibrary TickLibrary {\n using Math for *;\n using TickLibrary for Tick;\n\n error InvalidTick();\n error InvalidPrice();\n error TickOverflow();\n\n int24 internal constant MAX_TICK = 2 ** 19 - 1;\n int24 internal constant MIN_TICK = -MAX_TICK;\n\n uint256 internal constant MIN_PRICE = 1350587;\n uint256 internal constant MAX_PRICE = 4647684107270898330752324302845848816923571339324334;\n\n uint256 private constant _R0 = 0xfff97272373d413259a46990;\n uint256 private constant _R1 = 0xfff2e50f5f656932ef12357c;\n uint256 private constant _R2 = 0xffe5caca7e10e4e61c3624ea;\n uint256 private constant _R3 = 0xffcb9843d60f6159c9db5883;\n uint256 private constant _R4 = 0xff973b41fa98c081472e6896;\n uint256 private constant _R5 = 0xff2ea16466c96a3843ec78b3;\n uint256 private constant _R6 = 0xfe5dee046a99a2a811c461f1;\n uint256 private constant _R7 = 0xfcbe86c7900a88aedcffc83b;\n uint256 private constant _R8 = 0xf987a7253ac413176f2b074c;\n uint256 private constant _R9 = 0xf3392b0822b70005940c7a39;\n uint256 private constant _R10 = 0xe7159475a2c29b7443b29c7f;\n uint256 private constant _R11 = 0xd097f3bdfd2022b8845ad8f7;\n uint256 private constant _R12 = 0xa9f746462d870fdf8a65dc1f;\n uint256 private constant _R13 = 0x70d869a156d2a1b890bb3df6;\n uint256 private constant _R14 = 0x31be135f97d08fd981231505;\n uint256 private constant _R15 = 0x9aa508b5b7a84e1c677de54;\n uint256 private constant _R16 = 0x5d6af8dedb81196699c329;\n uint256 private constant _R17 = 0x2216e584f5fa1ea92604;\n uint256 private constant _R18 = 0x48a170391f7dc42;\n uint256 private constant _R19 = 0x149b34;\n\n function validateTick(Tick tick) internal pure {\n if (Tick.unwrap(tick) > MAX_TICK || Tick.unwrap(tick) < MIN_TICK) revert InvalidTick();\n }\n\n modifier validatePrice(uint256 price) {\n if (price > MAX_PRICE || price < MIN_PRICE) revert InvalidPrice();\n _;\n }\n\n function fromPrice(uint256 price) internal pure validatePrice(price) returns (Tick) {\n unchecked {\n int24 tick = int24((int256(price).lnWad() * 42951820407860) / 2 ** 128);\n if (toPrice(Tick.wrap(tick)) > price) return Tick.wrap(tick - 1);\n return Tick.wrap(tick);\n }\n }\n\n function toPrice(Tick tick) internal pure returns (uint256 price) {\n validateTick(tick);\n int24 tickValue = Tick.unwrap(tick);\n uint256 absTick = uint24(tickValue < 0 ? -tickValue : tickValue);\n\n unchecked {\n if (absTick & 0x1 != 0) price = _R0;\n else price = 1 << 96;\n if (absTick & 0x2 != 0) price = (price * _R1) >> 96;\n if (absTick & 0x4 != 0) price = (price * _R2) >> 96;\n if (absTick & 0x8 != 0) price = (price * _R3) >> 96;\n if (absTick & 0x10 != 0) price = (price * _R4) >> 96;\n if (absTick & 0x20 != 0) price = (price * _R5) >> 96;\n if (absTick & 0x40 != 0) price = (price * _R6) >> 96;\n if (absTick & 0x80 != 0) price = (price * _R7) >> 96;\n if (absTick & 0x100 != 0) price = (price * _R8) >> 96;\n if (absTick & 0x200 != 0) price = (price * _R9) >> 96;\n if (absTick & 0x400 != 0) price = (price * _R10) >> 96;\n if (absTick & 0x800 != 0) price = (price * _R11) >> 96;\n if (absTick & 0x1000 != 0) price = (price * _R12) >> 96;\n if (absTick & 0x2000 != 0) price = (price * _R13) >> 96;\n if (absTick & 0x4000 != 0) price = (price * _R14) >> 96;\n if (absTick & 0x8000 != 0) price = (price * _R15) >> 96;\n if (absTick & 0x10000 != 0) price = (price * _R16) >> 96;\n if (absTick & 0x20000 != 0) price = (price * _R17) >> 96;\n if (absTick & 0x40000 != 0) price = (price * _R18) >> 96;\n }\n if (tickValue > 0) price = 0x1000000000000000000000000000000000000000000000000 / price;\n }\n\n function gt(Tick a, Tick b) internal pure returns (bool) {\n return Tick.unwrap(a) > Tick.unwrap(b);\n }\n\n function baseToQuote(Tick tick, uint256 base, bool roundingUp) internal pure returns (uint256) {\n return Math.divide((base * tick.toPrice()), 1 << 96, roundingUp);\n }\n\n function quoteToBase(Tick tick, uint256 quote, bool roundingUp) internal pure returns (uint256) {\n // @dev quote = unit(uint64) * unitSize(uint64) < 2^96\n // We don't need to check overflow here\n return Math.divide(quote << 96, tick.toPrice(), roundingUp);\n }\n}\n" + } + }, + "settings": { + "evmVersion": "cancun", + "optimizer": { + "enabled": true, + "runs": 1000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/8453/Controller.json b/deployments/8453/Controller.json index 2ba97b9..32ec73a 100644 --- a/deployments/8453/Controller.json +++ b/deployments/8453/Controller.json @@ -1,5 +1,5 @@ { - "address": "0x4FaC849f948E59f9AEB62d9f7E628138DeF03BfA", + "address": "0xeC7385C35dD8038AcfFf89595106e20930b8678C", "abi": [ { "inputs": [ @@ -1003,10 +1003,10 @@ "type": "receive" } ], - "transactionHash": "0xf2fb1da74bd28296980c90a8a0ff52a46db4d53962b9a4025c4ec3fe69cab1ed", + "transactionHash": "0x", "args": [ "0x382CCccbD3b142D7DA063bF68cd0c89634767F76" ], "numDeployments": 1, - "bytecode": "0x60a0604052348015600e575f80fd5b5060405161581e38038061581e833981016040819052602b91603b565b6001600160a01b03166080526066565b5f60208284031215604a575f80fd5b81516001600160a01b0381168114605f575f80fd5b9392505050565b60805161568f61018f5f395f818161017a015281816104e601528181610585015281816107690152818161094701528181610a8e01528181610c1e01528181610caf01528181610d7901528181610ed401528181611147015281816113ac01528181611769015281816119b101528181611a7401528181611ed001528181611f5801528181612038015281816121ec0152818161228f0152818161232a015281816124370152818161257b0152818161261e015281816126b9015281816127d2015281816129200152818161299a01528181612a3e01528181612b3901528181612bb101528181612c0901528181612c9a01528181612d5401528181612dfe01528181612e7901528181612ef301528181612f8401528181612ff901526135dd015261568f5ff3fe6080604052600436106100e7575f3560e01c80637658ab0511610087578063a183a10411610057578063a183a10414610295578063c0e8e89a146102b4578063d09ef241146102c7578063fe81574614610310575f80fd5b80637658ab05146102245780637d773110146102445780638feb85b714610257578063a04c796b14610276575f80fd5b80633f322bc9116100c25780633f322bc91461016957806341a8bb88146101b4578063483f9f2f146101d35780635083585814610205575f80fd5b806309ae2c13146100f257806315c7afb4146101075780631ae45a121461013c575f80fd5b366100ee57005b5f80fd5b610105610100366004613e39565b610323565b005b348015610112575f80fd5b50610126610121366004613fea565b610570565b60405161013391906140a4565b60405180910390f35b348015610147575f80fd5b5061015b6101563660046140ca565b610bf2565b604051908152602001610133565b348015610174575f80fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610133565b3480156101bf575f80fd5b5061015b6101ce3660046140fe565b610c8f565b3480156101de575f80fd5b506101f26101ed366004614135565b610dfc565b60405160029190910b8152602001610133565b348015610210575f80fd5b5061015b61021f36600461414c565b610e06565b6102376102323660046141a7565b610e13565b604051610133919061429b565b610237610252366004613e39565b610f80565b348015610262575f80fd5b506101056102713660046142de565b6111eb565b348015610281575f80fd5b506101056102903660046142de565b611434565b3480156102a0575f80fd5b506101056102af36600461435f565b6115b3565b6101056102c2366004613e39565b6117ee565b3480156102d2575f80fd5b506102e66102e1366004614135565b61196f565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610133565b61023761031e366004613e39565b611b90565b80806001600160401b031642111561034e5760405163637910d560e11b815260040160405180910390fd5b838361035a8282611d13565b885f816001600160401b0381111561037457610374613ef2565b60405190808252806020026020018201604052801561039d578160200160208202803683370190505b5090505f826001600160401b038111156103b9576103b9613ef2565b6040519080825280602002602001820160405280156103ec57816020015b60608152602001906001900390816103d75790505b5090505f5b838110156104a457600383828151811061040d5761040d6143b1565b60200260200101906006811115610426576104266143c5565b90816006811115610439576104396143c5565b9052508d8d8281811061044e5761044e6143b1565b905060200281019061046091906143d9565b60405160200161047091906144c2565b604051602081830303815290604052828281518110610491576104916143b1565b60209081029190910101526001016103f1565b505f3383838e8e6040516020016104bf9594939291906145cd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061051d9030908590600401614615565b5f604051808303815f875af1158015610538573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261055f9190810190614683565b505050505050505050505050505050565b606061057a611e1a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415806105bb57506001600160a01b0383163014155b156105f2576040517fc0185c6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805f808580602001905181019061060a91906147cc565b8251939750919550935091505f816001600160401b0381111561062f5761062f613ef2565b604051908082528060200260200182016040528015610658578160200160208202803683370190505b5090505f805b83811015610bad575f878281518110610679576106796143b1565b602002602001015190505f6006811115610695576106956143c5565b8160068111156106a7576106a76143c5565b036106e6576106e18783815181106106c1576106c16143b1565b60200260200101518060200190518101906106dc919061497f565b611e99565b610ba4565b60018160068111156106fa576106fa6143c5565b036107f2575f610735888481518110610715576107156143b1565b60200260200101518060200190518101906107309190614a0e565b611f33565b905080156107ec576040516323b872dd60e01b81523060048201526001600160a01b038b81166024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064015f604051808303815f87803b1580156107aa575f80fd5b505af11580156107bc573d5f803e3d5ffd5b50505050808585806107cd90614ab9565b9650815181106107df576107df6143b1565b6020026020010181815250505b50610ba4565b6002816006811115610806576108066143c5565b03610841575f610735888481518110610821576108216143b1565b602002602001015180602001905181019061083c9190614ad1565b61210c565b6003816006811115610855576108556143c5565b036108965761088f87838151811061086f5761086f6143b1565b602002602001015180602001905181019061088a9190614c37565b6121c5565b5050610ba4565b60048160068111156108aa576108aa6143c5565b036108e45761088f8783815181106108c4576108c46143b1565b60200260200101518060200190518101906108df9190614c37565b612554565b60058160068111156108f8576108f86143c5565b03610a2b575f878381518110610910576109106143b1565b602002602001015180602001905181019061092b9190614c68565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa15801561099c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c09190614cbe565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610a0c575f80fd5b505afa158015610a1e573d5f803e3d5ffd5b5050505061088f826128e9565b6006816006811115610a3f57610a3f6143c5565b03610b72575f878381518110610a5757610a576143b1565b6020026020010151806020019051810190610a729190614cd9565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa158015610ae3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b079190614cbe565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610b53575f80fd5b505afa158015610b65573d5f803e3d5ffd5b5050505061088f82612997565b6040517f4a7f394f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060010161065e565b50610bb88785612b11565b80825281604051602001610bcc919061429b565b604051602081830303815290604052975050505050505050610bec613202565b92915050565b60405163cdc92f2d60e01b81526001600160c01b03821660048201525f90610bec906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cdc92f2d90602401602060405180830381865afa158015610c63573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c879190614d54565b60020b613227565b604051639b22917d60e01b81526001600160c01b03831660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190614d6f565b602001516040517f41a8bb880000000000000000000000000000000000000000000000000000000081526001600160c01b0385166004820152600284900b60248201526001600160401b03909116906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610dbe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de29190614d89565b6001600160401b0316610df59190614da4565b9392505050565b5f610bec826134ef565b5f610bec8260020b613227565b606081806001600160401b0316421115610e405760405163637910d560e11b815260040160405180910390fd5b8b8a14610e79576040517f947d5a8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e838787611d13565b610e8d858561359b565b5f338e8e8e8e8e8e604051602001610eab9796959493929190614dbb565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca1799890610f0b9030908690600401614615565b5f604051808303815f875af1158015610f26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f4d9190810190614683565b905080515f14610f6e5780806020019051810190610f6b9190614e8a565b93505b5050509b9a5050505050505050505050565b606081806001600160401b0316421115610fad5760405163637910d560e11b815260040160405180910390fd5b8484610fb98282611d13565b895f816001600160401b03811115610fd357610fd3613ef2565b604051908082528060200260200182016040528015610ffc578160200160208202803683370190505b5090505f826001600160401b0381111561101857611018613ef2565b60405190808252806020026020018201604052801561104b57816020015b60608152602001906001900390816110365790505b5090505f5b8381101561110357600183828151811061106c5761106c6143b1565b60200260200101906006811115611085576110856143c5565b90816006811115611098576110986143c5565b9052508e8e828181106110ad576110ad6143b1565b90506020028101906110bf9190614f15565b6040516020016110cf9190614f29565b6040516020818303038152906040528282815181106110f0576110f06143b1565b6020908102919091010152600101611050565b505f3383838f8f60405160200161111e9594939291906145cd565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061117e9030908690600401614615565b5f604051808303815f875af1158015611199573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111c09190810190614683565b9050808060200190518101906111d69190614e8a565b98505050505050505050979650505050505050565b80806001600160401b03164211156112165760405163637910d560e11b815260040160405180910390fd5b611220848461359b565b865f816001600160401b0381111561123a5761123a613ef2565b604051908082528060200260200182016040528015611263578160200160208202803683370190505b5090505f826001600160401b0381111561127f5761127f613ef2565b6040519080825280602002602001820160405280156112b257816020015b606081526020019060019003908161129d5790505b5090505f5b8381101561136a5760058382815181106112d3576112d36143b1565b602002602001019060068111156112ec576112ec6143c5565b908160068111156112ff576112ff6143c5565b9052508b8b82818110611314576113146143b1565b90506020028101906113269190614f8c565b6040516020016113369190614fa0565b604051602081830303815290604052828281518110611357576113576143b1565b60209081029190910101526001016112b7565b505f3383838c8c6040516020016113859594939291906145cd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906113e39030908590600401614615565b5f604051808303815f875af11580156113fe573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114259190810190614683565b50505050505050505050505050565b80806001600160401b031642111561145f5760405163637910d560e11b815260040160405180910390fd5b611469848461359b565b865f816001600160401b0381111561148357611483613ef2565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b5090505f826001600160401b038111156114c8576114c8613ef2565b6040519080825280602002602001820160405280156114fb57816020015b60608152602001906001900390816114e65790505b5090505f5b8381101561136a57600683828151811061151c5761151c6143b1565b60200260200101906006811115611535576115356143c5565b90816006811115611548576115486143c5565b9052508b8b8281811061155d5761155d6143b1565b905060200281019061156f9190614fcd565b60405160200161157f9190614fe1565b6040516020818303038152906040528282815181106115a0576115a06143b1565b6020908102919091010152600101611500565b80806001600160401b03164211156115de5760405163637910d560e11b815260040160405180910390fd5b825f816001600160401b038111156115f8576115f8613ef2565b604051908082528060200260200182016040528015611621578160200160208202803683370190505b5090505f826001600160401b0381111561163d5761163d613ef2565b60405190808252806020026020018201604052801561167057816020015b606081526020019060019003908161165b5790505b5090505f5b83811015611727575f838281518110611690576116906143b1565b602002602001019060068111156116a9576116a96143c5565b908160068111156116bc576116bc6143c5565b9052508787828181106116d1576116d16143b1565b90506020028101906116e39190615018565b6040516020016116f39190615042565b604051602081830303815290604052828281518110611714576117146143b1565b6020908102919091010152600101611675565b5060605f338484846040516020016117429493929190615109565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906117a09030908590600401614615565b5f604051808303815f875af11580156117bb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117e29190810190614683565b50505050505050505050565b80806001600160401b03164211156118195760405163637910d560e11b815260040160405180910390fd5b83836118258282611d13565b885f816001600160401b0381111561183f5761183f613ef2565b604051908082528060200260200182016040528015611868578160200160208202803683370190505b5090505f826001600160401b0381111561188457611884613ef2565b6040519080825280602002602001820160405280156118b757816020015b60608152602001906001900390816118a25790505b5090505f5b838110156104a45760048382815181106118d8576118d86143b1565b602002602001019060068111156118f1576118f16143c5565b90816006811115611904576119046143c5565b9052508d8d82818110611919576119196143b1565b905060200281019061192b91906143d9565b60405160200161193b91906144c2565b60405160208183030381529060405282828151811061195c5761195c6143b1565b60209081029190910101526001016118bc565b5f8080808080604087901c62ffffff602889901c16604051639b22917d60e01b81526001600160c01b038316600482015291935091505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156119f6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1a9190614d6f565b60208101519091506001600160401b0316611a38600284900b613227565b6040517fd09ef241000000000000000000000000000000000000000000000000000000008152600481018b90529097505f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d09ef24190602401606060405180830381865afa158015611ab9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611add9190615187565b80516020820151909a50909150611afd906001600160401b031683614da4565b6060840151604083015191985090611b2e90611b22906001600160401b031685614da4565b600287900b905f6136b2565b9650611b3f8162ffffff1660171c90565b611b83575f611b5462ffffff831689836136dc565b90505f8113611b7557611b66816151d9565b611b70908961520f565b611b7f565b611b7f8189615222565b9750505b5050505050509193509193565b606081806001600160401b0316421115611bbd5760405163637910d560e11b815260040160405180910390fd5b8484611bc98282611d13565b895f816001600160401b03811115611be357611be3613ef2565b604051908082528060200260200182016040528015611c0c578160200160208202803683370190505b5090505f826001600160401b03811115611c2857611c28613ef2565b604051908082528060200260200182016040528015611c5b57816020015b6060815260200190600190039081611c465790505b5090505f5b83811015611103576002838281518110611c7c57611c7c6143b1565b60200260200101906006811115611c9557611c956143c5565b90816006811115611ca857611ca86143c5565b9052508e8e82818110611cbd57611cbd6143b1565b9050602002810190611ccf9190615018565b604051602001611cdf9190615235565b604051602081830303815290604052828281518110611d0057611d006143b1565b6020908102919091010152600101611c60565b5f5b81811015611e15575f838383818110611d3057611d306143b1565b905060c00201803603810190611d46919061533f565b60408101515190915015611e0c5780516020808301516040808501518051938101518183015160609092015192517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810194909452606484019490945260ff909316608483015260a482019290925260c48101919091526001600160a01b039091169063d505accf9060e4015f604051808303815f87803b158015611df9575f80fd5b505af1925050508015611e0a575060015b505b50600101611d15565b505050565b7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45c15611e73576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60017f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b805160208201516040517ffefc7c510000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263fefc7c5192611f039260040161537b565b5f604051808303815f87803b158015611f1a575f80fd5b505af1158015611f2c573d5f803e3d5ffd5b5050505050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f9081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015611fa5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc99190614d6f565b90505f83604001519050611fe6826060015162ffffff1660171c90565b156120035760608201516120009062ffffff16825f61375c565b90505b5f61202583602001516001600160401b0316836120209190615406565b6137a0565b90506001600160401b03811615612104577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631dbef4886040518060800160405280868152602001886020015160020b8152602001846001600160401b031681526020015f6001600160a01b031681525087606001516040518363ffffffff1660e01b81526004016120c1929190615425565b60408051808303815f875af11580156120dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061210091906154d3565b5093505b505050919050565b5f806121556040518060a00160405280855f01516001600160c01b0316815260200185604001518152602001856080015181526020015f81526020018560a00151815250612554565b915050808360800181815161216a9190615222565b9052506080830151156121bf576121bc604051806080016040528085602001516001600160c01b03168152602001856060015160020b8152602001856080015181526020018560c00151815250611f33565b91505b50919050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015612239573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061225d9190614d6f565b90505b8284604001511180156123025750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156122dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061230091906154f5565b155b1561252957835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612377573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239b9190614d54565b90506123a98160020b613227565b856020015111156123ba5750612529565b5f6123ce8360a0015162ffffff1660171c90565b156123ff576123f88587604001510360018560a0015162ffffff1661375c9092919063ffffffff16565b9050612409565b8486604001510390505b60208301516001600160401b03168082049082061515600116019050805f03612433575050612529565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612487876137a0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b81526004016124b5929190615514565b60408051808303815f875af11580156124d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124f491906154d3565b91509150815f036125085750505050612529565b612512828861520f565b965061251e818761520f565b955050505050612260565b818460600151101561254e57604051630f271b5560e41b815260040160405180910390fd5b50915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa1580156125c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125ec9190614d6f565b90505b8360400151821080156126915750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa15801561266b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061268f91906154f5565b155b156128c457835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612706573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061272a9190614d54565b90506127388160020b613227565b8560200151111561274957506128c4565b5f61275d8360a0015162ffffff1660171c90565b1561277057838660400151039050612797565b612794848760400151035f8560a0015162ffffff1661375c9092919063ffffffff16565b90505b60208301516001600160401b03166127b4600284900b835f6137f7565b6127be9190615406565b9050805f036127ce5750506128c4565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612822876137a0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b8152600401612850929190615514565b60408051808303815f875af115801561286b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061288f91906154d3565b91509150805f036128a357505050506128c4565b6128ad828861520f565b96506128b9818761520f565b9550505050506125ef565b828460600151111561254e57604051630f271b5560e41b815260040160405180910390fd5b805160208201516040517f38926b6d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926338926b6d92612953926004016155ae565b6020604051808303815f875af115801561296f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061299391906155c6565b5050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b22917d6129d4845f015160401c90565b6040516001600160e01b031960e084901b1681526001600160c01b03909116600482015260240160c060405180830381865afa158015612a16573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a3a9190614d6f565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166314d6a9eb6040518060400160405280855f01518152602001612a9f85602001516001600160401b031687602001516120209190615406565b6001600160401b031681525084604001516040518363ffffffff1660e01b8152600401612acd9291906155dd565b6020604051808303815f875af1925050508015612b07575060408051601f3d908101601f19168201909252612b04918101906155c6565b60015b1561299357505050565b60405163258473db60e21b81523060048201525f602482018190529081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612b7e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ba291906155c6565b90505f811215612c7557612bea7f0000000000000000000000000000000000000000000000000000000000000000612bd9836151d9565b6001600160a01b0385169190613839565b604051636a256b2960e01b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612c4f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c7391906155c6565b505b60405163258473db60e21b81523060048201526001600160a01b0383811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612cdf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d0391906155c6565b90505f811315612dac576040517fd9caed120000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528581166024830152604482018390527f0000000000000000000000000000000000000000000000000000000000000000169063d9caed12906064015f604051808303815f87803b158015612d95575f80fd5b505af1158015612da7573d5f803e3d5ffd5b505050505b82515f5b818110156131e7575f858281518110612dcb57612dcb6143b1565b602090810291909101015160405163258473db60e21b81523060048201526001600160a01b0380831660248301529192507f000000000000000000000000000000000000000000000000000000000000000090911690639611cf6c90604401602060405180830381865afa158015612e45573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e6991906155c6565b93505f841215612f5f57612ed4877f0000000000000000000000000000000000000000000000000000000000000000612ea1876151d9565b898681518110612eb357612eb36143b1565b60200260200101516001600160a01b0316613908909392919063ffffffff16565b604051636a256b2960e01b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612f39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f5d91906155c6565b505b60405163258473db60e21b81523060048201526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612fc9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fed91906155c6565b93505f8413156130a7577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed12878481518110613038576130386143b1565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908a166024820152604481018790526064015f604051808303815f87803b158015613090575f80fd5b505af11580156130a2573d5f803e3d5ffd5b505050505b5f8683815181106130ba576130ba6143b1565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613121573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061314591906155c6565b905080156131dd5786838151811061315f5761315f6143b1565b602090810291909101015160405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af11580156131b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131db91906154f5565b505b5050600101612db0565b504715611f2c57611f2c6001600160a01b0384168647613839565b5f7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b5f61323182613977565b815f600282900b8113613244578161324d565b61324d82615609565b62ffffff8116915060011615613271576bfff97272373d413259a469909250613282565b6c0100000000000000000000000092505b60028116156132a15760606bfff2e50f5f656932ef12357c8402901c92505b60048116156132c05760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156132df5760606bffcb9843d60f6159c9db58838402901c92505b60108116156132fe5760606bff973b41fa98c081472e68968402901c92505b602081161561331d5760606bff2ea16466c96a3843ec78b38402901c92505b604081161561333c5760606bfe5dee046a99a2a811c461f18402901c92505b608081161561335b5760606bfcbe86c7900a88aedcffc83b8402901c92505b61010081161561337b5760606bf987a7253ac413176f2b074c8402901c92505b61020081161561339b5760606bf3392b0822b70005940c7a398402901c92505b6104008116156133bb5760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156133db5760606bd097f3bdfd2022b8845ad8f78402901c92505b6110008116156133fb5760606ba9f746462d870fdf8a65dc1f8402901c92505b61200081161561341b5760606b70d869a156d2a1b890bb3df68402901c92505b61400081161561343b5760606b31be135f97d08fd9812315058402901c92505b61800081161561345b5760606b09aa508b5b7a84e1c677de548402901c92505b6201000081161561347b5760606a5d6af8dedb81196699c3298402901c92505b6202000081161561349a576060692216e584f5fa1ea926048402901c92505b620400008116156134b757606067048a170391f7dc428402901c92505b5f8260020b13156134e8576134e5837801000000000000000000000000000000000000000000000000615406565b92505b5050919050565b5f81750c6c1313451aab317fb9b67e11777e9a5a6ccdb2ebae811180613517575062149bbb81105b1561354d576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f700100000000000000000000000000000000613569856139d6565b6527107fff7434028161357e5761357e6153f2565b0590508361358b82613227565b11156121bc575f190191506121bf565b5f5b81811015611e15575f8383838181106135b8576135b86143b1565b905060a002016020018036038101906135d19190615629565b8051909150156136a9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637ac2ff7b3086868681811061361d5761361d6143b1565b865160208801516040808a015160608b015191516001600160e01b031960e08b901b1681526001600160a01b03909816600489015260a090940295909501356024870152604486019190915260ff16606485015260848401525060a482015260c4015f604051808303815f87803b158015613696575f80fd5b505af19250505080156136a7575060015b505b5060010161359d565b5f6136d4606084901b6136c78660020b613227565b8082061515851691040190565b949350505050565b5f6207a11f19627fffff851601600281900b821282816136fe57825f03613700565b825b62ffffff1690505f6137396137158389614da4565b620f42408861372b578581830615151691040190565b808206151586151691040190565b90508261374e57613749816151d9565b613750565b805b98975050505050505050565b5f6207a11f19627fffff85160181831561377657815f0391505b81620f4240019050613796620f4240866137909190614da4565b82900490565b9695505050505050565b5f6001600160401b038211156137f357604080517f6dfcc6500000000000000000000000000000000000000000000000000000000081526004810191909152602481018390526044015b60405180910390fd5b5090565b5f6136d46138078560020b613227565b6138119085614da4565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b5f6001600160a01b03841661388e575f805f8085875af1905080613889576040517ff4b3b1bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613902565b60405163a9059cbb60e01b81526001600160a01b038416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080613902576040517ff27f64e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b179052613902908590613bef565b6207ffff600282900b138061399c57506139936207ffff615609565b60020b8160020b125b156139d3576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6fffffffffffffffffffffffffffffffff811160071b81811c6001600160401b031060061b1781811c63ffffffff1060051b1781811c61ffff1060041b1781811c60ff1060031b175f8213613a3257631615e6385f526004601cfd5b7103782dace9d90000000000000000000000007ff8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff6f8421084210842108cc6318c6db6d54be84841c1c601f161a90911891821b609f90811c6c465772b2bbbb5f824b15207a3081018102606090811d6d0388eaa27412d5aca026815d636e018202811d6d0df99ac502031bf953eff472fdcc018202811d6d13cdffb29d51d99322bdff5f2211018202811d6d0a0f742023def783a307a986912e018202811d6d01920d8043ca89b5239253284e42018202811d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7883018302821d6d0139601a2efabe717e604cbb4894018302821d6d02247f7a7b6594320649aa03aba1018302821d6c8c3f38e95a6b1ff2ab1c3b343619018302821d6d02384773bdf1ac5676facced60901901830290911d6cb9a025d814b29c212b8b1a07cd19019091027ffffffffffffffff5f6af8f7b3396644f18e157960000000000000000000000000105711340daa0d5f769dba1915cef59f0815a5506029290037d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302919091010590565b5f613c036001600160a01b03841683613c69565b905080515f14158015613c27575080806020019051810190613c2591906154f5565b155b15611e15576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016137ea565b6060610df583835f845f80856001600160a01b03168486604051613c8d9190615643565b5f6040518083038185875af1925050503d805f8114613cc7576040519150601f19603f3d011682016040523d82523d5f602084013e613ccc565b606091505b5091509150613796868383606082613cec57613ce782613d4c565b610df5565b8151158015613d0357506001600160a01b0384163b155b15613d45576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016137ea565b5080610df5565b805115613d5c5780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8083601f840112613d9e575f80fd5b5081356001600160401b03811115613db4575f80fd5b6020830191508360208260051b8501011115613dce575f80fd5b9250929050565b5f8083601f840112613de5575f80fd5b5081356001600160401b03811115613dfb575f80fd5b60208301915083602060c083028501011115613dce575f80fd5b6001600160401b03811681146139d3575f80fd5b8035613e3481613e15565b919050565b5f805f805f805f6080888a031215613e4f575f80fd5b87356001600160401b0380821115613e65575f80fd5b613e718b838c01613d8e565b909950975060208a0135915080821115613e89575f80fd5b613e958b838c01613d8e565b909750955060408a0135915080821115613ead575f80fd5b50613eba8a828b01613dd5565b9094509250506060880135613ece81613e15565b8091505092959891949750929550565b6001600160a01b03811681146139d3575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b0381118282101715613f2857613f28613ef2565b60405290565b604051608081016001600160401b0381118282101715613f2857613f28613ef2565b60405160e081016001600160401b0381118282101715613f2857613f28613ef2565b604051606081016001600160401b0381118282101715613f2857613f28613ef2565b604051601f8201601f191681016001600160401b0381118282101715613fbc57613fbc613ef2565b604052919050565b5f6001600160401b03821115613fdc57613fdc613ef2565b50601f01601f191660200190565b5f8060408385031215613ffb575f80fd5b823561400681613ede565b915060208301356001600160401b03811115614020575f80fd5b8301601f81018513614030575f80fd5b803561404361403e82613fc4565b613f94565b818152866020838501011115614057575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610df56020830184614076565b6001600160c01b03811681146139d3575f80fd5b5f602082840312156140da575f80fd5b8135610df5816140b6565b8060020b81146139d3575f80fd5b8035613e34816140e5565b5f806040838503121561410f575f80fd5b823561411a816140b6565b9150602083013561412a816140e5565b809150509250929050565b5f60208284031215614145575f80fd5b5035919050565b5f6020828403121561415c575f80fd5b8135610df5816140e5565b5f8083601f840112614177575f80fd5b5081356001600160401b0381111561418d575f80fd5b60208301915083602060a083028501011115613dce575f80fd5b5f805f805f805f805f805f60c08c8e0312156141c1575f80fd5b6001600160401b03808d3511156141d6575f80fd5b6141e38e8e358f01613d8e565b909c509a5060208d01358110156141f8575f80fd5b6142088e60208f01358f01613d8e565b909a50985060408d013581101561421d575f80fd5b61422d8e60408f01358f01613d8e565b909850965060608d0135811015614242575f80fd5b6142528e60608f01358f01613dd5565b909650945060808d0135811015614267575f80fd5b506142788d60808e01358e01614167565b909350915061428960a08d01613e29565b90509295989b509295989b9093969950565b602080825282518282018190525f9190848201906040850190845b818110156142d2578351835292840192918401916001016142b6565b50909695505050505050565b5f805f805f805f6080888a0312156142f4575f80fd5b87356001600160401b038082111561430a575f80fd5b6143168b838c01613d8e565b909950975060208a013591508082111561432e575f80fd5b61433a8b838c01613d8e565b909750955060408a0135915080821115614352575f80fd5b50613eba8a828b01614167565b5f805f60408486031215614371575f80fd5b83356001600160401b03811115614386575f80fd5b61439286828701613d8e565b90945092505060208401356143a681613e15565b809150509250925092565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f8235609e198336030181126143ed575f80fd5b9190910192915050565b5f808335601e1984360301811261440c575f80fd5b83016020810192503590506001600160401b0381111561442a575f80fd5b803603821315613dce575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f813561446c816140b6565b6001600160c01b0381168452506020820135602084015260408201356040840152606082013560608401526144a460808301836143f7565b60a060808601526144b960a086018284614438565b95945050505050565b602081525f610df56020830184614460565b5f600782106144f157634e487b7160e01b5f52602160045260245ffd5b50815260200190565b5f815180845260208085019450602084015f5b8381101561452e576145208783516144d4565b96509082019060010161450d565b509495945050505050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101561458457601f19868403018952614572838351614076565b98840198925090830190600101614556565b5090979650505050505050565b8183525f60208085019450825f5b8581101561452e5781356145b281613ede565b6001600160a01b03168752958201959082019060010161459f565b6001600160a01b0386168152608060208201525f6145ee60808301876144fa565b82810360408401526146008187614539565b90508281036060840152613750818587614591565b6001600160a01b0383168152604060208201525f6136d46040830184614076565b5f82601f830112614645575f80fd5b815161465361403e82613fc4565b818152846020838601011115614667575f80fd5b8160208501602083015e5f918101602001919091529392505050565b5f60208284031215614693575f80fd5b81516001600160401b038111156146a8575f80fd5b6136d484828501614636565b5f6001600160401b038211156146cc576146cc613ef2565b5060051b60200190565b600781106139d3575f80fd5b5f82601f8301126146f1575f80fd5b8151602061470161403e836146b4565b82815260059290921b8401810191818101908684111561471f575f80fd5b8286015b8481101561475c5780516001600160401b03811115614740575f80fd5b61474e8986838b0101614636565b845250918301918301614723565b509695505050505050565b5f82601f830112614776575f80fd5b8151602061478661403e836146b4565b8083825260208201915060208460051b8701019350868411156147a7575f80fd5b602086015b8481101561475c5780516147bf81613ede565b83529183019183016147ac565b5f805f80608085870312156147df575f80fd5b84516147ea81613ede565b809450506020808601516001600160401b0380821115614808575f80fd5b818801915088601f83011261481b575f80fd5b815161482961403e826146b4565b81815260059190911b8301840190848101908b831115614847575f80fd5b938501935b8285101561486e57845161485f816146d6565b8252938501939085019061484c565b60408b01519098509450505080831115614886575f80fd5b61489289848a016146e2565b945060608801519250808311156148a7575f80fd5b50506148b587828801614767565b91505092959194509250565b62ffffff811681146139d3575f80fd5b5f60c082840312156148e1575f80fd5b60405160c081018181106001600160401b038211171561490357614903613ef2565b8060405250809150825161491681613ede565b8152602083015161492681613e15565b6020820152604083015161493981613ede565b6040820152606083015161494c816148c1565b6060820152608083015161495f81613ede565b608082015260a0830151614972816148c1565b60a0919091015292915050565b5f6020828403121561498f575f80fd5b81516001600160401b03808211156149a5575f80fd5b9083019060e082860312156149b8575f80fd5b6149c0613f06565b6149ca86846148d1565b815260c0830151828111156149dd575f80fd5b6149e987828601614636565b60208301525095945050505050565b8051613e34816140b6565b8051613e34816140e5565b5f60208284031215614a1e575f80fd5b81516001600160401b0380821115614a34575f80fd5b9083019060808286031215614a47575f80fd5b614a4f613f2e565b8251614a5a816140b6565b81526020830151614a6a816140e5565b602082015260408381015190820152606083015182811115614a8a575f80fd5b614a9687828601614636565b60608301525095945050505050565b634e487b7160e01b5f52601160045260245ffd5b5f60018201614aca57614aca614aa5565b5060010190565b5f60208284031215614ae1575f80fd5b81516001600160401b0380821115614af7575f80fd5b9083019060e08286031215614b0a575f80fd5b614b12613f50565b614b1b836149f8565b8152614b29602084016149f8565b602082015260408301516040820152614b4460608401614a03565b60608201526080830151608082015260a083015182811115614b64575f80fd5b614b7087828601614636565b60a08301525060c083015182811115614b87575f80fd5b614b9387828601614636565b60c08301525095945050505050565b5f60a08284031215614bb2575f80fd5b60405160a081016001600160401b038282108183111715614bd557614bd5613ef2565b8160405282935084519150614be9826140b6565b8183526020850151602084015260408501516040840152606085015160608401526080850151915080821115614c1d575f80fd5b50614c2a85828601614636565b6080830152505092915050565b5f60208284031215614c47575f80fd5b81516001600160401b03811115614c5c575f80fd5b6136d484828501614ba2565b5f60208284031215614c78575f80fd5b81516001600160401b0380821115614c8e575f80fd5b9083019060408286031215614ca1575f80fd5b614ca9613f06565b825181526020830151828111156149dd575f80fd5b5f60208284031215614cce575f80fd5b8151610df581613ede565b5f60208284031215614ce9575f80fd5b81516001600160401b0380821115614cff575f80fd5b9083019060608286031215614d12575f80fd5b614d1a613f72565b8251815260208301516020820152604083015182811115614d39575f80fd5b614d4587828601614636565b60408301525095945050505050565b5f60208284031215614d64575f80fd5b8151610df5816140e5565b5f60c08284031215614d7f575f80fd5b610df583836148d1565b5f60208284031215614d99575f80fd5b8151610df581613e15565b8082028115828204841417610bec57610bec614aa5565b6001600160a01b0388168152608060208083018290529082018790525f90889060a08401835b8a811015614e0d578335614df4816146d6565b614dfe83826144d4565b94840194925050600101614de1565b5084810360408601528781528181019250600588901b81018201895f5b8a811015614e6457838303601f19018652614e45828d6143f7565b614e50858284614438565b978701979450505090840190600101614e2a565b50508581036060870152614e7981888a614591565b9d9c50505050505050505050505050565b5f6020808385031215614e9b575f80fd5b82516001600160401b03811115614eb0575f80fd5b8301601f81018513614ec0575f80fd5b8051614ece61403e826146b4565b81815260059190911b82018301908381019087831115614eec575f80fd5b928401925b82841015614f0a57835182529284019290840190614ef1565b979650505050505050565b5f8235607e198336030181126143ed575f80fd5b602081525f8235614f39816140b6565b6001600160c01b0381166020840152506020830135614f57816140e5565b8060020b60408401525060408301356060830152614f7860608401846143f7565b6080808501526144b960a085018284614438565b5f8235603e198336030181126143ed575f80fd5b60208152813560208201525f614fb960208401846143f7565b6040808501526144b9606085018284614438565b5f8235605e198336030181126143ed575f80fd5b6020815281356020820152602082013560408201525f61500460408401846143f7565b6060808501526144b9608085018284614438565b5f823560de198336030181126143ed575f80fd5b8035613e34816148c1565b8035613e3481613ede565b602081525f823561505281613ede565b6001600160a01b0380821660208501526020850135915061507282613e15565b6001600160401b03821660408501526040850135915061509182613ede565b166060838101919091528301356150a7816148c1565b62ffffff81166080840152506150bf60808401615037565b6001600160a01b03811660a0840152506150db60a0840161502c565b62ffffff811660c0840152506150f460c08401846143f7565b60e0808501526144b961010085018284614438565b5f6001600160a01b03808716835260206080602085015261512d60808501886144fa565b848103604086015261513f8188614539565b8581036060870152865180825260208089019350909101905f5b81811015615177578351861683529284019291840191600101615159565b50909a9950505050505050505050565b5f60608284031215615197575f80fd5b61519f613f72565b82516151aa81613ede565b815260208301516151ba81613e15565b602082015260408301516151cd81613e15565b60408201529392505050565b5f7f8000000000000000000000000000000000000000000000000000000000000000820361520957615209614aa5565b505f0390565b80820180821115610bec57610bec614aa5565b81810381811115610bec57610bec614aa5565b602081525f8235615245816140b6565b6001600160c01b0381166020840152506020830135615263816140b6565b6001600160c01b03811660408401525060408301356060830152615289606084016140f3565b615298608084018260020b9052565b50608083013560a08301526152b060a08401846143f7565b60e060c08501526152c661010085018284614438565b9150506152d660c08501856143f7565b848303601f190160e0860152613796838284614438565b5f608082840312156152fd575f80fd5b615305613f2e565b905081358152602082013560ff8116811461531e575f80fd5b80602083015250604082013560408201526060820135606082015292915050565b5f60c0828403121561534f575f80fd5b615357613f72565b823561536281613ede565b8152602083810135908201526151cd84604085016152ed565b6153dd81846001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b60e060c08201525f6136d460e0830184614076565b634e487b7160e01b5f52601260045260245ffd5b5f8261542057634e487b7160e01b5f52601260045260245ffd5b500490565b5f61014061548c8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e08401526001600160a01b03606086015116610100840152806101208401526144b981840185614076565b5f80604083850312156154e4575f80fd5b505080516020909101519092909150565b5f60208284031215615505575f80fd5b81518015158114610df5575f80fd5b5f61012061557b8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e0840152806101008401526144b981840185614076565b828152604060208201525f6136d46040830184614076565b5f602082840312156155d6575f80fd5b5051919050565b825181526001600160401b036020840151166020820152606060408201525f6136d46060830184614076565b5f8160020b627fffff19810361562157615621614aa5565b5f0392915050565b5f60808284031215615639575f80fd5b610df583836152ed565b5f82518060208501845e5f92019182525091905056fea264697066735822122012b1777feff8c8fc10207ef102423cb7b36dc774363bc90fa2e98b0f3cbab6a764736f6c63430008190033" + "bytecode": "0x60a0604052348015600e575f80fd5b5060405161582e38038061582e833981016040819052602b91603b565b6001600160a01b03166080526066565b5f60208284031215604a575f80fd5b81516001600160a01b0381168114605f575f80fd5b9392505050565b60805161569f61018f5f395f818161017a015281816104e601528181610585015281816107690152818161094701528181610a8e01528181610c1e01528181610caf01528181610d7901528181610ed401528181611147015281816113ac01528181611769015281816119b101528181611a7401528181611ed001528181611f5801528181612038015281816121eb0152818161228e0152818161232901528181612436015281816125840152818161261d015281816126bf015281816127dc01528181612931015281816129ab01528181612a4f01528181612b4a01528181612bc201528181612c1a01528181612cab01528181612d6501528181612e0f01528181612e8a01528181612f0401528181612f950152818161300a01526135ed015261569f5ff3fe6080604052600436106100e7575f3560e01c80637658ab0511610087578063a183a10411610057578063a183a10414610295578063c0e8e89a146102b4578063d09ef241146102c7578063fe81574614610310575f80fd5b80637658ab05146102245780637d773110146102445780638feb85b714610257578063a04c796b14610276575f80fd5b80633f322bc9116100c25780633f322bc91461016957806341a8bb88146101b4578063483f9f2f146101d35780635083585814610205575f80fd5b806309ae2c13146100f257806315c7afb4146101075780631ae45a121461013c575f80fd5b366100ee57005b5f80fd5b610105610100366004613e49565b610323565b005b348015610112575f80fd5b50610126610121366004613ffa565b610570565b60405161013391906140b4565b60405180910390f35b348015610147575f80fd5b5061015b6101563660046140da565b610bf2565b604051908152602001610133565b348015610174575f80fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610133565b3480156101bf575f80fd5b5061015b6101ce36600461410e565b610c8f565b3480156101de575f80fd5b506101f26101ed366004614145565b610dfc565b60405160029190910b8152602001610133565b348015610210575f80fd5b5061015b61021f36600461415c565b610e06565b6102376102323660046141b7565b610e13565b60405161013391906142ab565b610237610252366004613e49565b610f80565b348015610262575f80fd5b506101056102713660046142ee565b6111eb565b348015610281575f80fd5b506101056102903660046142ee565b611434565b3480156102a0575f80fd5b506101056102af36600461436f565b6115b3565b6101056102c2366004613e49565b6117ee565b3480156102d2575f80fd5b506102e66102e1366004614145565b61196f565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610133565b61023761031e366004613e49565b611b90565b80806001600160401b031642111561034e5760405163637910d560e11b815260040160405180910390fd5b838361035a8282611d13565b885f816001600160401b0381111561037457610374613f02565b60405190808252806020026020018201604052801561039d578160200160208202803683370190505b5090505f826001600160401b038111156103b9576103b9613f02565b6040519080825280602002602001820160405280156103ec57816020015b60608152602001906001900390816103d75790505b5090505f5b838110156104a457600383828151811061040d5761040d6143c1565b60200260200101906006811115610426576104266143d5565b90816006811115610439576104396143d5565b9052508d8d8281811061044e5761044e6143c1565b905060200281019061046091906143e9565b60405160200161047091906144d2565b604051602081830303815290604052828281518110610491576104916143c1565b60209081029190910101526001016103f1565b505f3383838e8e6040516020016104bf9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061051d9030908590600401614625565b5f604051808303815f875af1158015610538573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261055f9190810190614693565b505050505050505050505050505050565b606061057a611e1a565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415806105bb57506001600160a01b0383163014155b156105f2576040517fc0185c6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f805f808580602001905181019061060a91906147dc565b8251939750919550935091505f816001600160401b0381111561062f5761062f613f02565b604051908082528060200260200182016040528015610658578160200160208202803683370190505b5090505f805b83811015610bad575f878281518110610679576106796143c1565b602002602001015190505f6006811115610695576106956143d5565b8160068111156106a7576106a76143d5565b036106e6576106e18783815181106106c1576106c16143c1565b60200260200101518060200190518101906106dc919061498f565b611e99565b610ba4565b60018160068111156106fa576106fa6143d5565b036107f2575f610735888481518110610715576107156143c1565b60200260200101518060200190518101906107309190614a1e565b611f33565b905080156107ec576040516323b872dd60e01b81523060048201526001600160a01b038b81166024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064015f604051808303815f87803b1580156107aa575f80fd5b505af11580156107bc573d5f803e3d5ffd5b50505050808585806107cd90614ac9565b9650815181106107df576107df6143c1565b6020026020010181815250505b50610ba4565b6002816006811115610806576108066143d5565b03610841575f610735888481518110610821576108216143c1565b602002602001015180602001905181019061083c9190614ae1565b61210c565b6003816006811115610855576108556143d5565b036108965761088f87838151811061086f5761086f6143c1565b602002602001015180602001905181019061088a9190614c47565b6121c4565b5050610ba4565b60048160068111156108aa576108aa6143d5565b036108e45761088f8783815181106108c4576108c46143c1565b60200260200101518060200190518101906108df9190614c47565b612553565b60058160068111156108f8576108f86143d5565b03610a2b575f878381518110610910576109106143c1565b602002602001015180602001905181019061092b9190614c78565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa15801561099c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109c09190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610a0c575f80fd5b505afa158015610a1e573d5f803e3d5ffd5b5050505061088f826128fa565b6006816006811115610a3f57610a3f6143d5565b03610b72575f878381518110610a5757610a576143c1565b6020026020010151806020019051810190610a729190614ce9565b80516040516331a9108f60e11b815260048101829052919250907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f584a6d908290636352211e90602401602060405180830381865afa158015610ae3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b079190614cce565b6040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908e166024820152604481018490526064015f6040518083038186803b158015610b53575f80fd5b505afa158015610b65573d5f803e3d5ffd5b5050505061088f826129a8565b6040517f4a7f394f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060010161065e565b50610bb88785612b22565b80825281604051602001610bcc91906142ab565b604051602081830303815290604052975050505050505050610bec613213565b92915050565b60405163cdc92f2d60e01b81526001600160c01b03821660048201525f90610bec906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cdc92f2d90602401602060405180830381865afa158015610c63573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c879190614d64565b60020b613238565b604051639b22917d60e01b81526001600160c01b03831660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015610cfc573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d209190614d7f565b602001516040517f41a8bb880000000000000000000000000000000000000000000000000000000081526001600160c01b0385166004820152600284900b60248201526001600160401b03909116906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341a8bb8890604401602060405180830381865afa158015610dbe573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610de29190614d99565b6001600160401b0316610df59190614db4565b9392505050565b5f610bec826134f6565b5f610bec8260020b613238565b606081806001600160401b0316421115610e405760405163637910d560e11b815260040160405180910390fd5b8b8a14610e79576040517f947d5a8400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e838787611d13565b610e8d85856135ab565b5f338e8e8e8e8e8e604051602001610eab9796959493929190614dcb565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca1799890610f0b9030908690600401614625565b5f604051808303815f875af1158015610f26573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610f4d9190810190614693565b905080515f14610f6e5780806020019051810190610f6b9190614e9a565b93505b5050509b9a5050505050505050505050565b606081806001600160401b0316421115610fad5760405163637910d560e11b815260040160405180910390fd5b8484610fb98282611d13565b895f816001600160401b03811115610fd357610fd3613f02565b604051908082528060200260200182016040528015610ffc578160200160208202803683370190505b5090505f826001600160401b0381111561101857611018613f02565b60405190808252806020026020018201604052801561104b57816020015b60608152602001906001900390816110365790505b5090505f5b8381101561110357600183828151811061106c5761106c6143c1565b60200260200101906006811115611085576110856143d5565b90816006811115611098576110986143d5565b9052508e8e828181106110ad576110ad6143c1565b90506020028101906110bf9190614f25565b6040516020016110cf9190614f39565b6040516020818303038152906040528282815181106110f0576110f06143c1565b6020908102919091010152600101611050565b505f3383838f8f60405160200161111e9594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca179989061117e9030908690600401614625565b5f604051808303815f875af1158015611199573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526111c09190810190614693565b9050808060200190518101906111d69190614e9a565b98505050505050505050979650505050505050565b80806001600160401b03164211156112165760405163637910d560e11b815260040160405180910390fd5b61122084846135ab565b865f816001600160401b0381111561123a5761123a613f02565b604051908082528060200260200182016040528015611263578160200160208202803683370190505b5090505f826001600160401b0381111561127f5761127f613f02565b6040519080825280602002602001820160405280156112b257816020015b606081526020019060019003908161129d5790505b5090505f5b8381101561136a5760058382815181106112d3576112d36143c1565b602002602001019060068111156112ec576112ec6143d5565b908160068111156112ff576112ff6143d5565b9052508b8b82818110611314576113146143c1565b90506020028101906113269190614f9c565b6040516020016113369190614fb0565b604051602081830303815290604052828281518110611357576113576143c1565b60209081029190910101526001016112b7565b505f3383838c8c6040516020016113859594939291906145dd565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906113e39030908590600401614625565b5f604051808303815f875af11580156113fe573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526114259190810190614693565b50505050505050505050505050565b80806001600160401b031642111561145f5760405163637910d560e11b815260040160405180910390fd5b61146984846135ab565b865f816001600160401b0381111561148357611483613f02565b6040519080825280602002602001820160405280156114ac578160200160208202803683370190505b5090505f826001600160401b038111156114c8576114c8613f02565b6040519080825280602002602001820160405280156114fb57816020015b60608152602001906001900390816114e65790505b5090505f5b8381101561136a57600683828151811061151c5761151c6143c1565b60200260200101906006811115611535576115356143d5565b90816006811115611548576115486143d5565b9052508b8b8281811061155d5761155d6143c1565b905060200281019061156f9190614fdd565b60405160200161157f9190614ff1565b6040516020818303038152906040528282815181106115a0576115a06143c1565b6020908102919091010152600101611500565b80806001600160401b03164211156115de5760405163637910d560e11b815260040160405180910390fd5b825f816001600160401b038111156115f8576115f8613f02565b604051908082528060200260200182016040528015611621578160200160208202803683370190505b5090505f826001600160401b0381111561163d5761163d613f02565b60405190808252806020026020018201604052801561167057816020015b606081526020019060019003908161165b5790505b5090505f5b83811015611727575f838281518110611690576116906143c1565b602002602001019060068111156116a9576116a96143d5565b908160068111156116bc576116bc6143d5565b9052508787828181106116d1576116d16143c1565b90506020028101906116e39190615028565b6040516020016116f39190615052565b604051602081830303815290604052828281518110611714576117146143c1565b6020908102919091010152600101611675565b5060605f338484846040516020016117429493929190615119565b60408051601f19818403018152908290526313942f3360e31b825291506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639ca17998906117a09030908590600401614625565b5f604051808303815f875af11580156117bb573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526117e29190810190614693565b50505050505050505050565b80806001600160401b03164211156118195760405163637910d560e11b815260040160405180910390fd5b83836118258282611d13565b885f816001600160401b0381111561183f5761183f613f02565b604051908082528060200260200182016040528015611868578160200160208202803683370190505b5090505f826001600160401b0381111561188457611884613f02565b6040519080825280602002602001820160405280156118b757816020015b60608152602001906001900390816118a25790505b5090505f5b838110156104a45760048382815181106118d8576118d86143c1565b602002602001019060068111156118f1576118f16143d5565b90816006811115611904576119046143d5565b9052508d8d82818110611919576119196143c1565b905060200281019061192b91906143e9565b60405160200161193b91906144d2565b60405160208183030381529060405282828151811061195c5761195c6143c1565b60209081029190910101526001016118bc565b5f8080808080604087901c62ffffff602889901c16604051639b22917d60e01b81526001600160c01b038316600482015291935091505f906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156119f6573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a1a9190614d7f565b60208101519091506001600160401b0316611a38600284900b613238565b6040517fd09ef241000000000000000000000000000000000000000000000000000000008152600481018b90529097505f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d09ef24190602401606060405180830381865afa158015611ab9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611add9190615197565b80516020820151909a50909150611afd906001600160401b031683614db4565b6060840151604083015191985090611b2e90611b22906001600160401b031685614db4565b600287900b905f6136c2565b9650611b3f8162ffffff1660171c90565b611b83575f611b5462ffffff831689836136ec565b90505f8113611b7557611b66816151e9565b611b70908961521f565b611b7f565b611b7f8189615232565b9750505b5050505050509193509193565b606081806001600160401b0316421115611bbd5760405163637910d560e11b815260040160405180910390fd5b8484611bc98282611d13565b895f816001600160401b03811115611be357611be3613f02565b604051908082528060200260200182016040528015611c0c578160200160208202803683370190505b5090505f826001600160401b03811115611c2857611c28613f02565b604051908082528060200260200182016040528015611c5b57816020015b6060815260200190600190039081611c465790505b5090505f5b83811015611103576002838281518110611c7c57611c7c6143c1565b60200260200101906006811115611c9557611c956143d5565b90816006811115611ca857611ca86143d5565b9052508e8e82818110611cbd57611cbd6143c1565b9050602002810190611ccf9190615028565b604051602001611cdf9190615245565b604051602081830303815290604052828281518110611d0057611d006143c1565b6020908102919091010152600101611c60565b5f5b81811015611e15575f838383818110611d3057611d306143c1565b905060c00201803603810190611d46919061534f565b60408101515190915015611e0c5780516020808301516040808501518051938101518183015160609092015192517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810194909452606484019490945260ff909316608483015260a482019290925260c48101919091526001600160a01b039091169063d505accf9060e4015f604051808303815f87803b158015611df9575f80fd5b505af1925050508015611e0a575060015b505b50600101611d15565b505050565b7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45c15611e73576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60017f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b805160208201516040517ffefc7c510000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263fefc7c5192611f039260040161538b565b5f604051808303815f87803b158015611f1a575f80fd5b505af1158015611f2c573d5f803e3d5ffd5b5050505050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f9081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015611fa5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fc99190614d7f565b90505f83604001519050611fe6826060015162ffffff1660171c90565b156120035760608201516120009062ffffff16825f61376c565b90505b5f61202583602001516001600160401b0316836120209190615416565b6137b0565b90506001600160401b03811615612104577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631dbef4886040518060800160405280868152602001886020015160020b8152602001846001600160401b031681526020015f6001600160a01b031681525087606001516040518363ffffffff1660e01b81526004016120c1929190615435565b60408051808303815f875af11580156120dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061210091906154e3565b5093505b505050919050565b5f805f6121566040518060a00160405280865f01516001600160c01b0316815260200186604001518152602001866080015181526020015f81526020018660a00151815250612553565b91509150808460800181815161216c9190615232565b90525081156121bd576121ba604051806080016040528086602001516001600160c01b03168152602001866060015160020b8152602001866080015181526020018660c00151815250611f33565b92505b5050919050565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f90819081907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639b22917d9060240160c060405180830381865afa158015612238573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061225c9190614d7f565b90505b8284604001511180156123015750835160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa1580156122db573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122ff9190615505565b155b1561252857835160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa158015612376573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239a9190614d64565b90506123a88160020b613238565b856020015111156123b95750612528565b5f6123cd8360a0015162ffffff1660171c90565b156123fe576123f78587604001510360018560a0015162ffffff1661376c9092919063ffffffff16565b9050612408565b8486604001510390505b60208301516001600160401b03168082049082061515600116019050805f03612432575050612528565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b8152602001612486876137b0565b6001600160401b03168152508a608001516040518363ffffffff1660e01b81526004016124b4929190615524565b60408051808303815f875af11580156124cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124f391906154e3565b91509150815f036125075750505050612528565b612511828861521f565b965061251d818761521f565b95505050505061225f565b818460600151101561254d57604051630f271b5560e41b815260040160405180910390fd5b50915091565b8051604051639b22917d60e01b81526001600160c01b0390911660048201525f908190819081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639b22917d9060240160c060405180830381865afa1580156125c9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125ed9190614d7f565b90505b84604001518310156128ce57845160405163fcc8fc9b60e01b81526001600160c01b0390911660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063fcc8fc9b90602401602060405180830381865afa15801561266a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061268e9190615505565b1561269c57600193506128ce565b845160405163cdc92f2d60e01b81526001600160c01b0390911660048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cdc92f2d90602401602060405180830381865afa15801561270c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127309190614d64565b905061273e8160020b613238565b866020015111156127535760019450506128ce565b5f6127678360a0015162ffffff1660171c90565b1561277a578487604001510390506127a1565b61279e858860400151035f8560a0015162ffffff1661376c9092919063ffffffff16565b90505b60208301516001600160401b03166127be600284900b835f613807565b6127c89190615416565b9050805f036127d85750506128ce565b5f807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633b9500b060405180606001604052808881526020018760020b815260200161282c876137b0565b6001600160401b03168152508b608001516040518363ffffffff1660e01b815260040161285a929190615524565b60408051808303815f875af1158015612875573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061289991906154e3565b91509150805f036128ad57505050506128ce565b6128b7828761521f565b95506128c3818861521f565b9650505050506125f0565b81856060015111156128f357604051630f271b5560e41b815260040160405180910390fd5b5050915091565b805160208201516040517f38926b6d0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016926338926b6d92612964926004016155be565b6020604051808303815f875af1158015612980573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906129a491906155d6565b5050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639b22917d6129e5845f015160401c90565b6040516001600160e01b031960e084901b1681526001600160c01b03909116600482015260240160c060405180830381865afa158015612a27573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a4b9190614d7f565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166314d6a9eb6040518060400160405280855f01518152602001612ab085602001516001600160401b031687602001516120209190615416565b6001600160401b031681525084604001516040518363ffffffff1660e01b8152600401612ade9291906155ed565b6020604051808303815f875af1925050508015612b18575060408051601f3d908101601f19168201909252612b15918101906155d6565b60015b156129a457505050565b60405163258473db60e21b81523060048201525f602482018190529081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612b8f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612bb391906155d6565b90505f811215612c8657612bfb7f0000000000000000000000000000000000000000000000000000000000000000612bea836151e9565b6001600160a01b0385169190613849565b604051636a256b2960e01b81526001600160a01b0383811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612c60573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c8491906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0383811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612cf0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d1491906155d6565b90505f811315612dbd576040517fd9caed120000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528581166024830152604482018390527f0000000000000000000000000000000000000000000000000000000000000000169063d9caed12906064015f604051808303815f87803b158015612da6575f80fd5b505af1158015612db8573d5f803e3d5ffd5b505050505b82515f5b818110156131f8575f858281518110612ddc57612ddc6143c1565b602090810291909101015160405163258473db60e21b81523060048201526001600160a01b0380831660248301529192507f000000000000000000000000000000000000000000000000000000000000000090911690639611cf6c90604401602060405180830381865afa158015612e56573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612e7a91906155d6565b93505f841215612f7057612ee5877f0000000000000000000000000000000000000000000000000000000000000000612eb2876151e9565b898681518110612ec457612ec46143c1565b60200260200101516001600160a01b0316613918909392919063ffffffff16565b604051636a256b2960e01b81526001600160a01b0382811660048301527f00000000000000000000000000000000000000000000000000000000000000001690636a256b29906024016020604051808303815f875af1158015612f4a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f6e91906155d6565b505b60405163258473db60e21b81523060048201526001600160a01b0382811660248301527f00000000000000000000000000000000000000000000000000000000000000001690639611cf6c90604401602060405180830381865afa158015612fda573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ffe91906155d6565b93505f8413156130b8577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d9caed12878481518110613049576130496143c1565b60209081029190910101516040516001600160e01b031960e084901b1681526001600160a01b039182166004820152908a166024820152604481018790526064015f604051808303815f87803b1580156130a1575f80fd5b505af11580156130b3573d5f803e3d5ffd5b505050505b5f8683815181106130cb576130cb6143c1565b60209081029190910101516040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613132573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061315691906155d6565b905080156131ee57868381518110613170576131706143c1565b602090810291909101015160405163a9059cbb60e01b81526001600160a01b038a81166004830152602482018490529091169063a9059cbb906044016020604051808303815f875af11580156131c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906131ec9190615505565b505b5050600101612dc1565b504715611f2c57611f2c6001600160a01b0384168647613849565b5f7f8e94fed44239eb2314ab7a406345e6c5a8f0ccedf3b600de3d004e672c33abf45d565b5f61324282613987565b815f600282900b8113613255578161325e565b61325e82615619565b62ffffff8116915060011615613282576bfff97272373d413259a469909250613293565b6c0100000000000000000000000092505b60028116156132b25760606bfff2e50f5f656932ef12357c8402901c92505b60048116156132d15760606bffe5caca7e10e4e61c3624ea8402901c92505b60088116156132f05760606bffcb9843d60f6159c9db58838402901c92505b601081161561330f5760606bff973b41fa98c081472e68968402901c92505b602081161561332e5760606bff2ea16466c96a3843ec78b38402901c92505b604081161561334d5760606bfe5dee046a99a2a811c461f18402901c92505b608081161561336c5760606bfcbe86c7900a88aedcffc83b8402901c92505b61010081161561338c5760606bf987a7253ac413176f2b074c8402901c92505b6102008116156133ac5760606bf3392b0822b70005940c7a398402901c92505b6104008116156133cc5760606be7159475a2c29b7443b29c7f8402901c92505b6108008116156133ec5760606bd097f3bdfd2022b8845ad8f78402901c92505b61100081161561340c5760606ba9f746462d870fdf8a65dc1f8402901c92505b61200081161561342c5760606b70d869a156d2a1b890bb3df68402901c92505b61400081161561344c5760606b31be135f97d08fd9812315058402901c92505b61800081161561346c5760606b09aa508b5b7a84e1c677de548402901c92505b6201000081161561348c5760606a5d6af8dedb81196699c3298402901c92505b620200008116156134ab576060692216e584f5fa1ea926048402901c92505b620400008116156134c857606067048a170391f7dc428402901c92505b5f8260020b13156121bd576121ba837801000000000000000000000000000000000000000000000000615416565b5f81750c6c1313451aab317fb9b67e11777e9a5a6ccdb2ebae81118061351e575062149bbb81105b15613554576040517ebfc92100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f700100000000000000000000000000000000613570856139e6565b6527107fff7434028161358557613585615402565b0590508361359282613238565b11156135a2575f190191506135a5565b91505b50919050565b5f5b81811015611e15575f8383838181106135c8576135c86143c1565b905060a002016020018036038101906135e19190615639565b8051909150156136b9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637ac2ff7b3086868681811061362d5761362d6143c1565b865160208801516040808a015160608b015191516001600160e01b031960e08b901b1681526001600160a01b03909816600489015260a090940295909501356024870152604486019190915260ff16606485015260848401525060a482015260c4015f604051808303815f87803b1580156136a6575f80fd5b505af19250505080156136b7575060015b505b506001016135ad565b5f6136e4606084901b6136d78660020b613238565b8082061515851691040190565b949350505050565b5f6207a11f19627fffff851601600281900b8212828161370e57825f03613710565b825b62ffffff1690505f6137496137258389614db4565b620f42408861373b578581830615151691040190565b808206151586151691040190565b90508261375e57613759816151e9565b613760565b805b98975050505050505050565b5f6207a11f19627fffff85160181831561378657815f0391505b81620f42400190506137a6620f4240866137a09190614db4565b82900490565b9695505050505050565b5f6001600160401b0382111561380357604080517f6dfcc6500000000000000000000000000000000000000000000000000000000081526004810191909152602481018390526044015b60405180910390fd5b5090565b5f6136e46138178560020b613238565b6138219085614db4565b6bffffffffffffffffffffffff8116151584166c010000000000000000000000009091040190565b5f6001600160a01b03841661389e575f805f8085875af1905080613899576040517ff4b3b1bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613912565b60405163a9059cbb60e01b81526001600160a01b038416600482015282602482015260205f6044835f895af13d15601f3d1160015f511416171691505080613912576040517ff27f64e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166323b872dd60e01b179052613912908590613bff565b6207ffff600282900b13806139ac57506139a36207ffff615619565b60020b8160020b125b156139e3576040517fce8ef7fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b6fffffffffffffffffffffffffffffffff811160071b81811c6001600160401b031060061b1781811c63ffffffff1060051b1781811c61ffff1060041b1781811c60ff1060031b175f8213613a4257631615e6385f526004601cfd5b7103782dace9d90000000000000000000000007ff8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff6f8421084210842108cc6318c6db6d54be84841c1c601f161a90911891821b609f90811c6c465772b2bbbb5f824b15207a3081018102606090811d6d0388eaa27412d5aca026815d636e018202811d6d0df99ac502031bf953eff472fdcc018202811d6d13cdffb29d51d99322bdff5f2211018202811d6d0a0f742023def783a307a986912e018202811d6d01920d8043ca89b5239253284e42018202811d6c0b7a86d7375468fac667a0a527016c29508e458543d8aa4df2abee7883018302821d6d0139601a2efabe717e604cbb4894018302821d6d02247f7a7b6594320649aa03aba1018302821d6c8c3f38e95a6b1ff2ab1c3b343619018302821d6d02384773bdf1ac5676facced60901901830290911d6cb9a025d814b29c212b8b1a07cd19019091027ffffffffffffffff5f6af8f7b3396644f18e157960000000000000000000000000105711340daa0d5f769dba1915cef59f0815a5506029290037d0267a36c0c95b3975ab3ee5b203a7614a3f75373f047d803ae7b6687f2b302919091010590565b5f613c136001600160a01b03841683613c79565b905080515f14158015613c37575080806020019051810190613c359190615505565b155b15611e15576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03841660048201526024016137fa565b6060610df583835f845f80856001600160a01b03168486604051613c9d9190615653565b5f6040518083038185875af1925050503d805f8114613cd7576040519150601f19603f3d011682016040523d82523d5f602084013e613cdc565b606091505b50915091506137a6868383606082613cfc57613cf782613d5c565b610df5565b8151158015613d1357506001600160a01b0384163b155b15613d55576040517f9996b3150000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016137fa565b5080610df5565b805115613d6c5780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8083601f840112613dae575f80fd5b5081356001600160401b03811115613dc4575f80fd5b6020830191508360208260051b8501011115613dde575f80fd5b9250929050565b5f8083601f840112613df5575f80fd5b5081356001600160401b03811115613e0b575f80fd5b60208301915083602060c083028501011115613dde575f80fd5b6001600160401b03811681146139e3575f80fd5b8035613e4481613e25565b919050565b5f805f805f805f6080888a031215613e5f575f80fd5b87356001600160401b0380821115613e75575f80fd5b613e818b838c01613d9e565b909950975060208a0135915080821115613e99575f80fd5b613ea58b838c01613d9e565b909750955060408a0135915080821115613ebd575f80fd5b50613eca8a828b01613de5565b9094509250506060880135613ede81613e25565b8091505092959891949750929550565b6001600160a01b03811681146139e3575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b0381118282101715613f3857613f38613f02565b60405290565b604051608081016001600160401b0381118282101715613f3857613f38613f02565b60405160e081016001600160401b0381118282101715613f3857613f38613f02565b604051606081016001600160401b0381118282101715613f3857613f38613f02565b604051601f8201601f191681016001600160401b0381118282101715613fcc57613fcc613f02565b604052919050565b5f6001600160401b03821115613fec57613fec613f02565b50601f01601f191660200190565b5f806040838503121561400b575f80fd5b823561401681613eee565b915060208301356001600160401b03811115614030575f80fd5b8301601f81018513614040575f80fd5b803561405361404e82613fd4565b613fa4565b818152866020838501011115614067575f80fd5b816020840160208301375f602083830101528093505050509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610df56020830184614086565b6001600160c01b03811681146139e3575f80fd5b5f602082840312156140ea575f80fd5b8135610df5816140c6565b8060020b81146139e3575f80fd5b8035613e44816140f5565b5f806040838503121561411f575f80fd5b823561412a816140c6565b9150602083013561413a816140f5565b809150509250929050565b5f60208284031215614155575f80fd5b5035919050565b5f6020828403121561416c575f80fd5b8135610df5816140f5565b5f8083601f840112614187575f80fd5b5081356001600160401b0381111561419d575f80fd5b60208301915083602060a083028501011115613dde575f80fd5b5f805f805f805f805f805f60c08c8e0312156141d1575f80fd5b6001600160401b03808d3511156141e6575f80fd5b6141f38e8e358f01613d9e565b909c509a5060208d0135811015614208575f80fd5b6142188e60208f01358f01613d9e565b909a50985060408d013581101561422d575f80fd5b61423d8e60408f01358f01613d9e565b909850965060608d0135811015614252575f80fd5b6142628e60608f01358f01613de5565b909650945060808d0135811015614277575f80fd5b506142888d60808e01358e01614177565b909350915061429960a08d01613e39565b90509295989b509295989b9093969950565b602080825282518282018190525f9190848201906040850190845b818110156142e2578351835292840192918401916001016142c6565b50909695505050505050565b5f805f805f805f6080888a031215614304575f80fd5b87356001600160401b038082111561431a575f80fd5b6143268b838c01613d9e565b909950975060208a013591508082111561433e575f80fd5b61434a8b838c01613d9e565b909750955060408a0135915080821115614362575f80fd5b50613eca8a828b01614177565b5f805f60408486031215614381575f80fd5b83356001600160401b03811115614396575f80fd5b6143a286828701613d9e565b90945092505060208401356143b681613e25565b809150509250925092565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b5f8235609e198336030181126143fd575f80fd5b9190910192915050565b5f808335601e1984360301811261441c575f80fd5b83016020810192503590506001600160401b0381111561443a575f80fd5b803603821315613dde575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f813561447c816140c6565b6001600160c01b0381168452506020820135602084015260408201356040840152606082013560608401526144b46080830183614407565b60a060808601526144c960a086018284614448565b95945050505050565b602081525f610df56020830184614470565b5f6007821061450157634e487b7160e01b5f52602160045260245ffd5b50815260200190565b5f815180845260208085019450602084015f5b8381101561453e576145308783516144e4565b96509082019060010161451d565b509495945050505050565b5f8282518085526020808601955060208260051b840101602086015f5b8481101561459457601f19868403018952614582838351614086565b98840198925090830190600101614566565b5090979650505050505050565b8183525f60208085019450825f5b8581101561453e5781356145c281613eee565b6001600160a01b0316875295820195908201906001016145af565b6001600160a01b0386168152608060208201525f6145fe608083018761450a565b82810360408401526146108187614549565b905082810360608401526137608185876145a1565b6001600160a01b0383168152604060208201525f6136e46040830184614086565b5f82601f830112614655575f80fd5b815161466361404e82613fd4565b818152846020838601011115614677575f80fd5b8160208501602083015e5f918101602001919091529392505050565b5f602082840312156146a3575f80fd5b81516001600160401b038111156146b8575f80fd5b6136e484828501614646565b5f6001600160401b038211156146dc576146dc613f02565b5060051b60200190565b600781106139e3575f80fd5b5f82601f830112614701575f80fd5b8151602061471161404e836146c4565b82815260059290921b8401810191818101908684111561472f575f80fd5b8286015b8481101561476c5780516001600160401b03811115614750575f80fd5b61475e8986838b0101614646565b845250918301918301614733565b509695505050505050565b5f82601f830112614786575f80fd5b8151602061479661404e836146c4565b8083825260208201915060208460051b8701019350868411156147b7575f80fd5b602086015b8481101561476c5780516147cf81613eee565b83529183019183016147bc565b5f805f80608085870312156147ef575f80fd5b84516147fa81613eee565b809450506020808601516001600160401b0380821115614818575f80fd5b818801915088601f83011261482b575f80fd5b815161483961404e826146c4565b81815260059190911b8301840190848101908b831115614857575f80fd5b938501935b8285101561487e57845161486f816146e6565b8252938501939085019061485c565b60408b01519098509450505080831115614896575f80fd5b6148a289848a016146f2565b945060608801519250808311156148b7575f80fd5b50506148c587828801614777565b91505092959194509250565b62ffffff811681146139e3575f80fd5b5f60c082840312156148f1575f80fd5b60405160c081018181106001600160401b038211171561491357614913613f02565b8060405250809150825161492681613eee565b8152602083015161493681613e25565b6020820152604083015161494981613eee565b6040820152606083015161495c816148d1565b6060820152608083015161496f81613eee565b608082015260a0830151614982816148d1565b60a0919091015292915050565b5f6020828403121561499f575f80fd5b81516001600160401b03808211156149b5575f80fd5b9083019060e082860312156149c8575f80fd5b6149d0613f16565b6149da86846148e1565b815260c0830151828111156149ed575f80fd5b6149f987828601614646565b60208301525095945050505050565b8051613e44816140c6565b8051613e44816140f5565b5f60208284031215614a2e575f80fd5b81516001600160401b0380821115614a44575f80fd5b9083019060808286031215614a57575f80fd5b614a5f613f3e565b8251614a6a816140c6565b81526020830151614a7a816140f5565b602082015260408381015190820152606083015182811115614a9a575f80fd5b614aa687828601614646565b60608301525095945050505050565b634e487b7160e01b5f52601160045260245ffd5b5f60018201614ada57614ada614ab5565b5060010190565b5f60208284031215614af1575f80fd5b81516001600160401b0380821115614b07575f80fd5b9083019060e08286031215614b1a575f80fd5b614b22613f60565b614b2b83614a08565b8152614b3960208401614a08565b602082015260408301516040820152614b5460608401614a13565b60608201526080830151608082015260a083015182811115614b74575f80fd5b614b8087828601614646565b60a08301525060c083015182811115614b97575f80fd5b614ba387828601614646565b60c08301525095945050505050565b5f60a08284031215614bc2575f80fd5b60405160a081016001600160401b038282108183111715614be557614be5613f02565b8160405282935084519150614bf9826140c6565b8183526020850151602084015260408501516040840152606085015160608401526080850151915080821115614c2d575f80fd5b50614c3a85828601614646565b6080830152505092915050565b5f60208284031215614c57575f80fd5b81516001600160401b03811115614c6c575f80fd5b6136e484828501614bb2565b5f60208284031215614c88575f80fd5b81516001600160401b0380821115614c9e575f80fd5b9083019060408286031215614cb1575f80fd5b614cb9613f16565b825181526020830151828111156149ed575f80fd5b5f60208284031215614cde575f80fd5b8151610df581613eee565b5f60208284031215614cf9575f80fd5b81516001600160401b0380821115614d0f575f80fd5b9083019060608286031215614d22575f80fd5b614d2a613f82565b8251815260208301516020820152604083015182811115614d49575f80fd5b614d5587828601614646565b60408301525095945050505050565b5f60208284031215614d74575f80fd5b8151610df5816140f5565b5f60c08284031215614d8f575f80fd5b610df583836148e1565b5f60208284031215614da9575f80fd5b8151610df581613e25565b8082028115828204841417610bec57610bec614ab5565b6001600160a01b0388168152608060208083018290529082018790525f90889060a08401835b8a811015614e1d578335614e04816146e6565b614e0e83826144e4565b94840194925050600101614df1565b5084810360408601528781528181019250600588901b81018201895f5b8a811015614e7457838303601f19018652614e55828d614407565b614e60858284614448565b978701979450505090840190600101614e3a565b50508581036060870152614e8981888a6145a1565b9d9c50505050505050505050505050565b5f6020808385031215614eab575f80fd5b82516001600160401b03811115614ec0575f80fd5b8301601f81018513614ed0575f80fd5b8051614ede61404e826146c4565b81815260059190911b82018301908381019087831115614efc575f80fd5b928401925b82841015614f1a57835182529284019290840190614f01565b979650505050505050565b5f8235607e198336030181126143fd575f80fd5b602081525f8235614f49816140c6565b6001600160c01b0381166020840152506020830135614f67816140f5565b8060020b60408401525060408301356060830152614f886060840184614407565b6080808501526144c960a085018284614448565b5f8235603e198336030181126143fd575f80fd5b60208152813560208201525f614fc96020840184614407565b6040808501526144c9606085018284614448565b5f8235605e198336030181126143fd575f80fd5b6020815281356020820152602082013560408201525f6150146040840184614407565b6060808501526144c9608085018284614448565b5f823560de198336030181126143fd575f80fd5b8035613e44816148d1565b8035613e4481613eee565b602081525f823561506281613eee565b6001600160a01b0380821660208501526020850135915061508282613e25565b6001600160401b0382166040850152604085013591506150a182613eee565b166060838101919091528301356150b7816148d1565b62ffffff81166080840152506150cf60808401615047565b6001600160a01b03811660a0840152506150eb60a0840161503c565b62ffffff811660c08401525061510460c0840184614407565b60e0808501526144c961010085018284614448565b5f6001600160a01b03808716835260206080602085015261513d608085018861450a565b848103604086015261514f8188614549565b8581036060870152865180825260208089019350909101905f5b81811015615187578351861683529284019291840191600101615169565b50909a9950505050505050505050565b5f606082840312156151a7575f80fd5b6151af613f82565b82516151ba81613eee565b815260208301516151ca81613e25565b602082015260408301516151dd81613e25565b60408201529392505050565b5f7f8000000000000000000000000000000000000000000000000000000000000000820361521957615219614ab5565b505f0390565b80820180821115610bec57610bec614ab5565b81810381811115610bec57610bec614ab5565b602081525f8235615255816140c6565b6001600160c01b0381166020840152506020830135615273816140c6565b6001600160c01b0381166040840152506040830135606083015261529960608401614103565b6152a8608084018260020b9052565b50608083013560a08301526152c060a0840184614407565b60e060c08501526152d661010085018284614448565b9150506152e660c0850185614407565b848303601f190160e08601526137a6838284614448565b5f6080828403121561530d575f80fd5b615315613f3e565b905081358152602082013560ff8116811461532e575f80fd5b80602083015250604082013560408201526060820135606082015292915050565b5f60c0828403121561535f575f80fd5b615367613f82565b823561537281613eee565b8152602083810135908201526151dd84604085016152fd565b6153ed81846001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b60e060c08201525f6136e460e0830184614086565b634e487b7160e01b5f52601260045260245ffd5b5f8261543057634e487b7160e01b5f52601260045260245ffd5b500490565b5f61014061549c8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e08401526001600160a01b03606086015116610100840152806101208401526144c981840185614086565b5f80604083850312156154f4575f80fd5b505080516020909101519092909150565b5f60208284031215615515575f80fd5b81518015158114610df5575f80fd5b5f61012061558b8386516001600160a01b038082511683526001600160401b036020830151166020840152806040830151166040840152606082015162ffffff80821660608601528260808501511660808601528060a08501511660a08601525050505050565b602085015160020b60c08401526001600160401b0360408601511660e0840152806101008401526144c981840185614086565b828152604060208201525f6136e46040830184614086565b5f602082840312156155e6575f80fd5b5051919050565b825181526001600160401b036020840151166020820152606060408201525f6136e46060830184614086565b5f8160020b627fffff19810361563157615631614ab5565b5f0392915050565b5f60808284031215615649575f80fd5b610df583836152fd565b5f82518060208501845e5f92019182525091905056fea26469706673582212205d030babface628d41af975b2b7119f20ba2d315229ba63974efbe1f93407df064736f6c63430008190033" } \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 59824f8..ba0af29 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -92,9 +92,9 @@ const config: HardhatConfig = { }, defaultNetwork: 'hardhat', networks: { - [networkInfos.berachainTestnet.id]: { - url: networkInfos.berachainTestnet.rpcUrls.default.http[0], - chainId: networkInfos.berachainTestnet.id, + [networkInfos.berachainTestnetbArtio.id]: { + url: networkInfos.berachainTestnetbArtio.rpcUrls.default.http[0], + chainId: networkInfos.berachainTestnetbArtio.id, accounts: process.env.DEV_PRIVATE_KEY ? [process.env.DEV_PRIVATE_KEY] : [], gas: 'auto', gasPrice: 'auto', @@ -217,24 +217,25 @@ const config: HardhatConfig = { base: process.env.BASESCAN_API_KEY ?? '', sepolia: process.env.ARBISCAN_API_KEY ?? '', arbitrumSepolia: process.env.ARBISCAN_API_KEY ?? '', - [networkInfos.berachainTestnet.id]: 'berachainArtio', + [networkInfos.berachainTestnetbArtio.id]: 'verifyContract', }, customChains: [ { - network: networkInfos.berachainTestnet.id.toString(), - chainId: networkInfos.berachainTestnet.id, + network: networkInfos.berachainTestnetbArtio.id.toString(), + chainId: networkInfos.berachainTestnetbArtio.id, urls: { - apiURL: 'https://api.routescan.io/v2/network/testnet/evm/80085/etherscan', - browserURL: 'https://artio.beratrail.io/', + apiURL: 'https://api.routescan.io/v2/network/testnet/evm/80084/etherscan/api/', + browserURL: 'https://bartio.beratrail.io', }, }, ], enabled: true, }, sourcify: { - // Disabled by default - // Doesn't need an API key + // Enable Sourcify verification by default enabled: true, + apiUrl: 'https://sourcify.dev/server', + browserUrl: 'https://repo.sourcify.dev', }, } diff --git a/package-lock.json b/package-lock.json index 4d6b6fa..a4efc38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,8 @@ "license": "ISC", "devDependencies": { "@nomicfoundation/hardhat-foundry": "^1.1.1", - "@nomicfoundation/hardhat-verify": "^2.0.6", - "@nomicfoundation/hardhat-viem": "^2.0.0", + "@nomicfoundation/hardhat-verify": "^2.0.9", + "@nomicfoundation/hardhat-viem": "^2.0.3", "@openzeppelin/upgrades-core": "^1.33.1", "@types/chai": "^4.3.11", "@types/mocha": "^10.0.6", @@ -24,7 +24,7 @@ "hardhat": "^2.22.2", "hardhat-abi-exporter": "^2.10.1", "hardhat-contract-sizer": "^2.10.0", - "hardhat-deploy": "^0.12.2", + "hardhat-deploy": "^0.12.4", "hardhat-gas-reporter": "^1.0.9", "hardhat-log-remover": "^2.0.2", "keythereum": "^2.0.0", @@ -33,7 +33,7 @@ "prettier-plugin-solidity": "^1.2.0", "readline-sync": "^1.4.10", "ts-node": "^10.9.2", - "viem": "^2.9.15" + "viem": "^2.20.0" } }, "node_modules/@adraffy/ens-normalize": { @@ -2425,21 +2425,21 @@ } }, "node_modules/@noble/curves": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", - "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.0.tgz", + "integrity": "sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==", "dev": true, "dependencies": { - "@noble/hashes": "1.3.2" + "@noble/hashes": "1.4.0" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", "dev": true, "engines": { "node": ">= 16" @@ -2461,131 +2461,82 @@ ] }, "node_modules/@nomicfoundation/edr": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.3.5.tgz", - "integrity": "sha512-dPSM9DuI1sr71gqWUMgLo8MjHQWO4+WNDm3iWaT6P4vUFJReZX5qwA5X+3UwIPBry8GvNY084u7yWUvB3/8rqA==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.5.2.tgz", + "integrity": "sha512-hW/iLvUQZNTVjFyX/I40rtKvvDOqUEyIi96T28YaLfmPL+3LW2lxmYLUXEJ6MI14HzqxDqrLyhf6IbjAa2r3Dw==", "dev": true, + "dependencies": { + "@nomicfoundation/edr-darwin-arm64": "0.5.2", + "@nomicfoundation/edr-darwin-x64": "0.5.2", + "@nomicfoundation/edr-linux-arm64-gnu": "0.5.2", + "@nomicfoundation/edr-linux-arm64-musl": "0.5.2", + "@nomicfoundation/edr-linux-x64-gnu": "0.5.2", + "@nomicfoundation/edr-linux-x64-musl": "0.5.2", + "@nomicfoundation/edr-win32-x64-msvc": "0.5.2" + }, "engines": { "node": ">= 18" - }, - "optionalDependencies": { - "@nomicfoundation/edr-darwin-arm64": "0.3.5", - "@nomicfoundation/edr-darwin-x64": "0.3.5", - "@nomicfoundation/edr-linux-arm64-gnu": "0.3.5", - "@nomicfoundation/edr-linux-arm64-musl": "0.3.5", - "@nomicfoundation/edr-linux-x64-gnu": "0.3.5", - "@nomicfoundation/edr-linux-x64-musl": "0.3.5", - "@nomicfoundation/edr-win32-x64-msvc": "0.3.5" } }, "node_modules/@nomicfoundation/edr-darwin-arm64": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.3.5.tgz", - "integrity": "sha512-gIXUIiPMUy6roLHpNlxf15DumU7/YhffUf7XIB+WUjMecaySfTGyZsTGnCMJZqrDyiYqWPyPKwCV/2u/jqFAUg==", - "cpu": [ - "arm64" - ], + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.5.2.tgz", + "integrity": "sha512-Gm4wOPKhbDjGTIRyFA2QUAPfCXA1AHxYOKt3yLSGJkQkdy9a5WW+qtqKeEKHc/+4wpJSLtsGQfpzyIzggFfo/A==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-darwin-x64": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.3.5.tgz", - "integrity": "sha512-0MrpOCXUK8gmplpYZ2Cy0holHEylvWoNeecFcrP2WJ5DLQzrB23U5JU2MvUzOJ7aL76Za1VXNBWi/UeTWdHM+w==", - "cpu": [ - "x64" - ], + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.5.2.tgz", + "integrity": "sha512-ClyABq2dFCsrYEED3/UIO0c7p4H1/4vvlswFlqUyBpOkJccr75qIYvahOSJRM62WgUFRhbSS0OJXFRwc/PwmVg==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.3.5.tgz", - "integrity": "sha512-aw9f7AZMiY1dZFNePJGKho2k+nEgFgzUAyyukiKfSqUIMXoFXMf1U3Ujv848czrSq9c5XGcdDa2xnEf3daU3xg==", - "cpu": [ - "arm64" - ], + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.5.2.tgz", + "integrity": "sha512-HWMTVk1iOabfvU2RvrKLDgtFjJZTC42CpHiw2h6rfpsgRqMahvIlx2jdjWYzFNy1jZKPTN1AStQ/91MRrg5KnA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-arm64-musl": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.3.5.tgz", - "integrity": "sha512-cVFRQjyABBlsbDj+XTczYBfrCHprZ6YNzN8gGGSqAh+UGIJkAIRomK6ar27GyJLNx3HkgbuDoi/9kA0zOo/95w==", - "cpu": [ - "arm64" - ], + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.5.2.tgz", + "integrity": "sha512-CwsQ10xFx/QAD5y3/g5alm9+jFVuhc7uYMhrZAu9UVF+KtVjeCvafj0PaVsZ8qyijjqVuVsJ8hD1x5ob7SMcGg==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-x64-gnu": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.3.5.tgz", - "integrity": "sha512-CjOg85DfR1Vt0fQWn5U0qi26DATK9tVzo3YOZEyI0JBsnqvk43fUTPv3uUAWBrPIRg5O5kOc9xG13hSpCBBxBg==", - "cpu": [ - "x64" - ], + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.5.2.tgz", + "integrity": "sha512-CWVCEdhWJ3fmUpzWHCRnC0/VLBDbqtqTGTR6yyY1Ep3S3BOrHEAvt7h5gx85r2vLcztisu2vlDq51auie4IU1A==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-linux-x64-musl": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.3.5.tgz", - "integrity": "sha512-hvX8bBGpBydAVevzK8jsu2FlqVZK1RrCyTX6wGHnltgMuBaoGLHYtNHiFpteOaJw2byYMiORc2bvj+98LhJ0Ew==", - "cpu": [ - "x64" - ], + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.5.2.tgz", + "integrity": "sha512-+aJDfwhkddy2pP5u1ISg3IZVAm0dO836tRlDTFWtvvSMQ5hRGqPcWwlsbobhDQsIxhPJyT7phL0orCg5W3WMeA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { "node": ">= 18" } }, "node_modules/@nomicfoundation/edr-win32-x64-msvc": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.3.5.tgz", - "integrity": "sha512-IJXjW13DY5UPsx/eG5DGfXtJ7Ydwrvw/BTZ2Y93lRLHzszVpSmeVmlxjZP5IW2afTSgMLaAAsqNw4NhppRGN8A==", - "cpu": [ - "x64" - ], + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.5.2.tgz", + "integrity": "sha512-CcvvuA3sAv7liFNPsIR/68YlH6rrybKzYttLlMr80d4GKJjwJ5OKb3YgE6FdZZnOfP19HEHhsLcE0DPLtY3r0w==", "dev": true, - "optional": true, - "os": [ - "win32" - ], "engines": { "node": ">= 18" } @@ -2668,9 +2619,9 @@ } }, "node_modules/@nomicfoundation/hardhat-verify": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.6.tgz", - "integrity": "sha512-oKUI5fl8QC8jysE2LUBHE6rObzEmccJcc4b43Ov7LFMlCBZJE27qoqGIsg/++wX7L8Jdga+bkejPxl8NvsecpQ==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-verify/-/hardhat-verify-2.0.9.tgz", + "integrity": "sha512-7kD8hu1+zlnX87gC+UN4S0HTKBnIsDfXZ/pproq1gYsK94hgCk+exvzXbwR0X2giiY/RZPkqY9oKRi0Uev91hQ==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.1.2", @@ -2684,20 +2635,20 @@ "undici": "^5.14.0" }, "peerDependencies": { - "hardhat": "^2.0.4" + "hardhat": "^2.22.72.0.4" } }, "node_modules/@nomicfoundation/hardhat-viem": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-viem/-/hardhat-viem-2.0.1.tgz", - "integrity": "sha512-C7mSg2MiJekWY2xZYYOdbGmA1+hRKIHoSsh/SeY97mPO6nTha7OEeeg+seecxTekLJW1kqryjCdU8ul+L29v3w==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nomicfoundation/hardhat-viem/-/hardhat-viem-2.0.3.tgz", + "integrity": "sha512-y2eYaHtpshiGrhU2L5My4zYrj/vxxRdCIqbTsg9YP7AjKWhJGvKPkVRYaPTosW68nYlNtkns/+Eb25aXACHd9Q==", "dev": true, "dependencies": { "abitype": "^0.9.8", "lodash.memoize": "^4.1.2" }, "peerDependencies": { - "hardhat": "^2.17.0", + "hardhat": "^2.22.62.17.0", "typescript": "~5.0.0", "viem": "^2.7.6" } @@ -3075,27 +3026,27 @@ } }, "node_modules/@scure/bip32": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", - "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", "dev": true, "dependencies": { - "@noble/curves": "~1.2.0", - "@noble/hashes": "~1.3.2", - "@scure/base": "~1.1.2" + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz", + "integrity": "sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==", "dev": true, "dependencies": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" }, "funding": { "url": "https://paulmillr.com/funding/" @@ -5448,19 +5399,6 @@ "@noble/hashes": "^1.4.0" } }, - "node_modules/ethereum-bloom-filters/node_modules/@noble/hashes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", - "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", - "dev": true, - "peer": true, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/ethereum-cryptography": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", @@ -6068,7 +6006,6 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", "dev": true, - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -6431,7 +6368,6 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", "dev": true, - "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -6633,14 +6569,14 @@ } }, "node_modules/hardhat": { - "version": "2.22.3", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.3.tgz", - "integrity": "sha512-k8JV2ECWNchD6ahkg2BR5wKVxY0OiKot7fuxiIpRK0frRqyOljcR2vKwgWSLw6YIeDcNNA4xybj7Og7NSxr2hA==", + "version": "2.22.9", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.9.tgz", + "integrity": "sha512-sWiuI/yRdFUPfndIvL+2H18Vs2Gav0XacCFYY5msT5dHOWkhLxESJySIk9j83mXL31aXL8+UMA9OgViFLexklg==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/edr": "^0.3.5", + "@nomicfoundation/edr": "^0.5.2", "@nomicfoundation/ethereumjs-common": "4.0.4", "@nomicfoundation/ethereumjs-tx": "5.0.4", "@nomicfoundation/ethereumjs-util": "9.0.4", @@ -6674,7 +6610,7 @@ "raw-body": "^2.4.1", "resolve": "1.17.0", "semver": "^6.3.0", - "solc": "0.7.3", + "solc": "0.8.26", "source-map-support": "^0.5.13", "stacktrace-parser": "^0.1.10", "tsort": "0.0.1", @@ -6799,9 +6735,9 @@ } }, "node_modules/hardhat-deploy": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.12.2.tgz", - "integrity": "sha512-Xp/4Lb5lC/j3kvitaWW5IZN5Meqv5D3kTIifc3ZwBoQtFLN26/fDfRV6MWAAcRO9gH64hZVokvtcDdl/fd7w3A==", + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/hardhat-deploy/-/hardhat-deploy-0.12.4.tgz", + "integrity": "sha512-bYO8DIyeGxZWlhnMoCBon9HNZb6ji0jQn7ngP1t5UmGhC8rQYhji7B73qETMOFhzt5ECZPr+U52duj3nubsqdQ==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.7.0", @@ -7003,12 +6939,6 @@ "@scure/base": "~1.1.0" } }, - "node_modules/hardhat/node_modules/commander": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", - "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==", - "dev": true - }, "node_modules/hardhat/node_modules/ethereum-cryptography": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", @@ -7021,15 +6951,6 @@ "@scure/bip39": "1.1.1" } }, - "node_modules/hardhat/node_modules/jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/hardhat/node_modules/keccak": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", @@ -7045,49 +6966,25 @@ "node": ">=10.0.0" } }, - "node_modules/hardhat/node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/hardhat/node_modules/solc": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", - "integrity": "sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA==", + "version": "0.8.26", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.8.26.tgz", + "integrity": "sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g==", "dev": true, "dependencies": { "command-exists": "^1.2.8", - "commander": "3.0.2", + "commander": "^8.1.0", "follow-redirects": "^1.12.1", - "fs-extra": "^0.30.0", "js-sha3": "0.8.0", "memorystream": "^0.3.1", - "require-from-string": "^2.0.0", "semver": "^5.5.0", "tmp": "0.0.33" }, "bin": { - "solcjs": "solcjs" + "solcjs": "solc.js" }, "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/hardhat/node_modules/solc/node_modules/fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "klaw": "^1.0.0", - "path-is-absolute": "^1.0.0", - "rimraf": "^2.2.8" + "node": ">=10.0.0" } }, "node_modules/hardhat/node_modules/solc/node_modules/semver": { @@ -7753,9 +7650,9 @@ "dev": true }, "node_modules/isows": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", - "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.4.tgz", + "integrity": "sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ==", "dev": true, "funding": [ { @@ -8582,6 +8479,7 @@ "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", "integrity": "sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==", "dev": true, + "peer": true, "optionalDependencies": { "graceful-fs": "^4.1.9" } @@ -11853,9 +11751,9 @@ } }, "node_modules/viem": { - "version": "2.9.25", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.9.25.tgz", - "integrity": "sha512-W0QOXCsYQppnV89PQP0EnCvfZIEsDYqmpVakLPNrok4Q4B7651M3MV/sYifYcLWv3Mn4KUyMCUlVxlej6CfC/w==", + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.20.1.tgz", + "integrity": "sha512-a/BSe25TSfkc423GTSKYl1O0ON2J5huoQeOLkylHT1WS8wh3JFqb8nfAq7vg+aZ+W06BCTn36bbi47yp4D92Cg==", "dev": true, "funding": [ { @@ -11865,13 +11763,14 @@ ], "dependencies": { "@adraffy/ens-normalize": "1.10.0", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@scure/bip32": "1.3.2", - "@scure/bip39": "1.2.1", - "abitype": "1.0.0", - "isows": "1.0.3", - "ws": "8.13.0" + "@noble/curves": "1.4.0", + "@noble/hashes": "1.4.0", + "@scure/bip32": "1.4.0", + "@scure/bip39": "1.3.0", + "abitype": "1.0.5", + "isows": "1.0.4", + "webauthn-p256": "0.0.5", + "ws": "8.17.1" }, "peerDependencies": { "typescript": ">=5.0.4" @@ -11883,9 +11782,9 @@ } }, "node_modules/viem/node_modules/abitype": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", - "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.5.tgz", + "integrity": "sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==", "dev": true, "funding": { "url": "https://github.com/sponsors/wevm" @@ -11904,9 +11803,9 @@ } }, "node_modules/viem/node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "dev": true, "engines": { "node": ">=10.0.0" @@ -12021,6 +11920,22 @@ "@scure/bip39": "1.2.2" } }, + "node_modules/webauthn-p256": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/webauthn-p256/-/webauthn-p256-0.0.5.tgz", + "integrity": "sha512-drMGNWKdaixZNobeORVIqq7k5DsRC9FnG201K2QjeOoQLmtSDaSsVZdkg6n5jUALJKcAG++zBPJXmv6hy0nWFg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.4.0" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index 9153ee7..78ef399 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ "license": "ISC", "files": [], "devDependencies": { - "@nomicfoundation/hardhat-viem": "^2.0.0", + "@nomicfoundation/hardhat-viem": "^2.0.3", "@nomicfoundation/hardhat-foundry": "^1.1.1", - "@nomicfoundation/hardhat-verify": "^2.0.6", + "@nomicfoundation/hardhat-verify": "^2.0.9", "@openzeppelin/upgrades-core": "^1.33.1", "@types/chai": "^4.3.11", "@types/mocha": "^10.0.6", @@ -41,7 +41,7 @@ "hardhat": "^2.22.2", "hardhat-abi-exporter": "^2.10.1", "hardhat-contract-sizer": "^2.10.0", - "hardhat-deploy": "^0.12.2", + "hardhat-deploy": "^0.12.4", "hardhat-gas-reporter": "^1.0.9", "hardhat-log-remover": "^2.0.2", "keythereum": "^2.0.0", @@ -50,6 +50,6 @@ "prettier-plugin-solidity": "^1.2.0", "readline-sync": "^1.4.10", "ts-node": "^10.9.2", - "viem": "^2.9.15" + "viem": "^2.20.0" } -} +} \ No newline at end of file diff --git a/utils/constants.ts b/utils/constants.ts index 482323c..d29eb88 100644 --- a/utils/constants.ts +++ b/utils/constants.ts @@ -1,16 +1,10 @@ -import { arbitrumSepolia, base, berachainTestnet, arbitrum } from 'viem/chains' +import { arbitrumSepolia, base, arbitrum, berachainTestnetbArtio } from 'viem/chains' import { Address } from 'viem' export const BOOK_MANAGER: { [chainId: number]: Address } = { [arbitrumSepolia.id]: '0xC528b9ED5d56d1D0d3C18A2342954CE1069138a4', [base.id]: '0x382CCccbD3b142D7DA063bF68cd0c89634767F76', - [berachainTestnet.id]: '0x982c57388101D012846aDC4997E9b073F3bC16BD', -} - -export const DEFAULT_BROKER_SHARE_RATIO: { [chainId: number]: number } = { - [arbitrumSepolia.id]: 700_000, - [base.id]: 700_000, - [berachainTestnet.id]: 700_000, + [berachainTestnetbArtio.id]: '0x874b1B795993653fbFC3f1c1fc0469214cC9F4A5', } export const SAFE_WALLET: { [chainId: number]: Address } = {