From 7fc869d48ee84dfcca6242bc9582eabae5a906c0 Mon Sep 17 00:00:00 2001 From: livingrockrises <90545960+livingrockrises@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:45:17 +0530 Subject: [PATCH] more logs+fix tokenprice in base test --- contracts/token/BiconomyTokenPaymaster.sol | 3 +++ test/unit/concrete/TestTokenPaymaster.Base.t.sol | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/contracts/token/BiconomyTokenPaymaster.sol b/contracts/token/BiconomyTokenPaymaster.sol index 26e7cbb..1f41c92 100644 --- a/contracts/token/BiconomyTokenPaymaster.sol +++ b/contracts/token/BiconomyTokenPaymaster.sol @@ -584,9 +584,12 @@ contract BiconomyTokenPaymaster is // Calculate price by using token and native oracle uint192 tokenPrice = _fetchPrice(tokenInfo.oracle); uint192 nativeAssetPrice = _fetchPrice(nativeAssetToUsdOracle); + console2.log("tokenPrice oracle", tokenPrice); + console2.log("nativeAssetPrice oracle", nativeAssetPrice); // Adjust to token decimals price = (nativeAssetPrice * tokenInfo.decimals) / tokenPrice; + console2.log("derived & used price", price); } /// @notice Fetches the latest price from the given oracle. diff --git a/test/unit/concrete/TestTokenPaymaster.Base.t.sol b/test/unit/concrete/TestTokenPaymaster.Base.t.sol index 84f1dfc..766c886 100644 --- a/test/unit/concrete/TestTokenPaymaster.Base.t.sol +++ b/test/unit/concrete/TestTokenPaymaster.Base.t.sol @@ -25,6 +25,10 @@ contract TestTokenPaymasterBase is TestBase { function setUp() public { uint256 forkId = vm.createFork("https://developer-access-mainnet.base.org"); vm.selectFork(forkId); + + // Set block to latest block + // vm.rollFork(21744650); + // assertEq(block.number, 21744650); setupPaymasterTestEnvironment(); console2.log("current block timestamp ", block.timestamp); @@ -82,7 +86,7 @@ contract TestTokenPaymasterBase is TestBase { vm.stopPrank(); vm.startPrank(PAYMASTER_OWNER.addr); - tokenPaymaster.setUnaccountedGas(200_000); + tokenPaymaster.setUnaccountedGas(40_000); vm.stopPrank(); uint256 initialBundlerBalance = BUNDLER.addr.balance; @@ -124,7 +128,7 @@ contract TestTokenPaymasterBase is TestBase { initialPaymasterEpBalance, initialUserTokenBalance, initialPaymasterTokenBalance, - 401606430000000, // tokenPrice + 2672598177, 100000, this.getMaxPenalty(ops[0])); }