Skip to content

Commit

Permalink
added initial oracle storage and price calc
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivaanshK committed Sep 5, 2024
1 parent 49a48b0 commit 31681cc
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 19 deletions.
10 changes: 10 additions & 0 deletions contracts/common/BiconomyTokenPaymasterErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@ contract BiconomyTokenPaymasterErrors {
* @notice Throws when invalid signature length in paymasterAndData
*/
error InvalidDynamicAdjustment();

/**
* @notice Throws when each token doesnt have a corresponding oracle
*/
error TokensAndOraclesLengthMismatch();

/**
* @notice Throws when oracle returns invalid price
*/
error OraclePriceNotPositive();
}
4 changes: 2 additions & 2 deletions contracts/interfaces/IBiconomySponsorshipPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PackedUserOperation } from "@account-abstraction/contracts/core/UserOpe

interface IBiconomySponsorshipPaymaster{
event UnaccountedGasChanged(uint256 indexed oldValue, uint256 indexed newValue);
event FixedDynamicAdjustmentChanged(uint32 indexed oldValue, uint32 indexed newValue);
event FixedDynamicAdjustmentChanged(uint256 indexed oldValue, uint256 indexed newValue);
event VerifyingSignerChanged(address indexed oldSigner, address indexed newSigner, address indexed actor);
event FeeCollectorChanged(address indexed oldFeeCollector, address indexed newFeeCollector, address indexed actor);
event GasDeposited(address indexed paymasterId, uint256 indexed value);
Expand All @@ -22,7 +22,7 @@ interface IBiconomySponsorshipPaymaster{

function setFeeCollector(address _newFeeCollector) external payable;

function setUnaccountedGas(uint16 value) external payable;
function setUnaccountedGas(uint256 value) external payable;

function withdrawERC20(IERC20 token, address target, uint256 amount) external;

Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IBiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.26;

interface IBiconomyTokenPaymaster {
event UnaccountedGasChanged(uint256 indexed oldValue, uint256 indexed newValue);
event FixedDynamicAdjustmentChanged(uint32 indexed oldValue, uint32 indexed newValue);
event FixedDynamicAdjustmentChanged(uint256 indexed oldValue, uint256 indexed newValue);
event FeeCollectorChanged(address indexed oldFeeCollector, address indexed newFeeCollector, address indexed actor);
event GasDeposited(address indexed paymasterId, uint256 indexed value);
event GasWithdrawn(address indexed paymasterId, address indexed to, uint256 indexed value);
Expand Down
10 changes: 10 additions & 0 deletions contracts/interfaces/oracles/IOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IOracle {
function decimals() external view returns (uint8);
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
15 changes: 8 additions & 7 deletions contracts/sponsorship/BiconomySponsorshipPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ contract BiconomySponsorshipPaymaster is

address public verifyingSigner;
address public feeCollector;
uint16 public unaccountedGas;
uint32 private constant PRICE_DENOMINATOR = 1e6;
uint256 public unaccountedGas;

// Denominator to prevent precision errors when applying dynamic adjustment
uint256 private constant PRICE_DENOMINATOR = 1e6;
// Offset in PaymasterAndData to get to PAYMASTER_ID_OFFSET
uint256 private constant PAYMASTER_ID_OFFSET = PAYMASTER_DATA_OFFSET;
// Limit for unaccounted gas cost
uint16 private constant UNACCOUNTED_GAS_LIMIT = 50_000;
uint256 private constant UNACCOUNTED_GAS_LIMIT = 50_000;

mapping(address => uint256) public paymasterIdBalances;

Expand All @@ -55,7 +56,7 @@ contract BiconomySponsorshipPaymaster is
IEntryPoint _entryPoint,
address _verifyingSigner,
address _feeCollector,
uint16 _unaccountedGas
uint256 _unaccountedGas
)
BasePaymaster(_owner, _entryPoint)
{
Expand Down Expand Up @@ -123,11 +124,11 @@ contract BiconomySponsorshipPaymaster is
* @param value The new value to be set as the unaccountedEPGasOverhead.
* @notice only to be called by the owner of the contract.
*/
function setUnaccountedGas(uint16 value) external payable override onlyOwner {
function setUnaccountedGas(uint256 value) external payable override onlyOwner {
if (value > UNACCOUNTED_GAS_LIMIT) {
revert UnaccountedGasTooHigh();
}
uint16 oldValue = unaccountedGas;
uint256 oldValue = unaccountedGas;
unaccountedGas = value;
emit UnaccountedGasChanged(oldValue, value);
}
Expand Down Expand Up @@ -346,7 +347,7 @@ contract BiconomySponsorshipPaymaster is
function _checkConstructorArgs(
address _verifyingSigner,
address _feeCollector,
uint16 _unaccountedGas
uint256 _unaccountedGas
)
internal
view
Expand Down
53 changes: 49 additions & 4 deletions contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ pragma solidity ^0.8.26;
import { ReentrancyGuardTransient } from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
import { IEntryPoint } from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import { PackedUserOperation, UserOperationLib } from "@account-abstraction/contracts/core/UserOperationLib.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC20, ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { SafeTransferLib } from "@solady/src/utils/SafeTransferLib.sol";
import { BasePaymaster } from "../base/BasePaymaster.sol";
import { BiconomyTokenPaymasterErrors } from "../common/BiconomyTokenPaymasterErrors.sol";
import { IBiconomyTokenPaymaster } from "../interfaces/IBiconomyTokenPaymaster.sol";
import { IOracle } from "../interfaces/oracles/IOracle.sol";
import "@account-abstraction/contracts/core/Helpers.sol";

/**
Expand All @@ -29,9 +30,17 @@ contract BiconomyTokenPaymaster is
{
using UserOperationLib for PackedUserOperation;

struct TokenInfo {
IOracle oracle;
uint8 decimals;
}

// State variables
address public feeCollector;
uint256 public unaccountedGas;
uint256 public dynamicAdjustment;
IOracle public nativeOracle; // ETH -> USD price
mapping(address => TokenInfo) tokenDirectory;

// Limit for unaccounted gas cost
uint256 private constant UNACCOUNTED_GAS_LIMIT = 50_000;
Expand All @@ -42,19 +51,30 @@ contract BiconomyTokenPaymaster is
address _owner,
IEntryPoint _entryPoint,
uint256 _unaccountedGas,
uint256 _dynamicAdjustment
uint256 _dynamicAdjustment,
IOracle _nativeOracle,
address[] memory _tokens, // Array of token addresses
IOracle[] memory _oracles // Array of corresponding oracle addresses
)
BasePaymaster(_owner, _entryPoint)
{
if (_unaccountedGas > UNACCOUNTED_GAS_LIMIT) {
revert UnaccountedGasTooHigh();
} else if (_dynamicAdjustment > MAX_DYNAMIC_ADJUSTMENT || _dynamicAdjustment == 0) {
revert InvalidDynamicAdjustment();
} else if (_tokens.length != _oracles.length) {
revert TokensAndOraclesLengthMismatch();
}
assembly ("memory-safe") {
sstore(feeCollector.slot, address()) // initialize fee collector to this contract
sstore(unaccountedGas.slot, _unaccountedGas)
sstore(dynamicAdjustment.slot, _dynamicAdjustment)
sstore(nativeOracle.slot, _nativeOracle)
}

// Populate the tokenToOracle mapping
for (uint256 i = 0; i < _tokens.length; i++) {
tokenDirectory[_tokens[i]] = TokenInfo(_oracles[i], ERC20(_tokens[i]).decimals());
}
}

Expand Down Expand Up @@ -211,8 +231,7 @@ contract BiconomyTokenPaymaster is
override
returns (bytes memory context, uint256 validationData)
{
(maxCost);
// Implementation of post-operation logic

}

/**
Expand All @@ -239,4 +258,30 @@ contract BiconomyTokenPaymaster is
if (target == address(0)) revert CanNotWithdrawToZeroAddress();
SafeTransferLib.safeTransfer(address(token), target, amount);
}

/// @notice Fetches the latest token price.

/// @return price The latest token price fetched from the oracles.
function getPrice(address tokenAddress) internal view returns (uint192) {
TokenInfo memory tokenInfo = tokenDirectory[tokenAddress];
uint192 tokenPrice = _fetchPrice(tokenInfo.oracle);
uint192 nativeAssetPrice = _fetchPrice(nativeOracle);
uint192 price = nativeAssetPrice * uint192(tokenInfo.decimals) / tokenPrice;
return price;
}

/// @notice Fetches the latest price from the given oracle.
/// @dev This function is used to get the latest price from the tokenOracle or nativeAssetOracle.
/// @param _oracle The oracle contract to fetch the price from.
/// @return price The latest price fetched from the oracle.
function _fetchPrice(IOracle _oracle) internal view returns (uint192 price) {
(, int256 answer,, uint256 updatedAt,) = _oracle.latestRoundData();
if (answer <= 0) {
revert OraclePriceNotPositive();
}
// if (updatedAt < block.timestamp - stalenessThreshold) {
// revert OraclePriceStale();
// }
price = uint192(int192(answer));
}
}
107 changes: 107 additions & 0 deletions contracts/token/oracles/TwapOracle.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {IOracle} from "../../interfaces/oracles/IOracle.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {OracleLibrary} from "@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol";
import {IUniswapV3PoolImmutables} from "@uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol";


contract TwapOracle is IOracle {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Invalid TWAP age, either too low or too high
error InvalidTwapAge();

/// @dev Pool doesn't contain the base token
error InvalidTokenOrPool();

/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS AND IMMUTABLES */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The Uniswap V3 pool address
address public immutable pool;

/// @dev The base token address (the one which price is being fetched)
address public immutable baseToken;

/// @dev The base token decimals
uint256 public immutable baseTokenDecimals;

/// @dev The quote token address (WETH or USD stable coin)
address public immutable quoteToken;

/// @dev The quote token decimals
uint256 public immutable quoteTokenDecimals;

/// @dev Default TWAP age, used to fetch the price
uint32 public immutable twapAge;

uint32 public constant MINIMUM_TWAP_AGE = 1 minutes;
uint32 public constant MAXIMUM_TWAP_AGE = 7 days;

uint256 public constant ORACLE_DECIMALS = 1e8;

constructor(
address _pool,
uint32 _twapAge,
address _baseToken
) {
pool = _pool;

if (_twapAge < MINIMUM_TWAP_AGE || _twapAge > MAXIMUM_TWAP_AGE) revert InvalidTwapAge();
twapAge = _twapAge;

address token0 = IUniswapV3PoolImmutables(_pool).token0();
address token1 = IUniswapV3PoolImmutables(_pool).token1();

if (_baseToken != token0 && _baseToken != token1) revert InvalidTokenOrPool();

baseToken = _baseToken;
baseTokenDecimals = 10 ** IERC20Metadata(baseToken).decimals();

quoteToken = token0 == baseToken ? token1 : token0;
quoteTokenDecimals = 10 ** IERC20Metadata(quoteToken).decimals();
}

function decimals() external override pure returns (uint8) {
return 8;
}

function latestRoundData() external override view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) {
uint256 _price = _fetchTwap();

// Normalize the price to the oracle decimals
uint256 price = _price * ORACLE_DECIMALS / quoteTokenDecimals;

return _buildLatestRoundData(price);
}

function _buildLatestRoundData(uint256 price) internal view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) {
return (0, int256(price), 0, block.timestamp, 0);
}

function _fetchTwap() internal view returns (uint256) {
(int24 arithmeticMeanTick,) = OracleLibrary.consult(pool, twapAge);

return OracleLibrary.getQuoteAtTick(
arithmeticMeanTick,
uint128(baseTokenDecimals), // Base token amount is equal to 1 token
baseToken,
quoteToken
);
}
}
2 changes: 1 addition & 1 deletion lib/v3-core
Submodule v3-core updated 93 files
+2 −2 .github/workflows/fuzz-testing.yml
+1 −0 .github/workflows/lint.yml
+4 −5 .github/workflows/mythx.yml
+1 −0 .github/workflows/tests.yml
+6 −5 README.md
+ audits/abdk/audit.pdf
+0 −166 audits/tob/README.md
+ audits/tob/audit.pdf
+0 −16 audits/tob/contracts/crytic/echidna/E2E_mint_burn.config.yaml
+0 −503 audits/tob/contracts/crytic/echidna/E2E_mint_burn.sol
+0 −10 audits/tob/contracts/crytic/echidna/E2E_swap.config.yaml
+0 −487 audits/tob/contracts/crytic/echidna/E2E_swap.sol
+0 −7 audits/tob/contracts/crytic/echidna/Other.config.yaml
+0 −21 audits/tob/contracts/crytic/echidna/Other.sol
+0 −205 audits/tob/contracts/crytic/echidna/Setup.sol
+0 −11 audits/tob/contracts/crytic/manticore/001.sol
+0 −12 audits/tob/contracts/crytic/manticore/002.sol
+0 −9 audits/tob/contracts/crytic/manticore/003.sol
+1 −1 contracts/NoDelegateCall.sol
+5 −5 contracts/UniswapV3Factory.sol
+237 −200 contracts/UniswapV3Pool.sol
+3 −3 contracts/UniswapV3PoolDeployer.sol
+8 −6 contracts/interfaces/IUniswapV3Pool.sol
+107 −1 contracts/interfaces/LICENSE
+19 −0 contracts/interfaces/pool/IUniswapV3PoolErrors.sol
+23 −22 contracts/interfaces/pool/IUniswapV3PoolState.sol
+69 −65 contracts/libraries/BitMath.sol
+87 −83 contracts/libraries/FullMath.sol
+107 −1 contracts/libraries/LICENSE
+0 −17 contracts/libraries/LiquidityMath.sol
+0 −46 contracts/libraries/LowGasSafeMath.sol
+138 −111 contracts/libraries/Oracle.sol
+24 −19 contracts/libraries/Position.sol
+70 −60 contracts/libraries/SqrtPriceMath.sol
+59 −57 contracts/libraries/SwapMath.sol
+56 −47 contracts/libraries/Tick.sol
+39 −33 contracts/libraries/TickBitmap.sol
+174 −165 contracts/libraries/TickMath.sol
+7 −4 contracts/libraries/TransferHelper.sol
+12 −8 contracts/test/BitMathEchidnaTest.sol
+2 −2 contracts/test/BitMathTest.sol
+41 −35 contracts/test/FullMathEchidnaTest.sol
+2 −2 contracts/test/FullMathTest.sol
+0 −16 contracts/test/LiquidityMathTest.sol
+0 −36 contracts/test/LowGasSafeMathEchidnaTest.sol
+2 −2 contracts/test/MockTimeUniswapV3Pool.sol
+3 −3 contracts/test/MockTimeUniswapV3PoolDeployer.sol
+4 −4 contracts/test/NoDelegateCallTest.sol
+21 −26 contracts/test/OracleEchidnaTest.sol
+5 −4 contracts/test/OracleTest.sol
+18 −17 contracts/test/SqrtPriceMathEchidnaTest.sol
+2 −2 contracts/test/SqrtPriceMathTest.sol
+9 −4 contracts/test/SwapMathEchidnaTest.sol
+2 −2 contracts/test/SwapMathTest.sol
+2 −2 contracts/test/TestERC20.sol
+8 −8 contracts/test/TestUniswapV3Callee.sol
+17 −19 contracts/test/TestUniswapV3ReentrantCallee.sol
+9 −8 contracts/test/TestUniswapV3Router.sol
+4 −4 contracts/test/TestUniswapV3SwapPay.sol
+2 −2 contracts/test/TickBitmapEchidnaTest.sol
+2 −2 contracts/test/TickBitmapTest.sol
+4 −3 contracts/test/TickEchidnaTest.sol
+2 −2 contracts/test/TickMathEchidnaTest.sol
+2 −2 contracts/test/TickMathTest.sol
+26 −28 contracts/test/TickOverflowSafetyEchidnaTest.sol
+2 −3 contracts/test/TickTest.sol
+4 −4 contracts/test/UniswapV3PoolSwapTest.sol
+2 −2 contracts/test/UnsafeMathEchidnaTest.sol
+23 −5 hardhat.config.ts
+2 −2 package.json
+0 −44 test/LiquidityMath.spec.ts
+3 −1 test/NoDelegateCall.spec.ts
+4 −11 test/Oracle.spec.ts
+1 −14 test/TickMath.spec.ts
+4 −1 test/UniswapV3Factory.spec.ts
+13 −27 test/UniswapV3Pool.arbitrage.spec.ts
+3 −2 test/UniswapV3Pool.gas.spec.ts
+29 −74 test/UniswapV3Pool.spec.ts
+10 −6 test/UniswapV3Pool.swaps.spec.ts
+5 −2 test/UniswapV3Router.spec.ts
+3 −3 test/__snapshots__/BitMath.spec.ts.snap
+0 −5 test/__snapshots__/LiquidityMath.spec.ts.snap
+1 −1 test/__snapshots__/NoDelegateCall.spec.ts.snap
+20 −20 test/__snapshots__/Oracle.spec.ts.snap
+8 −8 test/__snapshots__/SqrtPriceMath.spec.ts.snap
+8 −8 test/__snapshots__/SwapMath.spec.ts.snap
+9 −9 test/__snapshots__/TickBitmap.spec.ts.snap
+13 −13 test/__snapshots__/TickMath.spec.ts.snap
+3 −3 test/__snapshots__/UniswapV3Factory.spec.ts.snap
+84 −84 test/__snapshots__/UniswapV3Pool.gas.spec.ts.snap
+50 −50 test/__snapshots__/UniswapV3Pool.swaps.spec.ts.snap
+2 −1 test/shared/fixtures.ts
+2,525 −2,182 yarn.lock
2 changes: 1 addition & 1 deletion lib/v3-periphery
Submodule v3-periphery updated 90 files
+1 −0 .github/workflows/lint.yml
+1 −0 .github/workflows/tests.yml
+2 −1 .gitignore
+ audits/abdk/audit.pdf
+13 −14 contracts/NonfungiblePositionManager.sol
+10 −11 contracts/NonfungibleTokenPositionDescriptor.sol
+22 −25 contracts/SwapRouter.sol
+18 −22 contracts/V3Migrator.sol
+1 −1 contracts/base/BlockTimestamp.sol
+10 −11 contracts/base/ERC721Permit.sol
+6 −3 contracts/base/LiquidityManagement.sol
+1 −1 contracts/base/Multicall.sol
+1 −1 contracts/base/PeripheryImmutableState.sol
+2 −5 contracts/base/PeripheryPaymentsWithFee.sol
+1 −1 contracts/base/PeripheryValidation.sol
+1 −1 contracts/base/PoolInitializer.sol
+1 −1 contracts/base/SelfPermit.sol
+32 −35 contracts/examples/PairFlash.sol
+2 −2 contracts/interfaces/IERC20Metadata.sol
+2 −2 contracts/interfaces/INonfungiblePositionManager.sol
+1 −1 contracts/interfaces/external/IWETH9.sol
+4 −5 contracts/lens/Quoter.sol
+16 −9 contracts/lens/QuoterV2.sol
+21 −18 contracts/lens/TickLens.sol
+6 −3 contracts/lens/UniswapInterfaceMulticall.sol
+37 −0 contracts/libraries/AddressStringUtil.sol
+48 −50 contracts/libraries/BytesLib.sol
+1 −1 contracts/libraries/CallbackValidation.sol
+1 −1 contracts/libraries/ChainId.sol
+1 −1 contracts/libraries/HexStrings.sol
+18 −10 contracts/libraries/LiquidityAmounts.sol
+123 −80 contracts/libraries/NFTDescriptor.sol
+13 −7 contracts/libraries/NFTSVG.sol
+44 −19 contracts/libraries/OracleLibrary.sol
+10 −8 contracts/libraries/PoolAddress.sol
+2 −2 contracts/libraries/PoolTicksCounter.sol
+11 −12 contracts/libraries/PositionValue.sol
+96 −0 contracts/libraries/SafeERC20Namer.sol
+62 −0 contracts/libraries/SqrtPriceMathPartial.sol
+1 −1 contracts/libraries/TokenRatioSortOrder.sol
+3 −2 contracts/libraries/TransferHelper.sol
+1 −1 contracts/test/Base64Test.sol
+1 −1 contracts/test/LiquidityAmountsTest.sol
+1 −1 contracts/test/MockObservable.sol
+1 −1 contracts/test/MockObservations.sol
+1 −1 contracts/test/MockTimeNonfungiblePositionManager.sol
+1 −1 contracts/test/MockTimeSwapRouter.sol
+3 −3 contracts/test/NFTDescriptorTest.sol
+1 −1 contracts/test/NonfungiblePositionManagerPositionsGasTest.sol
+5 −1 contracts/test/OracleTest.sol
+1 −1 contracts/test/PathTest.sol
+1 −1 contracts/test/PeripheryImmutableStateTest.sol
+1 −1 contracts/test/PoolAddressTest.sol
+1 −1 contracts/test/PositionValueTest.sol
+1 −1 contracts/test/SelfPermitTest.sol
+1 −1 contracts/test/TestCallbackValidation.sol
+2 −2 contracts/test/TestERC20.sol
+2 −2 contracts/test/TestERC20Metadata.sol
+1 −1 contracts/test/TestERC20PermitAllowed.sol
+1 −1 contracts/test/TestMulticall.sol
+1 −1 contracts/test/TestPositionNFTOwner.sol
+1 −1 contracts/test/TestUniswapV3Callee.sol
+17 −7 hardhat.config.ts
+7 −8 package.json
+7 −8 test/NFTDescriptor.spec.ts
+13 −15 test/NonfungiblePositionManager.spec.ts
+185 −1 test/OracleLibrary.spec.ts
+0 −1 test/PairFlash.spec.ts
+124 −216 test/QuoterV2.spec.ts
+97 −13 test/SwapRouter.gas.spec.ts
+1 −3 test/SwapRouter.spec.ts
+3 −5 test/V3Migrator.spec.ts
+15 −15 test/__snapshots__/Base64.spec.ts.snap
+10 −10 test/__snapshots__/LiquidityAmounts.spec.ts.snap
+2 −2 test/__snapshots__/Multicall.spec.ts.snap
+1 −1 test/__snapshots__/NFTDescriptor.spec.ts.snap
+20 −20 test/__snapshots__/NonfungiblePositionManager.spec.ts.snap
+1 −1 test/__snapshots__/OracleLibrary.spec.ts.snap
+1 −1 test/__snapshots__/PairFlash.spec.ts.snap
+1 −1 test/__snapshots__/Path.spec.ts.snap
+1 −1 test/__snapshots__/PeripheryImmutableState.spec.ts.snap
+2 −2 test/__snapshots__/PoolAddress.spec.ts.snap
+5 −5 test/__snapshots__/PositionValue.spec.ts.snap
+25 −25 test/__snapshots__/QuoterV2.spec.ts.snap
+21 −15 test/__snapshots__/SwapRouter.gas.spec.ts.snap
+1 −1 test/__snapshots__/SwapRouter.spec.ts.snap
+2 −2 test/__snapshots__/TickLens.spec.ts.snap
+1 −1 test/__snapshots__/V3Migrator.spec.ts.snap
+3 −4 test/shared/externalFixtures.ts
+3,333 −1,897 yarn.lock
6 changes: 3 additions & 3 deletions test/unit/concrete/TestSponsorshipPaymaster.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ contract TestSponsorshipPaymasterWithDynamicAdjustment is TestBase {
}

function test_SetUnaccountedGas() external prankModifier(PAYMASTER_OWNER.addr) {
uint16 initialUnaccountedGas = bicoPaymaster.unaccountedGas();
uint16 newUnaccountedGas = 5000;
uint256 initialUnaccountedGas = bicoPaymaster.unaccountedGas();
uint256 newUnaccountedGas = 5000;

vm.expectEmit(true, true, false, true, address(bicoPaymaster));
emit IBiconomySponsorshipPaymaster.UnaccountedGasChanged(initialUnaccountedGas, newUnaccountedGas);
bicoPaymaster.setUnaccountedGas(newUnaccountedGas);

uint48 resultingUnaccountedGas = bicoPaymaster.unaccountedGas();
uint256 resultingUnaccountedGas = bicoPaymaster.unaccountedGas();
assertEq(resultingUnaccountedGas, newUnaccountedGas);
}

Expand Down

0 comments on commit 31681cc

Please sign in to comment.