diff --git a/README.md b/README.md index f1ba6af..40892dc 100644 --- a/README.md +++ b/README.md @@ -61,83 +61,83 @@ Some changed has been made to the original Angle's Transmuter: ### Mainnet -| Contract | Explore | -| --------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| DiamondCut Facet | [0xad58Fc13a682a121e5fe2f8E45D4D988A7e51B0D](https:///etherscan.io/address/0xad58Fc13a682a121e5fe2f8E45D4D988A7e51B0D) | -| DiamondLoupe Facet | [0xA360E5aD9F17caff53715346888aA0d13541c2F5](https:///etherscan.io/address/0xA360E5aD9F17caff53715346888aA0d13541c2F5) | -| Getters Facet | [0xa9C21Cf291ad935e0C9B05a55A42254fB159181d](https:///etherscan.io/address/0xa9C21Cf291ad935e0C9B05a55A42254fB159181d) | -| Redeemer Facet | [0x1bB46FC55E3fd91Ca0F162DCC0B3ef574C8ff97E](https:///etherscan.io/address/0x1bB46FC55E3fd91Ca0F162DCC0B3ef574C8ff97E) | -| RewardHandler Facet | [0xd8cc2A51556Da84b5DB309e86f30Ff98B5309862](https:///etherscan.io/address/0xd8cc2A51556Da84b5DB309e86f30Ff98B5309862) | -| SettersGovernor Facet | [0xeB197439D1425F3129F01F7763EC511DF2489095](https:///etherscan.io/address/0xeB197439D1425F3129F01F7763EC511DF2489095) | -| SettersGuardian Facet | [0xc743BeDE8412228B42Ae755cD64A33Cd3ae4A92f](https:///etherscan.io/address/0xc743BeDE8412228B42Ae755cD64A33Cd3ae4A92f) | -| Swapper Facet | [0x506Ba37aa8e265bE445913B9c4080852277f3c5a](https:///etherscan.io/address/0x506Ba37aa8e265bE445913B9c4080852277f3c5a) | -| Parallelizer USDp | [0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2](https:///etherscan.io/address/0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2) | -| sUSDp (Savings) | [0x0d45b129dc868963025Db79A9074EA9c9e32Cae4](https:///etherscan.io/address/0x0d45b129dc868963025Db79A9074EA9c9e32Cae4) | -| GenericHarvester USDp | [0x36DA06796fD9d22BCD6287b66A87FfdadB12636C](https:///etherscan.io/address/0x36DA06796fD9d22BCD6287b66A87FfdadB12636C) | +| Contract | Explore | +| ---------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| DiamondCut Facet | [0xad58Fc13a682a121e5fe2f8E45D4D988A7e51B0D](https:///etherscan.io/address/0xad58Fc13a682a121e5fe2f8E45D4D988A7e51B0D) | +| DiamondLoupe Facet | [0xA360E5aD9F17caff53715346888aA0d13541c2F5](https:///etherscan.io/address/0xA360E5aD9F17caff53715346888aA0d13541c2F5) | +| Getters Facet | [0xa9C21Cf291ad935e0C9B05a55A42254fB159181d](https:///etherscan.io/address/0xa9C21Cf291ad935e0C9B05a55A42254fB159181d) | +| Redeemer Facet | [0x1bB46FC55E3fd91Ca0F162DCC0B3ef574C8ff97E](https:///etherscan.io/address/0x1bB46FC55E3fd91Ca0F162DCC0B3ef574C8ff97E) | +| RewardHandler Facet | [0xd8cc2A51556Da84b5DB309e86f30Ff98B5309862](https:///etherscan.io/address/0xd8cc2A51556Da84b5DB309e86f30Ff98B5309862) | +| SettersGovernor Facet | [0xeB197439D1425F3129F01F7763EC511DF2489095](https:///etherscan.io/address/0xeB197439D1425F3129F01F7763EC511DF2489095) | +| SettersGuardian Facet | [0xc743BeDE8412228B42Ae755cD64A33Cd3ae4A92f](https:///etherscan.io/address/0xc743BeDE8412228B42Ae755cD64A33Cd3ae4A92f) | +| Swapper Facet | [0x506Ba37aa8e265bE445913B9c4080852277f3c5a](https:///etherscan.io/address/0x506Ba37aa8e265bE445913B9c4080852277f3c5a) | +| Parallelizer USDp | [0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2](https:///etherscan.io/address/0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2) | +| sUSDp (Savings) | [0x0d45b129dc868963025Db79A9074EA9c9e32Cae4](https:///etherscan.io/address/0x0d45b129dc868963025Db79A9074EA9c9e32Cae4) | +| GenericRebalancer USDp | [0x36DA06796fD9d22BCD6287b66A87FfdadB12636C](https:///etherscan.io/address/0x36DA06796fD9d22BCD6287b66A87FfdadB12636C) | ### Base -| Contract | Explore | -| --------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| DiamondCut Facet | [0x15452454A9735D68df430879B2941316a09295B1](https:///basescan.org/address/0x15452454A9735D68df430879B2941316a09295B1) | -| DiamondLoupe Facet | [0x24CeF236056834f38e9247A1Fff6681Dd313d3aa](https:///basescan.org/address/0x24CeF236056834f38e9247A1Fff6681Dd313d3aa) | -| Getters Facet | [0xBE65F0F410A72BeC163dC65d46c83699e957D588](https:///basescan.org/address/0xBE65F0F410A72BeC163dC65d46c83699e957D588) | -| Redeemer Facet | [0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8](https:///basescan.org/address/0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8) | -| RewardHandler Facet | [0x2B6C7c275404e93A14A05b549AF292231D6e4DeC](https:///basescan.org/address/0x2B6C7c275404e93A14A05b549AF292231D6e4DeC) | -| SettersGovernor Facet | [0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43](https:///basescan.org/address/0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43) | -| SettersGuardian Facet | [0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8](https:///basescan.org/address/0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8) | -| Swapper Facet | [0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7](https:///basescan.org/address/0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7) | -| Parallelizer USDp | [0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD](https:///basescan.org/address/0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD) | -| sUSDp (Savings) | [0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7](https:///basescan.org/address/0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7) | -| GenericHarvester USDp | [0xCa43eCFCDFBA1fED003649e946Ae6091646B410a](https:///basescan.org/address/0xCa43eCFCDFBA1fED003649e946Ae6091646B410a) | +| Contract | Explore | +| ---------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| DiamondCut Facet | [0x15452454A9735D68df430879B2941316a09295B1](https:///basescan.org/address/0x15452454A9735D68df430879B2941316a09295B1) | +| DiamondLoupe Facet | [0x24CeF236056834f38e9247A1Fff6681Dd313d3aa](https:///basescan.org/address/0x24CeF236056834f38e9247A1Fff6681Dd313d3aa) | +| Getters Facet | [0xBE65F0F410A72BeC163dC65d46c83699e957D588](https:///basescan.org/address/0xBE65F0F410A72BeC163dC65d46c83699e957D588) | +| Redeemer Facet | [0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8](https:///basescan.org/address/0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8) | +| RewardHandler Facet | [0x2B6C7c275404e93A14A05b549AF292231D6e4DeC](https:///basescan.org/address/0x2B6C7c275404e93A14A05b549AF292231D6e4DeC) | +| SettersGovernor Facet | [0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43](https:///basescan.org/address/0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43) | +| SettersGuardian Facet | [0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8](https:///basescan.org/address/0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8) | +| Swapper Facet | [0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7](https:///basescan.org/address/0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7) | +| Parallelizer USDp | [0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD](https:///basescan.org/address/0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD) | +| sUSDp (Savings) | [0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7](https:///basescan.org/address/0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7) | +| GenericRebalancer USDp | [0xCa43eCFCDFBA1fED003649e946Ae6091646B410a](https:///basescan.org/address/0xCa43eCFCDFBA1fED003649e946Ae6091646B410a) | ### Sonic -| Contract | Explore | -| --------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| DiamondCut Facet | [0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8](https:///sonicscan.org/address/0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8) | -| DiamondLoupe Facet | [0x2B6C7c275404e93A14A05b549AF292231D6e4DeC](https:///sonicscan.org/address/0x2B6C7c275404e93A14A05b549AF292231D6e4DeC) | -| Getters Facet | [0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43](https:///sonicscan.org/address/0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43) | -| Redeemer Facet | [0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8](https:///sonicscan.org/address/0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8) | -| RewardHandler Facet | [0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7](https:///sonicscan.org/address/0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7) | -| SettersGovernor Facet | [0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD](https:///sonicscan.org/address/0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD) | -| SettersGuardian Facet | [0xCa43eCFCDFBA1fED003649e946Ae6091646B410a](https:///sonicscan.org/address/0xCa43eCFCDFBA1fED003649e946Ae6091646B410a) | -| Swapper Facet | [0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF](https:///sonicscan.org/address/0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF) | -| Parallelizer USDp | [0xBEFBAe2330186F031b469e26283aCc66bb5F8826](https:///sonicscan.org/address/0xBEFBAe2330186F031b469e26283aCc66bb5F8826) | -| sUSDp (Savings) | [0xe8a3DA6f5ed1cf04c58ac7f6A7383641e877517b](https:///sonicscan.org/address/0xe8a3DA6f5ed1cf04c58ac7f6A7383641e877517b) | -| GenericHarvester USDp | [0x120805265fA944834DC6e930De2995768806a9d2](https:///sonicscan.org/address/0x120805265fA944834DC6e930De2995768806a9d2) | +| Contract | Explore | +| ---------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| DiamondCut Facet | [0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8](https:///sonicscan.org/address/0xe9fe4720FA99f9b28584dA44ABB8cf91f15990e8) | +| DiamondLoupe Facet | [0x2B6C7c275404e93A14A05b549AF292231D6e4DeC](https:///sonicscan.org/address/0x2B6C7c275404e93A14A05b549AF292231D6e4DeC) | +| Getters Facet | [0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43](https:///sonicscan.org/address/0x90e4AE8bA8C6Fd51fcED0f9331668b05c7a4Ee43) | +| Redeemer Facet | [0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8](https:///sonicscan.org/address/0xe5C82b4F09Fd4d079757e156Db44AFD2c8032CC8) | +| RewardHandler Facet | [0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7](https:///sonicscan.org/address/0xfB2D070270e9FfC2dB107D0162b47c2Ed291E3F7) | +| SettersGovernor Facet | [0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD](https:///sonicscan.org/address/0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD) | +| SettersGuardian Facet | [0xCa43eCFCDFBA1fED003649e946Ae6091646B410a](https:///sonicscan.org/address/0xCa43eCFCDFBA1fED003649e946Ae6091646B410a) | +| Swapper Facet | [0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF](https:///sonicscan.org/address/0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF) | +| Parallelizer USDp | [0xBEFBAe2330186F031b469e26283aCc66bb5F8826](https:///sonicscan.org/address/0xBEFBAe2330186F031b469e26283aCc66bb5F8826) | +| sUSDp (Savings) | [0xe8a3DA6f5ed1cf04c58ac7f6A7383641e877517b](https:///sonicscan.org/address/0xe8a3DA6f5ed1cf04c58ac7f6A7383641e877517b) | +| GenericRebalancer USDp | [0x120805265fA944834DC6e930De2995768806a9d2](https:///sonicscan.org/address/0x120805265fA944834DC6e930De2995768806a9d2) | #### HyperEVM -| Contract | Explore | -| --------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| DiamondCut Facet | [0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF](https:///www.hyperscan.com/address/0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF) | -| DiamondLoupe Facet | [0xBEFBAe2330186F031b469e26283aCc66bb5F8826](https:///www.hyperscan.com/address/0xBEFBAe2330186F031b469e26283aCc66bb5F8826) | -| Getters Facet | [0x120805265fA944834DC6e930De2995768806a9d2](https:///www.hyperscan.com/address/0x120805265fA944834DC6e930De2995768806a9d2) | -| Redeemer Facet | [0xF92eD96C7bEc4aD46FF7937Cae633c907EBDf594](https:///www.hyperscan.com/address/0xF92eD96C7bEc4aD46FF7937Cae633c907EBDf594) | -| RewardHandler Facet | [0xa5d9CAA2EF06D39d5992b5046e2DEFFf6D5Cbd18](https:///www.hyperscan.com/address/0xa5d9CAA2EF06D39d5992b5046e2DEFFf6D5Cbd18) | -| SettersGovernor Facet | [0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7](https:///www.hyperscan.com/address/0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7) | -| SettersGuardian Facet | [0xaE2Fb66d1989EC1684fF095B75D151Ae8E403E2e](https:///www.hyperscan.com/address/0xaE2Fb66d1989EC1684fF095B75D151Ae8E403E2e) | -| Swapper Facet | [0x1b2741dB9F46a0411852e4cC28dDC476851b5179](https:///www.hyperscan.com/address/0x1b2741dB9F46a0411852e4cC28dDC476851b5179) | -| Parallelizer USDp | [0x1250304F66404cd153fA39388DDCDAec7E0f1707](https:///www.hyperscan.com/address/0x1250304F66404cd153fA39388DDCDAec7E0f1707) | -| sUSDp (Savings) | [0x9B3a8f7CEC208e247d97dEE13313690977e24459](https:///www.hyperscan.com/address/0x9B3a8f7CEC208e247d97dEE13313690977e24459) | -| GenericHarvester USDp | [0x57770C1721Eb35509f38210A935c8b1911db7E0e](https:///www.hyperscan.com/address/0x57770C1721Eb35509f38210A935c8b1911db7E0e) | +| Contract | Explore | +| ---------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| DiamondCut Facet | [0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF](https:///www.hyperscan.com/address/0xA65821FfE86E6Eb613DAa1F70AF350C5A21759dF) | +| DiamondLoupe Facet | [0xBEFBAe2330186F031b469e26283aCc66bb5F8826](https:///www.hyperscan.com/address/0xBEFBAe2330186F031b469e26283aCc66bb5F8826) | +| Getters Facet | [0x120805265fA944834DC6e930De2995768806a9d2](https:///www.hyperscan.com/address/0x120805265fA944834DC6e930De2995768806a9d2) | +| Redeemer Facet | [0xF92eD96C7bEc4aD46FF7937Cae633c907EBDf594](https:///www.hyperscan.com/address/0xF92eD96C7bEc4aD46FF7937Cae633c907EBDf594) | +| RewardHandler Facet | [0xa5d9CAA2EF06D39d5992b5046e2DEFFf6D5Cbd18](https:///www.hyperscan.com/address/0xa5d9CAA2EF06D39d5992b5046e2DEFFf6D5Cbd18) | +| SettersGovernor Facet | [0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7](https:///www.hyperscan.com/address/0x472eD57b376fE400259FB28e5C46eB53f0E3e7E7) | +| SettersGuardian Facet | [0xaE2Fb66d1989EC1684fF095B75D151Ae8E403E2e](https:///www.hyperscan.com/address/0xaE2Fb66d1989EC1684fF095B75D151Ae8E403E2e) | +| Swapper Facet | [0x1b2741dB9F46a0411852e4cC28dDC476851b5179](https:///www.hyperscan.com/address/0x1b2741dB9F46a0411852e4cC28dDC476851b5179) | +| Parallelizer USDp | [0x1250304F66404cd153fA39388DDCDAec7E0f1707](https:///www.hyperscan.com/address/0x1250304F66404cd153fA39388DDCDAec7E0f1707) | +| sUSDp (Savings) | [0x9B3a8f7CEC208e247d97dEE13313690977e24459](https:///www.hyperscan.com/address/0x9B3a8f7CEC208e247d97dEE13313690977e24459) | +| GenericRebalancer USDp | [0x57770C1721Eb35509f38210A935c8b1911db7E0e](https:///www.hyperscan.com/address/0x57770C1721Eb35509f38210A935c8b1911db7E0e) | #### Avalanche -| Contract | Explore | -| --------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| DiamondCut Facet | [0x657acB8A3BF9383e561565d422ea9b9A90ce0052](https:///www.snowscan.xyz/address/0x657acB8A3BF9383e561565d422ea9b9A90ce0052) | -| DiamondLoupe Facet | [0x23D491aa7C0972087F8a607F6f4c7106a02BA95d](https:///www.snowscan.xyz/address/0x23D491aa7C0972087F8a607F6f4c7106a02BA95d) | -| Getters Facet | [0xF6Cc47E981ED5902BE382dbe7B54e3696De22dBb](https:///www.snowscan.xyz/address/0xF6Cc47E981ED5902BE382dbe7B54e3696De22dBb) | -| Redeemer Facet | [0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2](https:///www.snowscan.xyz/address/0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2) | -| RewardHandler Facet | [0x36DA06796fD9d22BCD6287b66A87FfdadB12636C](https:///www.snowscan.xyz/address/0x36DA06796fD9d22BCD6287b66A87FfdadB12636C) | -| SettersGovernor Facet | [0x5bEADA21a6B9Cb229117B3EA2C0D1594785013A2](https:///www.snowscan.xyz/address/0x5bEADA21a6B9Cb229117B3EA2C0D1594785013A2) | -| SettersGuardian Facet | [0xbBC90E685C4a66EBBDC71a3A1437d3111e43Fe84](https:///www.snowscan.xyz/address/0xbBC90E685C4a66EBBDC71a3A1437d3111e43Fe84) | -| Swapper Facet | [0x57265a3D7db8f4a4a155eadF6c7326926caC1490](https:///www.snowscan.xyz/address/0x57265a3D7db8f4a4a155eadF6c7326926caC1490) | -| Parallelizer USDp | [0x41d58951cbd12D4Ef49b0437897677bbF5547C80](https:///www.snowscan.xyz/address/0x41d58951cbd12D4Ef49b0437897677bbF5547C80) | -| sUSDp (Savings) | [0x9d92c21205383651610f90722131655a5b8ed3e0](https:///www.snowscan.xyz/address/0x9d92c21205383651610f90722131655a5b8ed3e0) | -| GenericHarvester USDp | [0x0d45b129dc868963025db79a9074ea9c9e32cae4](https:///www.snowscan.xyz/address/0x0d45b129dc868963025db79a9074ea9c9e32cae4) | +| Contract | Explore | +| ---------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| DiamondCut Facet | [0x657acB8A3BF9383e561565d422ea9b9A90ce0052](https:///www.snowscan.xyz/address/0x657acB8A3BF9383e561565d422ea9b9A90ce0052) | +| DiamondLoupe Facet | [0x23D491aa7C0972087F8a607F6f4c7106a02BA95d](https:///www.snowscan.xyz/address/0x23D491aa7C0972087F8a607F6f4c7106a02BA95d) | +| Getters Facet | [0xF6Cc47E981ED5902BE382dbe7B54e3696De22dBb](https:///www.snowscan.xyz/address/0xF6Cc47E981ED5902BE382dbe7B54e3696De22dBb) | +| Redeemer Facet | [0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2](https:///www.snowscan.xyz/address/0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2) | +| RewardHandler Facet | [0x36DA06796fD9d22BCD6287b66A87FfdadB12636C](https:///www.snowscan.xyz/address/0x36DA06796fD9d22BCD6287b66A87FfdadB12636C) | +| SettersGovernor Facet | [0x5bEADA21a6B9Cb229117B3EA2C0D1594785013A2](https:///www.snowscan.xyz/address/0x5bEADA21a6B9Cb229117B3EA2C0D1594785013A2) | +| SettersGuardian Facet | [0xbBC90E685C4a66EBBDC71a3A1437d3111e43Fe84](https:///www.snowscan.xyz/address/0xbBC90E685C4a66EBBDC71a3A1437d3111e43Fe84) | +| Swapper Facet | [0x57265a3D7db8f4a4a155eadF6c7326926caC1490](https:///www.snowscan.xyz/address/0x57265a3D7db8f4a4a155eadF6c7326926caC1490) | +| Parallelizer USDp | [0x41d58951cbd12D4Ef49b0437897677bbF5547C80](https:///www.snowscan.xyz/address/0x41d58951cbd12D4Ef49b0437897677bbF5547C80) | +| sUSDp (Savings) | [0x9d92c21205383651610f90722131655a5b8ed3e0](https:///www.snowscan.xyz/address/0x9d92c21205383651610f90722131655a5b8ed3e0) | +| GenericRebalancer USDp | [0x0d45b129dc868963025db79a9074ea9c9e32cae4](https:///www.snowscan.xyz/address/0x0d45b129dc868963025db79a9074ea9c9e32cae4) | ### Testnet diff --git a/contracts/helpers/BaseHarvester.sol b/contracts/helpers/BaseRebalancer.sol similarity index 86% rename from contracts/helpers/BaseHarvester.sol rename to contracts/helpers/BaseRebalancer.sol index 4f6fc9a..37300a5 100644 --- a/contracts/helpers/BaseHarvester.sol +++ b/contracts/helpers/BaseRebalancer.sol @@ -6,7 +6,7 @@ import { AccessManaged } from "../utils/AccessManaged.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IParallelizer } from "contracts/interfaces/IParallelizer.sol"; import { ITokenP } from "contracts/interfaces/ITokenP.sol"; -import "contracts/interfaces/IHarvester.sol"; +import "contracts/interfaces/IRebalancer.sol"; import "../utils/Errors.sol"; @@ -22,17 +22,18 @@ struct YieldBearingParams { // Whether limit exposures should be overriden or read onchain through the Parallelizer // This value should be 1 to override exposures or 2 if these shouldn't be overriden uint64 overrideExposures; - // Maximum slippage when dealing with the Parallelizer - uint96 maxSlippage; + // Maximum slippage when dealing with the Parallelizer, bounded below 1e9 so uint64 leaves the + // struct packed in two slots + uint64 maxSlippage; } -/// @title BaseHarvester +/// @title BaseRebalancer /// @author Cooper Labs /// @custom:contact security@cooperlabs.xyz -/// @dev Abstract contract for a harvester that aims at rebalancing a Parallelizer -/// @dev This contract is an authorized fork of Angle's BaseHarvester contract: +/// @dev Abstract contract for a rebalancer that aims at rebalancing a Parallelizer +/// @dev This contract is an authorized fork of Angle's BaseHarvester contract, substantially modified: /// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/BaseHarvester.sol -abstract contract BaseHarvester is IHarvester, AccessManaged { +abstract contract BaseRebalancer is IRebalancer, AccessManaged { using SafeERC20 for IERC20; /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -67,8 +68,6 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { IParallelizer public immutable parallelizer; /// @notice TokenP handled by the `parallelizer` of interest ITokenP public immutable tokenP; - /// @notice Max slippage when dealing with the Parallelizer - mapping(address => uint96) public maxTokenSlippage; /// @notice Data associated to a yield bearing asset mapping(address => YieldBearingParams) public yieldBearingData; /// @notice trusted addresses that can update target exposure and do others non critical operations @@ -80,6 +79,7 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { event Recovered(address token, uint256 amount, address to); event TrustedToggled(address trusted, bool status); + event AllowanceReset(address indexed token, address indexed spender); /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CONSTRUCTOR @@ -116,7 +116,7 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { uint64 minExposure, uint64 maxExposure, uint64 overrideExposures, - uint96 maxSlippage + uint64 maxSlippage ) external restricted @@ -141,7 +141,7 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { * @notice Set the max allowed slippage * @param newMaxSlippage new max allowed slippage */ - function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external restricted { + function setMaxSlippage(address yieldBearingAsset, uint64 newMaxSlippage) external restricted { _setMaxSlippage(yieldBearingAsset, newMaxSlippage); } @@ -165,6 +165,19 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { IERC20(tokenAddress).safeTransfer(to, amountToRecover); } + /** + * @notice Set an allowance this contract granted back to zero + * @param token address of the token + * @param spender address losing the allowance + * @dev Rebalancing grants unlimited allowances that are never reduced. Rotating a yield bearing + * asset's configuration revokes the approvals it created, but this covers a spender that became + * untrusted for any other reason. + */ + function resetAllowance(address token, address spender) external restricted { + IERC20(token).forceApprove(spender, 0); + emit AllowanceReset(token, spender); + } + /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TRUSTED FUNCTIONS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ @@ -240,12 +253,20 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { uint64 minExposure, uint64 maxExposure, uint64 overrideExposures, - uint96 maxSlippage + uint64 maxSlippage ) internal virtual { YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset]; + address previousAsset = yieldBearingInfo.asset; + // Allowances are granted without expiry, so the outgoing asset would keep the yield bearing + // vault authorised over any of it later held here + if (previousAsset != address(0) && previousAsset != asset) { + IERC20(previousAsset).forceApprove(yieldBearingAsset, 0); + emit AllowanceReset(previousAsset, yieldBearingAsset); + _revokeAssetAllowances(yieldBearingAsset, previousAsset); + } yieldBearingInfo.asset = asset; if (targetExposure >= 1e9) revert InvalidParam(); if (maxSlippage >= 1e9) revert InvalidParam(); @@ -262,6 +283,9 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { } } + /// @notice Lets a rebalancer revoke the allowances it granted over an asset being rotated out + function _revokeAssetAllowances(address yieldBearingAsset, address previousAsset) internal virtual { } + function _updateLimitExposuresYieldAsset( address asset, YieldBearingParams storage yieldBearingInfo @@ -282,9 +306,9 @@ abstract contract BaseHarvester is IHarvester, AccessManaged { else yieldBearingInfo.minExposure = xFeeBurn[length - 2]; } - function _setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) internal virtual { - if (newMaxSlippage > 1e9) revert InvalidParam(); - maxTokenSlippage[yieldBearingAsset] = newMaxSlippage; + function _setMaxSlippage(address yieldBearingAsset, uint64 newMaxSlippage) internal virtual { + if (newMaxSlippage >= 1e9) revert InvalidParam(); + yieldBearingData[yieldBearingAsset].maxSlippage = newMaxSlippage; } function _scaleAmountBasedOnDecimals( diff --git a/contracts/helpers/GenericHarvester.sol b/contracts/helpers/GenericRebalancer.sol similarity index 81% rename from contracts/helpers/GenericHarvester.sol rename to contracts/helpers/GenericRebalancer.sol index 3b31873..5984850 100644 --- a/contracts/helpers/GenericHarvester.sol +++ b/contracts/helpers/GenericRebalancer.sol @@ -15,20 +15,20 @@ import { IERC4626 } from "contracts/interfaces/external/IERC4626.sol"; import "../utils/Errors.sol"; -import { BaseHarvester, YieldBearingParams } from "./BaseHarvester.sol"; +import { BaseRebalancer, YieldBearingParams } from "./BaseRebalancer.sol"; enum SwapType { VAULT, SWAP } -/// @title GenericHarvester +/// @title GenericRebalancer /// @author Cooper Labs /// @custom:contact security@cooperlabs.xyz -/// @dev Generic contract for anyone to permissionlessly adjust the reserves of Angle Parallelizer -/// @dev This contract is an authorized fork of Angle's GenericHarvester contract: +/// @dev Generic contract for trusted callers to adjust the reserves of Angle Parallelizer +/// @dev This contract is an authorized fork of Angle's GenericHarvester contract, substantially modified: /// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol -contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper { +contract GenericRebalancer is BaseRebalancer, IERC3156FlashBorrower, RouterSwapper { using SafeCast for uint256; using SafeERC20 for IERC20; @@ -52,7 +52,7 @@ contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper IERC3156FlashLender definitiveFlashloan ) RouterSwapper(initialSwapRouter, initialTokenTransferAddress) - BaseHarvester(initialAuthority, definitivetokenP, definitiveParallelizer) + BaseRebalancer(initialAuthority, definitivetokenP, definitiveParallelizer) { if (address(definitiveFlashloan) == address(0)) revert ZeroAddress(); flashloan = definitiveFlashloan; @@ -98,7 +98,9 @@ contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper /// `yieldBearingAsset` to the target exposure /// @dev scale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, /// it is used to lower the amount of the asset to harvest for example to have a lower slippage - function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) public virtual { + /// @dev Restricted to trusted callers: the flow forwards caller-supplied router calldata and refreshes the + /// collateral oracle, neither of which can be safely exposed to arbitrary callers + function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) public virtual onlyTrusted { if (scale > 1e9) revert InvalidParam(); updateLimitExposuresYieldAsset(yieldBearingAsset); YieldBearingParams memory yieldBearingInfo = yieldBearingData[yieldBearingAsset]; @@ -119,6 +121,8 @@ contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper } /// @inheritdoc IERC3156FlashBorrower + /// @dev A non-zero lender fee is charged to the budget of the address that called `harvest`, alongside any + /// shortfall between the principal and the tokenP the rebalance minted back function onFlashLoan( address initiator, address, @@ -130,7 +134,7 @@ contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper virtual returns (bytes32) { - if (msg.sender != address(flashloan) || initiator != address(this) || fee != 0) revert NotTrusted(); + if (msg.sender != address(flashloan) || initiator != address(this)) revert NotTrusted(); address sender; uint256 typeAction; uint256 minAmountOut; @@ -153,17 +157,26 @@ contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper tokenOut = asset; } } + uint256 tokenInBalanceBefore = IERC20(tokenIn).balanceOf(address(this)); + uint256 amountOut = parallelizer.swapExactInput(amount, 0, address(tokenP), tokenIn, address(this), block.timestamp); + // The principal is spent, what the lender will pull back is the principal plus its fee + amount += fee; - // Swap to tokenIn + // Swap to tokenOut amountOut = _swapToTokenOut(typeAction, tokenIn, tokenOut, amountOut, swapType, callData); _adjustAllowance(tokenOut, address(parallelizer), amountOut); uint256 amountStableOut = parallelizer.swapExactInput(amountOut, minAmountOut, tokenOut, address(tokenP), address(this), block.timestamp); + + amountStableOut += _recoverResidualInput(tokenIn, tokenInBalanceBefore); + if (amount > amountStableOut) { budget[sender] -= amount - amountStableOut; // Will revert if not enough funds + } else if (amountStableOut > amount) { + budget[sender] += amountStableOut - amount; } return CALLBACK_SUCCESS; } @@ -217,6 +230,24 @@ contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper ); } + /** + * @dev Returns any input the route did not consume to the Parallelizer + * @param tokenIn address of the token offered to the route + * @param balanceBefore balance of `tokenIn` held before the operation + * @return the tokenP obtained from the remainder, zero when the route consumed everything + * + * Router calldata is built off chain while the input is sized on chain, so a route can consume + * less than was offered. Returning the remainder keeps it inside the Parallelizer's accounting + * instead of stranding it here, and it settles with the rest of the operation. + */ + function _recoverResidualInput(address tokenIn, uint256 balanceBefore) internal returns (uint256) { + uint256 balanceAfter = IERC20(tokenIn).balanceOf(address(this)); + if (balanceAfter <= balanceBefore) return 0; + uint256 residual = balanceAfter - balanceBefore; + _adjustAllowance(tokenIn, address(parallelizer), residual); + return parallelizer.swapExactInput(residual, 0, tokenIn, address(tokenP), address(this), block.timestamp); + } + function _swapToTokenOut( uint256 typeAction, address tokenIn, @@ -260,6 +291,8 @@ contract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper uint256[] memory amounts = new uint256[](1); amounts[0] = amount; _swap(tokens, callDatas, amounts); + // A route that consumed less than offered would otherwise leave the difference approved + IERC20(tokenIn).forceApprove(tokenTransferAddress, 0); return IERC20(tokenOut).balanceOf(address(this)) - balance; } diff --git a/contracts/helpers/MultiBlockHarvester.sol b/contracts/helpers/MultiBlockRebalancer.sol similarity index 87% rename from contracts/helpers/MultiBlockHarvester.sol rename to contracts/helpers/MultiBlockRebalancer.sol index c050e75..6b293a9 100644 --- a/contracts/helpers/MultiBlockHarvester.sol +++ b/contracts/helpers/MultiBlockRebalancer.sol @@ -5,7 +5,7 @@ import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/I import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import { BaseHarvester, YieldBearingParams } from "./BaseHarvester.sol"; +import { BaseRebalancer, YieldBearingParams } from "./BaseRebalancer.sol"; import { IParallelizer } from "contracts/interfaces/IParallelizer.sol"; import { ITokenP } from "contracts/interfaces/ITokenP.sol"; import { IPool } from "contracts/interfaces/IPool.sol"; @@ -13,13 +13,13 @@ import { IPool } from "contracts/interfaces/IPool.sol"; import "../utils/Errors.sol"; import "../utils/Constants.sol"; -/// @title MultiBlockHarvester +/// @title MultiBlockRebalancer /// @author Cooper Labs /// @custom:contact security@cooperlabs.xyz /// @dev Contract to harvest yield from multiple yield bearing assets in multiple blocks transactions /// @dev This contract is an authorized fork of Angle's MultiBlockHarvester contract: /// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/MultiBlockHarvester.sol -contract MultiBlockHarvester is BaseHarvester { +contract MultiBlockRebalancer is BaseRebalancer { using SafeERC20 for IERC20; using Math for uint256; @@ -39,7 +39,7 @@ contract MultiBlockHarvester is BaseHarvester { ITokenP definitivetokenP, IParallelizer definitiveParallelizer ) - BaseHarvester(initialAuthority, definitivetokenP, definitiveParallelizer) + BaseRebalancer(initialAuthority, definitivetokenP, definitiveParallelizer) { } /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -52,9 +52,25 @@ contract MultiBlockHarvester is BaseHarvester { * @param newDepositAddress address to deposit to receive yieldBearingAsset */ function setYieldBearingToDepositAddress(address yieldBearingAsset, address newDepositAddress) external restricted { + address previousDepositAddress = yieldBearingToDepositAddress[yieldBearingAsset]; + address asset = yieldBearingData[yieldBearingAsset].asset; + // The outgoing deposit address would otherwise keep its allowance over the underlying asset + if (previousDepositAddress != address(0) && previousDepositAddress != newDepositAddress && asset != address(0)) { + IERC20(asset).forceApprove(previousDepositAddress, 0); + emit AllowanceReset(asset, previousDepositAddress); + } yieldBearingToDepositAddress[yieldBearingAsset] = newDepositAddress; } + /// @inheritdoc BaseRebalancer + function _revokeAssetAllowances(address yieldBearingAsset, address previousAsset) internal override { + address depositAddress = yieldBearingToDepositAddress[yieldBearingAsset]; + if (depositAddress != address(0)) { + IERC20(previousAsset).forceApprove(depositAddress, 0); + emit AllowanceReset(previousAsset, depositAddress); + } + } + /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TRUSTED FUNCTIONS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ @@ -141,7 +157,7 @@ contract MultiBlockHarvester is BaseHarvester { address asset, address depositAddress, bool assetIn, - uint96 maxSlippage + uint64 maxSlippage ) internal view diff --git a/contracts/interfaces/IGetters.sol b/contracts/interfaces/IGetters.sol index 6f0d6e2..6e78de6 100644 --- a/contracts/interfaces/IGetters.sol +++ b/contracts/interfaces/IGetters.sol @@ -144,6 +144,9 @@ interface IGetters { /// @notice Returns the minimum collateral ratio that must hold after surplus processing /// @dev Expressed in base 1e9, and always >= 1e9 + /// @notice Returns the aggregator or DEX the `RewardHandler` forwards its swap payload to + function getSwapRouter() external view returns (address); + function getSurplusBufferRatio() external view returns (uint64); /// @notice Computes the surplus of a collateral. diff --git a/contracts/interfaces/IHarvester.sol b/contracts/interfaces/IRebalancer.sol similarity index 84% rename from contracts/interfaces/IHarvester.sol rename to contracts/interfaces/IRebalancer.sol index 8264790..5a33c3a 100644 --- a/contracts/interfaces/IHarvester.sol +++ b/contracts/interfaces/IRebalancer.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.28; -/// @title IHarvester +/// @title IRebalancer /// @author Cooper Labs /// @custom:contact security@cooperlabs.xyz /// @dev This interface is an authorized fork of Angle's `IHarvester` interface /// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IHarvester.sol -interface IHarvester { +interface IRebalancer { function setYieldBearingAssetData( address yieldBearingAsset, address stablecoin, @@ -14,13 +14,13 @@ interface IHarvester { uint64 minExposureYieldAsset, uint64 maxExposureYieldAsset, uint64 overrideExposures, - uint96 maxSlippage + uint64 maxSlippage ) external; function updateLimitExposuresYieldAsset(address yieldBearingAsset) external; - function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external; + function setMaxSlippage(address yieldBearingAsset, uint64 newMaxSlippage) external; function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) external; } diff --git a/contracts/interfaces/IRedeemer.sol b/contracts/interfaces/IRedeemer.sol index 029b77c..912434c 100644 --- a/contracts/interfaces/IRedeemer.sol +++ b/contracts/interfaces/IRedeemer.sol @@ -11,13 +11,17 @@ interface IRedeemer { /// @param receiver Address which should be receiving the output tokens /// @param deadline Timestamp before which the redemption should have occured /// @param minAmountOuts Minimum amount of each token given back in the redemption to obtain + /// @param expectedTokensHash `keccak256(abi.encodePacked(tokens))` over the output list the caller was + /// quoted, as returned by `quoteRedemptionCurve`. The redemption reverts if the live list differs, since + /// `minAmountOuts` is positional and a collateral rotation can change which token each entry protects /// @return tokens List of tokens returned /// @return amounts Amount given for each token in the `tokens` array function redeem( uint256 amount, address receiver, uint256 deadline, - uint256[] memory minAmountOuts + uint256[] memory minAmountOuts, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts); @@ -29,7 +33,8 @@ interface IRedeemer { address receiver, uint256 deadline, uint256[] memory minAmountOuts, - address[] memory forfeitTokens + address[] memory forfeitTokens, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts); @@ -37,14 +42,17 @@ interface IRedeemer { /// @notice Same as `redeemWithForfeit` but using a single EIP-3009 authorization for the tokenP /// transfer. /// @dev The signed EIP-3009 nonce MUST equal `LibAuthorization.computeRedeemNonce(...)` so that - /// mutating `receiver`, `amount`, `deadline`, `minAmountOuts` or `forfeitTokens` invalidates the - /// signature. `authData.nonce` carries the caller-chosen `userSalt`. + /// mutating `receiver`, `amount`, `deadline`, `minAmountOuts`, `forfeitTokens` or `expectedTokensHash` + /// invalidates the signature. `authData.nonce` carries the caller-chosen `userSalt`. + /// @dev `expectedTokensHash` matters most here: a signature stays executable for its whole validity + /// window, so without it a relayer could hold one until a collateral rotation reshuffles the output list function redeemWithAuthorization( uint256 amount, address receiver, uint256 deadline, uint256[] memory minAmountOuts, address[] memory forfeitTokens, + bytes32 expectedTokensHash, bytes memory authData ) external diff --git a/contracts/interfaces/IRewardHandler.sol b/contracts/interfaces/IRewardHandler.sol index 742cd72..1ae085b 100644 --- a/contracts/interfaces/IRewardHandler.sol +++ b/contracts/interfaces/IRewardHandler.sol @@ -7,9 +7,9 @@ pragma solidity 0.8.28; /// @dev This interface is an authorized fork of Angle's `IRewardHandler` interface /// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRewardHandler.sol interface IRewardHandler { - /// @notice Sells some external tokens through a odos call + /// @notice Sells some external tokens through a call to the configured swap router /// @param minAmountOut Minimum amount of the outToken to get - /// @param payload Payload to pass to odos + /// @param payload Payload to pass to the swap router /// @return amountOut Amount obtained of the outToken function sellRewards(uint256 minAmountOut, bytes memory payload) external returns (uint256 amountOut); } diff --git a/contracts/interfaces/ISetters.sol b/contracts/interfaces/ISetters.sol index 17b514b..d20111e 100644 --- a/contracts/interfaces/ISetters.sol +++ b/contracts/interfaces/ISetters.sol @@ -72,6 +72,11 @@ interface ISettersGovernor { /// @dev The surplus buffer ratio is the minimum collateral ratio required after surplus processing /// @param _surplusBufferRatio The new surplus buffer ratio in BASE_9 function updateSurplusBufferRatio(uint64 _surplusBufferRatio) external; + + /// @notice Sets the aggregator or DEX the `RewardHandler` forwards its swap payload to + /// @dev The payload is executed with a raw call, so any router can be configured. It is chain + /// specific and must be set on every deployment before rewards can be sold + function setSwapRouter(address swapRouter) external; } /// @title ISettersGovernor diff --git a/contracts/parallelizer/Layout.sol b/contracts/parallelizer/Layout.sol index 05dd496..6d2d640 100644 --- a/contracts/parallelizer/Layout.sol +++ b/contracts/parallelizer/Layout.sol @@ -36,8 +36,15 @@ contract Layout { mapping(address => uint256) public isTrusted; // slot 7 mapping(address => uint256) public isSellerTrusted; // slot 8 mapping(WhitelistType => mapping(address => uint256)) public isWhitelistedForType; // slot 9 - // uint256(DIAMOND_STORAGE_POSITION) - ParallelizerStorage offset (9) - uint256(TRANSMUTER_STORAGE_POSITION) - uint256[56_904_584_862_873_869_173_946_452_133_933_512_717_281_559_375_467_474_726_875_187_792_230_718_146_205] + mapping(address => uint256) public slippageTolerance; // slot 10 + uint64 public surplusBufferRatio; // slot 11 + uint256 public lastReleasedAt; // slot 12 + uint256 public totalShares; // slot 13 + address[] public payees; // slot 14 + mapping(address => uint256) public shares; // slot 15 + address public swapRouter; // slot 16 + // uint256(DIAMOND_STORAGE_POSITION) - ParallelizerStorage offset (16) - uint256(TRANSMUTER_STORAGE_POSITION) + uint256[56_904_584_862_873_869_173_946_452_133_933_512_717_281_559_375_467_474_726_875_187_792_230_718_146_198] private __gap3; bytes4[] public selectors; // slot 1 mapping(bytes4 => FacetInfo) public selectorInfo; // slot 2 diff --git a/contracts/parallelizer/Storage.sol b/contracts/parallelizer/Storage.sol index a77e16f..d735820 100644 --- a/contracts/parallelizer/Storage.sol +++ b/contracts/parallelizer/Storage.sol @@ -149,4 +149,6 @@ struct ParallelizerStorage { uint256 totalShares; // The total shares of the totalShares for all payees address[] payees; // The addresses of the payees mapping(address => uint256) shares; // The shares of the totalShares for each payee + // Aggregator or DEX the `RewardHandler` forwards its swap payload to + address swapRouter; } diff --git a/contracts/parallelizer/configs/DiamondInitializer.sol b/contracts/parallelizer/configs/DiamondInitializer.sol index 7f1c428..457b394 100644 --- a/contracts/parallelizer/configs/DiamondInitializer.sol +++ b/contracts/parallelizer/configs/DiamondInitializer.sol @@ -33,7 +33,7 @@ contract DiamondInitializer { LibSetters.unpause(collateral.token, ActionType.Mint); LibSetters.unpause(collateral.token, ActionType.Burn); LibSetters.setStablecoinCap(collateral.token, 100_000_000 ether); - if (collateral.targetMax) LibOracle.updateOracle(collateral.token); + if (collateral.targetMax) LibOracle.initializeOracleTarget(collateral.token); } // setRedemptionCurveParams diff --git a/contracts/parallelizer/facets/Getters.sol b/contracts/parallelizer/facets/Getters.sol index e8e734f..bf58020 100644 --- a/contracts/parallelizer/facets/Getters.sol +++ b/contracts/parallelizer/facets/Getters.sol @@ -235,6 +235,11 @@ contract Getters is IGetters { return s.transmuterStorage().slippageTolerance[collateral]; } + /// @inheritdoc IGetters + function getSwapRouter() external view returns (address) { + return s.transmuterStorage().swapRouter; + } + /// @inheritdoc IGetters function getSurplusBufferRatio() external view returns (uint64) { return s.transmuterStorage().surplusBufferRatio; diff --git a/contracts/parallelizer/facets/Redeemer.sol b/contracts/parallelizer/facets/Redeemer.sol index 7539018..f1a3a3f 100644 --- a/contracts/parallelizer/facets/Redeemer.sol +++ b/contracts/parallelizer/facets/Redeemer.sol @@ -66,12 +66,13 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { uint256 amount, address receiver, uint256 deadline, - uint256[] memory minAmountOuts + uint256[] memory minAmountOuts, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts) { - return _redeem(amount, receiver, deadline, minAmountOuts, new address[](0), ""); + return _redeem(amount, receiver, deadline, minAmountOuts, new address[](0), expectedTokensHash, ""); } /// @inheritdoc IRedeemer @@ -82,12 +83,13 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { address receiver, uint256 deadline, uint256[] memory minAmountOuts, - address[] memory forfeitTokens + address[] memory forfeitTokens, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts) { - return _redeem(amount, receiver, deadline, minAmountOuts, forfeitTokens, ""); + return _redeem(amount, receiver, deadline, minAmountOuts, forfeitTokens, expectedTokensHash, ""); } /// @inheritdoc IRedeemer @@ -97,12 +99,13 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { uint256 deadline, uint256[] memory minAmountOuts, address[] memory forfeitTokens, + bytes32 expectedTokensHash, bytes memory authData ) external returns (address[] memory tokens, uint256[] memory amounts) { - return _redeem(amount, receiver, deadline, minAmountOuts, forfeitTokens, authData); + return _redeem(amount, receiver, deadline, minAmountOuts, forfeitTokens, expectedTokensHash, authData); } /// @inheritdoc IRedeemer @@ -148,6 +151,7 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { uint256 deadline, uint256[] memory minAmountOuts, address[] memory forfeitTokens, + bytes32 expectedTokensHash, bytes memory authData ) internal @@ -165,9 +169,13 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { (redemption.tokens, redemption.amounts, redemption.subCollateralsTracker) = _quoteRedemptionCurve(amount); if (redemption.amounts.length != minAmountOuts.length) revert InvalidLengths(); + // `minAmountOuts` is positional, so it only protects quantities. Binding the output list itself is what + // ties each minimum to the token it was quoted against, across a collateral rotation + if (keccak256(abi.encodePacked(redemption.tokens)) != expectedTokensHash) revert UnexpectedRedemptionTokens(); _updateNormalizer(amount, false); - redemption.from = _consumeAuthAndBurn(amount, to, deadline, minAmountOuts, forfeitTokens, authData); + redemption.from = + _consumeAuthAndBurn(amount, to, deadline, minAmountOuts, forfeitTokens, expectedTokensHash, authData); _distributeRedemption(redemption); emit Redeemed( @@ -197,9 +205,7 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { revert NotWhitelisted(); } if (collatInfo.isManaged > 0) { - LibManager.release( - redemption.tokens[i], redemption.to, redemption.amounts[i], collatInfo.managerData.config - ); + LibManager.release(redemption.tokens[i], redemption.to, redemption.amounts[i], collatInfo.managerData.config); } else { IERC20(redemption.tokens[i]).safeTransfer(redemption.to, redemption.amounts[i]); } @@ -216,6 +222,7 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { uint256 deadline, uint256[] memory minAmountOuts, address[] memory forfeitTokens, + bytes32 expectedTokensHash, bytes memory authData ) internal @@ -223,7 +230,7 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { { ITokenP tokenP = s.transmuterStorage().tokenP; if (authData.length > 0) { - from = _executeAuthorization(amount, to, deadline, minAmountOuts, forfeitTokens, authData); + from = _executeAuthorization(amount, to, deadline, minAmountOuts, forfeitTokens, expectedTokensHash, authData); tokenP.burnSelf(amount, address(this)); } else { from = msg.sender; @@ -240,6 +247,7 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { uint256 deadline, uint256[] memory minAmountOuts, address[] memory forfeitTokens, + bytes32 expectedTokensHash, bytes memory authData ) internal @@ -248,17 +256,12 @@ contract Redeemer is IRedeemer, AccessManagedModifiers { AuthorizationParams memory params = abi.decode(authData, (AuthorizationParams)); if (params.value != amount) revert InvalidSwap(); bytes32 derivedNonce = LibAuthorization.computeRedeemNonce( - params.from, amount, receiver, deadline, minAmountOuts, forfeitTokens, params.nonce - ); - IEIP3009(address(s.transmuterStorage().tokenP)).receiveWithAuthorization( - params.from, - address(this), - params.value, - params.validAfter, - params.validBefore, - derivedNonce, - params.signature + params.from, amount, receiver, deadline, minAmountOuts, forfeitTokens, expectedTokensHash, params.nonce ); + IEIP3009(address(s.transmuterStorage().tokenP)) + .receiveWithAuthorization( + params.from, address(this), params.value, params.validAfter, params.validBefore, derivedNonce, params.signature + ); return params.from; } diff --git a/contracts/parallelizer/facets/RewardHandler.sol b/contracts/parallelizer/facets/RewardHandler.sol index 36892ac..2f8d063 100644 --- a/contracts/parallelizer/facets/RewardHandler.sol +++ b/contracts/parallelizer/facets/RewardHandler.sol @@ -30,7 +30,7 @@ contract RewardHandler is IRewardHandler, AccessManagedModifiers { /// @dev It is impossible to sell a token that is a collateral through this function /// @dev Trusted sellers and governance only may call this function /// @dev Only governance can set which tokens can be swapped through this function by passing a prior approval - /// transaction to Odos router for the token to be swapped + /// transaction to the configured `swapRouter` for the token to be swapped function sellRewards(uint256 minAmountOut, bytes memory payload) external nonReentrant returns (uint256 amountOut) { ParallelizerStorage storage ts = s.transmuterStorage(); if (!LibDiamond.checkCanCall(msg.sender, msg.data) && ts.isSellerTrusted[msg.sender] == 0) revert NotTrusted(); @@ -44,8 +44,10 @@ contract RewardHandler is IRewardHandler, AccessManagedModifiers { balances[i] = IERC20(list[i]).balanceOf(address(this)); } uint256 tokenPBalance = IERC20(address(ts.tokenP)).balanceOf(address(this)); + address swapRouter = ts.swapRouter; + if (swapRouter == address(0)) revert ZeroAddress(); //solhint-disable-next-line - (bool success, bytes memory result) = ODOS_ROUTER.call(payload); + (bool success, bytes memory result) = swapRouter.call(payload); if (!success) _revertBytes(result); if (IERC20(address(ts.tokenP)).balanceOf(address(this)) < tokenPBalance) revert InvalidTokens(); bool hasIncreased; @@ -70,7 +72,7 @@ contract RewardHandler is IRewardHandler, AccessManagedModifiers { } } - /// @notice Processes odos revert messages + /// @notice Processes the router's revert messages function _revertBytes(bytes memory errMsg) private pure { if (errMsg.length > 0) { //solhint-disable-next-line @@ -78,6 +80,6 @@ contract RewardHandler is IRewardHandler, AccessManagedModifiers { revert(add(32, errMsg), mload(errMsg)) } } - revert OdosSwapFailed(); + revert RewardSwapFailed(); } } diff --git a/contracts/parallelizer/facets/SettersGovernor.sol b/contracts/parallelizer/facets/SettersGovernor.sol index 8101664..1add36a 100644 --- a/contracts/parallelizer/facets/SettersGovernor.sol +++ b/contracts/parallelizer/facets/SettersGovernor.sol @@ -132,4 +132,9 @@ contract SettersGovernor is AccessManagedModifiers, ISettersGovernor { function updateSurplusBufferRatio(uint64 _surplusBufferRatio) external restricted { LibSetters.updateSurplusBufferRatio(_surplusBufferRatio); } + + /// @inheritdoc ISettersGovernor + function setSwapRouter(address swapRouter) external restricted { + LibSetters.setSwapRouter(swapRouter); + } } diff --git a/contracts/parallelizer/libraries/LibAuthorization.sol b/contracts/parallelizer/libraries/LibAuthorization.sol index 8b9bbdf..ad70d37 100644 --- a/contracts/parallelizer/libraries/LibAuthorization.sol +++ b/contracts/parallelizer/libraries/LibAuthorization.sol @@ -25,9 +25,9 @@ library LibAuthorization { 0x41378613b6b468c26472b6d9a40faaeaf3c63b23ae57d1d7e3a7c3d2c356b1ed; // keccak256("RedeemWithAuthorization(address from,uint256 amount,address receiver,uint256 deadline,bytes32 - // minAmountOutsHash,bytes32 forfeitTokensHash,bytes32 userSalt)") + // minAmountOutsHash,bytes32 forfeitTokensHash,bytes32 expectedTokensHash,bytes32 userSalt)") bytes32 internal constant REDEEM_WITH_AUTHORIZATION_TYPEHASH = - 0xcff34e096e1842f6f6ae4c0d0c6eefd4855c8bdc5bc64155d7c14b2dbeee661a; + 0xb6577f08e668b53303325a19233e8315142d69bedb6d7e1d8d0e9af2473486d4; function computeSwapExactInputNonce( address from, @@ -87,6 +87,8 @@ library LibAuthorization { ); } + /// @param expectedTokensHash `keccak256(abi.encodePacked(tokens))` over the redemption output list the + /// authorizer was quoted, binding token identity and ordering rather than raw amounts alone function computeRedeemNonce( address from, uint256 amount, @@ -94,6 +96,7 @@ library LibAuthorization { uint256 deadline, uint256[] memory minAmountOuts, address[] memory forfeitTokens, + bytes32 expectedTokensHash, bytes32 userSalt ) internal @@ -109,6 +112,7 @@ library LibAuthorization { deadline, keccak256(abi.encodePacked(minAmountOuts)), keccak256(abi.encodePacked(forfeitTokens)), + expectedTokensHash, userSalt ) ); diff --git a/contracts/parallelizer/libraries/LibOracle.sol b/contracts/parallelizer/libraries/LibOracle.sol index c0a84a7..db45436 100644 --- a/contracts/parallelizer/libraries/LibOracle.sol +++ b/contracts/parallelizer/libraries/LibOracle.sol @@ -17,6 +17,9 @@ import "../Storage.sol"; /// @dev This library is an authorized fork of Angle's `LibOracle` library /// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/transmuter/libraries/LibOracle.sol library LibOracle { + /// @notice Emitted when a MAX target price is ratcheted up by `updateOracle` + event OracleTargetUpdated(address indexed collateral, uint256 previousTarget, uint256 newTarget); + /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ACTIONS SPECIFIC ORACLES //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ @@ -238,6 +241,32 @@ library LibOracle { return abi.decode(oracleConfig, (OracleReadType, OracleReadType, bytes, bytes, bytes)); } + /// @notice Seeds the MAX target with the current spot at deployment + /// @dev `updateOracle` bounds each step against the stored target, so a target left at 0 can never be raised + function initializeOracleTarget(address collateral) internal { + ParallelizerStorage storage ts = s.transmuterStorage(); + if (ts.collaterals[collateral].decimals == 0) revert NotCollateral(); + + ( + OracleReadType oracleType, + OracleReadType targetType, + bytes memory oracleData, + bytes memory targetData, + bytes memory hyperparameters + ) = _parseOracleConfig(ts.collaterals[collateral].oracleConfig); + + if (targetType != OracleReadType.MAX) revert OracleUpdateFailed(); + // Only an unset target may be seeded, so this cannot sidestep the ratchet later on + if (abi.decode(targetData, (uint256)) != 0) revert OracleUpdateFailed(); + + uint256 oracleValue = read(oracleType, BASE_18, oracleData); + if (oracleValue == 0) revert OracleUpdateFailed(); + + ts.collaterals[collateral].oracleConfig = + abi.encode(oracleType, targetType, oracleData, abi.encode(oracleValue), hyperparameters); + emit OracleTargetUpdated(collateral, 0, oracleValue); + } + function updateOracle(address collateral) internal { ParallelizerStorage storage ts = s.transmuterStorage(); if (ts.collaterals[collateral].decimals == 0) revert NotCollateral(); @@ -254,17 +283,13 @@ library LibOracle { uint256 oracleValue = read(oracleType, BASE_18, oracleData); uint256 maxValue = abi.decode(targetData, (uint256)); - if (oracleValue > maxValue) { - ts.collaterals[collateral].oracleConfig = abi.encode( - oracleType, - targetType, - oracleData, - // There are no checks whether the value increased or not - abi.encode(oracleValue), - hyperparameters - ); - } else { + // The ratchet is one-way and only governance can lower the target again through `setOracle`, so a single + // update is bounded: a transient upward print cannot be locked in beyond `MAX_ORACLE_RATCHET_STEP` + if (oracleValue <= maxValue || oracleValue * BASE_18 > maxValue * (BASE_18 + MAX_ORACLE_RATCHET_STEP)) { revert OracleUpdateFailed(); } + ts.collaterals[collateral].oracleConfig = + abi.encode(oracleType, targetType, oracleData, abi.encode(oracleValue), hyperparameters); + emit OracleTargetUpdated(collateral, maxValue, oracleValue); } } diff --git a/contracts/parallelizer/libraries/LibSetters.sol b/contracts/parallelizer/libraries/LibSetters.sol index 7c72224..8154ad6 100644 --- a/contracts/parallelizer/libraries/LibSetters.sol +++ b/contracts/parallelizer/libraries/LibSetters.sol @@ -39,6 +39,7 @@ library LibSetters { event PayeeAdded(address indexed payee, uint256 shares); event SlippageToleranceUpdated(address indexed collateral, uint256 slippageTolerance); event SurplusBufferRatioUpdated(uint64 surplusBufferRatio); + event SwapRouterUpdated(address indexed swapRouter); /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ONLY GOVERNOR ACTIONS @@ -303,6 +304,13 @@ library LibSetters { emit SlippageToleranceUpdated(collateral, slippageTolerance); } + /// @notice Internal version of `setSwapRouter` + function setSwapRouter(address swapRouter) internal { + if (swapRouter == address(0)) revert ZeroAddress(); + s.transmuterStorage().swapRouter = swapRouter; + emit SwapRouterUpdated(swapRouter); + } + /// @notice Internal version of `updateSurplusBufferRatio` function updateSurplusBufferRatio(uint64 _surplusBufferRatio) internal { if (_surplusBufferRatio < uint64(BASE_9)) revert InvalidParam(); @@ -374,6 +382,10 @@ library LibSetters { /// @param _shares The number of shares assigned to the fee receiver. function _addPayee(address _payee, uint256 _shares) internal returns (uint256) { if (_shares == 0) revert ZeroAmount(); + // The Parallelizer holds the income being distributed, so a share allocated to itself is handed + // back to `release` as fresh income on the next call. `address(0)` stays valid: `LibSurplus` + // treats it as the sentinel for burning that share. + if (_payee == address(this)) revert InvalidPayee(); ParallelizerStorage storage ts = s.transmuterStorage(); ts.payees.push(_payee); diff --git a/contracts/utils/Constants.sol b/contracts/utils/Constants.sol index d78bc0d..da477a3 100644 --- a/contracts/utils/Constants.sol +++ b/contracts/utils/Constants.sol @@ -7,7 +7,7 @@ import { IStETH } from "contracts/interfaces/external/lido/IStETH.sol"; import { IRETH } from "contracts/interfaces/external/rocketPool/IRETH.sol"; /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - STORAGE SLOTS + STORAGE SLOTS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ /// @dev Storage position of `DiamondStorage` structure @@ -23,7 +23,7 @@ bytes32 constant TRANSMUTER_STORAGE_POSITION = 0x4b2dd303f68b99d244b702089c802b6 bytes32 constant IMPLEMENTATION_STORAGE_POSITION = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - MATHS + MATHS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ uint256 constant BASE_6 = 1e6; @@ -40,9 +40,11 @@ uint256 constant MAX_MINT_FEE = BASE_12 - 1; uint256 constant MAX_PAYEES = 10; uint256 constant SECONDS_PER_YEAR = 365 days; uint256 constant MAX_STORED_ASSETS_INIT_STALENESS = 30 minutes; +/// @dev Largest relative increase a single `updateOracle` ratchet may apply to a MAX target price +uint256 constant MAX_ORACLE_RATCHET_STEP = 5e16; /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - REENTRANT + REENTRANT //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ // The values being non-zero value makes deployment a bit more expensive, @@ -54,7 +56,7 @@ uint8 constant NOT_ENTERED = 1; uint8 constant ENTERED = 2; /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - REENTRANT + REENTRANT //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ // Role IDs for the AccessManager @@ -63,11 +65,10 @@ uint64 constant GUARDIAN_ROLE = 20; uint64 constant KEEPER_ROLE = 30; /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - COMMON ADDRESSES + COMMON ADDRESSES //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ address constant PERMIT_2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; -address constant ODOS_ROUTER = 0xCf5540fFFCdC3d510B18bFcA6d2b9987b0772559; ICbETH constant CBETH = ICbETH(0xBe9895146f7AF43049ca1c1AE358B0541Ea49704); IRETH constant RETH = IRETH(0xae78736Cd615f374D3085123A210448E74Fc6393); IStETH constant STETH = IStETH(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84); diff --git a/contracts/utils/Errors.sol b/contracts/utils/Errors.sol index 6ee3525..53501a9 100644 --- a/contracts/utils/Errors.sol +++ b/contracts/utils/Errors.sol @@ -26,6 +26,7 @@ error InvalidNegativeFees(); error InvalidOracleType(); error InvalidParam(); error InvalidParams(); +error InvalidPayee(); error InvalidRate(); error InvalidSwap(); error InvalidTokens(); @@ -40,7 +41,7 @@ error NotGuardian(); error NotTrusted(); error NotTrustedOrGuardian(); error NotWhitelisted(); -error OdosSwapFailed(); +error RewardSwapFailed(); error OracleUpdateFailed(); error SurplusBufferRatioNotSet(); error Paused(); @@ -51,6 +52,7 @@ error RemoveFacetAddressMustBeZeroAddress(address _facetAddress); error TooBigAmountIn(); error TooLate(); error TooSmallAmountOut(); +error UnexpectedRedemptionTokens(); error ZeroAddress(); error ZeroAmount(); error ZeroSurplusAmount(); diff --git a/deploy/config/avalanche/config.json b/deploy/config/avalanche/config.json index 5d10d47..43805cd 100644 --- a/deploy/config/avalanche/config.json +++ b/deploy/config/avalanche/config.json @@ -20,8 +20,8 @@ "circuitChainIsMultiplied": [1], "chainlinkDecimals": [8], "hyperparameters": { - "userDeviation": 500000000000000, - "burnRatioDeviation": 0 + "userDeviation": 0, + "burnRatioDeviation": 500000000000000 } }, "xMintFee": [0], @@ -48,8 +48,8 @@ } ], "redemptionSetup": { - "xRedeemFee": [750000000, 850000000, 950000000, 970000000], - "yRedeemFee": [995000000, 950000000, 950000000, 995000000] + "xRedeemFee": [0, 600000000, 1000000000], + "yRedeemFee": [950000000, 950000000, 995000000] } } }, @@ -59,7 +59,7 @@ "symbol": "sUSDp" } }, - "genericHarvester": { + "genericRebalancer": { "usdp": { "swapRouter": "0x88de50b233052e4fb783d4f6db78cc34fea3e9fc", "tokenTransferAddress": "0x88de50b233052e4fb783d4f6db78cc34fea3e9fc", diff --git a/deploy/config/base/config.json b/deploy/config/base/config.json index f6a6c4d..dd632e9 100644 --- a/deploy/config/base/config.json +++ b/deploy/config/base/config.json @@ -20,8 +20,8 @@ "circuitChainIsMultiplied": [1], "chainlinkDecimals": [8], "hyperparameters": { - "userDeviation": 500000000000000, - "burnRatioDeviation": 0 + "userDeviation": 0, + "burnRatioDeviation": 500000000000000 } }, "xMintFee": [0], @@ -48,8 +48,8 @@ } ], "redemptionSetup": { - "xRedeemFee": [750000000, 850000000, 950000000, 970000000], - "yRedeemFee": [995000000, 950000000, 950000000, 995000000] + "xRedeemFee": [0, 600000000, 1000000000], + "yRedeemFee": [950000000, 950000000, 995000000] } } }, @@ -59,7 +59,7 @@ "symbol": "sUSDp" } }, - "genericHarvester": { + "genericRebalancer": { "usdp": { "swapRouter": "0x19ceead7105607cd444f5ad10dd51356436095a1", "tokenTransferAddress": "0x19ceead7105607cd444f5ad10dd51356436095a1", diff --git a/deploy/config/hyperevm/config.json b/deploy/config/hyperevm/config.json index 3af5446..90931c1 100644 --- a/deploy/config/hyperevm/config.json +++ b/deploy/config/hyperevm/config.json @@ -20,8 +20,8 @@ "circuitChainIsMultiplied": [1], "chainlinkDecimals": [8], "hyperparameters": { - "userDeviation": 500000000000000, - "burnRatioDeviation": 0 + "userDeviation": 0, + "burnRatioDeviation": 500000000000000 } }, "xMintFee": [0], @@ -51,8 +51,8 @@ } ], "redemptionSetup": { - "xRedeemFee": [750000000, 850000000, 950000000, 970000000], - "yRedeemFee": [995000000, 950000000, 950000000, 995000000] + "xRedeemFee": [0, 600000000, 1000000000], + "yRedeemFee": [950000000, 950000000, 995000000] } } }, @@ -62,7 +62,7 @@ "symbol": "sUSDp" } }, - "genericHarvester": { + "genericRebalancer": { "usdp": { "swapRouter": "0x744489ee3d540777a66f2cf297479745e0852f7a", "tokenTransferAddress": "0x744489ee3d540777a66f2cf297479745e0852f7a", diff --git a/deploy/config/mainnet/config.json b/deploy/config/mainnet/config.json index 83cbc8d..6d0d0c8 100644 --- a/deploy/config/mainnet/config.json +++ b/deploy/config/mainnet/config.json @@ -20,8 +20,8 @@ "circuitChainIsMultiplied": [1], "chainlinkDecimals": [8], "hyperparameters": { - "userDeviation": 500000000000000, - "burnRatioDeviation": 0 + "userDeviation": 0, + "burnRatioDeviation": 500000000000000 } }, "xMintFee": [0], @@ -57,8 +57,8 @@ "circuitChainIsMultiplied": [1], "chainlinkDecimals": [8], "hyperparameters": { - "userDeviation": 500000000000000, - "burnRatioDeviation": 0 + "userDeviation": 0, + "burnRatioDeviation": 500000000000000 } }, "xMintFee": [0], @@ -88,8 +88,8 @@ } ], "redemptionSetup": { - "xRedeemFee": [750000000, 850000000, 950000000, 970000000], - "yRedeemFee": [995000000, 950000000, 950000000, 995000000] + "xRedeemFee": [0, 600000000, 1000000000], + "yRedeemFee": [950000000, 950000000, 995000000] } } }, @@ -99,7 +99,7 @@ "symbol": "sUSDp" } }, - "genericHarvester": { + "genericRebalancer": { "usdp": { "swapRouter": "0xcf5540fffcdc3d510b18bfca6d2b9987b0772559", "tokenTransferAddress": "0xcf5540fffcdc3d510b18bfca6d2b9987b0772559", diff --git a/deploy/config/sepolia/config.json b/deploy/config/sepolia/config.json index e5c071c..2cb18d0 100644 --- a/deploy/config/sepolia/config.json +++ b/deploy/config/sepolia/config.json @@ -31,8 +31,8 @@ } ], "redemptionSetup": { - "xRedeemFee": [750000000, 850000000, 950000000, 970000000], - "yRedeemFee": [995000000, 950000000, 950000000, 995000000] + "xRedeemFee": [0, 600000000, 1000000000], + "yRedeemFee": [950000000, 950000000, 995000000] } } }, diff --git a/deploy/config/sonic/config.json b/deploy/config/sonic/config.json index 53a7ba0..d709173 100644 --- a/deploy/config/sonic/config.json +++ b/deploy/config/sonic/config.json @@ -20,8 +20,8 @@ "circuitChainIsMultiplied": [1], "chainlinkDecimals": [8], "hyperparameters": { - "userDeviation": 500000000000000, - "burnRatioDeviation": 0 + "userDeviation": 0, + "burnRatioDeviation": 500000000000000 } }, "xMintFee": [0], @@ -57,8 +57,8 @@ "circuitChainIsMultiplied": [1], "chainlinkDecimals": [8], "hyperparameters": { - "userDeviation": 500000000000000, - "burnRatioDeviation": 0 + "userDeviation": 0, + "burnRatioDeviation": 500000000000000 } }, "xMintFee": [0], @@ -88,8 +88,8 @@ } ], "redemptionSetup": { - "xRedeemFee": [750000000, 850000000, 950000000, 970000000], - "yRedeemFee": [995000000, 950000000, 950000000, 995000000] + "xRedeemFee": [0, 600000000, 1000000000], + "yRedeemFee": [950000000, 950000000, 995000000] } } }, @@ -99,7 +99,7 @@ "symbol": "sUSDp" } }, - "genericHarvester": { + "genericRebalancer": { "usdp": { "swapRouter": "0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D", "tokenTransferAddress": "0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D", diff --git a/deploy/scripts/GenericHarvester.ts b/deploy/scripts/GenericRebalancer.ts similarity index 71% rename from deploy/scripts/GenericHarvester.ts rename to deploy/scripts/GenericRebalancer.ts index c6c3b86..69e89a2 100644 --- a/deploy/scripts/GenericHarvester.ts +++ b/deploy/scripts/GenericRebalancer.ts @@ -4,7 +4,7 @@ import { deployScript, artifacts } from "@rocketh"; import { checkAddressValid, parseToConfigData } from "../utils"; import { readFileSync } from "fs"; -const contractName = "GenericHarvester"; +const contractName = "GenericRebalancer"; const token = "USDp"; @@ -28,26 +28,26 @@ export default deployScript( "Invalid tokenP address", ); - const genericHarvesterConfig = config.genericHarvester[token.toLowerCase() as keyof typeof config.genericHarvester]; - const swapRouter = checkAddressValid(genericHarvesterConfig.swapRouter, "Invalid swapRouter address"); + const genericRebalancerConfig = config.genericRebalancer[token.toLowerCase() as keyof typeof config.genericRebalancer]; + const swapRouter = checkAddressValid(genericRebalancerConfig.swapRouter, "Invalid swapRouter address"); const tokenTransferAddress = checkAddressValid( - genericHarvesterConfig.tokenTransferAddress, + genericRebalancerConfig.tokenTransferAddress, "Invalid tokenTransferAddress address", ); - const flashloan = checkAddressValid(genericHarvesterConfig.flashloan, "Invalid flashloan address"); + const flashloan = checkAddressValid(genericRebalancerConfig.flashloan, "Invalid flashloan address"); const parallelizer = get(`Parallelizer_${token}`); if (!parallelizer) { throw new Error(`Parallelizer_${token} not found`); } - const genericHarvester = await deploy(`${contractName}_${token}`, { + const genericRebalancer = await deploy(`${contractName}_${token}`, { account: deployer, - artifact: artifacts.GenericHarvester, + artifact: artifacts.GenericRebalancer, args: [tokenTransferAddress, swapRouter, tokenP, parallelizer.address, accessManager, flashloan], }); - console.log(`Deployed ${contractName}_${token}, network: ${chainName}, address: ${genericHarvester.address}`); + console.log(`Deployed ${contractName}_${token}, network: ${chainName}, address: ${genericRebalancer.address}`); }, { tags: [contractName], diff --git a/deploy/utils/types.ts b/deploy/utils/types.ts index 68fbdb3..902fc18 100644 --- a/deploy/utils/types.ts +++ b/deploy/utils/types.ts @@ -81,7 +81,7 @@ export type SavingsConfig = { symbol: string; }; -export type GenericHarvesterConfig = { +export type GenericRebalancerConfig = { swapRouter: Address; tokenTransferAddress: Address; flashloan: Address; @@ -101,7 +101,7 @@ export type ConfigData = { savings: { [tokenP: string]: SavingsConfig; }; - genericHarvester: { - [tokenP: string]: GenericHarvesterConfig; + genericRebalancer: { + [tokenP: string]: GenericRebalancerConfig; }; }; diff --git a/deployments/avalanche/GenericHarvester_USDp.json b/deployments/avalanche/GenericHarvester_USDp.json deleted file mode 100644 index 0507bdb..0000000 --- a/deployments/avalanche/GenericHarvester_USDp.json +++ /dev/null @@ -1,1190 +0,0 @@ -{ - "address": "0x0d45b129dc868963025db79a9074ea9c9e32cae4", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "initialTokenTransferAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "initialSwapRouter", - "type": "address" - }, - { - "internalType": "contract ITokenP", - "name": "definitivetokenP", - "type": "address" - }, - { - "internalType": "contract IParallelizer", - "name": "definitiveParallelizer", - "type": "address" - }, - { - "internalType": "address", - "name": "initialAuthority", - "type": "address" - }, - { - "internalType": "contract IERC3156FlashLender", - "name": "definitiveFlashloan", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AccessManagedInvalidAuthority", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "internalType": "uint32", - "name": "delay", - "type": "uint32" - } - ], - "name": "AccessManagedRequiredDelay", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "AccessManagedUnauthorized", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidParam", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrusted", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrustedOrGuardian", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", - "type": "error" - }, - { - "inputs": [], - "name": "SwapError", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAmount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "SwapRouterUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "TokenTransferAddressUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "trusted", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "status", - "type": "bool" - } - ], - "name": "TrustedToggled", - "type": "event" - }, - { - "inputs": [], - "name": "CALLBACK_SUCCESS", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "addBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "authority", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "budget", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "computeRebalanceAmount", - "outputs": [ - { - "internalType": "uint8", - "name": "increase", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "flashloan", - "outputs": [ - { - "internalType": "contract IERC3156FlashLender", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "scale", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "name": "harvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isConsumingScheduledOp", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isTrusted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "initiator", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "onFlashLoan", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "parallelizer", - "outputs": [ - { - "internalType": "contract IParallelizer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToRecover", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "recoverERC20", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "removeBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAuthority", - "type": "address" - } - ], - "name": "setAuthority", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint96", - "name": "newMaxSlippage", - "type": "uint96" - } - ], - "name": "setMaxSlippage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "setSwapRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - } - ], - "name": "setTargetExposure", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "setTokenTransferAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "name": "setYieldBearingAssetData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapRouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "trusted", - "type": "address" - } - ], - "name": "toggleTrusted", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "tokenP", - "outputs": [ - { - "internalType": "contract ITokenP", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenTransferAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "updateLimitExposuresYieldAsset", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "yieldBearingData", - "outputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "contractName": "GenericHarvester", - "sourceName": "contracts/helpers/GenericHarvester.sol", - "bytecode": "0x60e080604052346101e95760c08161270c803803809161001f828561020f565b8339810103126101e95761003281610246565b9061003f60208201610246565b6040820151926001600160a01b038416918285036101e95760608401516001600160a01b03811681036101e95760a061007a60808701610246565b950151956001600160a01b038716958688036101e9575f80546001600160a01b0319166001600160a01b0390921691821790556040519081527f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90602090a160a052608052600480546001600160a01b039283166001600160a01b0319918216179091556005805493909216921691909117905581156102005760446020925f9460c052604051948593849263095ea7b360e01b84526004840152811960248401525af180156101f5576101b9575b6040516124b1908161025b823960805181818161027601528181610ce601528181610e1e01528181611cd70152612069015260a0518181816103bf0152818161066c01528181610e4b015281816115790152611600015260c05181818161040701528181610d5b01526115bd0152f35b6020813d6020116101ed575b816101d26020938361020f565b810103126101e95751801515036101e9575f610149565b5f80fd5b3d91506101c5565b6040513d5f823e3d90fd5b63d92e233d60e01b5f5260045ffd5b601f909101601f19168101906001600160401b0382119082101761023257604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101e95756fe60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461166a57806313047520146116245780631978a5ed146115e15780631b89b61a1461159e578063212c8fb1146114e557806323e30c8b14610d0a57806335b37d1a14610cc75780634127365714610c455780635a7cb38f14610c1f578063641bd50314610b6d5780637a9e5e4b14610a9f5780637ee8434914610a0e5780638195001d146109ed5780638237e538146109b35780638fb360371461094057806396d64879146109035780639ae784861461082e578063b51609b4146107a7578063bf7e214f14610782578063c31c9c071461075c578063c5e6d5ea146106cb578063c9c6667414610693578063d2d0ec101461062a578063da94e205146105b1578063e234b903146105025763edf0ef0314610138575f80fd5b346104ae5760603660031901126104ae576101516118c0565b60243560443567ffffffffffffffff81116104ae576101749036906004016118ec565b9290633b9aca0083116104da578161018d600293611a33565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca84611972565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611cca565b979097611a79565b049586156104b2578301926040818503126104ae5780359360028510156104ae57602082013567ffffffffffffffff81116104ae5761026b92016119e0565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ae575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610492575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047e5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a79565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122a3565b03601f1981018452836119a2565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122a3565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047357610437575080f35b6020813d60201161046b575b81610450602093836119a2565b810103126104675751801515036104645780f35b80fd5b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049f9198505f906119a2565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ae5760203660031901126104ae576001600160a01b036105236118c0565b610536336105313633611a8c565b61191a565b168015610589576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ae5760403660031901126104ae576105ca6118c0565b602435906bffffffffffffffffffffffff82168092036104ae576105f2336105313633611a8c565b633b9aca0082116104da576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ae5760403660031901126104ae576106916004356106496118d6565b335f52600660205260405f20610660838254611a26565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661224c565b005b346104ae5760203660031901126104ae576001600160a01b036106b46118c0565b165f526006602052602060405f2054604051908152f35b346104ae5760203660031901126104ae576001600160a01b036106ec6118c0565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ae575f3660031901126104ae5760206001600160a01b0360045416604051908152f35b346104ae575f3660031901126104ae5760206001600160a01b035f5416604051908152f35b346104ae5760603660031901126104ae576107c06118c0565b6024356044356001600160a01b0381168082036104ae577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f560606106919561080c336105313633611a8c565b6001600160a01b036040519116938482528660208301526040820152a161224c565b346104ae5760403660031901126104ae576108476118c0565b60243567ffffffffffffffff811681036104ae57335f52600360205260ff60405f20541615806108f2575b6108ca576001600160a01b0361069192165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fd3633611a8c565b15610872565b346104ae5760203660031901126104ae576001600160a01b036109246118c0565b165f526003602052602060ff60405f2054166040519015158152f35b346104ae575f3660031901126104ae575f5460a01c60ff16156109ab5760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f610981565b346104ae575f3660031901126104ae5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ae5760203660031901126104ae57610691610a096118c0565b611a33565b346104ae5760203660031901126104ae576001600160a01b03610a2f6118c0565b610a3d336105313633611a8c565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ae5760203660031901126104ae57610ab86118c0565b5f54906001600160a01b0382163303610b5b57803b15610b265773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ae5760203660031901126104ae576040610c10610b8b6118c0565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bbb85611972565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611cca565b60ff8351921682526020820152f35b346104ae575f3660031901126104ae5760206001600160a01b0360055416604051908152f35b346104ae5760203660031901126104ae576001600160a01b03610c666118c0565b610c74336105313633611a8c565b168015610589576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ae575f3660031901126104ae5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ae5760a03660031901126104ae57610d236118c0565b610d2b6118d6565b5060443560843567ffffffffffffffff81116104ae57610d4f9036906004016118ec565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114d1575b5080156114c6575b61149e5782019060e0838303126104ae57610da88361195e565b92610db56040820161195e565b610dc16060830161195e565b9360a08301359060028210156104ae5760c08401359067ffffffffffffffff82116104ae57610dfc6001600160a01b039291839287016119e0565b9616921694600160208501351495865f146114985792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b038716998a60648401523060848401524260a48401525af19384156110c9575f94611464575b505f92600181036112c357505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c9575f9561128f575b50604093845192610f1686856119a2565b60018452601f1986019182366020870137610f3085612029565b52855192610f3e87856119a2565b600184525f5b83811061127e5750610f5584612029565b52610f5f83612029565b50855191610f6d87846119a2565b60018352366020840137610f8082612029565b528251925f5b84811061111c57505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111357505f916110d4575b5060809660c4936001600160a01b03610fdc60209897955f95611a26565b945b610fe9868583611c29565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c9575f92611095575b50818111611061575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b039161107391611a26565b91165f52600660205261108b60405f20918254611a26565b9055808080611037565b9091506020813d6020116110c1575b816110b1602093836119a2565b810103126104ae5751908361102e565b3d91506110a4565b6040513d5f823e3d90fd5b905060209493919294813d60201161110b575b816110f4602093836119a2565b810103126104ae5751929390929091906080610fbe565b3d91506110e7565b513d5f823e3d90fd5b6001600160a01b0361112e828461204a565b51166001600160a01b036005541690611147838661204a565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa938415611274575f94611241575b50808410611225575b505050505f8061119b838761204a565b516001600160a01b036004541682602083519301915af13d1561121d573d906111c3826119c4565b916111d08a5193846119a2565b82523d5f602084013e5b156111e85750600101610f86565b80519081611218577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b6060906111da565b6112389361123291611a26565b91612334565b8e80808061118b565b9093506020813d821161126c575b8161125c602093836119a2565b810103126104ae5751925f611182565b3d915061124f565b8b513d5f823e3d90fd5b806060602080938801015201610f44565b9094506020813d6020116112bb575b816112ab602093836119a2565b810103126104ae5751938b610f05565b3d915061129e565b9091939492989a979550156112f0575b50505050925f6080969360c4936001600160a01b03602097610fde565b9396509192869290156113ba5750611309918391611c29565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c9575f91611380575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112d3565b95929390506020863d6020116113b2575b8161139e602093836119a2565b810103126104ae579451919492915f61135c565b3d9150611391565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c9575f9161142a575b50925f6080969360c4936001600160a01b03602097611372565b95929390506020863d60201161145c575b81611448602093836119a2565b810103126104ae579451919492915f611410565b3d915061143b565b9093506020813d602011611490575b81611480602093836119a2565b810103126104ae5751928c610ec0565b3d9150611473565b91610e14565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8e565b6001600160a01b0316301415905084610d86565b346104ae5760403660031901126104ae576106916004356001600160a01b0361150c6118d6565b165f52600660205260405f2061152382825461193d565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261156f6084826119a2565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166122c7565b346104ae575f3660031901126104ae5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ae575f3660031901126104ae5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ae5760203660031901126104ae576001600160a01b036116456118c0565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ae5760e03660031901126104ae576116836118c0565b61168b6118d6565b6044359167ffffffffffffffff8316918284036104ae576064359267ffffffffffffffff8416918285036104ae576084359567ffffffffffffffff87168097036104ae5760a4359467ffffffffffffffff8616908187036104ae5760c435906bffffffffffffffffffffffff82168092036104ae576001600160a01b0390611717336105313633611a8c565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104da57633b9aca008110156104da576117a460019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461187857505083633b9aca0081109182159261186d575b50506104da576106919267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b101590508385611821565b929150925061069193507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff82541617905561205e565b600435906001600160a01b03821682036104ae57565b602435906001600160a01b03821682036104ae57565b9181601f840112156104ae5782359167ffffffffffffffff83116104ae57602083818601950101116104ae57565b156119225750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161194a57565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ae57565b60c0810190811067ffffffffffffffff82111761198e57604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761198e57604052565b67ffffffffffffffff811161198e57601f01601f191660200190565b81601f820112156104ae578035906119f7826119c4565b92611a0560405194856119a2565b828452602083830101116104ae57815f926020809301838601378301015290565b9190820391821161194a57565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a635750565b806001600160a01b03611a7792541661205e565b565b8181029291811591840414171561194a57565b905f915f54916001600160a01b03831692816004116104ae575f5f9060405f8151966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611b246084826119a2565b828052826020525190895afa611c16575b15611b46575b505050505050600190565b63ffffffff1615611c0d5760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ae576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c957611bfa575b5060ff60a01b1981541690555f8080808080611b3b565b611c0691505f906119a2565b5f5f611be3565b50505050505f90565b50505f516020518060201c150290611b35565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c9575f94611c80575b508310611c7557505050565b611a77921991612334565b9093506020813d602011611cac575b81611c9c602093836119a2565b810103126104ae5751925f611c69565b3d9150611c8f565b91908260409103126104ae576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c9575f905f92611ee6575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c9575f93611eb4575b50611d7b8267ffffffffffffffff602088015116611a79565b633b9aca008202828104633b9aca00148315171561194a57811015611e2b576040611dba611dc39493633b9aca0067ffffffffffffffff940490611a26565b96015116611a79565b633b9aca008202828104633b9aca00148315171561194a57811015611de957505f925050565b611df3848361193d565b633b9aca00810290808204633b9aca00149015171561194a578110611e16575050565b611e28929350633b9aca009004611a26565b90565b95509067ffffffffffffffff6060611dba611e4e94633b9aca0060019a04611a26565b633b9aca008202828104633b9aca00148315171561194a5781811015611e7657505f93505050565b633b9aca008502858104633b9aca00148615171561194a57611e98908361193d565b11611ea1575050565b611e28929350633b9aca00900490611a26565b611ed791935060403d604011611edf575b611ecf81836119a2565b810190611cb4565b50915f611d62565b503d611ec5565b9050611f01915060403d604011611edf57611ecf81836119a2565b905f611d2d565b67ffffffffffffffff811161198e5760051b60200190565b91906040838203126104ae57825167ffffffffffffffff81116104ae57830181601f820112156104ae578051611f5581611f08565b91611f6360405193846119a2565b81835260208084019260051b820101908482116104ae57602001915b818310612008575050509260208101519067ffffffffffffffff82116104ae57019080601f830112156104ae57815190611fb882611f08565b92611fc660405194856119a2565b82845260208085019360051b8201019182116104ae57602001915b818310611fee5750505090565b82518060070b81036104ae57815260209283019201611fe1565b825167ffffffffffffffff811681036104ae57815260209283019201611f7f565b8051156120365760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120365760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c9575f9261222f575b508151600181116121e9575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c9575f926121c4575b508151916001831161216a575060010180546fffffffffffffffff00000000000000001916905550565b600119830192831161194a5767ffffffffffffffff61218e611a779460019361204a565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6121e19192503d805f833e6121d981836119a2565b810190611f20565b50905f612140565b600119810190811161194a5761220967ffffffffffffffff915f9461204a565b511667ffffffffffffffff60018501911667ffffffffffffffff198254161790556120ff565b6122449192503d805f833e6121d981836119a2565b50905f6120d6565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a779161229e8260648101610376565b6122c7565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b905f602091828151910182855af1156110c9575f513d61232b57506001600160a01b0381163b155b6122f65750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b600114156122ef565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c9575f90612447575b61237d925061193d565b9160205f604051946123c8866123ba8582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f1981018852876119a2565b85519082865af1903d5f519083612428575b505050156123e757505050565b61229e611a77936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124226064826119a2565b826122c7565b9192509061243d57503b15155b5f80806123da565b6001915014612435565b506020823d602011612473575b81612461602093836119a2565b810103126104ae5761237d9151612373565b3d915061245456fea2646970667358221220c91ca8ea8899ca08b3839156df940b48fa1be932a747ba5243a6a03e6a682f0564736f6c634300081c0033", - "deployedBytecode": "0x60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461166a57806313047520146116245780631978a5ed146115e15780631b89b61a1461159e578063212c8fb1146114e557806323e30c8b14610d0a57806335b37d1a14610cc75780634127365714610c455780635a7cb38f14610c1f578063641bd50314610b6d5780637a9e5e4b14610a9f5780637ee8434914610a0e5780638195001d146109ed5780638237e538146109b35780638fb360371461094057806396d64879146109035780639ae784861461082e578063b51609b4146107a7578063bf7e214f14610782578063c31c9c071461075c578063c5e6d5ea146106cb578063c9c6667414610693578063d2d0ec101461062a578063da94e205146105b1578063e234b903146105025763edf0ef0314610138575f80fd5b346104ae5760603660031901126104ae576101516118c0565b60243560443567ffffffffffffffff81116104ae576101749036906004016118ec565b9290633b9aca0083116104da578161018d600293611a33565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca84611972565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611cca565b979097611a79565b049586156104b2578301926040818503126104ae5780359360028510156104ae57602082013567ffffffffffffffff81116104ae5761026b92016119e0565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ae575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610492575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047e5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a79565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122a3565b03601f1981018452836119a2565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122a3565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047357610437575080f35b6020813d60201161046b575b81610450602093836119a2565b810103126104675751801515036104645780f35b80fd5b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049f9198505f906119a2565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ae5760203660031901126104ae576001600160a01b036105236118c0565b610536336105313633611a8c565b61191a565b168015610589576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ae5760403660031901126104ae576105ca6118c0565b602435906bffffffffffffffffffffffff82168092036104ae576105f2336105313633611a8c565b633b9aca0082116104da576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ae5760403660031901126104ae576106916004356106496118d6565b335f52600660205260405f20610660838254611a26565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661224c565b005b346104ae5760203660031901126104ae576001600160a01b036106b46118c0565b165f526006602052602060405f2054604051908152f35b346104ae5760203660031901126104ae576001600160a01b036106ec6118c0565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ae575f3660031901126104ae5760206001600160a01b0360045416604051908152f35b346104ae575f3660031901126104ae5760206001600160a01b035f5416604051908152f35b346104ae5760603660031901126104ae576107c06118c0565b6024356044356001600160a01b0381168082036104ae577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f560606106919561080c336105313633611a8c565b6001600160a01b036040519116938482528660208301526040820152a161224c565b346104ae5760403660031901126104ae576108476118c0565b60243567ffffffffffffffff811681036104ae57335f52600360205260ff60405f20541615806108f2575b6108ca576001600160a01b0361069192165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fd3633611a8c565b15610872565b346104ae5760203660031901126104ae576001600160a01b036109246118c0565b165f526003602052602060ff60405f2054166040519015158152f35b346104ae575f3660031901126104ae575f5460a01c60ff16156109ab5760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f610981565b346104ae575f3660031901126104ae5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ae5760203660031901126104ae57610691610a096118c0565b611a33565b346104ae5760203660031901126104ae576001600160a01b03610a2f6118c0565b610a3d336105313633611a8c565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ae5760203660031901126104ae57610ab86118c0565b5f54906001600160a01b0382163303610b5b57803b15610b265773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ae5760203660031901126104ae576040610c10610b8b6118c0565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bbb85611972565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611cca565b60ff8351921682526020820152f35b346104ae575f3660031901126104ae5760206001600160a01b0360055416604051908152f35b346104ae5760203660031901126104ae576001600160a01b03610c666118c0565b610c74336105313633611a8c565b168015610589576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ae575f3660031901126104ae5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ae5760a03660031901126104ae57610d236118c0565b610d2b6118d6565b5060443560843567ffffffffffffffff81116104ae57610d4f9036906004016118ec565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114d1575b5080156114c6575b61149e5782019060e0838303126104ae57610da88361195e565b92610db56040820161195e565b610dc16060830161195e565b9360a08301359060028210156104ae5760c08401359067ffffffffffffffff82116104ae57610dfc6001600160a01b039291839287016119e0565b9616921694600160208501351495865f146114985792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b038716998a60648401523060848401524260a48401525af19384156110c9575f94611464575b505f92600181036112c357505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c9575f9561128f575b50604093845192610f1686856119a2565b60018452601f1986019182366020870137610f3085612029565b52855192610f3e87856119a2565b600184525f5b83811061127e5750610f5584612029565b52610f5f83612029565b50855191610f6d87846119a2565b60018352366020840137610f8082612029565b528251925f5b84811061111c57505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111357505f916110d4575b5060809660c4936001600160a01b03610fdc60209897955f95611a26565b945b610fe9868583611c29565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c9575f92611095575b50818111611061575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b039161107391611a26565b91165f52600660205261108b60405f20918254611a26565b9055808080611037565b9091506020813d6020116110c1575b816110b1602093836119a2565b810103126104ae5751908361102e565b3d91506110a4565b6040513d5f823e3d90fd5b905060209493919294813d60201161110b575b816110f4602093836119a2565b810103126104ae5751929390929091906080610fbe565b3d91506110e7565b513d5f823e3d90fd5b6001600160a01b0361112e828461204a565b51166001600160a01b036005541690611147838661204a565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa938415611274575f94611241575b50808410611225575b505050505f8061119b838761204a565b516001600160a01b036004541682602083519301915af13d1561121d573d906111c3826119c4565b916111d08a5193846119a2565b82523d5f602084013e5b156111e85750600101610f86565b80519081611218577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b6060906111da565b6112389361123291611a26565b91612334565b8e80808061118b565b9093506020813d821161126c575b8161125c602093836119a2565b810103126104ae5751925f611182565b3d915061124f565b8b513d5f823e3d90fd5b806060602080938801015201610f44565b9094506020813d6020116112bb575b816112ab602093836119a2565b810103126104ae5751938b610f05565b3d915061129e565b9091939492989a979550156112f0575b50505050925f6080969360c4936001600160a01b03602097610fde565b9396509192869290156113ba5750611309918391611c29565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c9575f91611380575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112d3565b95929390506020863d6020116113b2575b8161139e602093836119a2565b810103126104ae579451919492915f61135c565b3d9150611391565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c9575f9161142a575b50925f6080969360c4936001600160a01b03602097611372565b95929390506020863d60201161145c575b81611448602093836119a2565b810103126104ae579451919492915f611410565b3d915061143b565b9093506020813d602011611490575b81611480602093836119a2565b810103126104ae5751928c610ec0565b3d9150611473565b91610e14565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8e565b6001600160a01b0316301415905084610d86565b346104ae5760403660031901126104ae576106916004356001600160a01b0361150c6118d6565b165f52600660205260405f2061152382825461193d565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261156f6084826119a2565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166122c7565b346104ae575f3660031901126104ae5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ae575f3660031901126104ae5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ae5760203660031901126104ae576001600160a01b036116456118c0565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ae5760e03660031901126104ae576116836118c0565b61168b6118d6565b6044359167ffffffffffffffff8316918284036104ae576064359267ffffffffffffffff8416918285036104ae576084359567ffffffffffffffff87168097036104ae5760a4359467ffffffffffffffff8616908187036104ae5760c435906bffffffffffffffffffffffff82168092036104ae576001600160a01b0390611717336105313633611a8c565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104da57633b9aca008110156104da576117a460019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461187857505083633b9aca0081109182159261186d575b50506104da576106919267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b101590508385611821565b929150925061069193507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff82541617905561205e565b600435906001600160a01b03821682036104ae57565b602435906001600160a01b03821682036104ae57565b9181601f840112156104ae5782359167ffffffffffffffff83116104ae57602083818601950101116104ae57565b156119225750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161194a57565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ae57565b60c0810190811067ffffffffffffffff82111761198e57604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761198e57604052565b67ffffffffffffffff811161198e57601f01601f191660200190565b81601f820112156104ae578035906119f7826119c4565b92611a0560405194856119a2565b828452602083830101116104ae57815f926020809301838601378301015290565b9190820391821161194a57565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a635750565b806001600160a01b03611a7792541661205e565b565b8181029291811591840414171561194a57565b905f915f54916001600160a01b03831692816004116104ae575f5f9060405f8151966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611b246084826119a2565b828052826020525190895afa611c16575b15611b46575b505050505050600190565b63ffffffff1615611c0d5760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ae576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c957611bfa575b5060ff60a01b1981541690555f8080808080611b3b565b611c0691505f906119a2565b5f5f611be3565b50505050505f90565b50505f516020518060201c150290611b35565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c9575f94611c80575b508310611c7557505050565b611a77921991612334565b9093506020813d602011611cac575b81611c9c602093836119a2565b810103126104ae5751925f611c69565b3d9150611c8f565b91908260409103126104ae576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c9575f905f92611ee6575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c9575f93611eb4575b50611d7b8267ffffffffffffffff602088015116611a79565b633b9aca008202828104633b9aca00148315171561194a57811015611e2b576040611dba611dc39493633b9aca0067ffffffffffffffff940490611a26565b96015116611a79565b633b9aca008202828104633b9aca00148315171561194a57811015611de957505f925050565b611df3848361193d565b633b9aca00810290808204633b9aca00149015171561194a578110611e16575050565b611e28929350633b9aca009004611a26565b90565b95509067ffffffffffffffff6060611dba611e4e94633b9aca0060019a04611a26565b633b9aca008202828104633b9aca00148315171561194a5781811015611e7657505f93505050565b633b9aca008502858104633b9aca00148615171561194a57611e98908361193d565b11611ea1575050565b611e28929350633b9aca00900490611a26565b611ed791935060403d604011611edf575b611ecf81836119a2565b810190611cb4565b50915f611d62565b503d611ec5565b9050611f01915060403d604011611edf57611ecf81836119a2565b905f611d2d565b67ffffffffffffffff811161198e5760051b60200190565b91906040838203126104ae57825167ffffffffffffffff81116104ae57830181601f820112156104ae578051611f5581611f08565b91611f6360405193846119a2565b81835260208084019260051b820101908482116104ae57602001915b818310612008575050509260208101519067ffffffffffffffff82116104ae57019080601f830112156104ae57815190611fb882611f08565b92611fc660405194856119a2565b82845260208085019360051b8201019182116104ae57602001915b818310611fee5750505090565b82518060070b81036104ae57815260209283019201611fe1565b825167ffffffffffffffff811681036104ae57815260209283019201611f7f565b8051156120365760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120365760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c9575f9261222f575b508151600181116121e9575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c9575f926121c4575b508151916001831161216a575060010180546fffffffffffffffff00000000000000001916905550565b600119830192831161194a5767ffffffffffffffff61218e611a779460019361204a565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6121e19192503d805f833e6121d981836119a2565b810190611f20565b50905f612140565b600119810190811161194a5761220967ffffffffffffffff915f9461204a565b511667ffffffffffffffff60018501911667ffffffffffffffff198254161790556120ff565b6122449192503d805f833e6121d981836119a2565b50905f6120d6565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a779161229e8260648101610376565b6122c7565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b905f602091828151910182855af1156110c9575f513d61232b57506001600160a01b0381163b155b6122f65750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b600114156122ef565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c9575f90612447575b61237d925061193d565b9160205f604051946123c8866123ba8582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f1981018852876119a2565b85519082865af1903d5f519083612428575b505050156123e757505050565b61229e611a77936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124226064826119a2565b826122c7565b9192509061243d57503b15155b5f80806123da565b6001915014612435565b506020823d602011612473575b81612461602093836119a2565b810103126104ae5761237d9151612373565b3d915061245456fea2646970667358221220c91ca8ea8899ca08b3839156df940b48fa1be932a747ba5243a6a03e6a682f0564736f6c634300081c0033", - "linkReferences": {}, - "deployedLinkReferences": {}, - "immutableReferences": { - "7707": [ - { - "length": 32, - "start": 630 - }, - { - "length": 32, - "start": 3302 - }, - { - "length": 32, - "start": 3614 - }, - { - "length": 32, - "start": 7383 - }, - { - "length": 32, - "start": 8297 - } - ], - "7711": [ - { - "length": 32, - "start": 959 - }, - { - "length": 32, - "start": 1644 - }, - { - "length": 32, - "start": 3659 - }, - { - "length": 32, - "start": 5497 - }, - { - "length": 32, - "start": 5632 - } - ], - "8438": [ - { - "length": 32, - "start": 1031 - }, - { - "length": 32, - "start": 3419 - }, - { - "length": 32, - "start": 5565 - } - ] - }, - "inputSourceName": "project/contracts/helpers/GenericHarvester.sol", - "devdoc": { - "author": "Cooper Labs", - "custom:contact": "security@cooperlabs.xyz", - "details": "Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol", - "errors": { - "SafeERC20FailedOperation(address)": [ - { - "details": "An operation with an ERC-20 token failed." - } - ] - }, - "events": { - "AuthorityUpdated(address)": { - "details": "Authority that manages this contract was updated." - } - }, - "kind": "dev", - "methods": { - "addBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to add to the budget", - "receiver": "address of the receiver" - } - }, - "authority()": { - "details": "Returns the current authority." - }, - "computeRebalanceAmount(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - }, - "returns": { - "amount": "amount to be rebalanced", - "increase": "whether the exposure should be increased" - } - }, - "harvest(address,uint256,bytes)": { - "details": "This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage" - }, - "isConsumingScheduledOp()": { - "details": "Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls." - }, - "onFlashLoan(address,address,uint256,uint256,bytes)": { - "details": "Receive a flash loan.", - "params": { - "amount": "The amount of tokens lent.", - "data": "Arbitrary data structure, intended to contain user-defined parameters.", - "fee": "The additional amount of tokens to repay.", - "initiator": "The initiator of the loan.", - "token": "The loan currency." - }, - "returns": { - "_0": "The keccak256 hash of \"ERC3156FlashBorrower.onFlashLoan\"" - } - }, - "recoverERC20(address,uint256,address)": { - "params": { - "amountToRecover": "amount to recover", - "to": "address to send the recovered tokens", - "tokenAddress": "address of the token to recover" - } - }, - "removeBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to remove from the budget", - "receiver": "address of the receiver" - } - }, - "setAuthority(address)": { - "details": "Transfers control to a new authority. The caller must be the current authority." - }, - "setMaxSlippage(address,uint96)": { - "params": { - "newMaxSlippage": "new max allowed slippage" - } - }, - "setSwapRouter(address)": { - "params": { - "newSwapRouter": "address of the swap router" - } - }, - "setTargetExposure(address,uint64)": { - "params": { - "targetExposure": "target exposure to the yield bearing asset used", - "yieldBearingAsset": "address of the yield bearing asset" - } - }, - "setTokenTransferAddress(address)": { - "params": { - "newTokenTransferAddress": "address of the token transfer contract" - } - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "params": { - "asset": "address of the asset", - "maxExposure": "maximum exposure within the Parallelizer to the asset", - "minExposure": "minimum exposure within the Parallelizer to the asset", - "overrideExposures": "whether limit exposures should be overriden or read onchain through the Parallelizer", - "targetExposure": "target exposure to the yieldBearingAsset asset used", - "yieldBearingAsset": "address of the yieldBearingAsset" - } - }, - "toggleTrusted(address)": { - "params": { - "trusted": "address to toggle the trusted status" - } - }, - "updateLimitExposuresYieldAsset(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - } - } - }, - "title": "GenericHarvester", - "version": 1 - }, - "evm": { - "gasEstimates": { - "creation": { - "codeDepositCost": "1878600", - "executionCost": "infinite", - "totalCost": "infinite" - }, - "external": { - "CALLBACK_SUCCESS()": "433", - "addBudget(uint256,address)": "infinite", - "authority()": "2663", - "budget(address)": "2862", - "computeRebalanceAmount(address)": "infinite", - "flashloan()": "infinite", - "harvest(address,uint256,bytes)": "infinite", - "isConsumingScheduledOp()": "2606", - "isTrusted(address)": "2742", - "maxTokenSlippage(address)": "2428", - "onFlashLoan(address,address,uint256,uint256,bytes)": "infinite", - "parallelizer()": "infinite", - "recoverERC20(address,uint256,address)": "infinite", - "removeBudget(uint256,address)": "infinite", - "setAuthority(address)": "28360", - "setMaxSlippage(address,uint96)": "infinite", - "setSwapRouter(address)": "infinite", - "setTargetExposure(address,uint64)": "infinite", - "setTokenTransferAddress(address)": "infinite", - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": "infinite", - "swapRouter()": "2686", - "toggleTrusted(address)": "infinite", - "tokenP()": "infinite", - "tokenTransferAddress()": "2444", - "updateLimitExposuresYieldAsset(address)": "infinite", - "yieldBearingData(address)": "7217" - }, - "internal": { - "_adjustYieldExposure(uint256,uint8,address,address,uint256,enum SwapType,bytes memory)": "infinite", - "_swapToTokenOut(uint256,address,address,uint256,enum SwapType,bytes memory)": "infinite", - "_swapToTokenOutSwap(address,address,uint256,bytes memory)": "infinite", - "_swapToTokenOutVault(uint256,address,address,uint256)": "infinite" - } - } - }, - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialTokenTransferAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialSwapRouter\",\"type\":\"address\"},{\"internalType\":\"contract ITokenP\",\"name\":\"definitivetokenP\",\"type\":\"address\"},{\"internalType\":\"contract IParallelizer\",\"name\":\"definitiveParallelizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAuthority\",\"type\":\"address\"},{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"definitiveFlashloan\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AccessManagedInvalidAuthority\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"AccessManagedRequiredDelay\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"AccessManagedUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrustedOrGuardian\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SwapError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"SwapRouterUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"TokenTransferAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CALLBACK_SUCCESS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"addBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"authority\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"budget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"computeRebalanceAmount\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"increase\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flashloan\",\"outputs\":[{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"scale\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"harvest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isConsumingScheduledOp\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isTrusted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxTokenSlippage\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onFlashLoan\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parallelizer\",\"outputs\":[{\"internalType\":\"contract IParallelizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"removeBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAuthority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"newMaxSlippage\",\"type\":\"uint96\"}],\"name\":\"setMaxSlippage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"setSwapRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"}],\"name\":\"setTargetExposure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"setTokenTransferAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"name\":\"setYieldBearingAssetData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenP\",\"outputs\":[{\"internalType\":\"contract ITokenP\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenTransferAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"updateLimitExposuresYieldAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"yieldBearingData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Cooper Labs\",\"custom:contact\":\"security@cooperlabs.xyz\",\"details\":\"Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\",\"errors\":{\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"AuthorityUpdated(address)\":{\"details\":\"Authority that manages this contract was updated.\"}},\"kind\":\"dev\",\"methods\":{\"addBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to add to the budget\",\"receiver\":\"address of the receiver\"}},\"authority()\":{\"details\":\"Returns the current authority.\"},\"computeRebalanceAmount(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"},\"returns\":{\"amount\":\"amount to be rebalanced\",\"increase\":\"whether the exposure should be increased\"}},\"harvest(address,uint256,bytes)\":{\"details\":\"This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage\"},\"isConsumingScheduledOp()\":{\"details\":\"Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls.\"},\"onFlashLoan(address,address,uint256,uint256,bytes)\":{\"details\":\"Receive a flash loan.\",\"params\":{\"amount\":\"The amount of tokens lent.\",\"data\":\"Arbitrary data structure, intended to contain user-defined parameters.\",\"fee\":\"The additional amount of tokens to repay.\",\"initiator\":\"The initiator of the loan.\",\"token\":\"The loan currency.\"},\"returns\":{\"_0\":\"The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\"}},\"recoverERC20(address,uint256,address)\":{\"params\":{\"amountToRecover\":\"amount to recover\",\"to\":\"address to send the recovered tokens\",\"tokenAddress\":\"address of the token to recover\"}},\"removeBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to remove from the budget\",\"receiver\":\"address of the receiver\"}},\"setAuthority(address)\":{\"details\":\"Transfers control to a new authority. The caller must be the current authority.\"},\"setMaxSlippage(address,uint96)\":{\"params\":{\"newMaxSlippage\":\"new max allowed slippage\"}},\"setSwapRouter(address)\":{\"params\":{\"newSwapRouter\":\"address of the swap router\"}},\"setTargetExposure(address,uint64)\":{\"params\":{\"targetExposure\":\"target exposure to the yield bearing asset used\",\"yieldBearingAsset\":\"address of the yield bearing asset\"}},\"setTokenTransferAddress(address)\":{\"params\":{\"newTokenTransferAddress\":\"address of the token transfer contract\"}},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"params\":{\"asset\":\"address of the asset\",\"maxExposure\":\"maximum exposure within the Parallelizer to the asset\",\"minExposure\":\"minimum exposure within the Parallelizer to the asset\",\"overrideExposures\":\"whether limit exposures should be overriden or read onchain through the Parallelizer\",\"targetExposure\":\"target exposure to the yieldBearingAsset asset used\",\"yieldBearingAsset\":\"address of the yieldBearingAsset\"}},\"toggleTrusted(address)\":{\"params\":{\"trusted\":\"address to toggle the trusted status\"}},\"updateLimitExposuresYieldAsset(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"}}},\"title\":\"GenericHarvester\",\"version\":1},\"userdoc\":{\"events\":{\"SwapRouterUpdated(address)\":{\"notice\":\"Event emitted when the swap router is updated\"},\"TokenTransferAddressUpdated(address)\":{\"notice\":\"Event emitted when the token proxy is updated\"}},\"kind\":\"user\",\"methods\":{\"addBudget(uint256,address)\":{\"notice\":\"Add budget to be spent by the receiver during the flashloan\"},\"budget(address)\":{\"notice\":\"Budget of tokenP available for each users\"},\"computeRebalanceAmount(address)\":{\"notice\":\"Compute the amount needed to rebalance the Parallelizer\"},\"flashloan()\":{\"notice\":\"Parallel stablecoin flashloan contract\"},\"harvest(address,uint256,bytes)\":{\"notice\":\"Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset\"},\"isTrusted(address)\":{\"notice\":\"trusted addresses that can update target exposure and do others non critical operations\"},\"maxTokenSlippage(address)\":{\"notice\":\"Max slippage when dealing with the Parallelizer\"},\"parallelizer()\":{\"notice\":\"Reference to the `parallelizer` implementation this contract aims at rebalancing\"},\"recoverERC20(address,uint256,address)\":{\"notice\":\"Recover ERC20 tokens\"},\"removeBudget(uint256,address)\":{\"notice\":\"Remove budget from the owner and send it to the receiver\"},\"setMaxSlippage(address,uint96)\":{\"notice\":\"Set the max allowed slippage\"},\"setSwapRouter(address)\":{\"notice\":\"Set the swap router\"},\"setTargetExposure(address,uint64)\":{\"notice\":\"Set the target exposure of a yield bearing asset\"},\"setTokenTransferAddress(address)\":{\"notice\":\"Set the token transfer address\"},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"notice\":\"Set the yieldBearingAsset data\"},\"swapRouter()\":{\"notice\":\"address of the router/aggregator\"},\"toggleTrusted(address)\":{\"notice\":\"Toggle the trusted status of an address\"},\"tokenP()\":{\"notice\":\"TokenP handled by the `parallelizer` of interest\"},\"tokenTransferAddress()\":{\"notice\":\"address to approve to transfer tokens to\"},\"updateLimitExposuresYieldAsset(address)\":{\"notice\":\"Set the limit exposures to the asset linked to the yield bearing asset\"},\"yieldBearingData(address)\":{\"notice\":\"Data associated to a yield bearing asset\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project/contracts/helpers/GenericHarvester.sol\":\"GenericHarvester\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000},\"remappings\":[\"npm/@openzeppelin/contracts-upgradeable@5.4.0/:@openzeppelin/contracts/=npm/@openzeppelin/contracts@5.4.0/\",\"project/:@helpers/=project/libs/helpers/\",\"project/:@openzeppelin/contracts-upgradeable/=npm/@openzeppelin/contracts-upgradeable@5.4.0/\",\"project/:@openzeppelin/contracts/=npm/@openzeppelin/contracts@5.4.0/\",\"project/:contracts/=project/contracts/\"],\"viaIR\":true},\"sources\":{\"npm/@openzeppelin/contracts@5.4.0/access/manager/AuthorityUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.3.0) (access/manager/AuthorityUtils.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\nlibrary AuthorityUtils {\\n /**\\n * @dev Since `AccessManager` implements an extended IAuthority interface, invoking `canCall` with backwards compatibility\\n * for the preexisting `IAuthority` interface requires special care to avoid reverting on insufficient return data.\\n * This helper function takes care of invoking `canCall` in a backwards compatible way without reverting.\\n */\\n function canCallWithDelay(\\n address authority,\\n address caller,\\n address target,\\n bytes4 selector\\n ) internal view returns (bool immediate, uint32 delay) {\\n bytes memory data = abi.encodeCall(IAuthority.canCall, (caller, target, selector));\\n\\n assembly (\\\"memory-safe\\\") {\\n mstore(0x00, 0x00)\\n mstore(0x20, 0x00)\\n\\n if staticcall(gas(), authority, add(data, 0x20), mload(data), 0x00, 0x40) {\\n immediate := mload(0x00)\\n delay := mload(0x20)\\n\\n // If delay does not fit in a uint32, return 0 (no delay)\\n // equivalent to: if gt(delay, 0xFFFFFFFF) { delay := 0 }\\n delay := mul(delay, iszero(shr(32, delay)))\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x05fd06ae5bca9dc7470fb2dfae764315c81a84f591e86be6fec0c115474edc6c\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/access/manager/IAccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.4.0) (access/manager/IAccessManaged.sol)\\n\\npragma solidity >=0.8.4;\\n\\ninterface IAccessManaged {\\n /**\\n * @dev Authority that manages this contract was updated.\\n */\\n event AuthorityUpdated(address authority);\\n\\n error AccessManagedUnauthorized(address caller);\\n error AccessManagedRequiredDelay(address caller, uint32 delay);\\n error AccessManagedInvalidAuthority(address authority);\\n\\n /**\\n * @dev Returns the current authority.\\n */\\n function authority() external view returns (address);\\n\\n /**\\n * @dev Transfers control to a new authority. The caller must be the current authority.\\n */\\n function setAuthority(address) external;\\n\\n /**\\n * @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n * being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n * attacker controlled calls.\\n */\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0x1121e070554cffc6d536f658332a1a3d65fb2ea5573cd774f4ecbd02a2fcf4b7\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/access/manager/IAccessManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.4.0) (access/manager/IAccessManager.sol)\\n\\npragma solidity >=0.8.4;\\n\\ninterface IAccessManager {\\n /**\\n * @dev A delayed operation was scheduled.\\n */\\n event OperationScheduled(\\n bytes32 indexed operationId,\\n uint32 indexed nonce,\\n uint48 schedule,\\n address caller,\\n address target,\\n bytes data\\n );\\n\\n /**\\n * @dev A scheduled operation was executed.\\n */\\n event OperationExecuted(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev A scheduled operation was canceled.\\n */\\n event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev Informational labelling for a roleId.\\n */\\n event RoleLabel(uint64 indexed roleId, string label);\\n\\n /**\\n * @dev Emitted when `account` is granted `roleId`.\\n *\\n * NOTE: The meaning of the `since` argument depends on the `newMember` argument.\\n * If the role is granted to a new member, the `since` argument indicates when the account becomes a member of the role,\\n * otherwise it indicates the execution delay for this account and roleId is updated.\\n */\\n event RoleGranted(uint64 indexed roleId, address indexed account, uint32 delay, uint48 since, bool newMember);\\n\\n /**\\n * @dev Emitted when `account` membership or `roleId` is revoked. Unlike granting, revoking is instantaneous.\\n */\\n event RoleRevoked(uint64 indexed roleId, address indexed account);\\n\\n /**\\n * @dev Role acting as admin over a given `roleId` is updated.\\n */\\n event RoleAdminChanged(uint64 indexed roleId, uint64 indexed admin);\\n\\n /**\\n * @dev Role acting as guardian over a given `roleId` is updated.\\n */\\n event RoleGuardianChanged(uint64 indexed roleId, uint64 indexed guardian);\\n\\n /**\\n * @dev Grant delay for a given `roleId` will be updated to `delay` when `since` is reached.\\n */\\n event RoleGrantDelayChanged(uint64 indexed roleId, uint32 delay, uint48 since);\\n\\n /**\\n * @dev Target mode is updated (true = closed, false = open).\\n */\\n event TargetClosed(address indexed target, bool closed);\\n\\n /**\\n * @dev Role required to invoke `selector` on `target` is updated to `roleId`.\\n */\\n event TargetFunctionRoleUpdated(address indexed target, bytes4 selector, uint64 indexed roleId);\\n\\n /**\\n * @dev Admin delay for a given `target` will be updated to `delay` when `since` is reached.\\n */\\n event TargetAdminDelayUpdated(address indexed target, uint32 delay, uint48 since);\\n\\n error AccessManagerAlreadyScheduled(bytes32 operationId);\\n error AccessManagerNotScheduled(bytes32 operationId);\\n error AccessManagerNotReady(bytes32 operationId);\\n error AccessManagerExpired(bytes32 operationId);\\n error AccessManagerLockedRole(uint64 roleId);\\n error AccessManagerBadConfirmation();\\n error AccessManagerUnauthorizedAccount(address msgsender, uint64 roleId);\\n error AccessManagerUnauthorizedCall(address caller, address target, bytes4 selector);\\n error AccessManagerUnauthorizedConsume(address target);\\n error AccessManagerUnauthorizedCancel(address msgsender, address caller, address target, bytes4 selector);\\n error AccessManagerInvalidInitialAdmin(address initialAdmin);\\n\\n /**\\n * @dev Check if an address (`caller`) is authorised to call a given function on a given contract directly (with\\n * no restriction). Additionally, it returns the delay needed to perform the call indirectly through the {schedule}\\n * & {execute} workflow.\\n *\\n * This function is usually called by the targeted contract to control immediate execution of restricted functions.\\n * Therefore we only return true if the call can be performed without any delay. If the call is subject to a\\n * previously set delay (not zero), then the function should return false and the caller should schedule the operation\\n * for future execution.\\n *\\n * If `allowed` is true, the delay can be disregarded and the operation can be immediately executed, otherwise\\n * the operation can be executed if and only if delay is greater than 0.\\n *\\n * NOTE: The IAuthority interface does not include the `uint32` delay. This is an extension of that interface that\\n * is backward compatible. Some contracts may thus ignore the second return argument. In that case they will fail\\n * to identify the indirect workflow, and will consider calls that require a delay to be forbidden.\\n *\\n * NOTE: This function does not report the permissions of the admin functions in the manager itself. These are defined by the\\n * {AccessManager} documentation.\\n */\\n function canCall(\\n address caller,\\n address target,\\n bytes4 selector\\n ) external view returns (bool allowed, uint32 delay);\\n\\n /**\\n * @dev Expiration delay for scheduled proposals. Defaults to 1 week.\\n *\\n * IMPORTANT: Avoid overriding the expiration with 0. Otherwise every contract proposal will be expired immediately,\\n * disabling any scheduling usage.\\n */\\n function expiration() external view returns (uint32);\\n\\n /**\\n * @dev Minimum setback for all delay updates, with the exception of execution delays. It\\n * can be increased without setback (and reset via {revokeRole} in the case event of an\\n * accidental increase). Defaults to 5 days.\\n */\\n function minSetback() external view returns (uint32);\\n\\n /**\\n * @dev Get whether the contract is closed disabling any access. Otherwise role permissions are applied.\\n *\\n * NOTE: When the manager itself is closed, admin functions are still accessible to avoid locking the contract.\\n */\\n function isTargetClosed(address target) external view returns (bool);\\n\\n /**\\n * @dev Get the role required to call a function.\\n */\\n function getTargetFunctionRole(address target, bytes4 selector) external view returns (uint64);\\n\\n /**\\n * @dev Get the admin delay for a target contract. Changes to contract configuration are subject to this delay.\\n */\\n function getTargetAdminDelay(address target) external view returns (uint32);\\n\\n /**\\n * @dev Get the id of the role that acts as an admin for the given role.\\n *\\n * The admin permission is required to grant the role, revoke the role and update the execution delay to execute\\n * an operation that is restricted to this role.\\n */\\n function getRoleAdmin(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role that acts as a guardian for a given role.\\n *\\n * The guardian permission allows canceling operations that have been scheduled under the role.\\n */\\n function getRoleGuardian(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role current grant delay.\\n *\\n * Its value may change at any point without an event emitted following a call to {setGrantDelay}.\\n * Changes to this value, including effect timepoint are notified in advance by the {RoleGrantDelayChanged} event.\\n */\\n function getRoleGrantDelay(uint64 roleId) external view returns (uint32);\\n\\n /**\\n * @dev Get the access details for a given account for a given role. These details include the timepoint at which\\n * membership becomes active, and the delay applied to all operation by this user that requires this permission\\n * level.\\n *\\n * Returns:\\n * [0] Timestamp at which the account membership becomes valid. 0 means role is not granted.\\n * [1] Current execution delay for the account.\\n * [2] Pending execution delay for the account.\\n * [3] Timestamp at which the pending execution delay will become active. 0 means no delay update is scheduled.\\n */\\n function getAccess(\\n uint64 roleId,\\n address account\\n ) external view returns (uint48 since, uint32 currentDelay, uint32 pendingDelay, uint48 effect);\\n\\n /**\\n * @dev Check if a given account currently has the permission level corresponding to a given role. Note that this\\n * permission might be associated with an execution delay. {getAccess} can provide more details.\\n */\\n function hasRole(uint64 roleId, address account) external view returns (bool isMember, uint32 executionDelay);\\n\\n /**\\n * @dev Give a label to a role, for improved role discoverability by UIs.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleLabel} event.\\n */\\n function labelRole(uint64 roleId, string calldata label) external;\\n\\n /**\\n * @dev Add `account` to `roleId`, or change its execution delay.\\n *\\n * This gives the account the authorization to call any function that is restricted to this role. An optional\\n * execution delay (in seconds) can be set. If that delay is non 0, the user is required to schedule any operation\\n * that is restricted to members of this role. The user will only be able to execute the operation after the delay has\\n * passed, before it has expired. During this period, admin and guardians can cancel the operation (see {cancel}).\\n *\\n * If the account has already been granted this role, the execution delay will be updated. This update is not\\n * immediate and follows the delay rules. For example, if a user currently has a delay of 3 hours, and this is\\n * called to reduce that delay to 1 hour, the new delay will take some time to take effect, enforcing that any\\n * operation executed in the 3 hours that follows this update was indeed scheduled before this update.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - granted role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleGranted} event.\\n */\\n function grantRole(uint64 roleId, address account, uint32 executionDelay) external;\\n\\n /**\\n * @dev Remove an account from a role, with immediate effect. If the account does not have the role, this call has\\n * no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - revoked role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function revokeRole(uint64 roleId, address account) external;\\n\\n /**\\n * @dev Renounce role permissions for the calling account with immediate effect. If the sender is not in\\n * the role this call has no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be `callerConfirmation`.\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function renounceRole(uint64 roleId, address callerConfirmation) external;\\n\\n /**\\n * @dev Change admin role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleAdminChanged} event\\n */\\n function setRoleAdmin(uint64 roleId, uint64 admin) external;\\n\\n /**\\n * @dev Change guardian role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGuardianChanged} event\\n */\\n function setRoleGuardian(uint64 roleId, uint64 guardian) external;\\n\\n /**\\n * @dev Update the delay for granting a `roleId`.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGrantDelayChanged} event.\\n */\\n function setGrantDelay(uint64 roleId, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the role required to call functions identified by the `selectors` in the `target` contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetFunctionRoleUpdated} event per selector.\\n */\\n function setTargetFunctionRole(address target, bytes4[] calldata selectors, uint64 roleId) external;\\n\\n /**\\n * @dev Set the delay for changing the configuration of a given target contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetAdminDelayUpdated} event.\\n */\\n function setTargetAdminDelay(address target, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the closed flag for a contract.\\n *\\n * Closing the manager itself won't disable access to admin methods to avoid locking the contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetClosed} event.\\n */\\n function setTargetClosed(address target, bool closed) external;\\n\\n /**\\n * @dev Return the timepoint at which a scheduled operation will be ready for execution. This returns 0 if the\\n * operation is not yet scheduled, has expired, was executed, or was canceled.\\n */\\n function getSchedule(bytes32 id) external view returns (uint48);\\n\\n /**\\n * @dev Return the nonce for the latest scheduled operation with a given id. Returns 0 if the operation has never\\n * been scheduled.\\n */\\n function getNonce(bytes32 id) external view returns (uint32);\\n\\n /**\\n * @dev Schedule a delayed operation for future execution, and return the operation identifier. It is possible to\\n * choose the timestamp at which the operation becomes executable as long as it satisfies the execution delays\\n * required for the caller. The special value zero will automatically set the earliest possible time.\\n *\\n * Returns the `operationId` that was scheduled. Since this value is a hash of the parameters, it can reoccur when\\n * the same parameters are used; if this is relevant, the returned `nonce` can be used to uniquely identify this\\n * scheduled operation from other occurrences of the same `operationId` in invocations of {execute} and {cancel}.\\n *\\n * Emits a {OperationScheduled} event.\\n *\\n * NOTE: It is not possible to concurrently schedule more than one operation with the same `target` and `data`. If\\n * this is necessary, a random byte can be appended to `data` to act as a salt that will be ignored by the target\\n * contract if it is using standard Solidity ABI encoding.\\n */\\n function schedule(\\n address target,\\n bytes calldata data,\\n uint48 when\\n ) external returns (bytes32 operationId, uint32 nonce);\\n\\n /**\\n * @dev Execute a function that is delay restricted, provided it was properly scheduled beforehand, or the\\n * execution delay is 0.\\n *\\n * Returns the nonce that identifies the previously scheduled operation that is executed, or 0 if the\\n * operation wasn't previously scheduled (if the caller doesn't have an execution delay).\\n *\\n * Emits an {OperationExecuted} event only if the call was scheduled and delayed.\\n */\\n function execute(address target, bytes calldata data) external payable returns (uint32);\\n\\n /**\\n * @dev Cancel a scheduled (delayed) operation. Returns the nonce that identifies the previously scheduled\\n * operation that is cancelled.\\n *\\n * Requirements:\\n *\\n * - the caller must be the proposer, a guardian of the targeted function, or a global admin\\n *\\n * Emits a {OperationCanceled} event.\\n */\\n function cancel(address caller, address target, bytes calldata data) external returns (uint32);\\n\\n /**\\n * @dev Consume a scheduled operation targeting the caller. If such an operation exists, mark it as consumed\\n * (emit an {OperationExecuted} event and clean the state). Otherwise, throw an error.\\n *\\n * This is useful for contract that want to enforce that calls targeting them were scheduled on the manager,\\n * with all the verifications that it implies.\\n *\\n * Emit a {OperationExecuted} event.\\n */\\n function consumeScheduledOp(address caller, bytes calldata data) external;\\n\\n /**\\n * @dev Hashing function for delayed operations.\\n */\\n function hashOperation(address caller, address target, bytes calldata data) external view returns (bytes32);\\n\\n /**\\n * @dev Changes the authority of a target managed by this manager instance.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n */\\n function updateAuthority(address target, address newAuthority) external;\\n}\\n\",\"keccak256\":\"0x640fe2b6e5201c47322d458f81078d6dcf23ccf9954f8995b1b7bfbec0eb1421\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/access/manager/IAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.4.0) (access/manager/IAuthority.sol)\\n\\npragma solidity >=0.4.16;\\n\\n/**\\n * @dev Standard interface for permissioning originally defined in Dappsys.\\n */\\ninterface IAuthority {\\n /**\\n * @dev Returns true if the caller can invoke on a target the function identified by a function selector.\\n */\\n function canCall(address caller, address target, bytes4 selector) external view returns (bool allowed);\\n}\\n\",\"keccak256\":\"0x9c9a58dd831b9bb4a0ea47d96b53c13ab9a6e4270a518ea395b1424092fd74dc\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/interfaces/IERC1363.sol\":{\"content\":\"// 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\",\"keccak256\":\"0xd5ea07362ab630a6a3dee4285a74cf2377044ca2e4be472755ad64d7c5d4b69d\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/interfaces/IERC165.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x0afcb7e740d1537b252cb2676f600465ce6938398569f09ba1b9ca240dde2dfc\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/interfaces/IERC20.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x1a6221315ce0307746c2c4827c125d821ee796c74a676787762f4778671d4f44\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/interfaces/IERC3156FlashBorrower.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC3156FlashBorrower.sol)\\n\\npragma solidity >=0.5.0;\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashBorrower, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashBorrower {\\n /**\\n * @dev Receive a flash loan.\\n * @param initiator The initiator of the loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param fee The additional amount of tokens to repay.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n * @return The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\\n */\\n function onFlashLoan(\\n address initiator,\\n address token,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n ) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0x4e4b982b56b50290dd1dcaa2fef1178b1574dfc7c0f0a8ef9cb68a207d72582e\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/interfaces/IERC3156FlashLender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC3156FlashLender.sol)\\n\\npragma solidity >=0.5.0;\\n\\nimport {IERC3156FlashBorrower} from \\\"./IERC3156FlashBorrower.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashLender, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashLender {\\n /**\\n * @dev The amount of currency available to be lended.\\n * @param token The loan currency.\\n * @return The amount of `token` that can be borrowed.\\n */\\n function maxFlashLoan(address token) external view returns (uint256);\\n\\n /**\\n * @dev The fee to be charged for a given loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @return The amount of `token` to be charged for the loan, on top of the returned principal.\\n */\\n function flashFee(address token, uint256 amount) external view returns (uint256);\\n\\n /**\\n * @dev Initiate a flash loan.\\n * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n */\\n function flashLoan(\\n IERC3156FlashBorrower receiver,\\n address token,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x218d708e7d8df417db24a497727eefb7772e61c7cde3886fc42bbcb6aafa6947\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/token/ERC20/IERC20.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x74ed01eb66b923d0d0cfe3be84604ac04b76482a55f9dd655e1ef4d367f95bc2\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// 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\",\"keccak256\":\"0xd6fa4088198f04eef10c5bce8a2f4d60554b7ec4b987f684393c01bf79b94d9f\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x982c5cb790ab941d1e04f807120a71709d4c313ba0bfc16006447ffbd27fbbd5\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/utils/introspection/IERC165.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x8891738ffe910f0cf2da09566928589bf5d63f4524dd734fd9cedbac3274dd5c\",\"license\":\"MIT\"},\"npm/@openzeppelin/contracts@5.4.0/utils/math/SafeCast.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x195533c86d0ef72bcc06456a4f66a9b941f38eb403739b00f21fd7c1abd1ae54\",\"license\":\"MIT\"},\"project/contracts/helpers/BaseHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { AccessManaged } from \\\"../utils/AccessManaged.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport \\\"contracts/interfaces/IHarvester.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nstruct YieldBearingParams {\\n // Address of the asset used to mint the yield bearing asset\\n address asset;\\n // Target exposure to the collateral yield bearing asset used\\n uint64 targetExposure;\\n // Maximum exposure within the Parallelizer to the deposit asset\\n uint64 maxExposure;\\n // Minimum exposure within the Parallelizer to the deposit asset\\n uint64 minExposure;\\n // Whether limit exposures should be overriden or read onchain through the Parallelizer\\n // This value should be 1 to override exposures or 2 if these shouldn't be overriden\\n uint64 overrideExposures;\\n // Maximum slippage when dealing with the Parallelizer\\n uint96 maxSlippage;\\n}\\n\\n/// @title BaseHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Abstract contract for a harvester that aims at rebalancing a Parallelizer\\n/// @dev This contract is an authorized fork of Angle's BaseHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/BaseHarvester.sol\\nabstract contract BaseHarvester is IHarvester, AccessManaged {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrusted() {\\n if (!isTrusted[msg.sender]) revert NotTrusted();\\n _;\\n }\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted or guardian to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrustedOrRestricted() {\\n if (!isTrusted[msg.sender] && !_checkCanCall(_msgSender(), _msgData())) {\\n revert NotTrustedOrGuardian();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VARIABLES\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Reference to the `parallelizer` implementation this contract aims at rebalancing\\n IParallelizer public immutable parallelizer;\\n /// @notice TokenP handled by the `parallelizer` of interest\\n ITokenP public immutable tokenP;\\n /// @notice Max slippage when dealing with the Parallelizer\\n mapping(address => uint96) public maxTokenSlippage;\\n /// @notice Data associated to a yield bearing asset\\n mapping(address => YieldBearingParams) public yieldBearingData;\\n /// @notice trusted addresses that can update target exposure and do others non critical operations\\n mapping(address => bool) public isTrusted;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EVENTS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n event Recovered(address token, uint256 amount, address to);\\n event TrustedToggled(address trusted, bool status);\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialAuthority,\\n ITokenP definitiveTokenP,\\n IParallelizer definitiveParallelizer\\n )\\n AccessManaged(initialAuthority)\\n {\\n tokenP = definitiveTokenP;\\n parallelizer = definitiveParallelizer;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n GUARDIAN FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the yieldBearingAsset data\\n * @param yieldBearingAsset address of the yieldBearingAsset\\n * @param asset address of the asset\\n * @param targetExposure target exposure to the yieldBearingAsset asset used\\n * @param minExposure minimum exposure within the Parallelizer to the asset\\n * @param maxExposure maximum exposure within the Parallelizer to the asset\\n * @param overrideExposures whether limit exposures should be overriden or read onchain through the Parallelizer\\n */\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external\\n restricted\\n {\\n _setYieldBearingAssetData(\\n yieldBearingAsset, asset, targetExposure, minExposure, maxExposure, overrideExposures, maxSlippage\\n );\\n }\\n\\n /**\\n * @notice Set the limit exposures to the asset linked to the yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n */\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) public virtual {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n if (yieldBearingInfo.overrideExposures == 2) {\\n _updateLimitExposuresYieldAsset(yieldBearingInfo.asset, yieldBearingInfo);\\n }\\n }\\n\\n /**\\n * @notice Set the max allowed slippage\\n * @param newMaxSlippage new max allowed slippage\\n */\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external restricted {\\n _setMaxSlippage(yieldBearingAsset, newMaxSlippage);\\n }\\n\\n /**\\n * @notice Toggle the trusted status of an address\\n * @param trusted address to toggle the trusted status\\n */\\n function toggleTrusted(address trusted) external restricted {\\n emit TrustedToggled(trusted, isTrusted[trusted]);\\n isTrusted[trusted] = !isTrusted[trusted];\\n }\\n\\n /**\\n * @notice Recover ERC20 tokens\\n * @param tokenAddress address of the token to recover\\n * @param amountToRecover amount to recover\\n * @param to address to send the recovered tokens\\n */\\n function recoverERC20(address tokenAddress, uint256 amountToRecover, address to) external restricted {\\n emit Recovered(tokenAddress, amountToRecover, to);\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n TRUSTED FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the target exposure of a yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @param targetExposure target exposure to the yield bearing asset used\\n */\\n function setTargetExposure(address yieldBearingAsset, uint64 targetExposure) external onlyTrustedOrRestricted {\\n yieldBearingData[yieldBearingAsset].targetExposure = targetExposure;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Compute the amount needed to rebalance the Parallelizer\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @return increase whether the exposure should be increased\\n * @return amount amount to be rebalanced\\n */\\n function computeRebalanceAmount(address yieldBearingAsset) external view returns (uint8 increase, uint256 amount) {\\n return _computeRebalanceAmount(yieldBearingAsset, yieldBearingData[yieldBearingAsset]);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _computeRebalanceAmount(\\n address yieldBearingAsset,\\n YieldBearingParams memory yieldBearingInfo\\n )\\n internal\\n view\\n returns (uint8 increase, uint256 amount)\\n {\\n (uint256 stablecoinsFromYieldBearingAsset, uint256 stablecoinsIssued) =\\n parallelizer.getIssuedByCollateral(yieldBearingAsset);\\n (uint256 stablecoinsFromAsset,) = parallelizer.getIssuedByCollateral(yieldBearingInfo.asset);\\n uint256 targetExposureScaled = yieldBearingInfo.targetExposure * stablecoinsIssued;\\n if (stablecoinsFromYieldBearingAsset * 1e9 > targetExposureScaled) {\\n // Need to decrease exposure to yield bearing asset\\n amount = stablecoinsFromYieldBearingAsset - targetExposureScaled / 1e9;\\n uint256 maxValueScaled = yieldBearingInfo.maxExposure * stablecoinsIssued;\\n // These checks assume that there are no transaction fees on the stablecoin->collateral conversion and so\\n // it's still possible that exposure goes above the max exposure in some rare cases\\n if (stablecoinsFromAsset * 1e9 > maxValueScaled) {\\n amount = 0;\\n } else if ((stablecoinsFromAsset + amount) * 1e9 > maxValueScaled) {\\n amount = maxValueScaled / 1e9 - stablecoinsFromAsset;\\n }\\n } else {\\n // In this case, exposure after the operation might remain slightly below the targetExposure as less\\n // collateral may be obtained by burning stablecoins for the yield asset and unwrapping it\\n increase = 1;\\n amount = targetExposureScaled / 1e9 - stablecoinsFromYieldBearingAsset;\\n uint256 minValueScaled = yieldBearingInfo.minExposure * stablecoinsIssued;\\n if (stablecoinsFromAsset * 1e9 < minValueScaled) {\\n amount = 0;\\n } else if (stablecoinsFromAsset * 1e9 < minValueScaled + amount * 1e9) {\\n amount = stablecoinsFromAsset - minValueScaled / 1e9;\\n }\\n }\\n }\\n\\n function _setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n internal\\n virtual\\n {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n yieldBearingInfo.asset = asset;\\n if (targetExposure >= 1e9) revert InvalidParam();\\n if (maxSlippage >= 1e9) revert InvalidParam();\\n yieldBearingInfo.targetExposure = targetExposure;\\n yieldBearingInfo.overrideExposures = overrideExposures;\\n yieldBearingInfo.maxSlippage = maxSlippage;\\n if (overrideExposures == 1) {\\n if (maxExposure >= 1e9 || minExposure >= maxExposure) revert InvalidParam();\\n yieldBearingInfo.maxExposure = maxExposure;\\n yieldBearingInfo.minExposure = minExposure;\\n } else {\\n yieldBearingInfo.overrideExposures = 2;\\n _updateLimitExposuresYieldAsset(asset, yieldBearingInfo);\\n }\\n }\\n\\n function _updateLimitExposuresYieldAsset(\\n address asset,\\n YieldBearingParams storage yieldBearingInfo\\n )\\n internal\\n virtual\\n {\\n uint64[] memory xFeeMint;\\n (xFeeMint,) = parallelizer.getCollateralMintFees(asset);\\n uint256 length = xFeeMint.length;\\n if (length <= 1) yieldBearingInfo.maxExposure = 1e9;\\n else yieldBearingInfo.maxExposure = xFeeMint[length - 2];\\n\\n uint64[] memory xFeeBurn;\\n (xFeeBurn,) = parallelizer.getCollateralBurnFees(asset);\\n length = xFeeBurn.length;\\n if (length <= 1) yieldBearingInfo.minExposure = 0;\\n else yieldBearingInfo.minExposure = xFeeBurn[length - 2];\\n }\\n\\n function _setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) internal virtual {\\n if (newMaxSlippage > 1e9) revert InvalidParam();\\n maxTokenSlippage[yieldBearingAsset] = newMaxSlippage;\\n }\\n\\n function _scaleAmountBasedOnDecimals(\\n uint256 decimalsTokenIn,\\n uint256 decimalsTokenOut,\\n uint256 amountIn,\\n bool assetIn\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n if (decimalsTokenIn > decimalsTokenOut) {\\n if (assetIn) {\\n amountIn /= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n } else {\\n amountIn *= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n }\\n } else if (decimalsTokenIn < decimalsTokenOut) {\\n if (assetIn) {\\n amountIn *= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n } else {\\n amountIn /= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n }\\n }\\n return amountIn;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HELPER \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _adjustAllowance(address token, address sender, uint256 amountIn) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), sender);\\n if (allowance < amountIn) IERC20(token).safeIncreaseAllowance(sender, type(uint256).max - allowance);\\n }\\n}\\n\",\"keccak256\":\"0x82e2ae57997043160d7529488b34591c710cd74e267213b61009daa96e9eeaaf\",\"license\":\"GPL-3.0\"},\"project/contracts/helpers/GenericHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC20Metadata } from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport { IERC3156FlashBorrower } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\\\";\\nimport { IERC3156FlashLender } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\\\";\\nimport { RouterSwapper } from \\\"@helpers/RouterSwapper.sol\\\";\\n\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport { IERC4626 } from \\\"contracts/interfaces/external/IERC4626.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nimport { BaseHarvester, YieldBearingParams } from \\\"./BaseHarvester.sol\\\";\\n\\nenum SwapType {\\n VAULT,\\n SWAP\\n}\\n\\n/// @title GenericHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Generic contract for anyone to permissionlessly adjust the reserves of Angle Parallelizer\\n/// @dev This contract is an authorized fork of Angle's GenericHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\\ncontract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper {\\n using SafeCast for uint256;\\n using SafeERC20 for IERC20;\\n\\n bytes32 public constant CALLBACK_SUCCESS = keccak256(\\\"ERC3156FlashBorrower.onFlashLoan\\\");\\n\\n /// @notice Parallel stablecoin flashloan contract\\n IERC3156FlashLender public immutable flashloan;\\n /// @notice Budget of tokenP available for each users\\n mapping(address => uint256) public budget;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INITIALIZATION \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialTokenTransferAddress,\\n address initialSwapRouter,\\n ITokenP definitivetokenP,\\n IParallelizer definitiveParallelizer,\\n address initialAuthority,\\n IERC3156FlashLender definitiveFlashloan\\n )\\n RouterSwapper(initialSwapRouter, initialTokenTransferAddress)\\n BaseHarvester(initialAuthority, definitivetokenP, definitiveParallelizer)\\n {\\n if (address(definitiveFlashloan) == address(0)) revert ZeroAddress();\\n flashloan = definitiveFlashloan;\\n\\n IERC20(tokenP).approve(address(definitiveFlashloan), type(uint256).max);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n BUDGET HANDLING\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Add budget to be spent by the receiver during the flashloan\\n * @param amount amount of tokenP to add to the budget\\n * @param receiver address of the receiver\\n */\\n function addBudget(uint256 amount, address receiver) public virtual {\\n budget[receiver] += amount;\\n\\n IERC20(tokenP).safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n /**\\n * @notice Remove budget from the owner and send it to the receiver\\n * @param amount amount of tokenP to remove from the budget\\n * @param receiver address of the receiver\\n */\\n function removeBudget(uint256 amount, address receiver) public virtual {\\n budget[msg.sender] -= amount; // Will revert if not enough funds\\n\\n IERC20(tokenP).safeTransfer(receiver, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HARVEST\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure\\n /// to this yieldBearingAsset\\n /// @dev This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up\\n /// some yieldBearingAsset that can then be used for people looking to burn deposit tokens\\n /// @dev Due to potential transaction fees within the Parallelizer, this function doesn't exactly bring\\n /// `yieldBearingAsset` to the target exposure\\n /// @dev scale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest,\\n /// it is used to lower the amount of the asset to harvest for example to have a lower slippage\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) public virtual {\\n if (scale > 1e9) revert InvalidParam();\\n updateLimitExposuresYieldAsset(yieldBearingAsset);\\n YieldBearingParams memory yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n (uint8 increase, uint256 amount) = _computeRebalanceAmount(yieldBearingAsset, yieldBearingInfo);\\n amount = (amount * scale) / 1e9;\\n if (amount == 0) revert ZeroAmount();\\n (SwapType swapType, bytes memory data) = abi.decode(extraData, (SwapType, bytes));\\n try parallelizer.updateOracle(yieldBearingAsset) { } catch { }\\n _adjustYieldExposure(\\n amount,\\n increase,\\n yieldBearingAsset,\\n yieldBearingInfo.asset,\\n (amount * (1e9 - yieldBearingInfo.maxSlippage)) / 1e9,\\n swapType,\\n data\\n );\\n }\\n\\n /// @inheritdoc IERC3156FlashBorrower\\n function onFlashLoan(\\n address initiator,\\n address,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n )\\n public\\n virtual\\n returns (bytes32)\\n {\\n if (msg.sender != address(flashloan) || initiator != address(this) || fee != 0) revert NotTrusted();\\n address sender;\\n uint256 typeAction;\\n uint256 minAmountOut;\\n SwapType swapType;\\n bytes memory callData;\\n address tokenOut;\\n address tokenIn;\\n {\\n address yieldBearingAsset;\\n address asset;\\n (sender, typeAction, yieldBearingAsset, asset, minAmountOut, swapType, callData) =\\n abi.decode(data, (address, uint256, address, address, uint256, SwapType, bytes));\\n if (typeAction == 1) {\\n // Increase yield exposure action: we bring in the yield bearing asset\\n tokenOut = yieldBearingAsset;\\n tokenIn = asset;\\n } else {\\n // Decrease yield exposure action: we bring in the deposit asset\\n tokenIn = yieldBearingAsset;\\n tokenOut = asset;\\n }\\n }\\n uint256 amountOut =\\n parallelizer.swapExactInput(amount, 0, address(tokenP), tokenIn, address(this), block.timestamp);\\n\\n // Swap to tokenIn\\n amountOut = _swapToTokenOut(typeAction, tokenIn, tokenOut, amountOut, swapType, callData);\\n\\n _adjustAllowance(tokenOut, address(parallelizer), amountOut);\\n uint256 amountStableOut =\\n parallelizer.swapExactInput(amountOut, minAmountOut, tokenOut, address(tokenP), address(this), block.timestamp);\\n if (amount > amountStableOut) {\\n budget[sender] -= amount - amountStableOut; // Will revert if not enough funds\\n }\\n return CALLBACK_SUCCESS;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n SETTERS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the token transfer contract\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress) public override restricted {\\n super.setTokenTransferAddress(newTokenTransferAddress);\\n }\\n\\n /**\\n * @notice Set the swap router\\n * @param newSwapRouter address of the swap router\\n */\\n function setSwapRouter(address newSwapRouter) public override restricted {\\n super.setSwapRouter(newSwapRouter);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNALS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Burns `amountStablecoins` for one yieldBearing asset, swap for asset then mints deposit tokens\\n /// from the proceeds of the swap.\\n /// @dev If `increase` is 1, then the system tries to increase its exposure to the yield bearing asset which means\\n /// burning tokenP for the deposit asset, swapping for the yield bearing asset, then minting the tokenP\\n /// @dev This function reverts if the second tokenP mint gives less than `minAmountOut` of ag tokens\\n /// @dev This function reverts if the swap slippage is higher than `maxSlippage`\\n function _adjustYieldExposure(\\n uint256 amountStablecoins,\\n uint8 increase,\\n address yieldBearingAsset,\\n address asset,\\n uint256 minAmountOut,\\n SwapType swapType,\\n bytes memory extraData\\n )\\n internal\\n {\\n flashloan.flashLoan(\\n IERC3156FlashBorrower(address(this)),\\n address(tokenP),\\n amountStablecoins,\\n abi.encode(msg.sender, increase, yieldBearingAsset, asset, minAmountOut, swapType, extraData)\\n );\\n }\\n\\n function _swapToTokenOut(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n SwapType swapType,\\n bytes memory callData\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (swapType == SwapType.SWAP) {\\n amountOut = _swapToTokenOutSwap(tokenIn, tokenOut, amount, callData);\\n } else if (swapType == SwapType.VAULT) {\\n amountOut = _swapToTokenOutVault(typeAction, tokenIn, tokenOut, amount);\\n }\\n }\\n\\n /**\\n * @notice Swap token using the router/aggregator\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n * @param callData bytes to call the router/aggregator\\n */\\n function _swapToTokenOutSwap(\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n bytes memory callData\\n )\\n internal\\n returns (uint256)\\n {\\n uint256 balance = IERC20(tokenOut).balanceOf(address(this));\\n\\n address[] memory tokens = new address[](1);\\n tokens[0] = tokenIn;\\n bytes[] memory callDatas = new bytes[](1);\\n callDatas[0] = callData;\\n uint256[] memory amounts = new uint256[](1);\\n amounts[0] = amount;\\n _swap(tokens, callDatas, amounts);\\n\\n return IERC20(tokenOut).balanceOf(address(this)) - balance;\\n }\\n\\n /**\\n * @dev Deposit or redeem the vault asset\\n * @param typeAction 1 for deposit, 2 for redeem\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n */\\n function _swapToTokenOutVault(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (typeAction == 1) {\\n // Granting allowance with the yieldBearingAsset for the vault asset\\n _adjustAllowance(tokenIn, tokenOut, amount);\\n amountOut = IERC4626(tokenOut).deposit(amount, address(this));\\n } else {\\n amountOut = IERC4626(tokenIn).redeem(amount, address(this), address(this));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x604c4f9c755b2eb704dc15ba59046201c0258134ef2fbe15a529c510c68cb40a\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/IDiamondCut.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IDiamondCut\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondCut.sol by mudgen\\n/// @dev This interface is an authorized fork of Angle's `IDiamondCut` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IDiamondCut.sol\\ninterface IDiamondCut {\\n /// @notice Add/replace/remove any number of functions and optionally execute a function with delegatecall\\n /// @param _diamondCut Contains the facet addresses and function selectors\\n /// @param _init The address of the contract or facet to execute _calldata\\n /// @param _calldata A function call, including function selector and arguments, executed with delegatecall on\\n /// _init\\n function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;\\n}\\n\",\"keccak256\":\"0x08a01f77b740f7da424f0ea27a6a292f9e292058e23d1fe960d2d19a44496c7b\",\"license\":\"MIT\"},\"project/contracts/interfaces/IDiamondEtherscan.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\n/// @title IDiamondEtherscan\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface IDiamondEtherscan {\\n /// @notice Sets a dummy implementation with the same layout at the diamond proxy contract with all its facets\\n function setDummyImplementation(address _implementation) external;\\n\\n /// @notice Address of the dummy implementation used to make the DiamondProxy contract interpretable by Etherscan\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf742b55592d129e02fb755d25f7a97ed976a14c4c744d6ac46726809e8f1e037\",\"license\":\"MIT\"},\"project/contracts/interfaces/IDiamondLoupe.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @notice IDiamondLoupe\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondLoupe.sol by mudgen\\ninterface IDiamondLoupe {\\n /// @notice Gets all facet addresses and their four byte function selectors.\\n /// @return facets_ Facet\\n function facets() external view returns (Facet[] memory facets_);\\n\\n /// @notice Gets all the function selectors supported by a specific facet.\\n /// @param _facet The facet address.\\n /// @return facetFunctionSelectors_\\n function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);\\n\\n /// @notice Get all the facet addresses used by a diamond.\\n /// @return facetAddresses_\\n function facetAddresses() external view returns (address[] memory facetAddresses_);\\n\\n /// @notice Gets the facet that supports the given selector.\\n /// @dev If facet is not found return address(0).\\n /// @param _functionSelector The function selector.\\n /// @return facetAddress_ The facet address.\\n function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);\\n}\\n\",\"keccak256\":\"0xa5580958acabe2c44967e835e77a748eb0b8812f70cd071191201508c9388ca8\",\"license\":\"MIT\"},\"project/contracts/interfaces/IGetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IGetters\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IGetters` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IGetters.sol\\ninterface IGetters {\\n /// @notice Checks whether a given `selector` is actually a valid selector corresponding to a function in one of\\n /// the\\n /// facets of the proxy\\n function isValidSelector(bytes4 selector) external view returns (bool);\\n\\n /// @notice Stablecoin minted by parallelizer\\n function tokenP() external view returns (ITokenP);\\n\\n /// @notice Returns the list of collateral assets supported by the system\\n function getCollateralList() external view returns (address[] memory);\\n\\n /// @notice Returns all the info in storage associated to a `collateral`\\n function getCollateralInfo(address collateral) external view returns (Collateral memory);\\n\\n /// @notice Returns the decimals of a given `collateral`\\n function getCollateralDecimals(address collateral) external view returns (uint8);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to mint\\n /// with `collateral`\\n function getCollateralMintFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to burn\\n /// for `collateral`\\n function getCollateralBurnFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays used to compute the penalty factor depending on the collateral\\n /// ratio when users come to redeem\\n function getRedemptionFees() external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the collateral ratio of Parallelizer in base `10**9` and a rounded version of the total amount\\n /// of stablecoins issued\\n function getCollateralRatio() external view returns (uint64 collatRatio, uint256 stablecoinsIssued);\\n\\n /// @notice Returns the total amount of stablecoins issued through Parallelizer\\n function getTotalIssued() external view returns (uint256 stablecoinsIssued);\\n\\n /// @notice Returns the amount of stablecoins issued from `collateral` and the total amount of stablecoins issued\\n /// through Parallelizer\\n function getIssuedByCollateral(address collateral)\\n external\\n view\\n returns (uint256 stablecoinsFromCollateral, uint256 stablecoinsIssued);\\n\\n /// @notice Returns if a collateral is \\\"managed\\\" and the associated manager configuration\\n function getManagerData(address collateral)\\n external\\n view\\n returns (bool isManaged, IERC20[] memory subCollaterals, bytes memory config);\\n\\n /// @notice Returns the oracle values associated to `collateral`\\n /// @return mint Oracle value to be used for a mint transaction with `collateral`\\n /// @return burn Oracle value that will be used for `collateral` for a burn transaction. This value\\n /// is then used along with oracle values for all other collateral assets to get a global burn value for the oracle\\n /// @return ratio Ratio, in base `10**18` between the oracle value of the `collateral` and its target price.\\n /// This value is 10**18 if the oracle is greater than the collateral price\\n /// @return minRatio Minimum ratio across all collateral assets between a collateral burn price and its target\\n /// price. This value is independent of `collateral` and is used to normalize the burn oracle value for burn\\n /// transactions.\\n /// @return redemption Oracle value that would be used to price `collateral` when computing the collateral ratio\\n /// during a redemption\\n function getOracleValues(address collateral)\\n external\\n view\\n returns (uint256 mint, uint256 burn, uint256 ratio, uint256 minRatio, uint256 redemption);\\n\\n /// @notice Returns the data used to compute oracle values for `collateral`\\n /// @return oracleType Type of oracle (Chainlink, external smart contract, ...)\\n /// @return targetType Type passed to read the value of the target price\\n /// @return oracleData Extra data needed to read the oracle. For Chainlink oracles, this data is supposed to give\\n /// the addresses of the Chainlink feeds to read, the stale periods for each feed, ...\\n /// @return targetData Extra data needed to read the target price of the asset\\n function getOracle(address collateral)\\n external\\n view\\n returns (\\n OracleReadType oracleType,\\n OracleReadType targetType,\\n bytes memory oracleData,\\n bytes memory targetData,\\n bytes memory hyperparameters\\n );\\n\\n /// @notice Returns if the associated functionality is paused or not\\n function isPaused(address collateral, ActionType action) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update normalizers\\n function isTrusted(address sender) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update sell rewards\\n function isTrustedSeller(address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` has a non null entry in the `isWhitelistedForType` storage mapping\\n /// @dev Note that ultimately whitelisting may depend as well on external providers\\n function isWhitelistedForType(WhitelistType whitelistType, address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` can deal with `collateral` during burns and redemptions\\n function isWhitelistedForCollateral(address collateral, address sender) external returns (bool);\\n\\n /// @notice Checks whether only whitelisted address can deal with `collateral` during burns and redemptions\\n function isWhitelistedCollateral(address collateral) external view returns (bool);\\n\\n /// @notice Gets the data needed to deal with whitelists for `collateral`\\n function getCollateralWhitelistData(address collateral) external view returns (bytes memory);\\n\\n /// @notice Returns the stablecoin cap for `collateral`\\n function getStablecoinCap(address collateral) external view returns (uint256);\\n\\n /// @notice Returns the address of the `accessManager` contract\\n function accessManager() external view returns (address);\\n\\n /// @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n /// being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n /// attacker controlled calls.\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaa9eba6ee7770d6146fedbfef07ad10ff09524692319ca0cc32abfa64a2b597b\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/IHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IHarvester` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IHarvester.sol\\ninterface IHarvester {\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address stablecoin,\\n uint64 targetExposure,\\n uint64 minExposureYieldAsset,\\n uint64 maxExposureYieldAsset,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external;\\n\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) external;\\n\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external;\\n\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) external;\\n}\\n\",\"keccak256\":\"0x0d4e8fee737f4f747060a3c5044c8cb2f153faa228ad37a661a659ca62aab055\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/IParallelizer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IDiamondCut } from \\\"./IDiamondCut.sol\\\";\\nimport { IDiamondEtherscan } from \\\"./IDiamondEtherscan.sol\\\";\\nimport { IDiamondLoupe } from \\\"./IDiamondLoupe.sol\\\";\\nimport { IGetters } from \\\"./IGetters.sol\\\";\\nimport { IRedeemer } from \\\"./IRedeemer.sol\\\";\\nimport { IRewardHandler } from \\\"./IRewardHandler.sol\\\";\\nimport { ISettersGovernor, ISettersGuardian } from \\\"./ISetters.sol\\\";\\nimport { ISwapper } from \\\"./ISwapper.sol\\\";\\n\\n/// @title IParallelizer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IParallelizer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IParallelizer.sol\\ninterface IParallelizer is\\n IDiamondCut,\\n IDiamondEtherscan,\\n IDiamondLoupe,\\n IGetters,\\n IRedeemer,\\n IRewardHandler,\\n ISettersGovernor,\\n ISettersGuardian,\\n ISwapper\\n{ }\\n\",\"keccak256\":\"0x8bd964110c6a122bdb6cf58a194a97c894900237ebd7f3b11e2f43c6ee56ae7c\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/IRedeemer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRedeemer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRedeemer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRedeemer.sol\\ninterface IRedeemer {\\n /// @notice Redeems `amount` of stablecoins from the system\\n /// @param receiver Address which should be receiving the output tokens\\n /// @param deadline Timestamp before which the redemption should have occured\\n /// @param minAmountOuts Minimum amount of each token given back in the redemption to obtain\\n /// @return tokens List of tokens returned\\n /// @return amounts Amount given for each token in the `tokens` array\\n function redeem(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Same as the redeem function above with the additional feature to specify a list of `forfeitTokens` for\\n /// which the Parallelizer system will not try to do a transfer to `receiver`.\\n function redeemWithForfeit(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts,\\n address[] memory forfeitTokens\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Simulate the exact output that a redemption of `amount` of stablecoins would give at a given block\\n /// @return tokens List of tokens that would be given\\n /// @return amounts Amount that would be obtained for each token in the `tokens` array\\n function quoteRedemptionCurve(uint256 amount)\\n external\\n view\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Updates the normalizer variable by `amount`\\n function updateNormalizer(uint256 amount, bool increase) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3522ee0380b321c64d02bf2db2acb658d8b314b811dd54b6a718d6708b5fb21\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/IRewardHandler.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRewardHandler\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRewardHandler` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRewardHandler.sol\\ninterface IRewardHandler {\\n /// @notice Sells some external tokens through a odos call\\n /// @param minAmountOut Minimum amount of the outToken to get\\n /// @param payload Payload to pass to odos\\n /// @return amountOut Amount obtained of the outToken\\n function sellRewards(uint256 minAmountOut, bytes memory payload) external returns (uint256 amountOut);\\n}\\n\",\"keccak256\":\"0xff2afcbc8d1c25297324159d3684a323e60b3c9408129aba70d3d6938d093255\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/ISetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISettersGovernor` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISetters.sol\\ninterface ISettersGovernor {\\n /// @notice Recovers `amount` of `token` from the Parallelizer contract\\n function recoverERC20(address collateral, IERC20 token, address to, uint256 amount) external;\\n\\n /// @notice Sets a new access manager address\\n function setAccessManager(address _newAccessManager) external;\\n\\n /// @notice Sets (or unsets) a collateral manager `collateral`\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before setting the new manager\\n function setCollateralManager(\\n address collateral,\\n bool checkExternalManagerBalance,\\n ManagerStorage memory managerData\\n )\\n external;\\n\\n /// @notice Sets the allowance of the contract on `token` for `spender` to `amount`\\n function changeAllowance(IERC20 token, address spender, uint256 amount) external;\\n\\n /// @notice Changes the trusted status for `sender` when for selling rewards or updating the normalizer\\n function toggleTrusted(address sender, TrustedType t) external;\\n\\n /// @notice Changes whether a `collateral` can only be handled during burns and redemptions by whitelisted\\n /// addresses\\n /// and sets the data used to read into the whitelist\\n function setWhitelistStatus(address collateral, uint8 whitelistStatus, bytes memory whitelistData) external;\\n\\n /// @notice Add `collateral` as a supported collateral in the system\\n function addCollateral(address collateral) external;\\n\\n /// @notice Adjusts the amount of stablecoins issued from `collateral` by `amount`\\n function adjustStablecoins(address collateral, uint128 amount, bool increase) external;\\n\\n /// @notice Revokes `collateral` from the system\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before revoking the collateral\\n function revokeCollateral(address collateral, bool checkExternalManagerBalance) external;\\n\\n /// @notice Sets the `oracleConfig` used to read the value of `collateral` for the mint, burn and redemption\\n /// operations\\n function setOracle(address collateral, bytes memory oracleConfig) external;\\n\\n /// @notice Update oracle data for a given `collateral`\\n function updateOracle(address collateral) external;\\n}\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface ISettersGuardian {\\n /// @notice Changes the pause status for mint or burn transactions for `collateral`\\n function togglePause(address collateral, ActionType action) external;\\n\\n /// @notice Sets the mint or burn fees for `collateral`\\n function setFees(address collateral, uint64[] memory xFee, int64[] memory yFee, bool mint) external;\\n\\n /// @notice Sets the parameters for the redemption curve\\n function setRedemptionCurveParams(uint64[] memory xFee, int64[] memory yFee) external;\\n\\n /// @notice Changes the whitelist status for a collateral with `whitelistType` for an address `who`\\n function toggleWhitelist(WhitelistType whitelistType, address who) external;\\n\\n /// @notice Sets the stablecoin cap that can be issued from a `collateral`\\n function setStablecoinCap(address collateral, uint256 stablecoinCap) external;\\n}\\n\",\"keccak256\":\"0xc3fb2012e7c2f97ae93b12276afc4293aaeb97a6fe4d60109acaa94ef6945575\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title ISwapper\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISwapper` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISwapper.sol\\ninterface ISwapper {\\n /// @notice Swaps (that is to say mints or burns) an exact amount of `tokenIn` for an amount of `tokenOut`\\n /// @param amountIn Amount of `tokenIn` to bring\\n /// @param amountOutMin Minimum amount of `tokenOut` to get: if `amountOut` is inferior to this amount, the\\n /// function will revert\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountOut Amount of `tokenOut` obtained through the swap\\n function swapExactInput(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Same as `swapExactInput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactInputWithPermit(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Swaps (that is to say mints or burns) an amount of `tokenIn` for an exact amount of `tokenOut`\\n /// @param amountOut Amount of `tokenOut` to obtain from the swap\\n /// @param amountInMax Maximum amount of `tokenIn` to bring in order to get `amountOut` of `tokenOut`\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountIn Amount of `tokenIn` used to perform the swap\\n function swapExactOutput(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Same as `swapExactOutput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactOutputWithPermit(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Simulates what a call to `swapExactInput` with `amountIn` of `tokenIn` for `tokenOut` would give.\\n /// If called right before and at the same block, the `amountOut` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactInput`\\n function quoteIn(uint256 amountIn, address tokenIn, address tokenOut) external view returns (uint256 amountOut);\\n\\n /// @notice Simulates what a call to `swapExactOutput` for `amountOut` of `tokenOut` with `tokenIn` would give.\\n /// If called right before and at the same block, the `amountIn` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactOutput`\\n function quoteOut(uint256 amountOut, address tokenIn, address tokenOut) external view returns (uint256 amountIn);\\n}\\n\",\"keccak256\":\"0x47e4b2742a51b82b9df72fb681335affe8519f4114fb540cd29d8f48ed182ffd\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/ITokenP.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ITokenP\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @notice Interface for the stablecoins `tokenP` contracts\\n/// @dev This interface is an authorized fork of Angle's `IAgToken` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IAgToken.sol\\ninterface ITokenP is IERC20 {\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MINTER ROLE ONLY FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Lets a whitelisted contract mint tokenPs\\n /// @param account Address to mint to\\n /// @param amount Amount to mint\\n function mint(address account, uint256 amount) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @param sender Address which requested the burn from `burner`\\n /// @dev This method is to be called by a contract with the minter right after being requested\\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\\n /// @dev The method checks the allowance between the `sender` and the `burner`\\n function burnFrom(uint256 amount, address burner, address sender) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @dev This method is to be called by a contract with a minter right on the tokenP after being\\n /// requested to do so by an address willing to burn tokens from its address\\n function burnSelf(uint256 amount, address burner) external;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Amount of decimals of the stablecoin\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x64a1305faa8c5c91767a11af0eae16e4b463aa0bfe10f11b74aae9d96681a5eb\",\"license\":\"GPL-3.0\"},\"project/contracts/interfaces/external/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity >=0.5.0;\\n\\n/// @notice ERC4626 interface\\n/// @author OpenZeppelin\\n/// @dev In this implementation, the interface only contains the functions that the IERC4626 interface adds on top of\\n/// the IERC20 interface\\ninterface IERC4626 {\\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 \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s 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 redeemption 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\",\"keccak256\":\"0xd730d6a6b679201eec89dff3133de651da20b3e72e74f01b734078bfacf952ad\",\"license\":\"GPL-3.0\"},\"project/contracts/parallelizer/Storage.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n ENUMS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nenum FacetCutAction {\\n Add,\\n Replace,\\n Remove\\n}\\n\\nenum ManagerType {\\n EXTERNAL\\n}\\n\\nenum ActionType {\\n Mint,\\n Burn,\\n Redeem\\n}\\n\\nenum TrustedType {\\n Updater,\\n Seller\\n}\\n\\nenum QuoteType {\\n MintExactInput,\\n MintExactOutput,\\n BurnExactInput,\\n BurnExactOutput\\n}\\n\\nenum OracleReadType {\\n CHAINLINK_FEEDS,\\n EXTERNAL,\\n NO_ORACLE,\\n STABLE,\\n WSTETH,\\n CBETH,\\n RETH,\\n SFRXETH,\\n MAX,\\n MORPHO_ORACLE\\n}\\n\\nenum OracleQuoteType {\\n UNIT,\\n TARGET\\n}\\n\\nenum WhitelistType {\\n BACKED\\n}\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n STRUCTS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nstruct Permit2Details {\\n address to; // Address that will receive the funds\\n uint256 nonce; // Nonce of the transaction\\n bytes signature; // Permit signature of the user\\n}\\n\\nstruct FacetCut {\\n address facetAddress; // Facet contract address\\n FacetCutAction action; // Can be add, remove or replace\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct Facet {\\n address facetAddress; // Facet contract address\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct FacetInfo {\\n address facetAddress; // Facet contract address\\n uint16 selectorPosition; // Position in the list of all selectors\\n}\\n\\nstruct DiamondStorage {\\n bytes4[] selectors; // List of all available selectors\\n mapping(bytes4 => FacetInfo) selectorInfo; // Selector to (address, position in list)\\n IAccessManager accessManager; // Contract handling access management\\n}\\n\\nstruct ImplementationStorage {\\n address implementation; // Dummy implementation address for Etherscan usability\\n}\\n\\nstruct ManagerStorage {\\n IERC20[] subCollaterals; // Subtokens handled by the manager or strategies\\n bytes config; // Additional configuration data\\n}\\n\\nstruct Collateral {\\n uint8 isManaged; // If the collateral is managed through external strategies\\n uint8 isMintLive; // If minting from this asset is unpaused\\n uint8 isBurnLive; // If burning to this asset is unpaused\\n uint8 decimals; // IERC20Metadata(collateral).decimals()\\n uint8 onlyWhitelisted; // If only whitelisted addresses can burn or redeem for this token\\n uint216 normalizedStables; // Normalized amount of stablecoins issued from this collateral\\n uint64[] xFeeMint; // Increasing exposures in [0,BASE_9[\\n int64[] yFeeMint; // Mint fees at the exposures specified in `xFeeMint`\\n uint64[] xFeeBurn; // Decreasing exposures in ]0,BASE_9]\\n int64[] yFeeBurn; // Burn fees at the exposures specified in `xFeeBurn`\\n bytes oracleConfig; // Data about the oracle used for the collateral\\n bytes whitelistData; // For whitelisted collateral, data used to verify whitelists\\n ManagerStorage managerData; // For managed collateral, data used to handle the strategies\\n uint256 stablecoinCap; // Cap on the amount of stablecoins that can be issued from this collateral\\n}\\n\\nstruct ParallelizerStorage {\\n ITokenP tokenP; // tokenP handled by the system\\n uint8 isRedemptionLive; // If redemption is unpaused\\n uint8 statusReentrant; // If call is reentrant or not\\n bool consumingSchedule; // If the contract is consuming a scheduled operation\\n uint128 normalizedStables; // Normalized amount of stablecoins issued by the system\\n uint128 normalizer; // To reconcile `normalizedStables` values with the actual amount\\n address[] collateralList; // List of collateral assets supported by the system\\n uint64[] xRedemptionCurve; // Increasing collateral ratios > 0\\n int64[] yRedemptionCurve; // Value of the redemption fees at `xRedemptionCurve`\\n mapping(address => Collateral) collaterals; // Maps a collateral asset to its parameters\\n mapping(address => uint256) isTrusted; // If an address is trusted to update the normalizer value\\n mapping(address => uint256) isSellerTrusted; // If an address is trusted to sell accruing reward tokens or to run\\n // keeper jobs on oracles\\n mapping(WhitelistType => mapping(address => uint256)) isWhitelistedForType;\\n}\\n// Whether an address is whitelisted for a specific whitelist type\\n\",\"keccak256\":\"0x3f4313dd110dbe390038320b2d3cf24dcbe9b75cd9573e7f048f7233c02dd227\",\"license\":\"BUSL-1.1\"},\"project/contracts/utils/AccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { AuthorityUtils } from \\\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { IAccessManaged } from \\\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\\\";\\nimport { Context } from \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title AccessControl\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Fork of OpenZeppelin's `AccessManaged` contract\\n/// updated to make _checkCanCall to return bool\\n/// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/manager/AccessManaged.sol\\ncontract AccessManaged is Context, IAccessManaged {\\n address private _authority;\\n\\n bool private _consumingSchedule;\\n\\n /**\\n * @dev Initializes the contract connected to an initial authority.\\n */\\n constructor(address initialAuthority) {\\n _setAuthority(initialAuthority);\\n }\\n\\n /**\\n * @dev Restricts access to a function as defined by the connected Authority for this contract and the\\n * caller and selector of the function that entered the contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * In general, this modifier should only be used on `external` functions. It is okay to use it on `public`\\n * functions that are used as external entry points and are not called internally. Unless you know what you're\\n * doing, it should never be used on `internal` functions. Failure to follow these rules can have critical security\\n * implications! This is because the permissions are determined by the function that entered the contract, i.e. the\\n * function at the bottom of the call stack, and not the function where the modifier is visible in the source code.\\n * ====\\n *\\n * [WARNING]\\n * ====\\n * Avoid adding this modifier to the\\n * https://docs.soliditylang.org/en/v0.8.20/contracts.html#receive-ether-function[`receive()`]\\n * function or the https://docs.soliditylang.org/en/v0.8.20/contracts.html#fallback-function[`fallback()`]. These\\n * functions are the only execution paths where a function selector cannot be unambiguously determined from the\\n * calldata\\n * since the selector defaults to `0x00000000` in the `receive()` function and similarly in the `fallback()`\\n * function\\n * if no calldata is provided. (See {_checkCanCall}).\\n *\\n * The `receive()` function will always panic whereas the `fallback()` may panic depending on the calldata length.\\n * ====\\n */\\n modifier restricted() {\\n address caller = _msgSender();\\n require(_checkCanCall(caller, _msgData()), AccessManagedUnauthorized(caller));\\n _;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function authority() public view virtual returns (address) {\\n return _authority;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function setAuthority(address newAuthority) public virtual {\\n address caller = _msgSender();\\n if (caller != authority()) {\\n revert AccessManagedUnauthorized(caller);\\n }\\n if (newAuthority.code.length == 0) {\\n revert AccessManagedInvalidAuthority(newAuthority);\\n }\\n _setAuthority(newAuthority);\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function isConsumingScheduledOp() public view returns (bytes4) {\\n return _consumingSchedule ? this.isConsumingScheduledOp.selector : bytes4(0);\\n }\\n\\n /**\\n * @dev Transfers control to a new authority. Internal function with no access restriction. Allows bypassing the\\n * permissions set by the current authority.\\n */\\n function _setAuthority(address newAuthority) internal virtual {\\n _authority = newAuthority;\\n emit AuthorityUpdated(newAuthority);\\n }\\n\\n function _checkCanCall(address caller, bytes calldata data) internal virtual returns (bool) {\\n (bool immediate, uint32 delay) =\\n AuthorityUtils.canCallWithDelay(authority(), caller, address(this), bytes4(data[0:4]));\\n if (!immediate) {\\n if (delay > 0) {\\n _consumingSchedule = true;\\n IAccessManager(authority()).consumeScheduledOp(caller, data);\\n _consumingSchedule = false;\\n } else {\\n return false;\\n }\\n }\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x40dfee0e736695b3005df6c150a2d794ac06f3f4b91745e2959623e770044798\",\"license\":\"BUSL-1.1\"},\"project/contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nerror AccessManagedUnauthorized(address caller);\\nerror AlreadyAdded();\\nerror CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector);\\nerror CannotAddSelectorsToZeroAddress(bytes4[] _selectors);\\nerror CannotRemoveFunctionThatDoesNotExist(bytes4 _selector);\\nerror CannotRemoveImmutableFunction(bytes4 _selector);\\nerror CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors);\\nerror CannotReplaceFunctionThatDoesNotExists(bytes4 _selector);\\nerror CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector);\\nerror CannotReplaceImmutableFunction(bytes4 _selector);\\nerror ContractHasNoCode();\\nerror CollateralBacked();\\nerror FunctionNotFound(bytes4 _functionSelector);\\nerror IncorrectFacetCutAction(uint8 _action);\\nerror InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);\\nerror InvalidChainlinkRate();\\nerror InvalidLengths();\\nerror InvalidNegativeFees();\\nerror InvalidOracleType();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidRate();\\nerror InvalidSwap();\\nerror InvalidTokens();\\nerror InvalidAccessManager();\\nerror ManagerHasAssets();\\nerror NoSelectorsProvidedForFacetForCut(address _facetAddress);\\nerror NotAllowed();\\nerror NotCollateral();\\nerror NotGovernor();\\nerror NotGuardian();\\nerror NotTrusted();\\nerror NotTrustedOrGuardian();\\nerror NotWhitelisted();\\nerror OdosSwapFailed();\\nerror OracleUpdateFailed();\\nerror Paused();\\nerror ReentrantCall();\\nerror RemoveFacetAddressMustBeZeroAddress(address _facetAddress);\\nerror TooBigAmountIn();\\nerror TooLate();\\nerror TooSmallAmountOut();\\nerror ZeroAddress();\\nerror ZeroAmount();\\nerror SwapError();\\nerror SlippageTooHigh();\\nerror InsufficientFunds();\\n\",\"keccak256\":\"0x1e2f6812ef78e948e5155d32213b52afff8c0ba5463d18bee10694efbf886130\",\"license\":\"BUSL-1.1\"},\"project/libs/helpers/RouterSwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20, IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/// @title Swapper\\n/// @author Angle Labs, Inc.\\n/// @dev Abstract contract for swapping tokens using a router/aggregator\\n/// @dev This contract is an authorized fork of Angle's `RouterSwapper` contract\\n/// https://github.com/AngleProtocol/utils/blob/main/src/RouterSwapper.sol\\nabstract contract RouterSwapper {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERRORS\\n //////////////////////////////////////////////////////////////*/\\n\\n error SwapError();\\n error ZeroAddress();\\n\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Event emitted when the swap router is updated\\n */\\n event SwapRouterUpdated(address newSwapRouter);\\n /**\\n * @notice Event emitted when the token proxy is updated\\n */\\n event TokenTransferAddressUpdated(address newTokenTransferAddress);\\n\\n /*//////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////*/\\n\\n modifier noZeroAddress(address targetAddress) {\\n if (targetAddress == address(0)) {\\n revert ZeroAddress();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n MUTABLE VARIABLES\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice address of the router/aggregator\\n */\\n address public swapRouter;\\n /**\\n * @notice address to approve to transfer tokens to\\n */\\n address public tokenTransferAddress;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address initialSwapRouter, address initialTokenTransferAddress) {\\n swapRouter = initialSwapRouter;\\n tokenTransferAddress = initialTokenTransferAddress;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the router/aggregator address\\n * @param newSwapRouter address of the new router/aggregator\\n */\\n function setSwapRouter(address newSwapRouter) public virtual noZeroAddress(newSwapRouter) {\\n swapRouter = newSwapRouter;\\n\\n emit SwapRouterUpdated(newSwapRouter);\\n }\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the new token transfer address\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress)\\n public\\n virtual\\n noZeroAddress(newTokenTransferAddress)\\n {\\n tokenTransferAddress = newTokenTransferAddress;\\n\\n emit TokenTransferAddressUpdated(newTokenTransferAddress);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n SWAP FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Approve the router/aggregator to spend the token if needed\\n * @param token address of the token to approve\\n * @param spender address of the router/aggregator\\n * @param amount amount to approve\\n */\\n function _approveTokenIfNeeded(address token, address spender, uint256 amount) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), spender);\\n if (allowance < amount) {\\n IERC20(token).safeIncreaseAllowance(spender, amount - allowance);\\n }\\n }\\n\\n /**\\n * @notice Perform the swap using the router/aggregator\\n * @param callData bytes to call the router/aggregator\\n */\\n function _performRouterSwap(bytes memory callData) internal {\\n (bool success, bytes memory retData) = swapRouter.call(callData);\\n\\n if (!success) {\\n if (retData.length != 0) {\\n assembly (\\\"memory-safe\\\") {\\n revert(add(32, retData), mload(retData))\\n }\\n }\\n revert SwapError();\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swapCalldata(address[] calldata tokens, bytes[] calldata callDatas, uint256[] calldata amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swap(address[] memory tokens, bytes[] memory callDatas, uint256[] memory amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8c5a6b026a95816806814ef681b6b225ea4c405a39a4eab0111921853202829c\",\"license\":\"GPL-3.0\"}},\"version\":1}", - "storageLayout": { - "storage": [ - { - "astId": 22488, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_authority", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 22490, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_consumingSchedule", - "offset": 20, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 7716, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxTokenSlippage", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_uint96)" - }, - { - "astId": 7722, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "yieldBearingData", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_struct(YieldBearingParams)7657_storage)" - }, - { - "astId": 7727, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "isTrusted", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 23206, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "swapRouter", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 23209, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "tokenTransferAddress", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 8443, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "budget", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_struct(YieldBearingParams)7657_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct YieldBearingParams)", - "numberOfBytes": "32", - "value": "t_struct(YieldBearingParams)7657_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_address,t_uint96)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint96)", - "numberOfBytes": "32", - "value": "t_uint96" - }, - "t_struct(YieldBearingParams)7657_storage": { - "encoding": "inplace", - "label": "struct YieldBearingParams", - "members": [ - { - "astId": 7646, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "asset", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 7648, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "targetExposure", - "offset": 20, - "slot": "0", - "type": "t_uint64" - }, - { - "astId": 7650, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxExposure", - "offset": 0, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 7652, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "minExposure", - "offset": 8, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 7654, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "overrideExposures", - "offset": 16, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 7656, - "contract": "project/contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxSlippage", - "offset": 0, - "slot": "2", - "type": "t_uint96" - } - ], - "numberOfBytes": "96" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint64": { - "encoding": "inplace", - "label": "uint64", - "numberOfBytes": "8" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } - }, - "userdoc": { - "events": { - "SwapRouterUpdated(address)": { - "notice": "Event emitted when the swap router is updated" - }, - "TokenTransferAddressUpdated(address)": { - "notice": "Event emitted when the token proxy is updated" - } - }, - "kind": "user", - "methods": { - "addBudget(uint256,address)": { - "notice": "Add budget to be spent by the receiver during the flashloan" - }, - "budget(address)": { - "notice": "Budget of tokenP available for each users" - }, - "computeRebalanceAmount(address)": { - "notice": "Compute the amount needed to rebalance the Parallelizer" - }, - "flashloan()": { - "notice": "Parallel stablecoin flashloan contract" - }, - "harvest(address,uint256,bytes)": { - "notice": "Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset" - }, - "isTrusted(address)": { - "notice": "trusted addresses that can update target exposure and do others non critical operations" - }, - "maxTokenSlippage(address)": { - "notice": "Max slippage when dealing with the Parallelizer" - }, - "parallelizer()": { - "notice": "Reference to the `parallelizer` implementation this contract aims at rebalancing" - }, - "recoverERC20(address,uint256,address)": { - "notice": "Recover ERC20 tokens" - }, - "removeBudget(uint256,address)": { - "notice": "Remove budget from the owner and send it to the receiver" - }, - "setMaxSlippage(address,uint96)": { - "notice": "Set the max allowed slippage" - }, - "setSwapRouter(address)": { - "notice": "Set the swap router" - }, - "setTargetExposure(address,uint64)": { - "notice": "Set the target exposure of a yield bearing asset" - }, - "setTokenTransferAddress(address)": { - "notice": "Set the token transfer address" - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "notice": "Set the yieldBearingAsset data" - }, - "swapRouter()": { - "notice": "address of the router/aggregator" - }, - "toggleTrusted(address)": { - "notice": "Toggle the trusted status of an address" - }, - "tokenP()": { - "notice": "TokenP handled by the `parallelizer` of interest" - }, - "tokenTransferAddress()": { - "notice": "address to approve to transfer tokens to" - }, - "updateLimitExposuresYieldAsset(address)": { - "notice": "Set the limit exposures to the asset linked to the yield bearing asset" - }, - "yieldBearingData(address)": { - "notice": "Data associated to a yield bearing asset" - } - }, - "version": 1 - }, - "argsData": "0x00000000000000000000000088de50b233052e4fb783d4f6db78cc34fea3e9fc00000000000000000000000088de50b233052e4fb783d4f6db78cc34fea3e9fc0000000000000000000000009ee1963f05553ef838604dd39403be21cef26aa400000000000000000000000041d58951cbd12d4ef49b0437897677bbf5547c80000000000000000000000000fd28f108e95f4d41daae9dbfff707d677985998e0000000000000000000000009e0dcf7a33bbde6689560c5c807dd2a3df991277", - "transaction": { - "hash": "0xf9fdb881ae9b14af38626a6adee579e13a3946b210c7409a354a6d8751eec211", - "nonce": "0x78", - "origin": "0x66ccec236bbce5f1bbd1b2fc0a4014e57a55ad02" - }, - "receipt": { - "blockHash": "0x77da7b9248dabc067ce7019a829d0e178c0d3f299517d26e64d65280050d51a4", - "blockNumber": "0x4104093", - "transactionIndex": "0x7" - } -} \ No newline at end of file diff --git a/deployments/base/GenericHarvester_USDp.json b/deployments/base/GenericHarvester_USDp.json deleted file mode 100644 index 59dcfa2..0000000 --- a/deployments/base/GenericHarvester_USDp.json +++ /dev/null @@ -1,1124 +0,0 @@ -{ - "address": "0xCa43eCFCDFBA1fED003649e946Ae6091646B410a", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "initialTokenTransferAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "initialSwapRouter", - "type": "address" - }, - { - "internalType": "contract ITokenP", - "name": "definitivetokenP", - "type": "address" - }, - { - "internalType": "contract IParallelizer", - "name": "definitiveParallelizer", - "type": "address" - }, - { - "internalType": "address", - "name": "initialAuthority", - "type": "address" - }, - { - "internalType": "contract IERC3156FlashLender", - "name": "definitiveFlashloan", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AccessManagedInvalidAuthority", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "internalType": "uint32", - "name": "delay", - "type": "uint32" - } - ], - "name": "AccessManagedRequiredDelay", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "AccessManagedUnauthorized", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidParam", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrusted", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrustedOrGuardian", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", - "type": "error" - }, - { - "inputs": [], - "name": "SwapError", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAmount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "SwapRouterUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "TokenTransferAddressUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "trusted", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "status", - "type": "bool" - } - ], - "name": "TrustedToggled", - "type": "event" - }, - { - "inputs": [], - "name": "CALLBACK_SUCCESS", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "addBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "authority", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "budget", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "computeRebalanceAmount", - "outputs": [ - { - "internalType": "uint8", - "name": "increase", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "flashloan", - "outputs": [ - { - "internalType": "contract IERC3156FlashLender", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "scale", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "name": "harvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isConsumingScheduledOp", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isTrusted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "initiator", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "onFlashLoan", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "parallelizer", - "outputs": [ - { - "internalType": "contract IParallelizer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToRecover", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "recoverERC20", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "removeBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAuthority", - "type": "address" - } - ], - "name": "setAuthority", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint96", - "name": "newMaxSlippage", - "type": "uint96" - } - ], - "name": "setMaxSlippage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "setSwapRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - } - ], - "name": "setTargetExposure", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "setTokenTransferAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "name": "setYieldBearingAssetData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapRouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "trusted", - "type": "address" - } - ], - "name": "toggleTrusted", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "tokenP", - "outputs": [ - { - "internalType": "contract ITokenP", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenTransferAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "updateLimitExposuresYieldAsset", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "yieldBearingData", - "outputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x9a88645c33c969e68e41437d785b884db2c9e783597a09c2a7fd4f173749fcef", - "receipt": { - "to": null, - "from": "0x66CcEC236bbcE5f1bBd1b2fC0a4014e57A55ad02", - "contractAddress": "0xCa43eCFCDFBA1fED003649e946Ae6091646B410a", - "transactionIndex": 51, - "gasUsed": "2210613", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000040000000000000200000000000000000000010000000000000000000000000200000000000000000000000100400000000000000000000000000000000000000000000100000100000000000000000000000000000000000000000000000000000000000000100000000000000000000000008000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000010000000010000000000000000008000000000004000000000000000000001000000010", - "blockHash": "0x1d4aa3216f7e53cae7dd2878a8a75262c1a2e0cf151a774a5bf9f18fcdfdb9de", - "transactionHash": "0x9a88645c33c969e68e41437d785b884db2c9e783597a09c2a7fd4f173749fcef", - "logs": [ - { - "transactionIndex": 51, - "blockNumber": 31946047, - "transactionHash": "0x9a88645c33c969e68e41437d785b884db2c9e783597a09c2a7fd4f173749fcef", - "address": "0xCa43eCFCDFBA1fED003649e946Ae6091646B410a", - "topics": [ - "0x2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad" - ], - "data": "0x0000000000000000000000000e4e7ca9d7b1e6293d0713efefb4bca010debf46", - "logIndex": 213, - "blockHash": "0x1d4aa3216f7e53cae7dd2878a8a75262c1a2e0cf151a774a5bf9f18fcdfdb9de" - }, - { - "transactionIndex": 51, - "blockNumber": 31946047, - "transactionHash": "0x9a88645c33c969e68e41437d785b884db2c9e783597a09c2a7fd4f173749fcef", - "address": "0x76A9A0062ec6712b99B4f63bD2b4270185759dd5", - "topics": [ - "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", - "0x000000000000000000000000ca43ecfcdfba1fed003649e946ae6091646b410a", - "0x00000000000000000000000008417cdb7f52a5021bb4eb6e0deaf3f295c3f182" - ], - "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "logIndex": 214, - "blockHash": "0x1d4aa3216f7e53cae7dd2878a8a75262c1a2e0cf151a774a5bf9f18fcdfdb9de" - } - ], - "blockNumber": 31946047, - "cumulativeGasUsed": "17679273", - "status": 1, - "byzantium": true - }, - "args": [ - "0x19ceead7105607cd444f5ad10dd51356436095a1", - "0x19ceead7105607cd444f5ad10dd51356436095a1", - "0x76A9A0062ec6712b99B4f63bD2b4270185759dd5", - "0xC3BEF21Ea7dEB5C34CF33E918c8e28972C8048eD", - "0x0e4e7Ca9D7b1e6293D0713EFEfB4BCA010DeBF46", - "0x08417cdb7F52a5021bB4eb6E0deAf3f295c3f182" - ], - "numDeployments": 1, - "solcInputHash": "9e6800737641b3b015331b65b5c620c3", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialTokenTransferAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialSwapRouter\",\"type\":\"address\"},{\"internalType\":\"contract ITokenP\",\"name\":\"definitivetokenP\",\"type\":\"address\"},{\"internalType\":\"contract IParallelizer\",\"name\":\"definitiveParallelizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAuthority\",\"type\":\"address\"},{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"definitiveFlashloan\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AccessManagedInvalidAuthority\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"AccessManagedRequiredDelay\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"AccessManagedUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrustedOrGuardian\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SwapError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"SwapRouterUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"TokenTransferAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CALLBACK_SUCCESS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"addBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"authority\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"budget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"computeRebalanceAmount\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"increase\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flashloan\",\"outputs\":[{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"scale\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"harvest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isConsumingScheduledOp\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isTrusted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxTokenSlippage\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onFlashLoan\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parallelizer\",\"outputs\":[{\"internalType\":\"contract IParallelizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"removeBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAuthority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"newMaxSlippage\",\"type\":\"uint96\"}],\"name\":\"setMaxSlippage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"setSwapRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"}],\"name\":\"setTargetExposure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"setTokenTransferAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"name\":\"setYieldBearingAssetData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenP\",\"outputs\":[{\"internalType\":\"contract ITokenP\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenTransferAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"updateLimitExposuresYieldAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"yieldBearingData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Cooper Labs\",\"custom:contact\":\"security@cooperlabs.xyz\",\"details\":\"Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\",\"errors\":{\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"AuthorityUpdated(address)\":{\"details\":\"Authority that manages this contract was updated.\"}},\"kind\":\"dev\",\"methods\":{\"addBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to add to the budget\",\"receiver\":\"address of the receiver\"}},\"authority()\":{\"details\":\"Returns the current authority.\"},\"computeRebalanceAmount(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"},\"returns\":{\"amount\":\"amount to be rebalanced\",\"increase\":\"whether the exposure should be increased\"}},\"harvest(address,uint256,bytes)\":{\"details\":\"This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage\"},\"isConsumingScheduledOp()\":{\"details\":\"Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls.\"},\"onFlashLoan(address,address,uint256,uint256,bytes)\":{\"details\":\"Receive a flash loan.\",\"params\":{\"amount\":\"The amount of tokens lent.\",\"data\":\"Arbitrary data structure, intended to contain user-defined parameters.\",\"fee\":\"The additional amount of tokens to repay.\",\"initiator\":\"The initiator of the loan.\",\"token\":\"The loan currency.\"},\"returns\":{\"_0\":\"The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\"}},\"recoverERC20(address,uint256,address)\":{\"params\":{\"amountToRecover\":\"amount to recover\",\"to\":\"address to send the recovered tokens\",\"tokenAddress\":\"address of the token to recover\"}},\"removeBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to remove from the budget\",\"receiver\":\"address of the receiver\"}},\"setAuthority(address)\":{\"details\":\"Transfers control to a new authority. The caller must be the current authority.\"},\"setMaxSlippage(address,uint96)\":{\"params\":{\"newMaxSlippage\":\"new max allowed slippage\"}},\"setSwapRouter(address)\":{\"params\":{\"newSwapRouter\":\"address of the swap router\"}},\"setTargetExposure(address,uint64)\":{\"params\":{\"targetExposure\":\"target exposure to the yield bearing asset used\",\"yieldBearingAsset\":\"address of the yield bearing asset\"}},\"setTokenTransferAddress(address)\":{\"params\":{\"newTokenTransferAddress\":\"address of the token transfer contract\"}},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"params\":{\"asset\":\"address of the asset\",\"maxExposure\":\"maximum exposure within the Parallelizer to the asset\",\"minExposure\":\"minimum exposure within the Parallelizer to the asset\",\"overrideExposures\":\"whether limit exposures should be overriden or read onchain through the Parallelizer\",\"targetExposure\":\"target exposure to the yieldBearingAsset asset used\",\"yieldBearingAsset\":\"address of the yieldBearingAsset\"}},\"toggleTrusted(address)\":{\"params\":{\"trusted\":\"address to toggle the trusted status\"}},\"updateLimitExposuresYieldAsset(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"}}},\"title\":\"GenericHarvester\",\"version\":1},\"userdoc\":{\"events\":{\"SwapRouterUpdated(address)\":{\"notice\":\"Event emitted when the swap router is updated\"},\"TokenTransferAddressUpdated(address)\":{\"notice\":\"Event emitted when the token proxy is updated\"}},\"kind\":\"user\",\"methods\":{\"addBudget(uint256,address)\":{\"notice\":\"Add budget to be spent by the receiver during the flashloan\"},\"budget(address)\":{\"notice\":\"Budget of tokenP available for each users\"},\"computeRebalanceAmount(address)\":{\"notice\":\"Compute the amount needed to rebalance the Parallelizer\"},\"flashloan()\":{\"notice\":\"Parallel stablecoin flashloan contract\"},\"harvest(address,uint256,bytes)\":{\"notice\":\"Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset\"},\"isTrusted(address)\":{\"notice\":\"trusted addresses that can update target exposure and do others non critical operations\"},\"maxTokenSlippage(address)\":{\"notice\":\"Max slippage when dealing with the Parallelizer\"},\"parallelizer()\":{\"notice\":\"Reference to the `parallelizer` implementation this contract aims at rebalancing\"},\"recoverERC20(address,uint256,address)\":{\"notice\":\"Recover ERC20 tokens\"},\"removeBudget(uint256,address)\":{\"notice\":\"Remove budget from the owner and send it to the receiver\"},\"setMaxSlippage(address,uint96)\":{\"notice\":\"Set the max allowed slippage\"},\"setSwapRouter(address)\":{\"notice\":\"Set the swap router\"},\"setTargetExposure(address,uint64)\":{\"notice\":\"Set the target exposure of a yield bearing asset\"},\"setTokenTransferAddress(address)\":{\"notice\":\"Set the token transfer address\"},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"notice\":\"Set the yieldBearingAsset data\"},\"swapRouter()\":{\"notice\":\"address of the router/aggregator\"},\"toggleTrusted(address)\":{\"notice\":\"Toggle the trusted status of an address\"},\"tokenP()\":{\"notice\":\"TokenP handled by the `parallelizer` of interest\"},\"tokenTransferAddress()\":{\"notice\":\"address to approve to transfer tokens to\"},\"updateLimitExposuresYieldAsset(address)\":{\"notice\":\"Set the limit exposures to the asset linked to the yield bearing asset\"},\"yieldBearingData(address)\":{\"notice\":\"Data associated to a yield bearing asset\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/helpers/GenericHarvester.sol\":\"GenericHarvester\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@helpers/RouterSwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20, IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/// @title Swapper\\n/// @author Angle Labs, Inc.\\n/// @dev Abstract contract for swapping tokens using a router/aggregator\\n/// @dev This contract is an authorized fork of Angle's `RouterSwapper` contract\\n/// https://github.com/AngleProtocol/utils/blob/main/src/RouterSwapper.sol\\nabstract contract RouterSwapper {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERRORS\\n //////////////////////////////////////////////////////////////*/\\n\\n error SwapError();\\n error ZeroAddress();\\n\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Event emitted when the swap router is updated\\n */\\n event SwapRouterUpdated(address newSwapRouter);\\n /**\\n * @notice Event emitted when the token proxy is updated\\n */\\n event TokenTransferAddressUpdated(address newTokenTransferAddress);\\n\\n /*//////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////*/\\n\\n modifier noZeroAddress(address targetAddress) {\\n if (targetAddress == address(0)) {\\n revert ZeroAddress();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n MUTABLE VARIABLES\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice address of the router/aggregator\\n */\\n address public swapRouter;\\n /**\\n * @notice address to approve to transfer tokens to\\n */\\n address public tokenTransferAddress;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address initialSwapRouter, address initialTokenTransferAddress) {\\n swapRouter = initialSwapRouter;\\n tokenTransferAddress = initialTokenTransferAddress;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the router/aggregator address\\n * @param newSwapRouter address of the new router/aggregator\\n */\\n function setSwapRouter(address newSwapRouter) public virtual noZeroAddress(newSwapRouter) {\\n swapRouter = newSwapRouter;\\n\\n emit SwapRouterUpdated(newSwapRouter);\\n }\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the new token transfer address\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress)\\n public\\n virtual\\n noZeroAddress(newTokenTransferAddress)\\n {\\n tokenTransferAddress = newTokenTransferAddress;\\n\\n emit TokenTransferAddressUpdated(newTokenTransferAddress);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n SWAP FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Approve the router/aggregator to spend the token if needed\\n * @param token address of the token to approve\\n * @param spender address of the router/aggregator\\n * @param amount amount to approve\\n */\\n function _approveTokenIfNeeded(address token, address spender, uint256 amount) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), spender);\\n if (allowance < amount) {\\n IERC20(token).safeIncreaseAllowance(spender, amount - allowance);\\n }\\n }\\n\\n /**\\n * @notice Perform the swap using the router/aggregator\\n * @param callData bytes to call the router/aggregator\\n */\\n function _performRouterSwap(bytes memory callData) internal {\\n (bool success, bytes memory retData) = swapRouter.call(callData);\\n\\n if (!success) {\\n if (retData.length != 0) {\\n assembly (\\\"memory-safe\\\") {\\n revert(add(32, retData), mload(retData))\\n }\\n }\\n revert SwapError();\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swapCalldata(address[] calldata tokens, bytes[] calldata callDatas, uint256[] calldata amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swap(address[] memory tokens, bytes[] memory callDatas, uint256[] memory amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8c5a6b026a95816806814ef681b6b225ea4c405a39a4eab0111921853202829c\",\"license\":\"GPL-3.0\"},\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/AuthorityUtils.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\nlibrary AuthorityUtils {\\n /**\\n * @dev Since `AccessManager` implements an extended IAuthority interface, invoking `canCall` with backwards compatibility\\n * for the preexisting `IAuthority` interface requires special care to avoid reverting on insufficient return data.\\n * This helper function takes care of invoking `canCall` in a backwards compatible way without reverting.\\n */\\n function canCallWithDelay(\\n address authority,\\n address caller,\\n address target,\\n bytes4 selector\\n ) internal view returns (bool immediate, uint32 delay) {\\n (bool success, bytes memory data) = authority.staticcall(\\n abi.encodeCall(IAuthority.canCall, (caller, target, selector))\\n );\\n if (success) {\\n if (data.length >= 0x40) {\\n (immediate, delay) = abi.decode(data, (bool, uint32));\\n } else if (data.length >= 0x20) {\\n immediate = abi.decode(data, (bool));\\n }\\n }\\n return (immediate, delay);\\n }\\n}\\n\",\"keccak256\":\"0xb3875997b0d8705e29aa20fee88e1dfef93df438794ae1ad8ba2eb016a4dd4e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAccessManaged.sol)\\n\\npragma solidity ^0.8.20;\\n\\ninterface IAccessManaged {\\n /**\\n * @dev Authority that manages this contract was updated.\\n */\\n event AuthorityUpdated(address authority);\\n\\n error AccessManagedUnauthorized(address caller);\\n error AccessManagedRequiredDelay(address caller, uint32 delay);\\n error AccessManagedInvalidAuthority(address authority);\\n\\n /**\\n * @dev Returns the current authority.\\n */\\n function authority() external view returns (address);\\n\\n /**\\n * @dev Transfers control to a new authority. The caller must be the current authority.\\n */\\n function setAuthority(address) external;\\n\\n /**\\n * @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n * being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n * attacker controlled calls.\\n */\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaba93d42cd70e1418782951132d97b31ddce5f50ad81090884b6d0e41caac9d6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (access/manager/IAccessManager.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Time} from \\\"../../utils/types/Time.sol\\\";\\n\\ninterface IAccessManager {\\n /**\\n * @dev A delayed operation was scheduled.\\n */\\n event OperationScheduled(\\n bytes32 indexed operationId,\\n uint32 indexed nonce,\\n uint48 schedule,\\n address caller,\\n address target,\\n bytes data\\n );\\n\\n /**\\n * @dev A scheduled operation was executed.\\n */\\n event OperationExecuted(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev A scheduled operation was canceled.\\n */\\n event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev Informational labelling for a roleId.\\n */\\n event RoleLabel(uint64 indexed roleId, string label);\\n\\n /**\\n * @dev Emitted when `account` is granted `roleId`.\\n *\\n * NOTE: The meaning of the `since` argument depends on the `newMember` argument.\\n * If the role is granted to a new member, the `since` argument indicates when the account becomes a member of the role,\\n * otherwise it indicates the execution delay for this account and roleId is updated.\\n */\\n event RoleGranted(uint64 indexed roleId, address indexed account, uint32 delay, uint48 since, bool newMember);\\n\\n /**\\n * @dev Emitted when `account` membership or `roleId` is revoked. Unlike granting, revoking is instantaneous.\\n */\\n event RoleRevoked(uint64 indexed roleId, address indexed account);\\n\\n /**\\n * @dev Role acting as admin over a given `roleId` is updated.\\n */\\n event RoleAdminChanged(uint64 indexed roleId, uint64 indexed admin);\\n\\n /**\\n * @dev Role acting as guardian over a given `roleId` is updated.\\n */\\n event RoleGuardianChanged(uint64 indexed roleId, uint64 indexed guardian);\\n\\n /**\\n * @dev Grant delay for a given `roleId` will be updated to `delay` when `since` is reached.\\n */\\n event RoleGrantDelayChanged(uint64 indexed roleId, uint32 delay, uint48 since);\\n\\n /**\\n * @dev Target mode is updated (true = closed, false = open).\\n */\\n event TargetClosed(address indexed target, bool closed);\\n\\n /**\\n * @dev Role required to invoke `selector` on `target` is updated to `roleId`.\\n */\\n event TargetFunctionRoleUpdated(address indexed target, bytes4 selector, uint64 indexed roleId);\\n\\n /**\\n * @dev Admin delay for a given `target` will be updated to `delay` when `since` is reached.\\n */\\n event TargetAdminDelayUpdated(address indexed target, uint32 delay, uint48 since);\\n\\n error AccessManagerAlreadyScheduled(bytes32 operationId);\\n error AccessManagerNotScheduled(bytes32 operationId);\\n error AccessManagerNotReady(bytes32 operationId);\\n error AccessManagerExpired(bytes32 operationId);\\n error AccessManagerLockedRole(uint64 roleId);\\n error AccessManagerBadConfirmation();\\n error AccessManagerUnauthorizedAccount(address msgsender, uint64 roleId);\\n error AccessManagerUnauthorizedCall(address caller, address target, bytes4 selector);\\n error AccessManagerUnauthorizedConsume(address target);\\n error AccessManagerUnauthorizedCancel(address msgsender, address caller, address target, bytes4 selector);\\n error AccessManagerInvalidInitialAdmin(address initialAdmin);\\n\\n /**\\n * @dev Check if an address (`caller`) is authorised to call a given function on a given contract directly (with\\n * no restriction). Additionally, it returns the delay needed to perform the call indirectly through the {schedule}\\n * & {execute} workflow.\\n *\\n * This function is usually called by the targeted contract to control immediate execution of restricted functions.\\n * Therefore we only return true if the call can be performed without any delay. If the call is subject to a\\n * previously set delay (not zero), then the function should return false and the caller should schedule the operation\\n * for future execution.\\n *\\n * If `immediate` is true, the delay can be disregarded and the operation can be immediately executed, otherwise\\n * the operation can be executed if and only if delay is greater than 0.\\n *\\n * NOTE: The IAuthority interface does not include the `uint32` delay. This is an extension of that interface that\\n * is backward compatible. Some contracts may thus ignore the second return argument. In that case they will fail\\n * to identify the indirect workflow, and will consider calls that require a delay to be forbidden.\\n *\\n * NOTE: This function does not report the permissions of the admin functions in the manager itself. These are defined by the\\n * {AccessManager} documentation.\\n */\\n function canCall(\\n address caller,\\n address target,\\n bytes4 selector\\n ) external view returns (bool allowed, uint32 delay);\\n\\n /**\\n * @dev Expiration delay for scheduled proposals. Defaults to 1 week.\\n *\\n * IMPORTANT: Avoid overriding the expiration with 0. Otherwise every contract proposal will be expired immediately,\\n * disabling any scheduling usage.\\n */\\n function expiration() external view returns (uint32);\\n\\n /**\\n * @dev Minimum setback for all delay updates, with the exception of execution delays. It\\n * can be increased without setback (and reset via {revokeRole} in the case event of an\\n * accidental increase). Defaults to 5 days.\\n */\\n function minSetback() external view returns (uint32);\\n\\n /**\\n * @dev Get whether the contract is closed disabling any access. Otherwise role permissions are applied.\\n *\\n * NOTE: When the manager itself is closed, admin functions are still accessible to avoid locking the contract.\\n */\\n function isTargetClosed(address target) external view returns (bool);\\n\\n /**\\n * @dev Get the role required to call a function.\\n */\\n function getTargetFunctionRole(address target, bytes4 selector) external view returns (uint64);\\n\\n /**\\n * @dev Get the admin delay for a target contract. Changes to contract configuration are subject to this delay.\\n */\\n function getTargetAdminDelay(address target) external view returns (uint32);\\n\\n /**\\n * @dev Get the id of the role that acts as an admin for the given role.\\n *\\n * The admin permission is required to grant the role, revoke the role and update the execution delay to execute\\n * an operation that is restricted to this role.\\n */\\n function getRoleAdmin(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role that acts as a guardian for a given role.\\n *\\n * The guardian permission allows canceling operations that have been scheduled under the role.\\n */\\n function getRoleGuardian(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role current grant delay.\\n *\\n * Its value may change at any point without an event emitted following a call to {setGrantDelay}.\\n * Changes to this value, including effect timepoint are notified in advance by the {RoleGrantDelayChanged} event.\\n */\\n function getRoleGrantDelay(uint64 roleId) external view returns (uint32);\\n\\n /**\\n * @dev Get the access details for a given account for a given role. These details include the timepoint at which\\n * membership becomes active, and the delay applied to all operation by this user that requires this permission\\n * level.\\n *\\n * Returns:\\n * [0] Timestamp at which the account membership becomes valid. 0 means role is not granted.\\n * [1] Current execution delay for the account.\\n * [2] Pending execution delay for the account.\\n * [3] Timestamp at which the pending execution delay will become active. 0 means no delay update is scheduled.\\n */\\n function getAccess(\\n uint64 roleId,\\n address account\\n ) external view returns (uint48 since, uint32 currentDelay, uint32 pendingDelay, uint48 effect);\\n\\n /**\\n * @dev Check if a given account currently has the permission level corresponding to a given role. Note that this\\n * permission might be associated with an execution delay. {getAccess} can provide more details.\\n */\\n function hasRole(uint64 roleId, address account) external view returns (bool isMember, uint32 executionDelay);\\n\\n /**\\n * @dev Give a label to a role, for improved role discoverability by UIs.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleLabel} event.\\n */\\n function labelRole(uint64 roleId, string calldata label) external;\\n\\n /**\\n * @dev Add `account` to `roleId`, or change its execution delay.\\n *\\n * This gives the account the authorization to call any function that is restricted to this role. An optional\\n * execution delay (in seconds) can be set. If that delay is non 0, the user is required to schedule any operation\\n * that is restricted to members of this role. The user will only be able to execute the operation after the delay has\\n * passed, before it has expired. During this period, admin and guardians can cancel the operation (see {cancel}).\\n *\\n * If the account has already been granted this role, the execution delay will be updated. This update is not\\n * immediate and follows the delay rules. For example, if a user currently has a delay of 3 hours, and this is\\n * called to reduce that delay to 1 hour, the new delay will take some time to take effect, enforcing that any\\n * operation executed in the 3 hours that follows this update was indeed scheduled before this update.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - granted role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleGranted} event.\\n */\\n function grantRole(uint64 roleId, address account, uint32 executionDelay) external;\\n\\n /**\\n * @dev Remove an account from a role, with immediate effect. If the account does not have the role, this call has\\n * no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - revoked role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function revokeRole(uint64 roleId, address account) external;\\n\\n /**\\n * @dev Renounce role permissions for the calling account with immediate effect. If the sender is not in\\n * the role this call has no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be `callerConfirmation`.\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function renounceRole(uint64 roleId, address callerConfirmation) external;\\n\\n /**\\n * @dev Change admin role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleAdminChanged} event\\n */\\n function setRoleAdmin(uint64 roleId, uint64 admin) external;\\n\\n /**\\n * @dev Change guardian role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGuardianChanged} event\\n */\\n function setRoleGuardian(uint64 roleId, uint64 guardian) external;\\n\\n /**\\n * @dev Update the delay for granting a `roleId`.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGrantDelayChanged} event.\\n */\\n function setGrantDelay(uint64 roleId, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the role required to call functions identified by the `selectors` in the `target` contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetFunctionRoleUpdated} event per selector.\\n */\\n function setTargetFunctionRole(address target, bytes4[] calldata selectors, uint64 roleId) external;\\n\\n /**\\n * @dev Set the delay for changing the configuration of a given target contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetAdminDelayUpdated} event.\\n */\\n function setTargetAdminDelay(address target, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the closed flag for a contract.\\n *\\n * Closing the manager itself won't disable access to admin methods to avoid locking the contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetClosed} event.\\n */\\n function setTargetClosed(address target, bool closed) external;\\n\\n /**\\n * @dev Return the timepoint at which a scheduled operation will be ready for execution. This returns 0 if the\\n * operation is not yet scheduled, has expired, was executed, or was canceled.\\n */\\n function getSchedule(bytes32 id) external view returns (uint48);\\n\\n /**\\n * @dev Return the nonce for the latest scheduled operation with a given id. Returns 0 if the operation has never\\n * been scheduled.\\n */\\n function getNonce(bytes32 id) external view returns (uint32);\\n\\n /**\\n * @dev Schedule a delayed operation for future execution, and return the operation identifier. It is possible to\\n * choose the timestamp at which the operation becomes executable as long as it satisfies the execution delays\\n * required for the caller. The special value zero will automatically set the earliest possible time.\\n *\\n * Returns the `operationId` that was scheduled. Since this value is a hash of the parameters, it can reoccur when\\n * the same parameters are used; if this is relevant, the returned `nonce` can be used to uniquely identify this\\n * scheduled operation from other occurrences of the same `operationId` in invocations of {execute} and {cancel}.\\n *\\n * Emits a {OperationScheduled} event.\\n *\\n * NOTE: It is not possible to concurrently schedule more than one operation with the same `target` and `data`. If\\n * this is necessary, a random byte can be appended to `data` to act as a salt that will be ignored by the target\\n * contract if it is using standard Solidity ABI encoding.\\n */\\n function schedule(\\n address target,\\n bytes calldata data,\\n uint48 when\\n ) external returns (bytes32 operationId, uint32 nonce);\\n\\n /**\\n * @dev Execute a function that is delay restricted, provided it was properly scheduled beforehand, or the\\n * execution delay is 0.\\n *\\n * Returns the nonce that identifies the previously scheduled operation that is executed, or 0 if the\\n * operation wasn't previously scheduled (if the caller doesn't have an execution delay).\\n *\\n * Emits an {OperationExecuted} event only if the call was scheduled and delayed.\\n */\\n function execute(address target, bytes calldata data) external payable returns (uint32);\\n\\n /**\\n * @dev Cancel a scheduled (delayed) operation. Returns the nonce that identifies the previously scheduled\\n * operation that is cancelled.\\n *\\n * Requirements:\\n *\\n * - the caller must be the proposer, a guardian of the targeted function, or a global admin\\n *\\n * Emits a {OperationCanceled} event.\\n */\\n function cancel(address caller, address target, bytes calldata data) external returns (uint32);\\n\\n /**\\n * @dev Consume a scheduled operation targeting the caller. If such an operation exists, mark it as consumed\\n * (emit an {OperationExecuted} event and clean the state). Otherwise, throw an error.\\n *\\n * This is useful for contract that want to enforce that calls targeting them were scheduled on the manager,\\n * with all the verifications that it implies.\\n *\\n * Emit a {OperationExecuted} event.\\n */\\n function consumeScheduledOp(address caller, bytes calldata data) external;\\n\\n /**\\n * @dev Hashing function for delayed operations.\\n */\\n function hashOperation(address caller, address target, bytes calldata data) external view returns (bytes32);\\n\\n /**\\n * @dev Changes the authority of a target managed by this manager instance.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n */\\n function updateAuthority(address target, address newAuthority) external;\\n}\\n\",\"keccak256\":\"0x9be2d08a326515805bc9cf6315b7953f8d1ebe88abf48c2d645fb1fa8211a0e2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAuthority.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Standard interface for permissioning originally defined in Dappsys.\\n */\\ninterface IAuthority {\\n /**\\n * @dev Returns true if the caller can invoke on a target the function identified by a function selector.\\n */\\n function canCall(address caller, address target, bytes4 selector) external view returns (bool allowed);\\n}\\n\",\"keccak256\":\"0x4cc0766bd7fb7b3bafb70afa2a93b6e313a0baec7a35ad1b57505be7861c1030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"./IERC20.sol\\\";\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @title IERC1363\\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\\n *\\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\\n */\\ninterface IERC1363 is IERC20, IERC165 {\\n /*\\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\\n * 0xb0202a11 ===\\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\\n */\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @param data Additional data with no specified format, sent in call to `spender`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9b6b3e7803bc5f2f8cd7ad57db8ac1def61a9930a5a3107df4882e028a9605d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xde7e9fd9aee8d4f40772f96bb3b58836cbc6dfc0227014a061947f8821ea9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0xce41876e78d1badc0512229b4d14e4daf83bc1003d7f83978d18e0e56f965b9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashBorrower.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashBorrower, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashBorrower {\\n /**\\n * @dev Receive a flash loan.\\n * @param initiator The initiator of the loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param fee The additional amount of tokens to repay.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n * @return The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\\n */\\n function onFlashLoan(\\n address initiator,\\n address token,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n ) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0x0b1459615b9b47c2a4eec8e72f23ccc601f1d711f679a1c06b3390459021a341\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashLender.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC3156FlashBorrower} from \\\"./IERC3156FlashBorrower.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashLender, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashLender {\\n /**\\n * @dev The amount of currency available to be lended.\\n * @param token The loan currency.\\n * @return The amount of `token` that can be borrowed.\\n */\\n function maxFlashLoan(address token) external view returns (uint256);\\n\\n /**\\n * @dev The fee to be charged for a given loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @return The amount of `token` to be charged for the loan, on top of the returned principal.\\n */\\n function flashFee(address token, uint256 amount) external view returns (uint256);\\n\\n /**\\n * @dev Initiate a flash loan.\\n * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n */\\n function flashLoan(\\n IERC3156FlashBorrower receiver,\\n address token,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x5d19ea24c555cf6a5dbafea9fac57887cc3e72154f3ee8e0a2bf67971811c14b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xe06a3f08a987af6ad2e1c1e774405d4fe08f1694b67517438b467cecf0da0ef7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.20;\\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\",\"keccak256\":\"0x70f2f713b13b7ce4610bcd0ac9fec0f3cc43693b043abcb8dc40a42a726eb330\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.2.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 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\",\"keccak256\":\"0x4ea01544758fd2c7045961904686bfe232d2220a04ecaa2d6b08dac17827febf\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Panic.sol\":{\"content\":\"// 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\",\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x79796192ec90263f21b464d5bc90b777a525971d3de8232be80d9c4f9fb353b8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.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 Returns the addition of two unsigned integers, with an 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 if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\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 if (b == 0) return (false, 0);\\n return (true, a / b);\\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 if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\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 // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2\\u00b2\\u2075\\u2076 and mod 2\\u00b2\\u2075\\u2076 - 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 = prod1 * 2\\u00b2\\u2075\\u2076 + prod0.\\n uint256 prod0 = x * y; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 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 prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2\\u00b2\\u2075\\u2076. Also prevents denominator == 0.\\n if (denominator <= prod1) {\\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 [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, 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 {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2\\u00b2\\u2075\\u2076 / 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 prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2\\u00b2\\u2075\\u2076. Now that denominator is an odd number, it has an inverse modulo 2\\u00b2\\u2075\\u2076 such\\n // that denominator * inv \\u2261 1 mod 2\\u00b2\\u2075\\u2076. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv \\u2261 1 mod 2\\u2074.\\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\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u2076\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b3\\u00b2\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u2076\\u2074\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u00b2\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b2\\u2075\\u2076\\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\\u00b2\\u2075\\u2076. Since the preconditions guarantee that the outcome is\\n // less than 2\\u00b2\\u2075\\u2076, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * 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 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 \\u2261 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) \\u2261 1 mod p`. As a consequence, we have `a * a**(p-2) \\u2261 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\\u00b2 - 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 `\\u03b5_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) \\u2264 sqrt(a) < 2**e`). We know that `e \\u2264 128` because `(2\\u00b9\\u00b2\\u2078)\\u00b2 = 2\\u00b2\\u2075\\u2076` is\\n // bigger than any uint256.\\n //\\n // By noticing that\\n // `2**(e-1) \\u2264 sqrt(a) < 2**e \\u2192 (2**(e-1))\\u00b2 \\u2264 a < (2**e)\\u00b2 \\u2192 2**(2*e-2) \\u2264 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) \\u2264 sqrt(a) < 2**e = 2 * x_n`. This implies \\u03b5_n \\u2264 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 \\u03b5_n \\u2264 2**(e-2).\\n // This is going to be our x_0 (and \\u03b5_0)\\n xn = (3 * xn) >> 1; // \\u03b5_0 := | x_0 - sqrt(a) | \\u2264 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}\\u00b2 - a = ((x_n + a / x_n) / 2)\\u00b2 - a\\n // = ((x_n\\u00b2 + a) / (2 * x_n))\\u00b2 - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2) - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2 - 4 * a * x_n\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u2074 - 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u00b2 - a)\\u00b2 / (2 * x_n)\\u00b2\\n // = ((x_n\\u00b2 - a) / (2 * x_n))\\u00b2\\n // \\u2265 0\\n // Which proves that for all n \\u2265 1, sqrt(a) \\u2264 x_n\\n //\\n // This gives us the proof of quadratic convergence of the sequence:\\n // \\u03b5_{n+1} = | x_{n+1} - sqrt(a) |\\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\\n // = | (x_n\\u00b2 + a - 2*x_n*sqrt(a)) / (2 * x_n) |\\n // = | (x_n - sqrt(a))\\u00b2 / (2 * x_n) |\\n // = | \\u03b5_n\\u00b2 / (2 * x_n) |\\n // = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n //\\n // For the first iteration, we have a special case where x_0 is known:\\n // \\u03b5_1 = \\u03b5_0\\u00b2 / | (2 * x_0) |\\n // \\u2264 (2**(e-2))\\u00b2 / (2 * (2**(e-1) + 2**(e-2)))\\n // \\u2264 2**(2*e-4) / (3 * 2**(e-1))\\n // \\u2264 2**(e-3) / 3\\n // \\u2264 2**(e-3-log2(3))\\n // \\u2264 2**(e-4.5)\\n //\\n // For the following iterations, we use the fact that, 2**(e-1) \\u2264 sqrt(a) \\u2264 x_n:\\n // \\u03b5_{n+1} = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n // \\u2264 (2**(e-k))\\u00b2 / (2 * 2**(e-1))\\n // \\u2264 2**(2*e-2*k) / 2**e\\n // \\u2264 2**(e-2*k)\\n xn = (xn + a / xn) >> 1; // \\u03b5_1 := | x_1 - sqrt(a) | \\u2264 2**(e-4.5) -- special case, see above\\n xn = (xn + a / xn) >> 1; // \\u03b5_2 := | x_2 - sqrt(a) | \\u2264 2**(e-9) -- general case with k = 4.5\\n xn = (xn + a / xn) >> 1; // \\u03b5_3 := | x_3 - sqrt(a) | \\u2264 2**(e-18) -- general case with k = 9\\n xn = (xn + a / xn) >> 1; // \\u03b5_4 := | x_4 - sqrt(a) | \\u2264 2**(e-36) -- general case with k = 18\\n xn = (xn + a / xn) >> 1; // \\u03b5_5 := | x_5 - sqrt(a) | \\u2264 2**(e-72) -- general case with k = 36\\n xn = (xn + a / xn) >> 1; // \\u03b5_6 := | x_6 - sqrt(a) | \\u2264 2**(e-144) -- general case with k = 72\\n\\n // Because e \\u2264 128 (as discussed during the first estimation phase), we know have reached a precision\\n // \\u03b5_6 \\u2264 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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 exp;\\n unchecked {\\n exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);\\n value >>= exp;\\n result += exp;\\n\\n result += SafeCast.toUint(value > 1);\\n }\\n return result;\\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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 isGt;\\n unchecked {\\n isGt = SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= isGt * 128;\\n result += isGt * 16;\\n\\n isGt = SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= isGt * 64;\\n result += isGt * 8;\\n\\n isGt = SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= isGt * 32;\\n result += isGt * 4;\\n\\n isGt = SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= isGt * 16;\\n result += isGt * 2;\\n\\n result += SafeCast.toUint(value > (1 << 8) - 1);\\n }\\n return result;\\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\",\"keccak256\":\"0xa00be322d7db5786750ce0ac7e2f5b633ac30a5ed5fa1ced1e74acfc19acecea\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x195533c86d0ef72bcc06456a4f66a9b941f38eb403739b00f21fd7c1abd1ae54\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/types/Time.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/types/Time.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"../math/Math.sol\\\";\\nimport {SafeCast} from \\\"../math/SafeCast.sol\\\";\\n\\n/**\\n * @dev This library provides helpers for manipulating time-related objects.\\n *\\n * It uses the following types:\\n * - `uint48` for timepoints\\n * - `uint32` for durations\\n *\\n * While the library doesn't provide specific types for timepoints and duration, it does provide:\\n * - a `Delay` type to represent duration that can be programmed to change value automatically at a given point\\n * - additional helper functions\\n */\\nlibrary Time {\\n using Time for *;\\n\\n /**\\n * @dev Get the block timestamp as a Timepoint.\\n */\\n function timestamp() internal view returns (uint48) {\\n return SafeCast.toUint48(block.timestamp);\\n }\\n\\n /**\\n * @dev Get the block number as a Timepoint.\\n */\\n function blockNumber() internal view returns (uint48) {\\n return SafeCast.toUint48(block.number);\\n }\\n\\n // ==================================================== Delay =====================================================\\n /**\\n * @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the\\n * future. The \\\"effect\\\" timepoint describes when the transitions happens from the \\\"old\\\" value to the \\\"new\\\" value.\\n * This allows updating the delay applied to some operation while keeping some guarantees.\\n *\\n * In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for\\n * some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set\\n * the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should\\n * still apply for some time.\\n *\\n *\\n * The `Delay` type is 112 bits long, and packs the following:\\n *\\n * ```\\n * | [uint48]: effect date (timepoint)\\n * | | [uint32]: value before (duration)\\n * \\u2193 \\u2193 \\u2193 [uint32]: value after (duration)\\n * 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC\\n * ```\\n *\\n * NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently\\n * supported.\\n */\\n type Delay is uint112;\\n\\n /**\\n * @dev Wrap a duration into a Delay to add the one-step \\\"update in the future\\\" feature\\n */\\n function toDelay(uint32 duration) internal pure returns (Delay) {\\n return Delay.wrap(duration);\\n }\\n\\n /**\\n * @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled\\n * change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered.\\n */\\n function _getFullAt(\\n Delay self,\\n uint48 timepoint\\n ) private pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n (valueBefore, valueAfter, effect) = self.unpack();\\n return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the\\n * effect timepoint is 0, then the pending value should not be considered.\\n */\\n function getFull(Delay self) internal view returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n return _getFullAt(self, timestamp());\\n }\\n\\n /**\\n * @dev Get the current value.\\n */\\n function get(Delay self) internal view returns (uint32) {\\n (uint32 delay, , ) = self.getFull();\\n return delay;\\n }\\n\\n /**\\n * @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to\\n * enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the\\n * new delay becomes effective.\\n */\\n function withUpdate(\\n Delay self,\\n uint32 newValue,\\n uint32 minSetback\\n ) internal view returns (Delay updatedDelay, uint48 effect) {\\n uint32 value = self.get();\\n uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0));\\n effect = timestamp() + setback;\\n return (pack(value, newValue, effect), effect);\\n }\\n\\n /**\\n * @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint).\\n */\\n function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n uint112 raw = Delay.unwrap(self);\\n\\n valueAfter = uint32(raw);\\n valueBefore = uint32(raw >> 32);\\n effect = uint48(raw >> 64);\\n\\n return (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev pack the components into a Delay object.\\n */\\n function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) {\\n return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter));\\n }\\n}\\n\",\"keccak256\":\"0x36776530f012618bc7526ceb28e77b85e582cb12d9b9466a71d4bd6bf952e4cc\",\"license\":\"MIT\"},\"contracts/helpers/BaseHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { AccessManaged } from \\\"../utils/AccessManaged.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport \\\"contracts/interfaces/IHarvester.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nstruct YieldBearingParams {\\n // Address of the asset used to mint the yield bearing asset\\n address asset;\\n // Target exposure to the collateral yield bearing asset used\\n uint64 targetExposure;\\n // Maximum exposure within the Parallelizer to the deposit asset\\n uint64 maxExposure;\\n // Minimum exposure within the Parallelizer to the deposit asset\\n uint64 minExposure;\\n // Whether limit exposures should be overriden or read onchain through the Parallelizer\\n // This value should be 1 to override exposures or 2 if these shouldn't be overriden\\n uint64 overrideExposures;\\n // Maximum slippage when dealing with the Parallelizer\\n uint96 maxSlippage;\\n}\\n\\n/// @title BaseHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Abstract contract for a harvester that aims at rebalancing a Parallelizer\\n/// @dev This contract is an authorized fork of Angle's BaseHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/BaseHarvester.sol\\nabstract contract BaseHarvester is IHarvester, AccessManaged {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrusted() {\\n if (!isTrusted[msg.sender]) revert NotTrusted();\\n _;\\n }\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted or guardian to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrustedOrRestricted() {\\n if (!isTrusted[msg.sender] && !_checkCanCall(_msgSender(), _msgData())) {\\n revert NotTrustedOrGuardian();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VARIABLES\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Reference to the `parallelizer` implementation this contract aims at rebalancing\\n IParallelizer public immutable parallelizer;\\n /// @notice TokenP handled by the `parallelizer` of interest\\n ITokenP public immutable tokenP;\\n /// @notice Max slippage when dealing with the Parallelizer\\n mapping(address => uint96) public maxTokenSlippage;\\n /// @notice Data associated to a yield bearing asset\\n mapping(address => YieldBearingParams) public yieldBearingData;\\n /// @notice trusted addresses that can update target exposure and do others non critical operations\\n mapping(address => bool) public isTrusted;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EVENTS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n event Recovered(address token, uint256 amount, address to);\\n event TrustedToggled(address trusted, bool status);\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialAuthority,\\n ITokenP definitiveTokenP,\\n IParallelizer definitiveParallelizer\\n )\\n AccessManaged(initialAuthority)\\n {\\n tokenP = definitiveTokenP;\\n parallelizer = definitiveParallelizer;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n GUARDIAN FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the yieldBearingAsset data\\n * @param yieldBearingAsset address of the yieldBearingAsset\\n * @param asset address of the asset\\n * @param targetExposure target exposure to the yieldBearingAsset asset used\\n * @param minExposure minimum exposure within the Parallelizer to the asset\\n * @param maxExposure maximum exposure within the Parallelizer to the asset\\n * @param overrideExposures whether limit exposures should be overriden or read onchain through the Parallelizer\\n */\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external\\n restricted\\n {\\n _setYieldBearingAssetData(\\n yieldBearingAsset, asset, targetExposure, minExposure, maxExposure, overrideExposures, maxSlippage\\n );\\n }\\n\\n /**\\n * @notice Set the limit exposures to the asset linked to the yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n */\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) public virtual {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n if (yieldBearingInfo.overrideExposures == 2) {\\n _updateLimitExposuresYieldAsset(yieldBearingInfo.asset, yieldBearingInfo);\\n }\\n }\\n\\n /**\\n * @notice Set the max allowed slippage\\n * @param newMaxSlippage new max allowed slippage\\n */\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external restricted {\\n _setMaxSlippage(yieldBearingAsset, newMaxSlippage);\\n }\\n\\n /**\\n * @notice Toggle the trusted status of an address\\n * @param trusted address to toggle the trusted status\\n */\\n function toggleTrusted(address trusted) external restricted {\\n emit TrustedToggled(trusted, isTrusted[trusted]);\\n isTrusted[trusted] = !isTrusted[trusted];\\n }\\n\\n /**\\n * @notice Recover ERC20 tokens\\n * @param tokenAddress address of the token to recover\\n * @param amountToRecover amount to recover\\n * @param to address to send the recovered tokens\\n */\\n function recoverERC20(address tokenAddress, uint256 amountToRecover, address to) external restricted {\\n emit Recovered(tokenAddress, amountToRecover, to);\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n TRUSTED FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the target exposure of a yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @param targetExposure target exposure to the yield bearing asset used\\n */\\n function setTargetExposure(address yieldBearingAsset, uint64 targetExposure) external onlyTrustedOrRestricted {\\n yieldBearingData[yieldBearingAsset].targetExposure = targetExposure;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Compute the amount needed to rebalance the Parallelizer\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @return increase whether the exposure should be increased\\n * @return amount amount to be rebalanced\\n */\\n function computeRebalanceAmount(address yieldBearingAsset) external view returns (uint8 increase, uint256 amount) {\\n return _computeRebalanceAmount(yieldBearingAsset, yieldBearingData[yieldBearingAsset]);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _computeRebalanceAmount(\\n address yieldBearingAsset,\\n YieldBearingParams memory yieldBearingInfo\\n )\\n internal\\n view\\n returns (uint8 increase, uint256 amount)\\n {\\n (uint256 stablecoinsFromYieldBearingAsset, uint256 stablecoinsIssued) =\\n parallelizer.getIssuedByCollateral(yieldBearingAsset);\\n (uint256 stablecoinsFromAsset,) = parallelizer.getIssuedByCollateral(yieldBearingInfo.asset);\\n uint256 targetExposureScaled = yieldBearingInfo.targetExposure * stablecoinsIssued;\\n if (stablecoinsFromYieldBearingAsset * 1e9 > targetExposureScaled) {\\n // Need to decrease exposure to yield bearing asset\\n amount = stablecoinsFromYieldBearingAsset - targetExposureScaled / 1e9;\\n uint256 maxValueScaled = yieldBearingInfo.maxExposure * stablecoinsIssued;\\n // These checks assume that there are no transaction fees on the stablecoin->collateral conversion and so\\n // it's still possible that exposure goes above the max exposure in some rare cases\\n if (stablecoinsFromAsset * 1e9 > maxValueScaled) {\\n amount = 0;\\n } else if ((stablecoinsFromAsset + amount) * 1e9 > maxValueScaled) {\\n amount = maxValueScaled / 1e9 - stablecoinsFromAsset;\\n }\\n } else {\\n // In this case, exposure after the operation might remain slightly below the targetExposure as less\\n // collateral may be obtained by burning stablecoins for the yield asset and unwrapping it\\n increase = 1;\\n amount = targetExposureScaled / 1e9 - stablecoinsFromYieldBearingAsset;\\n uint256 minValueScaled = yieldBearingInfo.minExposure * stablecoinsIssued;\\n if (stablecoinsFromAsset * 1e9 < minValueScaled) {\\n amount = 0;\\n } else if (stablecoinsFromAsset * 1e9 < minValueScaled + amount * 1e9) {\\n amount = stablecoinsFromAsset - minValueScaled / 1e9;\\n }\\n }\\n }\\n\\n function _setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n internal\\n virtual\\n {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n yieldBearingInfo.asset = asset;\\n if (targetExposure >= 1e9) revert InvalidParam();\\n if (maxSlippage >= 1e9) revert InvalidParam();\\n yieldBearingInfo.targetExposure = targetExposure;\\n yieldBearingInfo.overrideExposures = overrideExposures;\\n yieldBearingInfo.maxSlippage = maxSlippage;\\n if (overrideExposures == 1) {\\n if (maxExposure >= 1e9 || minExposure >= maxExposure) revert InvalidParam();\\n yieldBearingInfo.maxExposure = maxExposure;\\n yieldBearingInfo.minExposure = minExposure;\\n } else {\\n yieldBearingInfo.overrideExposures = 2;\\n _updateLimitExposuresYieldAsset(asset, yieldBearingInfo);\\n }\\n }\\n\\n function _updateLimitExposuresYieldAsset(\\n address asset,\\n YieldBearingParams storage yieldBearingInfo\\n )\\n internal\\n virtual\\n {\\n uint64[] memory xFeeMint;\\n (xFeeMint,) = parallelizer.getCollateralMintFees(asset);\\n uint256 length = xFeeMint.length;\\n if (length <= 1) yieldBearingInfo.maxExposure = 1e9;\\n else yieldBearingInfo.maxExposure = xFeeMint[length - 2];\\n\\n uint64[] memory xFeeBurn;\\n (xFeeBurn,) = parallelizer.getCollateralBurnFees(asset);\\n length = xFeeBurn.length;\\n if (length <= 1) yieldBearingInfo.minExposure = 0;\\n else yieldBearingInfo.minExposure = xFeeBurn[length - 2];\\n }\\n\\n function _setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) internal virtual {\\n if (newMaxSlippage > 1e9) revert InvalidParam();\\n maxTokenSlippage[yieldBearingAsset] = newMaxSlippage;\\n }\\n\\n function _scaleAmountBasedOnDecimals(\\n uint256 decimalsTokenIn,\\n uint256 decimalsTokenOut,\\n uint256 amountIn,\\n bool assetIn\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n if (decimalsTokenIn > decimalsTokenOut) {\\n if (assetIn) {\\n amountIn /= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n } else {\\n amountIn *= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n }\\n } else if (decimalsTokenIn < decimalsTokenOut) {\\n if (assetIn) {\\n amountIn *= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n } else {\\n amountIn /= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n }\\n }\\n return amountIn;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HELPER \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _adjustAllowance(address token, address sender, uint256 amountIn) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), sender);\\n if (allowance < amountIn) IERC20(token).safeIncreaseAllowance(sender, type(uint256).max - allowance);\\n }\\n}\\n\",\"keccak256\":\"0x82e2ae57997043160d7529488b34591c710cd74e267213b61009daa96e9eeaaf\",\"license\":\"GPL-3.0\"},\"contracts/helpers/GenericHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC20Metadata } from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport { IERC3156FlashBorrower } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\\\";\\nimport { IERC3156FlashLender } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\\\";\\nimport { RouterSwapper } from \\\"@helpers/RouterSwapper.sol\\\";\\n\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport { IERC4626 } from \\\"contracts/interfaces/external/IERC4626.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nimport { BaseHarvester, YieldBearingParams } from \\\"./BaseHarvester.sol\\\";\\n\\nenum SwapType {\\n VAULT,\\n SWAP\\n}\\n\\n/// @title GenericHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Generic contract for anyone to permissionlessly adjust the reserves of Angle Parallelizer\\n/// @dev This contract is an authorized fork of Angle's GenericHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\\ncontract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper {\\n using SafeCast for uint256;\\n using SafeERC20 for IERC20;\\n\\n bytes32 public constant CALLBACK_SUCCESS = keccak256(\\\"ERC3156FlashBorrower.onFlashLoan\\\");\\n\\n /// @notice Parallel stablecoin flashloan contract\\n IERC3156FlashLender public immutable flashloan;\\n /// @notice Budget of tokenP available for each users\\n mapping(address => uint256) public budget;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INITIALIZATION \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialTokenTransferAddress,\\n address initialSwapRouter,\\n ITokenP definitivetokenP,\\n IParallelizer definitiveParallelizer,\\n address initialAuthority,\\n IERC3156FlashLender definitiveFlashloan\\n )\\n RouterSwapper(initialSwapRouter, initialTokenTransferAddress)\\n BaseHarvester(initialAuthority, definitivetokenP, definitiveParallelizer)\\n {\\n if (address(definitiveFlashloan) == address(0)) revert ZeroAddress();\\n flashloan = definitiveFlashloan;\\n\\n IERC20(tokenP).approve(address(definitiveFlashloan), type(uint256).max);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n BUDGET HANDLING\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Add budget to be spent by the receiver during the flashloan\\n * @param amount amount of tokenP to add to the budget\\n * @param receiver address of the receiver\\n */\\n function addBudget(uint256 amount, address receiver) public virtual {\\n budget[receiver] += amount;\\n\\n IERC20(tokenP).safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n /**\\n * @notice Remove budget from the owner and send it to the receiver\\n * @param amount amount of tokenP to remove from the budget\\n * @param receiver address of the receiver\\n */\\n function removeBudget(uint256 amount, address receiver) public virtual {\\n budget[msg.sender] -= amount; // Will revert if not enough funds\\n\\n IERC20(tokenP).safeTransfer(receiver, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HARVEST\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure\\n /// to this yieldBearingAsset\\n /// @dev This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up\\n /// some yieldBearingAsset that can then be used for people looking to burn deposit tokens\\n /// @dev Due to potential transaction fees within the Parallelizer, this function doesn't exactly bring\\n /// `yieldBearingAsset` to the target exposure\\n /// @dev scale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest,\\n /// it is used to lower the amount of the asset to harvest for example to have a lower slippage\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) public virtual {\\n if (scale > 1e9) revert InvalidParam();\\n updateLimitExposuresYieldAsset(yieldBearingAsset);\\n YieldBearingParams memory yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n (uint8 increase, uint256 amount) = _computeRebalanceAmount(yieldBearingAsset, yieldBearingInfo);\\n amount = (amount * scale) / 1e9;\\n if (amount == 0) revert ZeroAmount();\\n (SwapType swapType, bytes memory data) = abi.decode(extraData, (SwapType, bytes));\\n try parallelizer.updateOracle(yieldBearingAsset) { } catch { }\\n _adjustYieldExposure(\\n amount,\\n increase,\\n yieldBearingAsset,\\n yieldBearingInfo.asset,\\n (amount * (1e9 - yieldBearingInfo.maxSlippage)) / 1e9,\\n swapType,\\n data\\n );\\n }\\n\\n /// @inheritdoc IERC3156FlashBorrower\\n function onFlashLoan(\\n address initiator,\\n address,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n )\\n public\\n virtual\\n returns (bytes32)\\n {\\n if (msg.sender != address(flashloan) || initiator != address(this) || fee != 0) revert NotTrusted();\\n address sender;\\n uint256 typeAction;\\n uint256 minAmountOut;\\n SwapType swapType;\\n bytes memory callData;\\n address tokenOut;\\n address tokenIn;\\n {\\n address yieldBearingAsset;\\n address asset;\\n (sender, typeAction, yieldBearingAsset, asset, minAmountOut, swapType, callData) =\\n abi.decode(data, (address, uint256, address, address, uint256, SwapType, bytes));\\n if (typeAction == 1) {\\n // Increase yield exposure action: we bring in the yield bearing asset\\n tokenOut = yieldBearingAsset;\\n tokenIn = asset;\\n } else {\\n // Decrease yield exposure action: we bring in the deposit asset\\n tokenIn = yieldBearingAsset;\\n tokenOut = asset;\\n }\\n }\\n uint256 amountOut =\\n parallelizer.swapExactInput(amount, 0, address(tokenP), tokenIn, address(this), block.timestamp);\\n\\n // Swap to tokenIn\\n amountOut = _swapToTokenOut(typeAction, tokenIn, tokenOut, amountOut, swapType, callData);\\n\\n _adjustAllowance(tokenOut, address(parallelizer), amountOut);\\n uint256 amountStableOut =\\n parallelizer.swapExactInput(amountOut, minAmountOut, tokenOut, address(tokenP), address(this), block.timestamp);\\n if (amount > amountStableOut) {\\n budget[sender] -= amount - amountStableOut; // Will revert if not enough funds\\n }\\n return CALLBACK_SUCCESS;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n SETTERS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the token transfer contract\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress) public override restricted {\\n super.setTokenTransferAddress(newTokenTransferAddress);\\n }\\n\\n /**\\n * @notice Set the swap router\\n * @param newSwapRouter address of the swap router\\n */\\n function setSwapRouter(address newSwapRouter) public override restricted {\\n super.setSwapRouter(newSwapRouter);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNALS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Burns `amountStablecoins` for one yieldBearing asset, swap for asset then mints deposit tokens\\n /// from the proceeds of the swap.\\n /// @dev If `increase` is 1, then the system tries to increase its exposure to the yield bearing asset which means\\n /// burning tokenP for the deposit asset, swapping for the yield bearing asset, then minting the tokenP\\n /// @dev This function reverts if the second tokenP mint gives less than `minAmountOut` of ag tokens\\n /// @dev This function reverts if the swap slippage is higher than `maxSlippage`\\n function _adjustYieldExposure(\\n uint256 amountStablecoins,\\n uint8 increase,\\n address yieldBearingAsset,\\n address asset,\\n uint256 minAmountOut,\\n SwapType swapType,\\n bytes memory extraData\\n )\\n internal\\n {\\n flashloan.flashLoan(\\n IERC3156FlashBorrower(address(this)),\\n address(tokenP),\\n amountStablecoins,\\n abi.encode(msg.sender, increase, yieldBearingAsset, asset, minAmountOut, swapType, extraData)\\n );\\n }\\n\\n function _swapToTokenOut(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n SwapType swapType,\\n bytes memory callData\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (swapType == SwapType.SWAP) {\\n amountOut = _swapToTokenOutSwap(tokenIn, tokenOut, amount, callData);\\n } else if (swapType == SwapType.VAULT) {\\n amountOut = _swapToTokenOutVault(typeAction, tokenIn, tokenOut, amount);\\n }\\n }\\n\\n /**\\n * @notice Swap token using the router/aggregator\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n * @param callData bytes to call the router/aggregator\\n */\\n function _swapToTokenOutSwap(\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n bytes memory callData\\n )\\n internal\\n returns (uint256)\\n {\\n uint256 balance = IERC20(tokenOut).balanceOf(address(this));\\n\\n address[] memory tokens = new address[](1);\\n tokens[0] = tokenIn;\\n bytes[] memory callDatas = new bytes[](1);\\n callDatas[0] = callData;\\n uint256[] memory amounts = new uint256[](1);\\n amounts[0] = amount;\\n _swap(tokens, callDatas, amounts);\\n\\n return IERC20(tokenOut).balanceOf(address(this)) - balance;\\n }\\n\\n /**\\n * @dev Deposit or redeem the vault asset\\n * @param typeAction 1 for deposit, 2 for redeem\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n */\\n function _swapToTokenOutVault(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (typeAction == 1) {\\n // Granting allowance with the yieldBearingAsset for the vault asset\\n _adjustAllowance(tokenIn, tokenOut, amount);\\n amountOut = IERC4626(tokenOut).deposit(amount, address(this));\\n } else {\\n amountOut = IERC4626(tokenIn).redeem(amount, address(this), address(this));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x604c4f9c755b2eb704dc15ba59046201c0258134ef2fbe15a529c510c68cb40a\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDiamondCut.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IDiamondCut\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondCut.sol by mudgen\\n/// @dev This interface is an authorized fork of Angle's `IDiamondCut` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IDiamondCut.sol\\ninterface IDiamondCut {\\n /// @notice Add/replace/remove any number of functions and optionally execute a function with delegatecall\\n /// @param _diamondCut Contains the facet addresses and function selectors\\n /// @param _init The address of the contract or facet to execute _calldata\\n /// @param _calldata A function call, including function selector and arguments, executed with delegatecall on\\n /// _init\\n function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;\\n}\\n\",\"keccak256\":\"0x08a01f77b740f7da424f0ea27a6a292f9e292058e23d1fe960d2d19a44496c7b\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondEtherscan.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\n/// @title IDiamondEtherscan\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface IDiamondEtherscan {\\n /// @notice Sets a dummy implementation with the same layout at the diamond proxy contract with all its facets\\n function setDummyImplementation(address _implementation) external;\\n\\n /// @notice Address of the dummy implementation used to make the DiamondProxy contract interpretable by Etherscan\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf742b55592d129e02fb755d25f7a97ed976a14c4c744d6ac46726809e8f1e037\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondLoupe.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @notice IDiamondLoupe\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondLoupe.sol by mudgen\\ninterface IDiamondLoupe {\\n /// @notice Gets all facet addresses and their four byte function selectors.\\n /// @return facets_ Facet\\n function facets() external view returns (Facet[] memory facets_);\\n\\n /// @notice Gets all the function selectors supported by a specific facet.\\n /// @param _facet The facet address.\\n /// @return facetFunctionSelectors_\\n function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);\\n\\n /// @notice Get all the facet addresses used by a diamond.\\n /// @return facetAddresses_\\n function facetAddresses() external view returns (address[] memory facetAddresses_);\\n\\n /// @notice Gets the facet that supports the given selector.\\n /// @dev If facet is not found return address(0).\\n /// @param _functionSelector The function selector.\\n /// @return facetAddress_ The facet address.\\n function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);\\n}\\n\",\"keccak256\":\"0xa5580958acabe2c44967e835e77a748eb0b8812f70cd071191201508c9388ca8\",\"license\":\"MIT\"},\"contracts/interfaces/IGetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IGetters\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IGetters` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IGetters.sol\\ninterface IGetters {\\n /// @notice Checks whether a given `selector` is actually a valid selector corresponding to a function in one of\\n /// the\\n /// facets of the proxy\\n function isValidSelector(bytes4 selector) external view returns (bool);\\n\\n /// @notice Stablecoin minted by parallelizer\\n function tokenP() external view returns (ITokenP);\\n\\n /// @notice Returns the list of collateral assets supported by the system\\n function getCollateralList() external view returns (address[] memory);\\n\\n /// @notice Returns all the info in storage associated to a `collateral`\\n function getCollateralInfo(address collateral) external view returns (Collateral memory);\\n\\n /// @notice Returns the decimals of a given `collateral`\\n function getCollateralDecimals(address collateral) external view returns (uint8);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to mint\\n /// with `collateral`\\n function getCollateralMintFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to burn\\n /// for `collateral`\\n function getCollateralBurnFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays used to compute the penalty factor depending on the collateral\\n /// ratio when users come to redeem\\n function getRedemptionFees() external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the collateral ratio of Parallelizer in base `10**9` and a rounded version of the total amount\\n /// of stablecoins issued\\n function getCollateralRatio() external view returns (uint64 collatRatio, uint256 stablecoinsIssued);\\n\\n /// @notice Returns the total amount of stablecoins issued through Parallelizer\\n function getTotalIssued() external view returns (uint256 stablecoinsIssued);\\n\\n /// @notice Returns the amount of stablecoins issued from `collateral` and the total amount of stablecoins issued\\n /// through Parallelizer\\n function getIssuedByCollateral(address collateral)\\n external\\n view\\n returns (uint256 stablecoinsFromCollateral, uint256 stablecoinsIssued);\\n\\n /// @notice Returns if a collateral is \\\"managed\\\" and the associated manager configuration\\n function getManagerData(address collateral)\\n external\\n view\\n returns (bool isManaged, IERC20[] memory subCollaterals, bytes memory config);\\n\\n /// @notice Returns the oracle values associated to `collateral`\\n /// @return mint Oracle value to be used for a mint transaction with `collateral`\\n /// @return burn Oracle value that will be used for `collateral` for a burn transaction. This value\\n /// is then used along with oracle values for all other collateral assets to get a global burn value for the oracle\\n /// @return ratio Ratio, in base `10**18` between the oracle value of the `collateral` and its target price.\\n /// This value is 10**18 if the oracle is greater than the collateral price\\n /// @return minRatio Minimum ratio across all collateral assets between a collateral burn price and its target\\n /// price. This value is independent of `collateral` and is used to normalize the burn oracle value for burn\\n /// transactions.\\n /// @return redemption Oracle value that would be used to price `collateral` when computing the collateral ratio\\n /// during a redemption\\n function getOracleValues(address collateral)\\n external\\n view\\n returns (uint256 mint, uint256 burn, uint256 ratio, uint256 minRatio, uint256 redemption);\\n\\n /// @notice Returns the data used to compute oracle values for `collateral`\\n /// @return oracleType Type of oracle (Chainlink, external smart contract, ...)\\n /// @return targetType Type passed to read the value of the target price\\n /// @return oracleData Extra data needed to read the oracle. For Chainlink oracles, this data is supposed to give\\n /// the addresses of the Chainlink feeds to read, the stale periods for each feed, ...\\n /// @return targetData Extra data needed to read the target price of the asset\\n function getOracle(address collateral)\\n external\\n view\\n returns (\\n OracleReadType oracleType,\\n OracleReadType targetType,\\n bytes memory oracleData,\\n bytes memory targetData,\\n bytes memory hyperparameters\\n );\\n\\n /// @notice Returns if the associated functionality is paused or not\\n function isPaused(address collateral, ActionType action) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update normalizers\\n function isTrusted(address sender) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update sell rewards\\n function isTrustedSeller(address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` has a non null entry in the `isWhitelistedForType` storage mapping\\n /// @dev Note that ultimately whitelisting may depend as well on external providers\\n function isWhitelistedForType(WhitelistType whitelistType, address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` can deal with `collateral` during burns and redemptions\\n function isWhitelistedForCollateral(address collateral, address sender) external returns (bool);\\n\\n /// @notice Checks whether only whitelisted address can deal with `collateral` during burns and redemptions\\n function isWhitelistedCollateral(address collateral) external view returns (bool);\\n\\n /// @notice Gets the data needed to deal with whitelists for `collateral`\\n function getCollateralWhitelistData(address collateral) external view returns (bytes memory);\\n\\n /// @notice Returns the stablecoin cap for `collateral`\\n function getStablecoinCap(address collateral) external view returns (uint256);\\n\\n /// @notice Returns the address of the `accessManager` contract\\n function accessManager() external view returns (address);\\n\\n /// @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n /// being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n /// attacker controlled calls.\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaa9eba6ee7770d6146fedbfef07ad10ff09524692319ca0cc32abfa64a2b597b\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IHarvester` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IHarvester.sol\\ninterface IHarvester {\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address stablecoin,\\n uint64 targetExposure,\\n uint64 minExposureYieldAsset,\\n uint64 maxExposureYieldAsset,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external;\\n\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) external;\\n\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external;\\n\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) external;\\n}\\n\",\"keccak256\":\"0x0d4e8fee737f4f747060a3c5044c8cb2f153faa228ad37a661a659ca62aab055\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IParallelizer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IDiamondCut } from \\\"./IDiamondCut.sol\\\";\\nimport { IDiamondEtherscan } from \\\"./IDiamondEtherscan.sol\\\";\\nimport { IDiamondLoupe } from \\\"./IDiamondLoupe.sol\\\";\\nimport { IGetters } from \\\"./IGetters.sol\\\";\\nimport { IRedeemer } from \\\"./IRedeemer.sol\\\";\\nimport { IRewardHandler } from \\\"./IRewardHandler.sol\\\";\\nimport { ISettersGovernor, ISettersGuardian } from \\\"./ISetters.sol\\\";\\nimport { ISwapper } from \\\"./ISwapper.sol\\\";\\n\\n/// @title IParallelizer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IParallelizer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IParallelizer.sol\\ninterface IParallelizer is\\n IDiamondCut,\\n IDiamondEtherscan,\\n IDiamondLoupe,\\n IGetters,\\n IRedeemer,\\n IRewardHandler,\\n ISettersGovernor,\\n ISettersGuardian,\\n ISwapper\\n{ }\\n\",\"keccak256\":\"0x8bd964110c6a122bdb6cf58a194a97c894900237ebd7f3b11e2f43c6ee56ae7c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRedeemer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRedeemer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRedeemer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRedeemer.sol\\ninterface IRedeemer {\\n /// @notice Redeems `amount` of stablecoins from the system\\n /// @param receiver Address which should be receiving the output tokens\\n /// @param deadline Timestamp before which the redemption should have occured\\n /// @param minAmountOuts Minimum amount of each token given back in the redemption to obtain\\n /// @return tokens List of tokens returned\\n /// @return amounts Amount given for each token in the `tokens` array\\n function redeem(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Same as the redeem function above with the additional feature to specify a list of `forfeitTokens` for\\n /// which the Parallelizer system will not try to do a transfer to `receiver`.\\n function redeemWithForfeit(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts,\\n address[] memory forfeitTokens\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Simulate the exact output that a redemption of `amount` of stablecoins would give at a given block\\n /// @return tokens List of tokens that would be given\\n /// @return amounts Amount that would be obtained for each token in the `tokens` array\\n function quoteRedemptionCurve(uint256 amount)\\n external\\n view\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Updates the normalizer variable by `amount`\\n function updateNormalizer(uint256 amount, bool increase) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3522ee0380b321c64d02bf2db2acb658d8b314b811dd54b6a718d6708b5fb21\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRewardHandler.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRewardHandler\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRewardHandler` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRewardHandler.sol\\ninterface IRewardHandler {\\n /// @notice Sells some external tokens through a odos call\\n /// @param minAmountOut Minimum amount of the outToken to get\\n /// @param payload Payload to pass to odos\\n /// @return amountOut Amount obtained of the outToken\\n function sellRewards(uint256 minAmountOut, bytes memory payload) external returns (uint256 amountOut);\\n}\\n\",\"keccak256\":\"0xff2afcbc8d1c25297324159d3684a323e60b3c9408129aba70d3d6938d093255\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISettersGovernor` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISetters.sol\\ninterface ISettersGovernor {\\n /// @notice Recovers `amount` of `token` from the Parallelizer contract\\n function recoverERC20(address collateral, IERC20 token, address to, uint256 amount) external;\\n\\n /// @notice Sets a new access manager address\\n function setAccessManager(address _newAccessManager) external;\\n\\n /// @notice Sets (or unsets) a collateral manager `collateral`\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before setting the new manager\\n function setCollateralManager(\\n address collateral,\\n bool checkExternalManagerBalance,\\n ManagerStorage memory managerData\\n )\\n external;\\n\\n /// @notice Sets the allowance of the contract on `token` for `spender` to `amount`\\n function changeAllowance(IERC20 token, address spender, uint256 amount) external;\\n\\n /// @notice Changes the trusted status for `sender` when for selling rewards or updating the normalizer\\n function toggleTrusted(address sender, TrustedType t) external;\\n\\n /// @notice Changes whether a `collateral` can only be handled during burns and redemptions by whitelisted\\n /// addresses\\n /// and sets the data used to read into the whitelist\\n function setWhitelistStatus(address collateral, uint8 whitelistStatus, bytes memory whitelistData) external;\\n\\n /// @notice Add `collateral` as a supported collateral in the system\\n function addCollateral(address collateral) external;\\n\\n /// @notice Adjusts the amount of stablecoins issued from `collateral` by `amount`\\n function adjustStablecoins(address collateral, uint128 amount, bool increase) external;\\n\\n /// @notice Revokes `collateral` from the system\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before revoking the collateral\\n function revokeCollateral(address collateral, bool checkExternalManagerBalance) external;\\n\\n /// @notice Sets the `oracleConfig` used to read the value of `collateral` for the mint, burn and redemption\\n /// operations\\n function setOracle(address collateral, bytes memory oracleConfig) external;\\n\\n /// @notice Update oracle data for a given `collateral`\\n function updateOracle(address collateral) external;\\n}\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface ISettersGuardian {\\n /// @notice Changes the pause status for mint or burn transactions for `collateral`\\n function togglePause(address collateral, ActionType action) external;\\n\\n /// @notice Sets the mint or burn fees for `collateral`\\n function setFees(address collateral, uint64[] memory xFee, int64[] memory yFee, bool mint) external;\\n\\n /// @notice Sets the parameters for the redemption curve\\n function setRedemptionCurveParams(uint64[] memory xFee, int64[] memory yFee) external;\\n\\n /// @notice Changes the whitelist status for a collateral with `whitelistType` for an address `who`\\n function toggleWhitelist(WhitelistType whitelistType, address who) external;\\n\\n /// @notice Sets the stablecoin cap that can be issued from a `collateral`\\n function setStablecoinCap(address collateral, uint256 stablecoinCap) external;\\n}\\n\",\"keccak256\":\"0xc3fb2012e7c2f97ae93b12276afc4293aaeb97a6fe4d60109acaa94ef6945575\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title ISwapper\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISwapper` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISwapper.sol\\ninterface ISwapper {\\n /// @notice Swaps (that is to say mints or burns) an exact amount of `tokenIn` for an amount of `tokenOut`\\n /// @param amountIn Amount of `tokenIn` to bring\\n /// @param amountOutMin Minimum amount of `tokenOut` to get: if `amountOut` is inferior to this amount, the\\n /// function will revert\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountOut Amount of `tokenOut` obtained through the swap\\n function swapExactInput(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Same as `swapExactInput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactInputWithPermit(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Swaps (that is to say mints or burns) an amount of `tokenIn` for an exact amount of `tokenOut`\\n /// @param amountOut Amount of `tokenOut` to obtain from the swap\\n /// @param amountInMax Maximum amount of `tokenIn` to bring in order to get `amountOut` of `tokenOut`\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountIn Amount of `tokenIn` used to perform the swap\\n function swapExactOutput(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Same as `swapExactOutput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactOutputWithPermit(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Simulates what a call to `swapExactInput` with `amountIn` of `tokenIn` for `tokenOut` would give.\\n /// If called right before and at the same block, the `amountOut` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactInput`\\n function quoteIn(uint256 amountIn, address tokenIn, address tokenOut) external view returns (uint256 amountOut);\\n\\n /// @notice Simulates what a call to `swapExactOutput` for `amountOut` of `tokenOut` with `tokenIn` would give.\\n /// If called right before and at the same block, the `amountIn` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactOutput`\\n function quoteOut(uint256 amountOut, address tokenIn, address tokenOut) external view returns (uint256 amountIn);\\n}\\n\",\"keccak256\":\"0x47e4b2742a51b82b9df72fb681335affe8519f4114fb540cd29d8f48ed182ffd\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITokenP.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ITokenP\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @notice Interface for the stablecoins `tokenP` contracts\\n/// @dev This interface is an authorized fork of Angle's `IAgToken` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IAgToken.sol\\ninterface ITokenP is IERC20 {\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MINTER ROLE ONLY FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Lets a whitelisted contract mint tokenPs\\n /// @param account Address to mint to\\n /// @param amount Amount to mint\\n function mint(address account, uint256 amount) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @param sender Address which requested the burn from `burner`\\n /// @dev This method is to be called by a contract with the minter right after being requested\\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\\n /// @dev The method checks the allowance between the `sender` and the `burner`\\n function burnFrom(uint256 amount, address burner, address sender) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @dev This method is to be called by a contract with a minter right on the tokenP after being\\n /// requested to do so by an address willing to burn tokens from its address\\n function burnSelf(uint256 amount, address burner) external;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Amount of decimals of the stablecoin\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x64a1305faa8c5c91767a11af0eae16e4b463aa0bfe10f11b74aae9d96681a5eb\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity >=0.5.0;\\n\\n/// @notice ERC4626 interface\\n/// @author OpenZeppelin\\n/// @dev In this implementation, the interface only contains the functions that the IERC4626 interface adds on top of\\n/// the IERC20 interface\\ninterface IERC4626 {\\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 \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s 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 redeemption 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\",\"keccak256\":\"0xd730d6a6b679201eec89dff3133de651da20b3e72e74f01b734078bfacf952ad\",\"license\":\"GPL-3.0\"},\"contracts/parallelizer/Storage.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n ENUMS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nenum FacetCutAction {\\n Add,\\n Replace,\\n Remove\\n}\\n\\nenum ManagerType {\\n EXTERNAL\\n}\\n\\nenum ActionType {\\n Mint,\\n Burn,\\n Redeem\\n}\\n\\nenum TrustedType {\\n Updater,\\n Seller\\n}\\n\\nenum QuoteType {\\n MintExactInput,\\n MintExactOutput,\\n BurnExactInput,\\n BurnExactOutput\\n}\\n\\nenum OracleReadType {\\n CHAINLINK_FEEDS,\\n EXTERNAL,\\n NO_ORACLE,\\n STABLE,\\n WSTETH,\\n CBETH,\\n RETH,\\n SFRXETH,\\n MAX,\\n MORPHO_ORACLE\\n}\\n\\nenum OracleQuoteType {\\n UNIT,\\n TARGET\\n}\\n\\nenum WhitelistType {\\n BACKED\\n}\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n STRUCTS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nstruct Permit2Details {\\n address to; // Address that will receive the funds\\n uint256 nonce; // Nonce of the transaction\\n bytes signature; // Permit signature of the user\\n}\\n\\nstruct FacetCut {\\n address facetAddress; // Facet contract address\\n FacetCutAction action; // Can be add, remove or replace\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct Facet {\\n address facetAddress; // Facet contract address\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct FacetInfo {\\n address facetAddress; // Facet contract address\\n uint16 selectorPosition; // Position in the list of all selectors\\n}\\n\\nstruct DiamondStorage {\\n bytes4[] selectors; // List of all available selectors\\n mapping(bytes4 => FacetInfo) selectorInfo; // Selector to (address, position in list)\\n IAccessManager accessManager; // Contract handling access management\\n}\\n\\nstruct ImplementationStorage {\\n address implementation; // Dummy implementation address for Etherscan usability\\n}\\n\\nstruct ManagerStorage {\\n IERC20[] subCollaterals; // Subtokens handled by the manager or strategies\\n bytes config; // Additional configuration data\\n}\\n\\nstruct Collateral {\\n uint8 isManaged; // If the collateral is managed through external strategies\\n uint8 isMintLive; // If minting from this asset is unpaused\\n uint8 isBurnLive; // If burning to this asset is unpaused\\n uint8 decimals; // IERC20Metadata(collateral).decimals()\\n uint8 onlyWhitelisted; // If only whitelisted addresses can burn or redeem for this token\\n uint216 normalizedStables; // Normalized amount of stablecoins issued from this collateral\\n uint64[] xFeeMint; // Increasing exposures in [0,BASE_9[\\n int64[] yFeeMint; // Mint fees at the exposures specified in `xFeeMint`\\n uint64[] xFeeBurn; // Decreasing exposures in ]0,BASE_9]\\n int64[] yFeeBurn; // Burn fees at the exposures specified in `xFeeBurn`\\n bytes oracleConfig; // Data about the oracle used for the collateral\\n bytes whitelistData; // For whitelisted collateral, data used to verify whitelists\\n ManagerStorage managerData; // For managed collateral, data used to handle the strategies\\n uint256 stablecoinCap; // Cap on the amount of stablecoins that can be issued from this collateral\\n}\\n\\nstruct ParallelizerStorage {\\n ITokenP tokenP; // tokenP handled by the system\\n uint8 isRedemptionLive; // If redemption is unpaused\\n uint8 statusReentrant; // If call is reentrant or not\\n bool consumingSchedule; // If the contract is consuming a scheduled operation\\n uint128 normalizedStables; // Normalized amount of stablecoins issued by the system\\n uint128 normalizer; // To reconcile `normalizedStables` values with the actual amount\\n address[] collateralList; // List of collateral assets supported by the system\\n uint64[] xRedemptionCurve; // Increasing collateral ratios > 0\\n int64[] yRedemptionCurve; // Value of the redemption fees at `xRedemptionCurve`\\n mapping(address => Collateral) collaterals; // Maps a collateral asset to its parameters\\n mapping(address => uint256) isTrusted; // If an address is trusted to update the normalizer value\\n mapping(address => uint256) isSellerTrusted; // If an address is trusted to sell accruing reward tokens or to run\\n // keeper jobs on oracles\\n mapping(WhitelistType => mapping(address => uint256)) isWhitelistedForType;\\n}\\n// Whether an address is whitelisted for a specific whitelist type\\n\",\"keccak256\":\"0x3f4313dd110dbe390038320b2d3cf24dcbe9b75cd9573e7f048f7233c02dd227\",\"license\":\"BUSL-1.1\"},\"contracts/utils/AccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { AuthorityUtils } from \\\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { IAccessManaged } from \\\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\\\";\\nimport { Context } from \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title AccessControl\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Fork of OpenZeppelin's `AccessManaged` contract\\n/// updated to make _checkCanCall to return bool\\n/// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/manager/AccessManaged.sol\\ncontract AccessManaged is Context, IAccessManaged {\\n address private _authority;\\n\\n bool private _consumingSchedule;\\n\\n /**\\n * @dev Initializes the contract connected to an initial authority.\\n */\\n constructor(address initialAuthority) {\\n _setAuthority(initialAuthority);\\n }\\n\\n /**\\n * @dev Restricts access to a function as defined by the connected Authority for this contract and the\\n * caller and selector of the function that entered the contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * In general, this modifier should only be used on `external` functions. It is okay to use it on `public`\\n * functions that are used as external entry points and are not called internally. Unless you know what you're\\n * doing, it should never be used on `internal` functions. Failure to follow these rules can have critical security\\n * implications! This is because the permissions are determined by the function that entered the contract, i.e. the\\n * function at the bottom of the call stack, and not the function where the modifier is visible in the source code.\\n * ====\\n *\\n * [WARNING]\\n * ====\\n * Avoid adding this modifier to the\\n * https://docs.soliditylang.org/en/v0.8.20/contracts.html#receive-ether-function[`receive()`]\\n * function or the https://docs.soliditylang.org/en/v0.8.20/contracts.html#fallback-function[`fallback()`]. These\\n * functions are the only execution paths where a function selector cannot be unambiguously determined from the\\n * calldata\\n * since the selector defaults to `0x00000000` in the `receive()` function and similarly in the `fallback()`\\n * function\\n * if no calldata is provided. (See {_checkCanCall}).\\n *\\n * The `receive()` function will always panic whereas the `fallback()` may panic depending on the calldata length.\\n * ====\\n */\\n modifier restricted() {\\n address caller = _msgSender();\\n require(_checkCanCall(caller, _msgData()), AccessManagedUnauthorized(caller));\\n _;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function authority() public view virtual returns (address) {\\n return _authority;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function setAuthority(address newAuthority) public virtual {\\n address caller = _msgSender();\\n if (caller != authority()) {\\n revert AccessManagedUnauthorized(caller);\\n }\\n if (newAuthority.code.length == 0) {\\n revert AccessManagedInvalidAuthority(newAuthority);\\n }\\n _setAuthority(newAuthority);\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function isConsumingScheduledOp() public view returns (bytes4) {\\n return _consumingSchedule ? this.isConsumingScheduledOp.selector : bytes4(0);\\n }\\n\\n /**\\n * @dev Transfers control to a new authority. Internal function with no access restriction. Allows bypassing the\\n * permissions set by the current authority.\\n */\\n function _setAuthority(address newAuthority) internal virtual {\\n _authority = newAuthority;\\n emit AuthorityUpdated(newAuthority);\\n }\\n\\n function _checkCanCall(address caller, bytes calldata data) internal virtual returns (bool) {\\n (bool immediate, uint32 delay) =\\n AuthorityUtils.canCallWithDelay(authority(), caller, address(this), bytes4(data[0:4]));\\n if (!immediate) {\\n if (delay > 0) {\\n _consumingSchedule = true;\\n IAccessManager(authority()).consumeScheduledOp(caller, data);\\n _consumingSchedule = false;\\n } else {\\n return false;\\n }\\n }\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x40dfee0e736695b3005df6c150a2d794ac06f3f4b91745e2959623e770044798\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nerror AccessManagedUnauthorized(address caller);\\nerror AlreadyAdded();\\nerror CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector);\\nerror CannotAddSelectorsToZeroAddress(bytes4[] _selectors);\\nerror CannotRemoveFunctionThatDoesNotExist(bytes4 _selector);\\nerror CannotRemoveImmutableFunction(bytes4 _selector);\\nerror CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors);\\nerror CannotReplaceFunctionThatDoesNotExists(bytes4 _selector);\\nerror CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector);\\nerror CannotReplaceImmutableFunction(bytes4 _selector);\\nerror ContractHasNoCode();\\nerror CollateralBacked();\\nerror FunctionNotFound(bytes4 _functionSelector);\\nerror IncorrectFacetCutAction(uint8 _action);\\nerror InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);\\nerror InvalidChainlinkRate();\\nerror InvalidLengths();\\nerror InvalidNegativeFees();\\nerror InvalidOracleType();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidRate();\\nerror InvalidSwap();\\nerror InvalidTokens();\\nerror InvalidAccessManager();\\nerror ManagerHasAssets();\\nerror NoSelectorsProvidedForFacetForCut(address _facetAddress);\\nerror NotAllowed();\\nerror NotCollateral();\\nerror NotGovernor();\\nerror NotGuardian();\\nerror NotTrusted();\\nerror NotTrustedOrGuardian();\\nerror NotWhitelisted();\\nerror OdosSwapFailed();\\nerror OracleUpdateFailed();\\nerror Paused();\\nerror ReentrantCall();\\nerror RemoveFacetAddressMustBeZeroAddress(address _facetAddress);\\nerror TooBigAmountIn();\\nerror TooLate();\\nerror TooSmallAmountOut();\\nerror ZeroAddress();\\nerror ZeroAmount();\\nerror SwapError();\\nerror SlippageTooHigh();\\nerror InsufficientFunds();\\n\",\"keccak256\":\"0x1e2f6812ef78e948e5155d32213b52afff8c0ba5463d18bee10694efbf886130\",\"license\":\"BUSL-1.1\"}},\"version\":1}", - "bytecode": "0x60e080604052346101e95760c08161278a803803809161001f828561020f565b8339810103126101e95761003281610246565b9061003f60208201610246565b6040820151926001600160a01b038416918285036101e95760608401516001600160a01b03811681036101e95760a061007a60808701610246565b950151956001600160a01b038716958688036101e9575f80546001600160a01b0319166001600160a01b0390921691821790556040519081527f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90602090a160a052608052600480546001600160a01b039283166001600160a01b0319918216179091556005805493909216921691909117905581156102005760446020925f9460c052604051948593849263095ea7b360e01b84526004840152811960248401525af180156101f5576101b9575b60405161252f908161025b823960805181818161027601528181610ce401528181610e1b01528181611d1901526120ab015260a0518181816103bf0152818161066a01528181610e480152818161155201526115d9015260c05181818161040701528181610d5901526115960152f35b6020813d6020116101ed575b816101d26020938361020f565b810103126101e95751801515036101e9575f610149565b5f80fd5b3d91506101c5565b6040513d5f823e3d90fd5b63d92e233d60e01b5f5260045ffd5b601f909101601f19168101906001600160401b0382119082101761023257604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101e95756fe60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220ec283012c4b4807e318035ba023be8591bf414e2388206dea6cd585b6cb7364064736f6c634300081c0033", - "deployedBytecode": "0x60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220ec283012c4b4807e318035ba023be8591bf414e2388206dea6cd585b6cb7364064736f6c634300081c0033", - "devdoc": { - "author": "Cooper Labs", - "custom:contact": "security@cooperlabs.xyz", - "details": "Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol", - "errors": { - "SafeERC20FailedOperation(address)": [ - { - "details": "An operation with an ERC-20 token failed." - } - ] - }, - "events": { - "AuthorityUpdated(address)": { - "details": "Authority that manages this contract was updated." - } - }, - "kind": "dev", - "methods": { - "addBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to add to the budget", - "receiver": "address of the receiver" - } - }, - "authority()": { - "details": "Returns the current authority." - }, - "computeRebalanceAmount(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - }, - "returns": { - "amount": "amount to be rebalanced", - "increase": "whether the exposure should be increased" - } - }, - "harvest(address,uint256,bytes)": { - "details": "This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage" - }, - "isConsumingScheduledOp()": { - "details": "Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls." - }, - "onFlashLoan(address,address,uint256,uint256,bytes)": { - "details": "Receive a flash loan.", - "params": { - "amount": "The amount of tokens lent.", - "data": "Arbitrary data structure, intended to contain user-defined parameters.", - "fee": "The additional amount of tokens to repay.", - "initiator": "The initiator of the loan.", - "token": "The loan currency." - }, - "returns": { - "_0": "The keccak256 hash of \"ERC3156FlashBorrower.onFlashLoan\"" - } - }, - "recoverERC20(address,uint256,address)": { - "params": { - "amountToRecover": "amount to recover", - "to": "address to send the recovered tokens", - "tokenAddress": "address of the token to recover" - } - }, - "removeBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to remove from the budget", - "receiver": "address of the receiver" - } - }, - "setAuthority(address)": { - "details": "Transfers control to a new authority. The caller must be the current authority." - }, - "setMaxSlippage(address,uint96)": { - "params": { - "newMaxSlippage": "new max allowed slippage" - } - }, - "setSwapRouter(address)": { - "params": { - "newSwapRouter": "address of the swap router" - } - }, - "setTargetExposure(address,uint64)": { - "params": { - "targetExposure": "target exposure to the yield bearing asset used", - "yieldBearingAsset": "address of the yield bearing asset" - } - }, - "setTokenTransferAddress(address)": { - "params": { - "newTokenTransferAddress": "address of the token transfer contract" - } - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "params": { - "asset": "address of the asset", - "maxExposure": "maximum exposure within the Parallelizer to the asset", - "minExposure": "minimum exposure within the Parallelizer to the asset", - "overrideExposures": "whether limit exposures should be overriden or read onchain through the Parallelizer", - "targetExposure": "target exposure to the yieldBearingAsset asset used", - "yieldBearingAsset": "address of the yieldBearingAsset" - } - }, - "toggleTrusted(address)": { - "params": { - "trusted": "address to toggle the trusted status" - } - }, - "updateLimitExposuresYieldAsset(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - } - } - }, - "title": "GenericHarvester", - "version": 1 - }, - "userdoc": { - "events": { - "SwapRouterUpdated(address)": { - "notice": "Event emitted when the swap router is updated" - }, - "TokenTransferAddressUpdated(address)": { - "notice": "Event emitted when the token proxy is updated" - } - }, - "kind": "user", - "methods": { - "addBudget(uint256,address)": { - "notice": "Add budget to be spent by the receiver during the flashloan" - }, - "budget(address)": { - "notice": "Budget of tokenP available for each users" - }, - "computeRebalanceAmount(address)": { - "notice": "Compute the amount needed to rebalance the Parallelizer" - }, - "flashloan()": { - "notice": "Parallel stablecoin flashloan contract" - }, - "harvest(address,uint256,bytes)": { - "notice": "Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset" - }, - "isTrusted(address)": { - "notice": "trusted addresses that can update target exposure and do others non critical operations" - }, - "maxTokenSlippage(address)": { - "notice": "Max slippage when dealing with the Parallelizer" - }, - "parallelizer()": { - "notice": "Reference to the `parallelizer` implementation this contract aims at rebalancing" - }, - "recoverERC20(address,uint256,address)": { - "notice": "Recover ERC20 tokens" - }, - "removeBudget(uint256,address)": { - "notice": "Remove budget from the owner and send it to the receiver" - }, - "setMaxSlippage(address,uint96)": { - "notice": "Set the max allowed slippage" - }, - "setSwapRouter(address)": { - "notice": "Set the swap router" - }, - "setTargetExposure(address,uint64)": { - "notice": "Set the target exposure of a yield bearing asset" - }, - "setTokenTransferAddress(address)": { - "notice": "Set the token transfer address" - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "notice": "Set the yieldBearingAsset data" - }, - "swapRouter()": { - "notice": "address of the router/aggregator" - }, - "toggleTrusted(address)": { - "notice": "Toggle the trusted status of an address" - }, - "tokenP()": { - "notice": "TokenP handled by the `parallelizer` of interest" - }, - "tokenTransferAddress()": { - "notice": "address to approve to transfer tokens to" - }, - "updateLimitExposuresYieldAsset(address)": { - "notice": "Set the limit exposures to the asset linked to the yield bearing asset" - }, - "yieldBearingData(address)": { - "notice": "Data associated to a yield bearing asset" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 22996, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_authority", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 22998, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_consumingSchedule", - "offset": 20, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 8228, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxTokenSlippage", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_uint96)" - }, - { - "astId": 8234, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "yieldBearingData", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)" - }, - { - "astId": 8239, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "isTrusted", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 43, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "swapRouter", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 46, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "tokenTransferAddress", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 8955, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "budget", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct YieldBearingParams)", - "numberOfBytes": "32", - "value": "t_struct(YieldBearingParams)8169_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_address,t_uint96)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint96)", - "numberOfBytes": "32", - "value": "t_uint96" - }, - "t_struct(YieldBearingParams)8169_storage": { - "encoding": "inplace", - "label": "struct YieldBearingParams", - "members": [ - { - "astId": 8158, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "asset", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 8160, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "targetExposure", - "offset": 20, - "slot": "0", - "type": "t_uint64" - }, - { - "astId": 8162, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxExposure", - "offset": 0, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8164, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "minExposure", - "offset": 8, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8166, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "overrideExposures", - "offset": 16, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8168, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxSlippage", - "offset": 0, - "slot": "2", - "type": "t_uint96" - } - ], - "numberOfBytes": "96" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint64": { - "encoding": "inplace", - "label": "uint64", - "numberOfBytes": "8" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } - } -} \ No newline at end of file diff --git a/deployments/hyperevm/GenericHarvester_USDp.json b/deployments/hyperevm/GenericHarvester_USDp.json deleted file mode 100644 index e1ef8fc..0000000 --- a/deployments/hyperevm/GenericHarvester_USDp.json +++ /dev/null @@ -1,1124 +0,0 @@ -{ - "address": "0x57770C1721Eb35509f38210A935c8b1911db7E0e", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "initialTokenTransferAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "initialSwapRouter", - "type": "address" - }, - { - "internalType": "contract ITokenP", - "name": "definitivetokenP", - "type": "address" - }, - { - "internalType": "contract IParallelizer", - "name": "definitiveParallelizer", - "type": "address" - }, - { - "internalType": "address", - "name": "initialAuthority", - "type": "address" - }, - { - "internalType": "contract IERC3156FlashLender", - "name": "definitiveFlashloan", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AccessManagedInvalidAuthority", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "internalType": "uint32", - "name": "delay", - "type": "uint32" - } - ], - "name": "AccessManagedRequiredDelay", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "AccessManagedUnauthorized", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidParam", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrusted", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrustedOrGuardian", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", - "type": "error" - }, - { - "inputs": [], - "name": "SwapError", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAmount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "SwapRouterUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "TokenTransferAddressUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "trusted", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "status", - "type": "bool" - } - ], - "name": "TrustedToggled", - "type": "event" - }, - { - "inputs": [], - "name": "CALLBACK_SUCCESS", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "addBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "authority", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "budget", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "computeRebalanceAmount", - "outputs": [ - { - "internalType": "uint8", - "name": "increase", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "flashloan", - "outputs": [ - { - "internalType": "contract IERC3156FlashLender", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "scale", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "name": "harvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isConsumingScheduledOp", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isTrusted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "initiator", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "onFlashLoan", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "parallelizer", - "outputs": [ - { - "internalType": "contract IParallelizer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToRecover", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "recoverERC20", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "removeBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAuthority", - "type": "address" - } - ], - "name": "setAuthority", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint96", - "name": "newMaxSlippage", - "type": "uint96" - } - ], - "name": "setMaxSlippage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "setSwapRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - } - ], - "name": "setTargetExposure", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "setTokenTransferAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "name": "setYieldBearingAssetData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapRouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "trusted", - "type": "address" - } - ], - "name": "toggleTrusted", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "tokenP", - "outputs": [ - { - "internalType": "contract ITokenP", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenTransferAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "updateLimitExposuresYieldAsset", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "yieldBearingData", - "outputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x6c350767c797c798d57bc744249b0a5a16583184117d70fbfd341c0218768067", - "receipt": { - "to": null, - "from": "0x66CcEC236bbcE5f1bBd1b2fC0a4014e57A55ad02", - "contractAddress": "0x57770C1721Eb35509f38210A935c8b1911db7E0e", - "transactionIndex": 0, - "gasUsed": "2210613", - "logsBloom": "0x08000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000200000000000000000000000000000000000000000100100000000000800000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000040000000000000009000000000002000000000000000000020000000000000000000000080000000000000000000000000000000000000000000000000000000000100000000000200000000000000000000000000000000210000000000000000008000000000000000000000000000000000000000000", - "blockHash": "0xe3c06780634d363711f4758fa230c97447200aeeefe7732b7a7cc015cfc5428a", - "transactionHash": "0x6c350767c797c798d57bc744249b0a5a16583184117d70fbfd341c0218768067", - "logs": [ - { - "transactionIndex": 0, - "blockNumber": 6538100, - "transactionHash": "0x6c350767c797c798d57bc744249b0a5a16583184117d70fbfd341c0218768067", - "address": "0x57770C1721Eb35509f38210A935c8b1911db7E0e", - "topics": [ - "0x2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad" - ], - "data": "0x000000000000000000000000fd28f108e95f4d41daae9dbfff707d677985998e", - "logIndex": 0, - "blockHash": "0xe3c06780634d363711f4758fa230c97447200aeeefe7732b7a7cc015cfc5428a" - }, - { - "transactionIndex": 0, - "blockNumber": 6538100, - "transactionHash": "0x6c350767c797c798d57bc744249b0a5a16583184117d70fbfd341c0218768067", - "address": "0xBE65F0F410A72BeC163dC65d46c83699e957D588", - "topics": [ - "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", - "0x00000000000000000000000057770c1721eb35509f38210a935c8b1911db7e0e", - "0x00000000000000000000000015452454a9735d68df430879b2941316a09295b1" - ], - "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "logIndex": 1, - "blockHash": "0xe3c06780634d363711f4758fa230c97447200aeeefe7732b7a7cc015cfc5428a" - } - ], - "blockNumber": 6538100, - "cumulativeGasUsed": "2210613", - "status": 1, - "byzantium": true - }, - "args": [ - "0x744489ee3d540777a66f2cf297479745e0852f7a", - "0x744489ee3d540777a66f2cf297479745e0852f7a", - "0xBE65F0F410A72BeC163dC65d46c83699e957D588", - "0x1250304F66404cd153fA39388DDCDAec7E0f1707", - "0xfD28f108e95f4D41daAE9dbfFf707D677985998E", - "0x15452454A9735D68df430879B2941316a09295B1" - ], - "numDeployments": 1, - "solcInputHash": "ac7717979711c6e452015444ccc68db6", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialTokenTransferAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialSwapRouter\",\"type\":\"address\"},{\"internalType\":\"contract ITokenP\",\"name\":\"definitivetokenP\",\"type\":\"address\"},{\"internalType\":\"contract IParallelizer\",\"name\":\"definitiveParallelizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAuthority\",\"type\":\"address\"},{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"definitiveFlashloan\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AccessManagedInvalidAuthority\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"AccessManagedRequiredDelay\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"AccessManagedUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrustedOrGuardian\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SwapError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"SwapRouterUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"TokenTransferAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CALLBACK_SUCCESS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"addBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"authority\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"budget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"computeRebalanceAmount\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"increase\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flashloan\",\"outputs\":[{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"scale\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"harvest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isConsumingScheduledOp\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isTrusted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxTokenSlippage\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onFlashLoan\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parallelizer\",\"outputs\":[{\"internalType\":\"contract IParallelizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"removeBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAuthority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"newMaxSlippage\",\"type\":\"uint96\"}],\"name\":\"setMaxSlippage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"setSwapRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"}],\"name\":\"setTargetExposure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"setTokenTransferAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"name\":\"setYieldBearingAssetData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenP\",\"outputs\":[{\"internalType\":\"contract ITokenP\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenTransferAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"updateLimitExposuresYieldAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"yieldBearingData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Cooper Labs\",\"custom:contact\":\"security@cooperlabs.xyz\",\"details\":\"Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\",\"errors\":{\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"AuthorityUpdated(address)\":{\"details\":\"Authority that manages this contract was updated.\"}},\"kind\":\"dev\",\"methods\":{\"addBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to add to the budget\",\"receiver\":\"address of the receiver\"}},\"authority()\":{\"details\":\"Returns the current authority.\"},\"computeRebalanceAmount(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"},\"returns\":{\"amount\":\"amount to be rebalanced\",\"increase\":\"whether the exposure should be increased\"}},\"harvest(address,uint256,bytes)\":{\"details\":\"This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage\"},\"isConsumingScheduledOp()\":{\"details\":\"Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls.\"},\"onFlashLoan(address,address,uint256,uint256,bytes)\":{\"details\":\"Receive a flash loan.\",\"params\":{\"amount\":\"The amount of tokens lent.\",\"data\":\"Arbitrary data structure, intended to contain user-defined parameters.\",\"fee\":\"The additional amount of tokens to repay.\",\"initiator\":\"The initiator of the loan.\",\"token\":\"The loan currency.\"},\"returns\":{\"_0\":\"The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\"}},\"recoverERC20(address,uint256,address)\":{\"params\":{\"amountToRecover\":\"amount to recover\",\"to\":\"address to send the recovered tokens\",\"tokenAddress\":\"address of the token to recover\"}},\"removeBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to remove from the budget\",\"receiver\":\"address of the receiver\"}},\"setAuthority(address)\":{\"details\":\"Transfers control to a new authority. The caller must be the current authority.\"},\"setMaxSlippage(address,uint96)\":{\"params\":{\"newMaxSlippage\":\"new max allowed slippage\"}},\"setSwapRouter(address)\":{\"params\":{\"newSwapRouter\":\"address of the swap router\"}},\"setTargetExposure(address,uint64)\":{\"params\":{\"targetExposure\":\"target exposure to the yield bearing asset used\",\"yieldBearingAsset\":\"address of the yield bearing asset\"}},\"setTokenTransferAddress(address)\":{\"params\":{\"newTokenTransferAddress\":\"address of the token transfer contract\"}},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"params\":{\"asset\":\"address of the asset\",\"maxExposure\":\"maximum exposure within the Parallelizer to the asset\",\"minExposure\":\"minimum exposure within the Parallelizer to the asset\",\"overrideExposures\":\"whether limit exposures should be overriden or read onchain through the Parallelizer\",\"targetExposure\":\"target exposure to the yieldBearingAsset asset used\",\"yieldBearingAsset\":\"address of the yieldBearingAsset\"}},\"toggleTrusted(address)\":{\"params\":{\"trusted\":\"address to toggle the trusted status\"}},\"updateLimitExposuresYieldAsset(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"}}},\"title\":\"GenericHarvester\",\"version\":1},\"userdoc\":{\"events\":{\"SwapRouterUpdated(address)\":{\"notice\":\"Event emitted when the swap router is updated\"},\"TokenTransferAddressUpdated(address)\":{\"notice\":\"Event emitted when the token proxy is updated\"}},\"kind\":\"user\",\"methods\":{\"addBudget(uint256,address)\":{\"notice\":\"Add budget to be spent by the receiver during the flashloan\"},\"budget(address)\":{\"notice\":\"Budget of tokenP available for each users\"},\"computeRebalanceAmount(address)\":{\"notice\":\"Compute the amount needed to rebalance the Parallelizer\"},\"flashloan()\":{\"notice\":\"Parallel stablecoin flashloan contract\"},\"harvest(address,uint256,bytes)\":{\"notice\":\"Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset\"},\"isTrusted(address)\":{\"notice\":\"trusted addresses that can update target exposure and do others non critical operations\"},\"maxTokenSlippage(address)\":{\"notice\":\"Max slippage when dealing with the Parallelizer\"},\"parallelizer()\":{\"notice\":\"Reference to the `parallelizer` implementation this contract aims at rebalancing\"},\"recoverERC20(address,uint256,address)\":{\"notice\":\"Recover ERC20 tokens\"},\"removeBudget(uint256,address)\":{\"notice\":\"Remove budget from the owner and send it to the receiver\"},\"setMaxSlippage(address,uint96)\":{\"notice\":\"Set the max allowed slippage\"},\"setSwapRouter(address)\":{\"notice\":\"Set the swap router\"},\"setTargetExposure(address,uint64)\":{\"notice\":\"Set the target exposure of a yield bearing asset\"},\"setTokenTransferAddress(address)\":{\"notice\":\"Set the token transfer address\"},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"notice\":\"Set the yieldBearingAsset data\"},\"swapRouter()\":{\"notice\":\"address of the router/aggregator\"},\"toggleTrusted(address)\":{\"notice\":\"Toggle the trusted status of an address\"},\"tokenP()\":{\"notice\":\"TokenP handled by the `parallelizer` of interest\"},\"tokenTransferAddress()\":{\"notice\":\"address to approve to transfer tokens to\"},\"updateLimitExposuresYieldAsset(address)\":{\"notice\":\"Set the limit exposures to the asset linked to the yield bearing asset\"},\"yieldBearingData(address)\":{\"notice\":\"Data associated to a yield bearing asset\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/helpers/GenericHarvester.sol\":\"GenericHarvester\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@helpers/RouterSwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20, IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/// @title Swapper\\n/// @author Angle Labs, Inc.\\n/// @dev Abstract contract for swapping tokens using a router/aggregator\\n/// @dev This contract is an authorized fork of Angle's `RouterSwapper` contract\\n/// https://github.com/AngleProtocol/utils/blob/main/src/RouterSwapper.sol\\nabstract contract RouterSwapper {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERRORS\\n //////////////////////////////////////////////////////////////*/\\n\\n error SwapError();\\n error ZeroAddress();\\n\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Event emitted when the swap router is updated\\n */\\n event SwapRouterUpdated(address newSwapRouter);\\n /**\\n * @notice Event emitted when the token proxy is updated\\n */\\n event TokenTransferAddressUpdated(address newTokenTransferAddress);\\n\\n /*//////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////*/\\n\\n modifier noZeroAddress(address targetAddress) {\\n if (targetAddress == address(0)) {\\n revert ZeroAddress();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n MUTABLE VARIABLES\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice address of the router/aggregator\\n */\\n address public swapRouter;\\n /**\\n * @notice address to approve to transfer tokens to\\n */\\n address public tokenTransferAddress;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address initialSwapRouter, address initialTokenTransferAddress) {\\n swapRouter = initialSwapRouter;\\n tokenTransferAddress = initialTokenTransferAddress;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the router/aggregator address\\n * @param newSwapRouter address of the new router/aggregator\\n */\\n function setSwapRouter(address newSwapRouter) public virtual noZeroAddress(newSwapRouter) {\\n swapRouter = newSwapRouter;\\n\\n emit SwapRouterUpdated(newSwapRouter);\\n }\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the new token transfer address\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress)\\n public\\n virtual\\n noZeroAddress(newTokenTransferAddress)\\n {\\n tokenTransferAddress = newTokenTransferAddress;\\n\\n emit TokenTransferAddressUpdated(newTokenTransferAddress);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n SWAP FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Approve the router/aggregator to spend the token if needed\\n * @param token address of the token to approve\\n * @param spender address of the router/aggregator\\n * @param amount amount to approve\\n */\\n function _approveTokenIfNeeded(address token, address spender, uint256 amount) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), spender);\\n if (allowance < amount) {\\n IERC20(token).safeIncreaseAllowance(spender, amount - allowance);\\n }\\n }\\n\\n /**\\n * @notice Perform the swap using the router/aggregator\\n * @param callData bytes to call the router/aggregator\\n */\\n function _performRouterSwap(bytes memory callData) internal {\\n (bool success, bytes memory retData) = swapRouter.call(callData);\\n\\n if (!success) {\\n if (retData.length != 0) {\\n assembly (\\\"memory-safe\\\") {\\n revert(add(32, retData), mload(retData))\\n }\\n }\\n revert SwapError();\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swapCalldata(address[] calldata tokens, bytes[] calldata callDatas, uint256[] calldata amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swap(address[] memory tokens, bytes[] memory callDatas, uint256[] memory amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8c5a6b026a95816806814ef681b6b225ea4c405a39a4eab0111921853202829c\",\"license\":\"GPL-3.0\"},\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/AuthorityUtils.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\nlibrary AuthorityUtils {\\n /**\\n * @dev Since `AccessManager` implements an extended IAuthority interface, invoking `canCall` with backwards compatibility\\n * for the preexisting `IAuthority` interface requires special care to avoid reverting on insufficient return data.\\n * This helper function takes care of invoking `canCall` in a backwards compatible way without reverting.\\n */\\n function canCallWithDelay(\\n address authority,\\n address caller,\\n address target,\\n bytes4 selector\\n ) internal view returns (bool immediate, uint32 delay) {\\n (bool success, bytes memory data) = authority.staticcall(\\n abi.encodeCall(IAuthority.canCall, (caller, target, selector))\\n );\\n if (success) {\\n if (data.length >= 0x40) {\\n (immediate, delay) = abi.decode(data, (bool, uint32));\\n } else if (data.length >= 0x20) {\\n immediate = abi.decode(data, (bool));\\n }\\n }\\n return (immediate, delay);\\n }\\n}\\n\",\"keccak256\":\"0xb3875997b0d8705e29aa20fee88e1dfef93df438794ae1ad8ba2eb016a4dd4e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAccessManaged.sol)\\n\\npragma solidity ^0.8.20;\\n\\ninterface IAccessManaged {\\n /**\\n * @dev Authority that manages this contract was updated.\\n */\\n event AuthorityUpdated(address authority);\\n\\n error AccessManagedUnauthorized(address caller);\\n error AccessManagedRequiredDelay(address caller, uint32 delay);\\n error AccessManagedInvalidAuthority(address authority);\\n\\n /**\\n * @dev Returns the current authority.\\n */\\n function authority() external view returns (address);\\n\\n /**\\n * @dev Transfers control to a new authority. The caller must be the current authority.\\n */\\n function setAuthority(address) external;\\n\\n /**\\n * @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n * being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n * attacker controlled calls.\\n */\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaba93d42cd70e1418782951132d97b31ddce5f50ad81090884b6d0e41caac9d6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (access/manager/IAccessManager.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Time} from \\\"../../utils/types/Time.sol\\\";\\n\\ninterface IAccessManager {\\n /**\\n * @dev A delayed operation was scheduled.\\n */\\n event OperationScheduled(\\n bytes32 indexed operationId,\\n uint32 indexed nonce,\\n uint48 schedule,\\n address caller,\\n address target,\\n bytes data\\n );\\n\\n /**\\n * @dev A scheduled operation was executed.\\n */\\n event OperationExecuted(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev A scheduled operation was canceled.\\n */\\n event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev Informational labelling for a roleId.\\n */\\n event RoleLabel(uint64 indexed roleId, string label);\\n\\n /**\\n * @dev Emitted when `account` is granted `roleId`.\\n *\\n * NOTE: The meaning of the `since` argument depends on the `newMember` argument.\\n * If the role is granted to a new member, the `since` argument indicates when the account becomes a member of the role,\\n * otherwise it indicates the execution delay for this account and roleId is updated.\\n */\\n event RoleGranted(uint64 indexed roleId, address indexed account, uint32 delay, uint48 since, bool newMember);\\n\\n /**\\n * @dev Emitted when `account` membership or `roleId` is revoked. Unlike granting, revoking is instantaneous.\\n */\\n event RoleRevoked(uint64 indexed roleId, address indexed account);\\n\\n /**\\n * @dev Role acting as admin over a given `roleId` is updated.\\n */\\n event RoleAdminChanged(uint64 indexed roleId, uint64 indexed admin);\\n\\n /**\\n * @dev Role acting as guardian over a given `roleId` is updated.\\n */\\n event RoleGuardianChanged(uint64 indexed roleId, uint64 indexed guardian);\\n\\n /**\\n * @dev Grant delay for a given `roleId` will be updated to `delay` when `since` is reached.\\n */\\n event RoleGrantDelayChanged(uint64 indexed roleId, uint32 delay, uint48 since);\\n\\n /**\\n * @dev Target mode is updated (true = closed, false = open).\\n */\\n event TargetClosed(address indexed target, bool closed);\\n\\n /**\\n * @dev Role required to invoke `selector` on `target` is updated to `roleId`.\\n */\\n event TargetFunctionRoleUpdated(address indexed target, bytes4 selector, uint64 indexed roleId);\\n\\n /**\\n * @dev Admin delay for a given `target` will be updated to `delay` when `since` is reached.\\n */\\n event TargetAdminDelayUpdated(address indexed target, uint32 delay, uint48 since);\\n\\n error AccessManagerAlreadyScheduled(bytes32 operationId);\\n error AccessManagerNotScheduled(bytes32 operationId);\\n error AccessManagerNotReady(bytes32 operationId);\\n error AccessManagerExpired(bytes32 operationId);\\n error AccessManagerLockedRole(uint64 roleId);\\n error AccessManagerBadConfirmation();\\n error AccessManagerUnauthorizedAccount(address msgsender, uint64 roleId);\\n error AccessManagerUnauthorizedCall(address caller, address target, bytes4 selector);\\n error AccessManagerUnauthorizedConsume(address target);\\n error AccessManagerUnauthorizedCancel(address msgsender, address caller, address target, bytes4 selector);\\n error AccessManagerInvalidInitialAdmin(address initialAdmin);\\n\\n /**\\n * @dev Check if an address (`caller`) is authorised to call a given function on a given contract directly (with\\n * no restriction). Additionally, it returns the delay needed to perform the call indirectly through the {schedule}\\n * & {execute} workflow.\\n *\\n * This function is usually called by the targeted contract to control immediate execution of restricted functions.\\n * Therefore we only return true if the call can be performed without any delay. If the call is subject to a\\n * previously set delay (not zero), then the function should return false and the caller should schedule the operation\\n * for future execution.\\n *\\n * If `immediate` is true, the delay can be disregarded and the operation can be immediately executed, otherwise\\n * the operation can be executed if and only if delay is greater than 0.\\n *\\n * NOTE: The IAuthority interface does not include the `uint32` delay. This is an extension of that interface that\\n * is backward compatible. Some contracts may thus ignore the second return argument. In that case they will fail\\n * to identify the indirect workflow, and will consider calls that require a delay to be forbidden.\\n *\\n * NOTE: This function does not report the permissions of the admin functions in the manager itself. These are defined by the\\n * {AccessManager} documentation.\\n */\\n function canCall(\\n address caller,\\n address target,\\n bytes4 selector\\n ) external view returns (bool allowed, uint32 delay);\\n\\n /**\\n * @dev Expiration delay for scheduled proposals. Defaults to 1 week.\\n *\\n * IMPORTANT: Avoid overriding the expiration with 0. Otherwise every contract proposal will be expired immediately,\\n * disabling any scheduling usage.\\n */\\n function expiration() external view returns (uint32);\\n\\n /**\\n * @dev Minimum setback for all delay updates, with the exception of execution delays. It\\n * can be increased without setback (and reset via {revokeRole} in the case event of an\\n * accidental increase). Defaults to 5 days.\\n */\\n function minSetback() external view returns (uint32);\\n\\n /**\\n * @dev Get whether the contract is closed disabling any access. Otherwise role permissions are applied.\\n *\\n * NOTE: When the manager itself is closed, admin functions are still accessible to avoid locking the contract.\\n */\\n function isTargetClosed(address target) external view returns (bool);\\n\\n /**\\n * @dev Get the role required to call a function.\\n */\\n function getTargetFunctionRole(address target, bytes4 selector) external view returns (uint64);\\n\\n /**\\n * @dev Get the admin delay for a target contract. Changes to contract configuration are subject to this delay.\\n */\\n function getTargetAdminDelay(address target) external view returns (uint32);\\n\\n /**\\n * @dev Get the id of the role that acts as an admin for the given role.\\n *\\n * The admin permission is required to grant the role, revoke the role and update the execution delay to execute\\n * an operation that is restricted to this role.\\n */\\n function getRoleAdmin(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role that acts as a guardian for a given role.\\n *\\n * The guardian permission allows canceling operations that have been scheduled under the role.\\n */\\n function getRoleGuardian(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role current grant delay.\\n *\\n * Its value may change at any point without an event emitted following a call to {setGrantDelay}.\\n * Changes to this value, including effect timepoint are notified in advance by the {RoleGrantDelayChanged} event.\\n */\\n function getRoleGrantDelay(uint64 roleId) external view returns (uint32);\\n\\n /**\\n * @dev Get the access details for a given account for a given role. These details include the timepoint at which\\n * membership becomes active, and the delay applied to all operation by this user that requires this permission\\n * level.\\n *\\n * Returns:\\n * [0] Timestamp at which the account membership becomes valid. 0 means role is not granted.\\n * [1] Current execution delay for the account.\\n * [2] Pending execution delay for the account.\\n * [3] Timestamp at which the pending execution delay will become active. 0 means no delay update is scheduled.\\n */\\n function getAccess(\\n uint64 roleId,\\n address account\\n ) external view returns (uint48 since, uint32 currentDelay, uint32 pendingDelay, uint48 effect);\\n\\n /**\\n * @dev Check if a given account currently has the permission level corresponding to a given role. Note that this\\n * permission might be associated with an execution delay. {getAccess} can provide more details.\\n */\\n function hasRole(uint64 roleId, address account) external view returns (bool isMember, uint32 executionDelay);\\n\\n /**\\n * @dev Give a label to a role, for improved role discoverability by UIs.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleLabel} event.\\n */\\n function labelRole(uint64 roleId, string calldata label) external;\\n\\n /**\\n * @dev Add `account` to `roleId`, or change its execution delay.\\n *\\n * This gives the account the authorization to call any function that is restricted to this role. An optional\\n * execution delay (in seconds) can be set. If that delay is non 0, the user is required to schedule any operation\\n * that is restricted to members of this role. The user will only be able to execute the operation after the delay has\\n * passed, before it has expired. During this period, admin and guardians can cancel the operation (see {cancel}).\\n *\\n * If the account has already been granted this role, the execution delay will be updated. This update is not\\n * immediate and follows the delay rules. For example, if a user currently has a delay of 3 hours, and this is\\n * called to reduce that delay to 1 hour, the new delay will take some time to take effect, enforcing that any\\n * operation executed in the 3 hours that follows this update was indeed scheduled before this update.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - granted role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleGranted} event.\\n */\\n function grantRole(uint64 roleId, address account, uint32 executionDelay) external;\\n\\n /**\\n * @dev Remove an account from a role, with immediate effect. If the account does not have the role, this call has\\n * no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - revoked role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function revokeRole(uint64 roleId, address account) external;\\n\\n /**\\n * @dev Renounce role permissions for the calling account with immediate effect. If the sender is not in\\n * the role this call has no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be `callerConfirmation`.\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function renounceRole(uint64 roleId, address callerConfirmation) external;\\n\\n /**\\n * @dev Change admin role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleAdminChanged} event\\n */\\n function setRoleAdmin(uint64 roleId, uint64 admin) external;\\n\\n /**\\n * @dev Change guardian role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGuardianChanged} event\\n */\\n function setRoleGuardian(uint64 roleId, uint64 guardian) external;\\n\\n /**\\n * @dev Update the delay for granting a `roleId`.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGrantDelayChanged} event.\\n */\\n function setGrantDelay(uint64 roleId, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the role required to call functions identified by the `selectors` in the `target` contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetFunctionRoleUpdated} event per selector.\\n */\\n function setTargetFunctionRole(address target, bytes4[] calldata selectors, uint64 roleId) external;\\n\\n /**\\n * @dev Set the delay for changing the configuration of a given target contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetAdminDelayUpdated} event.\\n */\\n function setTargetAdminDelay(address target, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the closed flag for a contract.\\n *\\n * Closing the manager itself won't disable access to admin methods to avoid locking the contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetClosed} event.\\n */\\n function setTargetClosed(address target, bool closed) external;\\n\\n /**\\n * @dev Return the timepoint at which a scheduled operation will be ready for execution. This returns 0 if the\\n * operation is not yet scheduled, has expired, was executed, or was canceled.\\n */\\n function getSchedule(bytes32 id) external view returns (uint48);\\n\\n /**\\n * @dev Return the nonce for the latest scheduled operation with a given id. Returns 0 if the operation has never\\n * been scheduled.\\n */\\n function getNonce(bytes32 id) external view returns (uint32);\\n\\n /**\\n * @dev Schedule a delayed operation for future execution, and return the operation identifier. It is possible to\\n * choose the timestamp at which the operation becomes executable as long as it satisfies the execution delays\\n * required for the caller. The special value zero will automatically set the earliest possible time.\\n *\\n * Returns the `operationId` that was scheduled. Since this value is a hash of the parameters, it can reoccur when\\n * the same parameters are used; if this is relevant, the returned `nonce` can be used to uniquely identify this\\n * scheduled operation from other occurrences of the same `operationId` in invocations of {execute} and {cancel}.\\n *\\n * Emits a {OperationScheduled} event.\\n *\\n * NOTE: It is not possible to concurrently schedule more than one operation with the same `target` and `data`. If\\n * this is necessary, a random byte can be appended to `data` to act as a salt that will be ignored by the target\\n * contract if it is using standard Solidity ABI encoding.\\n */\\n function schedule(\\n address target,\\n bytes calldata data,\\n uint48 when\\n ) external returns (bytes32 operationId, uint32 nonce);\\n\\n /**\\n * @dev Execute a function that is delay restricted, provided it was properly scheduled beforehand, or the\\n * execution delay is 0.\\n *\\n * Returns the nonce that identifies the previously scheduled operation that is executed, or 0 if the\\n * operation wasn't previously scheduled (if the caller doesn't have an execution delay).\\n *\\n * Emits an {OperationExecuted} event only if the call was scheduled and delayed.\\n */\\n function execute(address target, bytes calldata data) external payable returns (uint32);\\n\\n /**\\n * @dev Cancel a scheduled (delayed) operation. Returns the nonce that identifies the previously scheduled\\n * operation that is cancelled.\\n *\\n * Requirements:\\n *\\n * - the caller must be the proposer, a guardian of the targeted function, or a global admin\\n *\\n * Emits a {OperationCanceled} event.\\n */\\n function cancel(address caller, address target, bytes calldata data) external returns (uint32);\\n\\n /**\\n * @dev Consume a scheduled operation targeting the caller. If such an operation exists, mark it as consumed\\n * (emit an {OperationExecuted} event and clean the state). Otherwise, throw an error.\\n *\\n * This is useful for contract that want to enforce that calls targeting them were scheduled on the manager,\\n * with all the verifications that it implies.\\n *\\n * Emit a {OperationExecuted} event.\\n */\\n function consumeScheduledOp(address caller, bytes calldata data) external;\\n\\n /**\\n * @dev Hashing function for delayed operations.\\n */\\n function hashOperation(address caller, address target, bytes calldata data) external view returns (bytes32);\\n\\n /**\\n * @dev Changes the authority of a target managed by this manager instance.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n */\\n function updateAuthority(address target, address newAuthority) external;\\n}\\n\",\"keccak256\":\"0x9be2d08a326515805bc9cf6315b7953f8d1ebe88abf48c2d645fb1fa8211a0e2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAuthority.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Standard interface for permissioning originally defined in Dappsys.\\n */\\ninterface IAuthority {\\n /**\\n * @dev Returns true if the caller can invoke on a target the function identified by a function selector.\\n */\\n function canCall(address caller, address target, bytes4 selector) external view returns (bool allowed);\\n}\\n\",\"keccak256\":\"0x4cc0766bd7fb7b3bafb70afa2a93b6e313a0baec7a35ad1b57505be7861c1030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"./IERC20.sol\\\";\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @title IERC1363\\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\\n *\\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\\n */\\ninterface IERC1363 is IERC20, IERC165 {\\n /*\\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\\n * 0xb0202a11 ===\\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\\n */\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @param data Additional data with no specified format, sent in call to `spender`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9b6b3e7803bc5f2f8cd7ad57db8ac1def61a9930a5a3107df4882e028a9605d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xde7e9fd9aee8d4f40772f96bb3b58836cbc6dfc0227014a061947f8821ea9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0xce41876e78d1badc0512229b4d14e4daf83bc1003d7f83978d18e0e56f965b9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashBorrower.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashBorrower, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashBorrower {\\n /**\\n * @dev Receive a flash loan.\\n * @param initiator The initiator of the loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param fee The additional amount of tokens to repay.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n * @return The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\\n */\\n function onFlashLoan(\\n address initiator,\\n address token,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n ) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0x0b1459615b9b47c2a4eec8e72f23ccc601f1d711f679a1c06b3390459021a341\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashLender.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC3156FlashBorrower} from \\\"./IERC3156FlashBorrower.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashLender, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashLender {\\n /**\\n * @dev The amount of currency available to be lended.\\n * @param token The loan currency.\\n * @return The amount of `token` that can be borrowed.\\n */\\n function maxFlashLoan(address token) external view returns (uint256);\\n\\n /**\\n * @dev The fee to be charged for a given loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @return The amount of `token` to be charged for the loan, on top of the returned principal.\\n */\\n function flashFee(address token, uint256 amount) external view returns (uint256);\\n\\n /**\\n * @dev Initiate a flash loan.\\n * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n */\\n function flashLoan(\\n IERC3156FlashBorrower receiver,\\n address token,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x5d19ea24c555cf6a5dbafea9fac57887cc3e72154f3ee8e0a2bf67971811c14b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xe06a3f08a987af6ad2e1c1e774405d4fe08f1694b67517438b467cecf0da0ef7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.20;\\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\",\"keccak256\":\"0x70f2f713b13b7ce4610bcd0ac9fec0f3cc43693b043abcb8dc40a42a726eb330\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.2.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 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\",\"keccak256\":\"0x4ea01544758fd2c7045961904686bfe232d2220a04ecaa2d6b08dac17827febf\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Panic.sol\":{\"content\":\"// 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\",\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x79796192ec90263f21b464d5bc90b777a525971d3de8232be80d9c4f9fb353b8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.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 Returns the addition of two unsigned integers, with an 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 if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\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 if (b == 0) return (false, 0);\\n return (true, a / b);\\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 if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\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 // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2\\u00b2\\u2075\\u2076 and mod 2\\u00b2\\u2075\\u2076 - 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 = prod1 * 2\\u00b2\\u2075\\u2076 + prod0.\\n uint256 prod0 = x * y; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 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 prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2\\u00b2\\u2075\\u2076. Also prevents denominator == 0.\\n if (denominator <= prod1) {\\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 [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, 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 {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2\\u00b2\\u2075\\u2076 / 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 prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2\\u00b2\\u2075\\u2076. Now that denominator is an odd number, it has an inverse modulo 2\\u00b2\\u2075\\u2076 such\\n // that denominator * inv \\u2261 1 mod 2\\u00b2\\u2075\\u2076. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv \\u2261 1 mod 2\\u2074.\\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\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u2076\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b3\\u00b2\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u2076\\u2074\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u00b2\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b2\\u2075\\u2076\\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\\u00b2\\u2075\\u2076. Since the preconditions guarantee that the outcome is\\n // less than 2\\u00b2\\u2075\\u2076, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * 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 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 \\u2261 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) \\u2261 1 mod p`. As a consequence, we have `a * a**(p-2) \\u2261 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\\u00b2 - 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 `\\u03b5_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) \\u2264 sqrt(a) < 2**e`). We know that `e \\u2264 128` because `(2\\u00b9\\u00b2\\u2078)\\u00b2 = 2\\u00b2\\u2075\\u2076` is\\n // bigger than any uint256.\\n //\\n // By noticing that\\n // `2**(e-1) \\u2264 sqrt(a) < 2**e \\u2192 (2**(e-1))\\u00b2 \\u2264 a < (2**e)\\u00b2 \\u2192 2**(2*e-2) \\u2264 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) \\u2264 sqrt(a) < 2**e = 2 * x_n`. This implies \\u03b5_n \\u2264 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 \\u03b5_n \\u2264 2**(e-2).\\n // This is going to be our x_0 (and \\u03b5_0)\\n xn = (3 * xn) >> 1; // \\u03b5_0 := | x_0 - sqrt(a) | \\u2264 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}\\u00b2 - a = ((x_n + a / x_n) / 2)\\u00b2 - a\\n // = ((x_n\\u00b2 + a) / (2 * x_n))\\u00b2 - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2) - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2 - 4 * a * x_n\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u2074 - 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u00b2 - a)\\u00b2 / (2 * x_n)\\u00b2\\n // = ((x_n\\u00b2 - a) / (2 * x_n))\\u00b2\\n // \\u2265 0\\n // Which proves that for all n \\u2265 1, sqrt(a) \\u2264 x_n\\n //\\n // This gives us the proof of quadratic convergence of the sequence:\\n // \\u03b5_{n+1} = | x_{n+1} - sqrt(a) |\\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\\n // = | (x_n\\u00b2 + a - 2*x_n*sqrt(a)) / (2 * x_n) |\\n // = | (x_n - sqrt(a))\\u00b2 / (2 * x_n) |\\n // = | \\u03b5_n\\u00b2 / (2 * x_n) |\\n // = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n //\\n // For the first iteration, we have a special case where x_0 is known:\\n // \\u03b5_1 = \\u03b5_0\\u00b2 / | (2 * x_0) |\\n // \\u2264 (2**(e-2))\\u00b2 / (2 * (2**(e-1) + 2**(e-2)))\\n // \\u2264 2**(2*e-4) / (3 * 2**(e-1))\\n // \\u2264 2**(e-3) / 3\\n // \\u2264 2**(e-3-log2(3))\\n // \\u2264 2**(e-4.5)\\n //\\n // For the following iterations, we use the fact that, 2**(e-1) \\u2264 sqrt(a) \\u2264 x_n:\\n // \\u03b5_{n+1} = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n // \\u2264 (2**(e-k))\\u00b2 / (2 * 2**(e-1))\\n // \\u2264 2**(2*e-2*k) / 2**e\\n // \\u2264 2**(e-2*k)\\n xn = (xn + a / xn) >> 1; // \\u03b5_1 := | x_1 - sqrt(a) | \\u2264 2**(e-4.5) -- special case, see above\\n xn = (xn + a / xn) >> 1; // \\u03b5_2 := | x_2 - sqrt(a) | \\u2264 2**(e-9) -- general case with k = 4.5\\n xn = (xn + a / xn) >> 1; // \\u03b5_3 := | x_3 - sqrt(a) | \\u2264 2**(e-18) -- general case with k = 9\\n xn = (xn + a / xn) >> 1; // \\u03b5_4 := | x_4 - sqrt(a) | \\u2264 2**(e-36) -- general case with k = 18\\n xn = (xn + a / xn) >> 1; // \\u03b5_5 := | x_5 - sqrt(a) | \\u2264 2**(e-72) -- general case with k = 36\\n xn = (xn + a / xn) >> 1; // \\u03b5_6 := | x_6 - sqrt(a) | \\u2264 2**(e-144) -- general case with k = 72\\n\\n // Because e \\u2264 128 (as discussed during the first estimation phase), we know have reached a precision\\n // \\u03b5_6 \\u2264 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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 exp;\\n unchecked {\\n exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);\\n value >>= exp;\\n result += exp;\\n\\n result += SafeCast.toUint(value > 1);\\n }\\n return result;\\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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 isGt;\\n unchecked {\\n isGt = SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= isGt * 128;\\n result += isGt * 16;\\n\\n isGt = SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= isGt * 64;\\n result += isGt * 8;\\n\\n isGt = SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= isGt * 32;\\n result += isGt * 4;\\n\\n isGt = SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= isGt * 16;\\n result += isGt * 2;\\n\\n result += SafeCast.toUint(value > (1 << 8) - 1);\\n }\\n return result;\\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\",\"keccak256\":\"0xa00be322d7db5786750ce0ac7e2f5b633ac30a5ed5fa1ced1e74acfc19acecea\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x195533c86d0ef72bcc06456a4f66a9b941f38eb403739b00f21fd7c1abd1ae54\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/types/Time.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/types/Time.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"../math/Math.sol\\\";\\nimport {SafeCast} from \\\"../math/SafeCast.sol\\\";\\n\\n/**\\n * @dev This library provides helpers for manipulating time-related objects.\\n *\\n * It uses the following types:\\n * - `uint48` for timepoints\\n * - `uint32` for durations\\n *\\n * While the library doesn't provide specific types for timepoints and duration, it does provide:\\n * - a `Delay` type to represent duration that can be programmed to change value automatically at a given point\\n * - additional helper functions\\n */\\nlibrary Time {\\n using Time for *;\\n\\n /**\\n * @dev Get the block timestamp as a Timepoint.\\n */\\n function timestamp() internal view returns (uint48) {\\n return SafeCast.toUint48(block.timestamp);\\n }\\n\\n /**\\n * @dev Get the block number as a Timepoint.\\n */\\n function blockNumber() internal view returns (uint48) {\\n return SafeCast.toUint48(block.number);\\n }\\n\\n // ==================================================== Delay =====================================================\\n /**\\n * @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the\\n * future. The \\\"effect\\\" timepoint describes when the transitions happens from the \\\"old\\\" value to the \\\"new\\\" value.\\n * This allows updating the delay applied to some operation while keeping some guarantees.\\n *\\n * In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for\\n * some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set\\n * the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should\\n * still apply for some time.\\n *\\n *\\n * The `Delay` type is 112 bits long, and packs the following:\\n *\\n * ```\\n * | [uint48]: effect date (timepoint)\\n * | | [uint32]: value before (duration)\\n * \\u2193 \\u2193 \\u2193 [uint32]: value after (duration)\\n * 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC\\n * ```\\n *\\n * NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently\\n * supported.\\n */\\n type Delay is uint112;\\n\\n /**\\n * @dev Wrap a duration into a Delay to add the one-step \\\"update in the future\\\" feature\\n */\\n function toDelay(uint32 duration) internal pure returns (Delay) {\\n return Delay.wrap(duration);\\n }\\n\\n /**\\n * @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled\\n * change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered.\\n */\\n function _getFullAt(\\n Delay self,\\n uint48 timepoint\\n ) private pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n (valueBefore, valueAfter, effect) = self.unpack();\\n return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the\\n * effect timepoint is 0, then the pending value should not be considered.\\n */\\n function getFull(Delay self) internal view returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n return _getFullAt(self, timestamp());\\n }\\n\\n /**\\n * @dev Get the current value.\\n */\\n function get(Delay self) internal view returns (uint32) {\\n (uint32 delay, , ) = self.getFull();\\n return delay;\\n }\\n\\n /**\\n * @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to\\n * enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the\\n * new delay becomes effective.\\n */\\n function withUpdate(\\n Delay self,\\n uint32 newValue,\\n uint32 minSetback\\n ) internal view returns (Delay updatedDelay, uint48 effect) {\\n uint32 value = self.get();\\n uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0));\\n effect = timestamp() + setback;\\n return (pack(value, newValue, effect), effect);\\n }\\n\\n /**\\n * @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint).\\n */\\n function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n uint112 raw = Delay.unwrap(self);\\n\\n valueAfter = uint32(raw);\\n valueBefore = uint32(raw >> 32);\\n effect = uint48(raw >> 64);\\n\\n return (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev pack the components into a Delay object.\\n */\\n function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) {\\n return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter));\\n }\\n}\\n\",\"keccak256\":\"0x36776530f012618bc7526ceb28e77b85e582cb12d9b9466a71d4bd6bf952e4cc\",\"license\":\"MIT\"},\"contracts/helpers/BaseHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { AccessManaged } from \\\"../utils/AccessManaged.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport \\\"contracts/interfaces/IHarvester.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nstruct YieldBearingParams {\\n // Address of the asset used to mint the yield bearing asset\\n address asset;\\n // Target exposure to the collateral yield bearing asset used\\n uint64 targetExposure;\\n // Maximum exposure within the Parallelizer to the deposit asset\\n uint64 maxExposure;\\n // Minimum exposure within the Parallelizer to the deposit asset\\n uint64 minExposure;\\n // Whether limit exposures should be overriden or read onchain through the Parallelizer\\n // This value should be 1 to override exposures or 2 if these shouldn't be overriden\\n uint64 overrideExposures;\\n // Maximum slippage when dealing with the Parallelizer\\n uint96 maxSlippage;\\n}\\n\\n/// @title BaseHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Abstract contract for a harvester that aims at rebalancing a Parallelizer\\n/// @dev This contract is an authorized fork of Angle's BaseHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/BaseHarvester.sol\\nabstract contract BaseHarvester is IHarvester, AccessManaged {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrusted() {\\n if (!isTrusted[msg.sender]) revert NotTrusted();\\n _;\\n }\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted or guardian to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrustedOrRestricted() {\\n if (!isTrusted[msg.sender] && !_checkCanCall(_msgSender(), _msgData())) {\\n revert NotTrustedOrGuardian();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VARIABLES\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Reference to the `parallelizer` implementation this contract aims at rebalancing\\n IParallelizer public immutable parallelizer;\\n /// @notice TokenP handled by the `parallelizer` of interest\\n ITokenP public immutable tokenP;\\n /// @notice Max slippage when dealing with the Parallelizer\\n mapping(address => uint96) public maxTokenSlippage;\\n /// @notice Data associated to a yield bearing asset\\n mapping(address => YieldBearingParams) public yieldBearingData;\\n /// @notice trusted addresses that can update target exposure and do others non critical operations\\n mapping(address => bool) public isTrusted;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EVENTS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n event Recovered(address token, uint256 amount, address to);\\n event TrustedToggled(address trusted, bool status);\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialAuthority,\\n ITokenP definitiveTokenP,\\n IParallelizer definitiveParallelizer\\n )\\n AccessManaged(initialAuthority)\\n {\\n tokenP = definitiveTokenP;\\n parallelizer = definitiveParallelizer;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n GUARDIAN FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the yieldBearingAsset data\\n * @param yieldBearingAsset address of the yieldBearingAsset\\n * @param asset address of the asset\\n * @param targetExposure target exposure to the yieldBearingAsset asset used\\n * @param minExposure minimum exposure within the Parallelizer to the asset\\n * @param maxExposure maximum exposure within the Parallelizer to the asset\\n * @param overrideExposures whether limit exposures should be overriden or read onchain through the Parallelizer\\n */\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external\\n restricted\\n {\\n _setYieldBearingAssetData(\\n yieldBearingAsset, asset, targetExposure, minExposure, maxExposure, overrideExposures, maxSlippage\\n );\\n }\\n\\n /**\\n * @notice Set the limit exposures to the asset linked to the yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n */\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) public virtual {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n if (yieldBearingInfo.overrideExposures == 2) {\\n _updateLimitExposuresYieldAsset(yieldBearingInfo.asset, yieldBearingInfo);\\n }\\n }\\n\\n /**\\n * @notice Set the max allowed slippage\\n * @param newMaxSlippage new max allowed slippage\\n */\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external restricted {\\n _setMaxSlippage(yieldBearingAsset, newMaxSlippage);\\n }\\n\\n /**\\n * @notice Toggle the trusted status of an address\\n * @param trusted address to toggle the trusted status\\n */\\n function toggleTrusted(address trusted) external restricted {\\n emit TrustedToggled(trusted, isTrusted[trusted]);\\n isTrusted[trusted] = !isTrusted[trusted];\\n }\\n\\n /**\\n * @notice Recover ERC20 tokens\\n * @param tokenAddress address of the token to recover\\n * @param amountToRecover amount to recover\\n * @param to address to send the recovered tokens\\n */\\n function recoverERC20(address tokenAddress, uint256 amountToRecover, address to) external restricted {\\n emit Recovered(tokenAddress, amountToRecover, to);\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n TRUSTED FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the target exposure of a yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @param targetExposure target exposure to the yield bearing asset used\\n */\\n function setTargetExposure(address yieldBearingAsset, uint64 targetExposure) external onlyTrustedOrRestricted {\\n yieldBearingData[yieldBearingAsset].targetExposure = targetExposure;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Compute the amount needed to rebalance the Parallelizer\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @return increase whether the exposure should be increased\\n * @return amount amount to be rebalanced\\n */\\n function computeRebalanceAmount(address yieldBearingAsset) external view returns (uint8 increase, uint256 amount) {\\n return _computeRebalanceAmount(yieldBearingAsset, yieldBearingData[yieldBearingAsset]);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _computeRebalanceAmount(\\n address yieldBearingAsset,\\n YieldBearingParams memory yieldBearingInfo\\n )\\n internal\\n view\\n returns (uint8 increase, uint256 amount)\\n {\\n (uint256 stablecoinsFromYieldBearingAsset, uint256 stablecoinsIssued) =\\n parallelizer.getIssuedByCollateral(yieldBearingAsset);\\n (uint256 stablecoinsFromAsset,) = parallelizer.getIssuedByCollateral(yieldBearingInfo.asset);\\n uint256 targetExposureScaled = yieldBearingInfo.targetExposure * stablecoinsIssued;\\n if (stablecoinsFromYieldBearingAsset * 1e9 > targetExposureScaled) {\\n // Need to decrease exposure to yield bearing asset\\n amount = stablecoinsFromYieldBearingAsset - targetExposureScaled / 1e9;\\n uint256 maxValueScaled = yieldBearingInfo.maxExposure * stablecoinsIssued;\\n // These checks assume that there are no transaction fees on the stablecoin->collateral conversion and so\\n // it's still possible that exposure goes above the max exposure in some rare cases\\n if (stablecoinsFromAsset * 1e9 > maxValueScaled) {\\n amount = 0;\\n } else if ((stablecoinsFromAsset + amount) * 1e9 > maxValueScaled) {\\n amount = maxValueScaled / 1e9 - stablecoinsFromAsset;\\n }\\n } else {\\n // In this case, exposure after the operation might remain slightly below the targetExposure as less\\n // collateral may be obtained by burning stablecoins for the yield asset and unwrapping it\\n increase = 1;\\n amount = targetExposureScaled / 1e9 - stablecoinsFromYieldBearingAsset;\\n uint256 minValueScaled = yieldBearingInfo.minExposure * stablecoinsIssued;\\n if (stablecoinsFromAsset * 1e9 < minValueScaled) {\\n amount = 0;\\n } else if (stablecoinsFromAsset * 1e9 < minValueScaled + amount * 1e9) {\\n amount = stablecoinsFromAsset - minValueScaled / 1e9;\\n }\\n }\\n }\\n\\n function _setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n internal\\n virtual\\n {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n yieldBearingInfo.asset = asset;\\n if (targetExposure >= 1e9) revert InvalidParam();\\n if (maxSlippage >= 1e9) revert InvalidParam();\\n yieldBearingInfo.targetExposure = targetExposure;\\n yieldBearingInfo.overrideExposures = overrideExposures;\\n yieldBearingInfo.maxSlippage = maxSlippage;\\n if (overrideExposures == 1) {\\n if (maxExposure >= 1e9 || minExposure >= maxExposure) revert InvalidParam();\\n yieldBearingInfo.maxExposure = maxExposure;\\n yieldBearingInfo.minExposure = minExposure;\\n } else {\\n yieldBearingInfo.overrideExposures = 2;\\n _updateLimitExposuresYieldAsset(asset, yieldBearingInfo);\\n }\\n }\\n\\n function _updateLimitExposuresYieldAsset(\\n address asset,\\n YieldBearingParams storage yieldBearingInfo\\n )\\n internal\\n virtual\\n {\\n uint64[] memory xFeeMint;\\n (xFeeMint,) = parallelizer.getCollateralMintFees(asset);\\n uint256 length = xFeeMint.length;\\n if (length <= 1) yieldBearingInfo.maxExposure = 1e9;\\n else yieldBearingInfo.maxExposure = xFeeMint[length - 2];\\n\\n uint64[] memory xFeeBurn;\\n (xFeeBurn,) = parallelizer.getCollateralBurnFees(asset);\\n length = xFeeBurn.length;\\n if (length <= 1) yieldBearingInfo.minExposure = 0;\\n else yieldBearingInfo.minExposure = xFeeBurn[length - 2];\\n }\\n\\n function _setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) internal virtual {\\n if (newMaxSlippage > 1e9) revert InvalidParam();\\n maxTokenSlippage[yieldBearingAsset] = newMaxSlippage;\\n }\\n\\n function _scaleAmountBasedOnDecimals(\\n uint256 decimalsTokenIn,\\n uint256 decimalsTokenOut,\\n uint256 amountIn,\\n bool assetIn\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n if (decimalsTokenIn > decimalsTokenOut) {\\n if (assetIn) {\\n amountIn /= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n } else {\\n amountIn *= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n }\\n } else if (decimalsTokenIn < decimalsTokenOut) {\\n if (assetIn) {\\n amountIn *= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n } else {\\n amountIn /= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n }\\n }\\n return amountIn;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HELPER \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _adjustAllowance(address token, address sender, uint256 amountIn) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), sender);\\n if (allowance < amountIn) IERC20(token).safeIncreaseAllowance(sender, type(uint256).max - allowance);\\n }\\n}\\n\",\"keccak256\":\"0x82e2ae57997043160d7529488b34591c710cd74e267213b61009daa96e9eeaaf\",\"license\":\"GPL-3.0\"},\"contracts/helpers/GenericHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC20Metadata } from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport { IERC3156FlashBorrower } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\\\";\\nimport { IERC3156FlashLender } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\\\";\\nimport { RouterSwapper } from \\\"@helpers/RouterSwapper.sol\\\";\\n\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport { IERC4626 } from \\\"contracts/interfaces/external/IERC4626.sol\\\";\\n\\nimport \\\"../utils/Constants.sol\\\";\\nimport \\\"../utils/Errors.sol\\\";\\n\\nimport { BaseHarvester, YieldBearingParams } from \\\"./BaseHarvester.sol\\\";\\n\\nenum SwapType {\\n VAULT,\\n SWAP\\n}\\n\\n/// @title GenericHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Generic contract for anyone to permissionlessly adjust the reserves of Angle Parallelizer\\n/// @dev This contract is an authorized fork of Angle's GenericHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\\ncontract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper {\\n using SafeCast for uint256;\\n using SafeERC20 for IERC20;\\n\\n bytes32 public constant CALLBACK_SUCCESS = keccak256(\\\"ERC3156FlashBorrower.onFlashLoan\\\");\\n\\n /// @notice Parallel stablecoin flashloan contract\\n IERC3156FlashLender public immutable flashloan;\\n /// @notice Budget of tokenP available for each users\\n mapping(address => uint256) public budget;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INITIALIZATION \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialTokenTransferAddress,\\n address initialSwapRouter,\\n ITokenP definitivetokenP,\\n IParallelizer definitiveParallelizer,\\n address initialAuthority,\\n IERC3156FlashLender definitiveFlashloan\\n )\\n RouterSwapper(initialSwapRouter, initialTokenTransferAddress)\\n BaseHarvester(initialAuthority, definitivetokenP, definitiveParallelizer)\\n {\\n if (address(definitiveFlashloan) == address(0)) revert ZeroAddress();\\n flashloan = definitiveFlashloan;\\n\\n IERC20(tokenP).approve(address(definitiveFlashloan), type(uint256).max);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n BUDGET HANDLING\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Add budget to be spent by the receiver during the flashloan\\n * @param amount amount of tokenP to add to the budget\\n * @param receiver address of the receiver\\n */\\n function addBudget(uint256 amount, address receiver) public virtual {\\n budget[receiver] += amount;\\n\\n IERC20(tokenP).safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n /**\\n * @notice Remove budget from the owner and send it to the receiver\\n * @param amount amount of tokenP to remove from the budget\\n * @param receiver address of the receiver\\n */\\n function removeBudget(uint256 amount, address receiver) public virtual {\\n budget[msg.sender] -= amount; // Will revert if not enough funds\\n\\n IERC20(tokenP).safeTransfer(receiver, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HARVEST\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure\\n /// to this yieldBearingAsset\\n /// @dev This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up\\n /// some yieldBearingAsset that can then be used for people looking to burn deposit tokens\\n /// @dev Due to potential transaction fees within the Parallelizer, this function doesn't exactly bring\\n /// `yieldBearingAsset` to the target exposure\\n /// @dev scale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest,\\n /// it is used to lower the amount of the asset to harvest for example to have a lower slippage\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) public virtual {\\n if (scale > 1e9) revert InvalidParam();\\n updateLimitExposuresYieldAsset(yieldBearingAsset);\\n YieldBearingParams memory yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n (uint8 increase, uint256 amount) = _computeRebalanceAmount(yieldBearingAsset, yieldBearingInfo);\\n amount = (amount * scale) / 1e9;\\n if (amount == 0) revert ZeroAmount();\\n (SwapType swapType, bytes memory data) = abi.decode(extraData, (SwapType, bytes));\\n try parallelizer.updateOracle(yieldBearingAsset) { } catch { }\\n _adjustYieldExposure(\\n amount,\\n increase,\\n yieldBearingAsset,\\n yieldBearingInfo.asset,\\n (amount * (1e9 - yieldBearingInfo.maxSlippage)) / 1e9,\\n swapType,\\n data\\n );\\n }\\n\\n /// @inheritdoc IERC3156FlashBorrower\\n function onFlashLoan(\\n address initiator,\\n address,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n )\\n public\\n virtual\\n returns (bytes32)\\n {\\n if (msg.sender != address(flashloan) || initiator != address(this) || fee != 0) revert NotTrusted();\\n address sender;\\n uint256 typeAction;\\n uint256 minAmountOut;\\n SwapType swapType;\\n bytes memory callData;\\n address tokenOut;\\n address tokenIn;\\n {\\n address yieldBearingAsset;\\n address asset;\\n (sender, typeAction, yieldBearingAsset, asset, minAmountOut, swapType, callData) =\\n abi.decode(data, (address, uint256, address, address, uint256, SwapType, bytes));\\n if (typeAction == 1) {\\n // Increase yield exposure action: we bring in the yield bearing asset\\n tokenOut = yieldBearingAsset;\\n tokenIn = asset;\\n } else {\\n // Decrease yield exposure action: we bring in the deposit asset\\n tokenIn = yieldBearingAsset;\\n tokenOut = asset;\\n }\\n }\\n uint256 amountOut =\\n parallelizer.swapExactInput(amount, 0, address(tokenP), tokenIn, address(this), block.timestamp);\\n\\n // Swap to tokenIn\\n amountOut = _swapToTokenOut(typeAction, tokenIn, tokenOut, amountOut, swapType, callData);\\n\\n _adjustAllowance(tokenOut, address(parallelizer), amountOut);\\n uint256 amountStableOut =\\n parallelizer.swapExactInput(amountOut, minAmountOut, tokenOut, address(tokenP), address(this), block.timestamp);\\n if (amount > amountStableOut) {\\n budget[sender] -= amount - amountStableOut; // Will revert if not enough funds\\n }\\n return CALLBACK_SUCCESS;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n SETTERS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the token transfer contract\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress) public override restricted {\\n super.setTokenTransferAddress(newTokenTransferAddress);\\n }\\n\\n /**\\n * @notice Set the swap router\\n * @param newSwapRouter address of the swap router\\n */\\n function setSwapRouter(address newSwapRouter) public override restricted {\\n super.setSwapRouter(newSwapRouter);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNALS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Burns `amountStablecoins` for one yieldBearing asset, swap for asset then mints deposit tokens\\n /// from the proceeds of the swap.\\n /// @dev If `increase` is 1, then the system tries to increase its exposure to the yield bearing asset which means\\n /// burning tokenP for the deposit asset, swapping for the yield bearing asset, then minting the tokenP\\n /// @dev This function reverts if the second tokenP mint gives less than `minAmountOut` of ag tokens\\n /// @dev This function reverts if the swap slippage is higher than `maxSlippage`\\n function _adjustYieldExposure(\\n uint256 amountStablecoins,\\n uint8 increase,\\n address yieldBearingAsset,\\n address asset,\\n uint256 minAmountOut,\\n SwapType swapType,\\n bytes memory extraData\\n )\\n internal\\n {\\n flashloan.flashLoan(\\n IERC3156FlashBorrower(address(this)),\\n address(tokenP),\\n amountStablecoins,\\n abi.encode(msg.sender, increase, yieldBearingAsset, asset, minAmountOut, swapType, extraData)\\n );\\n }\\n\\n function _swapToTokenOut(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n SwapType swapType,\\n bytes memory callData\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (swapType == SwapType.SWAP) {\\n amountOut = _swapToTokenOutSwap(tokenIn, tokenOut, amount, callData);\\n } else if (swapType == SwapType.VAULT) {\\n amountOut = _swapToTokenOutVault(typeAction, tokenIn, tokenOut, amount);\\n }\\n }\\n\\n /**\\n * @notice Swap token using the router/aggregator\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n * @param callData bytes to call the router/aggregator\\n */\\n function _swapToTokenOutSwap(\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n bytes memory callData\\n )\\n internal\\n returns (uint256)\\n {\\n uint256 balance = IERC20(tokenOut).balanceOf(address(this));\\n\\n address[] memory tokens = new address[](1);\\n tokens[0] = tokenIn;\\n bytes[] memory callDatas = new bytes[](1);\\n callDatas[0] = callData;\\n uint256[] memory amounts = new uint256[](1);\\n amounts[0] = amount;\\n _swap(tokens, callDatas, amounts);\\n\\n return IERC20(tokenOut).balanceOf(address(this)) - balance;\\n }\\n\\n /**\\n * @dev Deposit or redeem the vault asset\\n * @param typeAction 1 for deposit, 2 for redeem\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n */\\n function _swapToTokenOutVault(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (typeAction == 1) {\\n // Granting allowance with the yieldBearingAsset for the vault asset\\n _adjustAllowance(tokenIn, tokenOut, amount);\\n amountOut = IERC4626(tokenOut).deposit(amount, address(this));\\n } else {\\n amountOut = IERC4626(tokenIn).redeem(amount, address(this), address(this));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x764fdb8964ca0b949d1b3f336cd8046c9c77c86aae4011b0a8760cedc5bb7971\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDiamondCut.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IDiamondCut\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondCut.sol by mudgen\\n/// @dev This interface is an authorized fork of Angle's `IDiamondCut` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IDiamondCut.sol\\ninterface IDiamondCut {\\n /// @notice Add/replace/remove any number of functions and optionally execute a function with delegatecall\\n /// @param _diamondCut Contains the facet addresses and function selectors\\n /// @param _init The address of the contract or facet to execute _calldata\\n /// @param _calldata A function call, including function selector and arguments, executed with delegatecall on\\n /// _init\\n function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;\\n}\\n\",\"keccak256\":\"0x08a01f77b740f7da424f0ea27a6a292f9e292058e23d1fe960d2d19a44496c7b\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondEtherscan.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\n/// @title IDiamondEtherscan\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface IDiamondEtherscan {\\n /// @notice Sets a dummy implementation with the same layout at the diamond proxy contract with all its facets\\n function setDummyImplementation(address _implementation) external;\\n\\n /// @notice Address of the dummy implementation used to make the DiamondProxy contract interpretable by Etherscan\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf742b55592d129e02fb755d25f7a97ed976a14c4c744d6ac46726809e8f1e037\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondLoupe.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @notice IDiamondLoupe\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondLoupe.sol by mudgen\\ninterface IDiamondLoupe {\\n /// @notice Gets all facet addresses and their four byte function selectors.\\n /// @return facets_ Facet\\n function facets() external view returns (Facet[] memory facets_);\\n\\n /// @notice Gets all the function selectors supported by a specific facet.\\n /// @param _facet The facet address.\\n /// @return facetFunctionSelectors_\\n function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);\\n\\n /// @notice Get all the facet addresses used by a diamond.\\n /// @return facetAddresses_\\n function facetAddresses() external view returns (address[] memory facetAddresses_);\\n\\n /// @notice Gets the facet that supports the given selector.\\n /// @dev If facet is not found return address(0).\\n /// @param _functionSelector The function selector.\\n /// @return facetAddress_ The facet address.\\n function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);\\n}\\n\",\"keccak256\":\"0xa5580958acabe2c44967e835e77a748eb0b8812f70cd071191201508c9388ca8\",\"license\":\"MIT\"},\"contracts/interfaces/IGetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IGetters\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IGetters` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IGetters.sol\\ninterface IGetters {\\n /// @notice Checks whether a given `selector` is actually a valid selector corresponding to a function in one of\\n /// the\\n /// facets of the proxy\\n function isValidSelector(bytes4 selector) external view returns (bool);\\n\\n /// @notice Stablecoin minted by parallelizer\\n function tokenP() external view returns (ITokenP);\\n\\n /// @notice Returns the list of collateral assets supported by the system\\n function getCollateralList() external view returns (address[] memory);\\n\\n /// @notice Returns all the info in storage associated to a `collateral`\\n function getCollateralInfo(address collateral) external view returns (Collateral memory);\\n\\n /// @notice Returns the decimals of a given `collateral`\\n function getCollateralDecimals(address collateral) external view returns (uint8);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to mint\\n /// with `collateral`\\n function getCollateralMintFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to burn\\n /// for `collateral`\\n function getCollateralBurnFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays used to compute the penalty factor depending on the collateral\\n /// ratio when users come to redeem\\n function getRedemptionFees() external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the collateral ratio of Parallelizer in base `10**9` and a rounded version of the total amount\\n /// of stablecoins issued\\n function getCollateralRatio() external view returns (uint64 collatRatio, uint256 stablecoinsIssued);\\n\\n /// @notice Returns the total amount of stablecoins issued through Parallelizer\\n function getTotalIssued() external view returns (uint256 stablecoinsIssued);\\n\\n /// @notice Returns the amount of stablecoins issued from `collateral` and the total amount of stablecoins issued\\n /// through Parallelizer\\n function getIssuedByCollateral(address collateral)\\n external\\n view\\n returns (uint256 stablecoinsFromCollateral, uint256 stablecoinsIssued);\\n\\n /// @notice Returns if a collateral is \\\"managed\\\" and the associated manager configuration\\n function getManagerData(address collateral)\\n external\\n view\\n returns (bool isManaged, IERC20[] memory subCollaterals, bytes memory config);\\n\\n /// @notice Returns the oracle values associated to `collateral`\\n /// @return mint Oracle value to be used for a mint transaction with `collateral`\\n /// @return burn Oracle value that will be used for `collateral` for a burn transaction. This value\\n /// is then used along with oracle values for all other collateral assets to get a global burn value for the oracle\\n /// @return ratio Ratio, in base `10**18` between the oracle value of the `collateral` and its target price.\\n /// This value is 10**18 if the oracle is greater than the collateral price\\n /// @return minRatio Minimum ratio across all collateral assets between a collateral burn price and its target\\n /// price. This value is independent of `collateral` and is used to normalize the burn oracle value for burn\\n /// transactions.\\n /// @return redemption Oracle value that would be used to price `collateral` when computing the collateral ratio\\n /// during a redemption\\n function getOracleValues(address collateral)\\n external\\n view\\n returns (uint256 mint, uint256 burn, uint256 ratio, uint256 minRatio, uint256 redemption);\\n\\n /// @notice Returns the data used to compute oracle values for `collateral`\\n /// @return oracleType Type of oracle (Chainlink, external smart contract, ...)\\n /// @return targetType Type passed to read the value of the target price\\n /// @return oracleData Extra data needed to read the oracle. For Chainlink oracles, this data is supposed to give\\n /// the addresses of the Chainlink feeds to read, the stale periods for each feed, ...\\n /// @return targetData Extra data needed to read the target price of the asset\\n function getOracle(address collateral)\\n external\\n view\\n returns (\\n OracleReadType oracleType,\\n OracleReadType targetType,\\n bytes memory oracleData,\\n bytes memory targetData,\\n bytes memory hyperparameters\\n );\\n\\n /// @notice Returns if the associated functionality is paused or not\\n function isPaused(address collateral, ActionType action) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update normalizers\\n function isTrusted(address sender) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update sell rewards\\n function isTrustedSeller(address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` has a non null entry in the `isWhitelistedForType` storage mapping\\n /// @dev Note that ultimately whitelisting may depend as well on external providers\\n function isWhitelistedForType(WhitelistType whitelistType, address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` can deal with `collateral` during burns and redemptions\\n function isWhitelistedForCollateral(address collateral, address sender) external returns (bool);\\n\\n /// @notice Checks whether only whitelisted address can deal with `collateral` during burns and redemptions\\n function isWhitelistedCollateral(address collateral) external view returns (bool);\\n\\n /// @notice Gets the data needed to deal with whitelists for `collateral`\\n function getCollateralWhitelistData(address collateral) external view returns (bytes memory);\\n\\n /// @notice Returns the stablecoin cap for `collateral`\\n function getStablecoinCap(address collateral) external view returns (uint256);\\n\\n /// @notice Returns the address of the `accessManager` contract\\n function accessManager() external view returns (address);\\n\\n /// @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n /// being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n /// attacker controlled calls.\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaa9eba6ee7770d6146fedbfef07ad10ff09524692319ca0cc32abfa64a2b597b\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IHarvester` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IHarvester.sol\\ninterface IHarvester {\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address stablecoin,\\n uint64 targetExposure,\\n uint64 minExposureYieldAsset,\\n uint64 maxExposureYieldAsset,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external;\\n\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) external;\\n\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external;\\n\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) external;\\n}\\n\",\"keccak256\":\"0x0d4e8fee737f4f747060a3c5044c8cb2f153faa228ad37a661a659ca62aab055\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IParallelizer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IDiamondCut } from \\\"./IDiamondCut.sol\\\";\\nimport { IDiamondEtherscan } from \\\"./IDiamondEtherscan.sol\\\";\\nimport { IDiamondLoupe } from \\\"./IDiamondLoupe.sol\\\";\\nimport { IGetters } from \\\"./IGetters.sol\\\";\\nimport { IRedeemer } from \\\"./IRedeemer.sol\\\";\\nimport { IRewardHandler } from \\\"./IRewardHandler.sol\\\";\\nimport { ISettersGovernor, ISettersGuardian } from \\\"./ISetters.sol\\\";\\nimport { ISwapper } from \\\"./ISwapper.sol\\\";\\n\\n/// @title IParallelizer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IParallelizer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IParallelizer.sol\\ninterface IParallelizer is\\n IDiamondCut,\\n IDiamondEtherscan,\\n IDiamondLoupe,\\n IGetters,\\n IRedeemer,\\n IRewardHandler,\\n ISettersGovernor,\\n ISettersGuardian,\\n ISwapper\\n{ }\\n\",\"keccak256\":\"0x8bd964110c6a122bdb6cf58a194a97c894900237ebd7f3b11e2f43c6ee56ae7c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRedeemer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRedeemer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRedeemer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRedeemer.sol\\ninterface IRedeemer {\\n /// @notice Redeems `amount` of stablecoins from the system\\n /// @param receiver Address which should be receiving the output tokens\\n /// @param deadline Timestamp before which the redemption should have occured\\n /// @param minAmountOuts Minimum amount of each token given back in the redemption to obtain\\n /// @return tokens List of tokens returned\\n /// @return amounts Amount given for each token in the `tokens` array\\n function redeem(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Same as the redeem function above with the additional feature to specify a list of `forfeitTokens` for\\n /// which the Parallelizer system will not try to do a transfer to `receiver`.\\n function redeemWithForfeit(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts,\\n address[] memory forfeitTokens\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Simulate the exact output that a redemption of `amount` of stablecoins would give at a given block\\n /// @return tokens List of tokens that would be given\\n /// @return amounts Amount that would be obtained for each token in the `tokens` array\\n function quoteRedemptionCurve(uint256 amount)\\n external\\n view\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Updates the normalizer variable by `amount`\\n function updateNormalizer(uint256 amount, bool increase) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3522ee0380b321c64d02bf2db2acb658d8b314b811dd54b6a718d6708b5fb21\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRewardHandler.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRewardHandler\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRewardHandler` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRewardHandler.sol\\ninterface IRewardHandler {\\n /// @notice Sells some external tokens through a odos call\\n /// @param minAmountOut Minimum amount of the outToken to get\\n /// @param payload Payload to pass to odos\\n /// @return amountOut Amount obtained of the outToken\\n function sellRewards(uint256 minAmountOut, bytes memory payload) external returns (uint256 amountOut);\\n}\\n\",\"keccak256\":\"0xff2afcbc8d1c25297324159d3684a323e60b3c9408129aba70d3d6938d093255\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISettersGovernor` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISetters.sol\\ninterface ISettersGovernor {\\n /// @notice Recovers `amount` of `token` from the Parallelizer contract\\n function recoverERC20(address collateral, IERC20 token, address to, uint256 amount) external;\\n\\n /// @notice Sets a new access manager address\\n function setAccessManager(address _newAccessManager) external;\\n\\n /// @notice Sets (or unsets) a collateral manager `collateral`\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before setting the new manager\\n function setCollateralManager(\\n address collateral,\\n bool checkExternalManagerBalance,\\n ManagerStorage memory managerData\\n )\\n external;\\n\\n /// @notice Sets the allowance of the contract on `token` for `spender` to `amount`\\n function changeAllowance(IERC20 token, address spender, uint256 amount) external;\\n\\n /// @notice Changes the trusted status for `sender` when for selling rewards or updating the normalizer\\n function toggleTrusted(address sender, TrustedType t) external;\\n\\n /// @notice Changes whether a `collateral` can only be handled during burns and redemptions by whitelisted\\n /// addresses\\n /// and sets the data used to read into the whitelist\\n function setWhitelistStatus(address collateral, uint8 whitelistStatus, bytes memory whitelistData) external;\\n\\n /// @notice Add `collateral` as a supported collateral in the system\\n function addCollateral(address collateral) external;\\n\\n /// @notice Adjusts the amount of stablecoins issued from `collateral` by `amount`\\n function adjustStablecoins(address collateral, uint128 amount, bool increase) external;\\n\\n /// @notice Revokes `collateral` from the system\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before revoking the collateral\\n function revokeCollateral(address collateral, bool checkExternalManagerBalance) external;\\n\\n /// @notice Sets the `oracleConfig` used to read the value of `collateral` for the mint, burn and redemption\\n /// operations\\n function setOracle(address collateral, bytes memory oracleConfig) external;\\n\\n /// @notice Update oracle data for a given `collateral`\\n function updateOracle(address collateral) external;\\n}\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface ISettersGuardian {\\n /// @notice Changes the pause status for mint or burn transactions for `collateral`\\n function togglePause(address collateral, ActionType action) external;\\n\\n /// @notice Sets the mint or burn fees for `collateral`\\n function setFees(address collateral, uint64[] memory xFee, int64[] memory yFee, bool mint) external;\\n\\n /// @notice Sets the parameters for the redemption curve\\n function setRedemptionCurveParams(uint64[] memory xFee, int64[] memory yFee) external;\\n\\n /// @notice Changes the whitelist status for a collateral with `whitelistType` for an address `who`\\n function toggleWhitelist(WhitelistType whitelistType, address who) external;\\n\\n /// @notice Sets the stablecoin cap that can be issued from a `collateral`\\n function setStablecoinCap(address collateral, uint256 stablecoinCap) external;\\n}\\n\",\"keccak256\":\"0xc3fb2012e7c2f97ae93b12276afc4293aaeb97a6fe4d60109acaa94ef6945575\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title ISwapper\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISwapper` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISwapper.sol\\ninterface ISwapper {\\n /// @notice Swaps (that is to say mints or burns) an exact amount of `tokenIn` for an amount of `tokenOut`\\n /// @param amountIn Amount of `tokenIn` to bring\\n /// @param amountOutMin Minimum amount of `tokenOut` to get: if `amountOut` is inferior to this amount, the\\n /// function will revert\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountOut Amount of `tokenOut` obtained through the swap\\n function swapExactInput(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Same as `swapExactInput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactInputWithPermit(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Swaps (that is to say mints or burns) an amount of `tokenIn` for an exact amount of `tokenOut`\\n /// @param amountOut Amount of `tokenOut` to obtain from the swap\\n /// @param amountInMax Maximum amount of `tokenIn` to bring in order to get `amountOut` of `tokenOut`\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountIn Amount of `tokenIn` used to perform the swap\\n function swapExactOutput(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Same as `swapExactOutput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactOutputWithPermit(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Simulates what a call to `swapExactInput` with `amountIn` of `tokenIn` for `tokenOut` would give.\\n /// If called right before and at the same block, the `amountOut` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactInput`\\n function quoteIn(uint256 amountIn, address tokenIn, address tokenOut) external view returns (uint256 amountOut);\\n\\n /// @notice Simulates what a call to `swapExactOutput` for `amountOut` of `tokenOut` with `tokenIn` would give.\\n /// If called right before and at the same block, the `amountIn` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactOutput`\\n function quoteOut(uint256 amountOut, address tokenIn, address tokenOut) external view returns (uint256 amountIn);\\n}\\n\",\"keccak256\":\"0x47e4b2742a51b82b9df72fb681335affe8519f4114fb540cd29d8f48ed182ffd\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITokenP.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ITokenP\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @notice Interface for the stablecoins `tokenP` contracts\\n/// @dev This interface is an authorized fork of Angle's `IAgToken` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IAgToken.sol\\ninterface ITokenP is IERC20 {\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MINTER ROLE ONLY FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Lets a whitelisted contract mint tokenPs\\n /// @param account Address to mint to\\n /// @param amount Amount to mint\\n function mint(address account, uint256 amount) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @param sender Address which requested the burn from `burner`\\n /// @dev This method is to be called by a contract with the minter right after being requested\\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\\n /// @dev The method checks the allowance between the `sender` and the `burner`\\n function burnFrom(uint256 amount, address burner, address sender) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @dev This method is to be called by a contract with a minter right on the tokenP after being\\n /// requested to do so by an address willing to burn tokens from its address\\n function burnSelf(uint256 amount, address burner) external;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Amount of decimals of the stablecoin\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x64a1305faa8c5c91767a11af0eae16e4b463aa0bfe10f11b74aae9d96681a5eb\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity >=0.5.0;\\n\\n/// @notice ERC4626 interface\\n/// @author OpenZeppelin\\n/// @dev In this implementation, the interface only contains the functions that the IERC4626 interface adds on top of\\n/// the IERC20 interface\\ninterface IERC4626 {\\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 \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s 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 redeemption 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\",\"keccak256\":\"0xd730d6a6b679201eec89dff3133de651da20b3e72e74f01b734078bfacf952ad\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/coinbase/ICbETH.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title ICbETH\\n/// @notice Interface for the `cbETH` contract\\ninterface ICbETH {\\n function exchangeRate() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xb159341cb0e25c478912b274cdda2d50fa84692aeac87b6823d281aaea2aed04\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/frax/ISfrxETH.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title ISfrxETH\\n/// @notice Interface for the `sfrxETH` contract\\ninterface ISfrxETH {\\n function pricePerShare() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x914cbea276f817c7db62bfca21e15bd8f7892faa9f39d86baaef574cf12b859f\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/lido/IStETH.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IStETH\\n/// @notice Interface for the `StETH` contract\\ninterface IStETH {\\n function getPooledEthByShares(uint256 _sharesAmount) external view returns (uint256);\\n\\n function submit(address) external payable returns (uint256);\\n\\n function getSharesByPooledEth(uint256 _ethAmount) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xf21e3d8bdadc236b34bf2122b0e0b939d2d6bb6e2889b508636cbb7b84f59680\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/rocketPool/IRETH.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IRETH\\n/// @notice Interface for the `rETH` contract\\ninterface IRETH {\\n function getExchangeRate() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x567a378e95d40160e297c1adb617ccaa69c03e49c4ad72a6ce651dd43cdbd5cd\",\"license\":\"GPL-3.0\"},\"contracts/parallelizer/Storage.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n ENUMS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nenum FacetCutAction {\\n Add,\\n Replace,\\n Remove\\n}\\n\\nenum ManagerType {\\n EXTERNAL\\n}\\n\\nenum ActionType {\\n Mint,\\n Burn,\\n Redeem\\n}\\n\\nenum TrustedType {\\n Updater,\\n Seller\\n}\\n\\nenum QuoteType {\\n MintExactInput,\\n MintExactOutput,\\n BurnExactInput,\\n BurnExactOutput\\n}\\n\\nenum OracleReadType {\\n CHAINLINK_FEEDS,\\n EXTERNAL,\\n NO_ORACLE,\\n STABLE,\\n WSTETH,\\n CBETH,\\n RETH,\\n SFRXETH,\\n MAX,\\n MORPHO_ORACLE\\n}\\n\\nenum OracleQuoteType {\\n UNIT,\\n TARGET\\n}\\n\\nenum WhitelistType {\\n BACKED\\n}\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n STRUCTS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nstruct Permit2Details {\\n address to; // Address that will receive the funds\\n uint256 nonce; // Nonce of the transaction\\n bytes signature; // Permit signature of the user\\n}\\n\\nstruct FacetCut {\\n address facetAddress; // Facet contract address\\n FacetCutAction action; // Can be add, remove or replace\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct Facet {\\n address facetAddress; // Facet contract address\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct FacetInfo {\\n address facetAddress; // Facet contract address\\n uint16 selectorPosition; // Position in the list of all selectors\\n}\\n\\nstruct DiamondStorage {\\n bytes4[] selectors; // List of all available selectors\\n mapping(bytes4 => FacetInfo) selectorInfo; // Selector to (address, position in list)\\n IAccessManager accessManager; // Contract handling access management\\n}\\n\\nstruct ImplementationStorage {\\n address implementation; // Dummy implementation address for Etherscan usability\\n}\\n\\nstruct ManagerStorage {\\n IERC20[] subCollaterals; // Subtokens handled by the manager or strategies\\n bytes config; // Additional configuration data\\n}\\n\\nstruct Collateral {\\n uint8 isManaged; // If the collateral is managed through external strategies\\n uint8 isMintLive; // If minting from this asset is unpaused\\n uint8 isBurnLive; // If burning to this asset is unpaused\\n uint8 decimals; // IERC20Metadata(collateral).decimals()\\n uint8 onlyWhitelisted; // If only whitelisted addresses can burn or redeem for this token\\n uint216 normalizedStables; // Normalized amount of stablecoins issued from this collateral\\n uint64[] xFeeMint; // Increasing exposures in [0,BASE_9[\\n int64[] yFeeMint; // Mint fees at the exposures specified in `xFeeMint`\\n uint64[] xFeeBurn; // Decreasing exposures in ]0,BASE_9]\\n int64[] yFeeBurn; // Burn fees at the exposures specified in `xFeeBurn`\\n bytes oracleConfig; // Data about the oracle used for the collateral\\n bytes whitelistData; // For whitelisted collateral, data used to verify whitelists\\n ManagerStorage managerData; // For managed collateral, data used to handle the strategies\\n uint256 stablecoinCap; // Cap on the amount of stablecoins that can be issued from this collateral\\n}\\n\\nstruct ParallelizerStorage {\\n ITokenP tokenP; // tokenP handled by the system\\n uint8 isRedemptionLive; // If redemption is unpaused\\n uint8 statusReentrant; // If call is reentrant or not\\n bool consumingSchedule; // If the contract is consuming a scheduled operation\\n uint128 normalizedStables; // Normalized amount of stablecoins issued by the system\\n uint128 normalizer; // To reconcile `normalizedStables` values with the actual amount\\n address[] collateralList; // List of collateral assets supported by the system\\n uint64[] xRedemptionCurve; // Increasing collateral ratios > 0\\n int64[] yRedemptionCurve; // Value of the redemption fees at `xRedemptionCurve`\\n mapping(address => Collateral) collaterals; // Maps a collateral asset to its parameters\\n mapping(address => uint256) isTrusted; // If an address is trusted to update the normalizer value\\n mapping(address => uint256) isSellerTrusted; // If an address is trusted to sell accruing reward tokens or to run\\n // keeper jobs on oracles\\n mapping(WhitelistType => mapping(address => uint256)) isWhitelistedForType;\\n}\\n// Whether an address is whitelisted for a specific whitelist type\\n\",\"keccak256\":\"0x3f4313dd110dbe390038320b2d3cf24dcbe9b75cd9573e7f048f7233c02dd227\",\"license\":\"BUSL-1.1\"},\"contracts/utils/AccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { AuthorityUtils } from \\\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { IAccessManaged } from \\\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\\\";\\nimport { Context } from \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title AccessControl\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Fork of OpenZeppelin's `AccessManaged` contract\\n/// updated to make _checkCanCall to return bool\\n/// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/manager/AccessManaged.sol\\ncontract AccessManaged is Context, IAccessManaged {\\n address private _authority;\\n\\n bool private _consumingSchedule;\\n\\n /**\\n * @dev Initializes the contract connected to an initial authority.\\n */\\n constructor(address initialAuthority) {\\n _setAuthority(initialAuthority);\\n }\\n\\n /**\\n * @dev Restricts access to a function as defined by the connected Authority for this contract and the\\n * caller and selector of the function that entered the contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * In general, this modifier should only be used on `external` functions. It is okay to use it on `public`\\n * functions that are used as external entry points and are not called internally. Unless you know what you're\\n * doing, it should never be used on `internal` functions. Failure to follow these rules can have critical security\\n * implications! This is because the permissions are determined by the function that entered the contract, i.e. the\\n * function at the bottom of the call stack, and not the function where the modifier is visible in the source code.\\n * ====\\n *\\n * [WARNING]\\n * ====\\n * Avoid adding this modifier to the\\n * https://docs.soliditylang.org/en/v0.8.20/contracts.html#receive-ether-function[`receive()`]\\n * function or the https://docs.soliditylang.org/en/v0.8.20/contracts.html#fallback-function[`fallback()`]. These\\n * functions are the only execution paths where a function selector cannot be unambiguously determined from the\\n * calldata\\n * since the selector defaults to `0x00000000` in the `receive()` function and similarly in the `fallback()`\\n * function\\n * if no calldata is provided. (See {_checkCanCall}).\\n *\\n * The `receive()` function will always panic whereas the `fallback()` may panic depending on the calldata length.\\n * ====\\n */\\n modifier restricted() {\\n address caller = _msgSender();\\n require(_checkCanCall(caller, _msgData()), AccessManagedUnauthorized(caller));\\n _;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function authority() public view virtual returns (address) {\\n return _authority;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function setAuthority(address newAuthority) public virtual {\\n address caller = _msgSender();\\n if (caller != authority()) {\\n revert AccessManagedUnauthorized(caller);\\n }\\n if (newAuthority.code.length == 0) {\\n revert AccessManagedInvalidAuthority(newAuthority);\\n }\\n _setAuthority(newAuthority);\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function isConsumingScheduledOp() public view returns (bytes4) {\\n return _consumingSchedule ? this.isConsumingScheduledOp.selector : bytes4(0);\\n }\\n\\n /**\\n * @dev Transfers control to a new authority. Internal function with no access restriction. Allows bypassing the\\n * permissions set by the current authority.\\n */\\n function _setAuthority(address newAuthority) internal virtual {\\n _authority = newAuthority;\\n emit AuthorityUpdated(newAuthority);\\n }\\n\\n function _checkCanCall(address caller, bytes calldata data) internal virtual returns (bool) {\\n (bool immediate, uint32 delay) =\\n AuthorityUtils.canCallWithDelay(authority(), caller, address(this), bytes4(data[0:4]));\\n if (!immediate) {\\n if (delay > 0) {\\n _consumingSchedule = true;\\n IAccessManager(authority()).consumeScheduledOp(caller, data);\\n _consumingSchedule = false;\\n } else {\\n return false;\\n }\\n }\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x40dfee0e736695b3005df6c150a2d794ac06f3f4b91745e2959623e770044798\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { ICbETH } from \\\"contracts/interfaces/external/coinbase/ICbETH.sol\\\";\\nimport { ISfrxETH } from \\\"contracts/interfaces/external/frax/ISfrxETH.sol\\\";\\nimport { IStETH } from \\\"contracts/interfaces/external/lido/IStETH.sol\\\";\\nimport { IRETH } from \\\"contracts/interfaces/external/rocketPool/IRETH.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n STORAGE SLOTS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev Storage position of `DiamondStorage` structure\\n/// @dev Equals `keccak256(\\\"diamond.standard.diamond.storage\\\") - 1`\\nbytes32 constant DIAMOND_STORAGE_POSITION = 0xc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131b;\\n\\n/// @dev Storage position of `ParallelizerStorage` structure\\n/// @dev Equals `keccak256(\\\"diamond.standard.parallelizer.storage\\\") - 1`\\nbytes32 constant TRANSMUTER_STORAGE_POSITION = 0x4b2dd303f68b99d244b702089c802b6e9ea1b5d4ef61fd436d6c41abb1178c75;\\n\\n/// @dev Storage position of `ImplementationStorage` structure\\n/// @dev Equals `keccak256(\\\"eip1967.proxy.implementation\\\") - 1`\\nbytes32 constant IMPLEMENTATION_STORAGE_POSITION = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MATHS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nuint256 constant BASE_6 = 1e6;\\nuint256 constant BASE_8 = 1e8;\\nuint256 constant BASE_9 = 1e9;\\nuint256 constant BASE_12 = 1e12;\\nuint256 constant BPS = 1e14;\\nuint256 constant BASE_18 = 1e18;\\nuint256 constant HALF_BASE_27 = 1e27 / 2;\\nuint256 constant BASE_27 = 1e27;\\nuint256 constant BASE_36 = 1e36;\\nuint256 constant MAX_BURN_FEE = 999_000_000;\\nuint256 constant MAX_MINT_FEE = BASE_12 - 1;\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n REENTRANT \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n// The values being non-zero value makes deployment a bit more expensive,\\n// but in exchange the refund on every call to nonReentrant will be lower in\\n// amount. Since refunds are capped to a percentage of the total\\n// transaction's gas, it is best to keep them low in cases like this one, to\\n// increase the likelihood of the full refund coming into effect.\\nuint8 constant NOT_ENTERED = 1;\\nuint8 constant ENTERED = 2;\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n REENTRANT \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n// Role IDs for the AccessManager\\nuint64 constant GOVERNOR_ROLE = 10;\\nuint64 constant GUARDIAN_ROLE = 20;\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n COMMON ADDRESSES \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\naddress constant PERMIT_2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;\\naddress constant ODOS_ROUTER = 0x19cEeAd7105607Cd444F5ad10dd51356436095a1;\\nICbETH constant CBETH = ICbETH(0xBe9895146f7AF43049ca1c1AE358B0541Ea49704);\\nIRETH constant RETH = IRETH(0xae78736Cd615f374D3085123A210448E74Fc6393);\\nIStETH constant STETH = IStETH(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);\\nISfrxETH constant SFRXETH = ISfrxETH(0xac3E018457B222d93114458476f3E3416Abbe38F);\\naddress constant XEVT = 0x3Ee320c9F73a84D1717557af00695A34b26d1F1d;\\naddress constant USDM = 0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C;\\naddress constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;\\naddress constant EURC = 0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c;\\n\",\"keccak256\":\"0xc96a9c89a4d1b9f1a7f4ff42f56942d6f757e5b8528ecea53b18b68e2f88b559\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nerror AccessManagedUnauthorized(address caller);\\nerror AlreadyAdded();\\nerror CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector);\\nerror CannotAddSelectorsToZeroAddress(bytes4[] _selectors);\\nerror CannotRemoveFunctionThatDoesNotExist(bytes4 _selector);\\nerror CannotRemoveImmutableFunction(bytes4 _selector);\\nerror CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors);\\nerror CannotReplaceFunctionThatDoesNotExists(bytes4 _selector);\\nerror CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector);\\nerror CannotReplaceImmutableFunction(bytes4 _selector);\\nerror ContractHasNoCode();\\nerror CollateralBacked();\\nerror FunctionNotFound(bytes4 _functionSelector);\\nerror IncorrectFacetCutAction(uint8 _action);\\nerror InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);\\nerror InvalidChainlinkRate();\\nerror InvalidLengths();\\nerror InvalidNegativeFees();\\nerror InvalidOracleType();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidRate();\\nerror InvalidSwap();\\nerror InvalidTokens();\\nerror InvalidAccessManager();\\nerror ManagerHasAssets();\\nerror NoSelectorsProvidedForFacetForCut(address _facetAddress);\\nerror NotAllowed();\\nerror NotCollateral();\\nerror NotGovernor();\\nerror NotGuardian();\\nerror NotTrusted();\\nerror NotTrustedOrGuardian();\\nerror NotWhitelisted();\\nerror OdosSwapFailed();\\nerror OracleUpdateFailed();\\nerror Paused();\\nerror ReentrantCall();\\nerror RemoveFacetAddressMustBeZeroAddress(address _facetAddress);\\nerror TooBigAmountIn();\\nerror TooLate();\\nerror TooSmallAmountOut();\\nerror ZeroAddress();\\nerror ZeroAmount();\\nerror SwapError();\\nerror SlippageTooHigh();\\nerror InsufficientFunds();\\n\",\"keccak256\":\"0x1e2f6812ef78e948e5155d32213b52afff8c0ba5463d18bee10694efbf886130\",\"license\":\"BUSL-1.1\"}},\"version\":1}", - "bytecode": "0x60e080604052346101e95760c08161278a803803809161001f828561020f565b8339810103126101e95761003281610246565b9061003f60208201610246565b6040820151926001600160a01b038416918285036101e95760608401516001600160a01b03811681036101e95760a061007a60808701610246565b950151956001600160a01b038716958688036101e9575f80546001600160a01b0319166001600160a01b0390921691821790556040519081527f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90602090a160a052608052600480546001600160a01b039283166001600160a01b0319918216179091556005805493909216921691909117905581156102005760446020925f9460c052604051948593849263095ea7b360e01b84526004840152811960248401525af180156101f5576101b9575b60405161252f908161025b823960805181818161027601528181610ce401528181610e1b01528181611d1901526120ab015260a0518181816103bf0152818161066a01528181610e480152818161155201526115d9015260c05181818161040701528181610d5901526115960152f35b6020813d6020116101ed575b816101d26020938361020f565b810103126101e95751801515036101e9575f610149565b5f80fd5b3d91506101c5565b6040513d5f823e3d90fd5b63d92e233d60e01b5f5260045ffd5b601f909101601f19168101906001600160401b0382119082101761023257604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101e95756fe60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220f7392220a2d873c27631cf836ea0ca59ac953830b210fab4acd0d45ac60142a264736f6c634300081c0033", - "deployedBytecode": "0x60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220f7392220a2d873c27631cf836ea0ca59ac953830b210fab4acd0d45ac60142a264736f6c634300081c0033", - "devdoc": { - "author": "Cooper Labs", - "custom:contact": "security@cooperlabs.xyz", - "details": "Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol", - "errors": { - "SafeERC20FailedOperation(address)": [ - { - "details": "An operation with an ERC-20 token failed." - } - ] - }, - "events": { - "AuthorityUpdated(address)": { - "details": "Authority that manages this contract was updated." - } - }, - "kind": "dev", - "methods": { - "addBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to add to the budget", - "receiver": "address of the receiver" - } - }, - "authority()": { - "details": "Returns the current authority." - }, - "computeRebalanceAmount(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - }, - "returns": { - "amount": "amount to be rebalanced", - "increase": "whether the exposure should be increased" - } - }, - "harvest(address,uint256,bytes)": { - "details": "This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage" - }, - "isConsumingScheduledOp()": { - "details": "Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls." - }, - "onFlashLoan(address,address,uint256,uint256,bytes)": { - "details": "Receive a flash loan.", - "params": { - "amount": "The amount of tokens lent.", - "data": "Arbitrary data structure, intended to contain user-defined parameters.", - "fee": "The additional amount of tokens to repay.", - "initiator": "The initiator of the loan.", - "token": "The loan currency." - }, - "returns": { - "_0": "The keccak256 hash of \"ERC3156FlashBorrower.onFlashLoan\"" - } - }, - "recoverERC20(address,uint256,address)": { - "params": { - "amountToRecover": "amount to recover", - "to": "address to send the recovered tokens", - "tokenAddress": "address of the token to recover" - } - }, - "removeBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to remove from the budget", - "receiver": "address of the receiver" - } - }, - "setAuthority(address)": { - "details": "Transfers control to a new authority. The caller must be the current authority." - }, - "setMaxSlippage(address,uint96)": { - "params": { - "newMaxSlippage": "new max allowed slippage" - } - }, - "setSwapRouter(address)": { - "params": { - "newSwapRouter": "address of the swap router" - } - }, - "setTargetExposure(address,uint64)": { - "params": { - "targetExposure": "target exposure to the yield bearing asset used", - "yieldBearingAsset": "address of the yield bearing asset" - } - }, - "setTokenTransferAddress(address)": { - "params": { - "newTokenTransferAddress": "address of the token transfer contract" - } - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "params": { - "asset": "address of the asset", - "maxExposure": "maximum exposure within the Parallelizer to the asset", - "minExposure": "minimum exposure within the Parallelizer to the asset", - "overrideExposures": "whether limit exposures should be overriden or read onchain through the Parallelizer", - "targetExposure": "target exposure to the yieldBearingAsset asset used", - "yieldBearingAsset": "address of the yieldBearingAsset" - } - }, - "toggleTrusted(address)": { - "params": { - "trusted": "address to toggle the trusted status" - } - }, - "updateLimitExposuresYieldAsset(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - } - } - }, - "title": "GenericHarvester", - "version": 1 - }, - "userdoc": { - "events": { - "SwapRouterUpdated(address)": { - "notice": "Event emitted when the swap router is updated" - }, - "TokenTransferAddressUpdated(address)": { - "notice": "Event emitted when the token proxy is updated" - } - }, - "kind": "user", - "methods": { - "addBudget(uint256,address)": { - "notice": "Add budget to be spent by the receiver during the flashloan" - }, - "budget(address)": { - "notice": "Budget of tokenP available for each users" - }, - "computeRebalanceAmount(address)": { - "notice": "Compute the amount needed to rebalance the Parallelizer" - }, - "flashloan()": { - "notice": "Parallel stablecoin flashloan contract" - }, - "harvest(address,uint256,bytes)": { - "notice": "Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset" - }, - "isTrusted(address)": { - "notice": "trusted addresses that can update target exposure and do others non critical operations" - }, - "maxTokenSlippage(address)": { - "notice": "Max slippage when dealing with the Parallelizer" - }, - "parallelizer()": { - "notice": "Reference to the `parallelizer` implementation this contract aims at rebalancing" - }, - "recoverERC20(address,uint256,address)": { - "notice": "Recover ERC20 tokens" - }, - "removeBudget(uint256,address)": { - "notice": "Remove budget from the owner and send it to the receiver" - }, - "setMaxSlippage(address,uint96)": { - "notice": "Set the max allowed slippage" - }, - "setSwapRouter(address)": { - "notice": "Set the swap router" - }, - "setTargetExposure(address,uint64)": { - "notice": "Set the target exposure of a yield bearing asset" - }, - "setTokenTransferAddress(address)": { - "notice": "Set the token transfer address" - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "notice": "Set the yieldBearingAsset data" - }, - "swapRouter()": { - "notice": "address of the router/aggregator" - }, - "toggleTrusted(address)": { - "notice": "Toggle the trusted status of an address" - }, - "tokenP()": { - "notice": "TokenP handled by the `parallelizer` of interest" - }, - "tokenTransferAddress()": { - "notice": "address to approve to transfer tokens to" - }, - "updateLimitExposuresYieldAsset(address)": { - "notice": "Set the limit exposures to the asset linked to the yield bearing asset" - }, - "yieldBearingData(address)": { - "notice": "Data associated to a yield bearing asset" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 22997, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_authority", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 22999, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_consumingSchedule", - "offset": 20, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 8228, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxTokenSlippage", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_uint96)" - }, - { - "astId": 8234, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "yieldBearingData", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)" - }, - { - "astId": 8239, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "isTrusted", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 43, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "swapRouter", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 46, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "tokenTransferAddress", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 8956, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "budget", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct YieldBearingParams)", - "numberOfBytes": "32", - "value": "t_struct(YieldBearingParams)8169_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_address,t_uint96)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint96)", - "numberOfBytes": "32", - "value": "t_uint96" - }, - "t_struct(YieldBearingParams)8169_storage": { - "encoding": "inplace", - "label": "struct YieldBearingParams", - "members": [ - { - "astId": 8158, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "asset", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 8160, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "targetExposure", - "offset": 20, - "slot": "0", - "type": "t_uint64" - }, - { - "astId": 8162, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxExposure", - "offset": 0, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8164, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "minExposure", - "offset": 8, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8166, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "overrideExposures", - "offset": 16, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8168, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxSlippage", - "offset": 0, - "slot": "2", - "type": "t_uint96" - } - ], - "numberOfBytes": "96" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint64": { - "encoding": "inplace", - "label": "uint64", - "numberOfBytes": "8" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } - } -} \ No newline at end of file diff --git a/deployments/mainnet/GenericHarvester_USDp.json b/deployments/mainnet/GenericHarvester_USDp.json deleted file mode 100644 index ed0ab7c..0000000 --- a/deployments/mainnet/GenericHarvester_USDp.json +++ /dev/null @@ -1,1124 +0,0 @@ -{ - "address": "0x36DA06796fD9d22BCD6287b66A87FfdadB12636C", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "initialTokenTransferAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "initialSwapRouter", - "type": "address" - }, - { - "internalType": "contract ITokenP", - "name": "definitivetokenP", - "type": "address" - }, - { - "internalType": "contract IParallelizer", - "name": "definitiveParallelizer", - "type": "address" - }, - { - "internalType": "address", - "name": "initialAuthority", - "type": "address" - }, - { - "internalType": "contract IERC3156FlashLender", - "name": "definitiveFlashloan", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AccessManagedInvalidAuthority", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "internalType": "uint32", - "name": "delay", - "type": "uint32" - } - ], - "name": "AccessManagedRequiredDelay", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "AccessManagedUnauthorized", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidParam", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrusted", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrustedOrGuardian", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", - "type": "error" - }, - { - "inputs": [], - "name": "SwapError", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAmount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "SwapRouterUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "TokenTransferAddressUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "trusted", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "status", - "type": "bool" - } - ], - "name": "TrustedToggled", - "type": "event" - }, - { - "inputs": [], - "name": "CALLBACK_SUCCESS", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "addBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "authority", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "budget", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "computeRebalanceAmount", - "outputs": [ - { - "internalType": "uint8", - "name": "increase", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "flashloan", - "outputs": [ - { - "internalType": "contract IERC3156FlashLender", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "scale", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "name": "harvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isConsumingScheduledOp", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isTrusted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "initiator", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "onFlashLoan", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "parallelizer", - "outputs": [ - { - "internalType": "contract IParallelizer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToRecover", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "recoverERC20", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "removeBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAuthority", - "type": "address" - } - ], - "name": "setAuthority", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint96", - "name": "newMaxSlippage", - "type": "uint96" - } - ], - "name": "setMaxSlippage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "setSwapRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - } - ], - "name": "setTargetExposure", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "setTokenTransferAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "name": "setYieldBearingAssetData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapRouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "trusted", - "type": "address" - } - ], - "name": "toggleTrusted", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "tokenP", - "outputs": [ - { - "internalType": "contract ITokenP", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenTransferAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "updateLimitExposuresYieldAsset", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "yieldBearingData", - "outputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0x78fe720c21dd98061214a9c0d69c36b334885e137b70a84d82896ec5a122ed43", - "receipt": { - "to": null, - "from": "0x66CcEC236bbcE5f1bBd1b2fC0a4014e57A55ad02", - "contractAddress": "0x36DA06796fD9d22BCD6287b66A87FfdadB12636C", - "transactionIndex": 23, - "gasUsed": "2210601", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000010000000000000000000000000000000000400000000000000000000000000000008000000000000000000040000000000020000000080010000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000008000000000000010011000000000000008000000000000000000000000820000000000000000", - "blockHash": "0x72aeb2adc9b23d9bcb197b167959c0e6a72b511afdcb61b2ce66a5d6ef399fa3", - "transactionHash": "0x78fe720c21dd98061214a9c0d69c36b334885e137b70a84d82896ec5a122ed43", - "logs": [ - { - "transactionIndex": 23, - "blockNumber": 22767046, - "transactionHash": "0x78fe720c21dd98061214a9c0d69c36b334885e137b70a84d82896ec5a122ed43", - "address": "0x36DA06796fD9d22BCD6287b66A87FfdadB12636C", - "topics": [ - "0x2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad" - ], - "data": "0x00000000000000000000000094ea8800444017695345156319e96bdb1e355f7a", - "logIndex": 222, - "blockHash": "0x72aeb2adc9b23d9bcb197b167959c0e6a72b511afdcb61b2ce66a5d6ef399fa3" - }, - { - "transactionIndex": 23, - "blockNumber": 22767046, - "transactionHash": "0x78fe720c21dd98061214a9c0d69c36b334885e137b70a84d82896ec5a122ed43", - "address": "0x9B3a8f7CEC208e247d97dEE13313690977e24459", - "topics": [ - "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", - "0x00000000000000000000000036da06796fd9d22bcd6287b66a87ffdadb12636c", - "0x000000000000000000000000c9b6279baa19dbb8bcc3250c89caa093aaba0bfc" - ], - "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "logIndex": 223, - "blockHash": "0x72aeb2adc9b23d9bcb197b167959c0e6a72b511afdcb61b2ce66a5d6ef399fa3" - } - ], - "blockNumber": 22767046, - "cumulativeGasUsed": "10462236", - "status": 1, - "byzantium": true - }, - "args": [ - "0xcf5540fffcdc3d510b18bfca6d2b9987b0772559", - "0xcf5540fffcdc3d510b18bfca6d2b9987b0772559", - "0x9B3a8f7CEC208e247d97dEE13313690977e24459", - "0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2", - "0x94Ea8800444017695345156319e96bdB1E355F7a", - "0xC9B6279baa19dBB8bCc3250c89cAa093AaBA0bfc" - ], - "numDeployments": 1, - "solcInputHash": "9e6800737641b3b015331b65b5c620c3", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialTokenTransferAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialSwapRouter\",\"type\":\"address\"},{\"internalType\":\"contract ITokenP\",\"name\":\"definitivetokenP\",\"type\":\"address\"},{\"internalType\":\"contract IParallelizer\",\"name\":\"definitiveParallelizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAuthority\",\"type\":\"address\"},{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"definitiveFlashloan\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AccessManagedInvalidAuthority\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"AccessManagedRequiredDelay\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"AccessManagedUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrustedOrGuardian\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SwapError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"SwapRouterUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"TokenTransferAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CALLBACK_SUCCESS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"addBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"authority\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"budget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"computeRebalanceAmount\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"increase\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flashloan\",\"outputs\":[{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"scale\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"harvest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isConsumingScheduledOp\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isTrusted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxTokenSlippage\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onFlashLoan\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parallelizer\",\"outputs\":[{\"internalType\":\"contract IParallelizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"removeBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAuthority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"newMaxSlippage\",\"type\":\"uint96\"}],\"name\":\"setMaxSlippage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"setSwapRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"}],\"name\":\"setTargetExposure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"setTokenTransferAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"name\":\"setYieldBearingAssetData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenP\",\"outputs\":[{\"internalType\":\"contract ITokenP\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenTransferAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"updateLimitExposuresYieldAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"yieldBearingData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Cooper Labs\",\"custom:contact\":\"security@cooperlabs.xyz\",\"details\":\"Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\",\"errors\":{\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"AuthorityUpdated(address)\":{\"details\":\"Authority that manages this contract was updated.\"}},\"kind\":\"dev\",\"methods\":{\"addBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to add to the budget\",\"receiver\":\"address of the receiver\"}},\"authority()\":{\"details\":\"Returns the current authority.\"},\"computeRebalanceAmount(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"},\"returns\":{\"amount\":\"amount to be rebalanced\",\"increase\":\"whether the exposure should be increased\"}},\"harvest(address,uint256,bytes)\":{\"details\":\"This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage\"},\"isConsumingScheduledOp()\":{\"details\":\"Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls.\"},\"onFlashLoan(address,address,uint256,uint256,bytes)\":{\"details\":\"Receive a flash loan.\",\"params\":{\"amount\":\"The amount of tokens lent.\",\"data\":\"Arbitrary data structure, intended to contain user-defined parameters.\",\"fee\":\"The additional amount of tokens to repay.\",\"initiator\":\"The initiator of the loan.\",\"token\":\"The loan currency.\"},\"returns\":{\"_0\":\"The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\"}},\"recoverERC20(address,uint256,address)\":{\"params\":{\"amountToRecover\":\"amount to recover\",\"to\":\"address to send the recovered tokens\",\"tokenAddress\":\"address of the token to recover\"}},\"removeBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to remove from the budget\",\"receiver\":\"address of the receiver\"}},\"setAuthority(address)\":{\"details\":\"Transfers control to a new authority. The caller must be the current authority.\"},\"setMaxSlippage(address,uint96)\":{\"params\":{\"newMaxSlippage\":\"new max allowed slippage\"}},\"setSwapRouter(address)\":{\"params\":{\"newSwapRouter\":\"address of the swap router\"}},\"setTargetExposure(address,uint64)\":{\"params\":{\"targetExposure\":\"target exposure to the yield bearing asset used\",\"yieldBearingAsset\":\"address of the yield bearing asset\"}},\"setTokenTransferAddress(address)\":{\"params\":{\"newTokenTransferAddress\":\"address of the token transfer contract\"}},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"params\":{\"asset\":\"address of the asset\",\"maxExposure\":\"maximum exposure within the Parallelizer to the asset\",\"minExposure\":\"minimum exposure within the Parallelizer to the asset\",\"overrideExposures\":\"whether limit exposures should be overriden or read onchain through the Parallelizer\",\"targetExposure\":\"target exposure to the yieldBearingAsset asset used\",\"yieldBearingAsset\":\"address of the yieldBearingAsset\"}},\"toggleTrusted(address)\":{\"params\":{\"trusted\":\"address to toggle the trusted status\"}},\"updateLimitExposuresYieldAsset(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"}}},\"title\":\"GenericHarvester\",\"version\":1},\"userdoc\":{\"events\":{\"SwapRouterUpdated(address)\":{\"notice\":\"Event emitted when the swap router is updated\"},\"TokenTransferAddressUpdated(address)\":{\"notice\":\"Event emitted when the token proxy is updated\"}},\"kind\":\"user\",\"methods\":{\"addBudget(uint256,address)\":{\"notice\":\"Add budget to be spent by the receiver during the flashloan\"},\"budget(address)\":{\"notice\":\"Budget of tokenP available for each users\"},\"computeRebalanceAmount(address)\":{\"notice\":\"Compute the amount needed to rebalance the Parallelizer\"},\"flashloan()\":{\"notice\":\"Parallel stablecoin flashloan contract\"},\"harvest(address,uint256,bytes)\":{\"notice\":\"Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset\"},\"isTrusted(address)\":{\"notice\":\"trusted addresses that can update target exposure and do others non critical operations\"},\"maxTokenSlippage(address)\":{\"notice\":\"Max slippage when dealing with the Parallelizer\"},\"parallelizer()\":{\"notice\":\"Reference to the `parallelizer` implementation this contract aims at rebalancing\"},\"recoverERC20(address,uint256,address)\":{\"notice\":\"Recover ERC20 tokens\"},\"removeBudget(uint256,address)\":{\"notice\":\"Remove budget from the owner and send it to the receiver\"},\"setMaxSlippage(address,uint96)\":{\"notice\":\"Set the max allowed slippage\"},\"setSwapRouter(address)\":{\"notice\":\"Set the swap router\"},\"setTargetExposure(address,uint64)\":{\"notice\":\"Set the target exposure of a yield bearing asset\"},\"setTokenTransferAddress(address)\":{\"notice\":\"Set the token transfer address\"},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"notice\":\"Set the yieldBearingAsset data\"},\"swapRouter()\":{\"notice\":\"address of the router/aggregator\"},\"toggleTrusted(address)\":{\"notice\":\"Toggle the trusted status of an address\"},\"tokenP()\":{\"notice\":\"TokenP handled by the `parallelizer` of interest\"},\"tokenTransferAddress()\":{\"notice\":\"address to approve to transfer tokens to\"},\"updateLimitExposuresYieldAsset(address)\":{\"notice\":\"Set the limit exposures to the asset linked to the yield bearing asset\"},\"yieldBearingData(address)\":{\"notice\":\"Data associated to a yield bearing asset\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/helpers/GenericHarvester.sol\":\"GenericHarvester\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@helpers/RouterSwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20, IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/// @title Swapper\\n/// @author Angle Labs, Inc.\\n/// @dev Abstract contract for swapping tokens using a router/aggregator\\n/// @dev This contract is an authorized fork of Angle's `RouterSwapper` contract\\n/// https://github.com/AngleProtocol/utils/blob/main/src/RouterSwapper.sol\\nabstract contract RouterSwapper {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERRORS\\n //////////////////////////////////////////////////////////////*/\\n\\n error SwapError();\\n error ZeroAddress();\\n\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Event emitted when the swap router is updated\\n */\\n event SwapRouterUpdated(address newSwapRouter);\\n /**\\n * @notice Event emitted when the token proxy is updated\\n */\\n event TokenTransferAddressUpdated(address newTokenTransferAddress);\\n\\n /*//////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////*/\\n\\n modifier noZeroAddress(address targetAddress) {\\n if (targetAddress == address(0)) {\\n revert ZeroAddress();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n MUTABLE VARIABLES\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice address of the router/aggregator\\n */\\n address public swapRouter;\\n /**\\n * @notice address to approve to transfer tokens to\\n */\\n address public tokenTransferAddress;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address initialSwapRouter, address initialTokenTransferAddress) {\\n swapRouter = initialSwapRouter;\\n tokenTransferAddress = initialTokenTransferAddress;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the router/aggregator address\\n * @param newSwapRouter address of the new router/aggregator\\n */\\n function setSwapRouter(address newSwapRouter) public virtual noZeroAddress(newSwapRouter) {\\n swapRouter = newSwapRouter;\\n\\n emit SwapRouterUpdated(newSwapRouter);\\n }\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the new token transfer address\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress)\\n public\\n virtual\\n noZeroAddress(newTokenTransferAddress)\\n {\\n tokenTransferAddress = newTokenTransferAddress;\\n\\n emit TokenTransferAddressUpdated(newTokenTransferAddress);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n SWAP FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Approve the router/aggregator to spend the token if needed\\n * @param token address of the token to approve\\n * @param spender address of the router/aggregator\\n * @param amount amount to approve\\n */\\n function _approveTokenIfNeeded(address token, address spender, uint256 amount) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), spender);\\n if (allowance < amount) {\\n IERC20(token).safeIncreaseAllowance(spender, amount - allowance);\\n }\\n }\\n\\n /**\\n * @notice Perform the swap using the router/aggregator\\n * @param callData bytes to call the router/aggregator\\n */\\n function _performRouterSwap(bytes memory callData) internal {\\n (bool success, bytes memory retData) = swapRouter.call(callData);\\n\\n if (!success) {\\n if (retData.length != 0) {\\n assembly (\\\"memory-safe\\\") {\\n revert(add(32, retData), mload(retData))\\n }\\n }\\n revert SwapError();\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swapCalldata(address[] calldata tokens, bytes[] calldata callDatas, uint256[] calldata amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swap(address[] memory tokens, bytes[] memory callDatas, uint256[] memory amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8c5a6b026a95816806814ef681b6b225ea4c405a39a4eab0111921853202829c\",\"license\":\"GPL-3.0\"},\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/AuthorityUtils.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\nlibrary AuthorityUtils {\\n /**\\n * @dev Since `AccessManager` implements an extended IAuthority interface, invoking `canCall` with backwards compatibility\\n * for the preexisting `IAuthority` interface requires special care to avoid reverting on insufficient return data.\\n * This helper function takes care of invoking `canCall` in a backwards compatible way without reverting.\\n */\\n function canCallWithDelay(\\n address authority,\\n address caller,\\n address target,\\n bytes4 selector\\n ) internal view returns (bool immediate, uint32 delay) {\\n (bool success, bytes memory data) = authority.staticcall(\\n abi.encodeCall(IAuthority.canCall, (caller, target, selector))\\n );\\n if (success) {\\n if (data.length >= 0x40) {\\n (immediate, delay) = abi.decode(data, (bool, uint32));\\n } else if (data.length >= 0x20) {\\n immediate = abi.decode(data, (bool));\\n }\\n }\\n return (immediate, delay);\\n }\\n}\\n\",\"keccak256\":\"0xb3875997b0d8705e29aa20fee88e1dfef93df438794ae1ad8ba2eb016a4dd4e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAccessManaged.sol)\\n\\npragma solidity ^0.8.20;\\n\\ninterface IAccessManaged {\\n /**\\n * @dev Authority that manages this contract was updated.\\n */\\n event AuthorityUpdated(address authority);\\n\\n error AccessManagedUnauthorized(address caller);\\n error AccessManagedRequiredDelay(address caller, uint32 delay);\\n error AccessManagedInvalidAuthority(address authority);\\n\\n /**\\n * @dev Returns the current authority.\\n */\\n function authority() external view returns (address);\\n\\n /**\\n * @dev Transfers control to a new authority. The caller must be the current authority.\\n */\\n function setAuthority(address) external;\\n\\n /**\\n * @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n * being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n * attacker controlled calls.\\n */\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaba93d42cd70e1418782951132d97b31ddce5f50ad81090884b6d0e41caac9d6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (access/manager/IAccessManager.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Time} from \\\"../../utils/types/Time.sol\\\";\\n\\ninterface IAccessManager {\\n /**\\n * @dev A delayed operation was scheduled.\\n */\\n event OperationScheduled(\\n bytes32 indexed operationId,\\n uint32 indexed nonce,\\n uint48 schedule,\\n address caller,\\n address target,\\n bytes data\\n );\\n\\n /**\\n * @dev A scheduled operation was executed.\\n */\\n event OperationExecuted(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev A scheduled operation was canceled.\\n */\\n event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev Informational labelling for a roleId.\\n */\\n event RoleLabel(uint64 indexed roleId, string label);\\n\\n /**\\n * @dev Emitted when `account` is granted `roleId`.\\n *\\n * NOTE: The meaning of the `since` argument depends on the `newMember` argument.\\n * If the role is granted to a new member, the `since` argument indicates when the account becomes a member of the role,\\n * otherwise it indicates the execution delay for this account and roleId is updated.\\n */\\n event RoleGranted(uint64 indexed roleId, address indexed account, uint32 delay, uint48 since, bool newMember);\\n\\n /**\\n * @dev Emitted when `account` membership or `roleId` is revoked. Unlike granting, revoking is instantaneous.\\n */\\n event RoleRevoked(uint64 indexed roleId, address indexed account);\\n\\n /**\\n * @dev Role acting as admin over a given `roleId` is updated.\\n */\\n event RoleAdminChanged(uint64 indexed roleId, uint64 indexed admin);\\n\\n /**\\n * @dev Role acting as guardian over a given `roleId` is updated.\\n */\\n event RoleGuardianChanged(uint64 indexed roleId, uint64 indexed guardian);\\n\\n /**\\n * @dev Grant delay for a given `roleId` will be updated to `delay` when `since` is reached.\\n */\\n event RoleGrantDelayChanged(uint64 indexed roleId, uint32 delay, uint48 since);\\n\\n /**\\n * @dev Target mode is updated (true = closed, false = open).\\n */\\n event TargetClosed(address indexed target, bool closed);\\n\\n /**\\n * @dev Role required to invoke `selector` on `target` is updated to `roleId`.\\n */\\n event TargetFunctionRoleUpdated(address indexed target, bytes4 selector, uint64 indexed roleId);\\n\\n /**\\n * @dev Admin delay for a given `target` will be updated to `delay` when `since` is reached.\\n */\\n event TargetAdminDelayUpdated(address indexed target, uint32 delay, uint48 since);\\n\\n error AccessManagerAlreadyScheduled(bytes32 operationId);\\n error AccessManagerNotScheduled(bytes32 operationId);\\n error AccessManagerNotReady(bytes32 operationId);\\n error AccessManagerExpired(bytes32 operationId);\\n error AccessManagerLockedRole(uint64 roleId);\\n error AccessManagerBadConfirmation();\\n error AccessManagerUnauthorizedAccount(address msgsender, uint64 roleId);\\n error AccessManagerUnauthorizedCall(address caller, address target, bytes4 selector);\\n error AccessManagerUnauthorizedConsume(address target);\\n error AccessManagerUnauthorizedCancel(address msgsender, address caller, address target, bytes4 selector);\\n error AccessManagerInvalidInitialAdmin(address initialAdmin);\\n\\n /**\\n * @dev Check if an address (`caller`) is authorised to call a given function on a given contract directly (with\\n * no restriction). Additionally, it returns the delay needed to perform the call indirectly through the {schedule}\\n * & {execute} workflow.\\n *\\n * This function is usually called by the targeted contract to control immediate execution of restricted functions.\\n * Therefore we only return true if the call can be performed without any delay. If the call is subject to a\\n * previously set delay (not zero), then the function should return false and the caller should schedule the operation\\n * for future execution.\\n *\\n * If `immediate` is true, the delay can be disregarded and the operation can be immediately executed, otherwise\\n * the operation can be executed if and only if delay is greater than 0.\\n *\\n * NOTE: The IAuthority interface does not include the `uint32` delay. This is an extension of that interface that\\n * is backward compatible. Some contracts may thus ignore the second return argument. In that case they will fail\\n * to identify the indirect workflow, and will consider calls that require a delay to be forbidden.\\n *\\n * NOTE: This function does not report the permissions of the admin functions in the manager itself. These are defined by the\\n * {AccessManager} documentation.\\n */\\n function canCall(\\n address caller,\\n address target,\\n bytes4 selector\\n ) external view returns (bool allowed, uint32 delay);\\n\\n /**\\n * @dev Expiration delay for scheduled proposals. Defaults to 1 week.\\n *\\n * IMPORTANT: Avoid overriding the expiration with 0. Otherwise every contract proposal will be expired immediately,\\n * disabling any scheduling usage.\\n */\\n function expiration() external view returns (uint32);\\n\\n /**\\n * @dev Minimum setback for all delay updates, with the exception of execution delays. It\\n * can be increased without setback (and reset via {revokeRole} in the case event of an\\n * accidental increase). Defaults to 5 days.\\n */\\n function minSetback() external view returns (uint32);\\n\\n /**\\n * @dev Get whether the contract is closed disabling any access. Otherwise role permissions are applied.\\n *\\n * NOTE: When the manager itself is closed, admin functions are still accessible to avoid locking the contract.\\n */\\n function isTargetClosed(address target) external view returns (bool);\\n\\n /**\\n * @dev Get the role required to call a function.\\n */\\n function getTargetFunctionRole(address target, bytes4 selector) external view returns (uint64);\\n\\n /**\\n * @dev Get the admin delay for a target contract. Changes to contract configuration are subject to this delay.\\n */\\n function getTargetAdminDelay(address target) external view returns (uint32);\\n\\n /**\\n * @dev Get the id of the role that acts as an admin for the given role.\\n *\\n * The admin permission is required to grant the role, revoke the role and update the execution delay to execute\\n * an operation that is restricted to this role.\\n */\\n function getRoleAdmin(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role that acts as a guardian for a given role.\\n *\\n * The guardian permission allows canceling operations that have been scheduled under the role.\\n */\\n function getRoleGuardian(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role current grant delay.\\n *\\n * Its value may change at any point without an event emitted following a call to {setGrantDelay}.\\n * Changes to this value, including effect timepoint are notified in advance by the {RoleGrantDelayChanged} event.\\n */\\n function getRoleGrantDelay(uint64 roleId) external view returns (uint32);\\n\\n /**\\n * @dev Get the access details for a given account for a given role. These details include the timepoint at which\\n * membership becomes active, and the delay applied to all operation by this user that requires this permission\\n * level.\\n *\\n * Returns:\\n * [0] Timestamp at which the account membership becomes valid. 0 means role is not granted.\\n * [1] Current execution delay for the account.\\n * [2] Pending execution delay for the account.\\n * [3] Timestamp at which the pending execution delay will become active. 0 means no delay update is scheduled.\\n */\\n function getAccess(\\n uint64 roleId,\\n address account\\n ) external view returns (uint48 since, uint32 currentDelay, uint32 pendingDelay, uint48 effect);\\n\\n /**\\n * @dev Check if a given account currently has the permission level corresponding to a given role. Note that this\\n * permission might be associated with an execution delay. {getAccess} can provide more details.\\n */\\n function hasRole(uint64 roleId, address account) external view returns (bool isMember, uint32 executionDelay);\\n\\n /**\\n * @dev Give a label to a role, for improved role discoverability by UIs.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleLabel} event.\\n */\\n function labelRole(uint64 roleId, string calldata label) external;\\n\\n /**\\n * @dev Add `account` to `roleId`, or change its execution delay.\\n *\\n * This gives the account the authorization to call any function that is restricted to this role. An optional\\n * execution delay (in seconds) can be set. If that delay is non 0, the user is required to schedule any operation\\n * that is restricted to members of this role. The user will only be able to execute the operation after the delay has\\n * passed, before it has expired. During this period, admin and guardians can cancel the operation (see {cancel}).\\n *\\n * If the account has already been granted this role, the execution delay will be updated. This update is not\\n * immediate and follows the delay rules. For example, if a user currently has a delay of 3 hours, and this is\\n * called to reduce that delay to 1 hour, the new delay will take some time to take effect, enforcing that any\\n * operation executed in the 3 hours that follows this update was indeed scheduled before this update.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - granted role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleGranted} event.\\n */\\n function grantRole(uint64 roleId, address account, uint32 executionDelay) external;\\n\\n /**\\n * @dev Remove an account from a role, with immediate effect. If the account does not have the role, this call has\\n * no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - revoked role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function revokeRole(uint64 roleId, address account) external;\\n\\n /**\\n * @dev Renounce role permissions for the calling account with immediate effect. If the sender is not in\\n * the role this call has no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be `callerConfirmation`.\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function renounceRole(uint64 roleId, address callerConfirmation) external;\\n\\n /**\\n * @dev Change admin role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleAdminChanged} event\\n */\\n function setRoleAdmin(uint64 roleId, uint64 admin) external;\\n\\n /**\\n * @dev Change guardian role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGuardianChanged} event\\n */\\n function setRoleGuardian(uint64 roleId, uint64 guardian) external;\\n\\n /**\\n * @dev Update the delay for granting a `roleId`.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGrantDelayChanged} event.\\n */\\n function setGrantDelay(uint64 roleId, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the role required to call functions identified by the `selectors` in the `target` contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetFunctionRoleUpdated} event per selector.\\n */\\n function setTargetFunctionRole(address target, bytes4[] calldata selectors, uint64 roleId) external;\\n\\n /**\\n * @dev Set the delay for changing the configuration of a given target contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetAdminDelayUpdated} event.\\n */\\n function setTargetAdminDelay(address target, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the closed flag for a contract.\\n *\\n * Closing the manager itself won't disable access to admin methods to avoid locking the contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetClosed} event.\\n */\\n function setTargetClosed(address target, bool closed) external;\\n\\n /**\\n * @dev Return the timepoint at which a scheduled operation will be ready for execution. This returns 0 if the\\n * operation is not yet scheduled, has expired, was executed, or was canceled.\\n */\\n function getSchedule(bytes32 id) external view returns (uint48);\\n\\n /**\\n * @dev Return the nonce for the latest scheduled operation with a given id. Returns 0 if the operation has never\\n * been scheduled.\\n */\\n function getNonce(bytes32 id) external view returns (uint32);\\n\\n /**\\n * @dev Schedule a delayed operation for future execution, and return the operation identifier. It is possible to\\n * choose the timestamp at which the operation becomes executable as long as it satisfies the execution delays\\n * required for the caller. The special value zero will automatically set the earliest possible time.\\n *\\n * Returns the `operationId` that was scheduled. Since this value is a hash of the parameters, it can reoccur when\\n * the same parameters are used; if this is relevant, the returned `nonce` can be used to uniquely identify this\\n * scheduled operation from other occurrences of the same `operationId` in invocations of {execute} and {cancel}.\\n *\\n * Emits a {OperationScheduled} event.\\n *\\n * NOTE: It is not possible to concurrently schedule more than one operation with the same `target` and `data`. If\\n * this is necessary, a random byte can be appended to `data` to act as a salt that will be ignored by the target\\n * contract if it is using standard Solidity ABI encoding.\\n */\\n function schedule(\\n address target,\\n bytes calldata data,\\n uint48 when\\n ) external returns (bytes32 operationId, uint32 nonce);\\n\\n /**\\n * @dev Execute a function that is delay restricted, provided it was properly scheduled beforehand, or the\\n * execution delay is 0.\\n *\\n * Returns the nonce that identifies the previously scheduled operation that is executed, or 0 if the\\n * operation wasn't previously scheduled (if the caller doesn't have an execution delay).\\n *\\n * Emits an {OperationExecuted} event only if the call was scheduled and delayed.\\n */\\n function execute(address target, bytes calldata data) external payable returns (uint32);\\n\\n /**\\n * @dev Cancel a scheduled (delayed) operation. Returns the nonce that identifies the previously scheduled\\n * operation that is cancelled.\\n *\\n * Requirements:\\n *\\n * - the caller must be the proposer, a guardian of the targeted function, or a global admin\\n *\\n * Emits a {OperationCanceled} event.\\n */\\n function cancel(address caller, address target, bytes calldata data) external returns (uint32);\\n\\n /**\\n * @dev Consume a scheduled operation targeting the caller. If such an operation exists, mark it as consumed\\n * (emit an {OperationExecuted} event and clean the state). Otherwise, throw an error.\\n *\\n * This is useful for contract that want to enforce that calls targeting them were scheduled on the manager,\\n * with all the verifications that it implies.\\n *\\n * Emit a {OperationExecuted} event.\\n */\\n function consumeScheduledOp(address caller, bytes calldata data) external;\\n\\n /**\\n * @dev Hashing function for delayed operations.\\n */\\n function hashOperation(address caller, address target, bytes calldata data) external view returns (bytes32);\\n\\n /**\\n * @dev Changes the authority of a target managed by this manager instance.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n */\\n function updateAuthority(address target, address newAuthority) external;\\n}\\n\",\"keccak256\":\"0x9be2d08a326515805bc9cf6315b7953f8d1ebe88abf48c2d645fb1fa8211a0e2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAuthority.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Standard interface for permissioning originally defined in Dappsys.\\n */\\ninterface IAuthority {\\n /**\\n * @dev Returns true if the caller can invoke on a target the function identified by a function selector.\\n */\\n function canCall(address caller, address target, bytes4 selector) external view returns (bool allowed);\\n}\\n\",\"keccak256\":\"0x4cc0766bd7fb7b3bafb70afa2a93b6e313a0baec7a35ad1b57505be7861c1030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"./IERC20.sol\\\";\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @title IERC1363\\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\\n *\\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\\n */\\ninterface IERC1363 is IERC20, IERC165 {\\n /*\\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\\n * 0xb0202a11 ===\\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\\n */\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @param data Additional data with no specified format, sent in call to `spender`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9b6b3e7803bc5f2f8cd7ad57db8ac1def61a9930a5a3107df4882e028a9605d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xde7e9fd9aee8d4f40772f96bb3b58836cbc6dfc0227014a061947f8821ea9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0xce41876e78d1badc0512229b4d14e4daf83bc1003d7f83978d18e0e56f965b9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashBorrower.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashBorrower, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashBorrower {\\n /**\\n * @dev Receive a flash loan.\\n * @param initiator The initiator of the loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param fee The additional amount of tokens to repay.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n * @return The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\\n */\\n function onFlashLoan(\\n address initiator,\\n address token,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n ) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0x0b1459615b9b47c2a4eec8e72f23ccc601f1d711f679a1c06b3390459021a341\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashLender.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC3156FlashBorrower} from \\\"./IERC3156FlashBorrower.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashLender, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashLender {\\n /**\\n * @dev The amount of currency available to be lended.\\n * @param token The loan currency.\\n * @return The amount of `token` that can be borrowed.\\n */\\n function maxFlashLoan(address token) external view returns (uint256);\\n\\n /**\\n * @dev The fee to be charged for a given loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @return The amount of `token` to be charged for the loan, on top of the returned principal.\\n */\\n function flashFee(address token, uint256 amount) external view returns (uint256);\\n\\n /**\\n * @dev Initiate a flash loan.\\n * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n */\\n function flashLoan(\\n IERC3156FlashBorrower receiver,\\n address token,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x5d19ea24c555cf6a5dbafea9fac57887cc3e72154f3ee8e0a2bf67971811c14b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xe06a3f08a987af6ad2e1c1e774405d4fe08f1694b67517438b467cecf0da0ef7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.20;\\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\",\"keccak256\":\"0x70f2f713b13b7ce4610bcd0ac9fec0f3cc43693b043abcb8dc40a42a726eb330\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.2.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 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\",\"keccak256\":\"0x4ea01544758fd2c7045961904686bfe232d2220a04ecaa2d6b08dac17827febf\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Panic.sol\":{\"content\":\"// 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\",\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x79796192ec90263f21b464d5bc90b777a525971d3de8232be80d9c4f9fb353b8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.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 Returns the addition of two unsigned integers, with an 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 if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\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 if (b == 0) return (false, 0);\\n return (true, a / b);\\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 if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\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 // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2\\u00b2\\u2075\\u2076 and mod 2\\u00b2\\u2075\\u2076 - 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 = prod1 * 2\\u00b2\\u2075\\u2076 + prod0.\\n uint256 prod0 = x * y; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 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 prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2\\u00b2\\u2075\\u2076. Also prevents denominator == 0.\\n if (denominator <= prod1) {\\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 [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, 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 {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2\\u00b2\\u2075\\u2076 / 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 prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2\\u00b2\\u2075\\u2076. Now that denominator is an odd number, it has an inverse modulo 2\\u00b2\\u2075\\u2076 such\\n // that denominator * inv \\u2261 1 mod 2\\u00b2\\u2075\\u2076. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv \\u2261 1 mod 2\\u2074.\\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\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u2076\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b3\\u00b2\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u2076\\u2074\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u00b2\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b2\\u2075\\u2076\\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\\u00b2\\u2075\\u2076. Since the preconditions guarantee that the outcome is\\n // less than 2\\u00b2\\u2075\\u2076, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * 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 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 \\u2261 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) \\u2261 1 mod p`. As a consequence, we have `a * a**(p-2) \\u2261 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\\u00b2 - 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 `\\u03b5_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) \\u2264 sqrt(a) < 2**e`). We know that `e \\u2264 128` because `(2\\u00b9\\u00b2\\u2078)\\u00b2 = 2\\u00b2\\u2075\\u2076` is\\n // bigger than any uint256.\\n //\\n // By noticing that\\n // `2**(e-1) \\u2264 sqrt(a) < 2**e \\u2192 (2**(e-1))\\u00b2 \\u2264 a < (2**e)\\u00b2 \\u2192 2**(2*e-2) \\u2264 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) \\u2264 sqrt(a) < 2**e = 2 * x_n`. This implies \\u03b5_n \\u2264 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 \\u03b5_n \\u2264 2**(e-2).\\n // This is going to be our x_0 (and \\u03b5_0)\\n xn = (3 * xn) >> 1; // \\u03b5_0 := | x_0 - sqrt(a) | \\u2264 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}\\u00b2 - a = ((x_n + a / x_n) / 2)\\u00b2 - a\\n // = ((x_n\\u00b2 + a) / (2 * x_n))\\u00b2 - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2) - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2 - 4 * a * x_n\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u2074 - 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u00b2 - a)\\u00b2 / (2 * x_n)\\u00b2\\n // = ((x_n\\u00b2 - a) / (2 * x_n))\\u00b2\\n // \\u2265 0\\n // Which proves that for all n \\u2265 1, sqrt(a) \\u2264 x_n\\n //\\n // This gives us the proof of quadratic convergence of the sequence:\\n // \\u03b5_{n+1} = | x_{n+1} - sqrt(a) |\\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\\n // = | (x_n\\u00b2 + a - 2*x_n*sqrt(a)) / (2 * x_n) |\\n // = | (x_n - sqrt(a))\\u00b2 / (2 * x_n) |\\n // = | \\u03b5_n\\u00b2 / (2 * x_n) |\\n // = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n //\\n // For the first iteration, we have a special case where x_0 is known:\\n // \\u03b5_1 = \\u03b5_0\\u00b2 / | (2 * x_0) |\\n // \\u2264 (2**(e-2))\\u00b2 / (2 * (2**(e-1) + 2**(e-2)))\\n // \\u2264 2**(2*e-4) / (3 * 2**(e-1))\\n // \\u2264 2**(e-3) / 3\\n // \\u2264 2**(e-3-log2(3))\\n // \\u2264 2**(e-4.5)\\n //\\n // For the following iterations, we use the fact that, 2**(e-1) \\u2264 sqrt(a) \\u2264 x_n:\\n // \\u03b5_{n+1} = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n // \\u2264 (2**(e-k))\\u00b2 / (2 * 2**(e-1))\\n // \\u2264 2**(2*e-2*k) / 2**e\\n // \\u2264 2**(e-2*k)\\n xn = (xn + a / xn) >> 1; // \\u03b5_1 := | x_1 - sqrt(a) | \\u2264 2**(e-4.5) -- special case, see above\\n xn = (xn + a / xn) >> 1; // \\u03b5_2 := | x_2 - sqrt(a) | \\u2264 2**(e-9) -- general case with k = 4.5\\n xn = (xn + a / xn) >> 1; // \\u03b5_3 := | x_3 - sqrt(a) | \\u2264 2**(e-18) -- general case with k = 9\\n xn = (xn + a / xn) >> 1; // \\u03b5_4 := | x_4 - sqrt(a) | \\u2264 2**(e-36) -- general case with k = 18\\n xn = (xn + a / xn) >> 1; // \\u03b5_5 := | x_5 - sqrt(a) | \\u2264 2**(e-72) -- general case with k = 36\\n xn = (xn + a / xn) >> 1; // \\u03b5_6 := | x_6 - sqrt(a) | \\u2264 2**(e-144) -- general case with k = 72\\n\\n // Because e \\u2264 128 (as discussed during the first estimation phase), we know have reached a precision\\n // \\u03b5_6 \\u2264 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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 exp;\\n unchecked {\\n exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);\\n value >>= exp;\\n result += exp;\\n\\n result += SafeCast.toUint(value > 1);\\n }\\n return result;\\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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 isGt;\\n unchecked {\\n isGt = SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= isGt * 128;\\n result += isGt * 16;\\n\\n isGt = SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= isGt * 64;\\n result += isGt * 8;\\n\\n isGt = SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= isGt * 32;\\n result += isGt * 4;\\n\\n isGt = SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= isGt * 16;\\n result += isGt * 2;\\n\\n result += SafeCast.toUint(value > (1 << 8) - 1);\\n }\\n return result;\\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\",\"keccak256\":\"0xa00be322d7db5786750ce0ac7e2f5b633ac30a5ed5fa1ced1e74acfc19acecea\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x195533c86d0ef72bcc06456a4f66a9b941f38eb403739b00f21fd7c1abd1ae54\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/types/Time.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/types/Time.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"../math/Math.sol\\\";\\nimport {SafeCast} from \\\"../math/SafeCast.sol\\\";\\n\\n/**\\n * @dev This library provides helpers for manipulating time-related objects.\\n *\\n * It uses the following types:\\n * - `uint48` for timepoints\\n * - `uint32` for durations\\n *\\n * While the library doesn't provide specific types for timepoints and duration, it does provide:\\n * - a `Delay` type to represent duration that can be programmed to change value automatically at a given point\\n * - additional helper functions\\n */\\nlibrary Time {\\n using Time for *;\\n\\n /**\\n * @dev Get the block timestamp as a Timepoint.\\n */\\n function timestamp() internal view returns (uint48) {\\n return SafeCast.toUint48(block.timestamp);\\n }\\n\\n /**\\n * @dev Get the block number as a Timepoint.\\n */\\n function blockNumber() internal view returns (uint48) {\\n return SafeCast.toUint48(block.number);\\n }\\n\\n // ==================================================== Delay =====================================================\\n /**\\n * @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the\\n * future. The \\\"effect\\\" timepoint describes when the transitions happens from the \\\"old\\\" value to the \\\"new\\\" value.\\n * This allows updating the delay applied to some operation while keeping some guarantees.\\n *\\n * In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for\\n * some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set\\n * the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should\\n * still apply for some time.\\n *\\n *\\n * The `Delay` type is 112 bits long, and packs the following:\\n *\\n * ```\\n * | [uint48]: effect date (timepoint)\\n * | | [uint32]: value before (duration)\\n * \\u2193 \\u2193 \\u2193 [uint32]: value after (duration)\\n * 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC\\n * ```\\n *\\n * NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently\\n * supported.\\n */\\n type Delay is uint112;\\n\\n /**\\n * @dev Wrap a duration into a Delay to add the one-step \\\"update in the future\\\" feature\\n */\\n function toDelay(uint32 duration) internal pure returns (Delay) {\\n return Delay.wrap(duration);\\n }\\n\\n /**\\n * @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled\\n * change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered.\\n */\\n function _getFullAt(\\n Delay self,\\n uint48 timepoint\\n ) private pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n (valueBefore, valueAfter, effect) = self.unpack();\\n return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the\\n * effect timepoint is 0, then the pending value should not be considered.\\n */\\n function getFull(Delay self) internal view returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n return _getFullAt(self, timestamp());\\n }\\n\\n /**\\n * @dev Get the current value.\\n */\\n function get(Delay self) internal view returns (uint32) {\\n (uint32 delay, , ) = self.getFull();\\n return delay;\\n }\\n\\n /**\\n * @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to\\n * enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the\\n * new delay becomes effective.\\n */\\n function withUpdate(\\n Delay self,\\n uint32 newValue,\\n uint32 minSetback\\n ) internal view returns (Delay updatedDelay, uint48 effect) {\\n uint32 value = self.get();\\n uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0));\\n effect = timestamp() + setback;\\n return (pack(value, newValue, effect), effect);\\n }\\n\\n /**\\n * @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint).\\n */\\n function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n uint112 raw = Delay.unwrap(self);\\n\\n valueAfter = uint32(raw);\\n valueBefore = uint32(raw >> 32);\\n effect = uint48(raw >> 64);\\n\\n return (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev pack the components into a Delay object.\\n */\\n function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) {\\n return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter));\\n }\\n}\\n\",\"keccak256\":\"0x36776530f012618bc7526ceb28e77b85e582cb12d9b9466a71d4bd6bf952e4cc\",\"license\":\"MIT\"},\"contracts/helpers/BaseHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { AccessManaged } from \\\"../utils/AccessManaged.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport \\\"contracts/interfaces/IHarvester.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nstruct YieldBearingParams {\\n // Address of the asset used to mint the yield bearing asset\\n address asset;\\n // Target exposure to the collateral yield bearing asset used\\n uint64 targetExposure;\\n // Maximum exposure within the Parallelizer to the deposit asset\\n uint64 maxExposure;\\n // Minimum exposure within the Parallelizer to the deposit asset\\n uint64 minExposure;\\n // Whether limit exposures should be overriden or read onchain through the Parallelizer\\n // This value should be 1 to override exposures or 2 if these shouldn't be overriden\\n uint64 overrideExposures;\\n // Maximum slippage when dealing with the Parallelizer\\n uint96 maxSlippage;\\n}\\n\\n/// @title BaseHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Abstract contract for a harvester that aims at rebalancing a Parallelizer\\n/// @dev This contract is an authorized fork of Angle's BaseHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/BaseHarvester.sol\\nabstract contract BaseHarvester is IHarvester, AccessManaged {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrusted() {\\n if (!isTrusted[msg.sender]) revert NotTrusted();\\n _;\\n }\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted or guardian to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrustedOrRestricted() {\\n if (!isTrusted[msg.sender] && !_checkCanCall(_msgSender(), _msgData())) {\\n revert NotTrustedOrGuardian();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VARIABLES\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Reference to the `parallelizer` implementation this contract aims at rebalancing\\n IParallelizer public immutable parallelizer;\\n /// @notice TokenP handled by the `parallelizer` of interest\\n ITokenP public immutable tokenP;\\n /// @notice Max slippage when dealing with the Parallelizer\\n mapping(address => uint96) public maxTokenSlippage;\\n /// @notice Data associated to a yield bearing asset\\n mapping(address => YieldBearingParams) public yieldBearingData;\\n /// @notice trusted addresses that can update target exposure and do others non critical operations\\n mapping(address => bool) public isTrusted;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EVENTS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n event Recovered(address token, uint256 amount, address to);\\n event TrustedToggled(address trusted, bool status);\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialAuthority,\\n ITokenP definitiveTokenP,\\n IParallelizer definitiveParallelizer\\n )\\n AccessManaged(initialAuthority)\\n {\\n tokenP = definitiveTokenP;\\n parallelizer = definitiveParallelizer;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n GUARDIAN FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the yieldBearingAsset data\\n * @param yieldBearingAsset address of the yieldBearingAsset\\n * @param asset address of the asset\\n * @param targetExposure target exposure to the yieldBearingAsset asset used\\n * @param minExposure minimum exposure within the Parallelizer to the asset\\n * @param maxExposure maximum exposure within the Parallelizer to the asset\\n * @param overrideExposures whether limit exposures should be overriden or read onchain through the Parallelizer\\n */\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external\\n restricted\\n {\\n _setYieldBearingAssetData(\\n yieldBearingAsset, asset, targetExposure, minExposure, maxExposure, overrideExposures, maxSlippage\\n );\\n }\\n\\n /**\\n * @notice Set the limit exposures to the asset linked to the yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n */\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) public virtual {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n if (yieldBearingInfo.overrideExposures == 2) {\\n _updateLimitExposuresYieldAsset(yieldBearingInfo.asset, yieldBearingInfo);\\n }\\n }\\n\\n /**\\n * @notice Set the max allowed slippage\\n * @param newMaxSlippage new max allowed slippage\\n */\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external restricted {\\n _setMaxSlippage(yieldBearingAsset, newMaxSlippage);\\n }\\n\\n /**\\n * @notice Toggle the trusted status of an address\\n * @param trusted address to toggle the trusted status\\n */\\n function toggleTrusted(address trusted) external restricted {\\n emit TrustedToggled(trusted, isTrusted[trusted]);\\n isTrusted[trusted] = !isTrusted[trusted];\\n }\\n\\n /**\\n * @notice Recover ERC20 tokens\\n * @param tokenAddress address of the token to recover\\n * @param amountToRecover amount to recover\\n * @param to address to send the recovered tokens\\n */\\n function recoverERC20(address tokenAddress, uint256 amountToRecover, address to) external restricted {\\n emit Recovered(tokenAddress, amountToRecover, to);\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n TRUSTED FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the target exposure of a yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @param targetExposure target exposure to the yield bearing asset used\\n */\\n function setTargetExposure(address yieldBearingAsset, uint64 targetExposure) external onlyTrustedOrRestricted {\\n yieldBearingData[yieldBearingAsset].targetExposure = targetExposure;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Compute the amount needed to rebalance the Parallelizer\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @return increase whether the exposure should be increased\\n * @return amount amount to be rebalanced\\n */\\n function computeRebalanceAmount(address yieldBearingAsset) external view returns (uint8 increase, uint256 amount) {\\n return _computeRebalanceAmount(yieldBearingAsset, yieldBearingData[yieldBearingAsset]);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _computeRebalanceAmount(\\n address yieldBearingAsset,\\n YieldBearingParams memory yieldBearingInfo\\n )\\n internal\\n view\\n returns (uint8 increase, uint256 amount)\\n {\\n (uint256 stablecoinsFromYieldBearingAsset, uint256 stablecoinsIssued) =\\n parallelizer.getIssuedByCollateral(yieldBearingAsset);\\n (uint256 stablecoinsFromAsset,) = parallelizer.getIssuedByCollateral(yieldBearingInfo.asset);\\n uint256 targetExposureScaled = yieldBearingInfo.targetExposure * stablecoinsIssued;\\n if (stablecoinsFromYieldBearingAsset * 1e9 > targetExposureScaled) {\\n // Need to decrease exposure to yield bearing asset\\n amount = stablecoinsFromYieldBearingAsset - targetExposureScaled / 1e9;\\n uint256 maxValueScaled = yieldBearingInfo.maxExposure * stablecoinsIssued;\\n // These checks assume that there are no transaction fees on the stablecoin->collateral conversion and so\\n // it's still possible that exposure goes above the max exposure in some rare cases\\n if (stablecoinsFromAsset * 1e9 > maxValueScaled) {\\n amount = 0;\\n } else if ((stablecoinsFromAsset + amount) * 1e9 > maxValueScaled) {\\n amount = maxValueScaled / 1e9 - stablecoinsFromAsset;\\n }\\n } else {\\n // In this case, exposure after the operation might remain slightly below the targetExposure as less\\n // collateral may be obtained by burning stablecoins for the yield asset and unwrapping it\\n increase = 1;\\n amount = targetExposureScaled / 1e9 - stablecoinsFromYieldBearingAsset;\\n uint256 minValueScaled = yieldBearingInfo.minExposure * stablecoinsIssued;\\n if (stablecoinsFromAsset * 1e9 < minValueScaled) {\\n amount = 0;\\n } else if (stablecoinsFromAsset * 1e9 < minValueScaled + amount * 1e9) {\\n amount = stablecoinsFromAsset - minValueScaled / 1e9;\\n }\\n }\\n }\\n\\n function _setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n internal\\n virtual\\n {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n yieldBearingInfo.asset = asset;\\n if (targetExposure >= 1e9) revert InvalidParam();\\n if (maxSlippage >= 1e9) revert InvalidParam();\\n yieldBearingInfo.targetExposure = targetExposure;\\n yieldBearingInfo.overrideExposures = overrideExposures;\\n yieldBearingInfo.maxSlippage = maxSlippage;\\n if (overrideExposures == 1) {\\n if (maxExposure >= 1e9 || minExposure >= maxExposure) revert InvalidParam();\\n yieldBearingInfo.maxExposure = maxExposure;\\n yieldBearingInfo.minExposure = minExposure;\\n } else {\\n yieldBearingInfo.overrideExposures = 2;\\n _updateLimitExposuresYieldAsset(asset, yieldBearingInfo);\\n }\\n }\\n\\n function _updateLimitExposuresYieldAsset(\\n address asset,\\n YieldBearingParams storage yieldBearingInfo\\n )\\n internal\\n virtual\\n {\\n uint64[] memory xFeeMint;\\n (xFeeMint,) = parallelizer.getCollateralMintFees(asset);\\n uint256 length = xFeeMint.length;\\n if (length <= 1) yieldBearingInfo.maxExposure = 1e9;\\n else yieldBearingInfo.maxExposure = xFeeMint[length - 2];\\n\\n uint64[] memory xFeeBurn;\\n (xFeeBurn,) = parallelizer.getCollateralBurnFees(asset);\\n length = xFeeBurn.length;\\n if (length <= 1) yieldBearingInfo.minExposure = 0;\\n else yieldBearingInfo.minExposure = xFeeBurn[length - 2];\\n }\\n\\n function _setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) internal virtual {\\n if (newMaxSlippage > 1e9) revert InvalidParam();\\n maxTokenSlippage[yieldBearingAsset] = newMaxSlippage;\\n }\\n\\n function _scaleAmountBasedOnDecimals(\\n uint256 decimalsTokenIn,\\n uint256 decimalsTokenOut,\\n uint256 amountIn,\\n bool assetIn\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n if (decimalsTokenIn > decimalsTokenOut) {\\n if (assetIn) {\\n amountIn /= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n } else {\\n amountIn *= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n }\\n } else if (decimalsTokenIn < decimalsTokenOut) {\\n if (assetIn) {\\n amountIn *= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n } else {\\n amountIn /= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n }\\n }\\n return amountIn;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HELPER \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _adjustAllowance(address token, address sender, uint256 amountIn) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), sender);\\n if (allowance < amountIn) IERC20(token).safeIncreaseAllowance(sender, type(uint256).max - allowance);\\n }\\n}\\n\",\"keccak256\":\"0x82e2ae57997043160d7529488b34591c710cd74e267213b61009daa96e9eeaaf\",\"license\":\"GPL-3.0\"},\"contracts/helpers/GenericHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC20Metadata } from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport { IERC3156FlashBorrower } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\\\";\\nimport { IERC3156FlashLender } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\\\";\\nimport { RouterSwapper } from \\\"@helpers/RouterSwapper.sol\\\";\\n\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport { IERC4626 } from \\\"contracts/interfaces/external/IERC4626.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nimport { BaseHarvester, YieldBearingParams } from \\\"./BaseHarvester.sol\\\";\\n\\nenum SwapType {\\n VAULT,\\n SWAP\\n}\\n\\n/// @title GenericHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Generic contract for anyone to permissionlessly adjust the reserves of Angle Parallelizer\\n/// @dev This contract is an authorized fork of Angle's GenericHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\\ncontract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper {\\n using SafeCast for uint256;\\n using SafeERC20 for IERC20;\\n\\n bytes32 public constant CALLBACK_SUCCESS = keccak256(\\\"ERC3156FlashBorrower.onFlashLoan\\\");\\n\\n /// @notice Parallel stablecoin flashloan contract\\n IERC3156FlashLender public immutable flashloan;\\n /// @notice Budget of tokenP available for each users\\n mapping(address => uint256) public budget;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INITIALIZATION \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialTokenTransferAddress,\\n address initialSwapRouter,\\n ITokenP definitivetokenP,\\n IParallelizer definitiveParallelizer,\\n address initialAuthority,\\n IERC3156FlashLender definitiveFlashloan\\n )\\n RouterSwapper(initialSwapRouter, initialTokenTransferAddress)\\n BaseHarvester(initialAuthority, definitivetokenP, definitiveParallelizer)\\n {\\n if (address(definitiveFlashloan) == address(0)) revert ZeroAddress();\\n flashloan = definitiveFlashloan;\\n\\n IERC20(tokenP).approve(address(definitiveFlashloan), type(uint256).max);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n BUDGET HANDLING\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Add budget to be spent by the receiver during the flashloan\\n * @param amount amount of tokenP to add to the budget\\n * @param receiver address of the receiver\\n */\\n function addBudget(uint256 amount, address receiver) public virtual {\\n budget[receiver] += amount;\\n\\n IERC20(tokenP).safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n /**\\n * @notice Remove budget from the owner and send it to the receiver\\n * @param amount amount of tokenP to remove from the budget\\n * @param receiver address of the receiver\\n */\\n function removeBudget(uint256 amount, address receiver) public virtual {\\n budget[msg.sender] -= amount; // Will revert if not enough funds\\n\\n IERC20(tokenP).safeTransfer(receiver, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HARVEST\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure\\n /// to this yieldBearingAsset\\n /// @dev This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up\\n /// some yieldBearingAsset that can then be used for people looking to burn deposit tokens\\n /// @dev Due to potential transaction fees within the Parallelizer, this function doesn't exactly bring\\n /// `yieldBearingAsset` to the target exposure\\n /// @dev scale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest,\\n /// it is used to lower the amount of the asset to harvest for example to have a lower slippage\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) public virtual {\\n if (scale > 1e9) revert InvalidParam();\\n updateLimitExposuresYieldAsset(yieldBearingAsset);\\n YieldBearingParams memory yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n (uint8 increase, uint256 amount) = _computeRebalanceAmount(yieldBearingAsset, yieldBearingInfo);\\n amount = (amount * scale) / 1e9;\\n if (amount == 0) revert ZeroAmount();\\n (SwapType swapType, bytes memory data) = abi.decode(extraData, (SwapType, bytes));\\n try parallelizer.updateOracle(yieldBearingAsset) { } catch { }\\n _adjustYieldExposure(\\n amount,\\n increase,\\n yieldBearingAsset,\\n yieldBearingInfo.asset,\\n (amount * (1e9 - yieldBearingInfo.maxSlippage)) / 1e9,\\n swapType,\\n data\\n );\\n }\\n\\n /// @inheritdoc IERC3156FlashBorrower\\n function onFlashLoan(\\n address initiator,\\n address,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n )\\n public\\n virtual\\n returns (bytes32)\\n {\\n if (msg.sender != address(flashloan) || initiator != address(this) || fee != 0) revert NotTrusted();\\n address sender;\\n uint256 typeAction;\\n uint256 minAmountOut;\\n SwapType swapType;\\n bytes memory callData;\\n address tokenOut;\\n address tokenIn;\\n {\\n address yieldBearingAsset;\\n address asset;\\n (sender, typeAction, yieldBearingAsset, asset, minAmountOut, swapType, callData) =\\n abi.decode(data, (address, uint256, address, address, uint256, SwapType, bytes));\\n if (typeAction == 1) {\\n // Increase yield exposure action: we bring in the yield bearing asset\\n tokenOut = yieldBearingAsset;\\n tokenIn = asset;\\n } else {\\n // Decrease yield exposure action: we bring in the deposit asset\\n tokenIn = yieldBearingAsset;\\n tokenOut = asset;\\n }\\n }\\n uint256 amountOut =\\n parallelizer.swapExactInput(amount, 0, address(tokenP), tokenIn, address(this), block.timestamp);\\n\\n // Swap to tokenIn\\n amountOut = _swapToTokenOut(typeAction, tokenIn, tokenOut, amountOut, swapType, callData);\\n\\n _adjustAllowance(tokenOut, address(parallelizer), amountOut);\\n uint256 amountStableOut =\\n parallelizer.swapExactInput(amountOut, minAmountOut, tokenOut, address(tokenP), address(this), block.timestamp);\\n if (amount > amountStableOut) {\\n budget[sender] -= amount - amountStableOut; // Will revert if not enough funds\\n }\\n return CALLBACK_SUCCESS;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n SETTERS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the token transfer contract\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress) public override restricted {\\n super.setTokenTransferAddress(newTokenTransferAddress);\\n }\\n\\n /**\\n * @notice Set the swap router\\n * @param newSwapRouter address of the swap router\\n */\\n function setSwapRouter(address newSwapRouter) public override restricted {\\n super.setSwapRouter(newSwapRouter);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNALS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Burns `amountStablecoins` for one yieldBearing asset, swap for asset then mints deposit tokens\\n /// from the proceeds of the swap.\\n /// @dev If `increase` is 1, then the system tries to increase its exposure to the yield bearing asset which means\\n /// burning tokenP for the deposit asset, swapping for the yield bearing asset, then minting the tokenP\\n /// @dev This function reverts if the second tokenP mint gives less than `minAmountOut` of ag tokens\\n /// @dev This function reverts if the swap slippage is higher than `maxSlippage`\\n function _adjustYieldExposure(\\n uint256 amountStablecoins,\\n uint8 increase,\\n address yieldBearingAsset,\\n address asset,\\n uint256 minAmountOut,\\n SwapType swapType,\\n bytes memory extraData\\n )\\n internal\\n {\\n flashloan.flashLoan(\\n IERC3156FlashBorrower(address(this)),\\n address(tokenP),\\n amountStablecoins,\\n abi.encode(msg.sender, increase, yieldBearingAsset, asset, minAmountOut, swapType, extraData)\\n );\\n }\\n\\n function _swapToTokenOut(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n SwapType swapType,\\n bytes memory callData\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (swapType == SwapType.SWAP) {\\n amountOut = _swapToTokenOutSwap(tokenIn, tokenOut, amount, callData);\\n } else if (swapType == SwapType.VAULT) {\\n amountOut = _swapToTokenOutVault(typeAction, tokenIn, tokenOut, amount);\\n }\\n }\\n\\n /**\\n * @notice Swap token using the router/aggregator\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n * @param callData bytes to call the router/aggregator\\n */\\n function _swapToTokenOutSwap(\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n bytes memory callData\\n )\\n internal\\n returns (uint256)\\n {\\n uint256 balance = IERC20(tokenOut).balanceOf(address(this));\\n\\n address[] memory tokens = new address[](1);\\n tokens[0] = tokenIn;\\n bytes[] memory callDatas = new bytes[](1);\\n callDatas[0] = callData;\\n uint256[] memory amounts = new uint256[](1);\\n amounts[0] = amount;\\n _swap(tokens, callDatas, amounts);\\n\\n return IERC20(tokenOut).balanceOf(address(this)) - balance;\\n }\\n\\n /**\\n * @dev Deposit or redeem the vault asset\\n * @param typeAction 1 for deposit, 2 for redeem\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n */\\n function _swapToTokenOutVault(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (typeAction == 1) {\\n // Granting allowance with the yieldBearingAsset for the vault asset\\n _adjustAllowance(tokenIn, tokenOut, amount);\\n amountOut = IERC4626(tokenOut).deposit(amount, address(this));\\n } else {\\n amountOut = IERC4626(tokenIn).redeem(amount, address(this), address(this));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x604c4f9c755b2eb704dc15ba59046201c0258134ef2fbe15a529c510c68cb40a\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDiamondCut.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IDiamondCut\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondCut.sol by mudgen\\n/// @dev This interface is an authorized fork of Angle's `IDiamondCut` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IDiamondCut.sol\\ninterface IDiamondCut {\\n /// @notice Add/replace/remove any number of functions and optionally execute a function with delegatecall\\n /// @param _diamondCut Contains the facet addresses and function selectors\\n /// @param _init The address of the contract or facet to execute _calldata\\n /// @param _calldata A function call, including function selector and arguments, executed with delegatecall on\\n /// _init\\n function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;\\n}\\n\",\"keccak256\":\"0x08a01f77b740f7da424f0ea27a6a292f9e292058e23d1fe960d2d19a44496c7b\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondEtherscan.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\n/// @title IDiamondEtherscan\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface IDiamondEtherscan {\\n /// @notice Sets a dummy implementation with the same layout at the diamond proxy contract with all its facets\\n function setDummyImplementation(address _implementation) external;\\n\\n /// @notice Address of the dummy implementation used to make the DiamondProxy contract interpretable by Etherscan\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf742b55592d129e02fb755d25f7a97ed976a14c4c744d6ac46726809e8f1e037\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondLoupe.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @notice IDiamondLoupe\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondLoupe.sol by mudgen\\ninterface IDiamondLoupe {\\n /// @notice Gets all facet addresses and their four byte function selectors.\\n /// @return facets_ Facet\\n function facets() external view returns (Facet[] memory facets_);\\n\\n /// @notice Gets all the function selectors supported by a specific facet.\\n /// @param _facet The facet address.\\n /// @return facetFunctionSelectors_\\n function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);\\n\\n /// @notice Get all the facet addresses used by a diamond.\\n /// @return facetAddresses_\\n function facetAddresses() external view returns (address[] memory facetAddresses_);\\n\\n /// @notice Gets the facet that supports the given selector.\\n /// @dev If facet is not found return address(0).\\n /// @param _functionSelector The function selector.\\n /// @return facetAddress_ The facet address.\\n function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);\\n}\\n\",\"keccak256\":\"0xa5580958acabe2c44967e835e77a748eb0b8812f70cd071191201508c9388ca8\",\"license\":\"MIT\"},\"contracts/interfaces/IGetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IGetters\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IGetters` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IGetters.sol\\ninterface IGetters {\\n /// @notice Checks whether a given `selector` is actually a valid selector corresponding to a function in one of\\n /// the\\n /// facets of the proxy\\n function isValidSelector(bytes4 selector) external view returns (bool);\\n\\n /// @notice Stablecoin minted by parallelizer\\n function tokenP() external view returns (ITokenP);\\n\\n /// @notice Returns the list of collateral assets supported by the system\\n function getCollateralList() external view returns (address[] memory);\\n\\n /// @notice Returns all the info in storage associated to a `collateral`\\n function getCollateralInfo(address collateral) external view returns (Collateral memory);\\n\\n /// @notice Returns the decimals of a given `collateral`\\n function getCollateralDecimals(address collateral) external view returns (uint8);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to mint\\n /// with `collateral`\\n function getCollateralMintFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to burn\\n /// for `collateral`\\n function getCollateralBurnFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays used to compute the penalty factor depending on the collateral\\n /// ratio when users come to redeem\\n function getRedemptionFees() external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the collateral ratio of Parallelizer in base `10**9` and a rounded version of the total amount\\n /// of stablecoins issued\\n function getCollateralRatio() external view returns (uint64 collatRatio, uint256 stablecoinsIssued);\\n\\n /// @notice Returns the total amount of stablecoins issued through Parallelizer\\n function getTotalIssued() external view returns (uint256 stablecoinsIssued);\\n\\n /// @notice Returns the amount of stablecoins issued from `collateral` and the total amount of stablecoins issued\\n /// through Parallelizer\\n function getIssuedByCollateral(address collateral)\\n external\\n view\\n returns (uint256 stablecoinsFromCollateral, uint256 stablecoinsIssued);\\n\\n /// @notice Returns if a collateral is \\\"managed\\\" and the associated manager configuration\\n function getManagerData(address collateral)\\n external\\n view\\n returns (bool isManaged, IERC20[] memory subCollaterals, bytes memory config);\\n\\n /// @notice Returns the oracle values associated to `collateral`\\n /// @return mint Oracle value to be used for a mint transaction with `collateral`\\n /// @return burn Oracle value that will be used for `collateral` for a burn transaction. This value\\n /// is then used along with oracle values for all other collateral assets to get a global burn value for the oracle\\n /// @return ratio Ratio, in base `10**18` between the oracle value of the `collateral` and its target price.\\n /// This value is 10**18 if the oracle is greater than the collateral price\\n /// @return minRatio Minimum ratio across all collateral assets between a collateral burn price and its target\\n /// price. This value is independent of `collateral` and is used to normalize the burn oracle value for burn\\n /// transactions.\\n /// @return redemption Oracle value that would be used to price `collateral` when computing the collateral ratio\\n /// during a redemption\\n function getOracleValues(address collateral)\\n external\\n view\\n returns (uint256 mint, uint256 burn, uint256 ratio, uint256 minRatio, uint256 redemption);\\n\\n /// @notice Returns the data used to compute oracle values for `collateral`\\n /// @return oracleType Type of oracle (Chainlink, external smart contract, ...)\\n /// @return targetType Type passed to read the value of the target price\\n /// @return oracleData Extra data needed to read the oracle. For Chainlink oracles, this data is supposed to give\\n /// the addresses of the Chainlink feeds to read, the stale periods for each feed, ...\\n /// @return targetData Extra data needed to read the target price of the asset\\n function getOracle(address collateral)\\n external\\n view\\n returns (\\n OracleReadType oracleType,\\n OracleReadType targetType,\\n bytes memory oracleData,\\n bytes memory targetData,\\n bytes memory hyperparameters\\n );\\n\\n /// @notice Returns if the associated functionality is paused or not\\n function isPaused(address collateral, ActionType action) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update normalizers\\n function isTrusted(address sender) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update sell rewards\\n function isTrustedSeller(address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` has a non null entry in the `isWhitelistedForType` storage mapping\\n /// @dev Note that ultimately whitelisting may depend as well on external providers\\n function isWhitelistedForType(WhitelistType whitelistType, address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` can deal with `collateral` during burns and redemptions\\n function isWhitelistedForCollateral(address collateral, address sender) external returns (bool);\\n\\n /// @notice Checks whether only whitelisted address can deal with `collateral` during burns and redemptions\\n function isWhitelistedCollateral(address collateral) external view returns (bool);\\n\\n /// @notice Gets the data needed to deal with whitelists for `collateral`\\n function getCollateralWhitelistData(address collateral) external view returns (bytes memory);\\n\\n /// @notice Returns the stablecoin cap for `collateral`\\n function getStablecoinCap(address collateral) external view returns (uint256);\\n\\n /// @notice Returns the address of the `accessManager` contract\\n function accessManager() external view returns (address);\\n\\n /// @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n /// being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n /// attacker controlled calls.\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaa9eba6ee7770d6146fedbfef07ad10ff09524692319ca0cc32abfa64a2b597b\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IHarvester` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IHarvester.sol\\ninterface IHarvester {\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address stablecoin,\\n uint64 targetExposure,\\n uint64 minExposureYieldAsset,\\n uint64 maxExposureYieldAsset,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external;\\n\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) external;\\n\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external;\\n\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) external;\\n}\\n\",\"keccak256\":\"0x0d4e8fee737f4f747060a3c5044c8cb2f153faa228ad37a661a659ca62aab055\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IParallelizer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IDiamondCut } from \\\"./IDiamondCut.sol\\\";\\nimport { IDiamondEtherscan } from \\\"./IDiamondEtherscan.sol\\\";\\nimport { IDiamondLoupe } from \\\"./IDiamondLoupe.sol\\\";\\nimport { IGetters } from \\\"./IGetters.sol\\\";\\nimport { IRedeemer } from \\\"./IRedeemer.sol\\\";\\nimport { IRewardHandler } from \\\"./IRewardHandler.sol\\\";\\nimport { ISettersGovernor, ISettersGuardian } from \\\"./ISetters.sol\\\";\\nimport { ISwapper } from \\\"./ISwapper.sol\\\";\\n\\n/// @title IParallelizer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IParallelizer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IParallelizer.sol\\ninterface IParallelizer is\\n IDiamondCut,\\n IDiamondEtherscan,\\n IDiamondLoupe,\\n IGetters,\\n IRedeemer,\\n IRewardHandler,\\n ISettersGovernor,\\n ISettersGuardian,\\n ISwapper\\n{ }\\n\",\"keccak256\":\"0x8bd964110c6a122bdb6cf58a194a97c894900237ebd7f3b11e2f43c6ee56ae7c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRedeemer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRedeemer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRedeemer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRedeemer.sol\\ninterface IRedeemer {\\n /// @notice Redeems `amount` of stablecoins from the system\\n /// @param receiver Address which should be receiving the output tokens\\n /// @param deadline Timestamp before which the redemption should have occured\\n /// @param minAmountOuts Minimum amount of each token given back in the redemption to obtain\\n /// @return tokens List of tokens returned\\n /// @return amounts Amount given for each token in the `tokens` array\\n function redeem(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Same as the redeem function above with the additional feature to specify a list of `forfeitTokens` for\\n /// which the Parallelizer system will not try to do a transfer to `receiver`.\\n function redeemWithForfeit(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts,\\n address[] memory forfeitTokens\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Simulate the exact output that a redemption of `amount` of stablecoins would give at a given block\\n /// @return tokens List of tokens that would be given\\n /// @return amounts Amount that would be obtained for each token in the `tokens` array\\n function quoteRedemptionCurve(uint256 amount)\\n external\\n view\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Updates the normalizer variable by `amount`\\n function updateNormalizer(uint256 amount, bool increase) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3522ee0380b321c64d02bf2db2acb658d8b314b811dd54b6a718d6708b5fb21\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRewardHandler.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRewardHandler\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRewardHandler` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRewardHandler.sol\\ninterface IRewardHandler {\\n /// @notice Sells some external tokens through a odos call\\n /// @param minAmountOut Minimum amount of the outToken to get\\n /// @param payload Payload to pass to odos\\n /// @return amountOut Amount obtained of the outToken\\n function sellRewards(uint256 minAmountOut, bytes memory payload) external returns (uint256 amountOut);\\n}\\n\",\"keccak256\":\"0xff2afcbc8d1c25297324159d3684a323e60b3c9408129aba70d3d6938d093255\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISettersGovernor` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISetters.sol\\ninterface ISettersGovernor {\\n /// @notice Recovers `amount` of `token` from the Parallelizer contract\\n function recoverERC20(address collateral, IERC20 token, address to, uint256 amount) external;\\n\\n /// @notice Sets a new access manager address\\n function setAccessManager(address _newAccessManager) external;\\n\\n /// @notice Sets (or unsets) a collateral manager `collateral`\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before setting the new manager\\n function setCollateralManager(\\n address collateral,\\n bool checkExternalManagerBalance,\\n ManagerStorage memory managerData\\n )\\n external;\\n\\n /// @notice Sets the allowance of the contract on `token` for `spender` to `amount`\\n function changeAllowance(IERC20 token, address spender, uint256 amount) external;\\n\\n /// @notice Changes the trusted status for `sender` when for selling rewards or updating the normalizer\\n function toggleTrusted(address sender, TrustedType t) external;\\n\\n /// @notice Changes whether a `collateral` can only be handled during burns and redemptions by whitelisted\\n /// addresses\\n /// and sets the data used to read into the whitelist\\n function setWhitelistStatus(address collateral, uint8 whitelistStatus, bytes memory whitelistData) external;\\n\\n /// @notice Add `collateral` as a supported collateral in the system\\n function addCollateral(address collateral) external;\\n\\n /// @notice Adjusts the amount of stablecoins issued from `collateral` by `amount`\\n function adjustStablecoins(address collateral, uint128 amount, bool increase) external;\\n\\n /// @notice Revokes `collateral` from the system\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before revoking the collateral\\n function revokeCollateral(address collateral, bool checkExternalManagerBalance) external;\\n\\n /// @notice Sets the `oracleConfig` used to read the value of `collateral` for the mint, burn and redemption\\n /// operations\\n function setOracle(address collateral, bytes memory oracleConfig) external;\\n\\n /// @notice Update oracle data for a given `collateral`\\n function updateOracle(address collateral) external;\\n}\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface ISettersGuardian {\\n /// @notice Changes the pause status for mint or burn transactions for `collateral`\\n function togglePause(address collateral, ActionType action) external;\\n\\n /// @notice Sets the mint or burn fees for `collateral`\\n function setFees(address collateral, uint64[] memory xFee, int64[] memory yFee, bool mint) external;\\n\\n /// @notice Sets the parameters for the redemption curve\\n function setRedemptionCurveParams(uint64[] memory xFee, int64[] memory yFee) external;\\n\\n /// @notice Changes the whitelist status for a collateral with `whitelistType` for an address `who`\\n function toggleWhitelist(WhitelistType whitelistType, address who) external;\\n\\n /// @notice Sets the stablecoin cap that can be issued from a `collateral`\\n function setStablecoinCap(address collateral, uint256 stablecoinCap) external;\\n}\\n\",\"keccak256\":\"0xc3fb2012e7c2f97ae93b12276afc4293aaeb97a6fe4d60109acaa94ef6945575\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title ISwapper\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISwapper` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISwapper.sol\\ninterface ISwapper {\\n /// @notice Swaps (that is to say mints or burns) an exact amount of `tokenIn` for an amount of `tokenOut`\\n /// @param amountIn Amount of `tokenIn` to bring\\n /// @param amountOutMin Minimum amount of `tokenOut` to get: if `amountOut` is inferior to this amount, the\\n /// function will revert\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountOut Amount of `tokenOut` obtained through the swap\\n function swapExactInput(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Same as `swapExactInput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactInputWithPermit(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Swaps (that is to say mints or burns) an amount of `tokenIn` for an exact amount of `tokenOut`\\n /// @param amountOut Amount of `tokenOut` to obtain from the swap\\n /// @param amountInMax Maximum amount of `tokenIn` to bring in order to get `amountOut` of `tokenOut`\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountIn Amount of `tokenIn` used to perform the swap\\n function swapExactOutput(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Same as `swapExactOutput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactOutputWithPermit(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Simulates what a call to `swapExactInput` with `amountIn` of `tokenIn` for `tokenOut` would give.\\n /// If called right before and at the same block, the `amountOut` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactInput`\\n function quoteIn(uint256 amountIn, address tokenIn, address tokenOut) external view returns (uint256 amountOut);\\n\\n /// @notice Simulates what a call to `swapExactOutput` for `amountOut` of `tokenOut` with `tokenIn` would give.\\n /// If called right before and at the same block, the `amountIn` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactOutput`\\n function quoteOut(uint256 amountOut, address tokenIn, address tokenOut) external view returns (uint256 amountIn);\\n}\\n\",\"keccak256\":\"0x47e4b2742a51b82b9df72fb681335affe8519f4114fb540cd29d8f48ed182ffd\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITokenP.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ITokenP\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @notice Interface for the stablecoins `tokenP` contracts\\n/// @dev This interface is an authorized fork of Angle's `IAgToken` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IAgToken.sol\\ninterface ITokenP is IERC20 {\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MINTER ROLE ONLY FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Lets a whitelisted contract mint tokenPs\\n /// @param account Address to mint to\\n /// @param amount Amount to mint\\n function mint(address account, uint256 amount) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @param sender Address which requested the burn from `burner`\\n /// @dev This method is to be called by a contract with the minter right after being requested\\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\\n /// @dev The method checks the allowance between the `sender` and the `burner`\\n function burnFrom(uint256 amount, address burner, address sender) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @dev This method is to be called by a contract with a minter right on the tokenP after being\\n /// requested to do so by an address willing to burn tokens from its address\\n function burnSelf(uint256 amount, address burner) external;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Amount of decimals of the stablecoin\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x64a1305faa8c5c91767a11af0eae16e4b463aa0bfe10f11b74aae9d96681a5eb\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity >=0.5.0;\\n\\n/// @notice ERC4626 interface\\n/// @author OpenZeppelin\\n/// @dev In this implementation, the interface only contains the functions that the IERC4626 interface adds on top of\\n/// the IERC20 interface\\ninterface IERC4626 {\\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 \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s 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 redeemption 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\",\"keccak256\":\"0xd730d6a6b679201eec89dff3133de651da20b3e72e74f01b734078bfacf952ad\",\"license\":\"GPL-3.0\"},\"contracts/parallelizer/Storage.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n ENUMS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nenum FacetCutAction {\\n Add,\\n Replace,\\n Remove\\n}\\n\\nenum ManagerType {\\n EXTERNAL\\n}\\n\\nenum ActionType {\\n Mint,\\n Burn,\\n Redeem\\n}\\n\\nenum TrustedType {\\n Updater,\\n Seller\\n}\\n\\nenum QuoteType {\\n MintExactInput,\\n MintExactOutput,\\n BurnExactInput,\\n BurnExactOutput\\n}\\n\\nenum OracleReadType {\\n CHAINLINK_FEEDS,\\n EXTERNAL,\\n NO_ORACLE,\\n STABLE,\\n WSTETH,\\n CBETH,\\n RETH,\\n SFRXETH,\\n MAX,\\n MORPHO_ORACLE\\n}\\n\\nenum OracleQuoteType {\\n UNIT,\\n TARGET\\n}\\n\\nenum WhitelistType {\\n BACKED\\n}\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n STRUCTS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nstruct Permit2Details {\\n address to; // Address that will receive the funds\\n uint256 nonce; // Nonce of the transaction\\n bytes signature; // Permit signature of the user\\n}\\n\\nstruct FacetCut {\\n address facetAddress; // Facet contract address\\n FacetCutAction action; // Can be add, remove or replace\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct Facet {\\n address facetAddress; // Facet contract address\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct FacetInfo {\\n address facetAddress; // Facet contract address\\n uint16 selectorPosition; // Position in the list of all selectors\\n}\\n\\nstruct DiamondStorage {\\n bytes4[] selectors; // List of all available selectors\\n mapping(bytes4 => FacetInfo) selectorInfo; // Selector to (address, position in list)\\n IAccessManager accessManager; // Contract handling access management\\n}\\n\\nstruct ImplementationStorage {\\n address implementation; // Dummy implementation address for Etherscan usability\\n}\\n\\nstruct ManagerStorage {\\n IERC20[] subCollaterals; // Subtokens handled by the manager or strategies\\n bytes config; // Additional configuration data\\n}\\n\\nstruct Collateral {\\n uint8 isManaged; // If the collateral is managed through external strategies\\n uint8 isMintLive; // If minting from this asset is unpaused\\n uint8 isBurnLive; // If burning to this asset is unpaused\\n uint8 decimals; // IERC20Metadata(collateral).decimals()\\n uint8 onlyWhitelisted; // If only whitelisted addresses can burn or redeem for this token\\n uint216 normalizedStables; // Normalized amount of stablecoins issued from this collateral\\n uint64[] xFeeMint; // Increasing exposures in [0,BASE_9[\\n int64[] yFeeMint; // Mint fees at the exposures specified in `xFeeMint`\\n uint64[] xFeeBurn; // Decreasing exposures in ]0,BASE_9]\\n int64[] yFeeBurn; // Burn fees at the exposures specified in `xFeeBurn`\\n bytes oracleConfig; // Data about the oracle used for the collateral\\n bytes whitelistData; // For whitelisted collateral, data used to verify whitelists\\n ManagerStorage managerData; // For managed collateral, data used to handle the strategies\\n uint256 stablecoinCap; // Cap on the amount of stablecoins that can be issued from this collateral\\n}\\n\\nstruct ParallelizerStorage {\\n ITokenP tokenP; // tokenP handled by the system\\n uint8 isRedemptionLive; // If redemption is unpaused\\n uint8 statusReentrant; // If call is reentrant or not\\n bool consumingSchedule; // If the contract is consuming a scheduled operation\\n uint128 normalizedStables; // Normalized amount of stablecoins issued by the system\\n uint128 normalizer; // To reconcile `normalizedStables` values with the actual amount\\n address[] collateralList; // List of collateral assets supported by the system\\n uint64[] xRedemptionCurve; // Increasing collateral ratios > 0\\n int64[] yRedemptionCurve; // Value of the redemption fees at `xRedemptionCurve`\\n mapping(address => Collateral) collaterals; // Maps a collateral asset to its parameters\\n mapping(address => uint256) isTrusted; // If an address is trusted to update the normalizer value\\n mapping(address => uint256) isSellerTrusted; // If an address is trusted to sell accruing reward tokens or to run\\n // keeper jobs on oracles\\n mapping(WhitelistType => mapping(address => uint256)) isWhitelistedForType;\\n}\\n// Whether an address is whitelisted for a specific whitelist type\\n\",\"keccak256\":\"0x3f4313dd110dbe390038320b2d3cf24dcbe9b75cd9573e7f048f7233c02dd227\",\"license\":\"BUSL-1.1\"},\"contracts/utils/AccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { AuthorityUtils } from \\\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { IAccessManaged } from \\\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\\\";\\nimport { Context } from \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title AccessControl\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Fork of OpenZeppelin's `AccessManaged` contract\\n/// updated to make _checkCanCall to return bool\\n/// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/manager/AccessManaged.sol\\ncontract AccessManaged is Context, IAccessManaged {\\n address private _authority;\\n\\n bool private _consumingSchedule;\\n\\n /**\\n * @dev Initializes the contract connected to an initial authority.\\n */\\n constructor(address initialAuthority) {\\n _setAuthority(initialAuthority);\\n }\\n\\n /**\\n * @dev Restricts access to a function as defined by the connected Authority for this contract and the\\n * caller and selector of the function that entered the contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * In general, this modifier should only be used on `external` functions. It is okay to use it on `public`\\n * functions that are used as external entry points and are not called internally. Unless you know what you're\\n * doing, it should never be used on `internal` functions. Failure to follow these rules can have critical security\\n * implications! This is because the permissions are determined by the function that entered the contract, i.e. the\\n * function at the bottom of the call stack, and not the function where the modifier is visible in the source code.\\n * ====\\n *\\n * [WARNING]\\n * ====\\n * Avoid adding this modifier to the\\n * https://docs.soliditylang.org/en/v0.8.20/contracts.html#receive-ether-function[`receive()`]\\n * function or the https://docs.soliditylang.org/en/v0.8.20/contracts.html#fallback-function[`fallback()`]. These\\n * functions are the only execution paths where a function selector cannot be unambiguously determined from the\\n * calldata\\n * since the selector defaults to `0x00000000` in the `receive()` function and similarly in the `fallback()`\\n * function\\n * if no calldata is provided. (See {_checkCanCall}).\\n *\\n * The `receive()` function will always panic whereas the `fallback()` may panic depending on the calldata length.\\n * ====\\n */\\n modifier restricted() {\\n address caller = _msgSender();\\n require(_checkCanCall(caller, _msgData()), AccessManagedUnauthorized(caller));\\n _;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function authority() public view virtual returns (address) {\\n return _authority;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function setAuthority(address newAuthority) public virtual {\\n address caller = _msgSender();\\n if (caller != authority()) {\\n revert AccessManagedUnauthorized(caller);\\n }\\n if (newAuthority.code.length == 0) {\\n revert AccessManagedInvalidAuthority(newAuthority);\\n }\\n _setAuthority(newAuthority);\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function isConsumingScheduledOp() public view returns (bytes4) {\\n return _consumingSchedule ? this.isConsumingScheduledOp.selector : bytes4(0);\\n }\\n\\n /**\\n * @dev Transfers control to a new authority. Internal function with no access restriction. Allows bypassing the\\n * permissions set by the current authority.\\n */\\n function _setAuthority(address newAuthority) internal virtual {\\n _authority = newAuthority;\\n emit AuthorityUpdated(newAuthority);\\n }\\n\\n function _checkCanCall(address caller, bytes calldata data) internal virtual returns (bool) {\\n (bool immediate, uint32 delay) =\\n AuthorityUtils.canCallWithDelay(authority(), caller, address(this), bytes4(data[0:4]));\\n if (!immediate) {\\n if (delay > 0) {\\n _consumingSchedule = true;\\n IAccessManager(authority()).consumeScheduledOp(caller, data);\\n _consumingSchedule = false;\\n } else {\\n return false;\\n }\\n }\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x40dfee0e736695b3005df6c150a2d794ac06f3f4b91745e2959623e770044798\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nerror AccessManagedUnauthorized(address caller);\\nerror AlreadyAdded();\\nerror CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector);\\nerror CannotAddSelectorsToZeroAddress(bytes4[] _selectors);\\nerror CannotRemoveFunctionThatDoesNotExist(bytes4 _selector);\\nerror CannotRemoveImmutableFunction(bytes4 _selector);\\nerror CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors);\\nerror CannotReplaceFunctionThatDoesNotExists(bytes4 _selector);\\nerror CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector);\\nerror CannotReplaceImmutableFunction(bytes4 _selector);\\nerror ContractHasNoCode();\\nerror CollateralBacked();\\nerror FunctionNotFound(bytes4 _functionSelector);\\nerror IncorrectFacetCutAction(uint8 _action);\\nerror InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);\\nerror InvalidChainlinkRate();\\nerror InvalidLengths();\\nerror InvalidNegativeFees();\\nerror InvalidOracleType();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidRate();\\nerror InvalidSwap();\\nerror InvalidTokens();\\nerror InvalidAccessManager();\\nerror ManagerHasAssets();\\nerror NoSelectorsProvidedForFacetForCut(address _facetAddress);\\nerror NotAllowed();\\nerror NotCollateral();\\nerror NotGovernor();\\nerror NotGuardian();\\nerror NotTrusted();\\nerror NotTrustedOrGuardian();\\nerror NotWhitelisted();\\nerror OdosSwapFailed();\\nerror OracleUpdateFailed();\\nerror Paused();\\nerror ReentrantCall();\\nerror RemoveFacetAddressMustBeZeroAddress(address _facetAddress);\\nerror TooBigAmountIn();\\nerror TooLate();\\nerror TooSmallAmountOut();\\nerror ZeroAddress();\\nerror ZeroAmount();\\nerror SwapError();\\nerror SlippageTooHigh();\\nerror InsufficientFunds();\\n\",\"keccak256\":\"0x1e2f6812ef78e948e5155d32213b52afff8c0ba5463d18bee10694efbf886130\",\"license\":\"BUSL-1.1\"}},\"version\":1}", - "bytecode": "0x60e080604052346101e95760c08161278a803803809161001f828561020f565b8339810103126101e95761003281610246565b9061003f60208201610246565b6040820151926001600160a01b038416918285036101e95760608401516001600160a01b03811681036101e95760a061007a60808701610246565b950151956001600160a01b038716958688036101e9575f80546001600160a01b0319166001600160a01b0390921691821790556040519081527f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90602090a160a052608052600480546001600160a01b039283166001600160a01b0319918216179091556005805493909216921691909117905581156102005760446020925f9460c052604051948593849263095ea7b360e01b84526004840152811960248401525af180156101f5576101b9575b60405161252f908161025b823960805181818161027601528181610ce401528181610e1b01528181611d1901526120ab015260a0518181816103bf0152818161066a01528181610e480152818161155201526115d9015260c05181818161040701528181610d5901526115960152f35b6020813d6020116101ed575b816101d26020938361020f565b810103126101e95751801515036101e9575f610149565b5f80fd5b3d91506101c5565b6040513d5f823e3d90fd5b63d92e233d60e01b5f5260045ffd5b601f909101601f19168101906001600160401b0382119082101761023257604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101e95756fe60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220ec283012c4b4807e318035ba023be8591bf414e2388206dea6cd585b6cb7364064736f6c634300081c0033", - "deployedBytecode": "0x60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220ec283012c4b4807e318035ba023be8591bf414e2388206dea6cd585b6cb7364064736f6c634300081c0033", - "devdoc": { - "author": "Cooper Labs", - "custom:contact": "security@cooperlabs.xyz", - "details": "Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol", - "errors": { - "SafeERC20FailedOperation(address)": [ - { - "details": "An operation with an ERC-20 token failed." - } - ] - }, - "events": { - "AuthorityUpdated(address)": { - "details": "Authority that manages this contract was updated." - } - }, - "kind": "dev", - "methods": { - "addBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to add to the budget", - "receiver": "address of the receiver" - } - }, - "authority()": { - "details": "Returns the current authority." - }, - "computeRebalanceAmount(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - }, - "returns": { - "amount": "amount to be rebalanced", - "increase": "whether the exposure should be increased" - } - }, - "harvest(address,uint256,bytes)": { - "details": "This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage" - }, - "isConsumingScheduledOp()": { - "details": "Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls." - }, - "onFlashLoan(address,address,uint256,uint256,bytes)": { - "details": "Receive a flash loan.", - "params": { - "amount": "The amount of tokens lent.", - "data": "Arbitrary data structure, intended to contain user-defined parameters.", - "fee": "The additional amount of tokens to repay.", - "initiator": "The initiator of the loan.", - "token": "The loan currency." - }, - "returns": { - "_0": "The keccak256 hash of \"ERC3156FlashBorrower.onFlashLoan\"" - } - }, - "recoverERC20(address,uint256,address)": { - "params": { - "amountToRecover": "amount to recover", - "to": "address to send the recovered tokens", - "tokenAddress": "address of the token to recover" - } - }, - "removeBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to remove from the budget", - "receiver": "address of the receiver" - } - }, - "setAuthority(address)": { - "details": "Transfers control to a new authority. The caller must be the current authority." - }, - "setMaxSlippage(address,uint96)": { - "params": { - "newMaxSlippage": "new max allowed slippage" - } - }, - "setSwapRouter(address)": { - "params": { - "newSwapRouter": "address of the swap router" - } - }, - "setTargetExposure(address,uint64)": { - "params": { - "targetExposure": "target exposure to the yield bearing asset used", - "yieldBearingAsset": "address of the yield bearing asset" - } - }, - "setTokenTransferAddress(address)": { - "params": { - "newTokenTransferAddress": "address of the token transfer contract" - } - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "params": { - "asset": "address of the asset", - "maxExposure": "maximum exposure within the Parallelizer to the asset", - "minExposure": "minimum exposure within the Parallelizer to the asset", - "overrideExposures": "whether limit exposures should be overriden or read onchain through the Parallelizer", - "targetExposure": "target exposure to the yieldBearingAsset asset used", - "yieldBearingAsset": "address of the yieldBearingAsset" - } - }, - "toggleTrusted(address)": { - "params": { - "trusted": "address to toggle the trusted status" - } - }, - "updateLimitExposuresYieldAsset(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - } - } - }, - "title": "GenericHarvester", - "version": 1 - }, - "userdoc": { - "events": { - "SwapRouterUpdated(address)": { - "notice": "Event emitted when the swap router is updated" - }, - "TokenTransferAddressUpdated(address)": { - "notice": "Event emitted when the token proxy is updated" - } - }, - "kind": "user", - "methods": { - "addBudget(uint256,address)": { - "notice": "Add budget to be spent by the receiver during the flashloan" - }, - "budget(address)": { - "notice": "Budget of tokenP available for each users" - }, - "computeRebalanceAmount(address)": { - "notice": "Compute the amount needed to rebalance the Parallelizer" - }, - "flashloan()": { - "notice": "Parallel stablecoin flashloan contract" - }, - "harvest(address,uint256,bytes)": { - "notice": "Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset" - }, - "isTrusted(address)": { - "notice": "trusted addresses that can update target exposure and do others non critical operations" - }, - "maxTokenSlippage(address)": { - "notice": "Max slippage when dealing with the Parallelizer" - }, - "parallelizer()": { - "notice": "Reference to the `parallelizer` implementation this contract aims at rebalancing" - }, - "recoverERC20(address,uint256,address)": { - "notice": "Recover ERC20 tokens" - }, - "removeBudget(uint256,address)": { - "notice": "Remove budget from the owner and send it to the receiver" - }, - "setMaxSlippage(address,uint96)": { - "notice": "Set the max allowed slippage" - }, - "setSwapRouter(address)": { - "notice": "Set the swap router" - }, - "setTargetExposure(address,uint64)": { - "notice": "Set the target exposure of a yield bearing asset" - }, - "setTokenTransferAddress(address)": { - "notice": "Set the token transfer address" - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "notice": "Set the yieldBearingAsset data" - }, - "swapRouter()": { - "notice": "address of the router/aggregator" - }, - "toggleTrusted(address)": { - "notice": "Toggle the trusted status of an address" - }, - "tokenP()": { - "notice": "TokenP handled by the `parallelizer` of interest" - }, - "tokenTransferAddress()": { - "notice": "address to approve to transfer tokens to" - }, - "updateLimitExposuresYieldAsset(address)": { - "notice": "Set the limit exposures to the asset linked to the yield bearing asset" - }, - "yieldBearingData(address)": { - "notice": "Data associated to a yield bearing asset" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 22996, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_authority", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 22998, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_consumingSchedule", - "offset": 20, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 8228, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxTokenSlippage", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_uint96)" - }, - { - "astId": 8234, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "yieldBearingData", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)" - }, - { - "astId": 8239, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "isTrusted", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 43, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "swapRouter", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 46, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "tokenTransferAddress", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 8955, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "budget", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct YieldBearingParams)", - "numberOfBytes": "32", - "value": "t_struct(YieldBearingParams)8169_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_address,t_uint96)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint96)", - "numberOfBytes": "32", - "value": "t_uint96" - }, - "t_struct(YieldBearingParams)8169_storage": { - "encoding": "inplace", - "label": "struct YieldBearingParams", - "members": [ - { - "astId": 8158, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "asset", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 8160, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "targetExposure", - "offset": 20, - "slot": "0", - "type": "t_uint64" - }, - { - "astId": 8162, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxExposure", - "offset": 0, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8164, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "minExposure", - "offset": 8, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8166, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "overrideExposures", - "offset": 16, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8168, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxSlippage", - "offset": 0, - "slot": "2", - "type": "t_uint96" - } - ], - "numberOfBytes": "96" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint64": { - "encoding": "inplace", - "label": "uint64", - "numberOfBytes": "8" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } - } -} \ No newline at end of file diff --git a/deployments/sonic/GenericHarvester_USDp.json b/deployments/sonic/GenericHarvester_USDp.json deleted file mode 100644 index ec8c813..0000000 --- a/deployments/sonic/GenericHarvester_USDp.json +++ /dev/null @@ -1,1124 +0,0 @@ -{ - "address": "0x120805265fA944834DC6e930De2995768806a9d2", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "initialTokenTransferAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "initialSwapRouter", - "type": "address" - }, - { - "internalType": "contract ITokenP", - "name": "definitivetokenP", - "type": "address" - }, - { - "internalType": "contract IParallelizer", - "name": "definitiveParallelizer", - "type": "address" - }, - { - "internalType": "address", - "name": "initialAuthority", - "type": "address" - }, - { - "internalType": "contract IERC3156FlashLender", - "name": "definitiveFlashloan", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AccessManagedInvalidAuthority", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "internalType": "uint32", - "name": "delay", - "type": "uint32" - } - ], - "name": "AccessManagedRequiredDelay", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "AccessManagedUnauthorized", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidParam", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrusted", - "type": "error" - }, - { - "inputs": [], - "name": "NotTrustedOrGuardian", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - } - ], - "name": "SafeERC20FailedOperation", - "type": "error" - }, - { - "inputs": [], - "name": "SwapError", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "ZeroAmount", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "authority", - "type": "address" - } - ], - "name": "AuthorityUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "SwapRouterUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "TokenTransferAddressUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "trusted", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "status", - "type": "bool" - } - ], - "name": "TrustedToggled", - "type": "event" - }, - { - "inputs": [], - "name": "CALLBACK_SUCCESS", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "addBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "authority", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "budget", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "computeRebalanceAmount", - "outputs": [ - { - "internalType": "uint8", - "name": "increase", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "flashloan", - "outputs": [ - { - "internalType": "contract IERC3156FlashLender", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint256", - "name": "scale", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "extraData", - "type": "bytes" - } - ], - "name": "harvest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isConsumingScheduledOp", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "isTrusted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "initiator", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "fee", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "onFlashLoan", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "parallelizer", - "outputs": [ - { - "internalType": "contract IParallelizer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToRecover", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "recoverERC20", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "removeBudget", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAuthority", - "type": "address" - } - ], - "name": "setAuthority", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint96", - "name": "newMaxSlippage", - "type": "uint96" - } - ], - "name": "setMaxSlippage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newSwapRouter", - "type": "address" - } - ], - "name": "setSwapRouter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - } - ], - "name": "setTargetExposure", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newTokenTransferAddress", - "type": "address" - } - ], - "name": "setTokenTransferAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - }, - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "name": "setYieldBearingAssetData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "swapRouter", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "trusted", - "type": "address" - } - ], - "name": "toggleTrusted", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "tokenP", - "outputs": [ - { - "internalType": "contract ITokenP", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenTransferAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "yieldBearingAsset", - "type": "address" - } - ], - "name": "updateLimitExposuresYieldAsset", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "yieldBearingData", - "outputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "uint64", - "name": "targetExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "minExposure", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "overrideExposures", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "maxSlippage", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "transactionHash": "0xdaef90c334810e232fb133c5ab664d331d2271b181c1476ac7cfec619b369e0d", - "receipt": { - "to": null, - "from": "0x66CcEC236bbcE5f1bBd1b2fC0a4014e57A55ad02", - "contractAddress": "0x120805265fA944834DC6e930De2995768806a9d2", - "transactionIndex": 1, - "gasUsed": "2489551", - "logsBloom": "0x20000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200010000000000000040000000000000000000000000000000000000000000010000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000010000008000000000000000008000000000000020000000000000000000000000000000000000000000000010000000000000000000000000000004000100000000000000000000000000000000000000020000010000000000000000008000000000008000000000000000000000000000000", - "blockHash": "0xfd87a8e9818d7d35faa73985bf5d5f49c50923521e5c64035ff6d8f29ca14273", - "transactionHash": "0xdaef90c334810e232fb133c5ab664d331d2271b181c1476ac7cfec619b369e0d", - "logs": [ - { - "transactionIndex": 1, - "blockNumber": 35498524, - "transactionHash": "0xdaef90c334810e232fb133c5ab664d331d2271b181c1476ac7cfec619b369e0d", - "address": "0x120805265fA944834DC6e930De2995768806a9d2", - "topics": [ - "0x2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad" - ], - "data": "0x0000000000000000000000008efb3ded78fbaef2a4efe01e01bbd911e4094b78", - "logIndex": 8, - "blockHash": "0xfd87a8e9818d7d35faa73985bf5d5f49c50923521e5c64035ff6d8f29ca14273" - }, - { - "transactionIndex": 1, - "blockNumber": 35498524, - "transactionHash": "0xdaef90c334810e232fb133c5ab664d331d2271b181c1476ac7cfec619b369e0d", - "address": "0x08417cdb7F52a5021bB4eb6E0deAf3f295c3f182", - "topics": [ - "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", - "0x000000000000000000000000120805265fa944834dc6e930de2995768806a9d2", - "0x0000000000000000000000002cb56df31b909854b01d4b1ead5676cf90e885e7" - ], - "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "logIndex": 9, - "blockHash": "0xfd87a8e9818d7d35faa73985bf5d5f49c50923521e5c64035ff6d8f29ca14273" - } - ], - "blockNumber": 35498524, - "cumulativeGasUsed": "2653746", - "status": 1, - "byzantium": true - }, - "args": [ - "0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D", - "0xaC041Df48dF9791B0654f1Dbbf2CC8450C5f2e9D", - "0x08417cdb7F52a5021bB4eb6E0deAf3f295c3f182", - "0xBEFBAe2330186F031b469e26283aCc66bb5F8826", - "0x8eFb3DED78FbaEF2a4eFe01E01BBD911E4094b78", - "0x2cb56dF31b909854B01D4B1EAd5676cf90e885E7" - ], - "numDeployments": 1, - "solcInputHash": "9e6800737641b3b015331b65b5c620c3", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initialTokenTransferAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialSwapRouter\",\"type\":\"address\"},{\"internalType\":\"contract ITokenP\",\"name\":\"definitivetokenP\",\"type\":\"address\"},{\"internalType\":\"contract IParallelizer\",\"name\":\"definitiveParallelizer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"initialAuthority\",\"type\":\"address\"},{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"definitiveFlashloan\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AccessManagedInvalidAuthority\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"delay\",\"type\":\"uint32\"}],\"name\":\"AccessManagedRequiredDelay\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"}],\"name\":\"AccessManagedUnauthorized\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParam\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrusted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotTrustedOrGuardian\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SwapError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAmount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"AuthorityUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Recovered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"SwapRouterUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"TokenTransferAddressUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"TrustedToggled\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CALLBACK_SUCCESS\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"addBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"authority\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"budget\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"computeRebalanceAmount\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"increase\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"flashloan\",\"outputs\":[{\"internalType\":\"contract IERC3156FlashLender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"scale\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"name\":\"harvest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isConsumingScheduledOp\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isTrusted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"maxTokenSlippage\",\"outputs\":[{\"internalType\":\"uint96\",\"name\":\"\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"onFlashLoan\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parallelizer\",\"outputs\":[{\"internalType\":\"contract IParallelizer\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountToRecover\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"recoverERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"removeBudget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAuthority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"newMaxSlippage\",\"type\":\"uint96\"}],\"name\":\"setMaxSlippage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newSwapRouter\",\"type\":\"address\"}],\"name\":\"setSwapRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"}],\"name\":\"setTargetExposure\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newTokenTransferAddress\",\"type\":\"address\"}],\"name\":\"setTokenTransferAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"name\":\"setYieldBearingAssetData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"swapRouter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"trusted\",\"type\":\"address\"}],\"name\":\"toggleTrusted\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenP\",\"outputs\":[{\"internalType\":\"contract ITokenP\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tokenTransferAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"yieldBearingAsset\",\"type\":\"address\"}],\"name\":\"updateLimitExposuresYieldAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"yieldBearingData\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"targetExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"minExposure\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"overrideExposures\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"maxSlippage\",\"type\":\"uint96\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Cooper Labs\",\"custom:contact\":\"security@cooperlabs.xyz\",\"details\":\"Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\",\"errors\":{\"SafeERC20FailedOperation(address)\":[{\"details\":\"An operation with an ERC-20 token failed.\"}]},\"events\":{\"AuthorityUpdated(address)\":{\"details\":\"Authority that manages this contract was updated.\"}},\"kind\":\"dev\",\"methods\":{\"addBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to add to the budget\",\"receiver\":\"address of the receiver\"}},\"authority()\":{\"details\":\"Returns the current authority.\"},\"computeRebalanceAmount(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"},\"returns\":{\"amount\":\"amount to be rebalanced\",\"increase\":\"whether the exposure should be increased\"}},\"harvest(address,uint256,bytes)\":{\"details\":\"This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage\"},\"isConsumingScheduledOp()\":{\"details\":\"Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls.\"},\"onFlashLoan(address,address,uint256,uint256,bytes)\":{\"details\":\"Receive a flash loan.\",\"params\":{\"amount\":\"The amount of tokens lent.\",\"data\":\"Arbitrary data structure, intended to contain user-defined parameters.\",\"fee\":\"The additional amount of tokens to repay.\",\"initiator\":\"The initiator of the loan.\",\"token\":\"The loan currency.\"},\"returns\":{\"_0\":\"The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\"}},\"recoverERC20(address,uint256,address)\":{\"params\":{\"amountToRecover\":\"amount to recover\",\"to\":\"address to send the recovered tokens\",\"tokenAddress\":\"address of the token to recover\"}},\"removeBudget(uint256,address)\":{\"params\":{\"amount\":\"amount of tokenP to remove from the budget\",\"receiver\":\"address of the receiver\"}},\"setAuthority(address)\":{\"details\":\"Transfers control to a new authority. The caller must be the current authority.\"},\"setMaxSlippage(address,uint96)\":{\"params\":{\"newMaxSlippage\":\"new max allowed slippage\"}},\"setSwapRouter(address)\":{\"params\":{\"newSwapRouter\":\"address of the swap router\"}},\"setTargetExposure(address,uint64)\":{\"params\":{\"targetExposure\":\"target exposure to the yield bearing asset used\",\"yieldBearingAsset\":\"address of the yield bearing asset\"}},\"setTokenTransferAddress(address)\":{\"params\":{\"newTokenTransferAddress\":\"address of the token transfer contract\"}},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"params\":{\"asset\":\"address of the asset\",\"maxExposure\":\"maximum exposure within the Parallelizer to the asset\",\"minExposure\":\"minimum exposure within the Parallelizer to the asset\",\"overrideExposures\":\"whether limit exposures should be overriden or read onchain through the Parallelizer\",\"targetExposure\":\"target exposure to the yieldBearingAsset asset used\",\"yieldBearingAsset\":\"address of the yieldBearingAsset\"}},\"toggleTrusted(address)\":{\"params\":{\"trusted\":\"address to toggle the trusted status\"}},\"updateLimitExposuresYieldAsset(address)\":{\"params\":{\"yieldBearingAsset\":\"address of the yield bearing asset\"}}},\"title\":\"GenericHarvester\",\"version\":1},\"userdoc\":{\"events\":{\"SwapRouterUpdated(address)\":{\"notice\":\"Event emitted when the swap router is updated\"},\"TokenTransferAddressUpdated(address)\":{\"notice\":\"Event emitted when the token proxy is updated\"}},\"kind\":\"user\",\"methods\":{\"addBudget(uint256,address)\":{\"notice\":\"Add budget to be spent by the receiver during the flashloan\"},\"budget(address)\":{\"notice\":\"Budget of tokenP available for each users\"},\"computeRebalanceAmount(address)\":{\"notice\":\"Compute the amount needed to rebalance the Parallelizer\"},\"flashloan()\":{\"notice\":\"Parallel stablecoin flashloan contract\"},\"harvest(address,uint256,bytes)\":{\"notice\":\"Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset\"},\"isTrusted(address)\":{\"notice\":\"trusted addresses that can update target exposure and do others non critical operations\"},\"maxTokenSlippage(address)\":{\"notice\":\"Max slippage when dealing with the Parallelizer\"},\"parallelizer()\":{\"notice\":\"Reference to the `parallelizer` implementation this contract aims at rebalancing\"},\"recoverERC20(address,uint256,address)\":{\"notice\":\"Recover ERC20 tokens\"},\"removeBudget(uint256,address)\":{\"notice\":\"Remove budget from the owner and send it to the receiver\"},\"setMaxSlippage(address,uint96)\":{\"notice\":\"Set the max allowed slippage\"},\"setSwapRouter(address)\":{\"notice\":\"Set the swap router\"},\"setTargetExposure(address,uint64)\":{\"notice\":\"Set the target exposure of a yield bearing asset\"},\"setTokenTransferAddress(address)\":{\"notice\":\"Set the token transfer address\"},\"setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)\":{\"notice\":\"Set the yieldBearingAsset data\"},\"swapRouter()\":{\"notice\":\"address of the router/aggregator\"},\"toggleTrusted(address)\":{\"notice\":\"Toggle the trusted status of an address\"},\"tokenP()\":{\"notice\":\"TokenP handled by the `parallelizer` of interest\"},\"tokenTransferAddress()\":{\"notice\":\"address to approve to transfer tokens to\"},\"updateLimitExposuresYieldAsset(address)\":{\"notice\":\"Set the limit exposures to the asset linked to the yield bearing asset\"},\"yieldBearingData(address)\":{\"notice\":\"Data associated to a yield bearing asset\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/helpers/GenericHarvester.sol\":\"GenericHarvester\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@helpers/RouterSwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20, IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/// @title Swapper\\n/// @author Angle Labs, Inc.\\n/// @dev Abstract contract for swapping tokens using a router/aggregator\\n/// @dev This contract is an authorized fork of Angle's `RouterSwapper` contract\\n/// https://github.com/AngleProtocol/utils/blob/main/src/RouterSwapper.sol\\nabstract contract RouterSwapper {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERRORS\\n //////////////////////////////////////////////////////////////*/\\n\\n error SwapError();\\n error ZeroAddress();\\n\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Event emitted when the swap router is updated\\n */\\n event SwapRouterUpdated(address newSwapRouter);\\n /**\\n * @notice Event emitted when the token proxy is updated\\n */\\n event TokenTransferAddressUpdated(address newTokenTransferAddress);\\n\\n /*//////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////*/\\n\\n modifier noZeroAddress(address targetAddress) {\\n if (targetAddress == address(0)) {\\n revert ZeroAddress();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n MUTABLE VARIABLES\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice address of the router/aggregator\\n */\\n address public swapRouter;\\n /**\\n * @notice address to approve to transfer tokens to\\n */\\n address public tokenTransferAddress;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address initialSwapRouter, address initialTokenTransferAddress) {\\n swapRouter = initialSwapRouter;\\n tokenTransferAddress = initialTokenTransferAddress;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the router/aggregator address\\n * @param newSwapRouter address of the new router/aggregator\\n */\\n function setSwapRouter(address newSwapRouter) public virtual noZeroAddress(newSwapRouter) {\\n swapRouter = newSwapRouter;\\n\\n emit SwapRouterUpdated(newSwapRouter);\\n }\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the new token transfer address\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress)\\n public\\n virtual\\n noZeroAddress(newTokenTransferAddress)\\n {\\n tokenTransferAddress = newTokenTransferAddress;\\n\\n emit TokenTransferAddressUpdated(newTokenTransferAddress);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n SWAP FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Approve the router/aggregator to spend the token if needed\\n * @param token address of the token to approve\\n * @param spender address of the router/aggregator\\n * @param amount amount to approve\\n */\\n function _approveTokenIfNeeded(address token, address spender, uint256 amount) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), spender);\\n if (allowance < amount) {\\n IERC20(token).safeIncreaseAllowance(spender, amount - allowance);\\n }\\n }\\n\\n /**\\n * @notice Perform the swap using the router/aggregator\\n * @param callData bytes to call the router/aggregator\\n */\\n function _performRouterSwap(bytes memory callData) internal {\\n (bool success, bytes memory retData) = swapRouter.call(callData);\\n\\n if (!success) {\\n if (retData.length != 0) {\\n assembly (\\\"memory-safe\\\") {\\n revert(add(32, retData), mload(retData))\\n }\\n }\\n revert SwapError();\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swapCalldata(address[] calldata tokens, bytes[] calldata callDatas, uint256[] calldata amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n\\n /**\\n * @notice Swap tokens using the router/aggregator\\n * @param tokens array of tokens to swap\\n * @param callDatas array of bytes to call the router/aggregator\\n * @param amounts array of amounts to swap\\n */\\n function _swap(address[] memory tokens, bytes[] memory callDatas, uint256[] memory amounts) internal {\\n uint256 length = tokens.length;\\n for (uint256 i; i < length; ++i) {\\n _approveTokenIfNeeded(tokens[i], tokenTransferAddress, amounts[i]);\\n _performRouterSwap(callDatas[i]);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8c5a6b026a95816806814ef681b6b225ea4c405a39a4eab0111921853202829c\",\"license\":\"GPL-3.0\"},\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/AuthorityUtils.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IAuthority} from \\\"./IAuthority.sol\\\";\\n\\nlibrary AuthorityUtils {\\n /**\\n * @dev Since `AccessManager` implements an extended IAuthority interface, invoking `canCall` with backwards compatibility\\n * for the preexisting `IAuthority` interface requires special care to avoid reverting on insufficient return data.\\n * This helper function takes care of invoking `canCall` in a backwards compatible way without reverting.\\n */\\n function canCallWithDelay(\\n address authority,\\n address caller,\\n address target,\\n bytes4 selector\\n ) internal view returns (bool immediate, uint32 delay) {\\n (bool success, bytes memory data) = authority.staticcall(\\n abi.encodeCall(IAuthority.canCall, (caller, target, selector))\\n );\\n if (success) {\\n if (data.length >= 0x40) {\\n (immediate, delay) = abi.decode(data, (bool, uint32));\\n } else if (data.length >= 0x20) {\\n immediate = abi.decode(data, (bool));\\n }\\n }\\n return (immediate, delay);\\n }\\n}\\n\",\"keccak256\":\"0xb3875997b0d8705e29aa20fee88e1dfef93df438794ae1ad8ba2eb016a4dd4e4\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAccessManaged.sol)\\n\\npragma solidity ^0.8.20;\\n\\ninterface IAccessManaged {\\n /**\\n * @dev Authority that manages this contract was updated.\\n */\\n event AuthorityUpdated(address authority);\\n\\n error AccessManagedUnauthorized(address caller);\\n error AccessManagedRequiredDelay(address caller, uint32 delay);\\n error AccessManagedInvalidAuthority(address authority);\\n\\n /**\\n * @dev Returns the current authority.\\n */\\n function authority() external view returns (address);\\n\\n /**\\n * @dev Transfers control to a new authority. The caller must be the current authority.\\n */\\n function setAuthority(address) external;\\n\\n /**\\n * @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n * being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n * attacker controlled calls.\\n */\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaba93d42cd70e1418782951132d97b31ddce5f50ad81090884b6d0e41caac9d6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAccessManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (access/manager/IAccessManager.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Time} from \\\"../../utils/types/Time.sol\\\";\\n\\ninterface IAccessManager {\\n /**\\n * @dev A delayed operation was scheduled.\\n */\\n event OperationScheduled(\\n bytes32 indexed operationId,\\n uint32 indexed nonce,\\n uint48 schedule,\\n address caller,\\n address target,\\n bytes data\\n );\\n\\n /**\\n * @dev A scheduled operation was executed.\\n */\\n event OperationExecuted(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev A scheduled operation was canceled.\\n */\\n event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);\\n\\n /**\\n * @dev Informational labelling for a roleId.\\n */\\n event RoleLabel(uint64 indexed roleId, string label);\\n\\n /**\\n * @dev Emitted when `account` is granted `roleId`.\\n *\\n * NOTE: The meaning of the `since` argument depends on the `newMember` argument.\\n * If the role is granted to a new member, the `since` argument indicates when the account becomes a member of the role,\\n * otherwise it indicates the execution delay for this account and roleId is updated.\\n */\\n event RoleGranted(uint64 indexed roleId, address indexed account, uint32 delay, uint48 since, bool newMember);\\n\\n /**\\n * @dev Emitted when `account` membership or `roleId` is revoked. Unlike granting, revoking is instantaneous.\\n */\\n event RoleRevoked(uint64 indexed roleId, address indexed account);\\n\\n /**\\n * @dev Role acting as admin over a given `roleId` is updated.\\n */\\n event RoleAdminChanged(uint64 indexed roleId, uint64 indexed admin);\\n\\n /**\\n * @dev Role acting as guardian over a given `roleId` is updated.\\n */\\n event RoleGuardianChanged(uint64 indexed roleId, uint64 indexed guardian);\\n\\n /**\\n * @dev Grant delay for a given `roleId` will be updated to `delay` when `since` is reached.\\n */\\n event RoleGrantDelayChanged(uint64 indexed roleId, uint32 delay, uint48 since);\\n\\n /**\\n * @dev Target mode is updated (true = closed, false = open).\\n */\\n event TargetClosed(address indexed target, bool closed);\\n\\n /**\\n * @dev Role required to invoke `selector` on `target` is updated to `roleId`.\\n */\\n event TargetFunctionRoleUpdated(address indexed target, bytes4 selector, uint64 indexed roleId);\\n\\n /**\\n * @dev Admin delay for a given `target` will be updated to `delay` when `since` is reached.\\n */\\n event TargetAdminDelayUpdated(address indexed target, uint32 delay, uint48 since);\\n\\n error AccessManagerAlreadyScheduled(bytes32 operationId);\\n error AccessManagerNotScheduled(bytes32 operationId);\\n error AccessManagerNotReady(bytes32 operationId);\\n error AccessManagerExpired(bytes32 operationId);\\n error AccessManagerLockedRole(uint64 roleId);\\n error AccessManagerBadConfirmation();\\n error AccessManagerUnauthorizedAccount(address msgsender, uint64 roleId);\\n error AccessManagerUnauthorizedCall(address caller, address target, bytes4 selector);\\n error AccessManagerUnauthorizedConsume(address target);\\n error AccessManagerUnauthorizedCancel(address msgsender, address caller, address target, bytes4 selector);\\n error AccessManagerInvalidInitialAdmin(address initialAdmin);\\n\\n /**\\n * @dev Check if an address (`caller`) is authorised to call a given function on a given contract directly (with\\n * no restriction). Additionally, it returns the delay needed to perform the call indirectly through the {schedule}\\n * & {execute} workflow.\\n *\\n * This function is usually called by the targeted contract to control immediate execution of restricted functions.\\n * Therefore we only return true if the call can be performed without any delay. If the call is subject to a\\n * previously set delay (not zero), then the function should return false and the caller should schedule the operation\\n * for future execution.\\n *\\n * If `immediate` is true, the delay can be disregarded and the operation can be immediately executed, otherwise\\n * the operation can be executed if and only if delay is greater than 0.\\n *\\n * NOTE: The IAuthority interface does not include the `uint32` delay. This is an extension of that interface that\\n * is backward compatible. Some contracts may thus ignore the second return argument. In that case they will fail\\n * to identify the indirect workflow, and will consider calls that require a delay to be forbidden.\\n *\\n * NOTE: This function does not report the permissions of the admin functions in the manager itself. These are defined by the\\n * {AccessManager} documentation.\\n */\\n function canCall(\\n address caller,\\n address target,\\n bytes4 selector\\n ) external view returns (bool allowed, uint32 delay);\\n\\n /**\\n * @dev Expiration delay for scheduled proposals. Defaults to 1 week.\\n *\\n * IMPORTANT: Avoid overriding the expiration with 0. Otherwise every contract proposal will be expired immediately,\\n * disabling any scheduling usage.\\n */\\n function expiration() external view returns (uint32);\\n\\n /**\\n * @dev Minimum setback for all delay updates, with the exception of execution delays. It\\n * can be increased without setback (and reset via {revokeRole} in the case event of an\\n * accidental increase). Defaults to 5 days.\\n */\\n function minSetback() external view returns (uint32);\\n\\n /**\\n * @dev Get whether the contract is closed disabling any access. Otherwise role permissions are applied.\\n *\\n * NOTE: When the manager itself is closed, admin functions are still accessible to avoid locking the contract.\\n */\\n function isTargetClosed(address target) external view returns (bool);\\n\\n /**\\n * @dev Get the role required to call a function.\\n */\\n function getTargetFunctionRole(address target, bytes4 selector) external view returns (uint64);\\n\\n /**\\n * @dev Get the admin delay for a target contract. Changes to contract configuration are subject to this delay.\\n */\\n function getTargetAdminDelay(address target) external view returns (uint32);\\n\\n /**\\n * @dev Get the id of the role that acts as an admin for the given role.\\n *\\n * The admin permission is required to grant the role, revoke the role and update the execution delay to execute\\n * an operation that is restricted to this role.\\n */\\n function getRoleAdmin(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role that acts as a guardian for a given role.\\n *\\n * The guardian permission allows canceling operations that have been scheduled under the role.\\n */\\n function getRoleGuardian(uint64 roleId) external view returns (uint64);\\n\\n /**\\n * @dev Get the role current grant delay.\\n *\\n * Its value may change at any point without an event emitted following a call to {setGrantDelay}.\\n * Changes to this value, including effect timepoint are notified in advance by the {RoleGrantDelayChanged} event.\\n */\\n function getRoleGrantDelay(uint64 roleId) external view returns (uint32);\\n\\n /**\\n * @dev Get the access details for a given account for a given role. These details include the timepoint at which\\n * membership becomes active, and the delay applied to all operation by this user that requires this permission\\n * level.\\n *\\n * Returns:\\n * [0] Timestamp at which the account membership becomes valid. 0 means role is not granted.\\n * [1] Current execution delay for the account.\\n * [2] Pending execution delay for the account.\\n * [3] Timestamp at which the pending execution delay will become active. 0 means no delay update is scheduled.\\n */\\n function getAccess(\\n uint64 roleId,\\n address account\\n ) external view returns (uint48 since, uint32 currentDelay, uint32 pendingDelay, uint48 effect);\\n\\n /**\\n * @dev Check if a given account currently has the permission level corresponding to a given role. Note that this\\n * permission might be associated with an execution delay. {getAccess} can provide more details.\\n */\\n function hasRole(uint64 roleId, address account) external view returns (bool isMember, uint32 executionDelay);\\n\\n /**\\n * @dev Give a label to a role, for improved role discoverability by UIs.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleLabel} event.\\n */\\n function labelRole(uint64 roleId, string calldata label) external;\\n\\n /**\\n * @dev Add `account` to `roleId`, or change its execution delay.\\n *\\n * This gives the account the authorization to call any function that is restricted to this role. An optional\\n * execution delay (in seconds) can be set. If that delay is non 0, the user is required to schedule any operation\\n * that is restricted to members of this role. The user will only be able to execute the operation after the delay has\\n * passed, before it has expired. During this period, admin and guardians can cancel the operation (see {cancel}).\\n *\\n * If the account has already been granted this role, the execution delay will be updated. This update is not\\n * immediate and follows the delay rules. For example, if a user currently has a delay of 3 hours, and this is\\n * called to reduce that delay to 1 hour, the new delay will take some time to take effect, enforcing that any\\n * operation executed in the 3 hours that follows this update was indeed scheduled before this update.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - granted role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleGranted} event.\\n */\\n function grantRole(uint64 roleId, address account, uint32 executionDelay) external;\\n\\n /**\\n * @dev Remove an account from a role, with immediate effect. If the account does not have the role, this call has\\n * no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be an admin for the role (see {getRoleAdmin})\\n * - revoked role must not be the `PUBLIC_ROLE`\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function revokeRole(uint64 roleId, address account) external;\\n\\n /**\\n * @dev Renounce role permissions for the calling account with immediate effect. If the sender is not in\\n * the role this call has no effect.\\n *\\n * Requirements:\\n *\\n * - the caller must be `callerConfirmation`.\\n *\\n * Emits a {RoleRevoked} event if the account had the role.\\n */\\n function renounceRole(uint64 roleId, address callerConfirmation) external;\\n\\n /**\\n * @dev Change admin role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleAdminChanged} event\\n */\\n function setRoleAdmin(uint64 roleId, uint64 admin) external;\\n\\n /**\\n * @dev Change guardian role for a given role.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGuardianChanged} event\\n */\\n function setRoleGuardian(uint64 roleId, uint64 guardian) external;\\n\\n /**\\n * @dev Update the delay for granting a `roleId`.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {RoleGrantDelayChanged} event.\\n */\\n function setGrantDelay(uint64 roleId, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the role required to call functions identified by the `selectors` in the `target` contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetFunctionRoleUpdated} event per selector.\\n */\\n function setTargetFunctionRole(address target, bytes4[] calldata selectors, uint64 roleId) external;\\n\\n /**\\n * @dev Set the delay for changing the configuration of a given target contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetAdminDelayUpdated} event.\\n */\\n function setTargetAdminDelay(address target, uint32 newDelay) external;\\n\\n /**\\n * @dev Set the closed flag for a contract.\\n *\\n * Closing the manager itself won't disable access to admin methods to avoid locking the contract.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n *\\n * Emits a {TargetClosed} event.\\n */\\n function setTargetClosed(address target, bool closed) external;\\n\\n /**\\n * @dev Return the timepoint at which a scheduled operation will be ready for execution. This returns 0 if the\\n * operation is not yet scheduled, has expired, was executed, or was canceled.\\n */\\n function getSchedule(bytes32 id) external view returns (uint48);\\n\\n /**\\n * @dev Return the nonce for the latest scheduled operation with a given id. Returns 0 if the operation has never\\n * been scheduled.\\n */\\n function getNonce(bytes32 id) external view returns (uint32);\\n\\n /**\\n * @dev Schedule a delayed operation for future execution, and return the operation identifier. It is possible to\\n * choose the timestamp at which the operation becomes executable as long as it satisfies the execution delays\\n * required for the caller. The special value zero will automatically set the earliest possible time.\\n *\\n * Returns the `operationId` that was scheduled. Since this value is a hash of the parameters, it can reoccur when\\n * the same parameters are used; if this is relevant, the returned `nonce` can be used to uniquely identify this\\n * scheduled operation from other occurrences of the same `operationId` in invocations of {execute} and {cancel}.\\n *\\n * Emits a {OperationScheduled} event.\\n *\\n * NOTE: It is not possible to concurrently schedule more than one operation with the same `target` and `data`. If\\n * this is necessary, a random byte can be appended to `data` to act as a salt that will be ignored by the target\\n * contract if it is using standard Solidity ABI encoding.\\n */\\n function schedule(\\n address target,\\n bytes calldata data,\\n uint48 when\\n ) external returns (bytes32 operationId, uint32 nonce);\\n\\n /**\\n * @dev Execute a function that is delay restricted, provided it was properly scheduled beforehand, or the\\n * execution delay is 0.\\n *\\n * Returns the nonce that identifies the previously scheduled operation that is executed, or 0 if the\\n * operation wasn't previously scheduled (if the caller doesn't have an execution delay).\\n *\\n * Emits an {OperationExecuted} event only if the call was scheduled and delayed.\\n */\\n function execute(address target, bytes calldata data) external payable returns (uint32);\\n\\n /**\\n * @dev Cancel a scheduled (delayed) operation. Returns the nonce that identifies the previously scheduled\\n * operation that is cancelled.\\n *\\n * Requirements:\\n *\\n * - the caller must be the proposer, a guardian of the targeted function, or a global admin\\n *\\n * Emits a {OperationCanceled} event.\\n */\\n function cancel(address caller, address target, bytes calldata data) external returns (uint32);\\n\\n /**\\n * @dev Consume a scheduled operation targeting the caller. If such an operation exists, mark it as consumed\\n * (emit an {OperationExecuted} event and clean the state). Otherwise, throw an error.\\n *\\n * This is useful for contract that want to enforce that calls targeting them were scheduled on the manager,\\n * with all the verifications that it implies.\\n *\\n * Emit a {OperationExecuted} event.\\n */\\n function consumeScheduledOp(address caller, bytes calldata data) external;\\n\\n /**\\n * @dev Hashing function for delayed operations.\\n */\\n function hashOperation(address caller, address target, bytes calldata data) external view returns (bytes32);\\n\\n /**\\n * @dev Changes the authority of a target managed by this manager instance.\\n *\\n * Requirements:\\n *\\n * - the caller must be a global admin\\n */\\n function updateAuthority(address target, address newAuthority) external;\\n}\\n\",\"keccak256\":\"0x9be2d08a326515805bc9cf6315b7953f8d1ebe88abf48c2d645fb1fa8211a0e2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/manager/IAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (access/manager/IAuthority.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Standard interface for permissioning originally defined in Dappsys.\\n */\\ninterface IAuthority {\\n /**\\n * @dev Returns true if the caller can invoke on a target the function identified by a function selector.\\n */\\n function canCall(address caller, address target, bytes4 selector) external view returns (bool allowed);\\n}\\n\",\"keccak256\":\"0x4cc0766bd7fb7b3bafb70afa2a93b6e313a0baec7a35ad1b57505be7861c1030\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC1363.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"./IERC20.sol\\\";\\nimport {IERC165} from \\\"./IERC165.sol\\\";\\n\\n/**\\n * @title IERC1363\\n * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].\\n *\\n * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract\\n * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.\\n */\\ninterface IERC1363 is IERC20, IERC165 {\\n /*\\n * Note: the ERC-165 identifier for this interface is 0xb0202a11.\\n * 0xb0202a11 ===\\n * bytes4(keccak256('transferAndCall(address,uint256)')) ^\\n * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^\\n * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256)')) ^\\n * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))\\n */\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism\\n * and then calls {IERC1363Receiver-onTransferReceived} on `to`.\\n * @param from The address which you want to send tokens from.\\n * @param to The address which you want to transfer to.\\n * @param value The amount of tokens to be transferred.\\n * @param data Additional data with no specified format, sent in call to `to`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.\\n * @param spender The address which will spend the funds.\\n * @param value The amount of tokens to be spent.\\n * @param data Additional data with no specified format, sent in call to `spender`.\\n * @return A boolean value indicating whether the operation succeeded unless throwing.\\n */\\n function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9b6b3e7803bc5f2f8cd7ad57db8ac1def61a9930a5a3107df4882e028a9605d7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC165} from \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xde7e9fd9aee8d4f40772f96bb3b58836cbc6dfc0227014a061947f8821ea9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC20} from \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0xce41876e78d1badc0512229b4d14e4daf83bc1003d7f83978d18e0e56f965b9c\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashBorrower.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashBorrower, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashBorrower {\\n /**\\n * @dev Receive a flash loan.\\n * @param initiator The initiator of the loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param fee The additional amount of tokens to repay.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n * @return The keccak256 hash of \\\"ERC3156FlashBorrower.onFlashLoan\\\"\\n */\\n function onFlashLoan(\\n address initiator,\\n address token,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n ) external returns (bytes32);\\n}\\n\",\"keccak256\":\"0x0b1459615b9b47c2a4eec8e72f23ccc601f1d711f679a1c06b3390459021a341\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC3156FlashLender.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {IERC3156FlashBorrower} from \\\"./IERC3156FlashBorrower.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC-3156 FlashLender, as defined in\\n * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156].\\n */\\ninterface IERC3156FlashLender {\\n /**\\n * @dev The amount of currency available to be lended.\\n * @param token The loan currency.\\n * @return The amount of `token` that can be borrowed.\\n */\\n function maxFlashLoan(address token) external view returns (uint256);\\n\\n /**\\n * @dev The fee to be charged for a given loan.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @return The amount of `token` to be charged for the loan, on top of the returned principal.\\n */\\n function flashFee(address token, uint256 amount) external view returns (uint256);\\n\\n /**\\n * @dev Initiate a flash loan.\\n * @param receiver The receiver of the tokens in the loan, and the receiver of the callback.\\n * @param token The loan currency.\\n * @param amount The amount of tokens lent.\\n * @param data Arbitrary data structure, intended to contain user-defined parameters.\\n */\\n function flashLoan(\\n IERC3156FlashBorrower receiver,\\n address token,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x5d19ea24c555cf6a5dbafea9fac57887cc3e72154f3ee8e0a2bf67971811c14b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-20 standard as defined in the ERC.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the value of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\\n * caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 value) external returns (bool);\\n\\n /**\\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\\n * allowance mechanism. `value` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(address from, address to, uint256 value) external returns (bool);\\n}\\n\",\"keccak256\":\"0xe06a3f08a987af6ad2e1c1e774405d4fe08f1694b67517438b467cecf0da0ef7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.20;\\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\",\"keccak256\":\"0x70f2f713b13b7ce4610bcd0ac9fec0f3cc43693b043abcb8dc40a42a726eb330\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.2.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 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\",\"keccak256\":\"0x4ea01544758fd2c7045961904686bfe232d2220a04ecaa2d6b08dac17827febf\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n function _contextSuffixLength() internal view virtual returns (uint256) {\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x493033a8d1b176a037b2cc6a04dad01a5c157722049bbecf632ca876224dd4b2\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Panic.sol\":{\"content\":\"// 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\",\"keccak256\":\"0xf7fe324703a64fc51702311dc51562d5cb1497734f074e4f483bfb6717572d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.20;\\n\\n/**\\n * @dev Interface of the ERC-165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x79796192ec90263f21b464d5bc90b777a525971d3de8232be80d9c4f9fb353b8\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.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 Returns the addition of two unsigned integers, with an 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 if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\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 if (b == 0) return (false, 0);\\n return (true, a / b);\\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 if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\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 // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2\\u00b2\\u2075\\u2076 and mod 2\\u00b2\\u2075\\u2076 - 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 = prod1 * 2\\u00b2\\u2075\\u2076 + prod0.\\n uint256 prod0 = x * y; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 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 prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2\\u00b2\\u2075\\u2076. Also prevents denominator == 0.\\n if (denominator <= prod1) {\\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 [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, 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 {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2\\u00b2\\u2075\\u2076 / 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 prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2\\u00b2\\u2075\\u2076. Now that denominator is an odd number, it has an inverse modulo 2\\u00b2\\u2075\\u2076 such\\n // that denominator * inv \\u2261 1 mod 2\\u00b2\\u2075\\u2076. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv \\u2261 1 mod 2\\u2074.\\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\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u2076\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b3\\u00b2\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u2076\\u2074\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b9\\u00b2\\u2078\\n inverse *= 2 - denominator * inverse; // inverse mod 2\\u00b2\\u2075\\u2076\\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\\u00b2\\u2075\\u2076. Since the preconditions guarantee that the outcome is\\n // less than 2\\u00b2\\u2075\\u2076, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * 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 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 \\u2261 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) \\u2261 1 mod p`. As a consequence, we have `a * a**(p-2) \\u2261 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\\u00b2 - 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 `\\u03b5_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) \\u2264 sqrt(a) < 2**e`). We know that `e \\u2264 128` because `(2\\u00b9\\u00b2\\u2078)\\u00b2 = 2\\u00b2\\u2075\\u2076` is\\n // bigger than any uint256.\\n //\\n // By noticing that\\n // `2**(e-1) \\u2264 sqrt(a) < 2**e \\u2192 (2**(e-1))\\u00b2 \\u2264 a < (2**e)\\u00b2 \\u2192 2**(2*e-2) \\u2264 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) \\u2264 sqrt(a) < 2**e = 2 * x_n`. This implies \\u03b5_n \\u2264 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 \\u03b5_n \\u2264 2**(e-2).\\n // This is going to be our x_0 (and \\u03b5_0)\\n xn = (3 * xn) >> 1; // \\u03b5_0 := | x_0 - sqrt(a) | \\u2264 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}\\u00b2 - a = ((x_n + a / x_n) / 2)\\u00b2 - a\\n // = ((x_n\\u00b2 + a) / (2 * x_n))\\u00b2 - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2) - a\\n // = (x_n\\u2074 + 2 * a * x_n\\u00b2 + a\\u00b2 - 4 * a * x_n\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u2074 - 2 * a * x_n\\u00b2 + a\\u00b2) / (4 * x_n\\u00b2)\\n // = (x_n\\u00b2 - a)\\u00b2 / (2 * x_n)\\u00b2\\n // = ((x_n\\u00b2 - a) / (2 * x_n))\\u00b2\\n // \\u2265 0\\n // Which proves that for all n \\u2265 1, sqrt(a) \\u2264 x_n\\n //\\n // This gives us the proof of quadratic convergence of the sequence:\\n // \\u03b5_{n+1} = | x_{n+1} - sqrt(a) |\\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\\n // = | (x_n\\u00b2 + a - 2*x_n*sqrt(a)) / (2 * x_n) |\\n // = | (x_n - sqrt(a))\\u00b2 / (2 * x_n) |\\n // = | \\u03b5_n\\u00b2 / (2 * x_n) |\\n // = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n //\\n // For the first iteration, we have a special case where x_0 is known:\\n // \\u03b5_1 = \\u03b5_0\\u00b2 / | (2 * x_0) |\\n // \\u2264 (2**(e-2))\\u00b2 / (2 * (2**(e-1) + 2**(e-2)))\\n // \\u2264 2**(2*e-4) / (3 * 2**(e-1))\\n // \\u2264 2**(e-3) / 3\\n // \\u2264 2**(e-3-log2(3))\\n // \\u2264 2**(e-4.5)\\n //\\n // For the following iterations, we use the fact that, 2**(e-1) \\u2264 sqrt(a) \\u2264 x_n:\\n // \\u03b5_{n+1} = \\u03b5_n\\u00b2 / | (2 * x_n) |\\n // \\u2264 (2**(e-k))\\u00b2 / (2 * 2**(e-1))\\n // \\u2264 2**(2*e-2*k) / 2**e\\n // \\u2264 2**(e-2*k)\\n xn = (xn + a / xn) >> 1; // \\u03b5_1 := | x_1 - sqrt(a) | \\u2264 2**(e-4.5) -- special case, see above\\n xn = (xn + a / xn) >> 1; // \\u03b5_2 := | x_2 - sqrt(a) | \\u2264 2**(e-9) -- general case with k = 4.5\\n xn = (xn + a / xn) >> 1; // \\u03b5_3 := | x_3 - sqrt(a) | \\u2264 2**(e-18) -- general case with k = 9\\n xn = (xn + a / xn) >> 1; // \\u03b5_4 := | x_4 - sqrt(a) | \\u2264 2**(e-36) -- general case with k = 18\\n xn = (xn + a / xn) >> 1; // \\u03b5_5 := | x_5 - sqrt(a) | \\u2264 2**(e-72) -- general case with k = 36\\n xn = (xn + a / xn) >> 1; // \\u03b5_6 := | x_6 - sqrt(a) | \\u2264 2**(e-144) -- general case with k = 72\\n\\n // Because e \\u2264 128 (as discussed during the first estimation phase), we know have reached a precision\\n // \\u03b5_6 \\u2264 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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 exp;\\n unchecked {\\n exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);\\n value >>= exp;\\n result += exp;\\n\\n exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);\\n value >>= exp;\\n result += exp;\\n\\n result += SafeCast.toUint(value > 1);\\n }\\n return result;\\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 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n uint256 isGt;\\n unchecked {\\n isGt = SafeCast.toUint(value > (1 << 128) - 1);\\n value >>= isGt * 128;\\n result += isGt * 16;\\n\\n isGt = SafeCast.toUint(value > (1 << 64) - 1);\\n value >>= isGt * 64;\\n result += isGt * 8;\\n\\n isGt = SafeCast.toUint(value > (1 << 32) - 1);\\n value >>= isGt * 32;\\n result += isGt * 4;\\n\\n isGt = SafeCast.toUint(value > (1 << 16) - 1);\\n value >>= isGt * 16;\\n result += isGt * 2;\\n\\n result += SafeCast.toUint(value > (1 << 8) - 1);\\n }\\n return result;\\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\",\"keccak256\":\"0xa00be322d7db5786750ce0ac7e2f5b633ac30a5ed5fa1ced1e74acfc19acecea\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SafeCast.sol\":{\"content\":\"// 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\",\"keccak256\":\"0x195533c86d0ef72bcc06456a4f66a9b941f38eb403739b00f21fd7c1abd1ae54\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/types/Time.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/types/Time.sol)\\n\\npragma solidity ^0.8.20;\\n\\nimport {Math} from \\\"../math/Math.sol\\\";\\nimport {SafeCast} from \\\"../math/SafeCast.sol\\\";\\n\\n/**\\n * @dev This library provides helpers for manipulating time-related objects.\\n *\\n * It uses the following types:\\n * - `uint48` for timepoints\\n * - `uint32` for durations\\n *\\n * While the library doesn't provide specific types for timepoints and duration, it does provide:\\n * - a `Delay` type to represent duration that can be programmed to change value automatically at a given point\\n * - additional helper functions\\n */\\nlibrary Time {\\n using Time for *;\\n\\n /**\\n * @dev Get the block timestamp as a Timepoint.\\n */\\n function timestamp() internal view returns (uint48) {\\n return SafeCast.toUint48(block.timestamp);\\n }\\n\\n /**\\n * @dev Get the block number as a Timepoint.\\n */\\n function blockNumber() internal view returns (uint48) {\\n return SafeCast.toUint48(block.number);\\n }\\n\\n // ==================================================== Delay =====================================================\\n /**\\n * @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the\\n * future. The \\\"effect\\\" timepoint describes when the transitions happens from the \\\"old\\\" value to the \\\"new\\\" value.\\n * This allows updating the delay applied to some operation while keeping some guarantees.\\n *\\n * In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for\\n * some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set\\n * the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should\\n * still apply for some time.\\n *\\n *\\n * The `Delay` type is 112 bits long, and packs the following:\\n *\\n * ```\\n * | [uint48]: effect date (timepoint)\\n * | | [uint32]: value before (duration)\\n * \\u2193 \\u2193 \\u2193 [uint32]: value after (duration)\\n * 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC\\n * ```\\n *\\n * NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently\\n * supported.\\n */\\n type Delay is uint112;\\n\\n /**\\n * @dev Wrap a duration into a Delay to add the one-step \\\"update in the future\\\" feature\\n */\\n function toDelay(uint32 duration) internal pure returns (Delay) {\\n return Delay.wrap(duration);\\n }\\n\\n /**\\n * @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled\\n * change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered.\\n */\\n function _getFullAt(\\n Delay self,\\n uint48 timepoint\\n ) private pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n (valueBefore, valueAfter, effect) = self.unpack();\\n return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the\\n * effect timepoint is 0, then the pending value should not be considered.\\n */\\n function getFull(Delay self) internal view returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n return _getFullAt(self, timestamp());\\n }\\n\\n /**\\n * @dev Get the current value.\\n */\\n function get(Delay self) internal view returns (uint32) {\\n (uint32 delay, , ) = self.getFull();\\n return delay;\\n }\\n\\n /**\\n * @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to\\n * enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the\\n * new delay becomes effective.\\n */\\n function withUpdate(\\n Delay self,\\n uint32 newValue,\\n uint32 minSetback\\n ) internal view returns (Delay updatedDelay, uint48 effect) {\\n uint32 value = self.get();\\n uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0));\\n effect = timestamp() + setback;\\n return (pack(value, newValue, effect), effect);\\n }\\n\\n /**\\n * @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint).\\n */\\n function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {\\n uint112 raw = Delay.unwrap(self);\\n\\n valueAfter = uint32(raw);\\n valueBefore = uint32(raw >> 32);\\n effect = uint48(raw >> 64);\\n\\n return (valueBefore, valueAfter, effect);\\n }\\n\\n /**\\n * @dev pack the components into a Delay object.\\n */\\n function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) {\\n return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter));\\n }\\n}\\n\",\"keccak256\":\"0x36776530f012618bc7526ceb28e77b85e582cb12d9b9466a71d4bd6bf952e4cc\",\"license\":\"MIT\"},\"contracts/helpers/BaseHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { AccessManaged } from \\\"../utils/AccessManaged.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport \\\"contracts/interfaces/IHarvester.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nstruct YieldBearingParams {\\n // Address of the asset used to mint the yield bearing asset\\n address asset;\\n // Target exposure to the collateral yield bearing asset used\\n uint64 targetExposure;\\n // Maximum exposure within the Parallelizer to the deposit asset\\n uint64 maxExposure;\\n // Minimum exposure within the Parallelizer to the deposit asset\\n uint64 minExposure;\\n // Whether limit exposures should be overriden or read onchain through the Parallelizer\\n // This value should be 1 to override exposures or 2 if these shouldn't be overriden\\n uint64 overrideExposures;\\n // Maximum slippage when dealing with the Parallelizer\\n uint96 maxSlippage;\\n}\\n\\n/// @title BaseHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Abstract contract for a harvester that aims at rebalancing a Parallelizer\\n/// @dev This contract is an authorized fork of Angle's BaseHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/BaseHarvester.sol\\nabstract contract BaseHarvester is IHarvester, AccessManaged {\\n using SafeERC20 for IERC20;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MODIFIERS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrusted() {\\n if (!isTrusted[msg.sender]) revert NotTrusted();\\n _;\\n }\\n\\n /**\\n * @notice Checks whether the `msg.sender` is trusted or guardian to update\\n * target exposure and do others non critical operations\\n */\\n modifier onlyTrustedOrRestricted() {\\n if (!isTrusted[msg.sender] && !_checkCanCall(_msgSender(), _msgData())) {\\n revert NotTrustedOrGuardian();\\n }\\n _;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VARIABLES\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Reference to the `parallelizer` implementation this contract aims at rebalancing\\n IParallelizer public immutable parallelizer;\\n /// @notice TokenP handled by the `parallelizer` of interest\\n ITokenP public immutable tokenP;\\n /// @notice Max slippage when dealing with the Parallelizer\\n mapping(address => uint96) public maxTokenSlippage;\\n /// @notice Data associated to a yield bearing asset\\n mapping(address => YieldBearingParams) public yieldBearingData;\\n /// @notice trusted addresses that can update target exposure and do others non critical operations\\n mapping(address => bool) public isTrusted;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EVENTS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n event Recovered(address token, uint256 amount, address to);\\n event TrustedToggled(address trusted, bool status);\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialAuthority,\\n ITokenP definitiveTokenP,\\n IParallelizer definitiveParallelizer\\n )\\n AccessManaged(initialAuthority)\\n {\\n tokenP = definitiveTokenP;\\n parallelizer = definitiveParallelizer;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n GUARDIAN FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the yieldBearingAsset data\\n * @param yieldBearingAsset address of the yieldBearingAsset\\n * @param asset address of the asset\\n * @param targetExposure target exposure to the yieldBearingAsset asset used\\n * @param minExposure minimum exposure within the Parallelizer to the asset\\n * @param maxExposure maximum exposure within the Parallelizer to the asset\\n * @param overrideExposures whether limit exposures should be overriden or read onchain through the Parallelizer\\n */\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external\\n restricted\\n {\\n _setYieldBearingAssetData(\\n yieldBearingAsset, asset, targetExposure, minExposure, maxExposure, overrideExposures, maxSlippage\\n );\\n }\\n\\n /**\\n * @notice Set the limit exposures to the asset linked to the yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n */\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) public virtual {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n if (yieldBearingInfo.overrideExposures == 2) {\\n _updateLimitExposuresYieldAsset(yieldBearingInfo.asset, yieldBearingInfo);\\n }\\n }\\n\\n /**\\n * @notice Set the max allowed slippage\\n * @param newMaxSlippage new max allowed slippage\\n */\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external restricted {\\n _setMaxSlippage(yieldBearingAsset, newMaxSlippage);\\n }\\n\\n /**\\n * @notice Toggle the trusted status of an address\\n * @param trusted address to toggle the trusted status\\n */\\n function toggleTrusted(address trusted) external restricted {\\n emit TrustedToggled(trusted, isTrusted[trusted]);\\n isTrusted[trusted] = !isTrusted[trusted];\\n }\\n\\n /**\\n * @notice Recover ERC20 tokens\\n * @param tokenAddress address of the token to recover\\n * @param amountToRecover amount to recover\\n * @param to address to send the recovered tokens\\n */\\n function recoverERC20(address tokenAddress, uint256 amountToRecover, address to) external restricted {\\n emit Recovered(tokenAddress, amountToRecover, to);\\n IERC20(tokenAddress).safeTransfer(to, amountToRecover);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n TRUSTED FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the target exposure of a yield bearing asset\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @param targetExposure target exposure to the yield bearing asset used\\n */\\n function setTargetExposure(address yieldBearingAsset, uint64 targetExposure) external onlyTrustedOrRestricted {\\n yieldBearingData[yieldBearingAsset].targetExposure = targetExposure;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Compute the amount needed to rebalance the Parallelizer\\n * @param yieldBearingAsset address of the yield bearing asset\\n * @return increase whether the exposure should be increased\\n * @return amount amount to be rebalanced\\n */\\n function computeRebalanceAmount(address yieldBearingAsset) external view returns (uint8 increase, uint256 amount) {\\n return _computeRebalanceAmount(yieldBearingAsset, yieldBearingData[yieldBearingAsset]);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _computeRebalanceAmount(\\n address yieldBearingAsset,\\n YieldBearingParams memory yieldBearingInfo\\n )\\n internal\\n view\\n returns (uint8 increase, uint256 amount)\\n {\\n (uint256 stablecoinsFromYieldBearingAsset, uint256 stablecoinsIssued) =\\n parallelizer.getIssuedByCollateral(yieldBearingAsset);\\n (uint256 stablecoinsFromAsset,) = parallelizer.getIssuedByCollateral(yieldBearingInfo.asset);\\n uint256 targetExposureScaled = yieldBearingInfo.targetExposure * stablecoinsIssued;\\n if (stablecoinsFromYieldBearingAsset * 1e9 > targetExposureScaled) {\\n // Need to decrease exposure to yield bearing asset\\n amount = stablecoinsFromYieldBearingAsset - targetExposureScaled / 1e9;\\n uint256 maxValueScaled = yieldBearingInfo.maxExposure * stablecoinsIssued;\\n // These checks assume that there are no transaction fees on the stablecoin->collateral conversion and so\\n // it's still possible that exposure goes above the max exposure in some rare cases\\n if (stablecoinsFromAsset * 1e9 > maxValueScaled) {\\n amount = 0;\\n } else if ((stablecoinsFromAsset + amount) * 1e9 > maxValueScaled) {\\n amount = maxValueScaled / 1e9 - stablecoinsFromAsset;\\n }\\n } else {\\n // In this case, exposure after the operation might remain slightly below the targetExposure as less\\n // collateral may be obtained by burning stablecoins for the yield asset and unwrapping it\\n increase = 1;\\n amount = targetExposureScaled / 1e9 - stablecoinsFromYieldBearingAsset;\\n uint256 minValueScaled = yieldBearingInfo.minExposure * stablecoinsIssued;\\n if (stablecoinsFromAsset * 1e9 < minValueScaled) {\\n amount = 0;\\n } else if (stablecoinsFromAsset * 1e9 < minValueScaled + amount * 1e9) {\\n amount = stablecoinsFromAsset - minValueScaled / 1e9;\\n }\\n }\\n }\\n\\n function _setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address asset,\\n uint64 targetExposure,\\n uint64 minExposure,\\n uint64 maxExposure,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n internal\\n virtual\\n {\\n YieldBearingParams storage yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n yieldBearingInfo.asset = asset;\\n if (targetExposure >= 1e9) revert InvalidParam();\\n if (maxSlippage >= 1e9) revert InvalidParam();\\n yieldBearingInfo.targetExposure = targetExposure;\\n yieldBearingInfo.overrideExposures = overrideExposures;\\n yieldBearingInfo.maxSlippage = maxSlippage;\\n if (overrideExposures == 1) {\\n if (maxExposure >= 1e9 || minExposure >= maxExposure) revert InvalidParam();\\n yieldBearingInfo.maxExposure = maxExposure;\\n yieldBearingInfo.minExposure = minExposure;\\n } else {\\n yieldBearingInfo.overrideExposures = 2;\\n _updateLimitExposuresYieldAsset(asset, yieldBearingInfo);\\n }\\n }\\n\\n function _updateLimitExposuresYieldAsset(\\n address asset,\\n YieldBearingParams storage yieldBearingInfo\\n )\\n internal\\n virtual\\n {\\n uint64[] memory xFeeMint;\\n (xFeeMint,) = parallelizer.getCollateralMintFees(asset);\\n uint256 length = xFeeMint.length;\\n if (length <= 1) yieldBearingInfo.maxExposure = 1e9;\\n else yieldBearingInfo.maxExposure = xFeeMint[length - 2];\\n\\n uint64[] memory xFeeBurn;\\n (xFeeBurn,) = parallelizer.getCollateralBurnFees(asset);\\n length = xFeeBurn.length;\\n if (length <= 1) yieldBearingInfo.minExposure = 0;\\n else yieldBearingInfo.minExposure = xFeeBurn[length - 2];\\n }\\n\\n function _setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) internal virtual {\\n if (newMaxSlippage > 1e9) revert InvalidParam();\\n maxTokenSlippage[yieldBearingAsset] = newMaxSlippage;\\n }\\n\\n function _scaleAmountBasedOnDecimals(\\n uint256 decimalsTokenIn,\\n uint256 decimalsTokenOut,\\n uint256 amountIn,\\n bool assetIn\\n )\\n internal\\n pure\\n returns (uint256)\\n {\\n if (decimalsTokenIn > decimalsTokenOut) {\\n if (assetIn) {\\n amountIn /= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n } else {\\n amountIn *= 10 ** (decimalsTokenIn - decimalsTokenOut);\\n }\\n } else if (decimalsTokenIn < decimalsTokenOut) {\\n if (assetIn) {\\n amountIn *= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n } else {\\n amountIn /= 10 ** (decimalsTokenOut - decimalsTokenIn);\\n }\\n }\\n return amountIn;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HELPER \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n function _adjustAllowance(address token, address sender, uint256 amountIn) internal {\\n uint256 allowance = IERC20(token).allowance(address(this), sender);\\n if (allowance < amountIn) IERC20(token).safeIncreaseAllowance(sender, type(uint256).max - allowance);\\n }\\n}\\n\",\"keccak256\":\"0x82e2ae57997043160d7529488b34591c710cd74e267213b61009daa96e9eeaaf\",\"license\":\"GPL-3.0\"},\"contracts/helpers/GenericHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { SafeCast } from \\\"@openzeppelin/contracts/utils/math/SafeCast.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IERC20Metadata } from \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\nimport { IERC3156FlashBorrower } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol\\\";\\nimport { IERC3156FlashLender } from \\\"@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol\\\";\\nimport { RouterSwapper } from \\\"@helpers/RouterSwapper.sol\\\";\\n\\nimport { IParallelizer } from \\\"contracts/interfaces/IParallelizer.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\nimport { IERC4626 } from \\\"contracts/interfaces/external/IERC4626.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\nimport { BaseHarvester, YieldBearingParams } from \\\"./BaseHarvester.sol\\\";\\n\\nenum SwapType {\\n VAULT,\\n SWAP\\n}\\n\\n/// @title GenericHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Generic contract for anyone to permissionlessly adjust the reserves of Angle Parallelizer\\n/// @dev This contract is an authorized fork of Angle's GenericHarvester contract:\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol\\ncontract GenericHarvester is BaseHarvester, IERC3156FlashBorrower, RouterSwapper {\\n using SafeCast for uint256;\\n using SafeERC20 for IERC20;\\n\\n bytes32 public constant CALLBACK_SUCCESS = keccak256(\\\"ERC3156FlashBorrower.onFlashLoan\\\");\\n\\n /// @notice Parallel stablecoin flashloan contract\\n IERC3156FlashLender public immutable flashloan;\\n /// @notice Budget of tokenP available for each users\\n mapping(address => uint256) public budget;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INITIALIZATION \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n address initialTokenTransferAddress,\\n address initialSwapRouter,\\n ITokenP definitivetokenP,\\n IParallelizer definitiveParallelizer,\\n address initialAuthority,\\n IERC3156FlashLender definitiveFlashloan\\n )\\n RouterSwapper(initialSwapRouter, initialTokenTransferAddress)\\n BaseHarvester(initialAuthority, definitivetokenP, definitiveParallelizer)\\n {\\n if (address(definitiveFlashloan) == address(0)) revert ZeroAddress();\\n flashloan = definitiveFlashloan;\\n\\n IERC20(tokenP).approve(address(definitiveFlashloan), type(uint256).max);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n BUDGET HANDLING\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Add budget to be spent by the receiver during the flashloan\\n * @param amount amount of tokenP to add to the budget\\n * @param receiver address of the receiver\\n */\\n function addBudget(uint256 amount, address receiver) public virtual {\\n budget[receiver] += amount;\\n\\n IERC20(tokenP).safeTransferFrom(msg.sender, address(this), amount);\\n }\\n\\n /**\\n * @notice Remove budget from the owner and send it to the receiver\\n * @param amount amount of tokenP to remove from the budget\\n * @param receiver address of the receiver\\n */\\n function removeBudget(uint256 amount, address receiver) public virtual {\\n budget[msg.sender] -= amount; // Will revert if not enough funds\\n\\n IERC20(tokenP).safeTransfer(receiver, amount);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n HARVEST\\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure\\n /// to this yieldBearingAsset\\n /// @dev This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up\\n /// some yieldBearingAsset that can then be used for people looking to burn deposit tokens\\n /// @dev Due to potential transaction fees within the Parallelizer, this function doesn't exactly bring\\n /// `yieldBearingAsset` to the target exposure\\n /// @dev scale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest,\\n /// it is used to lower the amount of the asset to harvest for example to have a lower slippage\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) public virtual {\\n if (scale > 1e9) revert InvalidParam();\\n updateLimitExposuresYieldAsset(yieldBearingAsset);\\n YieldBearingParams memory yieldBearingInfo = yieldBearingData[yieldBearingAsset];\\n (uint8 increase, uint256 amount) = _computeRebalanceAmount(yieldBearingAsset, yieldBearingInfo);\\n amount = (amount * scale) / 1e9;\\n if (amount == 0) revert ZeroAmount();\\n (SwapType swapType, bytes memory data) = abi.decode(extraData, (SwapType, bytes));\\n try parallelizer.updateOracle(yieldBearingAsset) { } catch { }\\n _adjustYieldExposure(\\n amount,\\n increase,\\n yieldBearingAsset,\\n yieldBearingInfo.asset,\\n (amount * (1e9 - yieldBearingInfo.maxSlippage)) / 1e9,\\n swapType,\\n data\\n );\\n }\\n\\n /// @inheritdoc IERC3156FlashBorrower\\n function onFlashLoan(\\n address initiator,\\n address,\\n uint256 amount,\\n uint256 fee,\\n bytes calldata data\\n )\\n public\\n virtual\\n returns (bytes32)\\n {\\n if (msg.sender != address(flashloan) || initiator != address(this) || fee != 0) revert NotTrusted();\\n address sender;\\n uint256 typeAction;\\n uint256 minAmountOut;\\n SwapType swapType;\\n bytes memory callData;\\n address tokenOut;\\n address tokenIn;\\n {\\n address yieldBearingAsset;\\n address asset;\\n (sender, typeAction, yieldBearingAsset, asset, minAmountOut, swapType, callData) =\\n abi.decode(data, (address, uint256, address, address, uint256, SwapType, bytes));\\n if (typeAction == 1) {\\n // Increase yield exposure action: we bring in the yield bearing asset\\n tokenOut = yieldBearingAsset;\\n tokenIn = asset;\\n } else {\\n // Decrease yield exposure action: we bring in the deposit asset\\n tokenIn = yieldBearingAsset;\\n tokenOut = asset;\\n }\\n }\\n uint256 amountOut =\\n parallelizer.swapExactInput(amount, 0, address(tokenP), tokenIn, address(this), block.timestamp);\\n\\n // Swap to tokenIn\\n amountOut = _swapToTokenOut(typeAction, tokenIn, tokenOut, amountOut, swapType, callData);\\n\\n _adjustAllowance(tokenOut, address(parallelizer), amountOut);\\n uint256 amountStableOut =\\n parallelizer.swapExactInput(amountOut, minAmountOut, tokenOut, address(tokenP), address(this), block.timestamp);\\n if (amount > amountStableOut) {\\n budget[sender] -= amount - amountStableOut; // Will revert if not enough funds\\n }\\n return CALLBACK_SUCCESS;\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n SETTERS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /**\\n * @notice Set the token transfer address\\n * @param newTokenTransferAddress address of the token transfer contract\\n */\\n function setTokenTransferAddress(address newTokenTransferAddress) public override restricted {\\n super.setTokenTransferAddress(newTokenTransferAddress);\\n }\\n\\n /**\\n * @notice Set the swap router\\n * @param newSwapRouter address of the swap router\\n */\\n function setSwapRouter(address newSwapRouter) public override restricted {\\n super.setSwapRouter(newSwapRouter);\\n }\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n INTERNALS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Burns `amountStablecoins` for one yieldBearing asset, swap for asset then mints deposit tokens\\n /// from the proceeds of the swap.\\n /// @dev If `increase` is 1, then the system tries to increase its exposure to the yield bearing asset which means\\n /// burning tokenP for the deposit asset, swapping for the yield bearing asset, then minting the tokenP\\n /// @dev This function reverts if the second tokenP mint gives less than `minAmountOut` of ag tokens\\n /// @dev This function reverts if the swap slippage is higher than `maxSlippage`\\n function _adjustYieldExposure(\\n uint256 amountStablecoins,\\n uint8 increase,\\n address yieldBearingAsset,\\n address asset,\\n uint256 minAmountOut,\\n SwapType swapType,\\n bytes memory extraData\\n )\\n internal\\n {\\n flashloan.flashLoan(\\n IERC3156FlashBorrower(address(this)),\\n address(tokenP),\\n amountStablecoins,\\n abi.encode(msg.sender, increase, yieldBearingAsset, asset, minAmountOut, swapType, extraData)\\n );\\n }\\n\\n function _swapToTokenOut(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n SwapType swapType,\\n bytes memory callData\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (swapType == SwapType.SWAP) {\\n amountOut = _swapToTokenOutSwap(tokenIn, tokenOut, amount, callData);\\n } else if (swapType == SwapType.VAULT) {\\n amountOut = _swapToTokenOutVault(typeAction, tokenIn, tokenOut, amount);\\n }\\n }\\n\\n /**\\n * @notice Swap token using the router/aggregator\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n * @param callData bytes to call the router/aggregator\\n */\\n function _swapToTokenOutSwap(\\n address tokenIn,\\n address tokenOut,\\n uint256 amount,\\n bytes memory callData\\n )\\n internal\\n returns (uint256)\\n {\\n uint256 balance = IERC20(tokenOut).balanceOf(address(this));\\n\\n address[] memory tokens = new address[](1);\\n tokens[0] = tokenIn;\\n bytes[] memory callDatas = new bytes[](1);\\n callDatas[0] = callData;\\n uint256[] memory amounts = new uint256[](1);\\n amounts[0] = amount;\\n _swap(tokens, callDatas, amounts);\\n\\n return IERC20(tokenOut).balanceOf(address(this)) - balance;\\n }\\n\\n /**\\n * @dev Deposit or redeem the vault asset\\n * @param typeAction 1 for deposit, 2 for redeem\\n * @param tokenIn address of the token to swap\\n * @param tokenOut address of the token to receive\\n * @param amount amount of token to swap\\n */\\n function _swapToTokenOutVault(\\n uint256 typeAction,\\n address tokenIn,\\n address tokenOut,\\n uint256 amount\\n )\\n internal\\n returns (uint256 amountOut)\\n {\\n if (typeAction == 1) {\\n // Granting allowance with the yieldBearingAsset for the vault asset\\n _adjustAllowance(tokenIn, tokenOut, amount);\\n amountOut = IERC4626(tokenOut).deposit(amount, address(this));\\n } else {\\n amountOut = IERC4626(tokenIn).redeem(amount, address(this), address(this));\\n }\\n }\\n}\\n\",\"keccak256\":\"0x604c4f9c755b2eb704dc15ba59046201c0258134ef2fbe15a529c510c68cb40a\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDiamondCut.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IDiamondCut\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondCut.sol by mudgen\\n/// @dev This interface is an authorized fork of Angle's `IDiamondCut` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IDiamondCut.sol\\ninterface IDiamondCut {\\n /// @notice Add/replace/remove any number of functions and optionally execute a function with delegatecall\\n /// @param _diamondCut Contains the facet addresses and function selectors\\n /// @param _init The address of the contract or facet to execute _calldata\\n /// @param _calldata A function call, including function selector and arguments, executed with delegatecall on\\n /// _init\\n function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;\\n}\\n\",\"keccak256\":\"0x08a01f77b740f7da424f0ea27a6a292f9e292058e23d1fe960d2d19a44496c7b\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondEtherscan.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\n/// @title IDiamondEtherscan\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface IDiamondEtherscan {\\n /// @notice Sets a dummy implementation with the same layout at the diamond proxy contract with all its facets\\n function setDummyImplementation(address _implementation) external;\\n\\n /// @notice Address of the dummy implementation used to make the DiamondProxy contract interpretable by Etherscan\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf742b55592d129e02fb755d25f7a97ed976a14c4c744d6ac46726809e8f1e037\",\"license\":\"MIT\"},\"contracts/interfaces/IDiamondLoupe.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @notice IDiamondLoupe\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Reference: EIP-2535 Diamonds\\n/// @dev Forked from https://github.com/mudgen/diamond-3/blob/master/contracts/interfaces/IDiamondLoupe.sol by mudgen\\ninterface IDiamondLoupe {\\n /// @notice Gets all facet addresses and their four byte function selectors.\\n /// @return facets_ Facet\\n function facets() external view returns (Facet[] memory facets_);\\n\\n /// @notice Gets all the function selectors supported by a specific facet.\\n /// @param _facet The facet address.\\n /// @return facetFunctionSelectors_\\n function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);\\n\\n /// @notice Get all the facet addresses used by a diamond.\\n /// @return facetAddresses_\\n function facetAddresses() external view returns (address[] memory facetAddresses_);\\n\\n /// @notice Gets the facet that supports the given selector.\\n /// @dev If facet is not found return address(0).\\n /// @param _functionSelector The function selector.\\n /// @return facetAddress_ The facet address.\\n function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_);\\n}\\n\",\"keccak256\":\"0xa5580958acabe2c44967e835e77a748eb0b8812f70cd071191201508c9388ca8\",\"license\":\"MIT\"},\"contracts/interfaces/IGetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title IGetters\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IGetters` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IGetters.sol\\ninterface IGetters {\\n /// @notice Checks whether a given `selector` is actually a valid selector corresponding to a function in one of\\n /// the\\n /// facets of the proxy\\n function isValidSelector(bytes4 selector) external view returns (bool);\\n\\n /// @notice Stablecoin minted by parallelizer\\n function tokenP() external view returns (ITokenP);\\n\\n /// @notice Returns the list of collateral assets supported by the system\\n function getCollateralList() external view returns (address[] memory);\\n\\n /// @notice Returns all the info in storage associated to a `collateral`\\n function getCollateralInfo(address collateral) external view returns (Collateral memory);\\n\\n /// @notice Returns the decimals of a given `collateral`\\n function getCollateralDecimals(address collateral) external view returns (uint8);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to mint\\n /// with `collateral`\\n function getCollateralMintFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays from which fees are computed when coming to burn\\n /// for `collateral`\\n function getCollateralBurnFees(address collateral) external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the `xFee` and `yFee` arrays used to compute the penalty factor depending on the collateral\\n /// ratio when users come to redeem\\n function getRedemptionFees() external view returns (uint64[] memory, int64[] memory);\\n\\n /// @notice Returns the collateral ratio of Parallelizer in base `10**9` and a rounded version of the total amount\\n /// of stablecoins issued\\n function getCollateralRatio() external view returns (uint64 collatRatio, uint256 stablecoinsIssued);\\n\\n /// @notice Returns the total amount of stablecoins issued through Parallelizer\\n function getTotalIssued() external view returns (uint256 stablecoinsIssued);\\n\\n /// @notice Returns the amount of stablecoins issued from `collateral` and the total amount of stablecoins issued\\n /// through Parallelizer\\n function getIssuedByCollateral(address collateral)\\n external\\n view\\n returns (uint256 stablecoinsFromCollateral, uint256 stablecoinsIssued);\\n\\n /// @notice Returns if a collateral is \\\"managed\\\" and the associated manager configuration\\n function getManagerData(address collateral)\\n external\\n view\\n returns (bool isManaged, IERC20[] memory subCollaterals, bytes memory config);\\n\\n /// @notice Returns the oracle values associated to `collateral`\\n /// @return mint Oracle value to be used for a mint transaction with `collateral`\\n /// @return burn Oracle value that will be used for `collateral` for a burn transaction. This value\\n /// is then used along with oracle values for all other collateral assets to get a global burn value for the oracle\\n /// @return ratio Ratio, in base `10**18` between the oracle value of the `collateral` and its target price.\\n /// This value is 10**18 if the oracle is greater than the collateral price\\n /// @return minRatio Minimum ratio across all collateral assets between a collateral burn price and its target\\n /// price. This value is independent of `collateral` and is used to normalize the burn oracle value for burn\\n /// transactions.\\n /// @return redemption Oracle value that would be used to price `collateral` when computing the collateral ratio\\n /// during a redemption\\n function getOracleValues(address collateral)\\n external\\n view\\n returns (uint256 mint, uint256 burn, uint256 ratio, uint256 minRatio, uint256 redemption);\\n\\n /// @notice Returns the data used to compute oracle values for `collateral`\\n /// @return oracleType Type of oracle (Chainlink, external smart contract, ...)\\n /// @return targetType Type passed to read the value of the target price\\n /// @return oracleData Extra data needed to read the oracle. For Chainlink oracles, this data is supposed to give\\n /// the addresses of the Chainlink feeds to read, the stale periods for each feed, ...\\n /// @return targetData Extra data needed to read the target price of the asset\\n function getOracle(address collateral)\\n external\\n view\\n returns (\\n OracleReadType oracleType,\\n OracleReadType targetType,\\n bytes memory oracleData,\\n bytes memory targetData,\\n bytes memory hyperparameters\\n );\\n\\n /// @notice Returns if the associated functionality is paused or not\\n function isPaused(address collateral, ActionType action) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update normalizers\\n function isTrusted(address sender) external view returns (bool);\\n\\n /// @notice Returns if `sender` is trusted to update sell rewards\\n function isTrustedSeller(address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` has a non null entry in the `isWhitelistedForType` storage mapping\\n /// @dev Note that ultimately whitelisting may depend as well on external providers\\n function isWhitelistedForType(WhitelistType whitelistType, address sender) external view returns (bool);\\n\\n /// @notice Checks whether `sender` can deal with `collateral` during burns and redemptions\\n function isWhitelistedForCollateral(address collateral, address sender) external returns (bool);\\n\\n /// @notice Checks whether only whitelisted address can deal with `collateral` during burns and redemptions\\n function isWhitelistedCollateral(address collateral) external view returns (bool);\\n\\n /// @notice Gets the data needed to deal with whitelists for `collateral`\\n function getCollateralWhitelistData(address collateral) external view returns (bytes memory);\\n\\n /// @notice Returns the stablecoin cap for `collateral`\\n function getStablecoinCap(address collateral) external view returns (uint256);\\n\\n /// @notice Returns the address of the `accessManager` contract\\n function accessManager() external view returns (address);\\n\\n /// @dev Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is\\n /// being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs\\n /// attacker controlled calls.\\n function isConsumingScheduledOp() external view returns (bytes4);\\n}\\n\",\"keccak256\":\"0xaa9eba6ee7770d6146fedbfef07ad10ff09524692319ca0cc32abfa64a2b597b\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IHarvester.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IHarvester\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IHarvester` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IHarvester.sol\\ninterface IHarvester {\\n function setYieldBearingAssetData(\\n address yieldBearingAsset,\\n address stablecoin,\\n uint64 targetExposure,\\n uint64 minExposureYieldAsset,\\n uint64 maxExposureYieldAsset,\\n uint64 overrideExposures,\\n uint96 maxSlippage\\n )\\n external;\\n\\n function updateLimitExposuresYieldAsset(address yieldBearingAsset) external;\\n\\n function setMaxSlippage(address yieldBearingAsset, uint96 newMaxSlippage) external;\\n\\n function harvest(address yieldBearingAsset, uint256 scale, bytes calldata extraData) external;\\n}\\n\",\"keccak256\":\"0x0d4e8fee737f4f747060a3c5044c8cb2f153faa228ad37a661a659ca62aab055\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IParallelizer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IDiamondCut } from \\\"./IDiamondCut.sol\\\";\\nimport { IDiamondEtherscan } from \\\"./IDiamondEtherscan.sol\\\";\\nimport { IDiamondLoupe } from \\\"./IDiamondLoupe.sol\\\";\\nimport { IGetters } from \\\"./IGetters.sol\\\";\\nimport { IRedeemer } from \\\"./IRedeemer.sol\\\";\\nimport { IRewardHandler } from \\\"./IRewardHandler.sol\\\";\\nimport { ISettersGovernor, ISettersGuardian } from \\\"./ISetters.sol\\\";\\nimport { ISwapper } from \\\"./ISwapper.sol\\\";\\n\\n/// @title IParallelizer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IParallelizer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IParallelizer.sol\\ninterface IParallelizer is\\n IDiamondCut,\\n IDiamondEtherscan,\\n IDiamondLoupe,\\n IGetters,\\n IRedeemer,\\n IRewardHandler,\\n ISettersGovernor,\\n ISettersGuardian,\\n ISwapper\\n{ }\\n\",\"keccak256\":\"0x8bd964110c6a122bdb6cf58a194a97c894900237ebd7f3b11e2f43c6ee56ae7c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRedeemer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRedeemer\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRedeemer` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRedeemer.sol\\ninterface IRedeemer {\\n /// @notice Redeems `amount` of stablecoins from the system\\n /// @param receiver Address which should be receiving the output tokens\\n /// @param deadline Timestamp before which the redemption should have occured\\n /// @param minAmountOuts Minimum amount of each token given back in the redemption to obtain\\n /// @return tokens List of tokens returned\\n /// @return amounts Amount given for each token in the `tokens` array\\n function redeem(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Same as the redeem function above with the additional feature to specify a list of `forfeitTokens` for\\n /// which the Parallelizer system will not try to do a transfer to `receiver`.\\n function redeemWithForfeit(\\n uint256 amount,\\n address receiver,\\n uint256 deadline,\\n uint256[] memory minAmountOuts,\\n address[] memory forfeitTokens\\n )\\n external\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Simulate the exact output that a redemption of `amount` of stablecoins would give at a given block\\n /// @return tokens List of tokens that would be given\\n /// @return amounts Amount that would be obtained for each token in the `tokens` array\\n function quoteRedemptionCurve(uint256 amount)\\n external\\n view\\n returns (address[] memory tokens, uint256[] memory amounts);\\n\\n /// @notice Updates the normalizer variable by `amount`\\n function updateNormalizer(uint256 amount, bool increase) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xb3522ee0380b321c64d02bf2db2acb658d8b314b811dd54b6a718d6708b5fb21\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IRewardHandler.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title IRewardHandler\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `IRewardHandler` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IRewardHandler.sol\\ninterface IRewardHandler {\\n /// @notice Sells some external tokens through a odos call\\n /// @param minAmountOut Minimum amount of the outToken to get\\n /// @param payload Payload to pass to odos\\n /// @return amountOut Amount obtained of the outToken\\n function sellRewards(uint256 minAmountOut, bytes memory payload) external returns (uint256 amountOut);\\n}\\n\",\"keccak256\":\"0xff2afcbc8d1c25297324159d3684a323e60b3c9408129aba70d3d6938d093255\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISetters.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\nimport \\\"../parallelizer/Storage.sol\\\";\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISettersGovernor` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISetters.sol\\ninterface ISettersGovernor {\\n /// @notice Recovers `amount` of `token` from the Parallelizer contract\\n function recoverERC20(address collateral, IERC20 token, address to, uint256 amount) external;\\n\\n /// @notice Sets a new access manager address\\n function setAccessManager(address _newAccessManager) external;\\n\\n /// @notice Sets (or unsets) a collateral manager `collateral`\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before setting the new manager\\n function setCollateralManager(\\n address collateral,\\n bool checkExternalManagerBalance,\\n ManagerStorage memory managerData\\n )\\n external;\\n\\n /// @notice Sets the allowance of the contract on `token` for `spender` to `amount`\\n function changeAllowance(IERC20 token, address spender, uint256 amount) external;\\n\\n /// @notice Changes the trusted status for `sender` when for selling rewards or updating the normalizer\\n function toggleTrusted(address sender, TrustedType t) external;\\n\\n /// @notice Changes whether a `collateral` can only be handled during burns and redemptions by whitelisted\\n /// addresses\\n /// and sets the data used to read into the whitelist\\n function setWhitelistStatus(address collateral, uint8 whitelistStatus, bytes memory whitelistData) external;\\n\\n /// @notice Add `collateral` as a supported collateral in the system\\n function addCollateral(address collateral) external;\\n\\n /// @notice Adjusts the amount of stablecoins issued from `collateral` by `amount`\\n function adjustStablecoins(address collateral, uint128 amount, bool increase) external;\\n\\n /// @notice Revokes `collateral` from the system\\n /// @dev If `checkExternalManagerBalance` is true, the function will check that the current manager no longer has\\n /// assets before revoking the collateral\\n function revokeCollateral(address collateral, bool checkExternalManagerBalance) external;\\n\\n /// @notice Sets the `oracleConfig` used to read the value of `collateral` for the mint, burn and redemption\\n /// operations\\n function setOracle(address collateral, bytes memory oracleConfig) external;\\n\\n /// @notice Update oracle data for a given `collateral`\\n function updateOracle(address collateral) external;\\n}\\n\\n/// @title ISettersGovernor\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\ninterface ISettersGuardian {\\n /// @notice Changes the pause status for mint or burn transactions for `collateral`\\n function togglePause(address collateral, ActionType action) external;\\n\\n /// @notice Sets the mint or burn fees for `collateral`\\n function setFees(address collateral, uint64[] memory xFee, int64[] memory yFee, bool mint) external;\\n\\n /// @notice Sets the parameters for the redemption curve\\n function setRedemptionCurveParams(uint64[] memory xFee, int64[] memory yFee) external;\\n\\n /// @notice Changes the whitelist status for a collateral with `whitelistType` for an address `who`\\n function toggleWhitelist(WhitelistType whitelistType, address who) external;\\n\\n /// @notice Sets the stablecoin cap that can be issued from a `collateral`\\n function setStablecoinCap(address collateral, uint256 stablecoinCap) external;\\n}\\n\",\"keccak256\":\"0xc3fb2012e7c2f97ae93b12276afc4293aaeb97a6fe4d60109acaa94ef6945575\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\n/// @title ISwapper\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev This interface is an authorized fork of Angle's `ISwapper` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/ISwapper.sol\\ninterface ISwapper {\\n /// @notice Swaps (that is to say mints or burns) an exact amount of `tokenIn` for an amount of `tokenOut`\\n /// @param amountIn Amount of `tokenIn` to bring\\n /// @param amountOutMin Minimum amount of `tokenOut` to get: if `amountOut` is inferior to this amount, the\\n /// function will revert\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountOut Amount of `tokenOut` obtained through the swap\\n function swapExactInput(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Same as `swapExactInput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactInputWithPermit(\\n uint256 amountIn,\\n uint256 amountOutMin,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountOut);\\n\\n /// @notice Swaps (that is to say mints or burns) an amount of `tokenIn` for an exact amount of `tokenOut`\\n /// @param amountOut Amount of `tokenOut` to obtain from the swap\\n /// @param amountInMax Maximum amount of `tokenIn` to bring in order to get `amountOut` of `tokenOut`\\n /// @param tokenIn Token to bring for the swap\\n /// @param tokenOut Token to get out of the swap\\n /// @param to Address to which `tokenOut` must be sent\\n /// @param deadline Timestamp before which the transaction must be executed\\n /// @return amountIn Amount of `tokenIn` used to perform the swap\\n function swapExactOutput(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address tokenOut,\\n address to,\\n uint256 deadline\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Same as `swapExactOutput`, but using Permit2 signatures for `tokenIn`\\n /// @dev Can only be used to mint, hence `tokenOut` is not needed\\n function swapExactOutputWithPermit(\\n uint256 amountOut,\\n uint256 amountInMax,\\n address tokenIn,\\n address to,\\n uint256 deadline,\\n bytes calldata permitData\\n )\\n external\\n returns (uint256 amountIn);\\n\\n /// @notice Simulates what a call to `swapExactInput` with `amountIn` of `tokenIn` for `tokenOut` would give.\\n /// If called right before and at the same block, the `amountOut` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactInput`\\n function quoteIn(uint256 amountIn, address tokenIn, address tokenOut) external view returns (uint256 amountOut);\\n\\n /// @notice Simulates what a call to `swapExactOutput` for `amountOut` of `tokenOut` with `tokenIn` would give.\\n /// If called right before and at the same block, the `amountIn` outputted by this function is exactly the\\n /// amount that will be obtained with `swapExactOutput`\\n function quoteOut(uint256 amountOut, address tokenIn, address tokenOut) external view returns (uint256 amountIn);\\n}\\n\",\"keccak256\":\"0x47e4b2742a51b82b9df72fb681335affe8519f4114fb540cd29d8f48ed182ffd\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITokenP.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title ITokenP\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @notice Interface for the stablecoins `tokenP` contracts\\n/// @dev This interface is an authorized fork of Angle's `IAgToken` interface\\n/// https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/interfaces/IAgToken.sol\\ninterface ITokenP is IERC20 {\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n MINTER ROLE ONLY FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Lets a whitelisted contract mint tokenPs\\n /// @param account Address to mint to\\n /// @param amount Amount to mint\\n function mint(address account, uint256 amount) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address after being asked to by `sender`\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @param sender Address which requested the burn from `burner`\\n /// @dev This method is to be called by a contract with the minter right after being requested\\n /// to do so by a `sender` address willing to burn tokens from another `burner` address\\n /// @dev The method checks the allowance between the `sender` and the `burner`\\n function burnFrom(uint256 amount, address burner, address sender) external;\\n\\n /// @notice Burns `amount` tokens from a `burner` address\\n /// @param amount Amount of tokens to burn\\n /// @param burner Address to burn from\\n /// @dev This method is to be called by a contract with a minter right on the tokenP after being\\n /// requested to do so by an address willing to burn tokens from its address\\n function burnSelf(uint256 amount, address burner) external;\\n\\n /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS \\n //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Amount of decimals of the stablecoin\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x64a1305faa8c5c91767a11af0eae16e4b463aa0bfe10f11b74aae9d96681a5eb\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity >=0.5.0;\\n\\n/// @notice ERC4626 interface\\n/// @author OpenZeppelin\\n/// @dev In this implementation, the interface only contains the functions that the IERC4626 interface adds on top of\\n/// the IERC20 interface\\ninterface IERC4626 {\\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 \\u201cmanaged\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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 \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d 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\\u2019s 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\\u2019s 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 redeemption 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\",\"keccak256\":\"0xd730d6a6b679201eec89dff3133de651da20b3e72e74f01b734078bfacf952ad\",\"license\":\"GPL-3.0\"},\"contracts/parallelizer/Storage.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { ITokenP } from \\\"contracts/interfaces/ITokenP.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n ENUMS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nenum FacetCutAction {\\n Add,\\n Replace,\\n Remove\\n}\\n\\nenum ManagerType {\\n EXTERNAL\\n}\\n\\nenum ActionType {\\n Mint,\\n Burn,\\n Redeem\\n}\\n\\nenum TrustedType {\\n Updater,\\n Seller\\n}\\n\\nenum QuoteType {\\n MintExactInput,\\n MintExactOutput,\\n BurnExactInput,\\n BurnExactOutput\\n}\\n\\nenum OracleReadType {\\n CHAINLINK_FEEDS,\\n EXTERNAL,\\n NO_ORACLE,\\n STABLE,\\n WSTETH,\\n CBETH,\\n RETH,\\n SFRXETH,\\n MAX,\\n MORPHO_ORACLE\\n}\\n\\nenum OracleQuoteType {\\n UNIT,\\n TARGET\\n}\\n\\nenum WhitelistType {\\n BACKED\\n}\\n\\n/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////\\n STRUCTS \\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/\\n\\nstruct Permit2Details {\\n address to; // Address that will receive the funds\\n uint256 nonce; // Nonce of the transaction\\n bytes signature; // Permit signature of the user\\n}\\n\\nstruct FacetCut {\\n address facetAddress; // Facet contract address\\n FacetCutAction action; // Can be add, remove or replace\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct Facet {\\n address facetAddress; // Facet contract address\\n bytes4[] functionSelectors; // Ex. bytes4(keccak256(\\\"transfer(address,uint256)\\\"))\\n}\\n\\nstruct FacetInfo {\\n address facetAddress; // Facet contract address\\n uint16 selectorPosition; // Position in the list of all selectors\\n}\\n\\nstruct DiamondStorage {\\n bytes4[] selectors; // List of all available selectors\\n mapping(bytes4 => FacetInfo) selectorInfo; // Selector to (address, position in list)\\n IAccessManager accessManager; // Contract handling access management\\n}\\n\\nstruct ImplementationStorage {\\n address implementation; // Dummy implementation address for Etherscan usability\\n}\\n\\nstruct ManagerStorage {\\n IERC20[] subCollaterals; // Subtokens handled by the manager or strategies\\n bytes config; // Additional configuration data\\n}\\n\\nstruct Collateral {\\n uint8 isManaged; // If the collateral is managed through external strategies\\n uint8 isMintLive; // If minting from this asset is unpaused\\n uint8 isBurnLive; // If burning to this asset is unpaused\\n uint8 decimals; // IERC20Metadata(collateral).decimals()\\n uint8 onlyWhitelisted; // If only whitelisted addresses can burn or redeem for this token\\n uint216 normalizedStables; // Normalized amount of stablecoins issued from this collateral\\n uint64[] xFeeMint; // Increasing exposures in [0,BASE_9[\\n int64[] yFeeMint; // Mint fees at the exposures specified in `xFeeMint`\\n uint64[] xFeeBurn; // Decreasing exposures in ]0,BASE_9]\\n int64[] yFeeBurn; // Burn fees at the exposures specified in `xFeeBurn`\\n bytes oracleConfig; // Data about the oracle used for the collateral\\n bytes whitelistData; // For whitelisted collateral, data used to verify whitelists\\n ManagerStorage managerData; // For managed collateral, data used to handle the strategies\\n uint256 stablecoinCap; // Cap on the amount of stablecoins that can be issued from this collateral\\n}\\n\\nstruct ParallelizerStorage {\\n ITokenP tokenP; // tokenP handled by the system\\n uint8 isRedemptionLive; // If redemption is unpaused\\n uint8 statusReentrant; // If call is reentrant or not\\n bool consumingSchedule; // If the contract is consuming a scheduled operation\\n uint128 normalizedStables; // Normalized amount of stablecoins issued by the system\\n uint128 normalizer; // To reconcile `normalizedStables` values with the actual amount\\n address[] collateralList; // List of collateral assets supported by the system\\n uint64[] xRedemptionCurve; // Increasing collateral ratios > 0\\n int64[] yRedemptionCurve; // Value of the redemption fees at `xRedemptionCurve`\\n mapping(address => Collateral) collaterals; // Maps a collateral asset to its parameters\\n mapping(address => uint256) isTrusted; // If an address is trusted to update the normalizer value\\n mapping(address => uint256) isSellerTrusted; // If an address is trusted to sell accruing reward tokens or to run\\n // keeper jobs on oracles\\n mapping(WhitelistType => mapping(address => uint256)) isWhitelistedForType;\\n}\\n// Whether an address is whitelisted for a specific whitelist type\\n\",\"keccak256\":\"0x3f4313dd110dbe390038320b2d3cf24dcbe9b75cd9573e7f048f7233c02dd227\",\"license\":\"BUSL-1.1\"},\"contracts/utils/AccessManaged.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nimport { AuthorityUtils } from \\\"@openzeppelin/contracts/access/manager/AuthorityUtils.sol\\\";\\nimport { IAccessManager } from \\\"@openzeppelin/contracts/access/manager/IAccessManager.sol\\\";\\nimport { IAccessManaged } from \\\"@openzeppelin/contracts/access/manager/IAccessManaged.sol\\\";\\nimport { Context } from \\\"@openzeppelin/contracts/utils/Context.sol\\\";\\n\\nimport \\\"../utils/Errors.sol\\\";\\n\\n/// @title AccessControl\\n/// @author Cooper Labs\\n/// @custom:contact security@cooperlabs.xyz\\n/// @dev Fork of OpenZeppelin's `AccessManaged` contract\\n/// updated to make _checkCanCall to return bool\\n/// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/manager/AccessManaged.sol\\ncontract AccessManaged is Context, IAccessManaged {\\n address private _authority;\\n\\n bool private _consumingSchedule;\\n\\n /**\\n * @dev Initializes the contract connected to an initial authority.\\n */\\n constructor(address initialAuthority) {\\n _setAuthority(initialAuthority);\\n }\\n\\n /**\\n * @dev Restricts access to a function as defined by the connected Authority for this contract and the\\n * caller and selector of the function that entered the contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * In general, this modifier should only be used on `external` functions. It is okay to use it on `public`\\n * functions that are used as external entry points and are not called internally. Unless you know what you're\\n * doing, it should never be used on `internal` functions. Failure to follow these rules can have critical security\\n * implications! This is because the permissions are determined by the function that entered the contract, i.e. the\\n * function at the bottom of the call stack, and not the function where the modifier is visible in the source code.\\n * ====\\n *\\n * [WARNING]\\n * ====\\n * Avoid adding this modifier to the\\n * https://docs.soliditylang.org/en/v0.8.20/contracts.html#receive-ether-function[`receive()`]\\n * function or the https://docs.soliditylang.org/en/v0.8.20/contracts.html#fallback-function[`fallback()`]. These\\n * functions are the only execution paths where a function selector cannot be unambiguously determined from the\\n * calldata\\n * since the selector defaults to `0x00000000` in the `receive()` function and similarly in the `fallback()`\\n * function\\n * if no calldata is provided. (See {_checkCanCall}).\\n *\\n * The `receive()` function will always panic whereas the `fallback()` may panic depending on the calldata length.\\n * ====\\n */\\n modifier restricted() {\\n address caller = _msgSender();\\n require(_checkCanCall(caller, _msgData()), AccessManagedUnauthorized(caller));\\n _;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function authority() public view virtual returns (address) {\\n return _authority;\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function setAuthority(address newAuthority) public virtual {\\n address caller = _msgSender();\\n if (caller != authority()) {\\n revert AccessManagedUnauthorized(caller);\\n }\\n if (newAuthority.code.length == 0) {\\n revert AccessManagedInvalidAuthority(newAuthority);\\n }\\n _setAuthority(newAuthority);\\n }\\n\\n /// @inheritdoc IAccessManaged\\n function isConsumingScheduledOp() public view returns (bytes4) {\\n return _consumingSchedule ? this.isConsumingScheduledOp.selector : bytes4(0);\\n }\\n\\n /**\\n * @dev Transfers control to a new authority. Internal function with no access restriction. Allows bypassing the\\n * permissions set by the current authority.\\n */\\n function _setAuthority(address newAuthority) internal virtual {\\n _authority = newAuthority;\\n emit AuthorityUpdated(newAuthority);\\n }\\n\\n function _checkCanCall(address caller, bytes calldata data) internal virtual returns (bool) {\\n (bool immediate, uint32 delay) =\\n AuthorityUtils.canCallWithDelay(authority(), caller, address(this), bytes4(data[0:4]));\\n if (!immediate) {\\n if (delay > 0) {\\n _consumingSchedule = true;\\n IAccessManager(authority()).consumeScheduledOp(caller, data);\\n _consumingSchedule = false;\\n } else {\\n return false;\\n }\\n }\\n return true;\\n }\\n}\\n\",\"keccak256\":\"0x40dfee0e736695b3005df6c150a2d794ac06f3f4b91745e2959623e770044798\",\"license\":\"BUSL-1.1\"},\"contracts/utils/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.28;\\n\\nerror AccessManagedUnauthorized(address caller);\\nerror AlreadyAdded();\\nerror CannotAddFunctionToDiamondThatAlreadyExists(bytes4 _selector);\\nerror CannotAddSelectorsToZeroAddress(bytes4[] _selectors);\\nerror CannotRemoveFunctionThatDoesNotExist(bytes4 _selector);\\nerror CannotRemoveImmutableFunction(bytes4 _selector);\\nerror CannotReplaceFunctionsFromFacetWithZeroAddress(bytes4[] _selectors);\\nerror CannotReplaceFunctionThatDoesNotExists(bytes4 _selector);\\nerror CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet(bytes4 _selector);\\nerror CannotReplaceImmutableFunction(bytes4 _selector);\\nerror ContractHasNoCode();\\nerror CollateralBacked();\\nerror FunctionNotFound(bytes4 _functionSelector);\\nerror IncorrectFacetCutAction(uint8 _action);\\nerror InitializationFunctionReverted(address _initializationContractAddress, bytes _calldata);\\nerror InvalidChainlinkRate();\\nerror InvalidLengths();\\nerror InvalidNegativeFees();\\nerror InvalidOracleType();\\nerror InvalidParam();\\nerror InvalidParams();\\nerror InvalidRate();\\nerror InvalidSwap();\\nerror InvalidTokens();\\nerror InvalidAccessManager();\\nerror ManagerHasAssets();\\nerror NoSelectorsProvidedForFacetForCut(address _facetAddress);\\nerror NotAllowed();\\nerror NotCollateral();\\nerror NotGovernor();\\nerror NotGuardian();\\nerror NotTrusted();\\nerror NotTrustedOrGuardian();\\nerror NotWhitelisted();\\nerror OdosSwapFailed();\\nerror OracleUpdateFailed();\\nerror Paused();\\nerror ReentrantCall();\\nerror RemoveFacetAddressMustBeZeroAddress(address _facetAddress);\\nerror TooBigAmountIn();\\nerror TooLate();\\nerror TooSmallAmountOut();\\nerror ZeroAddress();\\nerror ZeroAmount();\\nerror SwapError();\\nerror SlippageTooHigh();\\nerror InsufficientFunds();\\n\",\"keccak256\":\"0x1e2f6812ef78e948e5155d32213b52afff8c0ba5463d18bee10694efbf886130\",\"license\":\"BUSL-1.1\"}},\"version\":1}", - "bytecode": "0x60e080604052346101e95760c08161278a803803809161001f828561020f565b8339810103126101e95761003281610246565b9061003f60208201610246565b6040820151926001600160a01b038416918285036101e95760608401516001600160a01b03811681036101e95760a061007a60808701610246565b950151956001600160a01b038716958688036101e9575f80546001600160a01b0319166001600160a01b0390921691821790556040519081527f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad90602090a160a052608052600480546001600160a01b039283166001600160a01b0319918216179091556005805493909216921691909117905581156102005760446020925f9460c052604051948593849263095ea7b360e01b84526004840152811960248401525af180156101f5576101b9575b60405161252f908161025b823960805181818161027601528181610ce401528181610e1b01528181611d1901526120ab015260a0518181816103bf0152818161066a01528181610e480152818161155201526115d9015260c05181818161040701528181610d5901526115960152f35b6020813d6020116101ed575b816101d26020938361020f565b810103126101e95751801515036101e9575f610149565b5f80fd5b3d91506101c5565b6040513d5f823e3d90fd5b63d92e233d60e01b5f5260045ffd5b601f909101601f19168101906001600160401b0382119082101761023257604052565b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036101e95756fe60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220ec283012c4b4807e318035ba023be8591bf414e2388206dea6cd585b6cb7364064736f6c634300081c0033", - "deployedBytecode": "0x60806040526004361015610011575f80fd5b5f5f3560e01c80630dd3932d1461164357806313047520146115fd5780631978a5ed146115ba5780631b89b61a14611577578063212c8fb1146114be57806323e30c8b14610d0857806335b37d1a14610cc55780634127365714610c435780635a7cb38f14610c1d578063641bd50314610b6b5780637a9e5e4b14610a9d5780637ee8434914610a0c5780638195001d146109eb5780638237e538146109b15780638fb360371461093e57806396d64879146109015780639ae784861461082c578063b51609b4146107a5578063bf7e214f14610780578063c31c9c071461075a578063c5e6d5ea146106c9578063c9c6667414610691578063d2d0ec1014610628578063da94e205146105af578063e234b903146105005763edf0ef0314610138575f80fd5b346104ac5760603660031901126104ac57610151611899565b60243560443567ffffffffffffffff81116104ac576101749036906004016118c5565b9290633b9aca0083116104d8578161018d600293611a0c565b6001600160a01b03811690815f5283602052633b9aca0061022c61022460405f206bffffffffffffffffffffffff6040519889926101ca8461194b565b67ffffffffffffffff81546001600160a01b038116865260a01c16602085015267ffffffffffffffff60018201548181166040870152818160401c16606087015260801c1660808501520154169460a08201958652611d0c565b979097611a52565b049586156104b0578301926040818503126104ac5780359360028510156104ac57602082013567ffffffffffffffff81116104ac5761026b92016119b9565b936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b156104ac575f80916024604051809481937f1cb44dfc0000000000000000000000000000000000000000000000000000000083528960048401525af1610490575b506001600160a01b036bffffffffffffffffffffffff915116915116633b9aca00036bffffffffffffffffffffffff811161047c5760ff946103fa97946103849460209894633b9aca0061033e6bffffffffffffffffffffffff61037697168a611a52565b0491604051998a97338d8a01521660408801526060870152608086015260a085015260c084015260e0808401526101008301906122e5565b03601f19810184528361197b565b60405193849283927f5cffe9de0000000000000000000000000000000000000000000000000000000084523060048501526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016602485015260448401526080606484015260848301906122e5565b0381856001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1801561047157610437575080f35b6020813d602011610469575b816104506020938361197b565b810103126104655761046190612309565b5080f35b5080fd5b3d9150610443565b6040513d84823e3d90fd5b602488634e487b7160e01b81526011600452fd5b61049d9198505f9061197b565b5f966001600160a01b036102d9565b5f80fd5b7f1f2a2005000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd2529034000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760203660031901126104ac576001600160a01b03610521611899565b6105343361052f3633611a65565b6118f3565b168015610587576020817ffd238617dbf7bc2e2e9c11b00a61a76432989bf0d6ca3a5aa34381a8752db4039273ffffffffffffffffffffffffffffffffffffffff196005541617600555604051908152a1005b7fd92e233d000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104ac5760403660031901126104ac576105c8611899565b602435906bffffffffffffffffffffffff82168092036104ac576105f03361052f3633611a65565b633b9aca0082116104d8576001600160a01b03165f52600160205260405f20906bffffffffffffffffffffffff198254161790555f80f35b346104ac5760403660031901126104ac5761068f6004356106476118af565b335f52600660205260405f2061065e8382546119ff565b90556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001661228e565b005b346104ac5760203660031901126104ac576001600160a01b036106b2611899565b165f526006602052602060405f2054604051908152f35b346104ac5760203660031901126104ac576001600160a01b036106ea611899565b165f52600260205260c060405f2080549067ffffffffffffffff6bffffffffffffffffffffffff60026001840154930154169181604051946001600160a01b038116865260a01c1660208501528181166040850152818160401c16606085015260801c16608083015260a0820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360045416604051908152f35b346104ac575f3660031901126104ac5760206001600160a01b035f5416604051908152f35b346104ac5760603660031901126104ac576107be611899565b6024356044356001600160a01b0381168082036104ac577fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5606061068f9561080a3361052f3633611a65565b6001600160a01b036040519116938482528660208301526040820152a161228e565b346104ac5760403660031901126104ac57610845611899565b60243567ffffffffffffffff811681036104ac57335f52600360205260ff60405f20541615806108f0575b6108c8576001600160a01b0361068f92165f52600260205260405f20907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b7f0dcc030f000000000000000000000000000000000000000000000000000000005f5260045ffd5b506108fb3633611a65565b15610870565b346104ac5760203660031901126104ac576001600160a01b03610922611899565b165f526003602052602060ff60405f2054166040519015158152f35b346104ac575f3660031901126104ac575f5460a01c60ff16156109a95760207f8fb36037000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60205f61097f565b346104ac575f3660031901126104ac5760206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b346104ac5760203660031901126104ac5761068f610a07611899565b611a0c565b346104ac5760203660031901126104ac576001600160a01b03610a2d611899565b610a3b3361052f3633611a65565b16805f5260036020527f7628ea5f6112a16b36a8239aa208395a8e8f221688cfb3a5461faffb9700abcd604060ff815f20541681519084825215156020820152a15f908152600360205260409020805460ff818116151660ff19909116179055005b346104ac5760203660031901126104ac57610ab6611899565b5f54906001600160a01b0382163303610b5957803b15610b245773ffffffffffffffffffffffffffffffffffffffff197f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad926001600160a01b036020931691829116175f55604051908152a1005b6001600160a01b03907fc2f31e5e000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b62d1953b60e31b5f523360045260245ffd5b346104ac5760203660031901126104ac576040610c0e610b89611899565b6001600160a01b0381165f526002602052825f20906bffffffffffffffffffffffff6002855193610bb98561194b565b67ffffffffffffffff81546001600160a01b038116875260a01c16602086015267ffffffffffffffff60018201548181168988015281818a1c16606088015260801c16608086015201541660a0830152611d0c565b60ff8351921682526020820152f35b346104ac575f3660031901126104ac5760206001600160a01b0360055416604051908152f35b346104ac5760203660031901126104ac576001600160a01b03610c64611899565b610c723361052f3633611a65565b168015610587576020817f36db479a3b4d3672bd6f5fca4484283f60b5ac70647b1ceec13ecbb1d030a2df9273ffffffffffffffffffffffffffffffffffffffff196004541617600455604051908152a1005b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760a03660031901126104ac57610d21611899565b610d296118af565b5060443560843567ffffffffffffffff81116104ac57610d4d9036906004016118c5565b90926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163314908115916114aa575b50801561149f575b6114775782019060e0838303126104ac57610da683611937565b92610db360408201611937565b610dbf60608301611937565b60a08301359460028610156104ac5760c08401359067ffffffffffffffff82116104ac57610df96001600160a01b039291839287016119b9565b9216921694600160208501351495865f146114715792915b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169687926001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001694604051926301db50ff60e51b84528960048501525f602485015286604485015260208460c4815f6001600160a01b0387169a8b60648401523060848401524260a48401525af19384156110c6575f9461143d575b505f926001810361129957505050506001600160a01b03851690604051936370a0823160e01b8552306004860152602085602481865afa9485156110c6575f95611265575b50604093845192610f13868561197b565b60018452601f1986019283366020870137610f2d8561206b565b52855191610f3b878461197b565b600183525f5b8481106112545750610f528361206b565b52610f5c8261206b565b50855192610f6a878561197b565b60018452366020850137610f7d8361206b565b528251925f5b84811061111957505050505060206024918351928380926370a0823160e01b82523060048301525afa91821561111057505f916110d1575b5060809660c4936001600160a01b03610fd960209897955f956119ff565b945b610fe6868583611c6b565b6040519a8b9889976301db50ff60e51b895260048901520135602487015216604485015260648401523060848401524260a48401525af19182156110c6575f92611092575b5081811161105e575b60206040517f439148f0bbc682ca079e46d6e2c2f0c1e3b820f1a291b069d8882abf8cf18dd98152f35b6001600160a01b0391611070916119ff565b91165f52600660205261108860405f209182546119ff565b9055808080611034565b9091506020813d6020116110be575b816110ae6020938361197b565b810103126104ac5751908361102b565b3d91506110a1565b6040513d5f823e3d90fd5b905060209493919294813d602011611108575b816110f16020938361197b565b810103126104ac5751929390929091906080610fbb565b3d91506110e4565b513d5f823e3d90fd5b6001600160a01b0361112b828461208c565b51166001600160a01b036005541690611144838761208c565b518951636eb1769f60e11b81523060048201526001600160a01b03841660248201529290602084604481865afa93841561124a575f94611217575b508084106111fb575b505050505f80611198838661208c565b516001600160a01b036004541682602083519301915af16111b7612316565b90156111c65750600101610f83565b805190816111f6577f7c3eb9ca000000000000000000000000000000000000000000000000000000005f5260045ffd5b602001fd5b61120e93611208916119ff565b916123b2565b8e808080611188565b9093506020813d8211611242575b816112326020938361197b565b810103126104ac5751925f61117f565b3d9150611225565b8b513d5f823e3d90fd5b806060602080938701015201610f41565b9094506020813d602011611291575b816112816020938361197b565b810103126104ac5751938b610f02565b3d9150611274565b90919394505f9a979592989a50156112c9575b50505050925f6080969360c4936001600160a01b03602097610fdb565b93965091928692901561139357506112e2918391611c6b565b604051907f6e553f6500000000000000000000000000000000000000000000000000000000825260048201523060248201526020816044815f6001600160a01b0389165af19081156110c6575f91611359575b50925f6080969360c4936001600160a01b036020975b9750829699508195506112ac565b95929390506020863d60201161138b575b816113776020938361197b565b810103126104ac579451919492915f611335565b3d915061136a565b90506020915060645f9360405194859384927fba08765200000000000000000000000000000000000000000000000000000000845260048401523060248401523060448401525af19081156110c6575f91611403575b50925f6080969360c4936001600160a01b0360209761134b565b95929390506020863d602011611435575b816114216020938361197b565b810103126104ac579451919492915f6113e9565b3d9150611414565b9093506020813d602011611469575b816114596020938361197b565b810103126104ac5751928c610ebd565b3d915061144c565b91610e11565b7fc22a648e000000000000000000000000000000000000000000000000000000005f5260045ffd5b506064351515610d8c565b6001600160a01b0316301415905084610d84565b346104ac5760403660031901126104ac5761068f6004356001600160a01b036114e56118af565b165f52600660205260405f206114fc828254611916565b9055604051907f23b872dd00000000000000000000000000000000000000000000000000000000602083015233602483015230604483015260648201526064815261154860848261197b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612345565b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac575f3660031901126104ac5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346104ac5760203660031901126104ac576001600160a01b0361161e611899565b165f52600160205260206bffffffffffffffffffffffff60405f205416604051908152f35b346104ac5760e03660031901126104ac5761165c611899565b6116646118af565b6044359167ffffffffffffffff8316918284036104ac576064359267ffffffffffffffff8416918285036104ac576084359567ffffffffffffffff87168097036104ac5760a4359467ffffffffffffffff8616908187036104ac5760c435906bffffffffffffffffffffffff82168092036104ac576001600160a01b03906116f03361052f3633611a65565b165f526002602052633b9aca0060405f20956001600160a01b03861673ffffffffffffffffffffffffffffffffffffffff1988541617875510156104d857633b9aca008110156104d85761177d60019386907fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff60a01b83549260a01b169116179055565b828501967fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff77ffffffffffffffff0000000000000000000000000000000089549260801b16911617875560028501906bffffffffffffffffffffffff19825416179055145f1461185157505083633b9aca00811091821592611846575b50506104d85761068f9267ffffffffffffffff19825416178155906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b1015905083856117fa565b929150925061068f93507002000000000000000000000000000000007fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff8254161790556120a0565b600435906001600160a01b03821682036104ac57565b602435906001600160a01b03821682036104ac57565b9181601f840112156104ac5782359167ffffffffffffffff83116104ac57602083818601950101116104ac57565b156118fb5750565b6001600160a01b039062d1953b60e31b5f521660045260245ffd5b9190820180921161192357565b634e487b7160e01b5f52601160045260245ffd5b35906001600160a01b03821682036104ac57565b60c0810190811067ffffffffffffffff82111761196757604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff82111761196757604052565b67ffffffffffffffff811161196757601f01601f191660200190565b81601f820112156104ac578035906119d08261199d565b926119de604051948561197b565b828452602083830101116104ac57815f926020809301838601378301015290565b9190820391821161192357565b6001600160a01b03165f52600260205260405f20600267ffffffffffffffff600183015460801c1614611a3c5750565b806001600160a01b03611a509254166120a0565b565b8181029291811591840414171561192357565b905f915f54916001600160a01b03831692816004116104ac575f5f905f80604051966001600160a01b0360208901917fb700961300000000000000000000000000000000000000000000000000000000835216978860248201523060448201527fffffffff00000000000000000000000000000000000000000000000000000000833516606482015260648152611afd60848261197b565b5190895afa611b0a612316565b90611bf2575b5015611b22575b505050505050600190565b63ffffffff1615611be95760ff60a01b191674010000000000000000000000000000000000000000175f55823b156104ac576064925f92836040519586809581947f94c7d7ee0000000000000000000000000000000000000000000000000000000083526004830152604060248301528060448301528084848401378181018301849052601f01601f191681010301925af180156110c657611bd6575b5060ff60a01b1981541690555f8080808080611b17565b611be291505f9061197b565b5f5f611bbf565b50505050505f90565b80519092909160408310611c3457505081604091810103126104ac576040611c1c60208301612309565b91015163ffffffff811681036104ac57905b5f611b10565b916020819492941015611c49575b5050611c2e565b81925090602091810103126104ac576020611c649101612309565b5f80611c42565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152909391169190602084604481865afa9384156110c6575f94611cc2575b508310611cb757505050565b611a509219916123b2565b9093506020813d602011611cee575b81611cde6020938361197b565b810103126104ac5751925f611cab565b3d9150611cd1565b91908260409103126104ac576020825192015190565b915f926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906001600160a01b0360405191634a71aecf60e11b8352166004820152604081602481855afa9081156110c6575f905f92611f28575b5060406001600160a01b038651166024825180968193634a71aecf60e11b835260048301525afa9283156110c6575f93611ef6575b50611dbd8267ffffffffffffffff602088015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e6d576040611dfc611e059493633b9aca0067ffffffffffffffff9404906119ff565b96015116611a52565b633b9aca008202828104633b9aca00148315171561192357811015611e2b57505f925050565b611e358483611916565b633b9aca00810290808204633b9aca001490151715611923578110611e58575050565b611e6a929350633b9aca0090046119ff565b90565b95509067ffffffffffffffff6060611dfc611e9094633b9aca0060019a046119ff565b633b9aca008202828104633b9aca0014831517156119235781811015611eb857505f93505050565b633b9aca008502858104633b9aca00148615171561192357611eda9083611916565b11611ee3575050565b611e6a929350633b9aca009004906119ff565b611f1991935060403d604011611f21575b611f11818361197b565b810190611cf6565b50915f611da4565b503d611f07565b9050611f43915060403d604011611f2157611f11818361197b565b905f611d6f565b67ffffffffffffffff81116119675760051b60200190565b91906040838203126104ac57825167ffffffffffffffff81116104ac57830181601f820112156104ac578051611f9781611f4a565b91611fa5604051938461197b565b81835260208084019260051b820101908482116104ac57602001915b81831061204a575050509260208101519067ffffffffffffffff82116104ac57019080601f830112156104ac57815190611ffa82611f4a565b92612008604051948561197b565b82845260208085019360051b8201019182116104ac57602001915b8183106120305750505090565b82518060070b81036104ac57815260209283019201612023565b825167ffffffffffffffff811681036104ac57815260209283019201611fc1565b8051156120785760200190565b634e487b7160e01b5f52603260045260245ffd5b80518210156120785760209160051b010190565b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916001600160a01b03604051917fb85780bc000000000000000000000000000000000000000000000000000000008352168060048301525f82602481875afa9182156110c6575f92612271575b5081516001811161222b575060018301805467ffffffffffffffff1916633b9aca001790555f91505b6024604051809581937f847da7be00000000000000000000000000000000000000000000000000000000835260048301525afa9182156110c6575f92612206575b50815191600183116121ac575060010180546fffffffffffffffff00000000000000001916905550565b60011983019283116119235767ffffffffffffffff6121d0611a509460019361208c565b51169101906fffffffffffffffff0000000000000000196fffffffffffffffff000000000000000083549260401b169116179055565b6122239192503d805f833e61221b818361197b565b810190611f62565b50905f612182565b60011981019081116119235761224b67ffffffffffffffff915f9461208c565b511667ffffffffffffffff60018501911667ffffffffffffffff19825416179055612141565b6122869192503d805f833e61221b818361197b565b50905f612118565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000060208201526001600160a01b0390921660248301526044820192909252611a50916122e08260648101610376565b612345565b805180835260209291819084018484015e5f828201840152601f01601f1916010190565b519081151582036104ac57565b3d15612340573d906123278261199d565b91612335604051938461197b565b82523d5f602084013e565b606090565b905f602091828151910182855af1156110c6575f513d6123a957506001600160a01b0381163b155b6123745750565b6001600160a01b03907f5274afe7000000000000000000000000000000000000000000000000000000005f521660045260245ffd5b6001141561236d565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152929392821692602082604481875afa80156110c6575f906124c5575b6123fb9250611916565b9160205f60405194612446866124388582019363095ea7b360e01b85528a60248401602090939291936001600160a01b0360408201951681520152565b03601f19810188528761197b565b85519082865af1903d5f5190836124a6575b5050501561246557505050565b6122e0611a50936001600160a01b036040519163095ea7b360e01b60208401521660248201525f6044820152604481526124a060648261197b565b82612345565b919250906124bb57503b15155b5f8080612458565b60019150146124b3565b506020823d6020116124f1575b816124df6020938361197b565b810103126104ac576123fb91516123f1565b3d91506124d256fea2646970667358221220ec283012c4b4807e318035ba023be8591bf414e2388206dea6cd585b6cb7364064736f6c634300081c0033", - "devdoc": { - "author": "Cooper Labs", - "custom:contact": "security@cooperlabs.xyz", - "details": "Generic contract for anyone to permissionlessly adjust the reserves of Angle ParallelizerThis contract is an authorized fork of Angle's GenericHarvester contract: https://github.com/AngleProtocol/angle-transmuter/blob/main/contracts/helpers/GenericHarvester.sol", - "errors": { - "SafeERC20FailedOperation(address)": [ - { - "details": "An operation with an ERC-20 token failed." - } - ] - }, - "events": { - "AuthorityUpdated(address)": { - "details": "Authority that manages this contract was updated." - } - }, - "kind": "dev", - "methods": { - "addBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to add to the budget", - "receiver": "address of the receiver" - } - }, - "authority()": { - "details": "Returns the current authority." - }, - "computeRebalanceAmount(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - }, - "returns": { - "amount": "amount to be rebalanced", - "increase": "whether the exposure should be increased" - } - }, - "harvest(address,uint256,bytes)": { - "details": "This transaction either reduces the exposure to `yieldBearingAsset` in the Parallelizer or frees up some yieldBearingAsset that can then be used for people looking to burn deposit tokensDue to potential transaction fees within the Parallelizer, this function doesn't exactly bring `yieldBearingAsset` to the target exposurescale is a number between 0 and 1e9 that represents the proportion of the tokenP to harvest, it is used to lower the amount of the asset to harvest for example to have a lower slippage" - }, - "isConsumingScheduledOp()": { - "details": "Returns true only in the context of a delayed restricted call, at the moment that the scheduled operation is being consumed. Prevents denial of service for delayed restricted calls in the case that the contract performs attacker controlled calls." - }, - "onFlashLoan(address,address,uint256,uint256,bytes)": { - "details": "Receive a flash loan.", - "params": { - "amount": "The amount of tokens lent.", - "data": "Arbitrary data structure, intended to contain user-defined parameters.", - "fee": "The additional amount of tokens to repay.", - "initiator": "The initiator of the loan.", - "token": "The loan currency." - }, - "returns": { - "_0": "The keccak256 hash of \"ERC3156FlashBorrower.onFlashLoan\"" - } - }, - "recoverERC20(address,uint256,address)": { - "params": { - "amountToRecover": "amount to recover", - "to": "address to send the recovered tokens", - "tokenAddress": "address of the token to recover" - } - }, - "removeBudget(uint256,address)": { - "params": { - "amount": "amount of tokenP to remove from the budget", - "receiver": "address of the receiver" - } - }, - "setAuthority(address)": { - "details": "Transfers control to a new authority. The caller must be the current authority." - }, - "setMaxSlippage(address,uint96)": { - "params": { - "newMaxSlippage": "new max allowed slippage" - } - }, - "setSwapRouter(address)": { - "params": { - "newSwapRouter": "address of the swap router" - } - }, - "setTargetExposure(address,uint64)": { - "params": { - "targetExposure": "target exposure to the yield bearing asset used", - "yieldBearingAsset": "address of the yield bearing asset" - } - }, - "setTokenTransferAddress(address)": { - "params": { - "newTokenTransferAddress": "address of the token transfer contract" - } - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "params": { - "asset": "address of the asset", - "maxExposure": "maximum exposure within the Parallelizer to the asset", - "minExposure": "minimum exposure within the Parallelizer to the asset", - "overrideExposures": "whether limit exposures should be overriden or read onchain through the Parallelizer", - "targetExposure": "target exposure to the yieldBearingAsset asset used", - "yieldBearingAsset": "address of the yieldBearingAsset" - } - }, - "toggleTrusted(address)": { - "params": { - "trusted": "address to toggle the trusted status" - } - }, - "updateLimitExposuresYieldAsset(address)": { - "params": { - "yieldBearingAsset": "address of the yield bearing asset" - } - } - }, - "title": "GenericHarvester", - "version": 1 - }, - "userdoc": { - "events": { - "SwapRouterUpdated(address)": { - "notice": "Event emitted when the swap router is updated" - }, - "TokenTransferAddressUpdated(address)": { - "notice": "Event emitted when the token proxy is updated" - } - }, - "kind": "user", - "methods": { - "addBudget(uint256,address)": { - "notice": "Add budget to be spent by the receiver during the flashloan" - }, - "budget(address)": { - "notice": "Budget of tokenP available for each users" - }, - "computeRebalanceAmount(address)": { - "notice": "Compute the amount needed to rebalance the Parallelizer" - }, - "flashloan()": { - "notice": "Parallel stablecoin flashloan contract" - }, - "harvest(address,uint256,bytes)": { - "notice": "Invests or divests from the yield asset associated to `yieldBearingAsset` based on the current exposure to this yieldBearingAsset" - }, - "isTrusted(address)": { - "notice": "trusted addresses that can update target exposure and do others non critical operations" - }, - "maxTokenSlippage(address)": { - "notice": "Max slippage when dealing with the Parallelizer" - }, - "parallelizer()": { - "notice": "Reference to the `parallelizer` implementation this contract aims at rebalancing" - }, - "recoverERC20(address,uint256,address)": { - "notice": "Recover ERC20 tokens" - }, - "removeBudget(uint256,address)": { - "notice": "Remove budget from the owner and send it to the receiver" - }, - "setMaxSlippage(address,uint96)": { - "notice": "Set the max allowed slippage" - }, - "setSwapRouter(address)": { - "notice": "Set the swap router" - }, - "setTargetExposure(address,uint64)": { - "notice": "Set the target exposure of a yield bearing asset" - }, - "setTokenTransferAddress(address)": { - "notice": "Set the token transfer address" - }, - "setYieldBearingAssetData(address,address,uint64,uint64,uint64,uint64,uint96)": { - "notice": "Set the yieldBearingAsset data" - }, - "swapRouter()": { - "notice": "address of the router/aggregator" - }, - "toggleTrusted(address)": { - "notice": "Toggle the trusted status of an address" - }, - "tokenP()": { - "notice": "TokenP handled by the `parallelizer` of interest" - }, - "tokenTransferAddress()": { - "notice": "address to approve to transfer tokens to" - }, - "updateLimitExposuresYieldAsset(address)": { - "notice": "Set the limit exposures to the asset linked to the yield bearing asset" - }, - "yieldBearingData(address)": { - "notice": "Data associated to a yield bearing asset" - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 22996, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_authority", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 22998, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "_consumingSchedule", - "offset": 20, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 8228, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxTokenSlippage", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_address,t_uint96)" - }, - { - "astId": 8234, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "yieldBearingData", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)" - }, - { - "astId": 8239, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "isTrusted", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_address,t_bool)" - }, - { - "astId": 43, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "swapRouter", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 46, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "tokenTransferAddress", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 8955, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "budget", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_address,t_uint256)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_mapping(t_address,t_bool)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => bool)", - "numberOfBytes": "32", - "value": "t_bool" - }, - "t_mapping(t_address,t_struct(YieldBearingParams)8169_storage)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => struct YieldBearingParams)", - "numberOfBytes": "32", - "value": "t_struct(YieldBearingParams)8169_storage" - }, - "t_mapping(t_address,t_uint256)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint256)", - "numberOfBytes": "32", - "value": "t_uint256" - }, - "t_mapping(t_address,t_uint96)": { - "encoding": "mapping", - "key": "t_address", - "label": "mapping(address => uint96)", - "numberOfBytes": "32", - "value": "t_uint96" - }, - "t_struct(YieldBearingParams)8169_storage": { - "encoding": "inplace", - "label": "struct YieldBearingParams", - "members": [ - { - "astId": 8158, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "asset", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 8160, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "targetExposure", - "offset": 20, - "slot": "0", - "type": "t_uint64" - }, - { - "astId": 8162, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxExposure", - "offset": 0, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8164, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "minExposure", - "offset": 8, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8166, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "overrideExposures", - "offset": 16, - "slot": "1", - "type": "t_uint64" - }, - { - "astId": 8168, - "contract": "contracts/helpers/GenericHarvester.sol:GenericHarvester", - "label": "maxSlippage", - "offset": 0, - "slot": "2", - "type": "t_uint96" - } - ], - "numberOfBytes": "96" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint64": { - "encoding": "inplace", - "label": "uint64", - "numberOfBytes": "8" - }, - "t_uint96": { - "encoding": "inplace", - "label": "uint96", - "numberOfBytes": "12" - } - } - } -} \ No newline at end of file diff --git a/docs/audits/v3.2.1/Bailsec - Parallel Protocol - Core - 1st Report.pdf b/docs/audits/v3.2.1/Bailsec - Parallel Protocol - Core - 1st Report.pdf new file mode 100644 index 0000000..239fd57 Binary files /dev/null and b/docs/audits/v3.2.1/Bailsec - Parallel Protocol - Core - 1st Report.pdf differ diff --git a/generated/abis/BaseHarvester.d.ts b/generated/abis/BaseRebalancer.d.ts similarity index 90% rename from generated/abis/BaseHarvester.d.ts rename to generated/abis/BaseRebalancer.d.ts index b8e44df..e4b84cf 100644 --- a/generated/abis/BaseHarvester.d.ts +++ b/generated/abis/BaseRebalancer.d.ts @@ -1,4 +1,4 @@ -export type Abi_BaseHarvester = [ +export type Abi_BaseRebalancer = [ { "inputs": [ { @@ -58,6 +58,25 @@ export type Abi_BaseHarvester = [ "name": "SafeERC20FailedOperation", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "AllowanceReset", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -207,25 +226,6 @@ export type Abi_BaseHarvester = [ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "parallelizer", @@ -262,6 +262,24 @@ export type Abi_BaseHarvester = [ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "resetAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -283,9 +301,9 @@ export type Abi_BaseHarvester = [ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -344,9 +362,9 @@ export type Abi_BaseHarvester = [ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", @@ -429,13 +447,13 @@ export type Abi_BaseHarvester = [ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "stateMutability": "view", "type": "function" } ]; -export declare const Abi_BaseHarvester: Abi_BaseHarvester; +export declare const Abi_BaseRebalancer: Abi_BaseRebalancer; diff --git a/generated/abis/BaseHarvester.js b/generated/abis/BaseRebalancer.js similarity index 91% rename from generated/abis/BaseHarvester.js rename to generated/abis/BaseRebalancer.js index 19475d9..ae7124b 100644 --- a/generated/abis/BaseHarvester.js +++ b/generated/abis/BaseRebalancer.js @@ -1,4 +1,4 @@ -export const Abi_BaseHarvester = /** @type {const} **/ ([ +export const Abi_BaseRebalancer = /** @type {const} **/ ([ { "inputs": [ { @@ -58,6 +58,25 @@ export const Abi_BaseHarvester = /** @type {const} **/ ([ "name": "SafeERC20FailedOperation", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "AllowanceReset", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -207,25 +226,6 @@ export const Abi_BaseHarvester = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "parallelizer", @@ -262,6 +262,24 @@ export const Abi_BaseHarvester = /** @type {const} **/ ([ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "resetAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -283,9 +301,9 @@ export const Abi_BaseHarvester = /** @type {const} **/ ([ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -344,9 +362,9 @@ export const Abi_BaseHarvester = /** @type {const} **/ ([ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", @@ -429,9 +447,9 @@ export const Abi_BaseHarvester = /** @type {const} **/ ([ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "stateMutability": "view", diff --git a/generated/abis/DiamondInitializer.d.ts b/generated/abis/DiamondInitializer.d.ts index 618141d..b3d3555 100644 --- a/generated/abis/DiamondInitializer.d.ts +++ b/generated/abis/DiamondInitializer.d.ts @@ -112,6 +112,31 @@ export type Abi_DiamondInitializer = [ "name": "OracleSet", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousTarget", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTarget", + "type": "uint256" + } + ], + "name": "OracleTargetUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/generated/abis/DiamondInitializer.js b/generated/abis/DiamondInitializer.js index 421dce0..383de8b 100644 --- a/generated/abis/DiamondInitializer.js +++ b/generated/abis/DiamondInitializer.js @@ -112,6 +112,31 @@ export const Abi_DiamondInitializer = /** @type {const} **/ ([ "name": "OracleSet", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousTarget", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTarget", + "type": "uint256" + } + ], + "name": "OracleTargetUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/generated/abis/GenericHarvester.d.ts b/generated/abis/GenericRebalancer.d.ts similarity index 93% rename from generated/abis/GenericHarvester.d.ts rename to generated/abis/GenericRebalancer.d.ts index d62a89e..2631a39 100644 --- a/generated/abis/GenericHarvester.d.ts +++ b/generated/abis/GenericRebalancer.d.ts @@ -1,4 +1,4 @@ -export type Abi_GenericHarvester = [ +export type Abi_GenericRebalancer = [ { "inputs": [ { @@ -114,6 +114,25 @@ export type Abi_GenericHarvester = [ "name": "ZeroAmount", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "AllowanceReset", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -352,25 +371,6 @@ export type Abi_GenericHarvester = [ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -464,6 +464,24 @@ export type Abi_GenericHarvester = [ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "resetAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -485,9 +503,9 @@ export type Abi_GenericHarvester = [ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -572,9 +590,9 @@ export type Abi_GenericHarvester = [ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", @@ -683,13 +701,13 @@ export type Abi_GenericHarvester = [ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "stateMutability": "view", "type": "function" } ]; -export declare const Abi_GenericHarvester: Abi_GenericHarvester; +export declare const Abi_GenericRebalancer: Abi_GenericRebalancer; diff --git a/generated/abis/GenericHarvester.js b/generated/abis/GenericRebalancer.js similarity index 94% rename from generated/abis/GenericHarvester.js rename to generated/abis/GenericRebalancer.js index 475cb12..618e224 100644 --- a/generated/abis/GenericHarvester.js +++ b/generated/abis/GenericRebalancer.js @@ -1,4 +1,4 @@ -export const Abi_GenericHarvester = /** @type {const} **/ ([ +export const Abi_GenericRebalancer = /** @type {const} **/ ([ { "inputs": [ { @@ -114,6 +114,25 @@ export const Abi_GenericHarvester = /** @type {const} **/ ([ "name": "ZeroAmount", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "AllowanceReset", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -352,25 +371,6 @@ export const Abi_GenericHarvester = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -464,6 +464,24 @@ export const Abi_GenericHarvester = /** @type {const} **/ ([ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "resetAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -485,9 +503,9 @@ export const Abi_GenericHarvester = /** @type {const} **/ ([ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -572,9 +590,9 @@ export const Abi_GenericHarvester = /** @type {const} **/ ([ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", @@ -683,9 +701,9 @@ export const Abi_GenericHarvester = /** @type {const} **/ ([ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "stateMutability": "view", diff --git a/generated/abis/Getters.d.ts b/generated/abis/Getters.d.ts index 5b672f5..3017b70 100644 --- a/generated/abis/Getters.d.ts +++ b/generated/abis/Getters.d.ts @@ -547,6 +547,19 @@ export type Abi_Getters = [ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getSwapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getTotalIssued", diff --git a/generated/abis/Getters.js b/generated/abis/Getters.js index c9ab986..c354e77 100644 --- a/generated/abis/Getters.js +++ b/generated/abis/Getters.js @@ -547,6 +547,19 @@ export const Abi_Getters = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getSwapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getTotalIssued", diff --git a/generated/abis/IGetters.d.ts b/generated/abis/IGetters.d.ts index c80683b..f8d2479 100644 --- a/generated/abis/IGetters.d.ts +++ b/generated/abis/IGetters.d.ts @@ -506,6 +506,19 @@ export type Abi_IGetters = [ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getSwapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getTotalIssued", diff --git a/generated/abis/IGetters.js b/generated/abis/IGetters.js index 3ea36b6..d816162 100644 --- a/generated/abis/IGetters.js +++ b/generated/abis/IGetters.js @@ -506,6 +506,19 @@ export const Abi_IGetters = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getSwapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getTotalIssued", diff --git a/generated/abis/IParallelizer.d.ts b/generated/abis/IParallelizer.d.ts index 83c7203..fc55b22 100644 --- a/generated/abis/IParallelizer.d.ts +++ b/generated/abis/IParallelizer.d.ts @@ -681,6 +681,19 @@ export type Abi_IParallelizer = [ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getSwapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getTotalIssued", @@ -1064,6 +1077,11 @@ export type Abi_IParallelizer = [ "internalType": "uint256[]", "name": "minAmountOuts", "type": "uint256[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeem", @@ -1109,6 +1127,11 @@ export type Abi_IParallelizer = [ "name": "forfeitTokens", "type": "address[]" }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" + }, { "internalType": "bytes", "name": "authData", @@ -1157,6 +1180,11 @@ export type Abi_IParallelizer = [ "internalType": "address[]", "name": "forfeitTokens", "type": "address[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeemWithForfeit", @@ -1378,6 +1406,19 @@ export type Abi_IParallelizer = [ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "setSwapRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/IParallelizer.js b/generated/abis/IParallelizer.js index 167cd07..fc8f2ef 100644 --- a/generated/abis/IParallelizer.js +++ b/generated/abis/IParallelizer.js @@ -681,6 +681,19 @@ export const Abi_IParallelizer = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getSwapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "getTotalIssued", @@ -1064,6 +1077,11 @@ export const Abi_IParallelizer = /** @type {const} **/ ([ "internalType": "uint256[]", "name": "minAmountOuts", "type": "uint256[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeem", @@ -1109,6 +1127,11 @@ export const Abi_IParallelizer = /** @type {const} **/ ([ "name": "forfeitTokens", "type": "address[]" }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" + }, { "internalType": "bytes", "name": "authData", @@ -1157,6 +1180,11 @@ export const Abi_IParallelizer = /** @type {const} **/ ([ "internalType": "address[]", "name": "forfeitTokens", "type": "address[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeemWithForfeit", @@ -1378,6 +1406,19 @@ export const Abi_IParallelizer = /** @type {const} **/ ([ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "setSwapRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/IHarvester.d.ts b/generated/abis/IRebalancer.d.ts similarity index 90% rename from generated/abis/IHarvester.d.ts rename to generated/abis/IRebalancer.d.ts index 971f5f1..f465af5 100644 --- a/generated/abis/IHarvester.d.ts +++ b/generated/abis/IRebalancer.d.ts @@ -1,4 +1,4 @@ -export type Abi_IHarvester = [ +export type Abi_IRebalancer = [ { "inputs": [ { @@ -30,9 +30,9 @@ export type Abi_IHarvester = [ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -73,9 +73,9 @@ export type Abi_IHarvester = [ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", @@ -97,4 +97,4 @@ export type Abi_IHarvester = [ "type": "function" } ]; -export declare const Abi_IHarvester: Abi_IHarvester; +export declare const Abi_IRebalancer: Abi_IRebalancer; diff --git a/generated/abis/IHarvester.js b/generated/abis/IRebalancer.js similarity index 91% rename from generated/abis/IHarvester.js rename to generated/abis/IRebalancer.js index 6c01bbf..3f56760 100644 --- a/generated/abis/IHarvester.js +++ b/generated/abis/IRebalancer.js @@ -1,4 +1,4 @@ -export const Abi_IHarvester = /** @type {const} **/ ([ +export const Abi_IRebalancer = /** @type {const} **/ ([ { "inputs": [ { @@ -30,9 +30,9 @@ export const Abi_IHarvester = /** @type {const} **/ ([ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -73,9 +73,9 @@ export const Abi_IHarvester = /** @type {const} **/ ([ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", diff --git a/generated/abis/IRedeemer.d.ts b/generated/abis/IRedeemer.d.ts index 2880336..cbbde1c 100644 --- a/generated/abis/IRedeemer.d.ts +++ b/generated/abis/IRedeemer.d.ts @@ -44,6 +44,11 @@ export type Abi_IRedeemer = [ "internalType": "uint256[]", "name": "minAmountOuts", "type": "uint256[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeem", @@ -89,6 +94,11 @@ export type Abi_IRedeemer = [ "name": "forfeitTokens", "type": "address[]" }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" + }, { "internalType": "bytes", "name": "authData", @@ -137,6 +147,11 @@ export type Abi_IRedeemer = [ "internalType": "address[]", "name": "forfeitTokens", "type": "address[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeemWithForfeit", diff --git a/generated/abis/IRedeemer.js b/generated/abis/IRedeemer.js index fed69ca..ea35c21 100644 --- a/generated/abis/IRedeemer.js +++ b/generated/abis/IRedeemer.js @@ -44,6 +44,11 @@ export const Abi_IRedeemer = /** @type {const} **/ ([ "internalType": "uint256[]", "name": "minAmountOuts", "type": "uint256[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeem", @@ -89,6 +94,11 @@ export const Abi_IRedeemer = /** @type {const} **/ ([ "name": "forfeitTokens", "type": "address[]" }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" + }, { "internalType": "bytes", "name": "authData", @@ -137,6 +147,11 @@ export const Abi_IRedeemer = /** @type {const} **/ ([ "internalType": "address[]", "name": "forfeitTokens", "type": "address[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeemWithForfeit", diff --git a/generated/abis/ISettersGovernor.d.ts b/generated/abis/ISettersGovernor.d.ts index afe2a07..bb0a501 100644 --- a/generated/abis/ISettersGovernor.d.ts +++ b/generated/abis/ISettersGovernor.d.ts @@ -170,6 +170,19 @@ export type Abi_ISettersGovernor = [ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "setSwapRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/ISettersGovernor.js b/generated/abis/ISettersGovernor.js index 8f7c6b2..fe08435 100644 --- a/generated/abis/ISettersGovernor.js +++ b/generated/abis/ISettersGovernor.js @@ -170,6 +170,19 @@ export const Abi_ISettersGovernor = /** @type {const} **/ ([ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "setSwapRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/Layout.d.ts b/generated/abis/Layout.d.ts index aef94a5..6c98465 100644 --- a/generated/abis/Layout.d.ts +++ b/generated/abis/Layout.d.ts @@ -208,6 +208,19 @@ export type Abi_Layout = [ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "lastReleasedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "nonReentrant", @@ -247,6 +260,25 @@ export type Abi_Layout = [ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "payees", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -290,6 +322,70 @@ export type Abi_Layout = [ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "shares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "slippageTolerance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "surplusBufferRatio", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "swapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "tokenP", @@ -303,6 +399,19 @@ export type Abi_Layout = [ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "totalShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/Layout.js b/generated/abis/Layout.js index 3baba84..143e2fc 100644 --- a/generated/abis/Layout.js +++ b/generated/abis/Layout.js @@ -208,6 +208,19 @@ export const Abi_Layout = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "lastReleasedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "nonReentrant", @@ -247,6 +260,25 @@ export const Abi_Layout = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "payees", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -290,6 +322,70 @@ export const Abi_Layout = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "shares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "slippageTolerance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "surplusBufferRatio", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "swapRouter", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "tokenP", @@ -303,6 +399,19 @@ export const Abi_Layout = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "totalShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/LibOracle.d.ts b/generated/abis/LibOracle.d.ts index 3c75f74..6705c7d 100644 --- a/generated/abis/LibOracle.d.ts +++ b/generated/abis/LibOracle.d.ts @@ -1,2 +1,28 @@ -export type Abi_LibOracle = []; +export type Abi_LibOracle = [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousTarget", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTarget", + "type": "uint256" + } + ], + "name": "OracleTargetUpdated", + "type": "event" + } +]; export declare const Abi_LibOracle: Abi_LibOracle; diff --git a/generated/abis/LibOracle.js b/generated/abis/LibOracle.js index d801996..69e7551 100644 --- a/generated/abis/LibOracle.js +++ b/generated/abis/LibOracle.js @@ -1 +1,27 @@ -export const Abi_LibOracle = /** @type {const} **/ ([]); \ No newline at end of file +export const Abi_LibOracle = /** @type {const} **/ ([ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousTarget", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTarget", + "type": "uint256" + } + ], + "name": "OracleTargetUpdated", + "type": "event" + } +]); \ No newline at end of file diff --git a/generated/abis/LibSetters.d.ts b/generated/abis/LibSetters.d.ts index 96f2fd7..74c1586 100644 --- a/generated/abis/LibSetters.d.ts +++ b/generated/abis/LibSetters.d.ts @@ -289,6 +289,19 @@ export type Abi_LibSetters = [ "name": "SurplusBufferRatioUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "SwapRouterUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/generated/abis/LibSetters.js b/generated/abis/LibSetters.js index 28025fe..e3e8446 100644 --- a/generated/abis/LibSetters.js +++ b/generated/abis/LibSetters.js @@ -289,6 +289,19 @@ export const Abi_LibSetters = /** @type {const} **/ ([ "name": "SurplusBufferRatioUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "SwapRouterUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ diff --git a/generated/abis/MultiBlockHarvester.d.ts b/generated/abis/MultiBlockRebalancer.d.ts similarity index 92% rename from generated/abis/MultiBlockHarvester.d.ts rename to generated/abis/MultiBlockRebalancer.d.ts index 1320704..0eb6141 100644 --- a/generated/abis/MultiBlockHarvester.d.ts +++ b/generated/abis/MultiBlockRebalancer.d.ts @@ -1,4 +1,4 @@ -export type Abi_MultiBlockHarvester = [ +export type Abi_MultiBlockRebalancer = [ { "inputs": [ { @@ -94,6 +94,25 @@ export type Abi_MultiBlockHarvester = [ "name": "ZeroAmount", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "AllowanceReset", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -261,25 +280,6 @@ export type Abi_MultiBlockHarvester = [ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "parallelizer", @@ -316,6 +316,24 @@ export type Abi_MultiBlockHarvester = [ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "resetAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -337,9 +355,9 @@ export type Abi_MultiBlockHarvester = [ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -398,9 +416,9 @@ export type Abi_MultiBlockHarvester = [ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", @@ -501,9 +519,9 @@ export type Abi_MultiBlockHarvester = [ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "stateMutability": "view", @@ -529,4 +547,4 @@ export type Abi_MultiBlockHarvester = [ "type": "function" } ]; -export declare const Abi_MultiBlockHarvester: Abi_MultiBlockHarvester; +export declare const Abi_MultiBlockRebalancer: Abi_MultiBlockRebalancer; diff --git a/generated/abis/MultiBlockHarvester.js b/generated/abis/MultiBlockRebalancer.js similarity index 92% rename from generated/abis/MultiBlockHarvester.js rename to generated/abis/MultiBlockRebalancer.js index cd433b6..b999476 100644 --- a/generated/abis/MultiBlockHarvester.js +++ b/generated/abis/MultiBlockRebalancer.js @@ -1,4 +1,4 @@ -export const Abi_MultiBlockHarvester = /** @type {const} **/ ([ +export const Abi_MultiBlockRebalancer = /** @type {const} **/ ([ { "inputs": [ { @@ -94,6 +94,25 @@ export const Abi_MultiBlockHarvester = /** @type {const} **/ ([ "name": "ZeroAmount", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "AllowanceReset", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -261,25 +280,6 @@ export const Abi_MultiBlockHarvester = /** @type {const} **/ ([ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "maxTokenSlippage", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "parallelizer", @@ -316,6 +316,24 @@ export const Abi_MultiBlockHarvester = /** @type {const} **/ ([ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "resetAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -337,9 +355,9 @@ export const Abi_MultiBlockHarvester = /** @type {const} **/ ([ "type": "address" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "newMaxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setMaxSlippage", @@ -398,9 +416,9 @@ export const Abi_MultiBlockHarvester = /** @type {const} **/ ([ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "name": "setYieldBearingAssetData", @@ -501,9 +519,9 @@ export const Abi_MultiBlockHarvester = /** @type {const} **/ ([ "type": "uint64" }, { - "internalType": "uint96", + "internalType": "uint64", "name": "maxSlippage", - "type": "uint96" + "type": "uint64" } ], "stateMutability": "view", diff --git a/generated/abis/Redeemer.d.ts b/generated/abis/Redeemer.d.ts index d421a03..d818654 100644 --- a/generated/abis/Redeemer.d.ts +++ b/generated/abis/Redeemer.d.ts @@ -76,6 +76,11 @@ export type Abi_Redeemer = [ "name": "TooSmallAmountOut", "type": "error" }, + { + "inputs": [], + "name": "UnexpectedRedemptionTokens", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -177,6 +182,11 @@ export type Abi_Redeemer = [ "internalType": "uint256[]", "name": "minAmountOuts", "type": "uint256[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeem", @@ -222,6 +232,11 @@ export type Abi_Redeemer = [ "name": "forfeitTokens", "type": "address[]" }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" + }, { "internalType": "bytes", "name": "authData", @@ -270,6 +285,11 @@ export type Abi_Redeemer = [ "internalType": "address[]", "name": "forfeitTokens", "type": "address[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeemWithForfeit", diff --git a/generated/abis/Redeemer.js b/generated/abis/Redeemer.js index cc04aa6..13ddb7e 100644 --- a/generated/abis/Redeemer.js +++ b/generated/abis/Redeemer.js @@ -76,6 +76,11 @@ export const Abi_Redeemer = /** @type {const} **/ ([ "name": "TooSmallAmountOut", "type": "error" }, + { + "inputs": [], + "name": "UnexpectedRedemptionTokens", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -177,6 +182,11 @@ export const Abi_Redeemer = /** @type {const} **/ ([ "internalType": "uint256[]", "name": "minAmountOuts", "type": "uint256[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeem", @@ -222,6 +232,11 @@ export const Abi_Redeemer = /** @type {const} **/ ([ "name": "forfeitTokens", "type": "address[]" }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" + }, { "internalType": "bytes", "name": "authData", @@ -270,6 +285,11 @@ export const Abi_Redeemer = /** @type {const} **/ ([ "internalType": "address[]", "name": "forfeitTokens", "type": "address[]" + }, + { + "internalType": "bytes32", + "name": "expectedTokensHash", + "type": "bytes32" } ], "name": "redeemWithForfeit", diff --git a/generated/abis/RewardHandler.d.ts b/generated/abis/RewardHandler.d.ts index 8aa4d3a..14b0fdc 100644 --- a/generated/abis/RewardHandler.d.ts +++ b/generated/abis/RewardHandler.d.ts @@ -16,12 +16,12 @@ export type Abi_RewardHandler = [ }, { "inputs": [], - "name": "OdosSwapFailed", + "name": "ReentrantCall", "type": "error" }, { "inputs": [], - "name": "ReentrantCall", + "name": "RewardSwapFailed", "type": "error" }, { @@ -40,6 +40,11 @@ export type Abi_RewardHandler = [ "name": "TooSmallAmountOut", "type": "error" }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "anonymous": false, "inputs": [ diff --git a/generated/abis/RewardHandler.js b/generated/abis/RewardHandler.js index b5a1e24..2ddf666 100644 --- a/generated/abis/RewardHandler.js +++ b/generated/abis/RewardHandler.js @@ -16,12 +16,12 @@ export const Abi_RewardHandler = /** @type {const} **/ ([ }, { "inputs": [], - "name": "OdosSwapFailed", + "name": "ReentrantCall", "type": "error" }, { "inputs": [], - "name": "ReentrantCall", + "name": "RewardSwapFailed", "type": "error" }, { @@ -40,6 +40,11 @@ export const Abi_RewardHandler = /** @type {const} **/ ([ "name": "TooSmallAmountOut", "type": "error" }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "anonymous": false, "inputs": [ diff --git a/generated/abis/SettersGovernor.d.ts b/generated/abis/SettersGovernor.d.ts index 86591a0..2f0ba6e 100644 --- a/generated/abis/SettersGovernor.d.ts +++ b/generated/abis/SettersGovernor.d.ts @@ -133,6 +133,11 @@ export type Abi_SettersGovernor = [ "name": "SafeERC20FailedOperation", "type": "error" }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "inputs": [], "name": "ZeroAmount", @@ -283,6 +288,31 @@ export type Abi_SettersGovernor = [ "name": "OracleSet", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousTarget", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTarget", + "type": "uint256" + } + ], + "name": "OracleTargetUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -403,6 +433,19 @@ export type Abi_SettersGovernor = [ "name": "SurplusBufferRatioUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "SwapRouterUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -599,6 +642,19 @@ export type Abi_SettersGovernor = [ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "setSwapRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/SettersGovernor.js b/generated/abis/SettersGovernor.js index b75adf4..50359af 100644 --- a/generated/abis/SettersGovernor.js +++ b/generated/abis/SettersGovernor.js @@ -133,6 +133,11 @@ export const Abi_SettersGovernor = /** @type {const} **/ ([ "name": "SafeERC20FailedOperation", "type": "error" }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, { "inputs": [], "name": "ZeroAmount", @@ -283,6 +288,31 @@ export const Abi_SettersGovernor = /** @type {const} **/ ([ "name": "OracleSet", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "collateral", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousTarget", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTarget", + "type": "uint256" + } + ], + "name": "OracleTargetUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -403,6 +433,19 @@ export const Abi_SettersGovernor = /** @type {const} **/ ([ "name": "SurplusBufferRatioUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "SwapRouterUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -599,6 +642,19 @@ export const Abi_SettersGovernor = /** @type {const} **/ ([ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "swapRouter", + "type": "address" + } + ], + "name": "setSwapRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { diff --git a/generated/abis/index.d.ts b/generated/abis/index.d.ts index 77a69c7..9586460 100644 --- a/generated/abis/index.d.ts +++ b/generated/abis/index.d.ts @@ -1,15 +1,15 @@ -export {Abi_BaseHarvester as BaseHarvester} from "./BaseHarvester.js" -export {Abi_GenericHarvester as GenericHarvester} from "./GenericHarvester.js" -export {Abi_MultiBlockHarvester as MultiBlockHarvester} from "./MultiBlockHarvester.js" +export {Abi_BaseRebalancer as BaseRebalancer} from "./BaseRebalancer.js" +export {Abi_GenericRebalancer as GenericRebalancer} from "./GenericRebalancer.js" +export {Abi_MultiBlockRebalancer as MultiBlockRebalancer} from "./MultiBlockRebalancer.js" export {Abi_IDiamondCut as IDiamondCut} from "./IDiamondCut.js" export {Abi_IDiamondEtherscan as IDiamondEtherscan} from "./IDiamondEtherscan.js" export {Abi_IDiamondLoupe as IDiamondLoupe} from "./IDiamondLoupe.js" export {Abi_IGetters as IGetters} from "./IGetters.js" -export {Abi_IHarvester as IHarvester} from "./IHarvester.js" export {Abi_IManager as IManager} from "./IManager.js" export {Abi_IParallelizer as IParallelizer} from "./IParallelizer.js" export {Abi_IParallelizerOracle as IParallelizerOracle} from "./IParallelizerOracle.js" export {Abi_IPool as IPool} from "./IPool.js" +export {Abi_IRebalancer as IRebalancer} from "./IRebalancer.js" export {Abi_IRedeemer as IRedeemer} from "./IRedeemer.js" export {Abi_IRewardHandler as IRewardHandler} from "./IRewardHandler.js" export {Abi_ISavings as ISavings} from "./ISavings.js" @@ -58,6 +58,7 @@ export {Abi_BaseSavings as BaseSavings} from "./BaseSavings.js" export {Abi_EIP3009 as EIP3009} from "./EIP3009.js" export {Abi_Savings as Savings} from "./Savings.js" export {Abi_SavingsEIP3009 as SavingsEIP3009} from "./SavingsEIP3009.js" +export {Abi_SavingsSunset as SavingsSunset} from "./SavingsSunset.js" export {Abi_SavingsNameable as SavingsNameable} from "./SavingsNameable.js" export {Abi_AccessManaged as AccessManaged} from "./AccessManaged.js" export {Abi_AccessManagedUpgradeable as AccessManagedUpgradeable} from "./AccessManagedUpgradeable.js" diff --git a/generated/abis/index.js b/generated/abis/index.js index 77a69c7..9586460 100644 --- a/generated/abis/index.js +++ b/generated/abis/index.js @@ -1,15 +1,15 @@ -export {Abi_BaseHarvester as BaseHarvester} from "./BaseHarvester.js" -export {Abi_GenericHarvester as GenericHarvester} from "./GenericHarvester.js" -export {Abi_MultiBlockHarvester as MultiBlockHarvester} from "./MultiBlockHarvester.js" +export {Abi_BaseRebalancer as BaseRebalancer} from "./BaseRebalancer.js" +export {Abi_GenericRebalancer as GenericRebalancer} from "./GenericRebalancer.js" +export {Abi_MultiBlockRebalancer as MultiBlockRebalancer} from "./MultiBlockRebalancer.js" export {Abi_IDiamondCut as IDiamondCut} from "./IDiamondCut.js" export {Abi_IDiamondEtherscan as IDiamondEtherscan} from "./IDiamondEtherscan.js" export {Abi_IDiamondLoupe as IDiamondLoupe} from "./IDiamondLoupe.js" export {Abi_IGetters as IGetters} from "./IGetters.js" -export {Abi_IHarvester as IHarvester} from "./IHarvester.js" export {Abi_IManager as IManager} from "./IManager.js" export {Abi_IParallelizer as IParallelizer} from "./IParallelizer.js" export {Abi_IParallelizerOracle as IParallelizerOracle} from "./IParallelizerOracle.js" export {Abi_IPool as IPool} from "./IPool.js" +export {Abi_IRebalancer as IRebalancer} from "./IRebalancer.js" export {Abi_IRedeemer as IRedeemer} from "./IRedeemer.js" export {Abi_IRewardHandler as IRewardHandler} from "./IRewardHandler.js" export {Abi_ISavings as ISavings} from "./ISavings.js" @@ -58,6 +58,7 @@ export {Abi_BaseSavings as BaseSavings} from "./BaseSavings.js" export {Abi_EIP3009 as EIP3009} from "./EIP3009.js" export {Abi_Savings as Savings} from "./Savings.js" export {Abi_SavingsEIP3009 as SavingsEIP3009} from "./SavingsEIP3009.js" +export {Abi_SavingsSunset as SavingsSunset} from "./SavingsSunset.js" export {Abi_SavingsNameable as SavingsNameable} from "./SavingsNameable.js" export {Abi_AccessManaged as AccessManaged} from "./AccessManaged.js" export {Abi_AccessManagedUpgradeable as AccessManagedUpgradeable} from "./AccessManagedUpgradeable.js" diff --git a/libs/helpers/CommonUtils.sol b/libs/helpers/CommonUtils.sol index dd45412..35cac93 100644 --- a/libs/helpers/CommonUtils.sol +++ b/libs/helpers/CommonUtils.sol @@ -209,10 +209,10 @@ contract CommonUtils is CommonBase, JsonReader { return "USD.Treasury"; } else if (name == ContractType.FlashLoan) { return "FlashLoan"; - } else if (name == ContractType.MultiBlockHarvester) { - return "USD.MultiBlockHarvester"; - } else if (name == ContractType.GenericHarvester) { - return "USD.GenericHarvester"; + } else if (name == ContractType.MultiBlockRebalancer) { + return "USD.MultiBlockRebalancer"; + } else if (name == ContractType.GenericRebalancer) { + return "USD.GenericRebalancer"; } else if (name == ContractType.Harvester) { return "USD.Harvester"; } else if (name == ContractType.Rebalancer) { diff --git a/libs/helpers/Constants.sol b/libs/helpers/Constants.sol index 4f7ee3b..0902649 100644 --- a/libs/helpers/Constants.sol +++ b/libs/helpers/Constants.sol @@ -23,8 +23,8 @@ enum ContractType { TreasuryEURp, TreasuryUSDp, FlashLoan, - MultiBlockHarvester, - GenericHarvester, + MultiBlockRebalancer, + GenericRebalancer, Harvester, Rebalancer, MulticallWithFailure, diff --git a/libs/helpers/registry/registry.json b/libs/helpers/registry/registry.json index ba3563c..c99988a 100644 --- a/libs/helpers/registry/registry.json +++ b/libs/helpers/registry/registry.json @@ -14,8 +14,8 @@ "Transmuter": "0x000000000000000000000000000000000000000d", "Treasury": "0x000000000000000000000000000000000000000f", "Harvester": "0x0000000000000000000000000000000000000013", - "GenericHarvester": "0x0000000000000000000000000000000000000012", - "MultiBlockHarvester": "0x0000000000000000000000000000000000000011", + "GenericRebalancer": "0x0000000000000000000000000000000000000012", + "MultiBlockRebalancer": "0x0000000000000000000000000000000000000011", "Rebalancer": "0x0000000000000000000000000000000000000014" }, "PRL": "0x0000000000000000000000000000000000000005", diff --git a/scripts/SetGenericHarvesterRoles.s.sol b/scripts/SetGenericHarvesterRoles.s.sol deleted file mode 100644 index 4a37568..0000000 --- a/scripts/SetGenericHarvesterRoles.s.sol +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.28; - -import "./Base.s.sol"; - -import { GenericHarvester } from "contracts/helpers/GenericHarvester.sol"; -import { BaseHarvester } from "contracts/helpers/BaseHarvester.sol"; - -contract SetGenericHarvesterRoles is BaseScript { - address genericHarvester = 0x57770C1721Eb35509f38210A935c8b1911db7E0e; - - function run() public broadcast { - bytes4[] memory guardianSelectors = new bytes4[](5); - guardianSelectors[0] = BaseHarvester.setYieldBearingAssetData.selector; - guardianSelectors[1] = BaseHarvester.setMaxSlippage.selector; - guardianSelectors[2] = BaseHarvester.toggleTrusted.selector; - guardianSelectors[3] = BaseHarvester.recoverERC20.selector; - guardianSelectors[4] = BaseHarvester.setTargetExposure.selector; - accessManager.setTargetFunctionRole(genericHarvester, guardianSelectors, Roles.GUARDIAN_ROLE); - - bytes4[] memory governorSelectors = new bytes4[](2); - governorSelectors[0] = GenericHarvester.setTokenTransferAddress.selector; - governorSelectors[1] = GenericHarvester.setSwapRouter.selector; - accessManager.setTargetFunctionRole(genericHarvester, governorSelectors, Roles.GOVERNOR_ROLE); - } -} diff --git a/scripts/SetGenericRebalancerRoles.s.sol b/scripts/SetGenericRebalancerRoles.s.sol new file mode 100644 index 0000000..086c6ef --- /dev/null +++ b/scripts/SetGenericRebalancerRoles.s.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; + +import "./Base.s.sol"; + +import { GenericRebalancer } from "contracts/helpers/GenericRebalancer.sol"; +import { BaseRebalancer } from "contracts/helpers/BaseRebalancer.sol"; + +contract SetGenericRebalancerRoles is BaseScript { + address genericRebalancer = 0x57770C1721Eb35509f38210A935c8b1911db7E0e; + + function run() public broadcast { + bytes4[] memory guardianSelectors = new bytes4[](6); + guardianSelectors[0] = BaseRebalancer.setYieldBearingAssetData.selector; + guardianSelectors[1] = BaseRebalancer.setMaxSlippage.selector; + guardianSelectors[2] = BaseRebalancer.toggleTrusted.selector; + guardianSelectors[3] = BaseRebalancer.recoverERC20.selector; + guardianSelectors[4] = BaseRebalancer.setTargetExposure.selector; + guardianSelectors[5] = BaseRebalancer.resetAllowance.selector; + accessManager.setTargetFunctionRole(genericRebalancer, guardianSelectors, Roles.GUARDIAN_ROLE); + + bytes4[] memory governorSelectors = new bytes4[](2); + governorSelectors[0] = GenericRebalancer.setTokenTransferAddress.selector; + governorSelectors[1] = GenericRebalancer.setSwapRouter.selector; + accessManager.setTargetFunctionRole(genericRebalancer, governorSelectors, Roles.GOVERNOR_ROLE); + } +} diff --git a/scripts/SetParallelizerRoles.s.sol b/scripts/SetParallelizerRoles.s.sol index 8762e67..ea01ede 100644 --- a/scripts/SetParallelizerRoles.s.sol +++ b/scripts/SetParallelizerRoles.s.sol @@ -21,7 +21,7 @@ contract SetParallelizerRoles is BaseScript { guardianSelectors[6] = IDiamondEtherscan.setDummyImplementation.selector; accessManager.setTargetFunctionRole(parallelizer, guardianSelectors, Roles.GUARDIAN_ROLE); - bytes4[] memory governorSelectors = new bytes4[](14); + bytes4[] memory governorSelectors = new bytes4[](15); governorSelectors[0] = ISettersGovernor.recoverERC20.selector; governorSelectors[1] = ISettersGovernor.setAccessManager.selector; governorSelectors[2] = ISettersGovernor.setCollateralManager.selector; @@ -36,6 +36,7 @@ contract SetParallelizerRoles is BaseScript { governorSelectors[11] = ISettersGovernor.updatePayees.selector; governorSelectors[12] = ISettersGovernor.updateSlippageTolerance.selector; governorSelectors[13] = ISettersGovernor.updateSurplusBufferRatio.selector; + governorSelectors[14] = ISettersGovernor.setSwapRouter.selector; accessManager.setTargetFunctionRole(parallelizer, governorSelectors, Roles.GOVERNOR_ROLE); bytes4[] memory keeperSelectors = new bytes4[](2); diff --git a/scripts/SetRedemptionCurve.s.sol b/scripts/SetRedemptionCurve.s.sol new file mode 100644 index 0000000..8d7de72 --- /dev/null +++ b/scripts/SetRedemptionCurve.s.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; + +import "./Base.s.sol"; + +import { ISettersGuardian } from "contracts/interfaces/ISetters.sol"; + +/// @notice Replaces the redemption curve with a ramp gentle enough that a donation cannot pay for +/// the coefficient it buys. Bailsec Core Issue_10. +/// +/// The previous curve returned to 99.5% over two ratio points, a slope of 2.25. An attacker pays in +/// ratio points and is repaid in payout points on their own redemption, while recovering the share +/// `f` they still hold a claim on, so the attack pays whenever the slope exceeds +/// (1 - f) / (f * H/S): about 1.05 against half the supply, about 0.12 against ninety percent. +/// +/// The same 4.5 point deterrent now spans a 60% to 100% ratio band, a slope of 0.112, which stays +/// under the threshold even for a holder of ninety percent of the supply. Ramping monotonically also +/// drops the old shape's oddity of paying its best rate at the deepest undercollateralization. +/// +/// Run once per chain, against that chain's Parallelizer. +contract SetRedemptionCurve is BaseScript { + address internal constant PARALLELIZER = 0x6efeDDF9269c3683Ba516cb0e2124FE335F262a2; + + function run() public broadcast { + uint64[] memory xFee = new uint64[](3); + xFee[0] = 0; + xFee[1] = 600_000_000; // 60% collateral ratio + xFee[2] = 1_000_000_000; // 100% collateral ratio + + int64[] memory yFee = new int64[](3); + yFee[0] = 950_000_000; // 95% payout, the deterrent floor + yFee[1] = 950_000_000; + yFee[2] = 995_000_000; // 99.5%, also the fee every healthy redemption pays + + ISettersGuardian(PARALLELIZER).setRedemptionCurveParams(xFee, yFee); + } +} diff --git a/scripts/SetupGenericHarvesterExposure.s.sol b/scripts/SetupGenericRebalancerExposure.s.sol similarity index 61% rename from scripts/SetupGenericHarvesterExposure.s.sol rename to scripts/SetupGenericRebalancerExposure.s.sol index 72c9c7a..6b3ccc4 100644 --- a/scripts/SetupGenericHarvesterExposure.s.sol +++ b/scripts/SetupGenericRebalancerExposure.s.sol @@ -3,15 +3,15 @@ pragma solidity 0.8.28; import "./Base.s.sol"; -import { GenericHarvester } from "contracts/helpers/GenericHarvester.sol"; -import { BaseHarvester } from "contracts/helpers/BaseHarvester.sol"; +import { GenericRebalancer } from "contracts/helpers/GenericRebalancer.sol"; +import { BaseRebalancer } from "contracts/helpers/BaseRebalancer.sol"; -contract SetupGenericHarvesterExposure is BaseScript { - BaseHarvester genericHarvester = BaseHarvester(0x57770C1721Eb35509f38210A935c8b1911db7E0e); +contract SetupGenericRebalancerExposure is BaseScript { + BaseRebalancer genericRebalancer = BaseRebalancer(0x57770C1721Eb35509f38210A935c8b1911db7E0e); function run() public broadcast { accessManager.grantRole(Roles.GUARDIAN_ROLE, broadcaster, 0); - genericHarvester.setYieldBearingAssetData( + genericRebalancer.setYieldBearingAssetData( // yieldBearingAsset address(0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2), // asset diff --git a/scripts/generated/DummyDiamondImplementation.sol b/scripts/generated/DummyDiamondImplementation.sol index c439866..dc142cb 100644 --- a/scripts/generated/DummyDiamondImplementation.sol +++ b/scripts/generated/DummyDiamondImplementation.sol @@ -229,7 +229,8 @@ contract DummyDiamondImplementation { uint256 amount, address receiver, uint256 deadline, - uint256[] memory minAmountOuts + uint256[] memory minAmountOuts, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts) @@ -240,7 +241,8 @@ contract DummyDiamondImplementation { address receiver, uint256 deadline, uint256[] memory minAmountOuts, - address[] memory forfeitTokens + address[] memory forfeitTokens, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts) diff --git a/scripts/generated/DummyDiamondImplementationSidechain.sol b/scripts/generated/DummyDiamondImplementationSidechain.sol index 6bcb412..6019c8c 100644 --- a/scripts/generated/DummyDiamondImplementationSidechain.sol +++ b/scripts/generated/DummyDiamondImplementationSidechain.sol @@ -234,7 +234,8 @@ contract DummyDiamondImplementation { uint256 amount, address receiver, uint256 deadline, - uint256[] memory minAmountOuts + uint256[] memory minAmountOuts, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts) @@ -245,7 +246,8 @@ contract DummyDiamondImplementation { address receiver, uint256 deadline, uint256[] memory minAmountOuts, - address[] memory forfeitTokens + address[] memory forfeitTokens, + bytes32 expectedTokensHash ) external returns (address[] memory tokens, uint256[] memory amounts) diff --git a/tests/Fixture.sol b/tests/Fixture.sol index 36b3032..0cd48e7 100644 --- a/tests/Fixture.sol +++ b/tests/Fixture.sol @@ -132,7 +132,7 @@ contract Fixture is Parallelizer, SavingsUtils, ConfigAccessManager { } /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ASSERTIONS + ASSERTIONS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ // Allow to have larger deviation for very small amounts @@ -155,7 +155,7 @@ contract Fixture is Parallelizer, SavingsUtils, ConfigAccessManager { } /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ACTIONS + ACTIONS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ function _mintExactOutput(address owner, address tokenIn, uint256 amountStable, uint256 estimatedAmountIn) internal { @@ -229,7 +229,7 @@ contract Fixture is Parallelizer, SavingsUtils, ConfigAccessManager { bytes32 internal constant PARALLELIZER_REDEEM_TYPEHASH = keccak256( "RedeemWithAuthorization(address from,uint256 amount,address receiver,uint256 deadline," - "bytes32 minAmountOutsHash,bytes32 forfeitTokensHash,bytes32 userSalt)" + "bytes32 minAmountOutsHash,bytes32 forfeitTokensHash,bytes32 expectedTokensHash,bytes32 userSalt)" ); function _buildSwapExactInputAuth( @@ -249,15 +249,7 @@ contract Fixture is Parallelizer, SavingsUtils, ConfigAccessManager { { bytes32 derivedNonce = keccak256( abi.encode( - PARALLELIZER_SWAP_EXACT_INPUT_TYPEHASH, - from, - tokenIn, - tokenOut, - amountIn, - amountOutMin, - to, - deadline, - userSalt + PARALLELIZER_SWAP_EXACT_INPUT_TYPEHASH, from, tokenIn, tokenOut, amountIn, amountOutMin, to, deadline, userSalt ) ); return _signAndPackAuth(privateKey, tokenIn, from, amountIn, derivedNonce, userSalt); @@ -302,6 +294,7 @@ contract Fixture is Parallelizer, SavingsUtils, ConfigAccessManager { uint256 deadline, uint256[] memory minAmountOuts, address[] memory forfeitTokens, + bytes32 expectedTokensHash, bytes32 userSalt ) internal @@ -317,12 +310,20 @@ contract Fixture is Parallelizer, SavingsUtils, ConfigAccessManager { deadline, keccak256(abi.encodePacked(minAmountOuts)), keccak256(abi.encodePacked(forfeitTokens)), + expectedTokensHash, userSalt ) ); return _signAndPackAuth(privateKey, address(tokenP), from, amount, derivedNonce, userSalt); } + /// @dev The output list a redemption of `amount` would produce right now, hashed as the redeem + /// entry points expect it + function _redemptionTokensHash(uint256 amount) internal view returns (bytes32) { + (address[] memory tokens,) = parallelizer.quoteRedemptionCurve(amount); + return keccak256(abi.encodePacked(tokens)); + } + /// @dev Signs an EIP-3009 `ReceiveWithAuthorization` with `nonce = signedNonce` and packs an /// `AuthorizationParams` whose on-the-wire `nonce` field carries `userSalt`, matching what the /// Parallelizer facets expect. @@ -340,9 +341,7 @@ contract Fixture is Parallelizer, SavingsUtils, ConfigAccessManager { { uint256 validBefore = block.timestamp + 1 hours; bytes32 structHash = keccak256( - abi.encode( - RECEIVE_WITH_AUTHORIZATION_TYPEHASH, from, address(parallelizer), value, 0, validBefore, signedNonce - ) + abi.encode(RECEIVE_WITH_AUTHORIZATION_TYPEHASH, from, address(parallelizer), value, 0, validBefore, signedNonce) ); bytes32 digest = MessageHashUtils.toTypedDataHash(MockTokenPermit(token).DOMAIN_SEPARATOR(), structHash); (uint8 v, bytes32 r, bytes32 s) = vm.sign(privateKey, digest); diff --git a/tests/fuzz/Oracle.t.sol b/tests/fuzz/Oracle.t.sol index d2c929e..790b157 100644 --- a/tests/fuzz/Oracle.t.sol +++ b/tests/fuzz/Oracle.t.sol @@ -717,6 +717,53 @@ contract OracleTest is Fixture, FunctionUtils { parallelizer.updateOracle(collateral); } + function test_revertWhen_updateOracle_AboveRatchetStep() public { + vm.prank(governor); + parallelizer.toggleTrusted(alice, Storage.TrustedType.Seller); + + address collateral = _collaterals[0]; + (Storage.OracleReadType readType,, bytes memory data,,) = parallelizer.getOracle(collateral); + (uint256 oracleValue,,,,) = parallelizer.getOracleValues(collateral); + + vm.prank(governor); + bytes memory hyperparameters = abi.encode(uint128(0), uint128(0)); + parallelizer.setOracle( + collateral, + abi.encode(readType, Storage.OracleReadType.MAX, data, abi.encode(oracleValue), hyperparameters) + ); + + (, int256 currentValue,,,) = _oracles[0].latestRoundData(); + // One wei above the largest increase a single ratchet may apply + uint256 aboveCap = (uint256(currentValue) * (BASE_18 + MAX_ORACLE_RATCHET_STEP)) / BASE_18 + 1; + MockChainlinkOracle(address(_oracles[0])).setLatestAnswer(int256(aboveCap)); + + vm.prank(alice); + vm.expectRevert(Errors.OracleUpdateFailed.selector); + parallelizer.updateOracle(collateral); + } + + function test_updateOracle_CannotLiftATargetLeftAtZero() public { + vm.prank(governor); + parallelizer.toggleTrusted(alice, Storage.TrustedType.Seller); + + address collateral = _collaterals[0]; + (Storage.OracleReadType readType,, bytes memory data,,) = parallelizer.getOracle(collateral); + + // A MAX target seeded with 0, which is what the deployment script encoded before the initializer seeded spot + vm.prank(governor); + parallelizer.setOracle( + collateral, + abi.encode( + readType, Storage.OracleReadType.MAX, data, abi.encode(uint256(0)), abi.encode(uint128(0), uint128(0)) + ) + ); + + // Every positive spot is above 0 by more than the ratchet step, so the target can never be raised + vm.prank(alice); + vm.expectRevert(Errors.OracleUpdateFailed.selector); + parallelizer.updateOracle(collateral); + } + function testFuzz_updateOracle_Success(uint256 updateOracleValue, uint32 heartbeat) public { vm.prank(governor); parallelizer.toggleTrusted(alice, Storage.TrustedType.Seller); @@ -743,8 +790,14 @@ contract OracleTest is Fixture, FunctionUtils { uint256 newOracleValue; { (, int256 oracleValueTmp,,,) = _oracles[indexCollat].latestRoundData(); - updateOracleValue = bound(updateOracleValue, uint256(oracleValueTmp) + 1, _maxOracleValue); - if (updateOracleValue > _maxOracleValue) return; + uint256 currentValue = uint256(oracleValueTmp); + // A single ratchet cannot lift the target by more than `MAX_ORACLE_RATCHET_STEP` + uint256 upperBound = (currentValue * (BASE_18 + MAX_ORACLE_RATCHET_STEP)) / BASE_18; + if (upperBound > _maxOracleValue) upperBound = _maxOracleValue; + uint256 lowerBound = currentValue + 1; + if (lowerBound < _minOracleValue * 10) lowerBound = _minOracleValue * 10; + if (lowerBound > upperBound) return; + updateOracleValue = bound(updateOracleValue, lowerBound, upperBound); uint256[3] memory latestOracleValue = [updateOracleValue, BASE_8, BASE_8]; latestOracleValue = _updateOracleValues(latestOracleValue); diff --git a/tests/fuzz/Redeem.t.sol b/tests/fuzz/Redeem.t.sol index 60ca6c2..eccc559 100644 --- a/tests/fuzz/Redeem.t.sol +++ b/tests/fuzz/Redeem.t.sol @@ -34,6 +34,9 @@ struct AssertQuoteParams { } contract RedeemTest is Fixture, FunctionUtils { + /// @dev Kept in storage rather than a local: these fuzz tests already sit on the EVM stack limit + bytes32 internal tokensHash; + using Math for uint256; using SafeERC20 for IERC20; @@ -269,15 +272,19 @@ contract RedeemTest is Fixture, FunctionUtils { // --> redemption should be exactly in proportion of current balances vm.startPrank(alice); uint256 amountBurnt = tokenP.balanceOf(alice); + uint256[] memory quoteAmounts; + { + address[] memory quoteTokens; + if (mintedStables == 0) vm.expectRevert(stdError.divisionError); + else if (mintedStables == amountBurnt) vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); + (quoteTokens, quoteAmounts) = parallelizer.quoteRedemptionCurve(amountBurnt); + tokensHash = keccak256(abi.encodePacked(quoteTokens)); + } if (mintedStables == 0) vm.expectRevert(stdError.divisionError); else if (mintedStables == amountBurnt) vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - (, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(amountBurnt); - if (mintedStables == 0) vm.expectRevert(stdError.divisionError); - else if (mintedStables == amountBurnt) vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - // uint256[] memory forfeitTokens = new uint256[](0); uint256[] memory minAmountOuts = new uint256[](_collaterals.length); (address[] memory tokens, uint256[] memory amounts) = - parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, tokensHash); vm.stopPrank(); if (mintedStables == 0 || mintedStables == amountBurnt) return; @@ -328,7 +335,12 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 amountBurnt = tokenP.balanceOf(alice); if (mintedStables == 0) vm.expectRevert(stdError.divisionError); else if (mintedStables == amountBurnt) vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - (, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(amountBurnt); + uint256[] memory quoteAmounts; + { + address[] memory quoteTokens; + (quoteTokens, quoteAmounts) = parallelizer.quoteRedemptionCurve(amountBurnt); + tokensHash = keccak256(abi.encodePacked(quoteTokens)); + } if (mintedStables == 0) vm.expectRevert(stdError.divisionError); else if (mintedStables == amountBurnt) vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); address[] memory tokens; @@ -336,7 +348,7 @@ contract RedeemTest is Fixture, FunctionUtils { { // uint256[] memory forfeitTokens = new uint256[](0); uint256[] memory minAmountOuts = new uint256[](_collaterals.length); - (tokens, amounts) = parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + (tokens, amounts) = parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, tokensHash); } vm.stopPrank(); @@ -398,7 +410,9 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory amounts; { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); - (tokens, amounts) = parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + (tokens, amounts) = parallelizer.redeem( + amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, _redemptionTokensHash(amountBurnt) + ); } vm.stopPrank(); @@ -440,7 +454,9 @@ contract RedeemTest is Fixture, FunctionUtils { { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); - (tokens, amounts) = parallelizer.redeem(amountBurntBob, bob, block.timestamp + 1 days, minAmountOuts); + (tokens, amounts) = parallelizer.redeem( + amountBurntBob, bob, block.timestamp + 1 days, minAmountOuts, _redemptionTokensHash(amountBurntBob) + ); } vm.stopPrank(); @@ -494,7 +510,7 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, bytes32(0)); } function testFuzz_RevertWhen_BurningAllStableIssuedWithWhitelist( @@ -513,10 +529,12 @@ contract RedeemTest is Fixture, FunctionUtils { } // Enable whitelist on the first collateral and whitelist alice - bytes memory emptyData; - bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); - hoax(governor); - parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + { + bytes memory emptyData; + bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); + hoax(governor); + parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + } hoax(guardian); parallelizer.toggleWhitelist(WhitelistType.BACKED, alice); @@ -527,7 +545,7 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, bytes32(0)); } function testFuzz_RedeemWithForfeit_RevertWhen_BurningAllStableIssued( @@ -564,7 +582,9 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - parallelizer.redeemWithForfeit(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens); + parallelizer.redeemWithForfeit( + amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens, bytes32(0) + ); } function testFuzz_RedeemWithForfeit_RevertWhen_BurningAllStableIssuedWithWhitelist( @@ -595,10 +615,12 @@ contract RedeemTest is Fixture, FunctionUtils { } // Enable whitelist on the first collateral and whitelist alice - bytes memory emptyData; - bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); - hoax(governor); - parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + { + bytes memory emptyData; + bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); + hoax(governor); + parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + } hoax(guardian); parallelizer.toggleWhitelist(WhitelistType.BACKED, alice); @@ -609,7 +631,9 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - parallelizer.redeemWithForfeit(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens); + parallelizer.redeemWithForfeit( + amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens, bytes32(0) + ); } /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -745,7 +769,9 @@ contract RedeemTest is Fixture, FunctionUtils { address[] memory tokens; { uint256[] memory minAmountOuts = new uint256[](quoteAmounts.length); - (tokens, amounts) = parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + (tokens, amounts) = parallelizer.redeem( + amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, _redemptionTokensHash(amountBurnt) + ); } vm.stopPrank(); @@ -780,7 +806,9 @@ contract RedeemTest is Fixture, FunctionUtils { if (mintedStables == 0 || amountBurntBob >= mintedStables) return; { uint256[] memory minAmountOuts = new uint256[](quoteAmounts.length); - (tokens, amounts) = parallelizer.redeem(amountBurntBob, bob, block.timestamp + 1 days, minAmountOuts); + (tokens, amounts) = parallelizer.redeem( + amountBurntBob, bob, block.timestamp + 1 days, minAmountOuts, _redemptionTokensHash(amountBurntBob) + ); } vm.stopPrank(); @@ -871,7 +899,7 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, bytes32(0)); } function testFuzz_RevertWhen_BurningAllStableIssuedWithManagerAndWhitelist( @@ -920,10 +948,12 @@ contract RedeemTest is Fixture, FunctionUtils { _randomRedeemptionFees(xFeeRedeemUnbounded, yFeeRedeemUnbounded); // Enable whitelist on the first collateral and whitelist alice - bytes memory emptyData; - bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); - hoax(governor); - parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + { + bytes memory emptyData; + bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); + hoax(governor); + parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + } hoax(guardian); parallelizer.toggleWhitelist(WhitelistType.BACKED, alice); @@ -934,7 +964,7 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, bytes32(0)); } /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -955,6 +985,7 @@ contract RedeemTest is Fixture, FunctionUtils { vm.startPrank(alice); uint256 amountBurnt = tokenP.balanceOf(alice); if (amountBurnt == mintedStables) return; + tokensHash = _redemptionTokensHash(amountBurnt); { uint256[] memory minAmountOuts; { @@ -962,7 +993,7 @@ contract RedeemTest is Fixture, FunctionUtils { minAmountOuts = new uint256[](quoteAmounts.length - 1); } vm.expectRevert(Errors.InvalidLengths.selector); - parallelizer.redeem(amountBurnt, alice, block.timestamp * 2, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp * 2, minAmountOuts, tokensHash); } { uint256[] memory minAmountOuts; @@ -971,7 +1002,7 @@ contract RedeemTest is Fixture, FunctionUtils { minAmountOuts = new uint256[](quoteAmounts.length + 1); } vm.expectRevert(Errors.InvalidLengths.selector); - parallelizer.redeem(amountBurnt, alice, block.timestamp * 2, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp * 2, minAmountOuts, tokensHash); } vm.stopPrank(); } @@ -1031,8 +1062,14 @@ contract RedeemTest is Fixture, FunctionUtils { address[] memory forfeitTokens = _getForfeitTokens(areForfeit); { uint256[] memory minAmountOuts = new uint256[](quoteAmounts.length); - (tokens, amounts) = - parallelizer.redeemWithForfeit(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens); + (tokens, amounts) = parallelizer.redeemWithForfeit( + amountBurnt, + alice, + block.timestamp + 1 days, + minAmountOuts, + forfeitTokens, + _redemptionTokensHash(amountBurnt) + ); } vm.stopPrank(); @@ -1066,7 +1103,9 @@ contract RedeemTest is Fixture, FunctionUtils { if (mintedStables == 0 || amountBurntBob >= mintedStables) return; { uint256[] memory minAmountOuts = new uint256[](quoteAmounts.length); - (tokens, amounts) = parallelizer.redeem(amountBurntBob, bob, block.timestamp + 1 days, minAmountOuts); + (tokens, amounts) = parallelizer.redeem( + amountBurntBob, bob, block.timestamp + 1 days, minAmountOuts, _redemptionTokensHash(amountBurntBob) + ); } vm.stopPrank(); @@ -1149,7 +1188,9 @@ contract RedeemTest is Fixture, FunctionUtils { uint256[] memory minAmountOuts = new uint256[](_collaterals.length); vm.expectRevert(Errors.CannotBurnAllStableIssued.selector); - parallelizer.redeemWithForfeit(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens); + parallelizer.redeemWithForfeit( + amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens, bytes32(0) + ); } /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1163,10 +1204,12 @@ contract RedeemTest is Fixture, FunctionUtils { _sweepBalances(alice, _collaterals); - bytes memory emptyData; - bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); - hoax(governor); - parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + { + bytes memory emptyData; + bytes memory whitelistData = abi.encode(WhitelistType.BACKED, emptyData); + hoax(governor); + parallelizer.setWhitelistStatus(address(eurA), 1, whitelistData); + } vm.startPrank(alice); uint256 amountBurnt = tokenP.balanceOf(alice); @@ -1174,10 +1217,11 @@ contract RedeemTest is Fixture, FunctionUtils { (, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(amountBurnt); // There should be a non zero amount of EURA to transfer if (quoteAmounts[0] == 0) return; + tokensHash = _redemptionTokensHash(amountBurnt); vm.expectRevert(Errors.NotWhitelisted.selector); uint256[] memory minAmountOuts = new uint256[](_collaterals.length); - parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, tokensHash); vm.stopPrank(); hoax(guardian); @@ -1185,10 +1229,10 @@ contract RedeemTest is Fixture, FunctionUtils { vm.startPrank(alice); vm.expectRevert(Errors.NotWhitelisted.selector); - parallelizer.redeem(amountBurnt, bob, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, bob, block.timestamp + 1 days, minAmountOuts, tokensHash); (address[] memory tokens, uint256[] memory amounts) = - parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts); + parallelizer.redeem(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, tokensHash); vm.stopPrank(); assertEq(amounts, quoteAmounts); @@ -1228,30 +1272,38 @@ contract RedeemTest is Fixture, FunctionUtils { if (mintedStables == 0 || amountBurnt == 0 || amountBurnt == mintedStables) return; (, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(amountBurnt); if (quoteAmounts[0] == 0 || quoteAmounts[1] == 0) return; + tokensHash = _redemptionTokensHash(amountBurnt); uint256[] memory minAmountOuts = new uint256[](_collaterals.length); { vm.startPrank(alice); address[] memory forfeitTokens = new address[](0); vm.expectRevert(Errors.NotWhitelisted.selector); - parallelizer.redeemWithForfeit(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens); + parallelizer.redeemWithForfeit( + amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens, tokensHash + ); address[] memory forfeitTokens1 = new address[](1); forfeitTokens1[0] = address(eurA); vm.expectRevert(Errors.NotWhitelisted.selector); - parallelizer.redeemWithForfeit(amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens); + parallelizer.redeemWithForfeit( + amountBurnt, alice, block.timestamp + 1 days, minAmountOuts, forfeitTokens, tokensHash + ); vm.stopPrank(); hoax(guardian); parallelizer.toggleWhitelist(WhitelistType.BACKED, alice); vm.startPrank(alice); vm.expectRevert(Errors.NotWhitelisted.selector); - parallelizer.redeemWithForfeit(amountBurnt, bob, block.timestamp + 1 days, minAmountOuts, forfeitTokens); + parallelizer.redeemWithForfeit( + amountBurnt, bob, block.timestamp + 1 days, minAmountOuts, forfeitTokens, tokensHash + ); } address[] memory forfeitTokens2 = new address[](2); forfeitTokens2[0] = address(eurA); forfeitTokens2[1] = address(eurB); - (address[] memory tokens, uint256[] memory amounts) = - parallelizer.redeemWithForfeit(amountBurnt, bob, block.timestamp + 1 days, minAmountOuts, forfeitTokens2); + (address[] memory tokens, uint256[] memory amounts) = parallelizer.redeemWithForfeit( + amountBurnt, bob, block.timestamp + 1 days, minAmountOuts, forfeitTokens2, tokensHash + ); vm.stopPrank(); assertEq(amounts, quoteAmounts); @@ -1811,8 +1863,9 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 stablecoinsIssued = parallelizer.getTotalIssued(); if (stablecoinsIssued > 1) { uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(stablecoinsIssued - 1); vm.expectRevert(); - parallelizer.redeem(stablecoinsIssued - 1, attacker, block.timestamp * 2, minOuts); + parallelizer.redeem(stablecoinsIssued - 1, attacker, block.timestamp * 2, minOuts, tokensHash); } vm.stopPrank(); @@ -1825,7 +1878,9 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 mintB, uint256 mintY, uint256 redeemRatio - ) public { + ) + public + { mintA = bound(mintA, 1e6, 1_000_000e6); mintB = bound(mintB, 1e12, 1_000_000e12); mintY = bound(mintY, 1e18, 1_000_000e18); @@ -1843,8 +1898,9 @@ contract RedeemTest is Fixture, FunctionUtils { if (redeemAmount >= stablecoinsIssued) redeemAmount = stablecoinsIssued - 1; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); vm.startPrank(alice); - parallelizer.redeem(redeemAmount, alice, block.timestamp * 2, minOuts); + parallelizer.redeem(redeemAmount, alice, block.timestamp * 2, minOuts, tokensHash); vm.stopPrank(); assertGt( @@ -1890,24 +1946,27 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 tokenPBal = tokenP.balanceOf(alice); uint256 redeemAmount = tokenPBal / 4; - vm.startPrank(guardian); - uint64[] memory xRedemption = new uint64[](1); - xRedemption[0] = uint64(0); - int64[] memory yRedemption = new int64[](1); - yRedemption[0] = int64(int256(BASE_9)); - parallelizer.setRedemptionCurveParams(xRedemption, yRedemption); - vm.stopPrank(); + { + vm.startPrank(guardian); + uint64[] memory xRedemption = new uint64[](1); + xRedemption[0] = uint64(0); + int64[] memory yRedemption = new int64[](1); + yRedemption[0] = int64(int256(BASE_9)); + parallelizer.setRedemptionCurveParams(xRedemption, yRedemption); + vm.stopPrank(); + } uint256 deadline = block.timestamp + 1 hours; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); address[] memory forfeit = new address[](0); bytes memory authData = - _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, bytes32("redeem1")); + _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, bytes32("redeem1")); // bob relays alice's signed authorization vm.prank(bob); (address[] memory tokens, uint256[] memory amounts) = - parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, authData); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, authData); assertEq(tokens.length, 3); for (uint256 i; i < amounts.length; i++) { @@ -1925,46 +1984,62 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 redeemAmount = tokenP.balanceOf(alice) / 4; - vm.startPrank(guardian); - uint64[] memory xR = new uint64[](1); - xR[0] = uint64(0); - int64[] memory yR = new int64[](1); - yR[0] = int64(int256(BASE_9)); - parallelizer.setRedemptionCurveParams(xR, yR); - vm.stopPrank(); + { + vm.startPrank(guardian); + uint64[] memory xR = new uint64[](1); + xR[0] = uint64(0); + int64[] memory yR = new int64[](1); + yR[0] = int64(int256(BASE_9)); + parallelizer.setRedemptionCurveParams(xR, yR); + vm.stopPrank(); + } uint256 deadline = block.timestamp + 1 hours; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); address[] memory forfeit = new address[](0); - bytes memory aliceAuth = - _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, bytes32("redeem_frontrun")); + bytes memory aliceAuth = _buildRedeemAuth( + 1, alice, redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, bytes32("redeem_frontrun") + ); vm.prank(bob); vm.expectRevert(bytes("invalid signature")); - parallelizer.redeemWithAuthorization(redeemAmount, bob, deadline, minOuts, forfeit, aliceAuth); + parallelizer.redeemWithAuthorization(redeemAmount, bob, deadline, minOuts, forfeit, tokensHash, aliceAuth); } function test_RedeemWithAuthorization_RevertWhen_ValueMismatch() public { _mintExactInput(alice, address(eurA), 100 * BASE_6, 0); uint256 redeemAmount = tokenP.balanceOf(alice) / 4; - vm.startPrank(guardian); - uint64[] memory xR = new uint64[](1); - xR[0] = uint64(0); - int64[] memory yR = new int64[](1); - yR[0] = int64(int256(BASE_9)); - parallelizer.setRedemptionCurveParams(xR, yR); - vm.stopPrank(); + { + vm.startPrank(guardian); + uint64[] memory xR = new uint64[](1); + xR[0] = uint64(0); + int64[] memory yR = new int64[](1); + yR[0] = int64(int256(BASE_9)); + parallelizer.setRedemptionCurveParams(xR, yR); + vm.stopPrank(); + } uint256 deadline = block.timestamp + 1 hours; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); address[] memory forfeit = new address[](0); - bytes memory authData = - _buildRedeemAuth(1, alice, redeemAmount / 2, alice, deadline, minOuts, forfeit, bytes32("bad_redeem")); + bytes memory authData = _buildRedeemAuth( + 1, + alice, + redeemAmount / 2, + alice, + deadline, + minOuts, + forfeit, + _redemptionTokensHash(redeemAmount / 2), + bytes32("bad_redeem") + ); vm.prank(bob); vm.expectRevert(); - parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, authData); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, authData); } function test_RedeemWithAuthorization_RevertWhen_ReusedNonce() public { @@ -1975,27 +2050,32 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 redeemAmount = tokenP.balanceOf(alice) / 8; bytes32 userSalt = bytes32("reuse_redeem"); - vm.startPrank(guardian); - uint64[] memory xR = new uint64[](1); - xR[0] = uint64(0); - int64[] memory yR = new int64[](1); - yR[0] = int64(int256(BASE_9)); - parallelizer.setRedemptionCurveParams(xR, yR); - vm.stopPrank(); + { + vm.startPrank(guardian); + uint64[] memory xR = new uint64[](1); + xR[0] = uint64(0); + int64[] memory yR = new int64[](1); + yR[0] = int64(int256(BASE_9)); + parallelizer.setRedemptionCurveParams(xR, yR); + vm.stopPrank(); + } uint256 deadline = block.timestamp + 1 hours; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); address[] memory forfeit = new address[](0); - bytes memory authData1 = _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, userSalt); + bytes memory authData1 = + _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, userSalt); vm.prank(bob); - parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, authData1); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, authData1); - bytes memory authData2 = _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, userSalt); + bytes memory authData2 = + _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, userSalt); vm.prank(bob); vm.expectRevert(); - parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, authData2); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, authData2); } event Redeemed( @@ -2014,27 +2094,30 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 redeemAmount = tokenP.balanceOf(alice) / 4; - vm.startPrank(guardian); - uint64[] memory xR = new uint64[](1); - xR[0] = uint64(0); - int64[] memory yR = new int64[](1); - yR[0] = int64(int256(BASE_9)); - parallelizer.setRedemptionCurveParams(xR, yR); - vm.stopPrank(); + { + vm.startPrank(guardian); + uint64[] memory xR = new uint64[](1); + xR[0] = uint64(0); + int64[] memory yR = new int64[](1); + yR[0] = int64(int256(BASE_9)); + parallelizer.setRedemptionCurveParams(xR, yR); + vm.stopPrank(); + } uint256 deadline = block.timestamp + 1 hours; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); address[] memory forfeit = new address[](1); forfeit[0] = address(eurA); bytes memory authData = - _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, bytes32("forfeit_ok")); + _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, bytes32("forfeit_ok")); uint256 eurABefore = IERC20(address(eurA)).balanceOf(alice); uint256 eurBBefore = IERC20(address(eurB)).balanceOf(alice); vm.prank(bob); - parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, authData); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, authData); assertEq(IERC20(address(eurA)).balanceOf(alice), eurABefore, "forfeited token must not be transferred"); assertGt(IERC20(address(eurB)).balanceOf(alice), eurBBefore, "non-forfeited token must be transferred"); @@ -2047,28 +2130,32 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 redeemAmount = tokenP.balanceOf(alice) / 4; - vm.startPrank(guardian); - uint64[] memory xR = new uint64[](1); - xR[0] = uint64(0); - int64[] memory yR = new int64[](1); - yR[0] = int64(int256(BASE_9)); - parallelizer.setRedemptionCurveParams(xR, yR); - vm.stopPrank(); + { + vm.startPrank(guardian); + uint64[] memory xR = new uint64[](1); + xR[0] = uint64(0); + int64[] memory yR = new int64[](1); + yR[0] = int64(int256(BASE_9)); + parallelizer.setRedemptionCurveParams(xR, yR); + vm.stopPrank(); + } uint256 deadline = block.timestamp + 1 hours; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); address[] memory signedForfeit = new address[](1); signedForfeit[0] = address(eurA); - bytes memory authData = - _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, signedForfeit, bytes32("forfeit_bind")); + bytes memory authData = _buildRedeemAuth( + 1, alice, redeemAmount, alice, deadline, minOuts, signedForfeit, tokensHash, bytes32("forfeit_bind") + ); address[] memory tamperedForfeit = new address[](1); tamperedForfeit[0] = address(eurB); vm.prank(bob); vm.expectRevert(bytes("invalid signature")); - parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, tamperedForfeit, authData); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, tamperedForfeit, tokensHash, authData); } function test_RedeemWithAuthorization_EmitsAuthorizerNotRelayer() public { @@ -2078,24 +2165,28 @@ contract RedeemTest is Fixture, FunctionUtils { uint256 redeemAmount = tokenP.balanceOf(alice) / 4; - vm.startPrank(guardian); - uint64[] memory xR = new uint64[](1); - xR[0] = uint64(0); - int64[] memory yR = new int64[](1); - yR[0] = int64(int256(BASE_9)); - parallelizer.setRedemptionCurveParams(xR, yR); - vm.stopPrank(); + { + vm.startPrank(guardian); + uint64[] memory xR = new uint64[](1); + xR[0] = uint64(0); + int64[] memory yR = new int64[](1); + yR[0] = int64(int256(BASE_9)); + parallelizer.setRedemptionCurveParams(xR, yR); + vm.stopPrank(); + } uint256 deadline = block.timestamp + 1 hours; uint256[] memory minOuts = new uint256[](3); + tokensHash = _redemptionTokensHash(redeemAmount); address[] memory forfeit = new address[](0); - bytes memory authData = - _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, bytes32("event_attr_redeem")); + bytes memory authData = _buildRedeemAuth( + 1, alice, redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, bytes32("event_attr_redeem") + ); vm.expectEmit(true, true, false, false, address(parallelizer)); emit Redeemed(0, new address[](0), new uint256[](0), new address[](0), alice, alice); vm.prank(bob); - parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, authData); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, tokensHash, authData); } } diff --git a/tests/invariants/PathIndeInvariants.t.sol b/tests/invariants/PathIndeInvariants.t.sol index 8440a31..1a0c634 100644 --- a/tests/invariants/PathIndeInvariants.t.sol +++ b/tests/invariants/PathIndeInvariants.t.sol @@ -114,9 +114,10 @@ contract PathIndeInvariants is Fixture { } { - bytes4[] memory selectors = new bytes4[](2); + bytes4[] memory selectors = new bytes4[](3); selectors[0] = ArbitragerWithSplit.swap.selector; selectors[1] = ArbitragerWithSplit.redeem.selector; + selectors[2] = ArbitragerWithSplit.redeemWithForfeit.selector; targetSelector(FuzzSelector({ addr: address(_arbitragerHandler), selectors: selectors })); } @@ -139,6 +140,7 @@ contract PathIndeInvariants is Fixture { console.log("Trader:swap", _traderHandler.calls("swap")); console.log("Arbitrager:swap", _arbitragerHandler.calls("swap")); console.log("Arbitrager:redeem", _arbitragerHandler.calls("redeem")); + console.log("Arbitrager:redeemForfeit", _arbitragerHandler.calls("redeemForfeit")); console.log("oracle", _governanceHandler.calls("oracle")); console.log("Mint fees", _governanceHandler.calls("feeMint")); console.log("Burn fees", _governanceHandler.calls("feeBurn")); @@ -216,21 +218,28 @@ contract PathIndeInvariants is Fixture { // Path independence holds exactly only where the mint/burn/redemption curves are flat. The // redemption penalty is evaluated at the entry-time collateral ratio on the full amount (Cyfrin // finding I-6) and governance may install non-flat fee curves, so single-path and split-path - // outcomes legitimately diverge by a bounded amount. These tolerances bound that intended path - // dependence (1% on collateral balances, 0.2% on the collateral ratio) while still catching gross - // path-dependence regressions. + // outcomes legitimately diverge by a bounded amount. + // + // The dominant source used to be elsewhere: `ArbitragerWithSplit` split a redemption that forfeited + // tokens. Forfeited tokens stay in the reserve while the others shrink, so the composition drifts + // and each later redemption forfeits a larger share of value. Splitting one moved the collateral + // ratio by 150 to 200 bps, an order of magnitude past this tolerance. + // + // Forfeit is still exercised, through `redeemWithForfeit`, but applied identically and unsplit to + // both systems so they drift together. Only the plain redemption is split. The residual divergence + // measured over 25 seeded campaigns peaks at 1.4e-8%, against 4.1e-6% before. function invariant_PathIndependenceBalanceCollaterals() public { for (uint256 i; i < _collaterals.length; i++) { uint256 balance = IERC20(_collaterals[i]).balanceOf(address(parallelizer)); uint256 balanceSplit = IERC20(_collaterals[i]).balanceOf(address(parallelizerSplit)); - assertApproxEqRelDecimal(balance, balanceSplit, _MAX_PERCENTAGE_DEVIATION * 10000, 18); + assertApproxEqRelDecimal(balance, balanceSplit, _MAX_PERCENTAGE_DEVIATION * 10_000, 18); } } function invariant_PathIndependenceCollateralRatio() public { (uint256 collateralRatio,) = parallelizer.getCollateralRatio(); (uint256 collateralRatioSplit,) = parallelizerSplit.getCollateralRatio(); - assertApproxEqRelDecimal(collateralRatio, collateralRatioSplit, _MAX_PERCENTAGE_DEVIATION * 2000, 18); + assertApproxEqRelDecimal(collateralRatio, collateralRatioSplit, _MAX_PERCENTAGE_DEVIATION * 100, 18); } function invariantSystemState() public view { diff --git a/tests/invariants/actors/Arbitrager.t.sol b/tests/invariants/actors/Arbitrager.t.sol index cd586c8..310038f 100644 --- a/tests/invariants/actors/Arbitrager.t.sol +++ b/tests/invariants/actors/Arbitrager.t.sol @@ -3,7 +3,12 @@ pragma solidity 0.8.28; import "contracts/utils/Constants.sol"; import { - AggregatorV3Interface, BaseActor, IERC20, IERC20Metadata, IParallelizer, TestStorage + AggregatorV3Interface, + BaseActor, + IERC20, + IERC20Metadata, + IParallelizer, + TestStorage } from "./BaseActor.t.sol"; import { QuoteType } from "contracts/parallelizer/Storage.sol"; import { console } from "@forge-std/console.sol"; @@ -185,8 +190,9 @@ contract Arbitrager is BaseActor { // don't care about slippage uint256[] memory minAmountOuts = new uint256[](_collaterals.length); address[] memory redeemTokens; + bytes32 tokensHash = _redemptionTokensHash(_parallelizer, amount); (redeemTokens, redeemAmounts) = _parallelizer.redeemWithForfeit( - amount, _currentActor, block.timestamp + 1 hours, minAmountOuts, forfeitTokens + amount, _currentActor, block.timestamp + 1 hours, minAmountOuts, forfeitTokens, tokensHash ); } diff --git a/tests/invariants/actors/ArbitragerWithSplit.t.sol b/tests/invariants/actors/ArbitragerWithSplit.t.sol index 8a54e49..e7ee4ec 100644 --- a/tests/invariants/actors/ArbitragerWithSplit.t.sol +++ b/tests/invariants/actors/ArbitragerWithSplit.t.sol @@ -3,7 +3,12 @@ pragma solidity 0.8.28; import "contracts/utils/Constants.sol"; import { - AggregatorV3Interface, BaseActor, IERC20, IERC20Metadata, IParallelizer, TestStorage + AggregatorV3Interface, + BaseActor, + IERC20, + IERC20Metadata, + IParallelizer, + TestStorage } from "./BaseActor.t.sol"; import { QuoteType } from "contracts/parallelizer/Storage.sol"; import { console } from "@forge-std/console.sol"; @@ -212,23 +217,23 @@ contract ArbitragerWithSplit is BaseActor { return (testS.amountIn, testS.amountOut); } - function redeem( + /// @dev Forfeit is exercised here, but applied identically and unsplit to both systems, so they + /// drift together and the path independence invariants stay meaningful. Splitting a forfeited + /// redemption is what breaks them: the forfeited tokens stay in the reserve while the others + /// shrink, so the composition drifts and each later redemption forfeits a larger share of value. + function redeemWithForfeit( bool[3] memory isForfeitTokens, uint256 amount, - uint256 splitProportion, uint256 actorIndex ) public useActor(actorIndex) - countCall("redeem") + countCall("redeemForfeit") { uint256 balancetokenP = tokenP.balanceOf(_currentActor); amount = bound(amount, 0, balancetokenP / 2); - splitProportion = bound(splitProportion, 1, BASE_9); if (amount == 0) return; - // Build forfeitTokens from isForfeitTokens so the protocol skips them; the post-redeem - // assertions below assume forfeited tokens are not credited to the actor. address[] memory forfeitTokens; { uint256 count; @@ -244,6 +249,70 @@ contract ArbitragerWithSplit is BaseActor { } } } + if (forfeitTokens.length == 0) return; + + console.log(""); + console.log("========= Redeem With Forfeit ========="); + + _redeemForfeitOn(_parallelizer, amount, isForfeitTokens, forfeitTokens); + _redeemForfeitOn(_parallelizerSplit, amount, isForfeitTokens, forfeitTokens); + } + + /// @dev Extracted so the caller stays within the EVM stack-depth limit + function _redeemForfeitOn( + IParallelizer target, + uint256 amount, + bool[3] memory isForfeitTokens, + address[] memory forfeitTokens + ) + internal + { + uint256[] memory balanceTokens = new uint256[](_collaterals.length); + for (uint256 i; i < balanceTokens.length; ++i) { + balanceTokens[i] = IERC20(_collaterals[i]).balanceOf(_currentActor); + } + + (uint64 prevCollateralRatio,) = target.getCollateralRatio(); + uint256[] memory redeemAmounts; + { + uint256[] memory minAmountOuts = new uint256[](_collaterals.length); + bytes32 tokensHash = _redemptionTokensHash(target, amount); + (, redeemAmounts) = target.redeemWithForfeit( + amount, _currentActor, block.timestamp + 1 hours, minAmountOuts, forfeitTokens, tokensHash + ); + } + + // forfeiting leaves value behind, so the ratio can only improve + (uint64 collateralRatio,) = target.getCollateralRatio(); + assertGe(collateralRatio, prevCollateralRatio); + for (uint256 i; i < balanceTokens.length; ++i) { + if (isForfeitTokens[i]) { + assertEq(IERC20(_collaterals[i]).balanceOf(_currentActor), balanceTokens[i]); + } else { + assertEq(IERC20(_collaterals[i]).balanceOf(_currentActor), balanceTokens[i] + redeemAmounts[i]); + } + } + } + + /// @dev No forfeit here, unlike the non-split `Arbitrager`. Forfeited tokens stay in the reserve + /// while the others shrink, so the composition drifts and each later redemption forfeits a larger + /// share of value. That makes redemption genuinely path dependent: a single split moves the + /// collateral ratio by around 150 to 200 bps against 0 for a plain redemption, which is what the + /// path independence invariants measure. `Arbitrager` keeps the forfeit coverage for the other suites. + function redeem( + uint256 amount, + uint256 splitProportion, + uint256 actorIndex + ) + public + useActor(actorIndex) + countCall("redeem") + { + uint256 balancetokenP = tokenP.balanceOf(_currentActor); + amount = bound(amount, 0, balancetokenP / 2); + splitProportion = bound(splitProportion, 1, BASE_9); + if (amount == 0) return; + // Redeem on the true parallelizer { uint256[] memory balanceTokens = new uint256[](_collaterals.length); @@ -259,10 +328,9 @@ contract ArbitragerWithSplit is BaseActor { { // don't care about slippage uint256[] memory minAmountOuts = new uint256[](_collaterals.length); - address[] memory redeemTokens; - (redeemTokens, redeemAmounts) = _parallelizer.redeemWithForfeit( - amount, _currentActor, block.timestamp + 1 hours, minAmountOuts, forfeitTokens - ); + bytes32 tokensHash = _redemptionTokensHash(_parallelizer, amount); + (, redeemAmounts) = + _parallelizer.redeem(amount, _currentActor, block.timestamp + 1 hours, minAmountOuts, tokensHash); } // if it is a burn it should always increase the collateral ratio @@ -271,11 +339,7 @@ contract ArbitragerWithSplit is BaseActor { assertEq(tokenP.balanceOf(_currentActor), balancetokenP - amount); balancetokenP -= amount; for (uint256 i; i < balanceTokens.length; ++i) { - if (!isForfeitTokens[i]) { - assertEq(IERC20(_collaterals[i]).balanceOf(_currentActor), balanceTokens[i] + redeemAmounts[i]); - } else { - assertEq(IERC20(_collaterals[i]).balanceOf(_currentActor), balanceTokens[i]); - } + assertEq(IERC20(_collaterals[i]).balanceOf(_currentActor), balanceTokens[i] + redeemAmounts[i]); } } @@ -295,15 +359,16 @@ contract ArbitragerWithSplit is BaseActor { { // don't care about slippage uint256[] memory minAmountOuts = new uint256[](_collaterals.length); - address[] memory redeemTokens; uint256 amountSplit = (amount * splitProportion) / BASE_9; - (redeemTokens, redeemAmountsSplit1) = _parallelizerSplit.redeemWithForfeit( - amountSplit, _currentActor, block.timestamp + 1 hours, minAmountOuts, forfeitTokens + bytes32 tokensHash = _redemptionTokensHash(_parallelizerSplit, amountSplit); + (, redeemAmountsSplit1) = _parallelizerSplit.redeem( + amountSplit, _currentActor, block.timestamp + 1 hours, minAmountOuts, tokensHash ); amountSplit = amount - amountSplit; - (, redeemAmountsSplit2) = _parallelizerSplit.redeemWithForfeit( - amountSplit, _currentActor, block.timestamp + 1 hours, minAmountOuts, forfeitTokens + tokensHash = _redemptionTokensHash(_parallelizerSplit, amountSplit); + (, redeemAmountsSplit2) = _parallelizerSplit.redeem( + amountSplit, _currentActor, block.timestamp + 1 hours, minAmountOuts, tokensHash ); } @@ -312,14 +377,10 @@ contract ArbitragerWithSplit is BaseActor { assertGe(collateralRatio, prevCollateralRatio); assertEq(tokenP.balanceOf(_currentActor), balancetokenP - amount); for (uint256 i; i < balanceTokens.length; ++i) { - if (!isForfeitTokens[i]) { - assertEq( - IERC20(_collaterals[i]).balanceOf(_currentActor), - balanceTokens[i] + redeemAmountsSplit1[i] + redeemAmountsSplit2[i] - ); - } else { - assertEq(IERC20(_collaterals[i]).balanceOf(_currentActor), balanceTokens[i]); - } + assertEq( + IERC20(_collaterals[i]).balanceOf(_currentActor), + balanceTokens[i] + redeemAmountsSplit1[i] + redeemAmountsSplit2[i] + ); } } } diff --git a/tests/invariants/actors/BaseActor.t.sol b/tests/invariants/actors/BaseActor.t.sol index e4fdd05..cb0e37f 100644 --- a/tests/invariants/actors/BaseActor.t.sol +++ b/tests/invariants/actors/BaseActor.t.sol @@ -79,4 +79,11 @@ contract BaseActor is Test { _maxTokenAmount.push(_maxAmountWithoutDecimals * 10 ** IERC20Metadata(_collaterals[1]).decimals()); _maxTokenAmount.push(_maxAmountWithoutDecimals * 10 ** IERC20Metadata(_collaterals[2]).decimals()); } + + /// @dev The output list a redemption of `amount` would produce right now, hashed as the redeem + /// entry points expect it + function _redemptionTokensHash(IParallelizer target, uint256 amount) internal view returns (bytes32) { + (address[] memory tokens,) = target.quoteRedemptionCurve(amount); + return keccak256(abi.encodePacked(tokens)); + } } diff --git a/tests/mock/MockFlashLoan.sol b/tests/mock/MockFlashLoan.sol new file mode 100644 index 0000000..139ada6 --- /dev/null +++ b/tests/mock/MockFlashLoan.sol @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: Unlicensed +pragma solidity 0.8.28; + +import { IERC3156FlashBorrower } from "@openzeppelin/contracts/interfaces/IERC3156FlashBorrower.sol"; +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +import { MockTokenPermit } from "./MockTokenPermit.sol"; + +/// @dev ERC-3156 lender: mints the principal to the borrower and pulls back principal plus fee through the +/// allowance the borrower granted, mirroring FlashParallelToken closely enough for the rebalancer. +contract MockFlashLoan { + bytes32 internal constant CALLBACK_SUCCESS = keccak256("ERC3156FlashBorrower.onFlashLoan"); + + /// @dev Basis points, as FlashParallelToken stores it + uint16 public feeRateBps; + + function setFeeRateBps(uint16 newFeeRateBps) external { + require(newFeeRateBps <= 1e4, "fee rate above 100%"); + feeRateBps = newFeeRateBps; + } + + function maxFlashLoan(address) external pure returns (uint256) { + return type(uint256).max; + } + + function flashFee(address, uint256 amount) public view returns (uint256) { + return (amount * feeRateBps) / 1e4; + } + + function flashLoan( + IERC3156FlashBorrower receiver, + address token, + uint256 amount, + bytes calldata data + ) + external + returns (bool) + { + uint256 fee = flashFee(token, amount); + MockTokenPermit(token).mint(address(receiver), amount); + require(receiver.onFlashLoan(msg.sender, token, amount, fee, data) == CALLBACK_SUCCESS, "bad callback"); + IERC20(token).transferFrom(address(receiver), address(this), amount + fee); + MockTokenPermit(token).burn(address(this), amount); + return true; + } +} diff --git a/tests/mock/MockReentrant.sol b/tests/mock/MockReentrant.sol index 19e1a98..719657c 100644 --- a/tests/mock/MockReentrant.sol +++ b/tests/mock/MockReentrant.sol @@ -19,10 +19,11 @@ contract ReentrantRedeemGetCollateralRatio { } function testERC777Reentrancy(uint256 redeemAmount) public { - uint256[] memory minAmountOuts; - (, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(redeemAmount); - minAmountOuts = new uint256[](quoteAmounts.length); - parallelizer.redeem(redeemAmount, address(this), block.timestamp * 2, minAmountOuts); + (address[] memory quoteTokens, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(redeemAmount); + uint256[] memory minAmountOuts = new uint256[](quoteAmounts.length); + parallelizer.redeem( + redeemAmount, address(this), block.timestamp * 2, minAmountOuts, keccak256(abi.encodePacked(quoteTokens)) + ); } function setInterfaceImplementer() public { @@ -60,10 +61,11 @@ contract ReentrantRedeemSwap { } function testERC777Reentrancy(uint256 redeemAmount) public { - uint256[] memory minAmountOuts; - (, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(redeemAmount); - minAmountOuts = new uint256[](quoteAmounts.length); - parallelizer.redeem(redeemAmount, address(this), block.timestamp * 2, minAmountOuts); + (address[] memory quoteTokens, uint256[] memory quoteAmounts) = parallelizer.quoteRedemptionCurve(redeemAmount); + uint256[] memory minAmountOuts = new uint256[](quoteAmounts.length); + parallelizer.redeem( + redeemAmount, address(this), block.timestamp * 2, minAmountOuts, keccak256(abi.encodePacked(quoteTokens)) + ); } function setInterfaceImplementer() public { diff --git a/tests/mock/MockOdosRouter.sol b/tests/mock/MockSwapRouter.sol similarity index 97% rename from tests/mock/MockOdosRouter.sol rename to tests/mock/MockSwapRouter.sol index f71e78e..2118141 100644 --- a/tests/mock/MockOdosRouter.sol +++ b/tests/mock/MockSwapRouter.sol @@ -7,7 +7,7 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../../contracts/utils/Constants.sol"; import "../../contracts/utils/Errors.sol"; -contract MockOdosRouter { +contract MockSwapRouter { using SafeERC20 for IERC20; bool public setRevert; diff --git a/tests/units/DonationRedemptionCoefficient.t.sol b/tests/units/DonationRedemptionCoefficient.t.sol new file mode 100644 index 0000000..f2f1687 --- /dev/null +++ b/tests/units/DonationRedemptionCoefficient.t.sol @@ -0,0 +1,398 @@ +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity 0.8.28; + +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; +import { console } from "@forge-std/console.sol"; + +import { MockChainlinkOracle } from "../mock/MockChainlinkOracle.sol"; +import { Fixture } from "../Fixture.sol"; +import "contracts/utils/Constants.sol"; + +/// @notice Bailsec Core Issue_10. A donation lifts the reported collateral ratio without lifting +/// tracked issuance, so it can buy a better redemption coefficient. Measured against the redemption +/// curve live on all five chains, with a second holder present so the transfer of value is visible. +contract Test_DonationRedemptionCoefficient is Fixture { + /// @dev The curve deployed on mainnet, sonic, base, avalanche and hyperevm + function _setLiveRedemptionCurve() internal { + uint64[] memory x = new uint64[](4); + x[0] = 750_000_000; + x[1] = 850_000_000; + x[2] = 950_000_000; + x[3] = 970_000_000; + int64[] memory y = new int64[](4); + y[0] = 995_000_000; + y[1] = 950_000_000; + y[2] = 950_000_000; + y[3] = 995_000_000; + hoax(guardian); + parallelizer.setRedemptionCurveParams(x, y); + } + + function setUp() public override { + super.setUp(); + _setLiveRedemptionCurve(); + // alice attacks, bob is the holder she would be extracting from. Splitting the position by + // transfer rather than a second mint keeps the exposure fee curve out of the measurement + _mintExactInput(alice, address(eurA), 100_000 * BASE_6, 0); + _setRatioTo(950_000_000); + } + + /// @dev Calibrates the eurA oracle so the reported ratio lands on `target`, rather than assuming + /// what the fixture's mints issued + function _setRatioTo(uint64 target) internal { + uint256 issued = parallelizer.getTotalIssued(); + uint256 balance = IERC20(address(eurA)).balanceOf(address(parallelizer)); + uint8 dec = IERC20Metadata(address(eurA)).decimals(); + // answer is 8 decimals, balance carries `dec`, issued and target are 18 and 9 decimals + uint256 answer = (uint256(target) * issued * (10 ** dec) * BASE_8) / (BASE_9 * balance * BASE_18); + MockChainlinkOracle(address(oracleA)).setLatestAnswer(int256(answer)); + } + + function _valueOf(address token, uint256 amount) internal view returns (uint256) { + (,,,, uint256 oracleValue) = parallelizer.getOracleValues(token); + return (oracleValue * amount) / (10 ** IERC20Metadata(token).decimals()); + } + + /// @dev Oracle value of the collateral `who` holds outside the Parallelizer + function _walletValue(address who) internal view returns (uint256 total) { + address[] memory list = parallelizer.getCollateralList(); + for (uint256 i; i < list.length; ++i) { + total += _valueOf(list[i], IERC20(list[i]).balanceOf(who)); + } + } + + /// @dev Oracle value `who` would get by redeeming everything they still hold + function _claimValue(address who) internal view returns (uint256 total) { + uint256 bal = tokenP.balanceOf(who); + if (bal == 0) return 0; + // the quote refuses to price the entire remaining issuance + if (bal >= parallelizer.getTotalIssued()) bal = parallelizer.getTotalIssued() - 1; + (address[] memory tokens, uint256[] memory amounts) = parallelizer.quoteRedemptionCurve(bal); + for (uint256 i; i < tokens.length; ++i) { + total += _valueOf(tokens[i], amounts[i]); + } + } + + function _redeem(address who, uint256 amount) internal { + (address[] memory tokens,) = parallelizer.quoteRedemptionCurve(amount); + uint256[] memory minOuts = new uint256[](tokens.length); + vm.prank(who); + parallelizer.redeem(amount, who, block.timestamp + 1 days, minOuts, keccak256(abi.encodePacked(tokens))); + } + + /// @dev Alice's total position after the run, and what bob is left holding + function _run(uint256 redeemAmount, uint256 donation) internal returns (uint256 aliceNet, uint256 bobClaim) { + uint256 cost; + if (donation > 0) { + deal(address(eurB), alice, donation); + cost = _valueOf(address(eurB), donation); + vm.prank(alice); + IERC20(address(eurB)).transfer(address(parallelizer), donation); + } + _redeem(alice, redeemAmount); + aliceNet = _walletValue(alice) + _claimValue(alice) - cost; + bobClaim = _claimValue(bob); + } + + /// @dev A curve with no upward segment: the reported ratio no longer prices the redemption, so a + /// donation has nothing to buy. `level` sets how much of a run deterrent is kept. + function _setFlatRedemptionCurve(int64 level) internal { + uint64[] memory x = new uint64[](2); + x[0] = 0; + x[1] = 1_000_000_000; + int64[] memory y = new int64[](2); + y[0] = level; + y[1] = level; + hoax(guardian); + parallelizer.setRedemptionCurveParams(x, y); + } + + function _attackerNet(uint256 donation) internal returns (int256) { + _splitSupply(50); + uint256 amount = tokenP.balanceOf(alice); + uint256 inner = vm.snapshotState(); + (uint256 baseAlice,) = _run(amount, 0); + vm.revertToState(inner); + (uint256 a,) = _run(amount, donation); + vm.revertToState(inner); + return int256(a) - int256(baseAlice); + } + + /// @dev Flattening removes the profit at any level, so the level is free to serve the run + /// deterrent rather than the donation defence + function test_FlatCurve_RemovesTheDonationProfit() public { + uint256 donation = 2000e12; + + int256 live = _attackerNet(donation); + console.log("live curve (99.5 / 95 / 95 / 99.5)"); + _log(live); + + _setFlatRedemptionCurve(995_000_000); + int256 flatHigh = _attackerNet(donation); + console.log("flat at 99.5%, no deterrent kept"); + _log(flatHigh); + + _setFlatRedemptionCurve(950_000_000); + int256 flatLow = _attackerNet(donation); + console.log("flat at 95%, 5 point deterrent kept"); + _log(flatLow); + + assertGt(live, int256(0), "the deployed curve is exploitable at this share"); + assertLt(flatHigh, int256(0), "flattening high must remove the profit"); + assertLt(flatLow, int256(0), "flattening low must remove the profit"); + } + + /// @dev `y[last]` also prices every redemption above a 100% ratio, so flattening the curve at a + /// lower level would raise the fee paid in normal conditions + function test_FlatLevel_AlsoPricesHealthyRedemptions() public { + _setRatioTo(1_100_000_000); + _splitSupply(50); + uint256 amount = tokenP.balanceOf(alice); + + uint256 snap = vm.snapshotState(); + _setFlatRedemptionCurve(995_000_000); + _redeem(alice, amount); + uint256 at995 = _walletValue(alice); + vm.revertToState(snap); + + _setFlatRedemptionCurve(950_000_000); + _redeem(alice, amount); + uint256 at950 = _walletValue(alice); + vm.revertToState(snap); + + console.log("healthy redemption at a 110% ratio"); + console.log(" proceeds with y[last] = 99.5%", at995); + console.log(" proceeds with y[last] = 95% ", at950); + console.log(" cost of flattening low ", at995 - at950); + assertGt(at995, at950, "a lower flat level taxes healthy redemptions"); + } + + /// @dev Same 4.5 point deterrent, ramping back to `y[last]` from `rampStart` up to a 100% ratio. + /// The attacker pays in ratio points and is paid in payout points, so the slope of that ramp is + /// what decides profitability, not whether a deterrent exists. + function _setRampedCurve(uint64 rampStart) internal { + uint64[] memory x = new uint64[](3); + x[0] = 0; + x[1] = rampStart; + x[2] = 1_000_000_000; + int64[] memory y = new int64[](3); + y[0] = 950_000_000; + y[1] = 950_000_000; + y[2] = 995_000_000; + hoax(guardian); + parallelizer.setRedemptionCurveParams(x, y); + } + + function _attackerNetAtShare(uint256 sharePct, uint256 donation) internal returns (int256) { + _splitSupply(100 - sharePct); + uint256 amount = tokenP.balanceOf(alice); + uint256 inner = vm.snapshotState(); + (uint256 baseAlice,) = _run(amount, 0); + vm.revertToState(inner); + (uint256 a,) = _run(amount, donation); + vm.revertToState(inner); + return int256(a) - int256(baseAlice); + } + + /// @dev A gentle enough ramp keeps the deterrent and still starves the attack, including against + /// a holder large enough to recover most of their own donation + function test_RampSlope_DecidesProfitability() public { + uint256 donation = 2000e12; + uint64[4] memory rampStarts = [uint64(950_000_000), 900_000_000, 800_000_000, 600_000_000]; + uint256[2] memory shares = [uint256(50), 90]; + + console.log("4.5 payout points ramping up to a 100% ratio, over a widening band"); + for (uint256 i; i < rampStarts.length; ++i) { + uint256 width = 1_000_000_000 - rampStarts[i]; + console.log(" ramp starts at (1e9)", rampStarts[i]); + console.log(" slope x1000", (uint256(45_000_000) * 1000) / width); + for (uint256 j; j < shares.length; ++j) { + uint256 snap = vm.snapshotState(); + _setRampedCurve(rampStarts[i]); + int256 net = _attackerNetAtShare(shares[j], donation); + vm.revertToState(snap); + console.log(" attacker share pct", shares[j]); + _log(net); + + // The attacker pays `d` in ratio points and is repaid `slope * d` in payout points on their + // own redemption, while recovering the share `f` of the donation they still have a claim + // on. So a ramp starves the attack when slope < (1 - f) / (f * H/S). At half the supply + // that threshold is about 1.05, at ninety percent about 0.12. + uint256 threshold = shares[j] == 50 ? 1053 : 117; + if ((uint256(45_000_000) * 1000) / width < threshold) { + assertLt(net, int256(0), "a ramp below the threshold must not pay"); + } else { + assertGt(net, int256(0), "a ramp above the threshold still pays"); + } + } + } + } + + /// @dev At or above 100% the curve sits at its cap, so the donation buys no coefficient lift and the + /// attacker is left paying the spread. The cap is what closes this, not the slope of the ramp + function test_Overcollateralized_RemovesTheDonationProfit() public { + uint256 donation = 2000e12; + + uint256 snap = vm.snapshotState(); + _setRampedCurve(600_000_000); + int256 under = _attackerNetAtShare(90, donation); + vm.revertToState(snap); + + snap = vm.snapshotState(); + _setRampedCurve(600_000_000); + _setRatioTo(1_050_000_000); + int256 over = _attackerNetAtShare(90, donation); + vm.revertToState(snap); + + console.log("undercollateralised:"); + _log(under); + console.log("overcollateralised:"); + _log(over); + assertLt(over, int256(0), "an overcollateralised system must not pay the donation attack"); + } + + /// @dev `processSurplus` drives the ratio down to `surplusBufferRatio`, so the margin over the + /// profitable region is under a point rather than whatever a spot reading suggests + function test_SurplusBufferSteadyState_LeavesAThinMargin() public { + uint256 donation = 2000e12; + + uint256 snap = vm.snapshotState(); + _setRampedCurve(600_000_000); + _setRatioTo(1_005_000_000); + int256 atBuffer = _attackerNetAtShare(90, donation); + vm.revertToState(snap); + + snap = vm.snapshotState(); + _setRampedCurve(600_000_000); + _setRatioTo(995_000_000); + int256 belowBuffer = _attackerNetAtShare(90, donation); + vm.revertToState(snap); + + console.log("at the 100.5% surplus buffer:"); + _log(atBuffer); + console.log("one point below it:"); + _log(belowBuffer); + + assertLt(atBuffer, int256(0), "the attack must not pay at the surplus buffer"); + } + + /// @dev The ratio sawtooths between the buffer and whatever yield adds before the next run, so the + /// trough is the block the run lands in + function test_MonthlySawtooth_TroughIsTheExposedPoint() public { + uint256 donation = 2000e12; + + uint256 snap = vm.snapshotState(); + _setRampedCurve(600_000_000); + _setRatioTo(1_005_000_000); + int256 trough = _attackerNetAtShare(90, donation); + vm.revertToState(snap); + + snap = vm.snapshotState(); + _setRampedCurve(600_000_000); + _setRatioTo(1_011_000_000); + int256 lateCycle = _attackerNetAtShare(90, donation); + vm.revertToState(snap); + + console.log("trough, just after processSurplus:"); + _log(trough); + console.log("late in the cycle, after a month of yield:"); + _log(lateCycle); + + assertLt(trough, int256(0), "the trough must still not pay the attack"); + assertLt(lateCycle, int256(0), "later in the cycle must not pay either"); + } + + function _log(int256 net) internal pure { + if (net > 0) console.log(" attacker GAINS", uint256(net)); + else console.log(" attacker LOSES", uint256(-net)); + } + + /// @dev Moves `pct` of the supply to bob, leaving alice with the rest + function _splitSupply(uint256 pctToBob) internal { + uint256 send = (tokenP.balanceOf(alice) * pctToBob) / 100; + vm.prank(alice); + IERC20(address(tokenP)).transfer(bob, send); + } + + /// @dev Donation sized to walk the ratio from 95% up onto the 97% shoulder of the curve + function test_Measure_ProfitabilityByAttackerShare() public { + uint256[5] memory attackerPct = [uint256(25), 30, 35, 40, 50]; + uint256 donation = 2000e12; + + console.log("attacker share -> net result, donating 2000 of correctly priced collateral"); + for (uint256 i; i < attackerPct.length; ++i) { + uint256 snap = vm.snapshotState(); + _splitSupply(100 - attackerPct[i]); + uint256 amount = tokenP.balanceOf(alice); + + uint256 inner = vm.snapshotState(); + (uint256 baseAlice,) = _run(amount, 0); + vm.revertToState(inner); + (uint256 a, uint256 b) = _run(amount, donation); + uint256 baseBob; + { + vm.revertToState(inner); + (, baseBob) = _run(amount, 0); + } + vm.revertToState(snap); + + console.log(" attacker holds pct", attackerPct[i]); + if (a > baseAlice) console.log(" attacker GAINS", a - baseAlice); + else console.log(" attacker LOSES", baseAlice - a); + if (b < baseBob) console.log(" others LOSE ", baseBob - b); + else console.log(" others gain ", b - baseBob); + + // Break-even sits between 30% and 35% of the supply on the deployed curve. These bounds are + // the documented exposure: widening the curve's upward segment would move them, and this + // test is meant to fail so the trade-off gets re-measured. + if (attackerPct[i] <= 30) assertLt(a, baseAlice, "attack should not pay at this share"); + if (attackerPct[i] >= 35) assertGt(a, baseAlice, "attack should still pay at this share"); + } + } + + function test_Measure_DonationTransfersValueFromOtherHolders() public { + _splitSupply(50); + uint256 startingAlice = tokenP.balanceOf(alice); + uint256[3] memory donations = [uint256(500e12), 2000e12, 5000e12]; + + uint256 snap = vm.snapshotState(); + (uint256 baseAlice, uint256 baseBob) = _run(startingAlice, 0); + vm.revertToState(snap); + require(tokenP.balanceOf(alice) == startingAlice, "snapshot did not restore"); + + (uint64 crStart,) = parallelizer.getCollateralRatio(); + console.log("starting collateral ratio (1e9)", crStart); + console.log("baseline, no donation"); + console.log(" alice net position", baseAlice); + console.log(" bob claim value", baseBob); + + for (uint256 i; i < donations.length; ++i) { + snap = vm.snapshotState(); + deal(address(eurB), alice, donations[i]); + vm.prank(alice); + IERC20(address(eurB)).transfer(address(parallelizer), donations[i]); + (uint64 crAfter,) = parallelizer.getCollateralRatio(); + vm.revertToState(snap); + + snap = vm.snapshotState(); + (uint256 a, uint256 b) = _run(startingAlice, donations[i]); + uint256 eurBBack = IERC20(address(eurB)).balanceOf(alice); + vm.revertToState(snap); + require(tokenP.balanceOf(alice) == startingAlice, "snapshot did not restore"); + + console.log("donation oracle value", _valueOfStatic(donations[i])); + console.log(" ratio moves to (1e9)", crAfter); + console.log(" eurB returned to alice (oracle value)", _valueOfStatic(eurBBack)); + if (a > baseAlice) console.log(" alice GAINS", a - baseAlice); + else console.log(" alice LOSES", baseAlice - a); + if (b < baseBob) console.log(" bob LOSES", baseBob - b); + else console.log(" bob gains", b - baseBob); + } + } + + function _valueOfStatic(uint256 amount) internal view returns (uint256) { + return _valueOf(address(eurB), amount); + } +} diff --git a/tests/units/Layout.t.sol b/tests/units/Layout.t.sol index decfdc4..d61828d 100644 --- a/tests/units/Layout.t.sol +++ b/tests/units/Layout.t.sol @@ -24,6 +24,20 @@ contract Test_Layout is Fixture { layout = Layout(address(parallelizer)); } + /// @dev Read before `_etch()` replaces the diamond's code, kept in storage so `test_Layout` + /// stays within the EVM stack-depth limit + uint64 internal _surplusBufferRatio; + uint256 internal _lastReleasedAt; + uint256 internal _totalShares; + + /// @dev The tail of `ParallelizerStorage`, added after the initial layout was written down + function _assertStructTail() internal view { + assertEq(layout.surplusBufferRatio(), _surplusBufferRatio); + assertEq(layout.lastReleasedAt(), _lastReleasedAt); + assertEq(layout.totalShares(), _totalShares); + assertEq(layout.swapRouter(), address(bob)); + } + function test_Layout() public { address tokenP = address(parallelizer.tokenP()); uint8 isRedemptionLive = parallelizer.isPaused(address(0), ActionType.Redeem) ? 0 : 1; @@ -36,6 +50,11 @@ contract Test_Layout is Fixture { hoax(governor); parallelizer.toggleTrusted(alice, TrustedType.Seller); address accessManager = parallelizer.accessManager(); + hoax(governor); + parallelizer.setSwapRouter(address(bob)); + _surplusBufferRatio = parallelizer.getSurplusBufferRatio(); + _lastReleasedAt = parallelizer.getLastReleasedAt(); + _totalShares = parallelizer.getTotalShares(); hoax(guardian); parallelizer.setDummyImplementation(address(alice)); address implementation = parallelizer.implementation(); @@ -62,8 +81,7 @@ contract Test_Layout is Fixture { uint8 onlyWhitelisted, uint216 normalizedStables, bytes memory oracleConfig, - bytes memory whitelistData, - , + bytes memory whitelistData,, ) = layout.collaterals(collateralList[0]); assertEq(isManaged, collateral.isManaged); @@ -86,12 +104,14 @@ contract Test_Layout is Fixture { assertEq(layout.selectors(selectorPosition), selectors[i]); } + _assertStructTail(); + assertEq(layout.accessManager(), accessManager); assertEq(layout.implementation(), implementation); } /*////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - INTERNAL + INTERNAL //////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/ function _etch() internal { diff --git a/tests/units/Rebalancer.t.sol b/tests/units/Rebalancer.t.sol new file mode 100644 index 0000000..e7dbf19 --- /dev/null +++ b/tests/units/Rebalancer.t.sol @@ -0,0 +1,327 @@ +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity 0.8.28; + +import { MultiBlockRebalancer } from "contracts/helpers/MultiBlockRebalancer.sol"; +import { GenericRebalancer, SwapType } from "contracts/helpers/GenericRebalancer.sol"; +import { stdError } from "@forge-std/Test.sol"; +import { IERC3156FlashLender } from "@openzeppelin/contracts/interfaces/IERC3156FlashLender.sol"; +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +import { MockRouter } from "../mock/MockRouter.sol"; +import { MockFlashLoan } from "../mock/MockFlashLoan.sol"; +import { MockTokenPermit } from "../mock/MockTokenPermit.sol"; +import { IParallelizer } from "contracts/interfaces/IParallelizer.sol"; +import "contracts/utils/Constants.sol"; +import "contracts/utils/Errors.sol" as Errors; + +import { Fixture } from "../Fixture.sol"; + +contract Test_Rebalancer_MaxSlippage is Fixture { + MultiBlockRebalancer internal rebalancer; + + address internal yieldBearingAsset; + + function setUp() public override { + super.setUp(); + + yieldBearingAsset = address(eurY); + rebalancer = new MultiBlockRebalancer(address(accessManager), tokenP, IParallelizer(address(parallelizer))); + + vm.startPrank(governor); + accessManager.setTargetFunctionRole( + address(rebalancer), getGuardianBaseRebalancerSelectorAccess(), GUARDIAN_ROLE + ); + accessManager.grantRole(GUARDIAN_ROLE, guardian, 0); + vm.stopPrank(); + + vm.prank(guardian); + rebalancer.setYieldBearingAssetData(yieldBearingAsset, address(eurA), 5e8, 1e8, 9e8, 1, 5e7); + } + + function test_SetMaxSlippage_UpdatesTheLiveLimit() public { + vm.prank(guardian); + rebalancer.setMaxSlippage(yieldBearingAsset, 1e7); + + (,,,,, uint64 maxSlippage) = rebalancer.yieldBearingData(yieldBearingAsset); + assertEq(maxSlippage, 1e7); + } + + function test_RevertWhen_SetMaxSlippageIsFullSlippage() public { + vm.prank(guardian); + vm.expectRevert(Errors.InvalidParam.selector); + rebalancer.setMaxSlippage(yieldBearingAsset, 1e9); + } + + function test_RevertWhen_SetMaxSlippageNotGuardian() public { + vm.prank(alice); + vm.expectRevert(abi.encodeWithSelector(Errors.AccessManagedUnauthorized.selector, alice)); + rebalancer.setMaxSlippage(yieldBearingAsset, 1e7); + } +} + + +contract Test_Rebalancer_ResidualInput is Fixture { + GenericRebalancer internal rebalancer; + MockRouter internal router; + MockFlashLoan internal lender; + + function setUp() public override { + super.setUp(); + + router = new MockRouter(); + lender = new MockFlashLoan(); + rebalancer = new GenericRebalancer( + address(router), + address(router), + tokenP, + parallelizer, + address(accessManager), + IERC3156FlashLender(address(lender)) + ); + + vm.startPrank(governor); + accessManager.setTargetFunctionRole( + address(rebalancer), getGuardianBaseRebalancerSelectorAccess(), GUARDIAN_ROLE + ); + accessManager.grantRole(GUARDIAN_ROLE, guardian, 0); + vm.stopPrank(); + + // eurY is the yield bearing asset, eurA its underlying. Target exposure well below the live one + // so the rebalance decreases eurY and the router leg runs with eurY as the input. + vm.startPrank(guardian); + rebalancer.toggleTrusted(alice); + rebalancer.setYieldBearingAssetData(address(eurY), address(eurA), 2e8, 1e7, 9e8, 1, 5e8); + vm.stopPrank(); + + _mintCollateral(address(eurY), 100_000 ether); + _mintCollateral(address(eurA), 1000 * BASE_6); + + // The router needs the output leg to hand back, and alice a budget to settle against + deal(address(eurA), address(router), 1_000_000 * BASE_6); + deal(address(tokenP), alice, 100_000 ether); + vm.startPrank(alice); + IERC20(address(tokenP)).approve(address(rebalancer), type(uint256).max); + rebalancer.addBudget(50_000 ether, alice); + vm.stopPrank(); + } + + function _mintCollateral(address collateral, uint256 amount) internal { + deal(collateral, governor, amount); + vm.startPrank(governor); + IERC20(collateral).approve(address(parallelizer), amount); + parallelizer.swapExactInput(amount, 0, collateral, address(tokenP), governor, block.timestamp + 1 hours); + vm.stopPrank(); + } + + /// @dev The route consumes less input than it was offered: the remainder must come back rather + /// than sit on the rebalancer, and no router allowance may survive the call. + function test_Harvest_ReturnsInputTheRouteDidNotConsume() public { + uint256 consumed = 1 ether; + bytes memory swapData = abi.encodeWithSelector( + MockRouter.swap.selector, consumed, address(eurY), 5000 * BASE_6, address(eurA) + ); + + uint256 budgetBefore = rebalancer.budget(alice); + + vm.prank(alice); + rebalancer.harvest(address(eurY), 1e7, abi.encode(SwapType.SWAP, swapData)); + + assertEq(IERC20(address(eurY)).balanceOf(address(rebalancer)), 0, "input left stranded on the rebalancer"); + assertEq(IERC20(address(eurY)).allowance(address(rebalancer), address(router)), 0, "router allowance survived"); + // The recovered input settles with the operation, so the surplus reaches the initiating caller + assertGt(rebalancer.budget(alice), budgetBefore, "settlement surplus not credited"); + } +} + + +contract Test_Rebalancer_Allowances is Fixture { + MultiBlockRebalancer internal rebalancer; + + function setUp() public override { + super.setUp(); + + rebalancer = new MultiBlockRebalancer(address(accessManager), tokenP, parallelizer); + + vm.startPrank(governor); + accessManager.setTargetFunctionRole( + address(rebalancer), getGuardianBaseRebalancerSelectorAccess(), GUARDIAN_ROLE + ); + accessManager.setTargetFunctionRole( + address(rebalancer), getGovernorMultiBlockRebalancerSelectorAccess(), GOVERNOR_ROLE + ); + accessManager.grantRole(GUARDIAN_ROLE, guardian, 0); + vm.stopPrank(); + + vm.prank(guardian); + rebalancer.setYieldBearingAssetData(address(eurY), address(eurA), 5e8, 1e8, 9e8, 1, 5e7); + } + + /// @dev Stands in for the unlimited allowance a previous rebalance would have granted + function _seedAllowance(address token, address spender) internal { + vm.prank(address(rebalancer)); + IERC20(token).approve(spender, type(uint256).max); + assertEq(IERC20(token).allowance(address(rebalancer), spender), type(uint256).max); + } + + function test_RotatingTheAsset_RevokesTheOutgoingAllowance() public { + _seedAllowance(address(eurA), address(eurY)); + + vm.prank(guardian); + rebalancer.setYieldBearingAssetData(address(eurY), address(eurB), 5e8, 1e8, 9e8, 1, 5e7); + + assertEq(IERC20(address(eurA)).allowance(address(rebalancer), address(eurY)), 0); + } + + function test_RotatingTheAsset_KeepsTheAllowanceWhenAssetIsUnchanged() public { + _seedAllowance(address(eurA), address(eurY)); + + vm.prank(guardian); + rebalancer.setYieldBearingAssetData(address(eurY), address(eurA), 4e8, 1e8, 9e8, 1, 5e7); + + assertEq(IERC20(address(eurA)).allowance(address(rebalancer), address(eurY)), type(uint256).max); + } + + function test_RotatingTheAsset_RevokesTheDepositAddressAllowance() public { + vm.prank(governor); + rebalancer.setYieldBearingToDepositAddress(address(eurY), bob); + _seedAllowance(address(eurA), bob); + + vm.prank(guardian); + rebalancer.setYieldBearingAssetData(address(eurY), address(eurB), 5e8, 1e8, 9e8, 1, 5e7); + + assertEq(IERC20(address(eurA)).allowance(address(rebalancer), bob), 0); + } + + function test_RotatingTheDepositAddress_RevokesTheOutgoingAllowance() public { + vm.prank(governor); + rebalancer.setYieldBearingToDepositAddress(address(eurY), bob); + _seedAllowance(address(eurA), bob); + + vm.prank(governor); + rebalancer.setYieldBearingToDepositAddress(address(eurY), charlie); + + assertEq(IERC20(address(eurA)).allowance(address(rebalancer), bob), 0); + } + + function test_ResetAllowance() public { + _seedAllowance(address(eurA), bob); + + vm.prank(guardian); + rebalancer.resetAllowance(address(eurA), bob); + + assertEq(IERC20(address(eurA)).allowance(address(rebalancer), bob), 0); + } + + function test_RevertWhen_ResetAllowanceNotGuardian() public { + vm.prank(alice); + vm.expectRevert(abi.encodeWithSelector(Errors.AccessManagedUnauthorized.selector, alice)); + rebalancer.resetAllowance(address(eurA), bob); + } +} + + +contract Test_Rebalancer_FlashLoanFee is Fixture { + GenericRebalancer internal rebalancer; + MockRouter internal router; + MockFlashLoan internal lender; + + function setUp() public override { + super.setUp(); + + router = new MockRouter(); + lender = new MockFlashLoan(); + rebalancer = new GenericRebalancer( + address(router), + address(router), + tokenP, + parallelizer, + address(accessManager), + IERC3156FlashLender(address(lender)) + ); + + vm.startPrank(governor); + accessManager.setTargetFunctionRole( + address(rebalancer), getGuardianBaseRebalancerSelectorAccess(), GUARDIAN_ROLE + ); + accessManager.grantRole(GUARDIAN_ROLE, guardian, 0); + vm.stopPrank(); + + vm.startPrank(guardian); + rebalancer.toggleTrusted(alice); + rebalancer.setYieldBearingAssetData(address(eurY), address(eurA), 2e8, 1e7, 9e8, 1, 5e8); + vm.stopPrank(); + + _mintCollateral(address(eurY), 100_000 ether); + _mintCollateral(address(eurA), 1000 * BASE_6); + + deal(address(eurA), address(router), 1_000_000 * BASE_6); + deal(address(tokenP), alice, 100_000 ether); + vm.startPrank(alice); + IERC20(address(tokenP)).approve(address(rebalancer), type(uint256).max); + rebalancer.addBudget(50_000 ether, alice); + vm.stopPrank(); + } + + function _mintCollateral(address collateral, uint256 amount) internal { + deal(collateral, governor, amount); + vm.startPrank(governor); + IERC20(collateral).approve(address(parallelizer), amount); + parallelizer.swapExactInput(amount, 0, collateral, address(tokenP), governor, block.timestamp + 1 hours); + vm.stopPrank(); + } + + function _harvest() internal { + bytes memory swapData = + abi.encodeWithSelector(MockRouter.swap.selector, 1 ether, address(eurY), 5000 * BASE_6, address(eurA)); + vm.prank(alice); + rebalancer.harvest(address(eurY), 1e7, abi.encode(SwapType.SWAP, swapData)); + } + + /// @dev A lender charging a fee must not lock the rebalancer out of its only rebalance path + function test_Harvest_SucceedsWithANonZeroFee() public { + lender.setFeeRateBps(5); + + _harvest(); + + assertGt(lender.flashFee(address(tokenP), 1 ether), 0, "fee rate produced no fee"); + } + + /// @dev The fee is settled out of the budget of the address that asked for the rebalance + function test_Harvest_ChargesTheFeeToTheCallerBudget() public { + uint256 snapshot = vm.snapshotState(); + + _harvest(); + uint256 budgetWithoutFee = rebalancer.budget(alice); + + vm.revertToState(snapshot); + + lender.setFeeRateBps(5); + _harvest(); + uint256 budgetWithFee = rebalancer.budget(alice); + + assertLt(budgetWithFee, budgetWithoutFee, "fee was not charged"); + // The lender kept exactly what it was owed on top of the principal + assertEq( + budgetWithoutFee - budgetWithFee, + IERC20(address(tokenP)).balanceOf(address(lender)), + "budget delta does not match the fee the lender collected" + ); + } + + /// @dev A fee the caller cannot cover fails the rebalance rather than dipping into other budgets + function test_RevertWhen_FeeExceedsTheCallerBudget() public { + // The ceiling FlashParallelToken allows governance to set + lender.setFeeRateBps(1e4); + uint256 drained = rebalancer.budget(alice) - 1 ether; + vm.prank(alice); + rebalancer.removeBudget(drained, alice); + + // A route that clears `minAmountOut` but leaves nothing spare to absorb the fee + bytes memory swapData = + abi.encodeWithSelector(MockRouter.swap.selector, 1 ether, address(eurY), 500 * BASE_6, address(eurA)); + vm.prank(alice); + vm.expectRevert(stdError.arithmeticError); + rebalancer.harvest(address(eurY), 1e7, abi.encode(SwapType.SWAP, swapData)); + } +} diff --git a/tests/units/RedemptionTokenBinding.t.sol b/tests/units/RedemptionTokenBinding.t.sol new file mode 100644 index 0000000..298b762 --- /dev/null +++ b/tests/units/RedemptionTokenBinding.t.sol @@ -0,0 +1,111 @@ +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity 0.8.28; + +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +import { Fixture } from "../Fixture.sol"; +import { OracleReadType } from "contracts/parallelizer/Storage.sol"; +import "contracts/utils/Constants.sol"; +import "contracts/utils/Errors.sol" as Errors; + +/// @notice The redemption output list is rebuilt from the live `collateralList`, while `minAmountOuts` +/// is positional. A revoke (swap and pop) followed by an add preserves the length but reshuffles the +/// tokens, so a caller's minima would end up guarding tokens they never quoted. +contract Test_RedemptionTokenBinding is Fixture { + uint256 internal redeemAmount; + + function setUp() public override { + super.setUp(); + + // eurB stays unbacked so governance is allowed to revoke it + _mintExactInput(alice, address(eurA), 100 * BASE_6, 0); + _mintExactInput(alice, address(eurY), 100 * BASE_18, 0); + + uint64[] memory xRedemption = new uint64[](1); + int64[] memory yRedemption = new int64[](1); + yRedemption[0] = int64(int256(BASE_9)); + hoax(guardian); + parallelizer.setRedemptionCurveParams(xRedemption, yRedemption); + + redeemAmount = tokenP.balanceOf(alice) / 4; + } + + function _tokensHash() internal view returns (bytes32) { + (address[] memory tokens,) = parallelizer.quoteRedemptionCurve(redeemAmount); + return keccak256(abi.encodePacked(tokens)); + } + + /// @dev Revoking eurB pops eurY into its slot, and adding eurB back appends it: same length, + /// different order + function _rotateCollateral() internal { + ( + OracleReadType oracleType, + OracleReadType targetType, + bytes memory oracleData, + bytes memory targetData, + bytes memory hyperparameters + ) = parallelizer.getOracle(address(eurB)); + + hoax(governor); + parallelizer.revokeCollateral(address(eurB), true); + hoax(governor); + parallelizer.addCollateral(address(eurB)); + hoax(governor); + parallelizer.setOracle( + address(eurB), abi.encode(oracleType, targetType, oracleData, targetData, hyperparameters) + ); + } + + function test_Redeem_SucceedsWhenTheOutputListMatches() public { + uint256[] memory minAmountOuts = new uint256[](3); + bytes32 quotedHash = _tokensHash(); + + vm.prank(alice); + (address[] memory tokens,) = + parallelizer.redeem(redeemAmount, alice, block.timestamp + 1 days, minAmountOuts, quotedHash); + + assertEq(tokens.length, 3); + } + + function test_RevertWhen_CollateralRotationReordersTheOutputList() public { + bytes32 quotedHash = _tokensHash(); + (address[] memory quotedTokens,) = parallelizer.quoteRedemptionCurve(redeemAmount); + + _rotateCollateral(); + + (address[] memory liveTokens,) = parallelizer.quoteRedemptionCurve(redeemAmount); + assertEq(liveTokens.length, quotedTokens.length, "the rotation must preserve the length"); + assertNotEq(liveTokens[1], quotedTokens[1], "the rotation must reorder the list"); + + uint256[] memory minAmountOuts = new uint256[](3); + vm.prank(alice); + vm.expectRevert(Errors.UnexpectedRedemptionTokens.selector); + parallelizer.redeem(redeemAmount, alice, block.timestamp + 1 days, minAmountOuts, quotedHash); + } + + /// @dev A signature stays executable for its whole validity window, so a relayer could otherwise + /// hold one until governance reshuffles the list + function test_RevertWhen_AuthorizationOutlivesTheOutputList() public { + uint256 deadline = block.timestamp + 1 hours; + uint256[] memory minOuts = new uint256[](3); + address[] memory forfeit = new address[](0); + bytes32 quotedHash = _tokensHash(); + + bytes memory authData = + _buildRedeemAuth(1, alice, redeemAmount, alice, deadline, minOuts, forfeit, quotedHash, bytes32("rotate")); + + _rotateCollateral(); + + // The relayer cannot satisfy the on-chain check with what was signed + vm.prank(bob); + vm.expectRevert(Errors.UnexpectedRedemptionTokens.selector); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, quotedHash, authData); + + // Nor swap in the live list, which no longer derives the signed nonce + bytes32 liveHash = _tokensHash(); + vm.prank(bob); + vm.expectRevert(bytes("invalid signature")); + parallelizer.redeemWithAuthorization(redeemAmount, alice, deadline, minOuts, forfeit, liveHash, authData); + } +} diff --git a/tests/units/RewardHandlerTest.t.sol b/tests/units/RewardHandlerTest.t.sol index 03558cc..33276d5 100644 --- a/tests/units/RewardHandlerTest.t.sol +++ b/tests/units/RewardHandlerTest.t.sol @@ -6,7 +6,7 @@ import { IERC20 } from "@openzeppelin/contracts/interfaces/IERC20.sol"; import { stdError } from "@forge-std/Test.sol"; -import { MockOdosRouter } from "tests/mock/MockOdosRouter.sol"; +import { MockSwapRouter } from "tests/mock/MockSwapRouter.sol"; import { MockTokenPermit } from "tests/mock/MockTokenPermit.sol"; import "contracts/parallelizer/Storage.sol"; @@ -17,19 +17,18 @@ import "../Fixture.sol"; contract RewardHandlerTest is Fixture { event RewardsSoldFor(address indexed tokenObtained, uint256 balanceUpdate); - MockOdosRouter odos; + MockSwapRouter router; IERC20 tokenA; IERC20 tokenB; function setUp() public override { super.setUp(); - odos = MockOdosRouter(ODOS_ROUTER); - tokenA = IERC20(address(new MockTokenPermit("tokenA", "tokenA", 18))); tokenB = IERC20(address(new MockTokenPermit("tokenA", "tokenA", 9))); - MockOdosRouter tempRouter = new MockOdosRouter(); - vm.etch(address(odos), address(tempRouter).code); + router = new MockSwapRouter(); + hoax(governor); + parallelizer.setSwapRouter(address(router)); } function test_RevertWhen_SellRewards_NotTrusted() public { @@ -42,7 +41,7 @@ contract RewardHandlerTest is Fixture { function test_RevertWhen_SellRewards_NoApproval() public { vm.startPrank(guardian); bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); vm.expectRevert(); parallelizer.sellRewards(0, payload); vm.stopPrank(); @@ -50,12 +49,12 @@ contract RewardHandlerTest is Fixture { function test_RevertWhen_SellRewards_NoIncrease() public { bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); vm.startPrank(governor); deal(address(tokenA), address(parallelizer), 100); - deal(address(tokenB), address(odos), 100); - parallelizer.changeAllowance(tokenA, address(odos), 100); + deal(address(tokenB), address(router), 100); + parallelizer.changeAllowance(tokenA, address(router), 100); vm.expectRevert(Errors.InvalidSwap.selector); parallelizer.sellRewards(0, payload); vm.stopPrank(); @@ -63,12 +62,12 @@ contract RewardHandlerTest is Fixture { function test_RevertWhen_SellRewards_TooSmallAmountOut() public { bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenA), address(eurA)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenA), address(eurA)); vm.startPrank(governor); deal(address(tokenA), address(parallelizer), 100); - deal(address(eurA), address(odos), 100); - parallelizer.changeAllowance(tokenA, address(odos), 100); + deal(address(eurA), address(router), 100); + parallelizer.changeAllowance(tokenA, address(router), 100); vm.expectRevert(Errors.TooSmallAmountOut.selector); parallelizer.sellRewards(1000, payload); vm.stopPrank(); @@ -76,39 +75,39 @@ contract RewardHandlerTest is Fixture { function test_RevertWhen_SellRewards_EmptyErrorMessage() public { bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); vm.startPrank(governor); deal(address(tokenA), address(parallelizer), 100); - deal(address(tokenB), address(odos), 100); - parallelizer.changeAllowance(tokenA, address(odos), 100); - odos.setRevertStatuses(true, false); - vm.expectRevert(Errors.OdosSwapFailed.selector); + deal(address(tokenB), address(router), 100); + parallelizer.changeAllowance(tokenA, address(router), 100); + router.setRevertStatuses(true, false); + vm.expectRevert(Errors.RewardSwapFailed.selector); parallelizer.sellRewards(0, payload); vm.stopPrank(); } function test_RevertWhen_SellRewards_ErrorMessage() public { bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenA), address(tokenB)); vm.startPrank(governor); deal(address(tokenA), address(parallelizer), 100); - deal(address(tokenB), address(odos), 100); - parallelizer.changeAllowance(tokenA, address(odos), 100); - odos.setRevertStatuses(false, true); + deal(address(tokenB), address(router), 100); + parallelizer.changeAllowance(tokenA, address(router), 100); + router.setRevertStatuses(false, true); vm.expectRevert("wrong swap"); parallelizer.sellRewards(0, payload); vm.stopPrank(); } function test_RevertWhen_SellRewards_InvalidSwapBecauseTokenSold() public { - bytes memory payload = abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(eurA), address(eurB)); + bytes memory payload = abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(eurA), address(eurB)); vm.startPrank(governor); deal(address(eurA), address(parallelizer), 100); - deal(address(eurB), address(odos), 100); - parallelizer.changeAllowance(eurA, address(odos), 100); + deal(address(eurB), address(router), 100); + parallelizer.changeAllowance(eurA, address(router), 100); vm.expectRevert(Errors.InvalidSwap.selector); parallelizer.sellRewards(0, payload); vm.stopPrank(); @@ -116,12 +115,12 @@ contract RewardHandlerTest is Fixture { function test_SellRewards_WithOneTokenIncrease() public { bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenA), address(eurA)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenA), address(eurA)); vm.startPrank(governor); deal(address(tokenA), address(parallelizer), 100); - deal(address(eurA), address(odos), 100); - parallelizer.changeAllowance(tokenA, address(odos), 100); + deal(address(eurA), address(router), 100); + parallelizer.changeAllowance(tokenA, address(router), 100); vm.expectEmit(address(parallelizer)); emit RewardsSoldFor(address(eurA), 100); parallelizer.sellRewards(0, payload); @@ -130,12 +129,12 @@ contract RewardHandlerTest is Fixture { function test_RevertWhen_SellRewards_TokenPSold() public { bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenP), address(eurA)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenP), address(eurA)); vm.startPrank(governor); deal(address(tokenP), address(parallelizer), 100); - deal(address(eurA), address(odos), 100); - parallelizer.changeAllowance(IERC20(address(tokenP)), address(odos), 100); + deal(address(eurA), address(router), 100); + parallelizer.changeAllowance(IERC20(address(tokenP)), address(router), 100); vm.expectRevert(Errors.InvalidTokens.selector); parallelizer.sellRewards(0, payload); vm.stopPrank(); @@ -143,14 +142,14 @@ contract RewardHandlerTest is Fixture { function test_SellRewards_WithOneTokenIncreaseAndTrusted() public { bytes memory payload = - abi.encodeWithSelector(MockOdosRouter.swap.selector, 100, 100, address(tokenA), address(eurA)); + abi.encodeWithSelector(MockSwapRouter.swap.selector, 100, 100, address(tokenA), address(eurA)); vm.startPrank(governor); parallelizer.toggleTrusted(alice, TrustedType.Seller); - parallelizer.changeAllowance(tokenA, address(odos), 100); + parallelizer.changeAllowance(tokenA, address(router), 100); vm.stopPrank(); deal(address(tokenA), address(parallelizer), 100); - deal(address(eurA), address(odos), 100); + deal(address(eurA), address(router), 100); vm.expectEmit(address(parallelizer)); emit RewardsSoldFor(address(eurA), 100); @@ -158,3 +157,38 @@ contract RewardHandlerTest is Fixture { parallelizer.sellRewards(0, payload); } } + +contract Test_SwapRouter is Fixture { + event SwapRouterUpdated(address indexed swapRouter); + + function test_SetSwapRouter_UpdatesTheLiveRouter() public { + assertEq(parallelizer.getSwapRouter(), address(0), "no router before governance sets one"); + + vm.expectEmit(address(parallelizer)); + emit SwapRouterUpdated(bob); + hoax(governor); + parallelizer.setSwapRouter(bob); + + assertEq(parallelizer.getSwapRouter(), bob); + } + + function test_RevertWhen_SetSwapRouterIsZero() public { + hoax(governor); + vm.expectRevert(Errors.ZeroAddress.selector); + parallelizer.setSwapRouter(address(0)); + } + + function test_RevertWhen_SetSwapRouterNotGovernor() public { + hoax(guardian); + vm.expectRevert(abi.encodeWithSelector(Errors.AccessManagedUnauthorized.selector, guardian)); + parallelizer.setSwapRouter(bob); + } + + /// @dev A raw call to address zero would report success and leave the swap silently unperformed + function test_RevertWhen_SellRewardsBeforeARouterIsSet() public { + bytes memory payload; + hoax(governor); + vm.expectRevert(Errors.ZeroAddress.selector); + parallelizer.sellRewards(0, payload); + } +} diff --git a/tests/units/Setters.t.sol b/tests/units/Setters.t.sol index fe542bc..efddb50 100644 --- a/tests/units/Setters.t.sol +++ b/tests/units/Setters.t.sol @@ -80,10 +80,12 @@ contract Test_Setters_Pause is Fixture { assert(parallelizer.isPaused(address(eurA), ActionType.Redeem)); vm.expectRevert(Errors.Paused.selector); - parallelizer.redeem(1 ether, alice, block.timestamp + 10, new uint256[](3)); + parallelizer.redeem(1 ether, alice, block.timestamp + 10, new uint256[](3), bytes32(0)); vm.expectRevert(Errors.Paused.selector); - parallelizer.redeemWithForfeit(1 ether, alice, block.timestamp + 10, new uint256[](3), new address[](0)); + parallelizer.redeemWithForfeit( + 1 ether, alice, block.timestamp + 10, new uint256[](3), new address[](0), bytes32(0) + ); } } @@ -1526,6 +1528,32 @@ contract Test_Setters_UpdatePayees is Fixture { assertEq(parallelizer.getTotalShares(), 3 ether); } + /// @dev Bailsec Core Issue_19: a share allocated to the Parallelizer is handed back to `release` + /// as fresh income on the next call, so it recursively redistributes itself + function test_RevertWhen_PayeeIsTheParallelizer() public { + address[] memory payees = new address[](1); + payees[0] = address(parallelizer); + uint256[] memory shares = new uint256[](1); + shares[0] = 1 ether; + + hoax(governor); + vm.expectRevert(Errors.InvalidPayee.selector); + parallelizer.updatePayees(payees, shares, false); + } + + /// @dev `address(0)` is the sentinel `LibSurplus` uses to burn a share, so it stays valid + function test_PayeeCanBeZeroAddress() public { + address[] memory payees = new address[](1); + payees[0] = address(0); + uint256[] memory shares = new uint256[](1); + shares[0] = 1 ether; + + hoax(governor); + parallelizer.updatePayees(payees, shares, false); + + assertEq(parallelizer.getShares(address(0)), 1 ether); + } + modifier initializePayees() { address[] memory payees = new address[](1); payees[0] = address(alice); diff --git a/tests/units/UserDeviation.t.sol b/tests/units/UserDeviation.t.sol new file mode 100644 index 0000000..9fa944e --- /dev/null +++ b/tests/units/UserDeviation.t.sol @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: BUSL-1.1 + +pragma solidity 0.8.28; + +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { console } from "@forge-std/console.sol"; + +import { MockChainlinkOracle } from "../mock/MockChainlinkOracle.sol"; +import { Fixture } from "../Fixture.sol"; +import { OracleReadType } from "contracts/parallelizer/Storage.sol"; +import "contracts/utils/Constants.sol"; +import "contracts/utils/Errors.sol" as Errors; + +/// @notice Bailsec Core Issue_22. `userDeviation` snaps a spot inside its band up to the target for +/// both mint and burn, so a collateral bought at a discount mints at face value. The band is also +/// what keeps ordinary oracle noise from tripping the burn firewall, which is why zeroing it is not +/// the answer. +contract Test_UserDeviation is Fixture { + function _oracleConfig( + address collateral, + uint128 userDeviation, + uint128 burnRatioDeviation + ) + internal + view + returns (bytes memory) + { + (OracleReadType oracleType, OracleReadType targetType, bytes memory oracleData, bytes memory targetData,) = + parallelizer.getOracle(collateral); + return abi.encode(oracleType, targetType, oracleData, targetData, abi.encode(userDeviation, burnRatioDeviation)); + } + + function _setDeviations(address collateral, uint128 userDeviation, uint128 burnRatioDeviation) internal { + bytes memory config = _oracleConfig(collateral, userDeviation, burnRatioDeviation); + hoax(governor); + parallelizer.setOracle(collateral, config); + } + + /// @dev eurA quoted `bps` basis points under its target + function _discountEurA(uint256 bps) internal { + MockChainlinkOracle(address(oracleA)).setLatestAnswer(int256((BASE_8 * (10_000 - bps)) / 10_000)); + } + + function _mintValue(uint256 amountIn) internal returns (uint256 tokenPOut) { + deal(address(eurA), alice, amountIn); + vm.startPrank(alice); + IERC20(address(eurA)).approve(address(parallelizer), amountIn); + uint256 before = tokenP.balanceOf(alice); + parallelizer.swapExactInput(amountIn, 0, address(eurA), address(tokenP), alice, block.timestamp + 1 days); + tokenPOut = tokenP.balanceOf(alice) - before; + vm.stopPrank(); + } + + /// @dev `setOracle` refuses a snap band wider than the firewall band, which is exactly the + /// pairing two mainnet collaterals carry today. They predate the check, and `DiamondInitializer` + /// routes through the same `setOracle`, so the current config would not deploy. + function test_SetOracle_RejectsTheLiveMainnetPairing() public { + bytes memory config = _oracleConfig(address(eurA), 5e14, 0); + hoax(governor); + vm.expectRevert(Errors.InvalidParams.selector); + parallelizer.setOracle(address(eurA), config); + } + + /// @dev Moving the same tolerance to the burn side prices the mint at the true spot, so the + /// discount is no longer captured + function test_ToleranceOnTheBurnSide_PricesTheMintCorrectly() public { + _setDeviations(address(eurA), 0, 5e14); + + uint256 snap = vm.snapshotState(); + uint256 atPeg = _mintValue(10_000 * BASE_6); + vm.revertToState(snap); + + _discountEurA(4); + uint256 discounted = _mintValue(10_000 * BASE_6); + + console.log("userDeviation 0, burnRatioDeviation 5bps"); + console.log(" tokenP minted at peg ", atPeg); + console.log(" tokenP minted 4 bps under peg ", discounted); + console.log(" shortfall carried by the minter ", atPeg - discounted); + assertLt(discounted, atPeg, "the discount must reach the minter, not the protocol"); + // the shortfall tracks the 4 bps discount rather than being absorbed by the reserve + assertApproxEqRel(atPeg - discounted, (atPeg * 4) / 10_000, 0.02e18, "shortfall should track the spot"); + } + + /// @dev And the burn firewall still tolerates the same noise, so nothing is lost by the move + function test_ToleranceOnTheBurnSide_StillAbsorbsOracleNoise() public { + _setDeviations(address(eurA), 0, 5e14); + _discountEurA(4); + + (,, uint256 ratio,,) = parallelizer.getOracleValues(address(eurA)); + console.log("burn ratio with a 4 bps depeg, tolerance on the burn side", ratio); + assertEq(ratio, BASE_18, "a 4 bps wobble must not haircut every burn"); + + // past the band the firewall engages as intended + _discountEurA(20); + (,, ratio,,) = parallelizer.getOracleValues(address(eurA)); + console.log("burn ratio with a 20 bps depeg", ratio); + assertLt(ratio, BASE_18, "a real depeg must still haircut burns"); + } +} diff --git a/tests/utils/ConfigAccessManager.sol b/tests/utils/ConfigAccessManager.sol index 13c08ee..8359831 100644 --- a/tests/utils/ConfigAccessManager.sol +++ b/tests/utils/ConfigAccessManager.sol @@ -7,9 +7,9 @@ import { UUPSUpgradeable } from "@openzeppelin/contracts/proxy/utils/UUPSUpgrade import { Savings } from "contracts/savings/Savings.sol"; import { SavingsNameable } from "contracts/savings/nameable/SavingsNameable.sol"; import { BaseSavings } from "contracts/savings/BaseSavings.sol"; -import { BaseHarvester } from "contracts/helpers/BaseHarvester.sol"; -import { MultiBlockHarvester } from "contracts/helpers/MultiBlockHarvester.sol"; -import { GenericHarvester } from "contracts/helpers/GenericHarvester.sol"; +import { BaseRebalancer } from "contracts/helpers/BaseRebalancer.sol"; +import { MultiBlockRebalancer } from "contracts/helpers/MultiBlockRebalancer.sol"; +import { GenericRebalancer } from "contracts/helpers/GenericRebalancer.sol"; import { SettersGuardian } from "contracts/parallelizer/facets/SettersGuardian.sol"; import { SettersGovernor } from "contracts/parallelizer/facets/SettersGovernor.sol"; import { DiamondEtherscan } from "contracts/parallelizer/facets/DiamondEtherscan.sol"; @@ -62,26 +62,27 @@ abstract contract ConfigAccessManager is Helper { return selectors; } - function getGuardianBaseHarvesterSelectorAccess() internal pure returns (bytes4[] memory) { - bytes4[] memory selectors = new bytes4[](5); - selectors[0] = BaseHarvester.setYieldBearingAssetData.selector; - selectors[1] = BaseHarvester.setMaxSlippage.selector; - selectors[2] = BaseHarvester.toggleTrusted.selector; - selectors[3] = BaseHarvester.recoverERC20.selector; - selectors[4] = BaseHarvester.setTargetExposure.selector; + function getGuardianBaseRebalancerSelectorAccess() internal pure returns (bytes4[] memory) { + bytes4[] memory selectors = new bytes4[](6); + selectors[0] = BaseRebalancer.setYieldBearingAssetData.selector; + selectors[1] = BaseRebalancer.setMaxSlippage.selector; + selectors[2] = BaseRebalancer.toggleTrusted.selector; + selectors[3] = BaseRebalancer.recoverERC20.selector; + selectors[4] = BaseRebalancer.setTargetExposure.selector; + selectors[5] = BaseRebalancer.resetAllowance.selector; return selectors; } - function getGovernorMultiBlockHarvesterSelectorAccess() internal pure returns (bytes4[] memory) { + function getGovernorMultiBlockRebalancerSelectorAccess() internal pure returns (bytes4[] memory) { bytes4[] memory selectors = new bytes4[](1); - selectors[0] = MultiBlockHarvester.setYieldBearingToDepositAddress.selector; + selectors[0] = MultiBlockRebalancer.setYieldBearingToDepositAddress.selector; return selectors; } - function getGovernorGenericHarvesterSelectorAccess() internal pure returns (bytes4[] memory) { + function getGovernorGenericRebalancerSelectorAccess() internal pure returns (bytes4[] memory) { bytes4[] memory selectors = new bytes4[](2); - selectors[0] = GenericHarvester.setTokenTransferAddress.selector; - selectors[1] = GenericHarvester.setSwapRouter.selector; + selectors[0] = GenericRebalancer.setTokenTransferAddress.selector; + selectors[1] = GenericRebalancer.setSwapRouter.selector; return selectors; } @@ -98,7 +99,7 @@ abstract contract ConfigAccessManager is Helper { } function getParallelizerGovernorSelectorAccess() internal pure returns (bytes4[] memory) { - bytes4[] memory selectors = new bytes4[](14); + bytes4[] memory selectors = new bytes4[](15); selectors[0] = SettersGovernor.recoverERC20.selector; selectors[1] = SettersGovernor.setAccessManager.selector; selectors[2] = SettersGovernor.setCollateralManager.selector; @@ -113,6 +114,7 @@ abstract contract ConfigAccessManager is Helper { selectors[11] = SettersGovernor.updatePayees.selector; selectors[12] = SettersGovernor.updateSlippageTolerance.selector; selectors[13] = SettersGovernor.updateSurplusBufferRatio.selector; + selectors[14] = SettersGovernor.setSwapRouter.selector; return selectors; }