{"file_path":"contracts/token/CapToken.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { Vault } from \"../vault/Vault.sol\";\nimport { UUPSUpgradeable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\n/// @title Cap Token\n/// @author kexley, Cap Labs\n/// @notice Token representing the basket of underlying assets\ncontract CapToken is UUPSUpgradeable, Vault {\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /// @notice Initialize the Cap token\n    /// @param _name Name of the cap token\n    /// @param _symbol Symbol of the cap token\n    /// @param _accessControl Access controller\n    /// @param _feeAuction Fee auction address\n    /// @param _oracle Oracle address\n    /// @param _assets Asset addresses to mint Cap token with\n    /// @param _insuranceFund Insurance fund\n    function initialize(\n        string memory _name,\n        string memory _symbol,\n        address _accessControl,\n        address _feeAuction,\n        address _oracle,\n        address[] calldata _assets,\n        address _insuranceFund\n    ) external initializer {\n        __Vault_init(_name, _symbol, _accessControl, _feeAuction, _oracle, _assets, _insuranceFund);\n        __UUPSUpgradeable_init();\n    }\n\n    /// @inheritdoc UUPSUpgradeable\n    function _authorizeUpgrade(address) internal view override checkAccess(bytes4(0)) { }\n}\n","deployed_bytecode":"0x6080604052600436106103be575f3560e01c80637ecebe00116101f4578063baf11db811610113578063d505accf116100a8578063df6e7cc811610078578063df6e7cc814610c4c578063e75179a414610c6b578063f878369e14610c8a578063f93b6be514610ca9578063feee175614610cbd575f5ffd5b8063d505accf14610ba4578063d936547e14610bc3578063dbf6248914610c19578063dd62ed3e14610c2d575f5ffd5b8063c6d98f1a116100e3578063c6d98f1a14610b12578063c77cf61514610b45578063caf1803714610b59578063cf23a0c614610b78575f5ffd5b8063baf11db814610a62578063bf20d9dc14610ab5578063c3c0529314610ad4578063c5e72a1714610af3575f5ffd5b80639abacb4111610189578063ad3cb1cc11610159578063ad3cb1cc146109e0578063adc5ce6e14610a10578063b790230314610a2f578063b7c4a6bf14610a43575f5ffd5b80639abacb4114610964578063a0821be314610983578063a4450587146109a2578063a9059cbb146109c1575f5ffd5b80638d730124116101c45780638d730124146108fe578063908ab68c1461091d57806395d89b41146109315780639782e82114610945575f5ffd5b80637ecebe001461082b57806384b0196e1461084a5780638a7595ad146108715780638bee2a8e14610890575f5ffd5b80633753b14a116102e05780635c975abb1161027557806370a082311161024557806370a08231146107ad57806371a97305146107cc578063753842db146107ed57806378250b631461080c575f5ffd5b80635c975abb1461072d5780635d799f87146107505780635d841af51461076f5780636c665a551461078e575f5ffd5b80634f24d20a116102b05780634f24d20a146106bc57806352d1902d146106db57806353d6fd59146106ef578063561279871461070e575f5ffd5b80633753b14a1461064c57806341d951261461066b5780634a5e42b11461068a5780634f1ef286146106a9575f5ffd5b806320b71534116103565780632c3ee88c116103265780632c3ee88c146105d15780632e48152c146105fe578063313ce5671461061d5780633644e51514610638575f5ffd5b806320b715341461055557806322867d781461057457806323b872dd14610593578063298410e5146105b2575f5ffd5b8063095ea7b311610391578063095ea7b31461046a57806318160ddd1461049957806318dfd788146104cc578063195d0e2814610536575f5ffd5b8063012ea17c146103c257806304b102c8146103e357806306fdde031461041c578063082bf6e81461043d575b5f5ffd5b3480156103cd575f5ffd5b506103e16103dc36600461386a565b610cdc565b005b3480156103ee575f5ffd5b506104026103fd3660046138a6565b610ee9565b604080519283526020830191909152015b60405180910390f35b348015610427575f5ffd5b50610430610fa4565b604051610413919061390e565b348015610448575f5ffd5b5061045c610457366004613920565b611049565b604051908152602001610413565b348015610475575f5ffd5b50610489610484366004613939565b61107e565b6040519015158152602001610413565b3480156104a4575f5ffd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025461045c565b3480156104d7575f5ffd5b506104eb6104e6366004613920565b611097565b60405161041391905f60c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b348015610541575f5ffd5b50610402610550366004613939565b61114a565b348015610560575f5ffd5b5061045c61056f366004613920565b61116e565b34801561057f575f5ffd5b506103e161058e366004613939565b6111a7565b34801561059e575f5ffd5b506104896105ad3660046138a6565b61126c565b3480156105bd575f5ffd5b506103e16105cc366004613920565b611291565b3480156105dc575f5ffd5b506105f06105eb366004613961565b611323565b6040516104139291906139b2565b348015610609575f5ffd5b50610489610618366004613920565b6113e0565b348015610628575f5ffd5b5060405160128152602001610413565b348015610643575f5ffd5b5061045c61140d565b348015610657575f5ffd5b506103e1610666366004613920565b61141b565b348015610676575f5ffd5b506103e1610685366004613ad7565b61144e565b348015610695575f5ffd5b506103e16106a4366004613920565b61155b565b6103e16106b7366004613ba9565b61158e565b3480156106c7575f5ffd5b5061045c6106d6366004613920565b6115a9565b3480156106e6575f5ffd5b5061045c611640565b3480156106fa575f5ffd5b506103e1610709366004613c13565b61165b565b348015610719575f5ffd5b5061045c610728366004613c48565b6116e6565b348015610738575f5ffd5b505f51602061433b5f395f51905f525460ff16610489565b34801561075b575f5ffd5b506103e161076a366004613c92565b6117e6565b34801561077a575f5ffd5b506103e1610789366004613961565b611894565b348015610799575f5ffd5b506103e16107a8366004613cc3565b6118ef565b3480156107b8575f5ffd5b5061045c6107c7366004613920565b6119d3565b3480156107d7575f5ffd5b506107e0611a03565b6040516104139190613cfc565b3480156107f8575f5ffd5b506103e1610807366004613920565b611a15565b348015610817575f5ffd5b506103e1610826366004613939565b611a53565b348015610836575f5ffd5b5061045c610845366004613920565b611abe565b348015610855575f5ffd5b5061085e611ac8565b6040516104139796959493929190613d47565b34801561087c575f5ffd5b506103e161088b366004613c92565b611b76565b34801561089b575f5ffd5b506108e66108aa366004613920565b6001600160a01b039081165f9081527f5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad10360205260409020541690565b6040516001600160a01b039091168152602001610413565b348015610909575f5ffd5b5061045c610918366004613920565b611c83565b348015610928575f5ffd5b506107e0611cad565b34801561093c575f5ffd5b50610430611cd8565b348015610950575f5ffd5b5061045c61095f366004613920565b611d16565b34801561096f575f5ffd5b506103e161097e366004613920565b611d40565b34801561098e575f5ffd5b5061045c61099d366004613920565b611d73565b3480156109ad575f5ffd5b5061045c6109bc366004613c48565b611d96565b3480156109cc575f5ffd5b506104896109db366004613939565b611eb7565b3480156109eb575f5ffd5b50610430604051806040016040528060058152602001640352e302e360dc1b81525081565b348015610a1b575f5ffd5b506103e1610a2a366004613920565b611ec4565b348015610a3a575f5ffd5b506108e6611f02565b348015610a4e575f5ffd5b50610402610a5d366004613939565b611f1d565b348015610a6d575f5ffd5b5061045c610a7c366004613920565b6001600160a01b03165f9081527f5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad101602052604090205490565b348015610ac0575f5ffd5b5061045c610acf366004613920565b611fd5565b348015610adf575f5ffd5b506103e1610aee366004613920565b611ff8565b348015610afe575f5ffd5b50610402610b0d3660046138a6565b61202b565b348015610b1d575f5ffd5b507f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe015461045c565b348015610b50575f5ffd5b506108e661205d565b348015610b64575f5ffd5b506105f0610b73366004613939565b61207c565b348015610b83575f5ffd5b50610b97610b92366004613db6565b612133565b6040516104139190613e16565b348015610baf575f5ffd5b506103e1610bbe366004613e28565b612308565b348015610bce575f5ffd5b50610489610bdd366004613920565b6001600160a01b03165f9081527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe03602052604090205460ff1690565b348015610c24575f5ffd5b506103e161245d565b348015610c38575f5ffd5b5061045c610c47366004613c92565b612479565b348015610c57575f5ffd5b506103e1610c66366004613920565b6124c2565b348015610c76575f5ffd5b5061045c610c85366004613920565b612547565b348015610c95575f5ffd5b506103e1610ca4366004613939565b61255b565b348015610cb4575f5ffd5b506103e16125db565b348015610cc8575f5ffd5b5061045c610cd7366004613920565b6125f4565b624ba85f60e21b610cec81612617565b6a295be96e64066972000000823510610d1857604051630e7fd4ad60e21b815260040160405180910390fd5b6b033b2e3c9fd0803ce80000008260600135101580610d3957506060820135155b15610d57576040516304d9bf5d60e21b815260040160405180910390fd5b6b033b2e3c9fd0803ce80000008260800135101580610d7857506080820135155b15610d9657604051632a41299560e01b815260040160405180910390fd5b6b033b2e3c9fd0803ce80000008260a00135101580610db7575060a0820135155b15610dd557604051633cb8e73560e11b815260040160405180910390fd5b81606001358260a001351480610df2575081608001358260a00135145b15610e1057604051633cb8e73560e11b815260040160405180910390fd5b6001600160a01b0383165f8181527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe0260209081526040918290208535808255868301356001830181905587850135600284018190556060808a0135600386018190556080808c01356004880181905560a0808e013560059099018990558a519b8c52988b019690965297890193909352870152938501939093529083019190915260c08201527fb80d92aa6c2285ae4a8f342a6066af0fa35893e1853656935ec70c4fa2937d8f9060e0015b60405180910390a1505050565b604080516080810182525f8082526001600160a01b038581166020840152828401859052861660608301529151632d761af360e01b815282917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391610f5a915f51602061429b5f395f51905f529190600401613e95565b6040805180830381865af4158015610f74573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f989190613ed8565b90969095509350505050565b60605f5f5160206142bb5f395f51905f525b9050806003018054610fc790613efa565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff390613efa565b801561103e5780601f106110155761010080835404028352916020019161103e565b820191905f5260205f20905b81548152906001019060200180831161102157829003601f168201915b505050505091505090565b5f5f61105483611d16565b90505f6110608461116e565b905081811115611077576110748282613f46565b92505b5050919050565b5f3361108b8185856126d7565b60019150505b92915050565b6110ca6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b506001600160a01b03165f9081527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe026020908152604091829020825160c08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b5f5f5f61115685611049565b905080841115611164578093505b610f9885856126e4565b6001600160a01b03165f9081527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe04602052604090205490565b6111af612754565b6111b7612786565b630450cfaf60e31b6111c881612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8632ebadfbe6111ea6127f3565b6040805180820182526001600160a01b0380891682526020820188815292516001600160e01b031960e087901b168152600481019490945290511660248301525160448201526064015f6040518083038186803b158015611249575f5ffd5b505af415801561125b573d5f5f3e3d5ffd5b5050505050611268612817565b5050565b5f33611279858285612841565b6112848585856128a5565b60019150505b9392505050565b63298410e560e01b6112a281612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863a18a81976112c46127f3565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03851660248201526044015b5f6040518083038186803b158015611309575f5ffd5b505af415801561131b573d5f5f3e3d5ffd5b505050505050565b6060807393812ed688143e4553708a5fa1b3624d8d59c760634bfcc81c5f51602061429b5f395f51905f526040805180820182528781523360208201908152915160e085901b6001600160e01b03191681526004810193909352516024830152516001600160a01b031660448201526064015f60405180830381865af41580156113af573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526113d69190810190613fd8565b9094909350915050565b5f6113e96127f3565b6001600160a01b039092165f90815260069290920160205250604090205460ff1690565b5f611416612902565b905090565b631ba9d8a560e11b61142c81612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863dd360ac96112c46127f3565b5f61145761290b565b805490915060ff600160401b82041615906001600160401b03165f8115801561147d5750825b90505f826001600160401b031660011480156114985750303b155b9050811580156114a6575080155b156114c45760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156114ee57845460ff60401b1916600160401b1785555b6114fe8d8d8d8d8d8d8d8d612933565b611506612974565b831561154c57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050505050565b634a5e42b160e01b61156c81612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863c709ad176112c46127f3565b61159661297c565b61159f82612a0a565b6112688282612a14565b5f73bacb4e5c6ea074e3065ea086b392c33dacf9c5e0631ae6b4d15f51602061431b5f395f51905f525b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b0385166024820152604401602060405180830381865af415801561161c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110919190614031565b5f611649612ad0565b505f5160206142fb5f395f51905f5290565b6353d6fd5960e01b61166c81612617565b6001600160a01b0383165f8181527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe036020908152604091829020805460ff19168615159081179091558251938452908301527ff6019ec0a78d156d249a1ec7579e2321f6ac7521d6e1d2eacf90ba4a184dcceb9101610edc565b5f6116ef612754565b6116f7612786565b5f6117028787611f1d565b90925090506117113387612b19565b6117248761171f8385614048565b612b4d565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8637be70bae6117466127f3565b6040518060e001604052808b6001600160a01b031681526020018a8152602001868152602001898152602001886001600160a01b03168152602001878152602001858152506040518363ffffffff1660e01b81526004016117a892919061405b565b5f6040518083038186803b1580156117be575f5ffd5b505af41580156117d0573d5f5f3e3d5ffd5b50505050506117dd612817565b95945050505050565b635d799f8760e01b6117f781612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8633687471f6118196127f3565b5f51602061431b5f395f51905f526040516001600160e01b031960e085901b168152600481019290925260248201526001600160a01b038087166044830152851660648201526084015b5f6040518083038186803b158015611879575f5ffd5b505af415801561188b573d5f5f3e3d5ffd5b50505050505050565b635d841af560e01b6118a581612617565b815f51602061429b5f395f51905f52600101556040518281527fc2045f7458ee2982ac24e8bc693c0924341b1d70475de942852d90e121fc77609060200160405180910390a15050565b6118f7612754565b6118ff612786565b636c665a5560e01b61191081612617565b61191a8484612b4d565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863ebd0396d61193c6127f3565b604080516060810182526001600160a01b03808a1682526020820189815288821683850190815293516001600160e01b031960e088901b16815260048101959095529151811660248501529051604484015290511660648201526084015f6040518083038186803b1580156119af575f5ffd5b505af41580156119c1573d5f5f3e3d5ffd5b50505050506119ce612817565b505050565b5f805f5160206142bb5f395f51905f525b6001600160a01b039093165f9081526020939093525050604090205490565b6060611416611a106127f3565b612ba7565b63753842db60e01b611a2681612617565b73bacb4e5c6ea074e3065ea086b392c33dacf9c5e063fdcc2aa45f51602061431b5f395f51905f526112c4565b6378250b6360e01b611a6481612617565b60405163938e51cf60e01b81525f51602061431b5f395f51905f5260048201526001600160a01b03841660248201526044810183905273bacb4e5c6ea074e3065ea086b392c33dacf9c5e09063938e51cf90606401611863565b5f61109182612bb3565b5f60608082808083815f5160206142db5f395f51905f528054909150158015611af357506001810154155b611b3c5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b60448201526064015b60405180910390fd5b611b44612bdb565b611b4c612c19565b604080515f80825260208201909252600f60f81b9c939b5091995046985030975095509350915050565b638a7595ad60e01b611b8781612617565b5f5f51602061431b5f395f51905f52604051632969be0760e11b8152600481018290526001600160a01b038616602482015290915073bacb4e5c6ea074e3065ea086b392c33dacf9c5e0906352d37c0e906044015f6040518083038186803b158015611bf1575f5ffd5b505af4158015611c03573d5f5f3e3d5ffd5b505060405163c431765760e01b8152600481018490526001600160a01b0380881660248301528616604482015273bacb4e5c6ea074e3065ea086b392c33dacf9c5e0925063c431765791506064015f6040518083038186803b158015611c67575f5ffd5b505af4158015611c79573d5f5f3e3d5ffd5b5050505050505050565b5f611c8c6127f3565b6001600160a01b039092165f90815260039290920160205250604090205490565b60606114167f5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad104612ba7565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0480546060915f5160206142bb5f395f51905f5291610fc790613efa565b5f611d1f6127f3565b6001600160a01b039092165f90815260029290920160205250604090205490565b639abacb4160e01b611d5181612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a86316488ca66112c46127f3565b5f73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a86350ba58276115d36127f3565b5f611d9f612754565b611da7612786565b5f5f611db288611049565b905080871115611dc0578096505b611dca88886126e4565b909350915073651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863fe209c31611df16127f3565b6040518060e001604052808c6001600160a01b031681526020018b81526020018781526020018a8152602001896001600160a01b03168152602001888152602001868152506040518363ffffffff1660e01b8152600401611e5392919061405b565b5f6040518083038186803b158015611e69575f5ffd5b505af4158015611e7b573d5f5f3e3d5ffd5b50505050611e898584612c2f565b8115611ead57611ead611e9a6127f3565b600701546001600160a01b031683612c2f565b50506117dd612817565b5f3361108b8185856128a5565b6356e2e73760e11b611ed581612617565b73bacb4e5c6ea074e3065ea086b392c33dacf9c5e06352d37c0e5f51602061431b5f395f51905f526112c4565b5f611f0b6127f3565b600701546001600160a01b0316919050565b604080516080810182525f8082526001600160a01b03851660208301528183018490523360608301529151632d761af360e01b815282917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391611f8c915f51602061429b5f395f51905f529190600401613e95565b6040805180830381865af4158015611fa6573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fca9190613ed8565b909590945092505050565b5f73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8630f82ffd06115d36127f3565b63c3c0529360e01b61200981612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863d8417d626112c46127f3565b5f5f5f61203785611049565b905080841115612045578093505b612050868686612c63565b9097909650945050505050565b5f5f51602061431b5f395f51905f525b546001600160a01b0316919050565b6060807393812ed688143e4553708a5fa1b3624d8d59c760634bfcc81c5f51602061429b5f395f51905f526040805180820182528781526001600160a01b03808a166020830190815292516001600160e01b031960e087901b16815260048101949094529051602484015290511660448201526064015f60405180830381865af415801561210c573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611fca9190810190613fd8565b606061213d612754565b612145612786565b606061215087611323565b909250905061215f3388612b19565b5f82516001600160401b03811115612179576121796139d6565b6040519080825280602002602001820160405280156121a2578160200160208202803683370190505b5090505f5b8351811015612213578281815181106121c2576121c26140c0565b60200260200101518482815181106121dc576121dc6140c0565b60200260200101516121ee9190614048565b828281518110612200576122006140c0565b60209081029190910101526001016121a7565b5061222561221f611a03565b82612cd5565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863e81d65616122476127f3565b6040518060c001604052808c81526020018781526020018b8b808060200260200160405190810160405280939291908181526020018383602002808284375f920191909152505050908252506001600160a01b038a16602082015260408082018a90526060909101879052516001600160e01b031960e085901b1681526122d29291906004016140d4565b5f6040518083038186803b1580156122e8575f5ffd5b505af41580156122fa573d5f5f3e3d5ffd5b5050505050506117dd612817565b8342111561232c5760405163313c898160e11b815260048101859052602401611b33565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886123968c6001600160a01b03165f9081527f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb006020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f6123f082612dac565b90505f6123ff82878787612dd8565b9050896001600160a01b0316816001600160a01b031614612446576040516325c0072360e11b81526001600160a01b0380831660048301528b166024820152604401611b33565b6124518a8a8a6126d7565b50505050505050505050565b63dbf6248960e01b61246e81612617565b612476612e04565b50565b6001600160a01b039182165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b73bacb4e5c6ea074e3065ea086b392c33dacf9c5e063201d48c05f51602061431b5f395f51905f526040516001600160e01b031960e084901b16815260048101919091526001600160a01b03841660248201526044015f6040518083038186803b15801561252e575f5ffd5b505af4158015612540573d5f5f3e3d5ffd5b5050505050565b5f5f51602061431b5f395f51905f52611d1f565b637c3c1b4f60e11b61256c81612617565b6001600160a01b0383165f8181527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe046020908152604091829020859055815192835282018490527f2a82c7b7f2539b4a75f05cda23dc12990cf8e212d55c2a3b6bb6d0d36b08b0059101610edc565b63f93b6be560e01b6125ec81612617565b612476612e66565b5f73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8633c0541276115d36127f3565b5f7fb413d65cb88f23816c329284a0d3eb15a99df7963ab7402ade4c5da22bff6b0054604051633657648360e21b81526001600160e01b0319841660048201523060248201523360448201526001600160a01b039091169063d95d920c90606401602060405180830381865afa158015612693573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126b79190614157565b90508061126857604051634ca8886760e01b815260040160405180910390fd5b6119ce8383836001612eab565b60408051608081018252600181526001600160a01b03841660208201528082018390523360608201529051632d761af360e01b81525f9182917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391611f8c915f51602061429b5f395f51905f5291600401613e95565b5f51602061433b5f395f51905f525460ff16156127845760405163d93c066560e01b815260040160405180910390fd5b565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c156127c657604051633ee5aeb560e01b815260040160405180910390fd5b61278460017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b90612f8e565b7fe912a1b0cc7579bc5827e495c2ce52587bc3871751e3281fc5599b38c3bfc40090565b6127845f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f006127ed565b5f61284c8484612479565b90505f1981101561289f578181101561289157604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401611b33565b61289f84848484035f612eab565b50505050565b6001600160a01b0383166128ce57604051634b637e8f60e11b81525f6004820152602401611b33565b6001600160a01b0382166128f75760405163ec442f0560e01b81525f6004820152602401611b33565b6119ce838383612f95565b5f6114166130ce565b5f807ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00611091565b61293b613141565b6129458888613166565b61294e88613178565b612957866131a3565b612960856131b4565b612969846131ed565b611c79838383613209565b612784613141565b306001600160a01b037f000000000000000000000000bdaa34082f1a1a3c32190a672bc9dd1b69791b971614806129ec57507f000000000000000000000000bdaa34082f1a1a3c32190a672bc9dd1b69791b976001600160a01b03166129e0613288565b6001600160a01b031614155b156127845760405163703e46dd60e11b815260040160405180910390fd5b5f61126881612617565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612a6e575060408051601f3d908101601f19168201909252612a6b91810190614031565b60015b612a9657604051634c9c8ce360e01b81526001600160a01b0383166004820152602401611b33565b5f5160206142fb5f395f51905f528114612ac657604051632a87526960e21b815260048101829052602401611b33565b6119ce838361329c565b306001600160a01b037f000000000000000000000000bdaa34082f1a1a3c32190a672bc9dd1b69791b9716146127845760405163703e46dd60e11b815260040160405180910390fd5b6001600160a01b038216612b4257604051634b637e8f60e11b81525f6004820152602401611b33565b611268825f83612f95565b604051630a78cab560e31b81525f51602061431b5f395f51905f5260048201526001600160a01b03831660248201526044810182905273bacb4e5c6ea074e3065ea086b392c33dacf9c5e0906353c655a8906064016112f3565b60605f61128a836132f1565b5f807f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb006119e4565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10280546060915f5160206142db5f395f51905f5291610fc790613efa565b60605f5f5160206142db5f395f51905f52610fb6565b6001600160a01b038216612c585760405163ec442f0560e01b81525f6004820152602401611b33565b6112685f8383612f95565b60408051608081018252600181526001600160a01b038481166020830152818301849052851660608201529051632d761af360e01b81525f9182917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391610f5a915f51602061429b5f395f51905f5291600401613e95565b5f51602061431b5f395f51905f525f5b835181101561289f5773bacb4e5c6ea074e3065ea086b392c33dacf9c5e06353c655a883868481518110612d1b57612d1b6140c0565b6020026020010151868581518110612d3557612d356140c0565b60200260200101516040518463ffffffff1660e01b8152600401612d75939291909283526001600160a01b03919091166020830152604082015260600190565b5f6040518083038186803b158015612d8b575f5ffd5b505af4158015612d9d573d5f5f3e3d5ffd5b50505050806001019050612ce5565b5f611091612db8612902565b8360405161190160f01b8152600281019290925260228201526042902090565b5f5f5f5f612de88888888861334a565b925092509250612df88282613412565b50909695505050505050565b612e0c612754565b5f51602061433b5f395f51905f52805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a150565b612e6e6134ca565b5f51602061433b5f395f51905f52805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612e48565b5f5160206142bb5f395f51905f526001600160a01b038516612ee25760405163e602df0560e01b81525f6004820152602401611b33565b6001600160a01b038416612f0b57604051634a1406b160e11b81525f6004820152602401611b33565b6001600160a01b038086165f9081526001830160209081526040808320938816835292905220839055811561254057836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051612f7f91815260200190565b60405180910390a35050505050565b80825d5050565b5f5160206142bb5f395f51905f526001600160a01b038416612fcf5781816002015f828254612fc49190614048565b9091555061303f9050565b6001600160a01b0384165f90815260208290526040902054828110156130215760405163391434e360e21b81526001600160a01b03861660048201526024810182905260448101849052606401611b33565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b03831661305d57600281018054839003905561307b565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516130c091815260200190565b60405180910390a350505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6130f86134f9565b613100613561565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6131496135a3565b61278457604051631afcd79f60e31b815260040160405180910390fd5b61316e613141565b61126882826135bc565b613180613141565b61247681604051806040016040528060018152602001603160f81b81525061360c565b6131ab613141565b6124768161366b565b6131bc613141565b805f51602061431b5f395f51905f525b80546001600160a01b0319166001600160a01b039290921691909117905550565b6131f5613141565b805f51602061429b5f395f51905f526131cc565b613211613141565b5f61321a6127f3565b9050825f5b818110156132615761325886868381811061323c5761323c6140c0565b90506020020160208101906132519190613920565b849061369a565b5060010161321f565b505060070180546001600160a01b0319166001600160a01b03929092169190911790555050565b5f5f5160206142fb5f395f51905f5261206d565b6132a5826136ae565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156132e9576119ce82826136f7565b611268613760565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561333e57602002820191905f5260205f20905b81548152602001906001019080831161332a575b50505050509050919050565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561338357505f91506003905082613408565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156133d4573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b0381166133ff57505f925060019150829050613408565b92505f91508190505b9450945094915050565b5f82600381111561342557613425614172565b0361342e575050565b600182600381111561344257613442614172565b036134605760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561347457613474614172565b036134955760405163fce698f760e01b815260048101829052602401611b33565b60038260038111156134a9576134a9614172565b03611268576040516335e2f38360e21b815260048101829052602401611b33565b5f51602061433b5f395f51905f525460ff1661278457604051638dfc202b60e01b815260040160405180910390fd5b5f5f5160206142db5f395f51905f5281613511612bdb565b80519091501561352957805160209091012092915050565b81548015613538579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b5f5f5160206142db5f395f51905f5281613579612c19565b80519091501561359157805160209091012092915050565b60018201548015613538579392505050565b5f6135ac61290b565b54600160401b900460ff16919050565b6135c4613141565b5f5160206142bb5f395f51905f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036135fd84826141ca565b506004810161289f83826141ca565b613614613141565b5f5160206142db5f395f51905f527fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10261364d84826141ca565b506003810161365c83826141ca565b505f8082556001909101555050565b613673613141565b807fb413d65cb88f23816c329284a0d3eb15a99df7963ab7402ade4c5da22bff6b006131cc565b5f61128a836001600160a01b03841661377f565b806001600160a01b03163b5f036136e357604051634c9c8ce360e01b81526001600160a01b0382166004820152602401611b33565b805f5160206142fb5f395f51905f526131cc565b60605f5f846001600160a01b0316846040516137139190614284565b5f60405180830381855af49150503d805f811461374b576040519150601f19603f3d011682016040523d82523d5f602084013e613750565b606091505b50915091506117dd8583836137cb565b34156127845760405163b398979f60e01b815260040160405180910390fd5b5f8181526001830160205260408120546137c457508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155611091565b505f611091565b6060826137e0576137db82613827565b61128a565b81511580156137f757506001600160a01b0384163b155b1561382057604051639996b31560e01b81526001600160a01b0385166004820152602401611b33565b508061128a565b80511561383657805160208201fd5b60405163d6bda27560e01b815260040160405180910390fd5b80356001600160a01b0381168114613865575f5ffd5b919050565b5f5f82840360e081121561387c575f5ffd5b6138858461384f565b925060c0601f1982011215613898575f5ffd5b506020830190509250929050565b5f5f5f606084860312156138b8575f5ffd5b6138c18461384f565b92506138cf6020850161384f565b929592945050506040919091013590565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61128a60208301846138e0565b5f60208284031215613930575f5ffd5b61128a8261384f565b5f5f6040838503121561394a575f5ffd5b6139538361384f565b946020939093013593505050565b5f60208284031215613971575f5ffd5b5035919050565b5f8151808452602084019350602083015f5b828110156139a857815186526020958601959091019060010161398a565b5093949350505050565b604081525f6139c46040830185613978565b82810360208401526117dd8185613978565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715613a1257613a126139d6565b604052919050565b5f5f6001600160401b03841115613a3357613a336139d6565b50601f8301601f1916602001613a48816139ea565b915050828152838383011115613a5c575f5ffd5b828260208301375f602084830101529392505050565b5f82601f830112613a81575f5ffd5b61128a83833560208501613a1a565b5f5f83601f840112613aa0575f5ffd5b5081356001600160401b03811115613ab6575f5ffd5b6020830191508360208260051b8501011115613ad0575f5ffd5b9250929050565b5f5f5f5f5f5f5f5f60e0898b031215613aee575f5ffd5b88356001600160401b03811115613b03575f5ffd5b613b0f8b828c01613a72565b98505060208901356001600160401b03811115613b2a575f5ffd5b613b368b828c01613a72565b975050613b4560408a0161384f565b9550613b5360608a0161384f565b9450613b6160808a0161384f565b935060a08901356001600160401b03811115613b7b575f5ffd5b613b878b828c01613a90565b9094509250613b9a905060c08a0161384f565b90509295985092959890939650565b5f5f60408385031215613bba575f5ffd5b613bc38361384f565b915060208301356001600160401b03811115613bdd575f5ffd5b8301601f81018513613bed575f5ffd5b613bfc85823560208401613a1a565b9150509250929050565b8015158114612476575f5ffd5b5f5f60408385031215613c24575f5ffd5b613c2d8361384f565b91506020830135613c3d81613c06565b809150509250929050565b5f5f5f5f5f60a08688031215613c5c575f5ffd5b613c658661384f565b94506020860135935060408601359250613c816060870161384f565b949793965091946080013592915050565b5f5f60408385031215613ca3575f5ffd5b613cac8361384f565b9150613cba6020840161384f565b90509250929050565b5f5f5f60608486031215613cd5575f5ffd5b613cde8461384f565b925060208401359150613cf36040850161384f565b90509250925092565b602080825282518282018190525f918401906040840190835b81811015613d3c5783516001600160a01b0316835260209384019390920191600101613d15565b509095945050505050565b60ff60f81b8816815260e060208201525f613d6560e08301896138e0565b8281036040840152613d7781896138e0565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050613da88185613978565b9a9950505050505050505050565b5f5f5f5f5f60808688031215613dca575f5ffd5b8535945060208601356001600160401b03811115613de6575f5ffd5b613df288828901613a90565b9095509350613e0590506040870161384f565b949793965091946060013592915050565b602081525f61128a6020830184613978565b5f5f5f5f5f5f5f60e0888a031215613e3e575f5ffd5b613e478861384f565b9650613e556020890161384f565b95506040880135945060608801359350608088013560ff81168114613e78575f5ffd5b9699959850939692959460a0840135945060c09093013592915050565b918252805115156020808401919091528101516001600160a01b039081166040808501919091528201516060808501919091529091015116608082015260a00190565b5f5f60408385031215613ee9575f5ffd5b505080516020909101519092909150565b600181811c90821680613f0e57607f821691505b602082108103613f2c57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561109157611091613f32565b5f82601f830112613f68575f5ffd5b81516001600160401b03811115613f8157613f816139d6565b8060051b613f91602082016139ea565b91825260208185018101929081019086841115613fac575f5ffd5b6020860192505b83831015613fce578251825260209283019290910190613fb3565b9695505050505050565b5f5f60408385031215613fe9575f5ffd5b82516001600160401b03811115613ffe575f5ffd5b61400a85828601613f59565b92505060208301516001600160401b03811115614025575f5ffd5b613bfc85828601613f59565b5f60208284031215614041575f5ffd5b5051919050565b8082018082111561109157611091613f32565b5f6101008201905083825260018060a01b03835116602083015260208301516040830152604083015160608301526060830151608083015260018060a01b0360808401511660a083015260a083015160c083015260c083015160e08301529392505050565b634e487b7160e01b5f52603260045260245ffd5b82815260406020820152815160408201525f602083015160c06060840152614100610100840182613978565b90506040840151603f1984830301608085015261411d8282613978565b91505060018060a01b0360608501511660a0840152608084015160c084015260a0840151603f198483030160e0850152613fce8282613978565b5f60208284031215614167575f5ffd5b815161128a81613c06565b634e487b7160e01b5f52602160045260245ffd5b601f8211156119ce57805f5260205f20601f840160051c810160208510156141ab5750805b601f840160051c820191505b81811015612540575f81556001016141b7565b81516001600160401b038111156141e3576141e36139d6565b6141f7816141f18454613efa565b84614186565b6020601f821160018114614229575f83156142125750848201515b5f19600385901b1c1916600184901b178455612540565b5f84815260208120601f198516915b828110156142585787850151825560209485019460019092019101614238565b508482101561427557868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82518060208501845e5f92019182525091905056fe3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe0052c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad100cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a2646970667358221220862a81b33eec25ac18add7f0f0063da1616e524e98f4ee790aa6043f6fee66f564736f6c634300081c0033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"prague","libraries":{"contracts/token/CapToken.sol:FractionalReserveLogic":"0xbacb4e5c6ea074e3065ea086b392c33dacf9c5e0","contracts/token/CapToken.sol:MinterLogic":"0x93812ed688143e4553708a5fa1b3624d8d59c760","contracts/token/CapToken.sol:VaultLogic":"0x651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8"},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[":@continuous-clearing-auction/=lib/continuous-clearing-auction/src/",":@ensdomains/=lib/continuous-clearing-auction/lib/v4-periphery/lib/v4-core/node_modules/@ensdomains/",":@layerzerolabs/interfaces/=lib/layerzero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/",":@layerzerolabs/lz-evm-messagelib-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/messagelib/",":@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero-v2/packages/layerzero-v2/evm/protocol/",":@layerzerolabs/lz-evm-v1-0.7/=lib/layerzero-v1/",":@layerzerolabs/oapp-alt-evm/=node_modules/@layerzerolabs/oapp-alt-evm/",":@layerzerolabs/oapp-evm-upgradeable/=lib/layerzero-devtools/packages/oapp-evm-upgradeable/",":@layerzerolabs/oapp-evm/=lib/layerzero-devtools/packages/oapp-evm/",":@layerzerolabs/oft-alt-evm/=node_modules/@layerzerolabs/oft-alt-evm/",":@layerzerolabs/oft-evm-upgradeable/=lib/layerzero-devtools/packages/oft-evm-upgradeable/",":@layerzerolabs/oft-evm/=lib/layerzero-devtools/packages/oft-evm/",":@layerzerolabs/test-devtools-evm-foundry/=lib/layerzero-devtools/packages/test-devtools-evm-foundry/",":@openzeppelin-v4.9.0/=node_modules/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/",":@openzeppelin/=node_modules/@openzeppelin/",":@predicate/=node_modules/@predicate/contracts/src/",":@symbioticfi/burners/=node_modules/@symbioticfi/burners/",":@symbioticfi/core/=node_modules/@symbioticfi/core/",":@symbioticfi/hooks/=node_modules/@symbioticfi/hooks/",":@symbioticfi/rewards/=node_modules/@symbioticfi/rewards/",":@tokenized-strategy/=lib/tokenized-strategy/src/",":@uniswap/=node_modules/@uniswap/",":blocknumberish/=lib/continuous-clearing-auction/lib/blocknumberish/",":btt/=lib/continuous-clearing-auction/test/btt/",":continuous-clearing-auction/=lib/continuous-clearing-auction/",":ds-test/=lib/layerzero-v2/lib/forge-std/lib/ds-test/src/",":eigenlayer-contracts/=node_modules/eigenlayer-contracts/",":eigenlayer-middleware/=lib/eigenlayer-middleware/",":eigenlayer/=node_modules/eigenlayer/",":erc4626-tests/=lib/tokenized-strategy/lib/erc4626-tests/",":forge-gas-snapshot/=lib/continuous-clearing-auction/lib/forge-gas-snapshot/src/",":forge-std/=lib/forge-std/src/",":halmos-cheatcodes/=lib/continuous-clearing-auction/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",":hardhat/=node_modules/hardhat/",":layerzero-devtools/=lib/layerzero-devtools/packages/toolbox-foundry/src/",":layerzero-v1/=lib/layerzero-v1/contracts/",":layerzero-v2/=lib/layerzero-v2/",":openzeppelin-contracts-upgradeable-v4.9.0/=node_modules/eigenlayer/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/",":openzeppelin-contracts-upgradeable/=node_modules/eigenlayer/lib/openzeppelin-contracts-upgradeable/",":openzeppelin-contracts-v4.9.0/=node_modules/eigenlayer/lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/",":openzeppelin-contracts/=node_modules/eigenlayer/lib/openzeppelin-contracts/",":openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",":openzeppelin-upgrades-v4.9.0/=node_modules/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/",":openzeppelin-upgrades/=node_modules/openzeppelin-upgrades/",":openzeppelin/=node_modules/openzeppelin/",":permit2/=lib/continuous-clearing-auction/lib/permit2/",":solady/=lib/continuous-clearing-auction/lib/solady/src/",":solidity-bytes-utils/contracts/=lib/solidity-bytes-utils/contracts/",":solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",":solmate/=lib/continuous-clearing-auction/lib/permit2/lib/solmate/",":test/=lib/continuous-clearing-auction/test/",":tokenized-strategy/=lib/tokenized-strategy/",":v4-core/=lib/continuous-clearing-auction/lib/v4-periphery/lib/v4-core/src/",":v4-periphery/=lib/continuous-clearing-auction/lib/v4-periphery/"]},"optimization_runs":200,"sourcify_repo_url":"https://repo.sourcify.dev/contracts/partial_match/1/0xbDaa34082F1a1a3c32190a672bC9dd1b69791b97/","decoded_constructor_args":null,"compiler_version":"0.8.28+commit.7893614a","is_verified_via_verifier_alliance":false,"verified_at":"2026-09-26T00:19:15.729506Z","implementations":[],"proxy_type":null,"external_libraries":[{"name":"contracts/token/CapToken.sol:FractionalReserveLogic","address_hash":"0xBACb4e5c6eA074e3065EA086B392C33dACF9c5e0"},{"name":"contracts/token/CapToken.sol:MinterLogic","address_hash":"0x93812Ed688143E4553708a5Fa1B3624D8d59c760"},{"name":"contracts/token/CapToken.sol:VaultLogic","address_hash":"0x651Ea1754c50B26C09fdb45C8b3b6D13Fd7E72a8"}],"creation_bytecode":"0x60a060405230608052348015610013575f5ffd5b5061001c610021565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100715760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516143906100f95f395f8181612987015281816129b00152612adb01526143905ff3fe6080604052600436106103be575f3560e01c80637ecebe00116101f4578063baf11db811610113578063d505accf116100a8578063df6e7cc811610078578063df6e7cc814610c4c578063e75179a414610c6b578063f878369e14610c8a578063f93b6be514610ca9578063feee175614610cbd575f5ffd5b8063d505accf14610ba4578063d936547e14610bc3578063dbf6248914610c19578063dd62ed3e14610c2d575f5ffd5b8063c6d98f1a116100e3578063c6d98f1a14610b12578063c77cf61514610b45578063caf1803714610b59578063cf23a0c614610b78575f5ffd5b8063baf11db814610a62578063bf20d9dc14610ab5578063c3c0529314610ad4578063c5e72a1714610af3575f5ffd5b80639abacb4111610189578063ad3cb1cc11610159578063ad3cb1cc146109e0578063adc5ce6e14610a10578063b790230314610a2f578063b7c4a6bf14610a43575f5ffd5b80639abacb4114610964578063a0821be314610983578063a4450587146109a2578063a9059cbb146109c1575f5ffd5b80638d730124116101c45780638d730124146108fe578063908ab68c1461091d57806395d89b41146109315780639782e82114610945575f5ffd5b80637ecebe001461082b57806384b0196e1461084a5780638a7595ad146108715780638bee2a8e14610890575f5ffd5b80633753b14a116102e05780635c975abb1161027557806370a082311161024557806370a08231146107ad57806371a97305146107cc578063753842db146107ed57806378250b631461080c575f5ffd5b80635c975abb1461072d5780635d799f87146107505780635d841af51461076f5780636c665a551461078e575f5ffd5b80634f24d20a116102b05780634f24d20a146106bc57806352d1902d146106db57806353d6fd59146106ef578063561279871461070e575f5ffd5b80633753b14a1461064c57806341d951261461066b5780634a5e42b11461068a5780634f1ef286146106a9575f5ffd5b806320b71534116103565780632c3ee88c116103265780632c3ee88c146105d15780632e48152c146105fe578063313ce5671461061d5780633644e51514610638575f5ffd5b806320b715341461055557806322867d781461057457806323b872dd14610593578063298410e5146105b2575f5ffd5b8063095ea7b311610391578063095ea7b31461046a57806318160ddd1461049957806318dfd788146104cc578063195d0e2814610536575f5ffd5b8063012ea17c146103c257806304b102c8146103e357806306fdde031461041c578063082bf6e81461043d575b5f5ffd5b3480156103cd575f5ffd5b506103e16103dc36600461386a565b610cdc565b005b3480156103ee575f5ffd5b506104026103fd3660046138a6565b610ee9565b604080519283526020830191909152015b60405180910390f35b348015610427575f5ffd5b50610430610fa4565b604051610413919061390e565b348015610448575f5ffd5b5061045c610457366004613920565b611049565b604051908152602001610413565b348015610475575f5ffd5b50610489610484366004613939565b61107e565b6040519015158152602001610413565b3480156104a4575f5ffd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025461045c565b3480156104d7575f5ffd5b506104eb6104e6366004613920565b611097565b60405161041391905f60c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b348015610541575f5ffd5b50610402610550366004613939565b61114a565b348015610560575f5ffd5b5061045c61056f366004613920565b61116e565b34801561057f575f5ffd5b506103e161058e366004613939565b6111a7565b34801561059e575f5ffd5b506104896105ad3660046138a6565b61126c565b3480156105bd575f5ffd5b506103e16105cc366004613920565b611291565b3480156105dc575f5ffd5b506105f06105eb366004613961565b611323565b6040516104139291906139b2565b348015610609575f5ffd5b50610489610618366004613920565b6113e0565b348015610628575f5ffd5b5060405160128152602001610413565b348015610643575f5ffd5b5061045c61140d565b348015610657575f5ffd5b506103e1610666366004613920565b61141b565b348015610676575f5ffd5b506103e1610685366004613ad7565b61144e565b348015610695575f5ffd5b506103e16106a4366004613920565b61155b565b6103e16106b7366004613ba9565b61158e565b3480156106c7575f5ffd5b5061045c6106d6366004613920565b6115a9565b3480156106e6575f5ffd5b5061045c611640565b3480156106fa575f5ffd5b506103e1610709366004613c13565b61165b565b348015610719575f5ffd5b5061045c610728366004613c48565b6116e6565b348015610738575f5ffd5b505f51602061433b5f395f51905f525460ff16610489565b34801561075b575f5ffd5b506103e161076a366004613c92565b6117e6565b34801561077a575f5ffd5b506103e1610789366004613961565b611894565b348015610799575f5ffd5b506103e16107a8366004613cc3565b6118ef565b3480156107b8575f5ffd5b5061045c6107c7366004613920565b6119d3565b3480156107d7575f5ffd5b506107e0611a03565b6040516104139190613cfc565b3480156107f8575f5ffd5b506103e1610807366004613920565b611a15565b348015610817575f5ffd5b506103e1610826366004613939565b611a53565b348015610836575f5ffd5b5061045c610845366004613920565b611abe565b348015610855575f5ffd5b5061085e611ac8565b6040516104139796959493929190613d47565b34801561087c575f5ffd5b506103e161088b366004613c92565b611b76565b34801561089b575f5ffd5b506108e66108aa366004613920565b6001600160a01b039081165f9081527f5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad10360205260409020541690565b6040516001600160a01b039091168152602001610413565b348015610909575f5ffd5b5061045c610918366004613920565b611c83565b348015610928575f5ffd5b506107e0611cad565b34801561093c575f5ffd5b50610430611cd8565b348015610950575f5ffd5b5061045c61095f366004613920565b611d16565b34801561096f575f5ffd5b506103e161097e366004613920565b611d40565b34801561098e575f5ffd5b5061045c61099d366004613920565b611d73565b3480156109ad575f5ffd5b5061045c6109bc366004613c48565b611d96565b3480156109cc575f5ffd5b506104896109db366004613939565b611eb7565b3480156109eb575f5ffd5b50610430604051806040016040528060058152602001640352e302e360dc1b81525081565b348015610a1b575f5ffd5b506103e1610a2a366004613920565b611ec4565b348015610a3a575f5ffd5b506108e6611f02565b348015610a4e575f5ffd5b50610402610a5d366004613939565b611f1d565b348015610a6d575f5ffd5b5061045c610a7c366004613920565b6001600160a01b03165f9081527f5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad101602052604090205490565b348015610ac0575f5ffd5b5061045c610acf366004613920565b611fd5565b348015610adf575f5ffd5b506103e1610aee366004613920565b611ff8565b348015610afe575f5ffd5b50610402610b0d3660046138a6565b61202b565b348015610b1d575f5ffd5b507f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe015461045c565b348015610b50575f5ffd5b506108e661205d565b348015610b64575f5ffd5b506105f0610b73366004613939565b61207c565b348015610b83575f5ffd5b50610b97610b92366004613db6565b612133565b6040516104139190613e16565b348015610baf575f5ffd5b506103e1610bbe366004613e28565b612308565b348015610bce575f5ffd5b50610489610bdd366004613920565b6001600160a01b03165f9081527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe03602052604090205460ff1690565b348015610c24575f5ffd5b506103e161245d565b348015610c38575f5ffd5b5061045c610c47366004613c92565b612479565b348015610c57575f5ffd5b506103e1610c66366004613920565b6124c2565b348015610c76575f5ffd5b5061045c610c85366004613920565b612547565b348015610c95575f5ffd5b506103e1610ca4366004613939565b61255b565b348015610cb4575f5ffd5b506103e16125db565b348015610cc8575f5ffd5b5061045c610cd7366004613920565b6125f4565b624ba85f60e21b610cec81612617565b6a295be96e64066972000000823510610d1857604051630e7fd4ad60e21b815260040160405180910390fd5b6b033b2e3c9fd0803ce80000008260600135101580610d3957506060820135155b15610d57576040516304d9bf5d60e21b815260040160405180910390fd5b6b033b2e3c9fd0803ce80000008260800135101580610d7857506080820135155b15610d9657604051632a41299560e01b815260040160405180910390fd5b6b033b2e3c9fd0803ce80000008260a00135101580610db7575060a0820135155b15610dd557604051633cb8e73560e11b815260040160405180910390fd5b81606001358260a001351480610df2575081608001358260a00135145b15610e1057604051633cb8e73560e11b815260040160405180910390fd5b6001600160a01b0383165f8181527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe0260209081526040918290208535808255868301356001830181905587850135600284018190556060808a0135600386018190556080808c01356004880181905560a0808e013560059099018990558a519b8c52988b019690965297890193909352870152938501939093529083019190915260c08201527fb80d92aa6c2285ae4a8f342a6066af0fa35893e1853656935ec70c4fa2937d8f9060e0015b60405180910390a1505050565b604080516080810182525f8082526001600160a01b038581166020840152828401859052861660608301529151632d761af360e01b815282917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391610f5a915f51602061429b5f395f51905f529190600401613e95565b6040805180830381865af4158015610f74573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f989190613ed8565b90969095509350505050565b60605f5f5160206142bb5f395f51905f525b9050806003018054610fc790613efa565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff390613efa565b801561103e5780601f106110155761010080835404028352916020019161103e565b820191905f5260205f20905b81548152906001019060200180831161102157829003601f168201915b505050505091505090565b5f5f61105483611d16565b90505f6110608461116e565b905081811115611077576110748282613f46565b92505b5050919050565b5f3361108b8185856126d7565b60019150505b92915050565b6110ca6040518060c001604052805f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b506001600160a01b03165f9081527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe026020908152604091829020825160c08101845281548152600182015492810192909252600281015492820192909252600382015460608201526004820154608082015260059091015460a082015290565b5f5f5f61115685611049565b905080841115611164578093505b610f9885856126e4565b6001600160a01b03165f9081527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe04602052604090205490565b6111af612754565b6111b7612786565b630450cfaf60e31b6111c881612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8632ebadfbe6111ea6127f3565b6040805180820182526001600160a01b0380891682526020820188815292516001600160e01b031960e087901b168152600481019490945290511660248301525160448201526064015f6040518083038186803b158015611249575f5ffd5b505af415801561125b573d5f5f3e3d5ffd5b5050505050611268612817565b5050565b5f33611279858285612841565b6112848585856128a5565b60019150505b9392505050565b63298410e560e01b6112a281612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863a18a81976112c46127f3565b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b03851660248201526044015b5f6040518083038186803b158015611309575f5ffd5b505af415801561131b573d5f5f3e3d5ffd5b505050505050565b6060807393812ed688143e4553708a5fa1b3624d8d59c760634bfcc81c5f51602061429b5f395f51905f526040805180820182528781523360208201908152915160e085901b6001600160e01b03191681526004810193909352516024830152516001600160a01b031660448201526064015f60405180830381865af41580156113af573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526113d69190810190613fd8565b9094909350915050565b5f6113e96127f3565b6001600160a01b039092165f90815260069290920160205250604090205460ff1690565b5f611416612902565b905090565b631ba9d8a560e11b61142c81612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863dd360ac96112c46127f3565b5f61145761290b565b805490915060ff600160401b82041615906001600160401b03165f8115801561147d5750825b90505f826001600160401b031660011480156114985750303b155b9050811580156114a6575080155b156114c45760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156114ee57845460ff60401b1916600160401b1785555b6114fe8d8d8d8d8d8d8d8d612933565b611506612974565b831561154c57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050505050565b634a5e42b160e01b61156c81612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863c709ad176112c46127f3565b61159661297c565b61159f82612a0a565b6112688282612a14565b5f73bacb4e5c6ea074e3065ea086b392c33dacf9c5e0631ae6b4d15f51602061431b5f395f51905f525b6040516001600160e01b031960e084901b16815260048101919091526001600160a01b0385166024820152604401602060405180830381865af415801561161c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110919190614031565b5f611649612ad0565b505f5160206142fb5f395f51905f5290565b6353d6fd5960e01b61166c81612617565b6001600160a01b0383165f8181527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe036020908152604091829020805460ff19168615159081179091558251938452908301527ff6019ec0a78d156d249a1ec7579e2321f6ac7521d6e1d2eacf90ba4a184dcceb9101610edc565b5f6116ef612754565b6116f7612786565b5f6117028787611f1d565b90925090506117113387612b19565b6117248761171f8385614048565b612b4d565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8637be70bae6117466127f3565b6040518060e001604052808b6001600160a01b031681526020018a8152602001868152602001898152602001886001600160a01b03168152602001878152602001858152506040518363ffffffff1660e01b81526004016117a892919061405b565b5f6040518083038186803b1580156117be575f5ffd5b505af41580156117d0573d5f5f3e3d5ffd5b50505050506117dd612817565b95945050505050565b635d799f8760e01b6117f781612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8633687471f6118196127f3565b5f51602061431b5f395f51905f526040516001600160e01b031960e085901b168152600481019290925260248201526001600160a01b038087166044830152851660648201526084015b5f6040518083038186803b158015611879575f5ffd5b505af415801561188b573d5f5f3e3d5ffd5b50505050505050565b635d841af560e01b6118a581612617565b815f51602061429b5f395f51905f52600101556040518281527fc2045f7458ee2982ac24e8bc693c0924341b1d70475de942852d90e121fc77609060200160405180910390a15050565b6118f7612754565b6118ff612786565b636c665a5560e01b61191081612617565b61191a8484612b4d565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863ebd0396d61193c6127f3565b604080516060810182526001600160a01b03808a1682526020820189815288821683850190815293516001600160e01b031960e088901b16815260048101959095529151811660248501529051604484015290511660648201526084015f6040518083038186803b1580156119af575f5ffd5b505af41580156119c1573d5f5f3e3d5ffd5b50505050506119ce612817565b505050565b5f805f5160206142bb5f395f51905f525b6001600160a01b039093165f9081526020939093525050604090205490565b6060611416611a106127f3565b612ba7565b63753842db60e01b611a2681612617565b73bacb4e5c6ea074e3065ea086b392c33dacf9c5e063fdcc2aa45f51602061431b5f395f51905f526112c4565b6378250b6360e01b611a6481612617565b60405163938e51cf60e01b81525f51602061431b5f395f51905f5260048201526001600160a01b03841660248201526044810183905273bacb4e5c6ea074e3065ea086b392c33dacf9c5e09063938e51cf90606401611863565b5f61109182612bb3565b5f60608082808083815f5160206142db5f395f51905f528054909150158015611af357506001810154155b611b3c5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b60448201526064015b60405180910390fd5b611b44612bdb565b611b4c612c19565b604080515f80825260208201909252600f60f81b9c939b5091995046985030975095509350915050565b638a7595ad60e01b611b8781612617565b5f5f51602061431b5f395f51905f52604051632969be0760e11b8152600481018290526001600160a01b038616602482015290915073bacb4e5c6ea074e3065ea086b392c33dacf9c5e0906352d37c0e906044015f6040518083038186803b158015611bf1575f5ffd5b505af4158015611c03573d5f5f3e3d5ffd5b505060405163c431765760e01b8152600481018490526001600160a01b0380881660248301528616604482015273bacb4e5c6ea074e3065ea086b392c33dacf9c5e0925063c431765791506064015f6040518083038186803b158015611c67575f5ffd5b505af4158015611c79573d5f5f3e3d5ffd5b5050505050505050565b5f611c8c6127f3565b6001600160a01b039092165f90815260039290920160205250604090205490565b60606114167f5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad104612ba7565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0480546060915f5160206142bb5f395f51905f5291610fc790613efa565b5f611d1f6127f3565b6001600160a01b039092165f90815260029290920160205250604090205490565b639abacb4160e01b611d5181612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a86316488ca66112c46127f3565b5f73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a86350ba58276115d36127f3565b5f611d9f612754565b611da7612786565b5f5f611db288611049565b905080871115611dc0578096505b611dca88886126e4565b909350915073651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863fe209c31611df16127f3565b6040518060e001604052808c6001600160a01b031681526020018b81526020018781526020018a8152602001896001600160a01b03168152602001888152602001868152506040518363ffffffff1660e01b8152600401611e5392919061405b565b5f6040518083038186803b158015611e69575f5ffd5b505af4158015611e7b573d5f5f3e3d5ffd5b50505050611e898584612c2f565b8115611ead57611ead611e9a6127f3565b600701546001600160a01b031683612c2f565b50506117dd612817565b5f3361108b8185856128a5565b6356e2e73760e11b611ed581612617565b73bacb4e5c6ea074e3065ea086b392c33dacf9c5e06352d37c0e5f51602061431b5f395f51905f526112c4565b5f611f0b6127f3565b600701546001600160a01b0316919050565b604080516080810182525f8082526001600160a01b03851660208301528183018490523360608301529151632d761af360e01b815282917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391611f8c915f51602061429b5f395f51905f529190600401613e95565b6040805180830381865af4158015611fa6573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611fca9190613ed8565b909590945092505050565b5f73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8630f82ffd06115d36127f3565b63c3c0529360e01b61200981612617565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863d8417d626112c46127f3565b5f5f5f61203785611049565b905080841115612045578093505b612050868686612c63565b9097909650945050505050565b5f5f51602061431b5f395f51905f525b546001600160a01b0316919050565b6060807393812ed688143e4553708a5fa1b3624d8d59c760634bfcc81c5f51602061429b5f395f51905f526040805180820182528781526001600160a01b03808a166020830190815292516001600160e01b031960e087901b16815260048101949094529051602484015290511660448201526064015f60405180830381865af415801561210c573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611fca9190810190613fd8565b606061213d612754565b612145612786565b606061215087611323565b909250905061215f3388612b19565b5f82516001600160401b03811115612179576121796139d6565b6040519080825280602002602001820160405280156121a2578160200160208202803683370190505b5090505f5b8351811015612213578281815181106121c2576121c26140c0565b60200260200101518482815181106121dc576121dc6140c0565b60200260200101516121ee9190614048565b828281518110612200576122006140c0565b60209081029190910101526001016121a7565b5061222561221f611a03565b82612cd5565b73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a863e81d65616122476127f3565b6040518060c001604052808c81526020018781526020018b8b808060200260200160405190810160405280939291908181526020018383602002808284375f920191909152505050908252506001600160a01b038a16602082015260408082018a90526060909101879052516001600160e01b031960e085901b1681526122d29291906004016140d4565b5f6040518083038186803b1580156122e8575f5ffd5b505af41580156122fa573d5f5f3e3d5ffd5b5050505050506117dd612817565b8342111561232c5760405163313c898160e11b815260048101859052602401611b33565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886123968c6001600160a01b03165f9081527f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb006020526040902080546001810190915590565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f6123f082612dac565b90505f6123ff82878787612dd8565b9050896001600160a01b0316816001600160a01b031614612446576040516325c0072360e11b81526001600160a01b0380831660048301528b166024820152604401611b33565b6124518a8a8a6126d7565b50505050505050505050565b63dbf6248960e01b61246e81612617565b612476612e04565b50565b6001600160a01b039182165f9081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b73bacb4e5c6ea074e3065ea086b392c33dacf9c5e063201d48c05f51602061431b5f395f51905f526040516001600160e01b031960e084901b16815260048101919091526001600160a01b03841660248201526044015f6040518083038186803b15801561252e575f5ffd5b505af4158015612540573d5f5f3e3d5ffd5b5050505050565b5f5f51602061431b5f395f51905f52611d1f565b637c3c1b4f60e11b61256c81612617565b6001600160a01b0383165f8181527f3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe046020908152604091829020859055815192835282018490527f2a82c7b7f2539b4a75f05cda23dc12990cf8e212d55c2a3b6bb6d0d36b08b0059101610edc565b63f93b6be560e01b6125ec81612617565b612476612e66565b5f73651ea1754c50b26c09fdb45c8b3b6d13fd7e72a8633c0541276115d36127f3565b5f7fb413d65cb88f23816c329284a0d3eb15a99df7963ab7402ade4c5da22bff6b0054604051633657648360e21b81526001600160e01b0319841660048201523060248201523360448201526001600160a01b039091169063d95d920c90606401602060405180830381865afa158015612693573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126b79190614157565b90508061126857604051634ca8886760e01b815260040160405180910390fd5b6119ce8383836001612eab565b60408051608081018252600181526001600160a01b03841660208201528082018390523360608201529051632d761af360e01b81525f9182917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391611f8c915f51602061429b5f395f51905f5291600401613e95565b5f51602061433b5f395f51905f525460ff16156127845760405163d93c066560e01b815260040160405180910390fd5b565b7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005c156127c657604051633ee5aeb560e01b815260040160405180910390fd5b61278460017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f005b90612f8e565b7fe912a1b0cc7579bc5827e495c2ce52587bc3871751e3281fc5599b38c3bfc40090565b6127845f7f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f006127ed565b5f61284c8484612479565b90505f1981101561289f578181101561289157604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401611b33565b61289f84848484035f612eab565b50505050565b6001600160a01b0383166128ce57604051634b637e8f60e11b81525f6004820152602401611b33565b6001600160a01b0382166128f75760405163ec442f0560e01b81525f6004820152602401611b33565b6119ce838383612f95565b5f6114166130ce565b5f807ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00611091565b61293b613141565b6129458888613166565b61294e88613178565b612957866131a3565b612960856131b4565b612969846131ed565b611c79838383613209565b612784613141565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806129ec57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166129e0613288565b6001600160a01b031614155b156127845760405163703e46dd60e11b815260040160405180910390fd5b5f61126881612617565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612a6e575060408051601f3d908101601f19168201909252612a6b91810190614031565b60015b612a9657604051634c9c8ce360e01b81526001600160a01b0383166004820152602401611b33565b5f5160206142fb5f395f51905f528114612ac657604051632a87526960e21b815260048101829052602401611b33565b6119ce838361329c565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146127845760405163703e46dd60e11b815260040160405180910390fd5b6001600160a01b038216612b4257604051634b637e8f60e11b81525f6004820152602401611b33565b611268825f83612f95565b604051630a78cab560e31b81525f51602061431b5f395f51905f5260048201526001600160a01b03831660248201526044810182905273bacb4e5c6ea074e3065ea086b392c33dacf9c5e0906353c655a8906064016112f3565b60605f61128a836132f1565b5f807f5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb006119e4565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10280546060915f5160206142db5f395f51905f5291610fc790613efa565b60605f5f5160206142db5f395f51905f52610fb6565b6001600160a01b038216612c585760405163ec442f0560e01b81525f6004820152602401611b33565b6112685f8383612f95565b60408051608081018252600181526001600160a01b038481166020830152818301849052851660608201529051632d761af360e01b81525f9182917393812ed688143e4553708a5fa1b3624d8d59c76091632d761af391610f5a915f51602061429b5f395f51905f5291600401613e95565b5f51602061431b5f395f51905f525f5b835181101561289f5773bacb4e5c6ea074e3065ea086b392c33dacf9c5e06353c655a883868481518110612d1b57612d1b6140c0565b6020026020010151868581518110612d3557612d356140c0565b60200260200101516040518463ffffffff1660e01b8152600401612d75939291909283526001600160a01b03919091166020830152604082015260600190565b5f6040518083038186803b158015612d8b575f5ffd5b505af4158015612d9d573d5f5f3e3d5ffd5b50505050806001019050612ce5565b5f611091612db8612902565b8360405161190160f01b8152600281019290925260228201526042902090565b5f5f5f5f612de88888888861334a565b925092509250612df88282613412565b50909695505050505050565b612e0c612754565b5f51602061433b5f395f51905f52805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a150565b612e6e6134ca565b5f51602061433b5f395f51905f52805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612e48565b5f5160206142bb5f395f51905f526001600160a01b038516612ee25760405163e602df0560e01b81525f6004820152602401611b33565b6001600160a01b038416612f0b57604051634a1406b160e11b81525f6004820152602401611b33565b6001600160a01b038086165f9081526001830160209081526040808320938816835292905220839055811561254057836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051612f7f91815260200190565b60405180910390a35050505050565b80825d5050565b5f5160206142bb5f395f51905f526001600160a01b038416612fcf5781816002015f828254612fc49190614048565b9091555061303f9050565b6001600160a01b0384165f90815260208290526040902054828110156130215760405163391434e360e21b81526001600160a01b03861660048201526024810182905260448101849052606401611b33565b6001600160a01b0385165f9081526020839052604090209083900390555b6001600160a01b03831661305d57600281018054839003905561307b565b6001600160a01b0383165f9081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516130c091815260200190565b60405180910390a350505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6130f86134f9565b613100613561565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6131496135a3565b61278457604051631afcd79f60e31b815260040160405180910390fd5b61316e613141565b61126882826135bc565b613180613141565b61247681604051806040016040528060018152602001603160f81b81525061360c565b6131ab613141565b6124768161366b565b6131bc613141565b805f51602061431b5f395f51905f525b80546001600160a01b0319166001600160a01b039290921691909117905550565b6131f5613141565b805f51602061429b5f395f51905f526131cc565b613211613141565b5f61321a6127f3565b9050825f5b818110156132615761325886868381811061323c5761323c6140c0565b90506020020160208101906132519190613920565b849061369a565b5060010161321f565b505060070180546001600160a01b0319166001600160a01b03929092169190911790555050565b5f5f5160206142fb5f395f51905f5261206d565b6132a5826136ae565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156132e9576119ce82826136f7565b611268613760565b6060815f0180548060200260200160405190810160405280929190818152602001828054801561333e57602002820191905f5260205f20905b81548152602001906001019080831161332a575b50505050509050919050565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561338357505f91506003905082613408565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156133d4573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b0381166133ff57505f925060019150829050613408565b92505f91508190505b9450945094915050565b5f82600381111561342557613425614172565b0361342e575050565b600182600381111561344257613442614172565b036134605760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561347457613474614172565b036134955760405163fce698f760e01b815260048101829052602401611b33565b60038260038111156134a9576134a9614172565b03611268576040516335e2f38360e21b815260048101829052602401611b33565b5f51602061433b5f395f51905f525460ff1661278457604051638dfc202b60e01b815260040160405180910390fd5b5f5f5160206142db5f395f51905f5281613511612bdb565b80519091501561352957805160209091012092915050565b81548015613538579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b5f5f5160206142db5f395f51905f5281613579612c19565b80519091501561359157805160209091012092915050565b60018201548015613538579392505050565b5f6135ac61290b565b54600160401b900460ff16919050565b6135c4613141565b5f5160206142bb5f395f51905f527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace036135fd84826141ca565b506004810161289f83826141ca565b613614613141565b5f5160206142db5f395f51905f527fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10261364d84826141ca565b506003810161365c83826141ca565b505f8082556001909101555050565b613673613141565b807fb413d65cb88f23816c329284a0d3eb15a99df7963ab7402ade4c5da22bff6b006131cc565b5f61128a836001600160a01b03841661377f565b806001600160a01b03163b5f036136e357604051634c9c8ce360e01b81526001600160a01b0382166004820152602401611b33565b805f5160206142fb5f395f51905f526131cc565b60605f5f846001600160a01b0316846040516137139190614284565b5f60405180830381855af49150503d805f811461374b576040519150601f19603f3d011682016040523d82523d5f602084013e613750565b606091505b50915091506117dd8583836137cb565b34156127845760405163b398979f60e01b815260040160405180910390fd5b5f8181526001830160205260408120546137c457508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155611091565b505f611091565b6060826137e0576137db82613827565b61128a565b81511580156137f757506001600160a01b0384163b155b1561382057604051639996b31560e01b81526001600160a01b0385166004820152602401611b33565b508061128a565b80511561383657805160208201fd5b60405163d6bda27560e01b815260040160405180910390fd5b80356001600160a01b0381168114613865575f5ffd5b919050565b5f5f82840360e081121561387c575f5ffd5b6138858461384f565b925060c0601f1982011215613898575f5ffd5b506020830190509250929050565b5f5f5f606084860312156138b8575f5ffd5b6138c18461384f565b92506138cf6020850161384f565b929592945050506040919091013590565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61128a60208301846138e0565b5f60208284031215613930575f5ffd5b61128a8261384f565b5f5f6040838503121561394a575f5ffd5b6139538361384f565b946020939093013593505050565b5f60208284031215613971575f5ffd5b5035919050565b5f8151808452602084019350602083015f5b828110156139a857815186526020958601959091019060010161398a565b5093949350505050565b604081525f6139c46040830185613978565b82810360208401526117dd8185613978565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715613a1257613a126139d6565b604052919050565b5f5f6001600160401b03841115613a3357613a336139d6565b50601f8301601f1916602001613a48816139ea565b915050828152838383011115613a5c575f5ffd5b828260208301375f602084830101529392505050565b5f82601f830112613a81575f5ffd5b61128a83833560208501613a1a565b5f5f83601f840112613aa0575f5ffd5b5081356001600160401b03811115613ab6575f5ffd5b6020830191508360208260051b8501011115613ad0575f5ffd5b9250929050565b5f5f5f5f5f5f5f5f60e0898b031215613aee575f5ffd5b88356001600160401b03811115613b03575f5ffd5b613b0f8b828c01613a72565b98505060208901356001600160401b03811115613b2a575f5ffd5b613b368b828c01613a72565b975050613b4560408a0161384f565b9550613b5360608a0161384f565b9450613b6160808a0161384f565b935060a08901356001600160401b03811115613b7b575f5ffd5b613b878b828c01613a90565b9094509250613b9a905060c08a0161384f565b90509295985092959890939650565b5f5f60408385031215613bba575f5ffd5b613bc38361384f565b915060208301356001600160401b03811115613bdd575f5ffd5b8301601f81018513613bed575f5ffd5b613bfc85823560208401613a1a565b9150509250929050565b8015158114612476575f5ffd5b5f5f60408385031215613c24575f5ffd5b613c2d8361384f565b91506020830135613c3d81613c06565b809150509250929050565b5f5f5f5f5f60a08688031215613c5c575f5ffd5b613c658661384f565b94506020860135935060408601359250613c816060870161384f565b949793965091946080013592915050565b5f5f60408385031215613ca3575f5ffd5b613cac8361384f565b9150613cba6020840161384f565b90509250929050565b5f5f5f60608486031215613cd5575f5ffd5b613cde8461384f565b925060208401359150613cf36040850161384f565b90509250925092565b602080825282518282018190525f918401906040840190835b81811015613d3c5783516001600160a01b0316835260209384019390920191600101613d15565b509095945050505050565b60ff60f81b8816815260e060208201525f613d6560e08301896138e0565b8281036040840152613d7781896138e0565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050613da88185613978565b9a9950505050505050505050565b5f5f5f5f5f60808688031215613dca575f5ffd5b8535945060208601356001600160401b03811115613de6575f5ffd5b613df288828901613a90565b9095509350613e0590506040870161384f565b949793965091946060013592915050565b602081525f61128a6020830184613978565b5f5f5f5f5f5f5f60e0888a031215613e3e575f5ffd5b613e478861384f565b9650613e556020890161384f565b95506040880135945060608801359350608088013560ff81168114613e78575f5ffd5b9699959850939692959460a0840135945060c09093013592915050565b918252805115156020808401919091528101516001600160a01b039081166040808501919091528201516060808501919091529091015116608082015260a00190565b5f5f60408385031215613ee9575f5ffd5b505080516020909101519092909150565b600181811c90821680613f0e57607f821691505b602082108103613f2c57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561109157611091613f32565b5f82601f830112613f68575f5ffd5b81516001600160401b03811115613f8157613f816139d6565b8060051b613f91602082016139ea565b91825260208185018101929081019086841115613fac575f5ffd5b6020860192505b83831015613fce578251825260209283019290910190613fb3565b9695505050505050565b5f5f60408385031215613fe9575f5ffd5b82516001600160401b03811115613ffe575f5ffd5b61400a85828601613f59565b92505060208301516001600160401b03811115614025575f5ffd5b613bfc85828601613f59565b5f60208284031215614041575f5ffd5b5051919050565b8082018082111561109157611091613f32565b5f6101008201905083825260018060a01b03835116602083015260208301516040830152604083015160608301526060830151608083015260018060a01b0360808401511660a083015260a083015160c083015260c083015160e08301529392505050565b634e487b7160e01b5f52603260045260245ffd5b82815260406020820152815160408201525f602083015160c06060840152614100610100840182613978565b90506040840151603f1984830301608085015261411d8282613978565b91505060018060a01b0360608501511660a0840152608084015160c084015260a0840151603f198483030160e0850152613fce8282613978565b5f60208284031215614167575f5ffd5b815161128a81613c06565b634e487b7160e01b5f52602160045260245ffd5b601f8211156119ce57805f5260205f20601f840160051c810160208510156141ab5750805b601f840160051c820191505b81811015612540575f81556001016141b7565b81516001600160401b038111156141e3576141e36139d6565b6141f7816141f18454613efa565b84614186565b6020601f821160018114614229575f83156142125750848201515b5f19600385901b1c1916600184901b178455612540565b5f84815260208120601f198516915b828110156142585787850151825560209485019460019092019101614238565b508482101561427557868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b5f82518060208501845e5f92019182525091905056fe3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe0052c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad100cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a2646970667358221220862a81b33eec25ac18add7f0f0063da1616e524e98f4ee790aa6043f6fee66f564736f6c634300081c0033","name":"CapToken","is_blueprint":false,"license_type":"none","is_fully_verified":false,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"prague","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":true,"additional_sources":[{"file_path":"contracts/interfaces/IOracleTypes.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\n/// @title Oracle Types\n/// @author kexley, Cap Labs\n/// @notice Oracle types\ninterface IOracleTypes {\n    /// @notice Oracle data\n    /// @param adapter Adapter address\n    /// @param payload Payload for the adapter\n    struct OracleData {\n        address adapter;\n        bytes payload;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/StorageSlot.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\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 * 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        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `Int256Slot` with member `value` located at `slot`.\n     */\n    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n        assembly (\"memory-safe\") {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns a `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        assembly (\"memory-safe\") {\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        assembly (\"memory-safe\") {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns a `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        assembly (\"memory-safe\") {\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        assembly (\"memory-safe\") {\n            r.slot := store.slot\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC6093.sol)\npragma solidity >=0.8.4;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Return the 512-bit addition of two uint256.\n     *\n     * The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.\n     */\n    function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        assembly (\"memory-safe\") {\n            low := add(a, b)\n            high := lt(low, a)\n        }\n    }\n\n    /**\n     * @dev Return the 512-bit multiplication of two uint256.\n     *\n     * The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.\n     */\n    function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {\n        // 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n        // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n        // variables such that product = high * 2²⁵⁶ + low.\n        assembly (\"memory-safe\") {\n            let mm := mulmod(a, b, not(0))\n            low := mul(a, b)\n            high := sub(sub(mm, low), lt(mm, low))\n        }\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a + b;\n            success = c >= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a - b;\n            success = c <= a;\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            uint256 c = a * b;\n            assembly (\"memory-safe\") {\n                // Only true when the multiplication doesn't overflow\n                // (c / a == b) || (a == 0)\n                success := or(eq(div(c, a), b), iszero(a))\n            }\n            // equivalent to: success ? c : 0\n            result = c * SafeCast.toUint(success);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `DIV` opcode returns zero when the denominator is 0.\n                result := div(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n        unchecked {\n            success = b > 0;\n            assembly (\"memory-safe\") {\n                // The `MOD` opcode returns zero when the denominator is 0.\n                result := mod(a, b)\n            }\n        }\n    }\n\n    /**\n     * @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryAdd(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.\n     */\n    function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {\n        (, uint256 result) = trySub(a, b);\n        return result;\n    }\n\n    /**\n     * @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.\n     */\n    function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {\n        (bool success, uint256 result) = tryMul(a, b);\n        return ternary(success, result, type(uint256).max);\n    }\n\n    /**\n     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n     *\n     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n     * one branch when needed, making this function more expensive.\n     */\n    function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n        unchecked {\n            // branchless ternary works because:\n            // b ^ (a ^ b) == a\n            // b ^ 0 == b\n            return b ^ ((a ^ b) * SafeCast.toUint(condition));\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a > b, a, b);\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return ternary(a < b, a, b);\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n\n        // The following calculation ensures accurate ceiling division without overflow.\n        // Since a is non-zero, (a - 1) / b will not overflow.\n        // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n        // but the largest value we can obtain is type(uint256).max - 1, which happens\n        // when a = type(uint256).max and b = 1.\n        unchecked {\n            return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n        }\n    }\n\n    /**\n     * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     *\n     * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (high == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return low / denominator;\n            }\n\n            // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n            if (denominator <= high) {\n                Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [high low].\n            uint256 remainder;\n            assembly (\"memory-safe\") {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                high := sub(high, gt(remainder, low))\n                low := sub(low, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly (\"memory-safe\") {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [high low] by twos.\n                low := div(low, twos)\n\n                // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from high into low.\n            low |= high * twos;\n\n            // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n            // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n            inverse *= 2 - denominator * inverse; // inverse mod 2³²\n            inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n            inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n            inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n            // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high\n            // is no longer required.\n            result = low * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n    }\n\n    /**\n     * @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {\n        unchecked {\n            (uint256 high, uint256 low) = mul512(x, y);\n            if (high >= 1 << n) {\n                Panic.panic(Panic.UNDER_OVERFLOW);\n            }\n            return (high << (256 - n)) | (low >> n);\n        }\n    }\n\n    /**\n     * @dev Calculates x * y >> n with full precision, following the selected rounding direction.\n     */\n    function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {\n        return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);\n    }\n\n    /**\n     * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n     *\n     * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n     * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n     *\n     * If the input value is not inversible, 0 is returned.\n     *\n     * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n     * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n     */\n    function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n        unchecked {\n            if (n == 0) return 0;\n\n            // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n            // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n            // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n            // ax + ny = 1\n            // ax = 1 + (-y)n\n            // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n            // If the remainder is 0 the gcd is n right away.\n            uint256 remainder = a % n;\n            uint256 gcd = n;\n\n            // Therefore the initial coefficients are:\n            // ax + ny = gcd(a, n) = n\n            // 0a + 1n = n\n            int256 x = 0;\n            int256 y = 1;\n\n            while (remainder != 0) {\n                uint256 quotient = gcd / remainder;\n\n                (gcd, remainder) = (\n                    // The old remainder is the next gcd to try.\n                    remainder,\n                    // Compute the next remainder.\n                    // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n                    // where gcd is at most n (capped to type(uint256).max)\n                    gcd - remainder * quotient\n                );\n\n                (x, y) = (\n                    // Increment the coefficient of a.\n                    y,\n                    // Decrement the coefficient of n.\n                    // Can overflow, but the result is casted to uint256 so that the\n                    // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n                    x - y * int256(quotient)\n                );\n            }\n\n            if (gcd != 1) return 0; // No inverse exists.\n            return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n        }\n    }\n\n    /**\n     * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n     *\n     * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n     * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n     * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n     *\n     * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n     */\n    function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n        unchecked {\n            return Math.modExp(a, p - 2, p);\n        }\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n     *\n     * Requirements:\n     * - modulus can't be zero\n     * - underlying staticcall to precompile must succeed\n     *\n     * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n     * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n     * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n     * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n     * interpreted as 0.\n     */\n    function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n        (bool success, uint256 result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n     * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n     * to operate modulo 0 or if the underlying precompile reverted.\n     *\n     * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n     * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n     * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n     * of a revert, but the result may be incorrectly interpreted as 0.\n     */\n    function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n        if (m == 0) return (false, 0);\n        assembly (\"memory-safe\") {\n            let ptr := mload(0x40)\n            // | Offset    | Content    | Content (Hex)                                                      |\n            // |-----------|------------|--------------------------------------------------------------------|\n            // | 0x00:0x1f | size of b  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x20:0x3f | size of e  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x40:0x5f | size of m  | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n            // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n            // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n            // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n            mstore(ptr, 0x20)\n            mstore(add(ptr, 0x20), 0x20)\n            mstore(add(ptr, 0x40), 0x20)\n            mstore(add(ptr, 0x60), b)\n            mstore(add(ptr, 0x80), e)\n            mstore(add(ptr, 0xa0), m)\n\n            // Given the result < m, it's guaranteed to fit in 32 bytes,\n            // so we can use the memory scratch space located at offset 0.\n            success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n            result := mload(0x00)\n        }\n    }\n\n    /**\n     * @dev Variant of {modExp} that supports inputs of arbitrary length.\n     */\n    function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n        (bool success, bytes memory result) = tryModExp(b, e, m);\n        if (!success) {\n            Panic.panic(Panic.DIVISION_BY_ZERO);\n        }\n        return result;\n    }\n\n    /**\n     * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n     */\n    function tryModExp(\n        bytes memory b,\n        bytes memory e,\n        bytes memory m\n    ) internal view returns (bool success, bytes memory result) {\n        if (_zeroBytes(m)) return (false, new bytes(0));\n\n        uint256 mLen = m.length;\n\n        // Encode call args in result and move the free memory pointer\n        result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n        assembly (\"memory-safe\") {\n            let dataPtr := add(result, 0x20)\n            // Write result on top of args to avoid allocating extra memory.\n            success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n            // Overwrite the length.\n            // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n            mstore(result, mLen)\n            // Set the memory pointer after the returned data.\n            mstore(0x40, add(dataPtr, mLen))\n        }\n    }\n\n    /**\n     * @dev Returns whether the provided byte array is zero.\n     */\n    function _zeroBytes(bytes memory byteArray) private pure returns (bool) {\n        for (uint256 i = 0; i < byteArray.length; ++i) {\n            if (byteArray[i] != 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n     * using integer operations.\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        unchecked {\n            // Take care of easy edge cases when a == 0 or a == 1\n            if (a <= 1) {\n                return a;\n            }\n\n            // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n            // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n            // the current value as `ε_n = | x_n - sqrt(a) |`.\n            //\n            // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n            // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n            // bigger than any uint256.\n            //\n            // By noticing that\n            // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n            // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n            // to the msb function.\n            uint256 aa = a;\n            uint256 xn = 1;\n\n            if (aa >= (1 << 128)) {\n                aa >>= 128;\n                xn <<= 64;\n            }\n            if (aa >= (1 << 64)) {\n                aa >>= 64;\n                xn <<= 32;\n            }\n            if (aa >= (1 << 32)) {\n                aa >>= 32;\n                xn <<= 16;\n            }\n            if (aa >= (1 << 16)) {\n                aa >>= 16;\n                xn <<= 8;\n            }\n            if (aa >= (1 << 8)) {\n                aa >>= 8;\n                xn <<= 4;\n            }\n            if (aa >= (1 << 4)) {\n                aa >>= 4;\n                xn <<= 2;\n            }\n            if (aa >= (1 << 2)) {\n                xn <<= 1;\n            }\n\n            // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n            //\n            // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n            // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n            // This is going to be our x_0 (and ε_0)\n            xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n            // From here, Newton's method give us:\n            // x_{n+1} = (x_n + a / x_n) / 2\n            //\n            // One should note that:\n            // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n            //              = ((x_n² + a) / (2 * x_n))² - a\n            //              = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n            //              = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n            //              = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n            //              = (x_n² - a)² / (2 * x_n)²\n            //              = ((x_n² - a) / (2 * x_n))²\n            //              ≥ 0\n            // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n            //\n            // This gives us the proof of quadratic convergence of the sequence:\n            // ε_{n+1} = | x_{n+1} - sqrt(a) |\n            //         = | (x_n + a / x_n) / 2 - sqrt(a) |\n            //         = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n            //         = | (x_n - sqrt(a))² / (2 * x_n) |\n            //         = | ε_n² / (2 * x_n) |\n            //         = ε_n² / | (2 * x_n) |\n            //\n            // For the first iteration, we have a special case where x_0 is known:\n            // ε_1 = ε_0² / | (2 * x_0) |\n            //     ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n            //     ≤ 2**(2*e-4) / (3 * 2**(e-1))\n            //     ≤ 2**(e-3) / 3\n            //     ≤ 2**(e-3-log2(3))\n            //     ≤ 2**(e-4.5)\n            //\n            // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n            // ε_{n+1} = ε_n² / | (2 * x_n) |\n            //         ≤ (2**(e-k))² / (2 * 2**(e-1))\n            //         ≤ 2**(2*e-2*k) / 2**e\n            //         ≤ 2**(e-2*k)\n            xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5)  -- special case, see above\n            xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9)    -- general case with k = 4.5\n            xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18)   -- general case with k = 9\n            xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36)   -- general case with k = 18\n            xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72)   -- general case with k = 36\n            xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144)  -- general case with k = 72\n\n            // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n            // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n            // sqrt(a) or sqrt(a) + 1.\n            return xn - SafeCast.toUint(xn > a / xn);\n        }\n    }\n\n    /**\n     * @dev Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // If upper 8 bits of 16-bit half set, add 8 to result\n        r |= SafeCast.toUint((x >> r) > 0xff) << 3;\n        // If upper 4 bits of 8-bit half set, add 4 to result\n        r |= SafeCast.toUint((x >> r) > 0xf) << 2;\n\n        // Shifts value right by the current result and use it as an index into this lookup table:\n        //\n        // | x (4 bits) |  index  | table[index] = MSB position |\n        // |------------|---------|-----------------------------|\n        // |    0000    |    0    |        table[0] = 0         |\n        // |    0001    |    1    |        table[1] = 0         |\n        // |    0010    |    2    |        table[2] = 1         |\n        // |    0011    |    3    |        table[3] = 1         |\n        // |    0100    |    4    |        table[4] = 2         |\n        // |    0101    |    5    |        table[5] = 2         |\n        // |    0110    |    6    |        table[6] = 2         |\n        // |    0111    |    7    |        table[7] = 2         |\n        // |    1000    |    8    |        table[8] = 3         |\n        // |    1001    |    9    |        table[9] = 3         |\n        // |    1010    |   10    |        table[10] = 3        |\n        // |    1011    |   11    |        table[11] = 3        |\n        // |    1100    |   12    |        table[12] = 3        |\n        // |    1101    |   13    |        table[13] = 3        |\n        // |    1110    |   14    |        table[14] = 3        |\n        // |    1111    |   15    |        table[15] = 3        |\n        //\n        // The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.\n        assembly (\"memory-safe\") {\n            r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 x) internal pure returns (uint256 r) {\n        // If value has upper 128 bits set, log2 result is at least 128\n        r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;\n        // If upper 64 bits of 128-bit half set, add 64 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;\n        // If upper 32 bits of 64-bit half set, add 32 to result\n        r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;\n        // If upper 16 bits of 32-bit half set, add 16 to result\n        r |= SafeCast.toUint((x >> r) > 0xffff) << 4;\n        // Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8\n        return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/UUPSUpgradeable.sol)\n\npragma solidity ^0.8.22;\n\nimport {IERC1822Proxiable} from \"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\";\nimport {ERC1967Utils} from \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol\";\nimport {Initializable} from \"./Initializable.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 Initializable, 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    function __UUPSUpgradeable_init() internal onlyInitializing {\n    }\n\n    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {\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     */\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"},{"file_path":"node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS\n    }\n\n    /**\n     * @dev The signature derives the `address(0)`.\n     */\n    error ECDSAInvalidSignature();\n\n    /**\n     * @dev The signature has an invalid length.\n     */\n    error ECDSAInvalidSignatureLength(uint256 length);\n\n    /**\n     * @dev The signature has an S value that is in the upper half order.\n     */\n    error ECDSAInvalidSignatureS(bytes32 s);\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n     * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n     * and a bytes32 providing additional information about the error.\n     *\n     * If no error is returned, then the address can be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes memory signature\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            assembly (\"memory-safe\") {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        unchecked {\n            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n            // We do not check for an overflow here since the shift operation results in 0 or 1.\n            uint8 v = uint8((uint256(vs) >> 255) + 27);\n            return tryRecover(hash, v, r, s);\n        }\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS, s);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature, bytes32(0));\n        }\n\n        return (signer, RecoverError.NoError, bytes32(0));\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n        _throwError(error, errorArg);\n        return recovered;\n    }\n\n    /**\n     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n     */\n    function _throwError(RecoverError error, bytes32 errorArg) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert ECDSAInvalidSignature();\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert ECDSAInvalidSignatureLength(uint256(errorArg));\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert ECDSAInvalidSignatureS(errorArg);\n        }\n    }\n}\n"},{"file_path":"contracts/storage/VaultStorageUtils.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IVault } from \"../interfaces/IVault.sol\";\n\n/// @title VaultStorageUtils\n/// @author kexley, Cap Labs\n/// @notice Storage utilities for Vault contract\nabstract contract VaultStorageUtils {\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"cap.storage.Vault\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 constant VaultStorageLocation = 0xe912a1b0cc7579bc5827e495c2ce52587bc3871751e3281fc5599b38c3bfc400;\n\n    /// @notice Get vault storage\n    /// @return $ Storage pointer\n    function getVaultStorage() internal pure returns (IVault.VaultStorage storage $) {\n        assembly {\n            $.slot := VaultStorageLocation\n        }\n    }\n}\n"},{"file_path":"contracts/vault/libraries/FractionalReserveLogic.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { IFractionalReserve } from \"../../interfaces/IFractionalReserve.sol\";\nimport { IERC4626 } from \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/// @title Fractional Reserve Logic\n/// @author kexley, Cap Labs\n/// @notice Idle capital is put to work in fractional reserve vaults and can be recalled when\n/// withdrawing, redeeming or borrowing.\nlibrary FractionalReserveLogic {\n    using SafeERC20 for IERC20;\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    /// @dev Fractional reserve invested event\n    event FractionalReserveInvested(address indexed asset, uint256 amount);\n\n    /// @dev Fractional reserve divested event\n    event FractionalReserveDivested(address indexed asset, uint256 amount);\n\n    /// @dev Fractional reserve vault updated event\n    event FractionalReserveVaultUpdated(address indexed asset, address vault);\n\n    /// @dev Fractional reserve reserve updated event\n    event FractionalReserveReserveUpdated(address indexed asset, uint256 reserve);\n\n    /// @dev Fractional reserve interest realized event\n    event FractionalReserveInterestRealized(address indexed asset, uint256 amount);\n\n    /// @dev Full divest required\n    error FullDivestRequired(address asset, uint256 loss);\n\n    /// @dev Fractional reserve vault already set\n    error FractionalReserveVaultAlreadySet(address vault);\n\n    /// @notice Invest unborrowed capital in a fractional reserve vault\n    /// @param $ Storage pointer\n    /// @param _asset Asset address\n    function invest(IFractionalReserve.FractionalReserveStorage storage $, address _asset) external {\n        uint256 assetBalance = IERC20(_asset).balanceOf(address(this));\n        uint256 reserveBalance = $.reserve[_asset];\n\n        if (assetBalance > reserveBalance && $.vault[_asset] != address(0)) {\n            uint256 investAmount = assetBalance - reserveBalance;\n            $.loaned[_asset] += investAmount;\n            IERC20(_asset).forceApprove($.vault[_asset], investAmount);\n            IERC4626($.vault[_asset]).deposit(investAmount, address(this));\n\n            emit FractionalReserveInvested(_asset, investAmount);\n        }\n    }\n\n    /// @notice Divest all from a fractional reserve vault\n    /// @param $ Storage pointer\n    /// @param _asset Asset address\n    function divest(IFractionalReserve.FractionalReserveStorage storage $, address _asset) external {\n        if ($.vault[_asset] != address(0)) {\n            uint256 loanedAssets = $.loaned[_asset];\n            $.loaned[_asset] = 0;\n\n            uint256 vaultBalance = IERC20($.vault[_asset]).balanceOf(address(this));\n            if (vaultBalance > 0) {\n                uint256 redeemedAssets = IERC4626($.vault[_asset]).redeem(vaultBalance, address(this), address(this));\n                if (redeemedAssets > loanedAssets) {\n                    IERC20(_asset).safeTransfer($.interestReceiver, redeemedAssets - loanedAssets);\n                } else if (redeemedAssets < loanedAssets) {\n                    revert FullDivestRequired(_asset, loanedAssets - redeemedAssets);\n                }\n\n                emit FractionalReserveDivested(_asset, loanedAssets);\n            }\n        }\n    }\n\n    /// @notice Divest capital from a fractional reserve vault when not enough funds are held in reserve\n    /// @dev Some wei are left over in the ERC4626 after rounding, so a full divest will yield less than expected and could fail\n    /// Re-investing recovers the lost wei, it is not skimmable via realize interest\n    /// @param $ Storage pointer\n    /// @param _asset Asset address\n    /// @param _withdrawAmount Amount to withdraw to fulfil\n    function divest(IFractionalReserve.FractionalReserveStorage storage $, address _asset, uint256 _withdrawAmount)\n        external\n    {\n        if ($.vault[_asset] != address(0)) {\n            uint256 assetBalance = IERC20(_asset).balanceOf(address(this));\n\n            if (_withdrawAmount > assetBalance) {\n                /// Divest both the withdrawal amount and the buffer reserve for later withdrawals\n                uint256 divestAmount = _withdrawAmount + $.reserve[_asset] - assetBalance;\n\n                uint256 shares = IERC4626($.vault[_asset]).previewWithdraw(divestAmount);\n                uint256 vaultBalance = IERC4626($.vault[_asset]).balanceOf(address(this));\n\n                if (shares > vaultBalance) {\n                    divestAmount = IERC4626($.vault[_asset]).redeem(vaultBalance, address(this), address(this));\n                } else {\n                    IERC4626($.vault[_asset]).withdraw(divestAmount, address(this), address(this));\n                }\n\n                if (divestAmount > $.loaned[_asset]) {\n                    uint256 interest = divestAmount - $.loaned[_asset];\n                    IERC20(_asset).safeTransfer($.interestReceiver, interest);\n                    emit FractionalReserveInterestRealized(_asset, interest);\n                    divestAmount = $.loaned[_asset];\n                }\n\n                $.loaned[_asset] -= divestAmount;\n\n                emit FractionalReserveDivested(_asset, divestAmount);\n            }\n        }\n    }\n\n    /// @notice Set the fractional reserve vault for an asset\n    /// @param $ Storage pointer\n    /// @param _asset Asset address\n    /// @param _vault Fractional reserve vault\n    function setFractionalReserveVault(\n        IFractionalReserve.FractionalReserveStorage storage $,\n        address _asset,\n        address _vault\n    ) external {\n        if ($.vault[_asset] != address(0)) $.vaults.remove($.vault[_asset]);\n        if (!$.vaults.add(_vault)) revert FractionalReserveVaultAlreadySet(_vault);\n        $.vault[_asset] = _vault;\n\n        emit FractionalReserveVaultUpdated(_asset, _vault);\n    }\n\n    /// @notice Set the reserve level for an asset\n    /// @param $ Storage pointer\n    /// @param _asset Asset address\n    /// @param _reserve Reserve level in asset decimals\n    function setReserve(IFractionalReserve.FractionalReserveStorage storage $, address _asset, uint256 _reserve)\n        external\n    {\n        $.reserve[_asset] = _reserve;\n\n        emit FractionalReserveReserveUpdated(_asset, _reserve);\n    }\n\n    /// @notice Realize interest from a fractional reserve vault\n    /// @param $ Storage pointer\n    /// @param _asset Asset address\n    function realizeInterest(IFractionalReserve.FractionalReserveStorage storage $, address _asset) external {\n        if ($.vault[_asset] != address(0)) {\n            uint256 interest = claimableInterest($, _asset);\n            IERC4626($.vault[_asset]).withdraw(interest, $.interestReceiver, address(this));\n            emit FractionalReserveInterestRealized(_asset, interest);\n        }\n    }\n\n    /// @notice Interest from a fractional reserve vault\n    /// @param $ Storage pointer\n    /// @param _asset Asset address\n    /// @return interest Claimable amount of asset\n    function claimableInterest(IFractionalReserve.FractionalReserveStorage storage $, address _asset)\n        public\n        view\n        returns (uint256 interest)\n    {\n        if ($.vault[_asset] == address(0)) return 0;\n\n        uint256 vaultShares = IERC4626($.vault[_asset]).balanceOf(address(this));\n        uint256 shares = IERC4626($.vault[_asset]).previewWithdraw($.loaned[_asset]);\n        if (vaultShares > shares) {\n            uint256 withdrawableShares = vaultShares - shares;\n            interest = IERC4626($.vault[_asset]).convertToAssets(withdrawableShares);\n        }\n    }\n}\n"},{"file_path":"contracts/storage/AccessStorageUtils.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IAccess } from \"../interfaces/IAccess.sol\";\n\n/// @title Access Storage Utils\n/// @author kexley, Cap Labs\n/// @notice Storage utilities for access control\nabstract contract AccessStorageUtils {\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"cap.storage.Access\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant AccessStorageLocation = 0xb413d65cb88f23816c329284a0d3eb15a99df7963ab7402ade4c5da22bff6b00;\n\n    /// @dev Get access storage\n    /// @return $ Storage pointer\n    function getAccessStorage() internal pure returns (IAccess.AccessStorage storage $) {\n        assembly {\n            $.slot := AccessStorageLocation\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {ContextUpgradeable} from \"../../utils/ContextUpgradeable.sol\";\nimport {IERC20Errors} from \"@openzeppelin/contracts/interfaces/draft-IERC6093.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n */\nabstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors {\n    /// @custom:storage-location erc7201:openzeppelin.storage.ERC20\n    struct ERC20Storage {\n        mapping(address account => uint256) _balances;\n\n        mapping(address account => mapping(address spender => uint256)) _allowances;\n\n        uint256 _totalSupply;\n\n        string _name;\n        string _symbol;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ERC20\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;\n\n    function _getERC20Storage() private pure returns (ERC20Storage storage $) {\n        assembly {\n            $.slot := ERC20StorageLocation\n        }\n    }\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * Both values are immutable: they can only be set once during construction.\n     */\n    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n        __ERC20_init_unchained(name_, symbol_);\n    }\n\n    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n        ERC20Storage storage $ = _getERC20Storage();\n        $._name = name_;\n        $._symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        ERC20Storage storage $ = _getERC20Storage();\n        return $._name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual returns (string memory) {\n        ERC20Storage storage $ = _getERC20Storage();\n        return $._symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /// @inheritdoc IERC20\n    function totalSupply() public view virtual returns (uint256) {\n        ERC20Storage storage $ = _getERC20Storage();\n        return $._totalSupply;\n    }\n\n    /// @inheritdoc IERC20\n    function balanceOf(address account) public view virtual returns (uint256) {\n        ERC20Storage storage $ = _getERC20Storage();\n        return $._balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /// @inheritdoc IERC20\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        ERC20Storage storage $ = _getERC20Storage();\n        return $._allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Skips emitting an {Approval} event indicating an allowance update. This is not\n     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        ERC20Storage storage $ = _getERC20Storage();\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            $._totalSupply += value;\n        } else {\n            uint256 fromBalance = $._balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                $._balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                $._totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                $._balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     *\n     * ```solidity\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        ERC20Storage storage $ = _getERC20Storage();\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        $._allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance < type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"},{"file_path":"contracts/interfaces/IAccess.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\n/// @title IAccess\n/// @author kexley, Cap Labs\n/// @notice Interface for Access contract\ninterface IAccess {\n    /// @dev Access storage\n    /// @param accessControl Access control address\n    struct AccessStorage {\n        address accessControl;\n    }\n\n    /// @notice Access is denied for the caller\n    error AccessDenied();\n}\n"},{"file_path":"contracts/interfaces/IAccessControl.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\n/// @title IAccessControl\n/// @author kexley, Cap Labs\n/// @notice Interface for granular access control system that manages permissions for specific function selectors on contracts\ninterface IAccessControl {\n    /// @notice Error thrown when trying to revoke own revocation role\n    error CannotRevokeSelf();\n\n    /// @notice Initialize the access control system with a default admin\n    /// @param _admin Address to be granted the default admin role and initial access management permissions\n    function initialize(address _admin) external;\n\n    /// @notice Grant access to a specific method on a contract\n    /// @param _selector Function selector (4-byte identifier) of the method to grant access to\n    /// @param _contract Address of the contract containing the method\n    /// @param _address Address to grant access to\n    function grantAccess(bytes4 _selector, address _contract, address _address) external;\n\n    /// @notice Revoke access to a specific method on a contract\n    /// @param _selector Function selector (4-byte identifier) of the method to revoke access from\n    /// @param _contract Address of the contract containing the method\n    /// @param _address Address to revoke access from\n    function revokeAccess(bytes4 _selector, address _contract, address _address) external;\n\n    /// @notice Check if a specific method access is granted to an address\n    /// @param _selector Function selector (4-byte identifier) of the method to check\n    /// @param _contract Address of the contract containing the method\n    /// @param _caller Address to check permissions for\n    /// @return hasAccess True if access is granted, false otherwise\n    function checkAccess(bytes4 _selector, address _contract, address _caller) external view returns (bool hasAccess);\n\n    /// @notice Get the role identifier for a specific function selector on a contract\n    /// @dev The role identifier is a unique identifier derived packing the selector and contract address\n    /// @param _selector Function selector (4-byte identifier) of the method\n    /// @param _contract Address of the contract containing the method\n    /// @return roleId Unique role identifier derived from the selector and contract address\n    function role(bytes4 _selector, address _contract) external pure returns (bytes32 roleId);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Strings.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SafeCast} from \"./math/SafeCast.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    using SafeCast for *;\n\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n    uint8 private constant ADDRESS_LENGTH = 20;\n    uint256 private constant SPECIAL_CHARS_LOOKUP =\n        (1 << 0x08) | // backspace\n            (1 << 0x09) | // tab\n            (1 << 0x0a) | // newline\n            (1 << 0x0c) | // form feed\n            (1 << 0x0d) | // carriage return\n            (1 << 0x22) | // double quote\n            (1 << 0x5c); // backslash\n\n    /**\n     * @dev The `value` string doesn't fit in the specified `length`.\n     */\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n    /**\n     * @dev The string being parsed contains characters that are not in scope of the given base.\n     */\n    error StringsInvalidChar();\n\n    /**\n     * @dev The string being parsed is not a properly formatted address.\n     */\n    error StringsInvalidAddressFormat();\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            assembly (\"memory-safe\") {\n                ptr := add(add(buffer, 0x20), length)\n            }\n            while (true) {\n                ptr--;\n                assembly (\"memory-safe\") {\n                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toStringSigned(int256 value) internal pure returns (string memory) {\n        return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        uint256 localValue = value;\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = HEX_DIGITS[localValue & 0xf];\n            localValue >>= 4;\n        }\n        if (localValue != 0) {\n            revert StringsInsufficientHexLength(value, length);\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n     * representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n     * representation, according to EIP-55.\n     */\n    function toChecksumHexString(address addr) internal pure returns (string memory) {\n        bytes memory buffer = bytes(toHexString(addr));\n\n        // hash the hex part of buffer (skip length + 2 bytes, length 40)\n        uint256 hashValue;\n        assembly (\"memory-safe\") {\n            hashValue := shr(96, keccak256(add(buffer, 0x22), 40))\n        }\n\n        for (uint256 i = 41; i > 1; --i) {\n            // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)\n            if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {\n                // case shift by xoring with 0x20\n                buffer[i] ^= 0x20;\n            }\n            hashValue >>= 4;\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n\n    /**\n     * @dev Parse a decimal string and returns the value as a `uint256`.\n     *\n     * Requirements:\n     * - The string must be formatted as `[0-9]*`\n     * - The result must fit into an `uint256` type\n     */\n    function parseUint(string memory input) internal pure returns (uint256) {\n        return parseUint(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseUint-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `[0-9]*`\n     * - The result must fit into an `uint256` type\n     */\n    function parseUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n        (bool success, uint256 value) = tryParseUint(input, begin, end);\n        if (!success) revert StringsInvalidChar();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseUint-string} that returns false if the parsing fails because of an invalid character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseUint(string memory input) internal pure returns (bool success, uint256 value) {\n        return _tryParseUintUncheckedBounds(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseUint-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n     * character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseUint(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, uint256 value) {\n        if (end > bytes(input).length || begin > end) return (false, 0);\n        return _tryParseUintUncheckedBounds(input, begin, end);\n    }\n\n    /**\n     * @dev Implementation of {tryParseUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n     */\n    function _tryParseUintUncheckedBounds(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) private pure returns (bool success, uint256 value) {\n        bytes memory buffer = bytes(input);\n\n        uint256 result = 0;\n        for (uint256 i = begin; i < end; ++i) {\n            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n            if (chr > 9) return (false, 0);\n            result *= 10;\n            result += chr;\n        }\n        return (true, result);\n    }\n\n    /**\n     * @dev Parse a decimal string and returns the value as a `int256`.\n     *\n     * Requirements:\n     * - The string must be formatted as `[-+]?[0-9]*`\n     * - The result must fit in an `int256` type.\n     */\n    function parseInt(string memory input) internal pure returns (int256) {\n        return parseInt(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseInt-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `[-+]?[0-9]*`\n     * - The result must fit in an `int256` type.\n     */\n    function parseInt(string memory input, uint256 begin, uint256 end) internal pure returns (int256) {\n        (bool success, int256 value) = tryParseInt(input, begin, end);\n        if (!success) revert StringsInvalidChar();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseInt-string} that returns false if the parsing fails because of an invalid character or if\n     * the result does not fit in a `int256`.\n     *\n     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n     */\n    function tryParseInt(string memory input) internal pure returns (bool success, int256 value) {\n        return _tryParseIntUncheckedBounds(input, 0, bytes(input).length);\n    }\n\n    uint256 private constant ABS_MIN_INT256 = 2 ** 255;\n\n    /**\n     * @dev Variant of {parseInt-string-uint256-uint256} that returns false if the parsing fails because of an invalid\n     * character or if the result does not fit in a `int256`.\n     *\n     * NOTE: This function will revert if the absolute value of the result does not fit in a `uint256`.\n     */\n    function tryParseInt(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, int256 value) {\n        if (end > bytes(input).length || begin > end) return (false, 0);\n        return _tryParseIntUncheckedBounds(input, begin, end);\n    }\n\n    /**\n     * @dev Implementation of {tryParseInt-string-uint256-uint256} that does not check bounds. Caller should make sure that\n     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n     */\n    function _tryParseIntUncheckedBounds(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) private pure returns (bool success, int256 value) {\n        bytes memory buffer = bytes(input);\n\n        // Check presence of a negative sign.\n        bytes1 sign = begin == end ? bytes1(0) : bytes1(_unsafeReadBytesOffset(buffer, begin)); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n        bool positiveSign = sign == bytes1(\"+\");\n        bool negativeSign = sign == bytes1(\"-\");\n        uint256 offset = (positiveSign || negativeSign).toUint();\n\n        (bool absSuccess, uint256 absValue) = tryParseUint(input, begin + offset, end);\n\n        if (absSuccess && absValue < ABS_MIN_INT256) {\n            return (true, negativeSign ? -int256(absValue) : int256(absValue));\n        } else if (absSuccess && negativeSign && absValue == ABS_MIN_INT256) {\n            return (true, type(int256).min);\n        } else return (false, 0);\n    }\n\n    /**\n     * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as a `uint256`.\n     *\n     * Requirements:\n     * - The string must be formatted as `(0x)?[0-9a-fA-F]*`\n     * - The result must fit in an `uint256` type.\n     */\n    function parseHexUint(string memory input) internal pure returns (uint256) {\n        return parseHexUint(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseHexUint-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `(0x)?[0-9a-fA-F]*`\n     * - The result must fit in an `uint256` type.\n     */\n    function parseHexUint(string memory input, uint256 begin, uint256 end) internal pure returns (uint256) {\n        (bool success, uint256 value) = tryParseHexUint(input, begin, end);\n        if (!success) revert StringsInvalidChar();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseHexUint-string} that returns false if the parsing fails because of an invalid character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseHexUint(string memory input) internal pure returns (bool success, uint256 value) {\n        return _tryParseHexUintUncheckedBounds(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseHexUint-string-uint256-uint256} that returns false if the parsing fails because of an\n     * invalid character.\n     *\n     * NOTE: This function will revert if the result does not fit in a `uint256`.\n     */\n    function tryParseHexUint(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, uint256 value) {\n        if (end > bytes(input).length || begin > end) return (false, 0);\n        return _tryParseHexUintUncheckedBounds(input, begin, end);\n    }\n\n    /**\n     * @dev Implementation of {tryParseHexUint-string-uint256-uint256} that does not check bounds. Caller should make sure that\n     * `begin <= end <= input.length`. Other inputs would result in undefined behavior.\n     */\n    function _tryParseHexUintUncheckedBounds(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) private pure returns (bool success, uint256 value) {\n        bytes memory buffer = bytes(input);\n\n        // skip 0x prefix if present\n        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(buffer, begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n        uint256 offset = hasPrefix.toUint() * 2;\n\n        uint256 result = 0;\n        for (uint256 i = begin + offset; i < end; ++i) {\n            uint8 chr = _tryParseChr(bytes1(_unsafeReadBytesOffset(buffer, i)));\n            if (chr > 15) return (false, 0);\n            result *= 16;\n            unchecked {\n                // Multiplying by 16 is equivalent to a shift of 4 bits (with additional overflow check).\n                // This guarantees that adding a value < 16 will not cause an overflow, hence the unchecked.\n                result += chr;\n            }\n        }\n        return (true, result);\n    }\n\n    /**\n     * @dev Parse a hexadecimal string (with or without \"0x\" prefix), and returns the value as an `address`.\n     *\n     * Requirements:\n     * - The string must be formatted as `(0x)?[0-9a-fA-F]{40}`\n     */\n    function parseAddress(string memory input) internal pure returns (address) {\n        return parseAddress(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseAddress-string} that parses a substring of `input` located between position `begin` (included) and\n     * `end` (excluded).\n     *\n     * Requirements:\n     * - The substring must be formatted as `(0x)?[0-9a-fA-F]{40}`\n     */\n    function parseAddress(string memory input, uint256 begin, uint256 end) internal pure returns (address) {\n        (bool success, address value) = tryParseAddress(input, begin, end);\n        if (!success) revert StringsInvalidAddressFormat();\n        return value;\n    }\n\n    /**\n     * @dev Variant of {parseAddress-string} that returns false if the parsing fails because the input is not a properly\n     * formatted address. See {parseAddress-string} requirements.\n     */\n    function tryParseAddress(string memory input) internal pure returns (bool success, address value) {\n        return tryParseAddress(input, 0, bytes(input).length);\n    }\n\n    /**\n     * @dev Variant of {parseAddress-string-uint256-uint256} that returns false if the parsing fails because input is not a properly\n     * formatted address. See {parseAddress-string-uint256-uint256} requirements.\n     */\n    function tryParseAddress(\n        string memory input,\n        uint256 begin,\n        uint256 end\n    ) internal pure returns (bool success, address value) {\n        if (end > bytes(input).length || begin > end) return (false, address(0));\n\n        bool hasPrefix = (end > begin + 1) && bytes2(_unsafeReadBytesOffset(bytes(input), begin)) == bytes2(\"0x\"); // don't do out-of-bound (possibly unsafe) read if sub-string is empty\n        uint256 expectedLength = 40 + hasPrefix.toUint() * 2;\n\n        // check that input is the correct length\n        if (end - begin == expectedLength) {\n            // length guarantees that this does not overflow, and value is at most type(uint160).max\n            (bool s, uint256 v) = _tryParseHexUintUncheckedBounds(input, begin, end);\n            return (s, address(uint160(v)));\n        } else {\n            return (false, address(0));\n        }\n    }\n\n    function _tryParseChr(bytes1 chr) private pure returns (uint8) {\n        uint8 value = uint8(chr);\n\n        // Try to parse `chr`:\n        // - Case 1: [0-9]\n        // - Case 2: [a-f]\n        // - Case 3: [A-F]\n        // - otherwise not supported\n        unchecked {\n            if (value > 47 && value < 58) value -= 48;\n            else if (value > 96 && value < 103) value -= 87;\n            else if (value > 64 && value < 71) value -= 55;\n            else return type(uint8).max;\n        }\n\n        return value;\n    }\n\n    /**\n     * @dev Escape special characters in JSON strings. This can be useful to prevent JSON injection in NFT metadata.\n     *\n     * WARNING: This function should only be used in double quoted JSON strings. Single quotes are not escaped.\n     *\n     * NOTE: This function escapes all unicode characters, and not just the ones in ranges defined in section 2.5 of\n     * RFC-4627 (U+0000 to U+001F, U+0022 and U+005C). ECMAScript's `JSON.parse` does recover escaped unicode\n     * characters that are not in this range, but other tooling may provide different results.\n     */\n    function escapeJSON(string memory input) internal pure returns (string memory) {\n        bytes memory buffer = bytes(input);\n        bytes memory output = new bytes(2 * buffer.length); // worst case scenario\n        uint256 outputLength = 0;\n\n        for (uint256 i; i < buffer.length; ++i) {\n            bytes1 char = bytes1(_unsafeReadBytesOffset(buffer, i));\n            if (((SPECIAL_CHARS_LOOKUP & (1 << uint8(char))) != 0)) {\n                output[outputLength++] = \"\\\\\";\n                if (char == 0x08) output[outputLength++] = \"b\";\n                else if (char == 0x09) output[outputLength++] = \"t\";\n                else if (char == 0x0a) output[outputLength++] = \"n\";\n                else if (char == 0x0c) output[outputLength++] = \"f\";\n                else if (char == 0x0d) output[outputLength++] = \"r\";\n                else if (char == 0x5c) output[outputLength++] = \"\\\\\";\n                else if (char == 0x22) {\n                    // solhint-disable-next-line quotes\n                    output[outputLength++] = '\"';\n                }\n            } else {\n                output[outputLength++] = char;\n            }\n        }\n        // write the actual length and deallocate unused memory\n        assembly (\"memory-safe\") {\n            mstore(output, outputLength)\n            mstore(0x40, add(output, shl(5, shr(5, add(outputLength, 63)))))\n        }\n\n        return string(output);\n    }\n\n    /**\n     * @dev Reads a bytes32 from a bytes array without bounds checking.\n     *\n     * NOTE: making this function internal would mean it could be used with memory unsafe offset, and marking the\n     * assembly block as such would prevent some optimizations.\n     */\n    function _unsafeReadBytesOffset(bytes memory buffer, uint256 offset) private pure returns (bytes32 value) {\n        // This is not memory safe in the general case, but all calls to this private function are within bounds.\n        assembly (\"memory-safe\") {\n            value := mload(add(add(buffer, 0x20), offset))\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC4626.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC4626.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\nimport {IERC20Metadata} from \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC-4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);\n\n    event Withdraw(\n        address indexed sender,\n        address indexed receiver,\n        address indexed owner,\n        uint256 assets,\n        uint256 shares\n    );\n\n    /**\n     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n     *\n     * - MUST be an ERC-20 token contract.\n     * - MUST NOT revert.\n     */\n    function asset() external view returns (address assetTokenAddress);\n\n    /**\n     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n     *\n     * - SHOULD include any compounding that occurs from yield.\n     * - MUST be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT revert.\n     */\n    function totalAssets() external view returns (uint256 totalManagedAssets);\n\n    /**\n     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n     * scenario where all the conditions are met.\n     *\n     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n     * - MUST NOT show any variations depending on the caller.\n     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n     * - MUST NOT revert.\n     *\n     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n     * from.\n     */\n    function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n     * through a deposit call.\n     *\n     * - MUST return a limited value if receiver is subject to some deposit limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n     * - MUST NOT revert.\n     */\n    function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n     *   in the same transaction.\n     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   deposit execution, and are accounted for during deposit.\n     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n     * - MUST return a limited value if receiver is subject to some mint limit.\n     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n     * - MUST NOT revert.\n     */\n    function maxMint(address receiver) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n     * current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n     *   same transaction.\n     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n     *   would be accepted, regardless if the user has enough tokens approved, etc.\n     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by minting.\n     */\n    function previewMint(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n     *\n     * - MUST emit the Deposit event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n     *   execution, and are accounted for during mint.\n     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n     *   approving enough underlying tokens to the Vault contract, etc).\n     *\n     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n     */\n    function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n    /**\n     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n     * Vault, through a withdraw call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n     *   called\n     *   in the same transaction.\n     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n     */\n    function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n    /**\n     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   withdraw execution, and are accounted for during withdraw.\n     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);\n\n    /**\n     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n     * through a redeem call.\n     *\n     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n     * - MUST NOT revert.\n     */\n    function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n    /**\n     * @dev Allows an on-chain or off-chain user to simulate the effects of their redemption at the current block,\n     * given current on-chain conditions.\n     *\n     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n     *   same transaction.\n     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n     *   redemption would be accepted, regardless if the user has enough shares, etc.\n     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n     * - MUST NOT revert.\n     *\n     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n     */\n    function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n    /**\n     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n     *\n     * - MUST emit the Withdraw event.\n     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n     *   redeem execution, and are accounted for during redeem.\n     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n     *   not having enough shares, etc).\n     *\n     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n     * Those methods should be performed separately.\n     */\n    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);\n}\n"},{"file_path":"contracts/interfaces/IRateOracle.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IOracleTypes } from \"./IOracleTypes.sol\";\n\n/// @title IRateOracle\n/// @author kexley, Cap Labs\n/// @notice Interface for the rate oracle\ninterface IRateOracle is IOracleTypes {\n    /// @dev Storage for the rate oracle\n    /// @param marketOracleData Oracle data for the market rate\n    /// @param utilizationOracleData Oracle data for the utilization rate\n    /// @param benchmarkRate Benchmark rate for each asset\n    /// @param restakerRate Restaker rate for each agent\n    struct RateOracleStorage {\n        mapping(address => IOracleTypes.OracleData) marketOracleData;\n        mapping(address => IOracleTypes.OracleData) utilizationOracleData;\n        mapping(address => uint256) benchmarkRate;\n        mapping(address => uint256) restakerRate;\n    }\n\n    /// @dev Rate too high\n    error RateTooHigh(address agent, uint256 rate);\n\n    /// @dev Set market oracle data\n    event SetMarketOracleData(address asset, IOracleTypes.OracleData data);\n\n    /// @dev Set utilization oracle data\n    event SetUtilizationOracleData(address asset, IOracleTypes.OracleData data);\n\n    /// @dev Set benchmark rate\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    event SetBenchmarkRate(address asset, uint256 rate);\n\n    /// @dev Set restaker rate\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    event SetRestakerRate(address agent, uint256 rate);\n\n    /// @notice Set a market source for an asset\n    /// @param _asset Asset address\n    /// @param _oracleData Oracle data\n    function setMarketOracleData(address _asset, IOracleTypes.OracleData calldata _oracleData) external;\n\n    /// @notice Set a utilization source for an asset\n    /// @param _asset Asset address\n    /// @param _oracleData Oracle data\n    function setUtilizationOracleData(address _asset, IOracleTypes.OracleData calldata _oracleData) external;\n\n    /// @notice Update the minimum interest rate for an asset\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    /// @param _asset Asset address\n    /// @param _rate New interest rate\n    function setBenchmarkRate(address _asset, uint256 _rate) external;\n\n    /// @notice Update the rate at which an agent accrues interest explicitly to pay restakers\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    /// @param _agent Agent address\n    /// @param _rate New interest rate\n    function setRestakerRate(address _agent, uint256 _rate) external;\n\n    /// @notice Fetch the market rate for an asset being borrowed\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    /// @param _asset Asset address\n    /// @return rate Borrow interest rate\n    function marketRate(address _asset) external returns (uint256 rate);\n\n    /// @notice View the utilization rate for an asset\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    /// @param _asset Asset address\n    /// @return rate Utilization rate\n    function utilizationRate(address _asset) external returns (uint256 rate);\n\n    /// @notice View the benchmark rate for an asset\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    /// @param _asset Asset address\n    /// @return rate Benchmark rate\n    function benchmarkRate(address _asset) external view returns (uint256 rate);\n\n    /// @notice View the restaker rate for an agent\n    /// @dev Rate value is encoded in ray (27 decimals) and encodes yearly rates\n    /// @param _agent Agent address\n    /// @return rate Restaker rate\n    function restakerRate(address _agent) external view returns (uint256 rate);\n\n    /// @notice View the market oracle data for an asset\n    /// @param _asset Asset address\n    /// @return data Oracle data for an asset\n    function marketOracleData(address _asset) external view returns (IOracleTypes.OracleData memory data);\n\n    /// @notice View the utilization oracle data for an asset\n    /// @param _asset Asset address\n    /// @return data Oracle data for an asset\n    function utilizationOracleData(address _asset) external view returns (IOracleTypes.OracleData memory data);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.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        assembly (\"memory-safe\") {\n            u := iszero(iszero(b))\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\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"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity >=0.4.16;\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"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)\n\npragma solidity >=0.6.2;\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"},{"file_path":"node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity >=0.4.16;\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"},{"file_path":"node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.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 library 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"},{"file_path":"node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n     *\n     * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n     * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n     * one branch when needed, making this function more expensive.\n     */\n    function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {\n        unchecked {\n            // branchless ternary works because:\n            // b ^ (a ^ b) == a\n            // b ^ 0 == b\n            return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return ternary(a > b, a, b);\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return ternary(a < b, a, b);\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // Formula from the \"Bit Twiddling Hacks\" by Sean Eron Anderson.\n            // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,\n            // taking advantage of the most significant (or \"sign\" bit) in two's complement representation.\n            // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,\n            // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).\n            int256 mask = n >> 255;\n\n            // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.\n            return uint256((n + mask) ^ mask);\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20Permit} from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\nimport {ERC20Upgradeable} from \"../ERC20Upgradeable.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712Upgradeable} from \"../../../utils/cryptography/EIP712Upgradeable.sol\";\nimport {NoncesUpgradeable} from \"../../../utils/NoncesUpgradeable.sol\";\nimport {Initializable} from \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20Permit, EIP712Upgradeable, NoncesUpgradeable {\n    bytes32 private constant PERMIT_TYPEHASH =\n        keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n    /**\n     * @dev Permit deadline has expired.\n     */\n    error ERC2612ExpiredSignature(uint256 deadline);\n\n    /**\n     * @dev Mismatched signature.\n     */\n    error ERC2612InvalidSigner(address signer, address owner);\n\n    /**\n     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n     *\n     * It's a good idea to use the same `name` that is defined as the ERC-20 token name.\n     */\n    function __ERC20Permit_init(string memory name) internal onlyInitializing {\n        __EIP712_init_unchained(name, \"1\");\n    }\n\n    function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n    /// @inheritdoc IERC20Permit\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    ) public virtual {\n        if (block.timestamp > deadline) {\n            revert ERC2612ExpiredSignature(deadline);\n        }\n\n        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n        bytes32 hash = _hashTypedDataV4(structHash);\n\n        address signer = ECDSA.recover(hash, v, r, s);\n        if (signer != owner) {\n            revert ERC2612InvalidSigner(signer, owner);\n        }\n\n        _approve(owner, spender, value);\n    }\n\n    /// @inheritdoc IERC20Permit\n    function nonces(address owner) public view virtual override(IERC20Permit, NoncesUpgradeable) returns (uint256) {\n        return super.nonces(owner);\n    }\n\n    /// @inheritdoc IERC20Permit\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n        return _domainSeparatorV4();\n    }\n}\n"},{"file_path":"contracts/vault/libraries/VaultLogic.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IFractionalReserve } from \"../../interfaces/IFractionalReserve.sol\";\nimport { IVault } from \"../../interfaces/IVault.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/// @title Vault for storing the backing for cTokens\n/// @author kexley, Cap Labs\n/// @notice Tokens are supplied by cToken minters and borrowed by covered agents\n/// @dev Supplies, borrows and utilization rates are tracked. Interest rates should be computed and\n/// charged on the external contracts, only the principle amount is counted on this contract.\nlibrary VaultLogic {\n    using SafeERC20 for IERC20;\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    /// @dev Cap token minted\n    event Mint(\n        address indexed minter,\n        address receiver,\n        address indexed asset,\n        uint256 amountIn,\n        uint256 amountOut,\n        uint256 fee\n    );\n\n    /// @dev Cap token burned\n    event Burn(\n        address indexed burner,\n        address receiver,\n        address indexed asset,\n        uint256 amountIn,\n        uint256 amountOut,\n        uint256 fee\n    );\n\n    /// @dev Cap token redeemed\n    event Redeem(address indexed redeemer, address receiver, uint256 amountIn, uint256[] amountsOut, uint256[] fees);\n\n    /// @dev Borrow made\n    event Borrow(address indexed borrower, address indexed asset, uint256 amount);\n\n    /// @dev Repayment made\n    event Repay(address indexed repayer, address indexed asset, uint256 amount);\n\n    /// @dev Add asset\n    event AddAsset(address asset);\n\n    /// @dev Remove asset\n    event RemoveAsset(address asset);\n\n    /// @dev Asset paused\n    event PauseAsset(address asset);\n\n    /// @dev Asset unpaused\n    event UnpauseAsset(address asset);\n\n    /// @dev Rescue unsupported ERC20 tokens\n    event RescueERC20(address asset, address receiver);\n\n    /// @dev Set the insurance fund\n    event SetInsuranceFund(address insuranceFund);\n\n    /// @dev Timestamp is past the deadline\n    error PastDeadline();\n\n    /// @dev Amount out is less than required\n    error Slippage(address asset, uint256 amountOut, uint256 minAmountOut);\n\n    /// @dev Amount out is 0\n    error InvalidAmount();\n\n    /// @dev Paused assets cannot be supplied or borrowed\n    error AssetPaused(address asset);\n\n    /// @dev Only whitelisted assets can be supplied or borrowed\n    error AssetNotSupported(address asset);\n\n    /// @dev Asset is already listed\n    error AssetAlreadySupported(address asset);\n\n    /// @dev Asset has supplies\n    error AssetHasSupplies(address asset);\n\n    /// @dev Only non-supported assets can be rescued\n    error AssetNotRescuable(address asset);\n\n    /// @dev Invalid min amounts out as they dont match the number of assets\n    error InvalidMinAmountsOut();\n\n    /// @dev Insufficient reserves\n    error InsufficientReserves(address asset, uint256 balanceBefore, uint256 amount);\n\n    /// @dev Modifier to only allow supplies and borrows when not paused\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    modifier whenNotPaused(IVault.VaultStorage storage $, address _asset) {\n        _whenNotPaused($, _asset);\n        _;\n    }\n\n    /// @dev Modifier to update the utilization index\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    modifier updateIndex(IVault.VaultStorage storage $, address _asset) {\n        _updateIndex($, _asset);\n        _;\n    }\n\n    /// @notice Mint the cap token using an asset\n    /// @dev This contract must have approval to move asset from msg.sender\n    /// @param $ Vault storage pointer\n    /// @param params Mint parameters\n    function mint(IVault.VaultStorage storage $, IVault.MintBurnParams memory params)\n        external\n        whenNotPaused($, params.asset)\n        updateIndex($, params.asset)\n    {\n        if (params.deadline < block.timestamp) revert PastDeadline();\n        if (params.amountOut < params.minAmountOut) {\n            revert Slippage(address(this), params.amountOut, params.minAmountOut);\n        }\n        if (params.amountOut == 0) revert InvalidAmount();\n\n        $.totalSupplies[params.asset] += params.amountIn;\n\n        IERC20(params.asset).safeTransferFrom(msg.sender, address(this), params.amountIn);\n\n        emit Mint(msg.sender, params.receiver, params.asset, params.amountIn, params.amountOut, params.fee);\n    }\n\n    /// @notice Burn the cap token for an asset\n    /// @dev Can only withdraw up to the amount remaining on this contract\n    /// @param $ Vault storage pointer\n    /// @param params Burn parameters\n    function burn(IVault.VaultStorage storage $, IVault.MintBurnParams memory params)\n        external\n        updateIndex($, params.asset)\n    {\n        if (params.deadline < block.timestamp) revert PastDeadline();\n        if (params.amountOut < params.minAmountOut) {\n            revert Slippage(params.asset, params.amountOut, params.minAmountOut);\n        }\n        if (params.amountOut == 0) revert InvalidAmount();\n\n        _verifyBalance($, params.asset, params.amountOut + params.fee);\n\n        $.totalSupplies[params.asset] -= params.amountOut + params.fee;\n\n        IERC20(params.asset).safeTransfer(params.receiver, params.amountOut);\n        if (params.fee > 0) IERC20(params.asset).safeTransfer($.insuranceFund, params.fee);\n\n        emit Burn(msg.sender, params.receiver, params.asset, params.amountIn, params.amountOut, params.fee);\n    }\n\n    /// @notice Redeem the Cap token for a bundle of assets\n    /// @dev Can only withdraw up to the amount remaining on this contract\n    /// @param $ Vault storage pointer\n    /// @param params Redeem parameters\n    function redeem(IVault.VaultStorage storage $, IVault.RedeemParams memory params) external {\n        if (params.amountsOut.length != params.minAmountsOut.length) revert InvalidMinAmountsOut();\n        if (params.deadline < block.timestamp) revert PastDeadline();\n\n        uint256 length = $.assets.length();\n        for (uint256 i; i < length; ++i) {\n            address asset = $.assets.at(i);\n            if (params.amountsOut[i] < params.minAmountsOut[i]) {\n                revert Slippage(asset, params.amountsOut[i], params.minAmountsOut[i]);\n            }\n            _verifyBalance($, asset, params.amountsOut[i] + params.fees[i]);\n            _updateIndex($, asset);\n            $.totalSupplies[asset] -= params.amountsOut[i] + params.fees[i];\n            IERC20(asset).safeTransfer(params.receiver, params.amountsOut[i]);\n            if (params.fees[i] > 0) IERC20(asset).safeTransfer($.insuranceFund, params.fees[i]);\n        }\n\n        emit Redeem(msg.sender, params.receiver, params.amountIn, params.amountsOut, params.fees);\n    }\n\n    /// @notice Borrow an asset\n    /// @dev Whitelisted agents can borrow any amount, LTV is handled by Agent contracts\n    /// @param $ Vault storage pointer\n    /// @param params Borrow parameters\n    function borrow(IVault.VaultStorage storage $, IVault.BorrowParams memory params)\n        external\n        whenNotPaused($, params.asset)\n        updateIndex($, params.asset)\n    {\n        _verifyBalance($, params.asset, params.amount);\n\n        $.totalBorrows[params.asset] += params.amount;\n        IERC20(params.asset).safeTransfer(params.receiver, params.amount);\n\n        emit Borrow(msg.sender, params.asset, params.amount);\n    }\n\n    /// @notice Repay an asset\n    /// @param $ Vault storage pointer\n    /// @param params Repay parameters\n    function repay(IVault.VaultStorage storage $, IVault.RepayParams memory params)\n        external\n        updateIndex($, params.asset)\n    {\n        $.totalBorrows[params.asset] -= params.amount;\n        IERC20(params.asset).safeTransferFrom(msg.sender, address(this), params.amount);\n\n        emit Repay(msg.sender, params.asset, params.amount);\n    }\n\n    /// @notice Add an asset to the vault list\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    function addAsset(IVault.VaultStorage storage $, address _asset) external {\n        if (!$.assets.add(_asset)) revert AssetNotSupported(_asset);\n        emit AddAsset(_asset);\n    }\n\n    /// @notice Remove an asset from the vault list\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    function removeAsset(IVault.VaultStorage storage $, address _asset) external {\n        if ($.totalSupplies[_asset] > 0) revert AssetHasSupplies(_asset);\n        if (!$.assets.remove(_asset)) revert AssetNotSupported(_asset);\n        emit RemoveAsset(_asset);\n    }\n\n    /// @notice Pause an asset\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    function pause(IVault.VaultStorage storage $, address _asset) external {\n        $.paused[_asset] = true;\n        emit PauseAsset(_asset);\n    }\n\n    /// @notice Unpause an asset\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    function unpause(IVault.VaultStorage storage $, address _asset) external {\n        $.paused[_asset] = false;\n        emit UnpauseAsset(_asset);\n    }\n\n    /// @notice Set the insurance fund\n    /// @param $ Vault storage pointer\n    /// @param _insuranceFund Insurance fund address\n    function setInsuranceFund(IVault.VaultStorage storage $, address _insuranceFund) external {\n        $.insuranceFund = _insuranceFund;\n        emit SetInsuranceFund(_insuranceFund);\n    }\n\n    /// @notice Rescue an unsupported asset\n    /// @param $ Vault storage pointer\n    /// @param reserve Fractional reserve storage pointer\n    /// @param _asset Asset to rescue\n    /// @param _receiver Receiver of the rescue\n    function rescueERC20(\n        IVault.VaultStorage storage $,\n        IFractionalReserve.FractionalReserveStorage storage reserve,\n        address _asset,\n        address _receiver\n    ) external {\n        if (_listed($, _asset) || reserve.vaults.contains(_asset)) revert AssetNotRescuable(_asset);\n        IERC20(_asset).safeTransfer(_receiver, IERC20(_asset).balanceOf(address(this)));\n        emit RescueERC20(_asset, _receiver);\n    }\n\n    /// @notice Calculate the available balance of an asset\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    /// @return balance Available balance\n    function availableBalance(IVault.VaultStorage storage $, address _asset) public view returns (uint256 balance) {\n        balance = $.totalSupplies[_asset] - $.totalBorrows[_asset];\n    }\n\n    /// @notice Calculate the utilization ratio of an asset\n    /// @dev Returns the ratio of borrowed assets to total supply, scaled to ray (1e27)\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    /// @return ratio Utilization ratio in ray (1e27)\n    function utilization(IVault.VaultStorage storage $, address _asset) public view returns (uint256 ratio) {\n        ratio = $.totalSupplies[_asset] != 0 ? $.totalBorrows[_asset] * 1e27 / $.totalSupplies[_asset] : 0;\n    }\n\n    /// @notice Up to date cumulative utilization index of an asset\n    /// @dev Utilization and index are both scaled in ray (1e27)\n    /// @param $ Vault storage pointer\n    /// @param _asset Utilized asset\n    /// @return index Utilization ratio index in ray (1e27)\n    function currentUtilizationIndex(IVault.VaultStorage storage $, address _asset)\n        external\n        view\n        returns (uint256 index)\n    {\n        index = $.utilizationIndex[_asset] + (utilization($, _asset) * (block.timestamp - $.lastUpdate[_asset]));\n    }\n\n    /// @dev Validate that an asset is listed\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset to check\n    /// @return isListed Asset is listed or not\n    function _listed(IVault.VaultStorage storage $, address _asset) internal view returns (bool isListed) {\n        isListed = $.assets.contains(_asset);\n    }\n\n    /// @dev Verify that an asset has enough balance\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    /// @param _amount Amount to verify\n    function _verifyBalance(IVault.VaultStorage storage $, address _asset, uint256 _amount) internal view {\n        uint256 balance = availableBalance($, _asset);\n        if (balance < _amount) {\n            revert InsufficientReserves(_asset, balance, _amount);\n        }\n    }\n\n    /// @dev Only allow supplies and borrows when not paused\n    /// @param $ Vault storage pointer\n    /// @param _asset Asset address\n    function _whenNotPaused(IVault.VaultStorage storage $, address _asset) private view {\n        if ($.paused[_asset]) revert AssetPaused(_asset);\n    }\n\n    /// @dev Update the cumulative utilization index of an asset\n    /// @param $ Vault storage pointer\n    /// @param _asset Utilized asset\n    function _updateIndex(IVault.VaultStorage storage $, address _asset) internal {\n        if (!_listed($, _asset)) revert AssetNotSupported(_asset);\n        $.utilizationIndex[_asset] += utilization($, _asset) * (block.timestamp - $.lastUpdate[_asset]);\n        $.lastUpdate[_asset] = block.timestamp;\n    }\n}\n"},{"file_path":"contracts/storage/MinterStorageUtils.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IMinter } from \"../interfaces/IMinter.sol\";\n\n/// @title MinterStorageUtils\n/// @author kexley, Cap Labs\n/// @notice Storage utilities for Minter contract\nabstract contract MinterStorageUtils {\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"cap.storage.Minter\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 constant MinterStorageLocation = 0x3b40995b576f8dd0a8521bba471c5346e53f6a25529b0903b82331eb1a2afe00;\n\n    /// @notice Get Minter storage\n    /// @return $ Storage pointer\n    function getMinterStorage() internal pure returns (IMinter.MinterStorage storage $) {\n        assembly {\n            $.slot := MinterStorageLocation\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\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 ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\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"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.20;\n\nimport {MessageHashUtils} from \"@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol\";\nimport {IERC5267} from \"@openzeppelin/contracts/interfaces/IERC5267.sol\";\nimport {Initializable} from \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: The upgradeable version of this contract does not use an immutable cache and recomputes the domain separator\n * each time {_domainSeparatorV4} is called. That is cheaper than accessing a cached version in cold storage.\n */\nabstract contract EIP712Upgradeable is Initializable, IERC5267 {\n    bytes32 private constant TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.EIP712\n    struct EIP712Storage {\n        /// @custom:oz-renamed-from _HASHED_NAME\n        bytes32 _hashedName;\n        /// @custom:oz-renamed-from _HASHED_VERSION\n        bytes32 _hashedVersion;\n\n        string _name;\n        string _version;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.EIP712\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100;\n\n    function _getEIP712Storage() private pure returns (EIP712Storage storage $) {\n        assembly {\n            $.slot := EIP712StorageLocation\n        }\n    }\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n        __EIP712_init_unchained(name, version);\n    }\n\n    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n        EIP712Storage storage $ = _getEIP712Storage();\n        $._name = name;\n        $._version = version;\n\n        // Reset prior values in storage if upgrading\n        $._hashedName = 0;\n        $._hashedVersion = 0;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        return _buildDomainSeparator();\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /// @inheritdoc IERC5267\n    function eip712Domain()\n        public\n        view\n        virtual\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        EIP712Storage storage $ = _getEIP712Storage();\n        // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized\n        // and the EIP712 domain is not reliable, as it will be missing name and version.\n        require($._hashedName == 0 && $._hashedVersion == 0, \"EIP712: Uninitialized\");\n\n        return (\n            hex\"0f\", // 01111\n            _EIP712Name(),\n            _EIP712Version(),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n\n    /**\n     * @dev The name parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Name() internal view virtual returns (string memory) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        return $._name;\n    }\n\n    /**\n     * @dev The version parameter for the EIP712 domain.\n     *\n     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n     * are a concern.\n     */\n    function _EIP712Version() internal view virtual returns (string memory) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        return $._version;\n    }\n\n    /**\n     * @dev The hash of the name parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.\n     */\n    function _EIP712NameHash() internal view returns (bytes32) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        string memory name = _EIP712Name();\n        if (bytes(name).length > 0) {\n            return keccak256(bytes(name));\n        } else {\n            // If the name is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.\n            bytes32 hashedName = $._hashedName;\n            if (hashedName != 0) {\n                return hashedName;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n\n    /**\n     * @dev The hash of the version parameter for the EIP712 domain.\n     *\n     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.\n     */\n    function _EIP712VersionHash() internal view returns (bytes32) {\n        EIP712Storage storage $ = _getEIP712Storage();\n        string memory version = _EIP712Version();\n        if (bytes(version).length > 0) {\n            return keccak256(bytes(version));\n        } else {\n            // If the version is empty, the contract may have been upgraded without initializing the new storage.\n            // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.\n            bytes32 hashedVersion = $._hashedVersion;\n            if (hashedVersion != 0) {\n                return hashedVersion;\n            } else {\n                return keccak256(\"\");\n            }\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.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 reinitialization) 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 Pointer to storage slot. Allows integrators to override it with a custom storage location.\n     *\n     * NOTE: Consider following the ERC-7201 formula to derive storage locations.\n     */\n    function _initializableStorageSlot() internal pure virtual returns (bytes32) {\n        return INITIALIZABLE_STORAGE;\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        bytes32 slot = _initializableStorageSlot();\n        assembly {\n            $.slot := slot\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Comparators.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Comparators.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides a set of functions to compare values.\n *\n * _Available since v5.1._\n */\nlibrary Comparators {\n    function lt(uint256 a, uint256 b) internal pure returns (bool) {\n        return a < b;\n    }\n\n    function gt(uint256 a, uint256 b) internal pure returns (bool) {\n        return a > b;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity >=0.4.16;\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"},{"file_path":"node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.20;\n\nimport {Arrays} from \"../Arrays.sol\";\nimport {Math} from \"../math/Math.sol\";\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n * - Set can be cleared (all elements removed) in O(n).\n *\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * The following types are supported:\n *\n * - `bytes32` (`Bytes32Set`) since v3.3.0\n * - `address` (`AddressSet`) since v3.3.0\n * - `uint256` (`UintSet`) since v3.3.0\n * - `string` (`StringSet`) since v5.4.0\n * - `bytes` (`BytesSet`) since v5.4.0\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position is the index of the value in the `values` array plus 1.\n        // Position 0 is used to mean a value is not in the set.\n        mapping(bytes32 value => uint256) _positions;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._positions[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We cache the value's position to prevent multiple reads from the same storage slot\n        uint256 position = set._positions[value];\n\n        if (position != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 valueIndex = position - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (valueIndex != lastIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the lastValue to the index where the value to delete is\n                set._values[valueIndex] = lastValue;\n                // Update the tracked position of the lastValue (that was just moved)\n                set._positions[lastValue] = position;\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the tracked position for the deleted slot\n            delete set._positions[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes all the values from a set. O(n).\n     *\n     * WARNING: This function has an unbounded cost that scales with set size. Developers should keep in mind that\n     * using it may render the function uncallable if the set grows to the point where clearing it consumes too much\n     * gas to fit in a block.\n     */\n    function _clear(Set storage set) private {\n        uint256 len = _length(set);\n        for (uint256 i = 0; i < len; ++i) {\n            delete set._positions[set._values[i]];\n        }\n        Arrays.unsafeSetLength(set._values, 0);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._positions[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    /**\n     * @dev Return a slice of the set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set, uint256 start, uint256 end) private view returns (bytes32[] memory) {\n        unchecked {\n            end = Math.min(end, _length(set));\n            start = Math.min(start, end);\n\n            uint256 len = end - start;\n            bytes32[] memory result = new bytes32[](len);\n            for (uint256 i = 0; i < len; ++i) {\n                result[i] = Arrays.unsafeAccess(set._values, start + i).value;\n            }\n            return result;\n        }\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Removes all the values from a set. O(n).\n     *\n     * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the\n     * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.\n     */\n    function clear(Bytes32Set storage set) internal {\n        _clear(set._inner);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        assembly (\"memory-safe\") {\n            result := store\n        }\n\n        return result;\n    }\n\n    /**\n     * @dev Return a slice of the set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set, uint256 start, uint256 end) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner, start, end);\n        bytes32[] memory result;\n\n        assembly (\"memory-safe\") {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes all the values from a set. O(n).\n     *\n     * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the\n     * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.\n     */\n    function clear(AddressSet storage set) internal {\n        _clear(set._inner);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        assembly (\"memory-safe\") {\n            result := store\n        }\n\n        return result;\n    }\n\n    /**\n     * @dev Return a slice of the set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set, uint256 start, uint256 end) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner, start, end);\n        address[] memory result;\n\n        assembly (\"memory-safe\") {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes all the values from a set. O(n).\n     *\n     * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the\n     * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.\n     */\n    function clear(UintSet storage set) internal {\n        _clear(set._inner);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        assembly (\"memory-safe\") {\n            result := store\n        }\n\n        return result;\n    }\n\n    /**\n     * @dev Return a slice of the set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set, uint256 start, uint256 end) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner, start, end);\n        uint256[] memory result;\n\n        assembly (\"memory-safe\") {\n            result := store\n        }\n\n        return result;\n    }\n\n    struct StringSet {\n        // Storage of set values\n        string[] _values;\n        // Position is the index of the value in the `values` array plus 1.\n        // Position 0 is used to mean a value is not in the set.\n        mapping(string value => uint256) _positions;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(StringSet storage set, string memory value) internal returns (bool) {\n        if (!contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._positions[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(StringSet storage set, string memory value) internal returns (bool) {\n        // We cache the value's position to prevent multiple reads from the same storage slot\n        uint256 position = set._positions[value];\n\n        if (position != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 valueIndex = position - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (valueIndex != lastIndex) {\n                string memory lastValue = set._values[lastIndex];\n\n                // Move the lastValue to the index where the value to delete is\n                set._values[valueIndex] = lastValue;\n                // Update the tracked position of the lastValue (that was just moved)\n                set._positions[lastValue] = position;\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the tracked position for the deleted slot\n            delete set._positions[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes all the values from a set. O(n).\n     *\n     * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the\n     * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.\n     */\n    function clear(StringSet storage set) internal {\n        uint256 len = length(set);\n        for (uint256 i = 0; i < len; ++i) {\n            delete set._positions[set._values[i]];\n        }\n        Arrays.unsafeSetLength(set._values, 0);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(StringSet storage set, string memory value) internal view returns (bool) {\n        return set._positions[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function length(StringSet storage set) internal view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(StringSet storage set, uint256 index) internal view returns (string memory) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(StringSet storage set) internal view returns (string[] memory) {\n        return set._values;\n    }\n\n    /**\n     * @dev Return a slice of the set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(StringSet storage set, uint256 start, uint256 end) internal view returns (string[] memory) {\n        unchecked {\n            end = Math.min(end, length(set));\n            start = Math.min(start, end);\n\n            uint256 len = end - start;\n            string[] memory result = new string[](len);\n            for (uint256 i = 0; i < len; ++i) {\n                result[i] = Arrays.unsafeAccess(set._values, start + i).value;\n            }\n            return result;\n        }\n    }\n\n    struct BytesSet {\n        // Storage of set values\n        bytes[] _values;\n        // Position is the index of the value in the `values` array plus 1.\n        // Position 0 is used to mean a value is not in the set.\n        mapping(bytes value => uint256) _positions;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(BytesSet storage set, bytes memory value) internal returns (bool) {\n        if (!contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._positions[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(BytesSet storage set, bytes memory value) internal returns (bool) {\n        // We cache the value's position to prevent multiple reads from the same storage slot\n        uint256 position = set._positions[value];\n\n        if (position != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 valueIndex = position - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (valueIndex != lastIndex) {\n                bytes memory lastValue = set._values[lastIndex];\n\n                // Move the lastValue to the index where the value to delete is\n                set._values[valueIndex] = lastValue;\n                // Update the tracked position of the lastValue (that was just moved)\n                set._positions[lastValue] = position;\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the tracked position for the deleted slot\n            delete set._positions[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes all the values from a set. O(n).\n     *\n     * WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the\n     * function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.\n     */\n    function clear(BytesSet storage set) internal {\n        uint256 len = length(set);\n        for (uint256 i = 0; i < len; ++i) {\n            delete set._positions[set._values[i]];\n        }\n        Arrays.unsafeSetLength(set._values, 0);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(BytesSet storage set, bytes memory value) internal view returns (bool) {\n        return set._positions[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function length(BytesSet storage set) internal view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(BytesSet storage set, uint256 index) internal view returns (bytes memory) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(BytesSet storage set) internal view returns (bytes[] memory) {\n        return set._values;\n    }\n\n    /**\n     * @dev Return a slice of the set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(BytesSet storage set, uint256 start, uint256 end) internal view returns (bytes[] memory) {\n        unchecked {\n            end = Math.min(end, length(set));\n            start = Math.min(start, end);\n\n            uint256 len = end - start;\n            bytes[] memory result = new bytes[](len);\n            for (uint256 i = 0; i < len; ++i) {\n                result[i] = Arrays.unsafeAccess(set._values, start + i).value;\n            }\n            return result;\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"},{"file_path":"contracts/storage/FractionalReserveStorageUtils.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IFractionalReserve } from \"../interfaces/IFractionalReserve.sol\";\n\n/// @title FractionalReserveStorageUtils\n/// @author kexley, Cap Labs\n/// @notice Storage utilities for Fractional Reserve contract\nabstract contract FractionalReserveStorageUtils {\n    /// @dev keccak256(abi.encode(uint256(keccak256(\"cap.storage.FractionalReserve\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 constant FractionalReserveStorageLocation =\n        0x5c48f30a22a9811126b69b5adcaabfc5ae0a83b6493e1b31e09dc579923ad100;\n\n    /// @notice Get FractionalReserve storage\n    /// @return $ Storage pointer\n    function getFractionalReserveStorage()\n        internal\n        pure\n        returns (IFractionalReserve.FractionalReserveStorage storage $)\n    {\n        assembly {\n            $.slot := FractionalReserveStorageLocation\n        }\n    }\n}\n"},{"file_path":"contracts/access/Access.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IAccess } from \"../interfaces/IAccess.sol\";\nimport { IAccessControl } from \"../interfaces/IAccessControl.sol\";\n\nimport { AccessStorageUtils } from \"../storage/AccessStorageUtils.sol\";\nimport { Initializable } from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/// @title Access\n/// @author kexley, Cap Labs\n/// @notice Inheritable access\nabstract contract Access is IAccess, Initializable, AccessStorageUtils {\n    /// @dev Check caller has permissions for a function, revert if call is not allowed\n    /// @param _selector Function selector\n    modifier checkAccess(bytes4 _selector) {\n        _checkAccess(_selector);\n        _;\n    }\n\n    /// @dev Initialize the access control address\n    /// @param _accessControl Access control address\n    function __Access_init(address _accessControl) internal onlyInitializing {\n        __Access_init_unchained(_accessControl);\n    }\n\n    /// @dev Initialize unchained\n    /// @param _accessControl Access control address\n    function __Access_init_unchained(address _accessControl) internal onlyInitializing {\n        getAccessStorage().accessControl = _accessControl;\n    }\n\n    /// @dev Check caller has access to a function, revert overwise\n    /// @param _selector Function selector\n    function _checkAccess(bytes4 _selector) internal view {\n        bool hasAccess =\n            IAccessControl(getAccessStorage().accessControl).checkAccess(_selector, address(this), msg.sender);\n        if (!hasAccess) revert AccessDenied();\n    }\n}\n"},{"file_path":"contracts/interfaces/IVault.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/// @title Vault interface for storing the backing for cTokens\n/// @author kexley, Cap Labs\n/// @notice Interface for the Vault contract which handles supplies, borrows and utilization tracking\ninterface IVault {\n    /// @dev Storage for the vault\n    /// @param assets List of assets\n    /// @param totalSupplies Total supplies of an asset\n    /// @param totalBorrows Total borrows of an asset\n    /// @param utilizationIndex Utilization index of an asset\n    /// @param lastUpdate Last update time of an asset\n    /// @param paused Pause state of an asset\n    /// @param insuranceFund Insurance fund address\n    struct VaultStorage {\n        EnumerableSet.AddressSet assets;\n        mapping(address => uint256) totalSupplies;\n        mapping(address => uint256) totalBorrows;\n        mapping(address => uint256) utilizationIndex;\n        mapping(address => uint256) lastUpdate;\n        mapping(address => bool) paused;\n        address insuranceFund;\n    }\n\n    /// @dev Parameters for minting or burning\n    /// @param asset Asset to mint or burn\n    /// @param amountIn Amount of asset to use in the minting or burning\n    /// @param amountOut Amount of cap token to mint or burn\n    /// @param minAmountOut Minimum amount to mint or burn\n    /// @param receiver Receiver of the minting or burning\n    /// @param deadline Deadline of the tx\n    /// @param fee Fee paid to the insurance fund\n    struct MintBurnParams {\n        address asset;\n        uint256 amountIn;\n        uint256 amountOut;\n        uint256 minAmountOut;\n        address receiver;\n        uint256 deadline;\n        uint256 fee;\n    }\n\n    /// @dev Parameters for redeeming\n    /// @param amountIn Amount of cap token to burn\n    /// @param amountsOut Amounts of assets to withdraw\n    /// @param minAmountsOut Minimum amounts of assets to withdraw\n    /// @param receiver Receiver of the withdrawal\n    /// @param deadline Deadline of the tx\n    /// @param fees Fees paid to the insurance fund\n    struct RedeemParams {\n        uint256 amountIn;\n        uint256[] amountsOut;\n        uint256[] minAmountsOut;\n        address receiver;\n        uint256 deadline;\n        uint256[] fees;\n    }\n\n    /// @dev Parameters for borrowing\n    /// @param asset Asset to borrow\n    /// @param amount Amount of asset to borrow\n    /// @param receiver Receiver of the borrow\n    struct BorrowParams {\n        address asset;\n        uint256 amount;\n        address receiver;\n    }\n\n    /// @dev Parameters for repaying\n    /// @param asset Asset to repay\n    /// @param amount Amount of asset to repay\n    struct RepayParams {\n        address asset;\n        uint256 amount;\n    }\n\n    /// @notice Mint the cap token using an asset\n    /// @dev This contract must have approval to move asset from msg.sender\n    /// @dev The amount in is capped by the deposit cap of the asset\n    /// @param _asset Whitelisted asset to deposit\n    /// @param _amountIn Amount of asset to use in the minting\n    /// @param _minAmountOut Minimum amount to mint\n    /// @param _receiver Receiver of the minting\n    /// @param _deadline Deadline of the tx\n    function mint(address _asset, uint256 _amountIn, uint256 _minAmountOut, address _receiver, uint256 _deadline)\n        external\n        returns (uint256 amountOut);\n\n    /// @notice Burn the cap token for an asset\n    /// @dev Asset is withdrawn from the reserve or divested from the underlying vault\n    /// @param _asset Asset to withdraw\n    /// @param _amountIn Amount of cap token to burn\n    /// @param _minAmountOut Minimum amount out to receive\n    /// @param _receiver Receiver of the withdrawal\n    /// @param _deadline Deadline of the tx\n    function burn(address _asset, uint256 _amountIn, uint256 _minAmountOut, address _receiver, uint256 _deadline)\n        external\n        returns (uint256 amountOut);\n\n    /// @notice Redeem the Cap token for a bundle of assets\n    /// @dev Assets are withdrawn from the reserve or divested from the underlying vault\n    /// @param _amountIn Amount of Cap token to burn\n    /// @param _minAmountsOut Minimum amounts of assets to withdraw\n    /// @param _receiver Receiver of the withdrawal\n    /// @param _deadline Deadline of the tx\n    /// @return amountsOut Amount of assets withdrawn\n    function redeem(uint256 _amountIn, uint256[] calldata _minAmountsOut, address _receiver, uint256 _deadline)\n        external\n        returns (uint256[] memory amountsOut);\n\n    /// @notice Borrow an asset\n    /// @dev Whitelisted agents can borrow any amount, LTV is handled by Agent contracts\n    /// @param _asset Asset to borrow\n    /// @param _amount Amount of asset to borrow\n    /// @param _receiver Receiver of the borrow\n    function borrow(address _asset, uint256 _amount, address _receiver) external;\n\n    /// @notice Repay an asset\n    /// @param _asset Asset to repay\n    /// @param _amount Amount of asset to repay\n    function repay(address _asset, uint256 _amount) external;\n\n    /// @notice Add an asset to the vault list\n    /// @param _asset Asset address\n    function addAsset(address _asset) external;\n\n    /// @notice Remove an asset from the vault list\n    /// @param _asset Asset address\n    function removeAsset(address _asset) external;\n\n    /// @notice Pause an asset\n    /// @param _asset Asset address\n    function pauseAsset(address _asset) external;\n\n    /// @notice Unpause an asset\n    /// @param _asset Asset address\n    function unpauseAsset(address _asset) external;\n\n    /// @notice Pause all protocol operations\n    function pauseProtocol() external;\n\n    /// @notice Unpause all protocol operations\n    function unpauseProtocol() external;\n\n    /// @notice Set the insurance fund\n    /// @param _insuranceFund Insurance fund address\n    function setInsuranceFund(address _insuranceFund) external;\n\n    /// @notice Rescue an unsupported asset\n    /// @param _asset Asset to rescue\n    /// @param _receiver Receiver of the rescue\n    function rescueERC20(address _asset, address _receiver) external;\n\n    /// @notice Get the list of assets supported by the vault\n    /// @return assetList List of assets\n    function assets() external view returns (address[] memory assetList);\n\n    /// @notice Get the total supplies of an asset\n    /// @param _asset Asset address\n    /// @return totalSupply Total supply\n    function totalSupplies(address _asset) external view returns (uint256 totalSupply);\n\n    /// @notice Get the total borrows of an asset\n    /// @param _asset Asset address\n    /// @return totalBorrow Total borrow\n    function totalBorrows(address _asset) external view returns (uint256 totalBorrow);\n\n    /// @notice Get the pause state of an asset\n    /// @param _asset Asset address\n    /// @return isPaused Pause state\n    function paused(address _asset) external view returns (bool isPaused);\n\n    /// @notice Available balance to borrow\n    /// @param _asset Asset to borrow\n    /// @return amount Amount available\n    function availableBalance(address _asset) external view returns (uint256 amount);\n\n    /// @notice Utilization rate of an asset\n    /// @dev Utilization scaled by 1e27\n    /// @param _asset Utilized asset\n    /// @return ratio Utilization ratio\n    function utilization(address _asset) external view returns (uint256 ratio);\n\n    /// @notice Up to date cumulative utilization index of an asset\n    /// @dev Utilization scaled by 1e27\n    /// @param _asset Utilized asset\n    /// @return index Utilization ratio index\n    function currentUtilizationIndex(address _asset) external view returns (uint256 index);\n\n    /// @notice Get the insurance fund\n    /// @return insuranceFund Insurance fund\n    function insuranceFund() external view returns (address);\n\n    /// @notice Get the remaining mint capacity of an asset\n    /// @param _asset Asset address\n    /// @return remainingMintCapacity Remaining mint capacity\n    function getRemainingMintCapacity(address _asset) external view returns (uint256 remainingMintCapacity);\n}\n"},{"file_path":"contracts/vault/Vault.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { Access } from \"../access/Access.sol\";\n\nimport { IMinter } from \"../interfaces/IMinter.sol\";\nimport { IVault } from \"../interfaces/IVault.sol\";\nimport { VaultStorageUtils } from \"../storage/VaultStorageUtils.sol\";\nimport { FractionalReserve } from \"./FractionalReserve.sol\";\nimport { Minter } from \"./Minter.sol\";\nimport { VaultLogic } from \"./libraries/VaultLogic.sol\";\nimport {\n    ERC20PermitUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PermitUpgradeable.sol\";\nimport { PausableUpgradeable } from \"@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol\";\nimport {\n    ReentrancyGuardTransientUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardTransientUpgradeable.sol\";\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/// @title Vault for storing the backing for cTokens\n/// @author kexley, Cap Labs\n/// @notice Tokens are supplied by cToken minters and borrowed by covered agents\n/// @dev Supplies, borrows and utilization rates are tracked. Interest rates should be computed and\n/// charged on the external contracts, only the principle amount is counted on this contract.\nabstract contract Vault is\n    IVault,\n    ERC20PermitUpgradeable,\n    PausableUpgradeable,\n    ReentrancyGuardTransientUpgradeable,\n    Access,\n    Minter,\n    FractionalReserve,\n    VaultStorageUtils\n{\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    /// @inheritdoc IVault\n    function mint(address _asset, uint256 _amountIn, uint256 _minAmountOut, address _receiver, uint256 _deadline)\n        external\n        whenNotPaused\n        nonReentrant\n        returns (uint256 amountOut)\n    {\n        uint256 fee;\n        uint256 remainingMintCapacity = getRemainingMintCapacity(_asset);\n        if (_amountIn > remainingMintCapacity) _amountIn = remainingMintCapacity;\n        (amountOut, fee) = Minter.getMintAmount(_asset, _amountIn);\n        VaultLogic.mint(\n            getVaultStorage(),\n            MintBurnParams({\n                asset: _asset,\n                amountIn: _amountIn,\n                amountOut: amountOut,\n                minAmountOut: _minAmountOut,\n                receiver: _receiver,\n                deadline: _deadline,\n                fee: fee\n            })\n        );\n        _mint(_receiver, amountOut);\n        if (fee > 0) _mint(getVaultStorage().insuranceFund, fee);\n    }\n\n    /// @inheritdoc IVault\n    function burn(address _asset, uint256 _amountIn, uint256 _minAmountOut, address _receiver, uint256 _deadline)\n        external\n        whenNotPaused\n        nonReentrant\n        returns (uint256 amountOut)\n    {\n        uint256 fee;\n        (amountOut, fee) = getBurnAmount(_asset, _amountIn);\n\n        _burn(msg.sender, _amountIn);\n\n        divest(_asset, amountOut + fee);\n\n        VaultLogic.burn(\n            getVaultStorage(),\n            MintBurnParams({\n                asset: _asset,\n                amountIn: _amountIn,\n                amountOut: amountOut,\n                minAmountOut: _minAmountOut,\n                receiver: _receiver,\n                deadline: _deadline,\n                fee: fee\n            })\n        );\n    }\n\n    /// @inheritdoc IVault\n    function redeem(uint256 _amountIn, uint256[] calldata _minAmountsOut, address _receiver, uint256 _deadline)\n        external\n        whenNotPaused\n        nonReentrant\n        returns (uint256[] memory amountsOut)\n    {\n        uint256[] memory fees;\n        (amountsOut, fees) = getRedeemAmount(_amountIn);\n\n        _burn(msg.sender, _amountIn);\n\n        uint256[] memory totalDivestAmounts = new uint256[](amountsOut.length);\n        for (uint256 i; i < amountsOut.length; i++) {\n            totalDivestAmounts[i] = amountsOut[i] + fees[i];\n        }\n        divestMany(assets(), totalDivestAmounts);\n\n        VaultLogic.redeem(\n            getVaultStorage(),\n            RedeemParams({\n                amountIn: _amountIn,\n                amountsOut: amountsOut,\n                minAmountsOut: _minAmountsOut,\n                receiver: _receiver,\n                deadline: _deadline,\n                fees: fees\n            })\n        );\n    }\n\n    /// @inheritdoc IVault\n    function borrow(address _asset, uint256 _amount, address _receiver)\n        external\n        whenNotPaused\n        nonReentrant\n        checkAccess(this.borrow.selector)\n    {\n        divest(_asset, _amount);\n        VaultLogic.borrow(getVaultStorage(), BorrowParams({ asset: _asset, amount: _amount, receiver: _receiver }));\n    }\n\n    /// @inheritdoc IVault\n    function repay(address _asset, uint256 _amount)\n        external\n        whenNotPaused\n        nonReentrant\n        checkAccess(this.repay.selector)\n    {\n        VaultLogic.repay(getVaultStorage(), RepayParams({ asset: _asset, amount: _amount }));\n    }\n\n    /// @inheritdoc IVault\n    function addAsset(address _asset) external checkAccess(this.addAsset.selector) {\n        VaultLogic.addAsset(getVaultStorage(), _asset);\n    }\n\n    /// @inheritdoc IVault\n    function removeAsset(address _asset) external checkAccess(this.removeAsset.selector) {\n        VaultLogic.removeAsset(getVaultStorage(), _asset);\n    }\n\n    /// @inheritdoc IVault\n    function pauseAsset(address _asset) external checkAccess(this.pauseAsset.selector) {\n        VaultLogic.pause(getVaultStorage(), _asset);\n    }\n\n    /// @inheritdoc IVault\n    function unpauseAsset(address _asset) external checkAccess(this.unpauseAsset.selector) {\n        VaultLogic.unpause(getVaultStorage(), _asset);\n    }\n\n    /// @inheritdoc IVault\n    function pauseProtocol() external checkAccess(this.pauseProtocol.selector) {\n        _pause();\n    }\n\n    /// @inheritdoc IVault\n    function unpauseProtocol() external checkAccess(this.unpauseProtocol.selector) {\n        _unpause();\n    }\n\n    /// @inheritdoc IVault\n    function setInsuranceFund(address _insuranceFund) external checkAccess(this.setInsuranceFund.selector) {\n        VaultLogic.setInsuranceFund(getVaultStorage(), _insuranceFund);\n    }\n\n    /// @inheritdoc IVault\n    function rescueERC20(address _asset, address _receiver) external checkAccess(this.rescueERC20.selector) {\n        VaultLogic.rescueERC20(getVaultStorage(), getFractionalReserveStorage(), _asset, _receiver);\n    }\n\n    /// @inheritdoc IVault\n    function assets() public view returns (address[] memory assetList) {\n        assetList = getVaultStorage().assets.values();\n    }\n\n    /// @inheritdoc IVault\n    function totalSupplies(address _asset) public view returns (uint256 _totalSupply) {\n        _totalSupply = getVaultStorage().totalSupplies[_asset];\n    }\n\n    /// @inheritdoc IVault\n    function totalBorrows(address _asset) external view returns (uint256 totalBorrow) {\n        totalBorrow = getVaultStorage().totalBorrows[_asset];\n    }\n\n    /// @inheritdoc IVault\n    function paused(address _asset) external view returns (bool isPaused) {\n        isPaused = getVaultStorage().paused[_asset];\n    }\n\n    /// @inheritdoc IVault\n    function availableBalance(address _asset) external view returns (uint256 amount) {\n        amount = VaultLogic.availableBalance(getVaultStorage(), _asset);\n    }\n\n    /// @inheritdoc IVault\n    function utilization(address _asset) external view returns (uint256 ratio) {\n        ratio = VaultLogic.utilization(getVaultStorage(), _asset);\n    }\n\n    /// @inheritdoc IVault\n    function currentUtilizationIndex(address _asset) external view returns (uint256 index) {\n        index = VaultLogic.currentUtilizationIndex(getVaultStorage(), _asset);\n    }\n\n    /// @inheritdoc IVault\n    function insuranceFund() external view returns (address) {\n        return getVaultStorage().insuranceFund;\n    }\n\n    /// @inheritdoc IMinter\n    function getMintAmount(address _asset, uint256 _amountIn)\n        public\n        view\n        override\n        returns (uint256 amountOut, uint256 fee)\n    {\n        uint256 remainingMintCapacity = getRemainingMintCapacity(_asset);\n        if (_amountIn > remainingMintCapacity) _amountIn = remainingMintCapacity;\n        (amountOut, fee) = Minter.getMintAmount(_asset, _amountIn);\n    }\n\n    /// @inheritdoc IMinter\n    function getMintAmount(address _user, address _asset, uint256 _amountIn)\n        public\n        view\n        override\n        returns (uint256 amountOut, uint256 fee)\n    {\n        uint256 remainingMintCapacity = getRemainingMintCapacity(_asset);\n        if (_amountIn > remainingMintCapacity) _amountIn = remainingMintCapacity;\n        (amountOut, fee) = Minter.getMintAmount(_user, _asset, _amountIn);\n    }\n\n    /// @inheritdoc IVault\n    function getRemainingMintCapacity(address _asset) public view returns (uint256 remainingMintCapacity) {\n        uint256 totalSupply = totalSupplies(_asset);\n        uint256 cap = depositCap(_asset);\n        if (cap > totalSupply) remainingMintCapacity = cap - totalSupply;\n    }\n\n    /// @dev Initialize the assets\n    /// @param _name Name of the cap token\n    /// @param _symbol Symbol of the cap token\n    /// @param _accessControl Access control address\n    /// @param _feeAuction Fee auction address\n    /// @param _oracle Oracle address\n    /// @param _assets Asset addresses\n    /// @param _insuranceFund Insurance fund\n    function __Vault_init(\n        string memory _name,\n        string memory _symbol,\n        address _accessControl,\n        address _feeAuction,\n        address _oracle,\n        address[] calldata _assets,\n        address _insuranceFund\n    ) internal onlyInitializing {\n        __ERC20_init(_name, _symbol);\n        __ERC20Permit_init(_name);\n        __Access_init(_accessControl);\n        __FractionalReserve_init(_feeAuction);\n        __Minter_init(_oracle);\n        __Vault_init_unchained(_assets, _insuranceFund);\n    }\n\n    /// @dev Initialize unchained\n    /// @param _assets Asset addresses\n    /// @param _insuranceFund Insurance fund\n    function __Vault_init_unchained(address[] calldata _assets, address _insuranceFund) internal onlyInitializing {\n        VaultStorage storage $ = getVaultStorage();\n        uint256 length = _assets.length;\n        for (uint256 i; i < length; ++i) {\n            $.assets.add(_assets[i]);\n        }\n        $.insuranceFund = _insuranceFund;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.20;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing a bytes32 `messageHash` with\n     * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n     * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n     * keccak256, although any bytes32 value can be safely used because the final digest will\n     * be re-hashed.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n        }\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x45` (`personal_sign` messages).\n     *\n     * The digest is calculated by prefixing an arbitrary `message` with\n     * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n     * hash signed when using the https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign[`eth_sign`] JSON-RPC method.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n        return\n            keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n     * `0x00` (data with intended validator).\n     *\n     * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n     * `validator` address. Then hashing the result.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n    }\n\n    /**\n     * @dev Variant of {toDataWithIntendedValidatorHash-address-bytes} optimized for cases where `data` is a bytes32.\n     */\n    function toDataWithIntendedValidatorHash(\n        address validator,\n        bytes32 messageHash\n    ) internal pure returns (bytes32 digest) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, hex\"19_00\")\n            mstore(0x02, shl(96, validator))\n            mstore(0x16, messageHash)\n            digest := keccak256(0x00, 0x36)\n        }\n    }\n\n    /**\n     * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n     *\n     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n     * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n     *\n     * See {ECDSA-recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n        assembly (\"memory-safe\") {\n            let ptr := mload(0x40)\n            mstore(ptr, hex\"19_01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            digest := keccak256(ptr, 0x42)\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\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"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Errors.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)\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 *\n * _Available since v5.1._\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    /**\n     * @dev A necessary precompile is missing.\n     */\n    error MissingPrecompile(address);\n}\n"},{"file_path":"contracts/interfaces/IOracle.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IPriceOracle } from \"./IPriceOracle.sol\";\nimport { IRateOracle } from \"./IRateOracle.sol\";\n\n/// @title Oracle\n/// @author kexley, Cap Labs\n/// @notice Price and rate oracles are unified\ninterface IOracle is IPriceOracle, IRateOracle {\n    /// @notice Initialize the oracle\n    /// @param _accessControl Access control address\n    function initialize(address _accessControl) external;\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC20} from \"../token/ERC20/IERC20.sol\";\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/SlotDerivation.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/SlotDerivation.sol)\n// This file was procedurally generated from scripts/generate/templates/SlotDerivation.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for computing storage (and transient storage) locations from namespaces and deriving slots\n * corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by\n * the solidity language / compiler.\n *\n * See https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays[Solidity docs for mappings and dynamic arrays.].\n *\n * Example usage:\n * ```solidity\n * contract Example {\n *     // Add the library methods\n *     using StorageSlot for bytes32;\n *     using SlotDerivation for bytes32;\n *\n *     // Declare a namespace\n *     string private constant _NAMESPACE = \"<namespace>\"; // eg. OpenZeppelin.Slot\n *\n *     function setValueInNamespace(uint256 key, address newValue) internal {\n *         _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value = newValue;\n *     }\n *\n *     function getValueInNamespace(uint256 key) internal view returns (address) {\n *         return _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value;\n *     }\n * }\n * ```\n *\n * TIP: Consider using this library along with {StorageSlot}.\n *\n * NOTE: This library provides a way to manipulate storage locations in a non-standard way. Tooling for checking\n * upgrade safety will ignore the slots accessed through this library.\n *\n * _Available since v5.1._\n */\nlibrary SlotDerivation {\n    /**\n     * @dev Derive an ERC-7201 slot from a string (namespace).\n     */\n    function erc7201Slot(string memory namespace) internal pure returns (bytes32 slot) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, sub(keccak256(add(namespace, 0x20), mload(namespace)), 1))\n            slot := and(keccak256(0x00, 0x20), not(0xff))\n        }\n    }\n\n    /**\n     * @dev Add an offset to a slot to get the n-th element of a structure or an array.\n     */\n    function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) {\n        unchecked {\n            return bytes32(uint256(slot) + pos);\n        }\n    }\n\n    /**\n     * @dev Derive the location of the first element in an array from the slot where the length is stored.\n     */\n    function deriveArray(bytes32 slot) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, slot)\n            result := keccak256(0x00, 0x20)\n        }\n    }\n\n    /**\n     * @dev Derive the location of a mapping element from the key.\n     */\n    function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, and(key, shr(96, not(0))))\n            mstore(0x20, slot)\n            result := keccak256(0x00, 0x40)\n        }\n    }\n\n    /**\n     * @dev Derive the location of a mapping element from the key.\n     */\n    function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, iszero(iszero(key)))\n            mstore(0x20, slot)\n            result := keccak256(0x00, 0x40)\n        }\n    }\n\n    /**\n     * @dev Derive the location of a mapping element from the key.\n     */\n    function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, key)\n            mstore(0x20, slot)\n            result := keccak256(0x00, 0x40)\n        }\n    }\n\n    /**\n     * @dev Derive the location of a mapping element from the key.\n     */\n    function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, key)\n            mstore(0x20, slot)\n            result := keccak256(0x00, 0x40)\n        }\n    }\n\n    /**\n     * @dev Derive the location of a mapping element from the key.\n     */\n    function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            mstore(0x00, key)\n            mstore(0x20, slot)\n            result := keccak256(0x00, 0x40)\n        }\n    }\n\n    /**\n     * @dev Derive the location of a mapping element from the key.\n     */\n    function deriveMapping(bytes32 slot, string memory key) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            let length := mload(key)\n            let begin := add(key, 0x20)\n            let end := add(begin, length)\n            let cache := mload(end)\n            mstore(end, slot)\n            result := keccak256(begin, add(length, 0x20))\n            mstore(end, cache)\n        }\n    }\n\n    /**\n     * @dev Derive the location of a mapping element from the key.\n     */\n    function deriveMapping(bytes32 slot, bytes memory key) internal pure returns (bytes32 result) {\n        assembly (\"memory-safe\") {\n            let length := mload(key)\n            let begin := add(key, 0x20)\n            let end := add(begin, length)\n            let cache := mload(end)\n            mstore(end, slot)\n            result := keccak256(begin, add(length, 0x20))\n            mstore(end, cache)\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/NoncesUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)\npragma solidity ^0.8.20;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides tracking nonces for addresses. Nonces will only increment.\n */\nabstract contract NoncesUpgradeable is Initializable {\n    /**\n     * @dev The nonce used for an `account` is not the expected current nonce.\n     */\n    error InvalidAccountNonce(address account, uint256 currentNonce);\n\n    /// @custom:storage-location erc7201:openzeppelin.storage.Nonces\n    struct NoncesStorage {\n        mapping(address account => uint256) _nonces;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Nonces\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant NoncesStorageLocation = 0x5ab42ced628888259c08ac98db1eb0cf702fc1501344311d8b100cd1bfe4bb00;\n\n    function _getNoncesStorage() private pure returns (NoncesStorage storage $) {\n        assembly {\n            $.slot := NoncesStorageLocation\n        }\n    }\n\n    function __Nonces_init() internal onlyInitializing {\n    }\n\n    function __Nonces_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Returns the next unused nonce for an address.\n     */\n    function nonces(address owner) public view virtual returns (uint256) {\n        NoncesStorage storage $ = _getNoncesStorage();\n        return $._nonces[owner];\n    }\n\n    /**\n     * @dev Consumes a nonce.\n     *\n     * Returns the current value and increments nonce.\n     */\n    function _useNonce(address owner) internal virtual returns (uint256) {\n        NoncesStorage storage $ = _getNoncesStorage();\n        // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be\n        // decremented or reset. This guarantees that the nonce never overflows.\n        unchecked {\n            // It is important to do x++ and not ++x here.\n            return $._nonces[owner]++;\n        }\n    }\n\n    /**\n     * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.\n     */\n    function _useCheckedNonce(address owner, uint256 nonce) internal virtual {\n        uint256 current = _useNonce(owner);\n        if (nonce != current) {\n            revert InvalidAccountNonce(owner, current);\n        }\n    }\n}\n"},{"file_path":"contracts/vault/Minter.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { Access } from \"../access/Access.sol\";\n\nimport { IMinter } from \"../interfaces/IMinter.sol\";\nimport { MinterStorageUtils } from \"../storage/MinterStorageUtils.sol\";\nimport { MinterLogic } from \"./libraries/MinterLogic.sol\";\n\n/// @title Minter/burner for cap tokens\n/// @author kexley, Cap Labs\n/// @notice Cap tokens are minted or burned in exchange for collateral ratio of the backing tokens\n/// @dev Dynamic fees are applied according to the allocation of assets in the basket. Increasing\n/// the supply of a excessive asset or burning for an scarce asset will charge fees on a kinked\n/// slope. Redeem can be used to avoid these fees by burning for the current ratio of assets.\nabstract contract Minter is IMinter, Access, MinterStorageUtils {\n    /// @inheritdoc IMinter\n    function getFeeData(address _asset) external view returns (FeeData memory feeData) {\n        feeData = getMinterStorage().fees[_asset];\n    }\n\n    /// @inheritdoc IMinter\n    function setFeeData(address _asset, FeeData calldata _feeData) external checkAccess(this.setFeeData.selector) {\n        if (_feeData.minMintFee >= 0.05e27) revert InvalidMinMintFee();\n        if (_feeData.mintKinkRatio >= 1e27 || _feeData.mintKinkRatio == 0) revert InvalidMintKinkRatio();\n        if (_feeData.burnKinkRatio >= 1e27 || _feeData.burnKinkRatio == 0) revert InvalidBurnKinkRatio();\n        if (_feeData.optimalRatio >= 1e27 || _feeData.optimalRatio == 0) revert InvalidOptimalRatio();\n        if (_feeData.optimalRatio == _feeData.mintKinkRatio || _feeData.optimalRatio == _feeData.burnKinkRatio) {\n            revert InvalidOptimalRatio();\n        }\n        getMinterStorage().fees[_asset] = _feeData;\n        emit SetFeeData(_asset, _feeData);\n    }\n\n    /// @inheritdoc IMinter\n    function getRedeemFee() external view returns (uint256 redeemFee) {\n        redeemFee = getMinterStorage().redeemFee;\n    }\n\n    /// @inheritdoc IMinter\n    function setRedeemFee(uint256 _redeemFee) external checkAccess(this.setRedeemFee.selector) {\n        getMinterStorage().redeemFee = _redeemFee;\n        emit SetRedeemFee(_redeemFee);\n    }\n\n    /// @inheritdoc IMinter\n    function setWhitelist(address _user, bool _whitelisted) external checkAccess(this.setWhitelist.selector) {\n        getMinterStorage().whitelist[_user] = _whitelisted;\n        emit SetWhitelist(_user, _whitelisted);\n    }\n\n    /// @inheritdoc IMinter\n    function setDepositCap(address _asset, uint256 _cap) external checkAccess(this.setDepositCap.selector) {\n        getMinterStorage().depositCap[_asset] = _cap;\n        emit SetDepositCap(_asset, _cap);\n    }\n\n    /// @inheritdoc IMinter\n    function getMintAmount(address _asset, uint256 _amountIn)\n        public\n        view\n        virtual\n        returns (uint256 amountOut, uint256 fee)\n    {\n        (amountOut, fee) = MinterLogic.amountOut(\n            getMinterStorage(), AmountOutParams({ mint: true, asset: _asset, amount: _amountIn, user: msg.sender })\n        );\n    }\n\n    /// @inheritdoc IMinter\n    function getMintAmount(address _user, address _asset, uint256 _amountIn)\n        public\n        view\n        virtual\n        returns (uint256 amountOut, uint256 fee)\n    {\n        (amountOut, fee) = MinterLogic.amountOut(\n            getMinterStorage(), AmountOutParams({ mint: true, asset: _asset, amount: _amountIn, user: _user })\n        );\n    }\n\n    /// @inheritdoc IMinter\n    function getBurnAmount(address _asset, uint256 _amountIn) public view returns (uint256 amountOut, uint256 fee) {\n        (amountOut, fee) = MinterLogic.amountOut(\n            getMinterStorage(), AmountOutParams({ mint: false, asset: _asset, amount: _amountIn, user: msg.sender })\n        );\n    }\n\n    /// @inheritdoc IMinter\n    function getBurnAmount(address _user, address _asset, uint256 _amountIn)\n        public\n        view\n        returns (uint256 amountOut, uint256 fee)\n    {\n        (amountOut, fee) = MinterLogic.amountOut(\n            getMinterStorage(), AmountOutParams({ mint: false, asset: _asset, amount: _amountIn, user: _user })\n        );\n    }\n\n    /// @inheritdoc IMinter\n    function getRedeemAmount(uint256 _amountIn)\n        public\n        view\n        returns (uint256[] memory amountsOut, uint256[] memory fees)\n    {\n        (amountsOut, fees) = MinterLogic.redeemAmountOut(\n            getMinterStorage(), RedeemAmountOutParams({ amount: _amountIn, user: msg.sender })\n        );\n    }\n\n    /// @inheritdoc IMinter\n    function getRedeemAmount(address _user, uint256 _amountIn)\n        public\n        view\n        returns (uint256[] memory amountsOut, uint256[] memory fees)\n    {\n        (amountsOut, fees) = MinterLogic.redeemAmountOut(\n            getMinterStorage(), RedeemAmountOutParams({ amount: _amountIn, user: _user })\n        );\n    }\n\n    /// @inheritdoc IMinter\n    function whitelisted(address _user) external view returns (bool isWhitelisted) {\n        isWhitelisted = getMinterStorage().whitelist[_user];\n    }\n\n    /// @inheritdoc IMinter\n    function depositCap(address _asset) public view returns (uint256 cap) {\n        cap = getMinterStorage().depositCap[_asset];\n    }\n\n    /// @dev Initialize unchained\n    /// @param _oracle Oracle address\n    function __Minter_init(address _oracle) internal onlyInitializing {\n        getMinterStorage().oracle = _oracle;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC5267.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC5267.sol)\n\npragma solidity >=0.4.16;\n\ninterface IERC5267 {\n    /**\n     * @dev MAY be emitted to signal that the domain could have changed.\n     */\n    event EIP712DomainChanged();\n\n    /**\n     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n     * signature.\n     */\n    function eip712Domain()\n        external\n        view\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        );\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)\n\npragma solidity >=0.4.16;\n\nimport {IERC165} from \"../utils/introspection/IERC165.sol\";\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)\n\npragma solidity ^0.8.20;\n\nimport {ContextUpgradeable} from \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable\n    struct PausableStorage {\n        bool _paused;\n    }\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.Pausable\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;\n\n    function _getPausableStorage() private pure returns (PausableStorage storage $) {\n        assembly {\n            $.slot := PausableStorageLocation\n        }\n    }\n\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n\n    /**\n     * @dev The operation failed because the contract is paused.\n     */\n    error EnforcedPause();\n\n    /**\n     * @dev The operation failed because the contract is not paused.\n     */\n    error ExpectedPause();\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        _requireNotPaused();\n        _;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        _requirePaused();\n        _;\n    }\n\n    function __Pausable_init() internal onlyInitializing {\n    }\n\n    function __Pausable_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        PausableStorage storage $ = _getPausableStorage();\n        return $._paused;\n    }\n\n    /**\n     * @dev Throws if the contract is paused.\n     */\n    function _requireNotPaused() internal view virtual {\n        if (paused()) {\n            revert EnforcedPause();\n        }\n    }\n\n    /**\n     * @dev Throws if the contract is not paused.\n     */\n    function _requirePaused() internal view virtual {\n        if (!paused()) {\n            revert ExpectedPause();\n        }\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        PausableStorage storage $ = _getPausableStorage();\n        $._paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        PausableStorage storage $ = _getPausableStorage();\n        $._paused = false;\n        emit Unpaused(_msgSender());\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Arrays.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/Arrays.sol)\n// This file was procedurally generated from scripts/generate/templates/Arrays.js.\n\npragma solidity ^0.8.20;\n\nimport {Comparators} from \"./Comparators.sol\";\nimport {SlotDerivation} from \"./SlotDerivation.sol\";\nimport {StorageSlot} from \"./StorageSlot.sol\";\nimport {Math} from \"./math/Math.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary Arrays {\n    using SlotDerivation for bytes32;\n    using StorageSlot for bytes32;\n\n    /**\n     * @dev Sort an array of uint256 (in memory) following the provided comparator function.\n     *\n     * This function does the sorting \"in place\", meaning that it overrides the input. The object is returned for\n     * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.\n     *\n     * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the\n     * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful\n     * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may\n     * consume more gas than is available in a block, leading to potential DoS.\n     *\n     * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.\n     */\n    function sort(\n        uint256[] memory array,\n        function(uint256, uint256) pure returns (bool) comp\n    ) internal pure returns (uint256[] memory) {\n        _quickSort(_begin(array), _end(array), comp);\n        return array;\n    }\n\n    /**\n     * @dev Variant of {sort} that sorts an array of uint256 in increasing order.\n     */\n    function sort(uint256[] memory array) internal pure returns (uint256[] memory) {\n        sort(array, Comparators.lt);\n        return array;\n    }\n\n    /**\n     * @dev Sort an array of address (in memory) following the provided comparator function.\n     *\n     * This function does the sorting \"in place\", meaning that it overrides the input. The object is returned for\n     * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.\n     *\n     * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the\n     * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful\n     * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may\n     * consume more gas than is available in a block, leading to potential DoS.\n     *\n     * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.\n     */\n    function sort(\n        address[] memory array,\n        function(address, address) pure returns (bool) comp\n    ) internal pure returns (address[] memory) {\n        sort(_castToUint256Array(array), _castToUint256Comp(comp));\n        return array;\n    }\n\n    /**\n     * @dev Variant of {sort} that sorts an array of address in increasing order.\n     */\n    function sort(address[] memory array) internal pure returns (address[] memory) {\n        sort(_castToUint256Array(array), Comparators.lt);\n        return array;\n    }\n\n    /**\n     * @dev Sort an array of bytes32 (in memory) following the provided comparator function.\n     *\n     * This function does the sorting \"in place\", meaning that it overrides the input. The object is returned for\n     * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.\n     *\n     * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the\n     * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful\n     * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may\n     * consume more gas than is available in a block, leading to potential DoS.\n     *\n     * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.\n     */\n    function sort(\n        bytes32[] memory array,\n        function(bytes32, bytes32) pure returns (bool) comp\n    ) internal pure returns (bytes32[] memory) {\n        sort(_castToUint256Array(array), _castToUint256Comp(comp));\n        return array;\n    }\n\n    /**\n     * @dev Variant of {sort} that sorts an array of bytes32 in increasing order.\n     */\n    function sort(bytes32[] memory array) internal pure returns (bytes32[] memory) {\n        sort(_castToUint256Array(array), Comparators.lt);\n        return array;\n    }\n\n    /**\n     * @dev Performs a quick sort of a segment of memory. The segment sorted starts at `begin` (inclusive), and stops\n     * at end (exclusive). Sorting follows the `comp` comparator.\n     *\n     * Invariant: `begin <= end`. This is the case when initially called by {sort} and is preserved in subcalls.\n     *\n     * IMPORTANT: Memory locations between `begin` and `end` are not validated/zeroed. This function should\n     * be used only if the limits are within a memory array.\n     */\n    function _quickSort(uint256 begin, uint256 end, function(uint256, uint256) pure returns (bool) comp) private pure {\n        unchecked {\n            if (end - begin < 0x40) return;\n\n            // Use first element as pivot\n            uint256 pivot = _mload(begin);\n            // Position where the pivot should be at the end of the loop\n            uint256 pos = begin;\n\n            for (uint256 it = begin + 0x20; it < end; it += 0x20) {\n                if (comp(_mload(it), pivot)) {\n                    // If the value stored at the iterator's position comes before the pivot, we increment the\n                    // position of the pivot and move the value there.\n                    pos += 0x20;\n                    _swap(pos, it);\n                }\n            }\n\n            _swap(begin, pos); // Swap pivot into place\n            _quickSort(begin, pos, comp); // Sort the left side of the pivot\n            _quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot\n        }\n    }\n\n    /**\n     * @dev Pointer to the memory location of the first element of `array`.\n     */\n    function _begin(uint256[] memory array) private pure returns (uint256 ptr) {\n        assembly (\"memory-safe\") {\n            ptr := add(array, 0x20)\n        }\n    }\n\n    /**\n     * @dev Pointer to the memory location of the first memory word (32bytes) after `array`. This is the memory word\n     * that comes just after the last element of the array.\n     */\n    function _end(uint256[] memory array) private pure returns (uint256 ptr) {\n        unchecked {\n            return _begin(array) + array.length * 0x20;\n        }\n    }\n\n    /**\n     * @dev Load memory word (as a uint256) at location `ptr`.\n     */\n    function _mload(uint256 ptr) private pure returns (uint256 value) {\n        assembly {\n            value := mload(ptr)\n        }\n    }\n\n    /**\n     * @dev Swaps the elements memory location `ptr1` and `ptr2`.\n     */\n    function _swap(uint256 ptr1, uint256 ptr2) private pure {\n        assembly {\n            let value1 := mload(ptr1)\n            let value2 := mload(ptr2)\n            mstore(ptr1, value2)\n            mstore(ptr2, value1)\n        }\n    }\n\n    /// @dev Helper: low level cast address memory array to uint256 memory array\n    function _castToUint256Array(address[] memory input) private pure returns (uint256[] memory output) {\n        assembly {\n            output := input\n        }\n    }\n\n    /// @dev Helper: low level cast bytes32 memory array to uint256 memory array\n    function _castToUint256Array(bytes32[] memory input) private pure returns (uint256[] memory output) {\n        assembly {\n            output := input\n        }\n    }\n\n    /// @dev Helper: low level cast address comp function to uint256 comp function\n    function _castToUint256Comp(\n        function(address, address) pure returns (bool) input\n    ) private pure returns (function(uint256, uint256) pure returns (bool) output) {\n        assembly {\n            output := input\n        }\n    }\n\n    /// @dev Helper: low level cast bytes32 comp function to uint256 comp function\n    function _castToUint256Comp(\n        function(bytes32, bytes32) pure returns (bool) input\n    ) private pure returns (function(uint256, uint256) pure returns (bool) output) {\n        assembly {\n            output := input\n        }\n    }\n\n    /**\n     * @dev Searches a sorted `array` and returns the first index that contains\n     * a value greater or equal to `element`. If no such index exists (i.e. all\n     * values in the array are strictly less than `element`), the array length is\n     * returned. Time complexity O(log n).\n     *\n     * NOTE: The `array` is expected to be sorted in ascending order, and to\n     * contain no repeated elements.\n     *\n     * IMPORTANT: Deprecated. This implementation behaves as {lowerBound} but lacks\n     * support for repeated elements in the array. The {lowerBound} function should\n     * be used instead.\n     */\n    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n        uint256 low = 0;\n        uint256 high = array.length;\n\n        if (high == 0) {\n            return 0;\n        }\n\n        while (low < high) {\n            uint256 mid = Math.average(low, high);\n\n            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n            // because Math.average rounds towards zero (it does integer division with truncation).\n            if (unsafeAccess(array, mid).value > element) {\n                high = mid;\n            } else {\n                low = mid + 1;\n            }\n        }\n\n        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n        if (low > 0 && unsafeAccess(array, low - 1).value == element) {\n            return low - 1;\n        } else {\n            return low;\n        }\n    }\n\n    /**\n     * @dev Searches an `array` sorted in ascending order and returns the first\n     * index that contains a value greater or equal than `element`. If no such index\n     * exists (i.e. all values in the array are strictly less than `element`), the array\n     * length is returned. Time complexity O(log n).\n     *\n     * See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound].\n     */\n    function lowerBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n        uint256 low = 0;\n        uint256 high = array.length;\n\n        if (high == 0) {\n            return 0;\n        }\n\n        while (low < high) {\n            uint256 mid = Math.average(low, high);\n\n            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n            // because Math.average rounds towards zero (it does integer division with truncation).\n            if (unsafeAccess(array, mid).value < element) {\n                // this cannot overflow because mid < high\n                unchecked {\n                    low = mid + 1;\n                }\n            } else {\n                high = mid;\n            }\n        }\n\n        return low;\n    }\n\n    /**\n     * @dev Searches an `array` sorted in ascending order and returns the first\n     * index that contains a value strictly greater than `element`. If no such index\n     * exists (i.e. all values in the array are strictly less than `element`), the array\n     * length is returned. Time complexity O(log n).\n     *\n     * See C++'s https://en.cppreference.com/w/cpp/algorithm/upper_bound[upper_bound].\n     */\n    function upperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n        uint256 low = 0;\n        uint256 high = array.length;\n\n        if (high == 0) {\n            return 0;\n        }\n\n        while (low < high) {\n            uint256 mid = Math.average(low, high);\n\n            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n            // because Math.average rounds towards zero (it does integer division with truncation).\n            if (unsafeAccess(array, mid).value > element) {\n                high = mid;\n            } else {\n                // this cannot overflow because mid < high\n                unchecked {\n                    low = mid + 1;\n                }\n            }\n        }\n\n        return low;\n    }\n\n    /**\n     * @dev Same as {lowerBound}, but with an array in memory.\n     */\n    function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {\n        uint256 low = 0;\n        uint256 high = array.length;\n\n        if (high == 0) {\n            return 0;\n        }\n\n        while (low < high) {\n            uint256 mid = Math.average(low, high);\n\n            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n            // because Math.average rounds towards zero (it does integer division with truncation).\n            if (unsafeMemoryAccess(array, mid) < element) {\n                // this cannot overflow because mid < high\n                unchecked {\n                    low = mid + 1;\n                }\n            } else {\n                high = mid;\n            }\n        }\n\n        return low;\n    }\n\n    /**\n     * @dev Same as {upperBound}, but with an array in memory.\n     */\n    function upperBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {\n        uint256 low = 0;\n        uint256 high = array.length;\n\n        if (high == 0) {\n            return 0;\n        }\n\n        while (low < high) {\n            uint256 mid = Math.average(low, high);\n\n            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n            // because Math.average rounds towards zero (it does integer division with truncation).\n            if (unsafeMemoryAccess(array, mid) > element) {\n                high = mid;\n            } else {\n                // this cannot overflow because mid < high\n                unchecked {\n                    low = mid + 1;\n                }\n            }\n        }\n\n        return low;\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {\n        bytes32 slot;\n        assembly (\"memory-safe\") {\n            slot := arr.slot\n        }\n        return slot.deriveArray().offset(pos).getAddressSlot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {\n        bytes32 slot;\n        assembly (\"memory-safe\") {\n            slot := arr.slot\n        }\n        return slot.deriveArray().offset(pos).getBytes32Slot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {\n        bytes32 slot;\n        assembly (\"memory-safe\") {\n            slot := arr.slot\n        }\n        return slot.deriveArray().offset(pos).getUint256Slot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(bytes[] storage arr, uint256 pos) internal pure returns (StorageSlot.BytesSlot storage) {\n        bytes32 slot;\n        assembly (\"memory-safe\") {\n            slot := arr.slot\n        }\n        return slot.deriveArray().offset(pos).getBytesSlot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeAccess(string[] storage arr, uint256 pos) internal pure returns (StorageSlot.StringSlot storage) {\n        bytes32 slot;\n        assembly (\"memory-safe\") {\n            slot := arr.slot\n        }\n        return slot.deriveArray().offset(pos).getStringSlot();\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {\n        assembly {\n            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))\n        }\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeMemoryAccess(bytes32[] memory arr, uint256 pos) internal pure returns (bytes32 res) {\n        assembly {\n            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))\n        }\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {\n        assembly {\n            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))\n        }\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeMemoryAccess(bytes[] memory arr, uint256 pos) internal pure returns (bytes memory res) {\n        assembly {\n            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))\n        }\n    }\n\n    /**\n     * @dev Access an array in an \"unsafe\" way. Skips solidity \"index-out-of-range\" check.\n     *\n     * WARNING: Only use if you are certain `pos` is lower than the array length.\n     */\n    function unsafeMemoryAccess(string[] memory arr, uint256 pos) internal pure returns (string memory res) {\n        assembly {\n            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))\n        }\n    }\n\n    /**\n     * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.\n     *\n     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.\n     */\n    function unsafeSetLength(address[] storage array, uint256 len) internal {\n        assembly (\"memory-safe\") {\n            sstore(array.slot, len)\n        }\n    }\n\n    /**\n     * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.\n     *\n     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.\n     */\n    function unsafeSetLength(bytes32[] storage array, uint256 len) internal {\n        assembly (\"memory-safe\") {\n            sstore(array.slot, len)\n        }\n    }\n\n    /**\n     * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.\n     *\n     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.\n     */\n    function unsafeSetLength(uint256[] storage array, uint256 len) internal {\n        assembly (\"memory-safe\") {\n            sstore(array.slot, len)\n        }\n    }\n\n    /**\n     * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.\n     *\n     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.\n     */\n    function unsafeSetLength(bytes[] storage array, uint256 len) internal {\n        assembly (\"memory-safe\") {\n            sstore(array.slot, len)\n        }\n    }\n\n    /**\n     * @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.\n     *\n     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.\n     */\n    function unsafeSetLength(string[] storage array, uint256 len) internal {\n        assembly (\"memory-safe\") {\n            sstore(array.slot, len)\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\nimport {IERC1363} from \"../../../interfaces/IERC1363.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    /**\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 Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {\n        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));\n    }\n\n    /**\n     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.\n     */\n    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {\n        return _callOptionalReturnBool(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     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\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     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the \"client\"\n     * smart contract uses ERC-7674 to set temporary allowances, then the \"client\" smart contract should avoid using\n     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract\n     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.\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     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function\n     * only sets the \"standard\" allowance. Any temporary allowance will remain active, in addition to the value being\n     * set here.\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     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            // bubble errors\n            if iszero(success) {\n                let ptr := mload(0x40)\n                returndatacopy(ptr, 0, returndatasize())\n                revert(ptr, returndatasize())\n            }\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n\n        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {\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 silently catches all reverts and returns a bool instead.\n     */\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly (\"memory-safe\") {\n            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n            returnSize := returndatasize()\n            returnValue := mload(0)\n        }\n        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Panic.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n *      using Panic for uint256;\n *\n *      // Use any of the declared internal constants\n *      function foo() { Panic.GENERIC.panic(); }\n *\n *      // Alternatively\n *      function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n    /// @dev generic / unspecified error\n    uint256 internal constant GENERIC = 0x00;\n    /// @dev used by the assert() builtin\n    uint256 internal constant ASSERT = 0x01;\n    /// @dev arithmetic underflow or overflow\n    uint256 internal constant UNDER_OVERFLOW = 0x11;\n    /// @dev division or modulo by zero\n    uint256 internal constant DIVISION_BY_ZERO = 0x12;\n    /// @dev enum conversion error\n    uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n    /// @dev invalid encoding in storage\n    uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n    /// @dev empty array pop\n    uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n    /// @dev array out of bounds access\n    uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n    /// @dev resource error (too large allocation or too large array)\n    uint256 internal constant RESOURCE_ERROR = 0x41;\n    /// @dev calling invalid internal function\n    uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n    /// @dev Reverts with a panic code. Recommended to use with\n    /// the internal constants with predefined codes.\n    function panic(uint256 code) internal pure {\n        assembly (\"memory-safe\") {\n            mstore(0x00, 0x4e487b71)\n            mstore(0x20, code)\n            revert(0x1c, 0x24)\n        }\n    }\n}\n"},{"file_path":"contracts/interfaces/IPriceOracle.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IOracleTypes } from \"./IOracleTypes.sol\";\n\n/// @title IPriceOracle\n/// @author kexley, Cap Labs\n/// @notice Interface for the price oracle\ninterface IPriceOracle is IOracleTypes {\n    /// @notice Storage for the price oracle\n    /// @param oracleData Oracle data for each asset\n    /// @param backupOracleData Backup oracle data for each asset\n    /// @param staleness Staleness period for each asset\n    struct PriceOracleStorage {\n        mapping(address => IOracleTypes.OracleData) oracleData;\n        mapping(address => IOracleTypes.OracleData) backupOracleData;\n        mapping(address => uint256) staleness;\n    }\n\n    /// @dev Set oracle data\n    event SetPriceOracleData(address asset, IOracleTypes.OracleData data);\n\n    /// @dev Set backup oracle data\n    event SetPriceBackupOracleData(address asset, IOracleTypes.OracleData data);\n\n    /// @dev Set the staleness period for asset prices\n    event SetStaleness(address asset, uint256 staleness);\n\n    /// @dev Price error\n    error PriceError(address asset);\n\n    /// @notice Set the oracle data for an asset\n    /// @param _asset Asset address to set oracle data for\n    /// @param _oracleData Oracle data configuration to set for the asset\n    function setPriceOracleData(address _asset, IOracleTypes.OracleData calldata _oracleData) external;\n\n    /// @notice Set the backup oracle data for an asset\n    /// @param _asset Asset address to set backup oracle data for\n    /// @param _oracleData Backup oracle data configuration to set for the asset\n    function setPriceBackupOracleData(address _asset, IOracleTypes.OracleData calldata _oracleData) external;\n\n    /// @notice Set the staleness period for asset prices\n    /// @param _asset Asset address to set staleness period for\n    /// @param _staleness Staleness period in seconds for asset prices\n    function setStaleness(address _asset, uint256 _staleness) external;\n\n    /// @notice Get the price for an asset\n    /// @param _asset Asset address to get price for\n    /// @return price Current price of the asset\n    /// @return lastUpdated Last updated timestamp\n    function getPrice(address _asset) external view returns (uint256 price, uint256 lastUpdated);\n\n    /// @notice View the oracle data for an asset\n    /// @param _asset Asset address to get oracle data for\n    /// @return data Oracle data configuration for the asset\n    function priceOracleData(address _asset) external view returns (IOracleTypes.OracleData memory data);\n\n    /// @notice View the backup oracle data for an asset\n    /// @param _asset Asset address to get backup oracle data for\n    /// @return data Backup oracle data configuration for the asset\n    function priceBackupOracleData(address _asset) external view returns (IOracleTypes.OracleData memory data);\n\n    /// @notice View the staleness period for asset prices\n    /// @param _asset Asset address to get staleness period for\n    /// @return assetStaleness Staleness period in seconds for asset prices\n    function staleness(address _asset) external view returns (uint256 assetStaleness);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1967.sol)\n\npragma solidity >=0.4.11;\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"},{"file_path":"contracts/vault/libraries/MinterLogic.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { IMinter } from \"../../interfaces/IMinter.sol\";\nimport { IOracle } from \"../../interfaces/IOracle.sol\";\nimport { IVault } from \"../../interfaces/IVault.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC20Metadata } from \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\n/// @title Amount Out Logic\n/// @author kexley, Cap Labs\n/// @notice Amount out logic for exchanging underlying assets with cap tokens\nlibrary MinterLogic {\n    /// @dev Ray precision\n    uint256 constant RAY_PRECISION = 1e27;\n\n    /// @dev Share precision\n    uint256 constant SHARE_PRECISION = 1e33;\n\n    /// @notice Calculate the amount out from a swap including fees\n    /// @param $ Storage pointer\n    /// @param params Parameters for a swap\n    /// @return amount Amount out from a swap\n    /// @return fee Fee applied\n    function amountOut(IMinter.MinterStorage storage $, IMinter.AmountOutParams memory params)\n        external\n        view\n        returns (uint256 amount, uint256 fee)\n    {\n        (uint256 amountOutBeforeFee, uint256 newRatio) = _amountOutBeforeFee($.oracle, params);\n\n        if ($.whitelist[params.user]) {\n            amount = amountOutBeforeFee;\n        } else {\n            (amount, fee) = _applyFeeSlopes(\n                $.fees[params.asset],\n                IMinter.FeeSlopeParams({ mint: params.mint, amount: amountOutBeforeFee, ratio: newRatio })\n            );\n        }\n    }\n\n    /// @notice Calculate the output amounts for redeeming a cap token for a proportional weighting\n    /// @param $ Storage pointer\n    /// @param params Parameters for redeeming\n    /// @return amounts Amount of underlying assets withdrawn\n    /// @return fees Amount of fees applied\n    function redeemAmountOut(IMinter.MinterStorage storage $, IMinter.RedeemAmountOutParams memory params)\n        external\n        view\n        returns (uint256[] memory amounts, uint256[] memory fees)\n    {\n        uint256 redeemFee = $.whitelist[params.user] ? 0 : $.redeemFee;\n        uint256 shares = params.amount * SHARE_PRECISION / IERC20(address(this)).totalSupply();\n        address[] memory assets = IVault(address(this)).assets();\n        uint256 assetLength = assets.length;\n        amounts = new uint256[](assetLength);\n        fees = new uint256[](assetLength);\n        for (uint256 i; i < assetLength; ++i) {\n            address asset = assets[i];\n            uint256 withdrawAmount = IVault(address(this)).totalSupplies(asset) * shares / SHARE_PRECISION;\n\n            fees[i] = withdrawAmount * redeemFee / RAY_PRECISION;\n            amounts[i] = withdrawAmount - fees[i];\n        }\n    }\n\n    /// @notice Calculate the amount out for a swap before fees\n    /// @param _oracle Oracle address\n    /// @param params Parameters for a swap\n    /// @return amount Amount out from a swap before fees\n    /// @return newRatio New ratio of an asset to the overall basket after swap\n    function _amountOutBeforeFee(address _oracle, IMinter.AmountOutParams memory params)\n        internal\n        view\n        returns (uint256 amount, uint256 newRatio)\n    {\n        (uint256 assetPrice,) = IOracle(_oracle).getPrice(params.asset);\n        (uint256 capPrice,) = IOracle(_oracle).getPrice(address(this));\n\n        uint256 assetDecimalsPow = 10 ** IERC20Metadata(params.asset).decimals();\n        uint256 capDecimalsPow = 10 ** IERC20Metadata(address(this)).decimals();\n\n        uint256 capSupply = IERC20(address(this)).totalSupply();\n        uint256 capValue = capSupply * capPrice / capDecimalsPow;\n        uint256 allocationValue = IVault(address(this)).totalSupplies(params.asset) * assetPrice / assetDecimalsPow;\n\n        uint256 assetValue;\n        if (params.mint) {\n            assetValue = params.amount * assetPrice / assetDecimalsPow;\n            if (capSupply == 0) {\n                newRatio = 0;\n                amount = assetValue * capDecimalsPow / assetPrice;\n            } else {\n                newRatio = (allocationValue + assetValue) * RAY_PRECISION / (capValue + assetValue);\n                amount = assetValue * capDecimalsPow / capPrice;\n            }\n        } else {\n            assetValue = params.amount * capPrice / capDecimalsPow;\n            if (params.amount == capSupply) {\n                newRatio = RAY_PRECISION;\n                amount = assetValue * assetDecimalsPow / assetPrice;\n            } else {\n                if (allocationValue < assetValue || capValue <= assetValue) {\n                    newRatio = 0;\n                } else {\n                    newRatio = (allocationValue - assetValue) * RAY_PRECISION / (capValue - assetValue);\n                }\n                amount = assetValue * assetDecimalsPow / assetPrice;\n            }\n        }\n    }\n\n    /// @notice Apply fee slopes to a mint or burn\n    /// @dev Fees only apply to mints or burns that over-allocate the basket to one asset\n    /// @param fees Fee slopes and ratio kinks\n    /// @param params Fee slope parameters\n    /// @return amount Remaining amount after fee applied\n    /// @return fee Fee applied\n    function _applyFeeSlopes(IMinter.FeeData memory fees, IMinter.FeeSlopeParams memory params)\n        internal\n        pure\n        returns (uint256 amount, uint256 fee)\n    {\n        uint256 rate;\n        if (params.mint) {\n            rate = fees.minMintFee;\n            if (params.ratio > fees.optimalRatio) {\n                if (params.ratio > fees.mintKinkRatio) {\n                    uint256 excessRatio = params.ratio - fees.mintKinkRatio;\n                    rate += fees.slope0 + (fees.slope1 * excessRatio / (RAY_PRECISION - fees.mintKinkRatio));\n                } else {\n                    rate += fees.slope0 * (params.ratio - fees.optimalRatio) / (fees.mintKinkRatio - fees.optimalRatio);\n                }\n            }\n        } else {\n            if (params.ratio < fees.optimalRatio) {\n                if (params.ratio < fees.burnKinkRatio) {\n                    uint256 excessRatio = fees.burnKinkRatio - params.ratio;\n                    rate = fees.slope0 + (fees.slope1 * excessRatio / fees.burnKinkRatio);\n                } else {\n                    rate = fees.slope0 * (fees.optimalRatio - params.ratio) / (fees.optimalRatio - fees.burnKinkRatio);\n                }\n            }\n        }\n\n        if (rate > RAY_PRECISION) rate = RAY_PRECISION;\n        fee = params.amount * rate / RAY_PRECISION;\n        amount = params.amount - fee;\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/TransientSlot.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/TransientSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/TransientSlot.js.\n\npragma solidity ^0.8.24;\n\n/**\n * @dev Library for reading and writing value-types to specific transient storage slots.\n *\n * Transient slots are often used to store temporary values that are removed after the current transaction.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n *  * Example reading and writing values using transient storage:\n * ```solidity\n * contract Lock {\n *     using TransientSlot for *;\n *\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 TransientSlot {\n    /**\n     * @dev UDVT that represents a slot holding an address.\n     */\n    type AddressSlot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a AddressSlot.\n     */\n    function asAddress(bytes32 slot) internal pure returns (AddressSlot) {\n        return AddressSlot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a bool.\n     */\n    type BooleanSlot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a BooleanSlot.\n     */\n    function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) {\n        return BooleanSlot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a bytes32.\n     */\n    type Bytes32Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Bytes32Slot.\n     */\n    function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) {\n        return Bytes32Slot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a uint256.\n     */\n    type Uint256Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Uint256Slot.\n     */\n    function asUint256(bytes32 slot) internal pure returns (Uint256Slot) {\n        return Uint256Slot.wrap(slot);\n    }\n\n    /**\n     * @dev UDVT that represents a slot holding a int256.\n     */\n    type Int256Slot is bytes32;\n\n    /**\n     * @dev Cast an arbitrary slot to a Int256Slot.\n     */\n    function asInt256(bytes32 slot) internal pure returns (Int256Slot) {\n        return Int256Slot.wrap(slot);\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(AddressSlot slot) internal view returns (address value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(AddressSlot slot, address value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(BooleanSlot slot) internal view returns (bool value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(BooleanSlot slot, bool value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Bytes32Slot slot) internal view returns (bytes32 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Bytes32Slot slot, bytes32 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Uint256Slot slot) internal view returns (uint256 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Uint256Slot slot, uint256 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n\n    /**\n     * @dev Load the value held at location `slot` in transient storage.\n     */\n    function tload(Int256Slot slot) internal view returns (int256 value) {\n        assembly (\"memory-safe\") {\n            value := tload(slot)\n        }\n    }\n\n    /**\n     * @dev Store `value` at location `slot` in transient storage.\n     */\n    function tstore(Int256Slot slot, int256 value) internal {\n        assembly (\"memory-safe\") {\n            tstore(slot, value)\n        }\n    }\n}\n"},{"file_path":"contracts/interfaces/IMinter.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\n/// @title IMinter\n/// @author kexley, Cap Labs\n/// @notice Interface for Minter contract\ninterface IMinter {\n    /// @dev Minter storage\n    /// @param oracle Oracle address\n    /// @param redeemFee Redeem fee\n    /// @param fees Fees for each asset\n    /// @param whitelist Whitelist for users\n    /// @param depositCap Deposit cap for each asset\n    struct MinterStorage {\n        address oracle;\n        uint256 redeemFee;\n        mapping(address => FeeData) fees;\n        mapping(address => bool) whitelist;\n        mapping(address => uint256) depositCap;\n    }\n\n    /// @dev Fee data set for an asset in a vault\n    /// @param minMintFee Minimum mint fee\n    /// @param slope0 Slope 0\n    /// @param slope1 Slope 1\n    /// @param mintKinkRatio Mint kink ratio\n    /// @param burnKinkRatio Burn kink ratio\n    /// @param optimalRatio Optimal ratio\n    struct FeeData {\n        uint256 minMintFee;\n        uint256 slope0;\n        uint256 slope1;\n        uint256 mintKinkRatio;\n        uint256 burnKinkRatio;\n        uint256 optimalRatio;\n    }\n\n    /// @dev Parameters for applying fee slopes\n    /// @param mint True if applying to mint, false if applying to burn\n    /// @param amount Amount of asset to apply fee to\n    /// @param ratio Ratio of fee to apply\n    struct FeeSlopeParams {\n        bool mint;\n        uint256 amount;\n        uint256 ratio;\n    }\n\n    /// @dev Parameters for minting or burning\n    /// @param mint True if minting, false if burning\n    /// @param asset Asset address\n    /// @param amount Amount of asset to mint or burn\n    /// @param user User address\n    struct AmountOutParams {\n        bool mint;\n        address asset;\n        uint256 amount;\n        address user;\n    }\n\n    /// @dev Parameters for redeeming\n    /// @param amount Amount of cap token to redeem\n    struct RedeemAmountOutParams {\n        uint256 amount;\n        address user;\n    }\n\n    /// @dev Fee data set for an asset in a vault\n    event SetFeeData(address asset, FeeData feeData);\n\n    /// @dev Redeem fee set\n    event SetRedeemFee(uint256 redeemFee);\n\n    /// @dev Whitelist set\n    event SetWhitelist(address user, bool whitelisted);\n\n    /// @dev Deposit cap set\n    event SetDepositCap(address asset, uint256 cap);\n\n    /// @dev Invalid minimum mint fee\n    error InvalidMinMintFee();\n\n    /// @dev Invalid mint kink ratio\n    error InvalidMintKinkRatio();\n\n    /// @dev Invalid burn kink ratio\n    error InvalidBurnKinkRatio();\n\n    /// @dev Invalid optimal ratio\n    error InvalidOptimalRatio();\n\n    /// @notice Get the fee data for an asset\n    /// @param _asset Asset address\n    /// @return feeData Fee data for the asset\n    function getFeeData(address _asset) external view returns (FeeData memory feeData);\n\n    /// @notice Set the allocation slopes and ratios for an asset\n    /// @param _asset Asset address\n    /// @param _feeData Fee slopes and ratios for the asset in the vault\n    function setFeeData(address _asset, FeeData calldata _feeData) external;\n\n    /// @notice Get the redeem fee\n    /// @return redeemFee Redeem fee amount\n    function getRedeemFee() external view returns (uint256 redeemFee);\n\n    /// @notice Set the redeem fee\n    /// @param _redeemFee Redeem fee amount\n    function setRedeemFee(uint256 _redeemFee) external;\n\n    /// @notice Set the whitelist for a user\n    /// @param _user User address\n    /// @param _whitelisted Whitelist state\n    function setWhitelist(address _user, bool _whitelisted) external;\n\n    /// @notice Set the deposit cap for an asset\n    /// @param _asset Asset address\n    /// @param _cap Deposit cap for the asset\n    function setDepositCap(address _asset, uint256 _cap) external;\n\n    /// @notice Get the mint amount for a given asset\n    /// @param _asset Asset address\n    /// @param _amountIn Amount of asset to use\n    /// @return amountOut Amount minted\n    /// @return fee Fee applied\n    function getMintAmount(address _asset, uint256 _amountIn) external view returns (uint256 amountOut, uint256 fee);\n\n    /// @notice Get the mint amount for a given asset\n    /// @param _user User address\n    /// @param _asset Asset address\n    /// @param _amountIn Amount of asset to use\n    /// @return amountOut Amount minted\n    /// @return fee Fee applied\n    function getMintAmount(address _user, address _asset, uint256 _amountIn)\n        external\n        view\n        returns (uint256 amountOut, uint256 fee);\n\n    /// @notice Get the burn amount for a given asset\n    /// @param _asset Asset address to withdraw\n    /// @param _amountIn Amount of cap token to burn\n    /// @return amountOut Amount of the asset withdrawn\n    /// @return fee Fee applied\n    function getBurnAmount(address _asset, uint256 _amountIn) external view returns (uint256 amountOut, uint256 fee);\n\n    /// @notice Get the burn amount for a given asset\n    /// @param _user User address\n    /// @param _asset Asset address to withdraw\n    /// @param _amountIn Amount of cap token to burn\n    /// @return amountOut Amount of the asset withdrawn\n    /// @return fee Fee applied\n    function getBurnAmount(address _user, address _asset, uint256 _amountIn)\n        external\n        view\n        returns (uint256 amountOut, uint256 fee);\n\n    /// @notice Get the redeem amount\n    /// @param _amountIn Amount of cap token to burn\n    /// @return amountsOut Amounts of assets to be withdrawn\n    /// @return redeemFees Amounts of redeem fees to be applied\n    function getRedeemAmount(uint256 _amountIn)\n        external\n        view\n        returns (uint256[] memory amountsOut, uint256[] memory redeemFees);\n\n    /// @notice Get the redeem amount\n    /// @param _user User address\n    /// @param _amountIn Amount of cap token to burn\n    /// @return amountsOut Amounts of assets to be withdrawn\n    /// @return redeemFees Amounts of redeem fees to be applied\n    function getRedeemAmount(address _user, uint256 _amountIn)\n        external\n        view\n        returns (uint256[] memory amountsOut, uint256[] memory redeemFees);\n\n    /// @notice Is user whitelisted\n    /// @param _user User address\n    /// @return isWhitelisted Whitelist state\n    function whitelisted(address _user) external view returns (bool isWhitelisted);\n\n    /// @notice Get the deposit cap for an asset\n    /// @param _asset Asset address\n    /// @return cap Deposit cap for the asset\n    function depositCap(address _asset) external view returns (uint256 cap);\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts/utils/Address.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.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, bytes memory returndata) = recipient.call{value: amount}(\"\");\n        if (!success) {\n            _revert(returndata);\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            assembly (\"memory-safe\") {\n                revert(add(returndata, 0x20), mload(returndata))\n            }\n        } else {\n            revert Errors.FailedCall();\n        }\n    }\n}\n"},{"file_path":"contracts/vault/FractionalReserve.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport { Access } from \"../access/Access.sol\";\n\nimport { IFractionalReserve } from \"../interfaces/IFractionalReserve.sol\";\nimport { FractionalReserveStorageUtils } from \"../storage/FractionalReserveStorageUtils.sol\";\nimport { FractionalReserveLogic } from \"./libraries/FractionalReserveLogic.sol\";\n\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/// @title Fractional Reserve\n/// @author kexley, Cap Labs\n/// @notice Idle capital is put to work in fractional reserve vaults and can be recalled when withdrawing, redeeming or borrowing.\nabstract contract FractionalReserve is IFractionalReserve, Access, FractionalReserveStorageUtils {\n    using EnumerableSet for EnumerableSet.AddressSet;\n\n    /// @inheritdoc IFractionalReserve\n    function investAll(address _asset) external checkAccess(this.investAll.selector) {\n        FractionalReserveLogic.invest(getFractionalReserveStorage(), _asset);\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function divestAll(address _asset) external checkAccess(this.divestAll.selector) {\n        FractionalReserveLogic.divest(getFractionalReserveStorage(), _asset);\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function setFractionalReserveVault(address _asset, address _vault)\n        external\n        checkAccess(this.setFractionalReserveVault.selector)\n    {\n        FractionalReserveStorage storage $ = getFractionalReserveStorage();\n        FractionalReserveLogic.divest($, _asset);\n        FractionalReserveLogic.setFractionalReserveVault($, _asset, _vault);\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function setReserve(address _asset, uint256 _reserve) external checkAccess(this.setReserve.selector) {\n        FractionalReserveLogic.setReserve(getFractionalReserveStorage(), _asset, _reserve);\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function realizeInterest(address _asset) external {\n        FractionalReserveLogic.realizeInterest(getFractionalReserveStorage(), _asset);\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function claimableInterest(address _asset) external view returns (uint256 interest) {\n        interest = FractionalReserveLogic.claimableInterest(getFractionalReserveStorage(), _asset);\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function fractionalReserveVault(address _asset) external view returns (address vaultAddress) {\n        vaultAddress = getFractionalReserveStorage().vault[_asset];\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function fractionalReserveVaults() external view returns (address[] memory vaultAddresses) {\n        vaultAddresses = getFractionalReserveStorage().vaults.values();\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function reserve(address _asset) external view returns (uint256 reserveAmount) {\n        reserveAmount = getFractionalReserveStorage().reserve[_asset];\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function loaned(address _asset) external view returns (uint256 loanedAmount) {\n        loanedAmount = getFractionalReserveStorage().loaned[_asset];\n    }\n\n    /// @inheritdoc IFractionalReserve\n    function interestReceiver() external view returns (address _interestReceiver) {\n        _interestReceiver = getFractionalReserveStorage().interestReceiver;\n    }\n\n    /// @dev Initialize unchained\n    /// @param _interestReceiver Interest receiver address\n    function __FractionalReserve_init(address _interestReceiver) internal onlyInitializing {\n        getFractionalReserveStorage().interestReceiver = _interestReceiver;\n    }\n\n    /// @dev Divest an asset from a fractional reserve vault\n    /// @param _asset Asset address\n    /// @param _amountOut Amount to divest\n    function divest(address _asset, uint256 _amountOut) internal {\n        FractionalReserveLogic.divest(getFractionalReserveStorage(), _asset, _amountOut);\n    }\n\n    /// @dev Divest many assets from a fractional reserve vault\n    /// @param _assets Assets to divest\n    /// @param _amountsOut Amounts to divest\n    function divestMany(address[] memory _assets, uint256[] memory _amountsOut) internal {\n        FractionalReserveStorage storage $ = getFractionalReserveStorage();\n        for (uint256 i; i < _assets.length; ++i) {\n            FractionalReserveLogic.divest($, _assets[i], _amountsOut[i]);\n        }\n    }\n}\n"},{"file_path":"node_modules/@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardTransientUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.3.0) (utils/ReentrancyGuardTransient.sol)\n\npragma solidity ^0.8.24;\n\nimport {TransientSlot} from \"@openzeppelin/contracts/utils/TransientSlot.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Variant of {ReentrancyGuard} that uses transient storage.\n *\n * NOTE: This variant only works on networks where EIP-1153 is available.\n *\n * _Available since v5.1._\n */\nabstract contract ReentrancyGuardTransientUpgradeable is Initializable {\n    using TransientSlot for *;\n\n    // keccak256(abi.encode(uint256(keccak256(\"openzeppelin.storage.ReentrancyGuard\")) - 1)) & ~bytes32(uint256(0xff))\n    bytes32 private constant REENTRANCY_GUARD_STORAGE =\n        0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function __ReentrancyGuardTransient_init() internal onlyInitializing {\n    }\n\n    function __ReentrancyGuardTransient_init_unchained() internal onlyInitializing {\n    }\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, REENTRANCY_GUARD_STORAGE.asBoolean().tload() will be false\n        if (_reentrancyGuardEntered()) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        REENTRANCY_GUARD_STORAGE.asBoolean().tstore(true);\n    }\n\n    function _nonReentrantAfter() private {\n        REENTRANCY_GUARD_STORAGE.asBoolean().tstore(false);\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return REENTRANCY_GUARD_STORAGE.asBoolean().tload();\n    }\n}\n"},{"file_path":"contracts/interfaces/IFractionalReserve.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.28;\n\nimport { EnumerableSet } from \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\n/// @title Fractional Reserve Interface\n/// @author kexley, Cap Labs\n/// @notice Interface for the Fractional Reserve contract\ninterface IFractionalReserve {\n    /// @dev Storage for the Fractional Reserve contract\n    /// @param interestReceiver Interest receiver address\n    /// @param loaned Loaned amount for each asset\n    /// @param reserve Reserve amount for each asset\n    /// @param vault Fractional reserve vault for each asset\n    /// @param vaults Fractional reserve vaults\n    struct FractionalReserveStorage {\n        address interestReceiver;\n        mapping(address => uint256) loaned;\n        mapping(address => uint256) reserve;\n        mapping(address => address) vault;\n        EnumerableSet.AddressSet vaults;\n    }\n\n    /// @notice Invest unborrowed capital in a fractional reserve vault (up to the reserve)\n    /// @param _asset Asset address\n    function investAll(address _asset) external;\n\n    /// @notice Divest all of an asset from a fractional reserve vault and send any profit to fee auction\n    /// @param _asset Asset address\n    function divestAll(address _asset) external;\n\n    /// @notice Set the fractional reserve vault for an asset, divesting the old vault entirely\n    /// @param _asset Asset address\n    /// @param _vault Fractional reserve vault\n    function setFractionalReserveVault(address _asset, address _vault) external;\n\n    /// @notice Set the reserve level for an asset\n    /// @param _asset Asset address\n    /// @param _reserve Reserve level in asset decimals\n    function setReserve(address _asset, uint256 _reserve) external;\n\n    /// @notice Realize interest from a fractional reserve vault and send to the fee auction\n    /// @dev Left permissionless so arbitrageurs can move fees to auction\n    /// @param _asset Asset address\n    function realizeInterest(address _asset) external;\n\n    /// @notice Interest from a fractional reserve vault\n    /// @param _asset Asset address\n    /// @return interest Claimable amount of asset\n    function claimableInterest(address _asset) external view returns (uint256 interest);\n\n    /// @notice Fractional reserve vault address for an asset\n    /// @param _asset Asset address\n    /// @return vaultAddress Vault address\n    function fractionalReserveVault(address _asset) external view returns (address vaultAddress);\n\n    /// @notice Fractional reserve vaults\n    /// @return vaultAddresses Fractional reserve vaults\n    function fractionalReserveVaults() external view returns (address[] memory vaultAddresses);\n\n    /// @notice Reserve amount for an asset\n    /// @param _asset Asset address\n    /// @return reserveAmount Reserve amount\n    function reserve(address _asset) external view returns (uint256 reserveAmount);\n\n    /// @notice Loaned amount for an asset\n    /// @param _asset Asset address\n    /// @return loanedAmount Loaned amount\n    function loaned(address _asset) external view returns (uint256 loanedAmount);\n\n    /// @notice Interest receiver\n    /// @return interestReceiver Interest receiver\n    function interestReceiver() external view returns (address interestReceiver);\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC2612ExpiredSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC2612InvalidSigner","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"currentNonce","type":"uint256"}],"name":"InvalidAccountNonce","type":"error"},{"inputs":[],"name":"InvalidBurnKinkRatio","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidMinMintFee","type":"error"},{"inputs":[],"name":"InvalidMintKinkRatio","type":"error"},{"inputs":[],"name":"InvalidOptimalRatio","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"cap","type":"uint256"}],"name":"SetDepositCap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"components":[{"internalType":"uint256","name":"minMintFee","type":"uint256"},{"internalType":"uint256","name":"slope0","type":"uint256"},{"internalType":"uint256","name":"slope1","type":"uint256"},{"internalType":"uint256","name":"mintKinkRatio","type":"uint256"},{"internalType":"uint256","name":"burnKinkRatio","type":"uint256"},{"internalType":"uint256","name":"optimalRatio","type":"uint256"}],"indexed":false,"internalType":"struct IMinter.FeeData","name":"feeData","type":"tuple"}],"name":"SetFeeData","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"redeemFee","type":"uint256"}],"name":"SetRedeemFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"SetWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"addAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"assets","outputs":[{"internalType":"address[]","name":"assetList","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"availableBalance","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"borrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"claimableInterest","outputs":[{"internalType":"uint256","name":"interest","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"currentUtilizationIndex","outputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"depositCap","outputs":[{"internalType":"uint256","name":"cap","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"divestAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"fractionalReserveVault","outputs":[{"internalType":"address","name":"vaultAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fractionalReserveVaults","outputs":[{"internalType":"address[]","name":"vaultAddresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getBurnAmount","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getBurnAmount","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getFeeData","outputs":[{"components":[{"internalType":"uint256","name":"minMintFee","type":"uint256"},{"internalType":"uint256","name":"slope0","type":"uint256"},{"internalType":"uint256","name":"slope1","type":"uint256"},{"internalType":"uint256","name":"mintKinkRatio","type":"uint256"},{"internalType":"uint256","name":"burnKinkRatio","type":"uint256"},{"internalType":"uint256","name":"optimalRatio","type":"uint256"}],"internalType":"struct IMinter.FeeData","name":"feeData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getMintAmount","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getMintAmount","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getRedeemAmount","outputs":[{"internalType":"uint256[]","name":"amountsOut","type":"uint256[]"},{"internalType":"uint256[]","name":"fees","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"getRedeemAmount","outputs":[{"internalType":"uint256[]","name":"amountsOut","type":"uint256[]"},{"internalType":"uint256[]","name":"fees","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRedeemFee","outputs":[{"internalType":"uint256","name":"redeemFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getRemainingMintCapacity","outputs":[{"internalType":"uint256","name":"remainingMintCapacity","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_accessControl","type":"address"},{"internalType":"address","name":"_feeAuction","type":"address"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"address","name":"_insuranceFund","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"insuranceFund","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"interestReceiver","outputs":[{"internalType":"address","name":"_interestReceiver","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"investAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"loaned","outputs":[{"internalType":"uint256","name":"loanedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256","name":"_minAmountOut","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"pauseAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"paused","outputs":[{"internalType":"bool","name":"isPaused","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"realizeInterest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint256[]","name":"_minAmountsOut","type":"uint256[]"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256[]","name":"amountsOut","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"removeAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"reserve","outputs":[{"internalType":"uint256","name":"reserveAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_cap","type":"uint256"}],"name":"setDepositCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"components":[{"internalType":"uint256","name":"minMintFee","type":"uint256"},{"internalType":"uint256","name":"slope0","type":"uint256"},{"internalType":"uint256","name":"slope1","type":"uint256"},{"internalType":"uint256","name":"mintKinkRatio","type":"uint256"},{"internalType":"uint256","name":"burnKinkRatio","type":"uint256"},{"internalType":"uint256","name":"optimalRatio","type":"uint256"}],"internalType":"struct IMinter.FeeData","name":"_feeData","type":"tuple"}],"name":"setFeeData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"address","name":"_vault","type":"address"}],"name":"setFractionalReserveVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_insuranceFund","type":"address"}],"name":"setInsuranceFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_redeemFee","type":"uint256"}],"name":"setRedeemFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_reserve","type":"uint256"}],"name":"setReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_whitelisted","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"totalBorrows","outputs":[{"internalType":"uint256","name":"totalBorrow","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"totalSupplies","outputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"unpauseAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseProtocol","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"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"utilization","outputs":[{"internalType":"uint256","name":"ratio","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"isWhitelisted","type":"bool"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":true,"constructor_args":null}