styling consistency
This commit is contained in:
@@ -114,9 +114,9 @@ contract GasTest is Test {
|
||||
uint256 constant internal INIT_BAL = 1_000_000; // initial token units for each token (internal==amount when base==1)
|
||||
uint256 constant internal BASE = 1; // use base=1 so internal amounts correspond to raw integers (Q64.64 units)
|
||||
|
||||
/// @notice Helper function to create a pool with the specified number of tokens
|
||||
/// @notice Helper function to create a pool with the specified number of _tokens
|
||||
function createPool(uint256 numTokens) internal returns (PartyPool) {
|
||||
// Deploy tokens dynamically
|
||||
// Deploy _tokens dynamically
|
||||
address[] memory tokens = new address[](numTokens);
|
||||
uint256[] memory bases = new uint256[](numTokens);
|
||||
|
||||
@@ -139,7 +139,7 @@ contract GasTest is Test {
|
||||
for (uint i = 0; i < tokens.length; i++) {
|
||||
ierc20Tokens[i] = IERC20(tokens[i]);
|
||||
}
|
||||
// Compute kappa from slippage params and number of tokens, then construct pool with kappa
|
||||
// Compute kappa from slippage params and number of _tokens, then construct pool with kappa
|
||||
int128 computedKappa = LMSRStabilized.computeKappaFromSlippage(ierc20Tokens.length, tradeFrac, targetSlippage);
|
||||
PartyPool newPool = Deploy.newPartyPool(poolName, poolName, ierc20Tokens, bases, computedKappa, feePpm, feePpm, false);
|
||||
|
||||
@@ -156,7 +156,7 @@ contract GasTest is Test {
|
||||
|
||||
/// @notice Helper to create a pool with the stable-pair optimization enabled
|
||||
function createPoolStable(uint256 numTokens) internal returns (PartyPool) {
|
||||
// Deploy tokens dynamically
|
||||
// Deploy _tokens dynamically
|
||||
address[] memory tokens = new address[](numTokens);
|
||||
uint256[] memory bases = new uint256[](numTokens);
|
||||
|
||||
@@ -216,7 +216,7 @@ contract GasTest is Test {
|
||||
// Deploy the borrower contract
|
||||
borrower = new FlashBorrower(address(pool2));
|
||||
|
||||
// Mint tokens to alice to be used for repayments and approve borrower
|
||||
// Mint _tokens to alice to be used for repayments and approve borrower
|
||||
IERC20[] memory tokenAddresses = pool2.allTokens();
|
||||
vm.startPrank(alice);
|
||||
for (uint256 i = 0; i < tokenAddresses.length; i++) {
|
||||
@@ -226,12 +226,12 @@ contract GasTest is Test {
|
||||
vm.stopPrank();
|
||||
}
|
||||
|
||||
/// @notice Helper function: perform 10 swaps back-and-forth between the first two tokens.
|
||||
/// @notice Helper function: perform 10 swaps back-and-forth between the first two _tokens.
|
||||
function _performSwapGasTest(PartyPool testPool) internal {
|
||||
IERC20[] memory tokens = testPool.allTokens();
|
||||
require(tokens.length >= 2, "Pool must have at least 2 tokens");
|
||||
|
||||
// Ensure alice approves pool for both tokens
|
||||
// Ensure alice approves pool for both _tokens
|
||||
vm.prank(alice);
|
||||
TestERC20(address(tokens[0])).approve(address(testPool), type(uint256).max);
|
||||
vm.prank(alice);
|
||||
@@ -252,22 +252,22 @@ contract GasTest is Test {
|
||||
}
|
||||
}
|
||||
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two tokens in the 2-token pool.
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two _tokens in the 2-token pool.
|
||||
function testSwapGasPair() public {
|
||||
_performSwapGasTest(pool2);
|
||||
}
|
||||
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two tokens in the 10-token pool.
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two _tokens in the 10-token pool.
|
||||
function testSwapGasTen() public {
|
||||
_performSwapGasTest(pool10);
|
||||
}
|
||||
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two tokens in the 20-token pool.
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two _tokens in the 20-token pool.
|
||||
function testSwapGasTwenty() public {
|
||||
_performSwapGasTest(pool20);
|
||||
}
|
||||
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two tokens in the 100-token pool.
|
||||
/// @notice Gas measurement: perform 10 swaps back-and-forth between first two _tokens in the 100-token pool.
|
||||
function testSwapGasFifty() public {
|
||||
_performSwapGasTest(pool50);
|
||||
}
|
||||
@@ -307,7 +307,7 @@ contract GasTest is Test {
|
||||
uint256 minted = testPool.swapMint(alice, alice, 0, input, 0);
|
||||
// If nothing minted (numerical edge), skip burn step
|
||||
if (minted == 0) continue;
|
||||
// Immediately burn the minted LP back to tokens, targeting the same token index
|
||||
// Immediately burn the minted LP back to _tokens, targeting the same token index
|
||||
testPool.burnSwap(alice, alice, minted, 0, 0, false);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ contract GasTest is Test {
|
||||
|
||||
vm.startPrank(alice);
|
||||
|
||||
// Mint additional tokens to alice and approve pool to transfer tokens for proportional mint
|
||||
// Mint additional _tokens to alice and approve pool to transfer _tokens for proportional mint
|
||||
for (uint256 i = 0; i < poolTokens.length; i++) {
|
||||
TestERC20(address(poolTokens[i])).mint(alice, iterations * input * 2);
|
||||
TestERC20(address(poolTokens[i])).approve(address(testPool), type(uint256).max);
|
||||
|
||||
Reference in New Issue
Block a user