From 23b7ba303a2beeb81c8b0c52b7756f8714c4c113 Mon Sep 17 00:00:00 2001 From: kopy-kat Date: Sun, 10 Nov 2024 21:54:54 +0700 Subject: [PATCH] feat: export policies --- foundry.toml | 1 + src/Modules.sol | 4 ++++ test/integrations/SwapTest.t.sol | 18 ------------------ 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/foundry.toml b/foundry.toml index 7b6ba378..177e84f7 100644 --- a/foundry.toml +++ b/foundry.toml @@ -13,6 +13,7 @@ verbosity = 3 [rpc_endpoints] mainnet = "${MAINNET_RPC_URL}" +testnet = "${TESTNET_RPC_URL}" [fmt] bracket_spacing = true diff --git a/src/Modules.sol b/src/Modules.sol index 57c90d62..38adbb58 100644 --- a/src/Modules.sol +++ b/src/Modules.sol @@ -17,3 +17,7 @@ import { import { ERC7484RegistryAdapter } from "module-bases/ERC7484RegistryAdapter.sol"; import { ERC7579ModuleBase } from "module-bases/ERC7579ModuleBase.sol"; import { TrustedForwarder } from "module-bases/utils/TrustedForwarder.sol"; +import { ERC1271Policy } from "module-bases/ERC1271Policy.sol"; +import { ERC7579ActionPolicy } from "module-bases/ERC7579ActionPolicy.sol"; +import { ERC7579PolicyBase } from "module-bases/ERC7579PolicyBase.sol"; +import { ERC7579UserOpPolicy } from "module-bases/ERC7579UserOpPolicy.sol"; diff --git a/test/integrations/SwapTest.t.sol b/test/integrations/SwapTest.t.sol index a4458df8..d23cf406 100644 --- a/test/integrations/SwapTest.t.sol +++ b/test/integrations/SwapTest.t.sol @@ -52,17 +52,12 @@ contract TestUniswap is BaseTest { function testApproveAndSwap() public { address poolAddress = UniswapV3Integration.getPoolAddress(address(tokenA), address(tokenB)); uint160 sqrtPriceX96 = UniswapV3Integration.getSqrtPriceX96(poolAddress); - emit log_named_uint("Square Root Price X96", sqrtPriceX96); uint256 priceRatio = UniswapV3Integration.sqrtPriceX96toPriceRatio(sqrtPriceX96); - emit log_named_uint("Price Ratio", priceRatio); - uint256 price = UniswapV3Integration.priceRatioToPrice(priceRatio, poolAddress, address(tokenA)); - emit log_named_uint("Price", price); - bool swapToken0to1 = UniswapV3Integration.checkTokenOrder(address(tokenA), poolAddress); uint256 priceRatioLimit; @@ -72,23 +67,14 @@ contract TestUniswap is BaseTest { priceRatioLimit = (priceRatio * (1000 + slippage)) / 1000; } - emit log_named_uint("Price Ratio Limit", priceRatioLimit); - uint256 priceLimit = UniswapV3Integration.priceRatioToPrice(priceRatioLimit, poolAddress, address(tokenA)); - emit log_named_uint("Price Limit", priceLimit); - uint160 sqrtPriceLimitX96 = UniswapV3Integration.priceRatioToSqrtPriceX96(priceRatioLimit); - emit log_named_uint("sqrtPriceLimitX96", sqrtPriceLimitX96); - uint256 initialAccountBalanceA = tokenA.balanceOf(instance.account); uint256 initialAccountBalanceB = tokenB.balanceOf(instance.account); - emit log_named_uint("Initial Balance of Token A (account)", initialAccountBalanceA); - emit log_named_uint("Initial Balance of Token B (account)", initialAccountBalanceB); - Execution[] memory swap = UniswapV3Integration.approveAndSwap( instance.account, tokenA, tokenB, amountIn, sqrtPriceLimitX96 ); @@ -104,11 +90,7 @@ contract TestUniswap is BaseTest { uint256 finalAccountBalanceA = tokenA.balanceOf(instance.account); uint256 finalAccountBalanceB = tokenB.balanceOf(instance.account); - emit log_named_uint("Final Balance of Token A (account)", finalAccountBalanceA); - emit log_named_uint("Final Balance of Token B (account)", finalAccountBalanceB); - sqrtPriceX96 = UniswapV3Integration.getSqrtPriceX96(poolAddress); - emit log_named_uint("Post Swap Square Root Price X96", sqrtPriceX96); require( finalAccountBalanceA < initialAccountBalanceA,