Skip to content

Commit

Permalink
Update gas metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
alcueca committed Apr 24, 2024
1 parent bbaab9b commit 3a9584c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
1 change: 1 addition & 0 deletions .forge-snapshots/GnosisSafe.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
109223
1 change: 1 addition & 0 deletions .forge-snapshots/MakerDAO.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
313172
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,29 @@ repayment approval.
| ---------------------- | ------------------------------------------ | ------------------------------------------------- | ------- | -------- | --------------------------------------------------------------- |
| Aave v3 | 0x9D4D2C08b29A2Db1c614483cd8971734BFDCC9F2 | Arbitrum One, Optimism, Polygon | 212569 | 0.05% | [AaveWrapper](src/aave/AaveWrapper.sol) |
| Aave v3 (Permissioned) | 0x0c86c636ed5593705b5675d370c831972C787841 | Ethereum, Gnosis | 229742 | 0 | [AaveWrapper](src/aave/AaveWrapper.sol) |
| Spark | 0x8cB701df93f2Dae295aE8D7beE5Aa7e4D40CB397 | Ethereum, Gnosis | 212569 | 0 | [AaveWrapper](src/aave/AaveWrapper.sol) |
| ZeroLend | 0xA48Cc0e4159C51d73B42c824f1444D1C1cbdA531 | Ethereum | 212569 | 0 | [AaveWrapper](src/aave/AaveWrapper.sol) |
| Aerodrome | 0x69b6E55f00d908018E2D745c524995bc231D762b | Base | 163919 | Variable | [SolidlyWrapper](src/solidly/SolidlyWrapper.sol) |
| Balancer v2 | 0x9E092cb431e5F1aa70e47e052773711d2Ba4917E | Ethereum, Arbitrum One, Optimism, Polygon, Gnosis | 113032 | 0 | [BalancerWrapper](src/balancer/BalancerWrapper.sol) |
| Balancer v2 | 0xD534400B0555F8441c5a3e0E9e585615B54fB2F4 | Base | 113032 | 0 | [BalancerWrapper](src/balancer/BalancerWrapper.sol) |
| Uniswap v3 | 0x319300462C37AD2D4f26B584C2b67De51F51f289 | Arbitrum One, Optimism, Polygon, Ethereum | 94720 | Variable | [UniswapV3Wrapper](src/uniswapV3/UniswapV3Wrapper.sol) |
| Balancer + Moonwell | 0x6207ec38da68902CC60D3760c9fe3EB64B426207 | Base | 1183309 | 0 | [CompoundWrapper](src/compound/CompoundWrapper.sol) |
| Balancer + Sonne | 0x6412183C579a276f467ad38468D19CC8f1F2b5cb | Optimism | 1040313 | 0 | [CompoundWrapper](src/compound/CompoundWrapper.sol) |
| Balancer + Pendle | 0xC1Ea6a6df39D991006b39706db7C51f5A1819da7 | Arbitrum One | 525422 | 0 | [BalancerPendleWrapper](src/pendle/BalancerPendleWrapper.sol) |
| Balancer + Silo | 0x0F9104Fec1a5C91e63632E215e8F5c57C8f32c77 | Arbitrum One | 1025824 | 1 | [SiloWrapper](src/silo/SiloWrapper.sol) |
| Dolomite | 0x54F1ce5E6bdf027C9a6016C9F52fC5A445b77ed6 | Arbitrum One | 459815 | 0 | [DolomiteWrapper](src/dolomite/DolomiteWrapper.sol) |
| MorphoBlue | 0xa0Cb4e1222d813D6e4dE79f2A7A0B7759209588F | Ethereum | 132114 | 0 | [MorphoBlueWrapper](src/morpho/MorphoBlueWrapper.sol) |
| Balancer + Sonne | 0x6412183C579a276f467ad38468D19CC8f1F2b5cb | Optimism | 1040313 | 0 | [CompoundWrapper](src/compound/CompoundWrapper.sol) |
| Camelot | 0x5E8820B2832aD8451f65Fa2CCe2F3Cef29016D0d | Arbitrum One | 80679 | 0.01% | [AlgebraWrapper](src/algebra/AlgebraWrapper.sol) |
| Camelot + Pendle | 0xC9d66F655b7B35A2B4958bE2FB58E472736Bbc47 | Arbitrum One | 506792 | 0.01% | [AlgebraPendleWrapper](src/pendle/AlgebraPendleWrapper.sol) |
| Balancer + Pendle | 0xC1Ea6a6df39D991006b39706db7C51f5A1819da7 | Arbitrum One | 525422 | 0 | [BalancerPendleWrapper](src/pendle/BalancerPendleWrapper.sol) |
| Dolomite | 0x54F1ce5E6bdf027C9a6016C9F52fC5A445b77ed6 | Arbitrum One | 459815 | 0 | [DolomiteWrapper](src/dolomite/DolomiteWrapper.sol) |
| Gnosis Safe | | | 109223 | Variable | [GnosisSafeWrapper](src/gnosisSafe/GnosisSafeWrapper.sol) |
| MakerDAO | | | 313172 | 0 | [ERC3156Wrapper](src/erc3156/ERC3156Wrapper.sol) |
| MorphoBlue | 0xa0Cb4e1222d813D6e4dE79f2A7A0B7759209588F | Ethereum | 132114 | 0 | [MorphoBlueWrapper](src/morpho/MorphoBlueWrapper.sol) |
| Spark | 0x8cB701df93f2Dae295aE8D7beE5Aa7e4D40CB397 | Ethereum, Gnosis | 212569 | 0 | [AaveWrapper](src/aave/AaveWrapper.sol) |
| Uniswap v3 | 0x319300462C37AD2D4f26B584C2b67De51F51f289 | Arbitrum One, Optimism, Polygon, Ethereum | 94720 | Variable | [UniswapV3Wrapper](src/uniswapV3/UniswapV3Wrapper.sol) |
| Uniswap v3 + Pendle | 0xa353Fd50210786F0E038ddD574A21d0CCefb3163 | Arbitrum One | 497567 | Variable | [UniswapV3PendleWrapper](src/pendle/UniswapV3PendleWrapper.sol) |
| Aerodrome | 0x69b6E55f00d908018E2D745c524995bc231D762b | Base | 163919 | Variable | [SolidlyWrapper](src/solidly/SolidlyWrapper.sol) |
| Velodrome | 0xcF13CDdbA3aEf757c52466deC310F221e06238d6 | Optimism | 163919 | Variable | [SolidlyWrapper](src/solidly/SolidlyWrapper.sol) |
| ZeroLend | 0xA48Cc0e4159C51d73B42c824f1444D1C1cbdA531 | Ethereum | 212569 | 0 | [AaveWrapper](src/aave/AaveWrapper.sol) |

Disclaimer: The gas costs are calculated for calling `flashLoan` on each wrapper for an arbitrarily chosen token and
loan amount. Calling the underlying flash lender directly may have larger gas savings in some instances than others.
Requesting loans for different tokens or amounts might have different gas costs. For AMMs the fees often vary according
to pool parameters and state.
loan amount. Gas refunds are not taken into account and might be significant in some cases. Calling the underlying flash
lender directly may have larger gas savings in some instances than others. Requesting loans for different tokens or
amounts might have different gas costs. For AMMs the fees often vary according to pool parameters and state.

## Gnosis Safe Wrapper

Expand Down
2 changes: 1 addition & 1 deletion test/AlgebraWrapper.Camelot.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ contract AlgebraWrapperCamelotTest is Test {
wrapper.algebraFlashCallback({ fee0: 0, fee1: 0, params: abi.encode(weth, usdc, 0, "") });
}

function test_measureFlashLoanGas() public {
function test_measureFlashLoanGasDebug() public {
console2.log("test_measureFlashLoanGas");
address token = wsteth;
uint256 loan = 1e18;
Expand Down
9 changes: 9 additions & 0 deletions test/ERC3156Wrapper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,13 @@ contract ERC3156WrapperTest is Test {
// borrowed
assertEq(borrower.flashFee(), fee);
}

function test_measureFlashLoanGas() public {
console2.log("test_measureFlashLoanGas");
address token = dai;
uint256 loan = 1e18;
uint256 fee = wrapper.flashFee(token, loan);
deal(address(token), address(borrower), fee);
borrower.flashBorrowMeasureGas(token, loan, "MakerDAO");
}
}
9 changes: 9 additions & 0 deletions test/GnosisSafeWrapper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,13 @@ contract GnosisSafeWrapperWithWrapperTest is GnosisSafeWrapperWithWrapper {
vm.expectRevert(abi.encodeWithSelector(GnosisSafeWrapper.UnsupportedAsset.selector, USDT));
borrower.flashBorrow(USDT, 1);
}

function test_measureFlashLoanGas() public {
console2.log("test_measureFlashLoanGas");
address token = USDT;
uint256 loan = 10e18;
uint256 fee = wrapper.flashFee(token, loan);
deal(address(token), address(borrower), fee);
borrower.flashBorrowMeasureGas(token, loan, "GnosisSafe");
}
}

0 comments on commit 3a9584c

Please sign in to comment.