styling consistency

This commit is contained in:
tim
2025-10-15 11:19:36 -04:00
parent 7ac4cdc8f6
commit ead004d631
18 changed files with 275 additions and 281 deletions

View File

@@ -130,7 +130,7 @@ contract PartyPoolTest is Test {
alice = address(0xA11ce);
bob = address(0xB0b);
// Deploy three ERC20 test tokens and mint initial supplies to this test contract for initial deposit
// Deploy three ERC20 test _tokens and mint initial supplies to this test contract for initial deposit
token0 = new TestERC20("T0", "T0", 0);
token1 = new TestERC20("T1", "T1", 0);
token2 = new TestERC20("T2", "T2", 0);
@@ -175,7 +175,7 @@ contract PartyPoolTest is Test {
int128 kappa3 = LMSRStabilized.computeKappaFromSlippage(tokens.length, tradeFrac, targetSlippage);
pool = Deploy.newPartyPool("LP", "LP", tokens, bases, kappa3, feePpm, feePpm, false);
// Transfer initial deposit amounts into pool before initial mint (pool expects tokens already in contract)
// Transfer initial deposit amounts into pool before initial mint (pool expects _tokens already in contract)
// We deposit equal amounts INIT_BAL for each token
token0.transfer(address(pool), INIT_BAL);
token1.transfer(address(pool), INIT_BAL);
@@ -184,7 +184,7 @@ contract PartyPoolTest is Test {
// Perform initial mint (initial deposit); receiver is this contract
pool.initialMint(address(this), 0);
// Set up pool10 with 10 tokens
// Set up pool10 with 10 _tokens
IERC20[] memory tokens10 = new IERC20[](10);
tokens10[0] = IERC20(address(token0));
tokens10[1] = IERC20(address(token1));
@@ -205,7 +205,7 @@ contract PartyPoolTest is Test {
int128 kappa10 = LMSRStabilized.computeKappaFromSlippage(tokens10.length, tradeFrac, targetSlippage);
pool10 = Deploy.newPartyPool("LP10", "LP10", tokens10, bases10, kappa10, feePpm, feePpm, false);
// Mint additional tokens for pool10 initial deposit
// Mint additional _tokens for pool10 initial deposit
token0.mint(address(this), INIT_BAL);
token1.mint(address(this), INIT_BAL);
token2.mint(address(this), INIT_BAL);
@@ -232,7 +232,7 @@ contract PartyPoolTest is Test {
// Perform initial mint for pool10
pool10.initialMint(address(this), 0);
// For later tests we will mint tokens to alice/bob as needed
// For later tests we will mint _tokens to alice/bob as needed
token0.mint(alice, INIT_BAL);
token1.mint(alice, INIT_BAL);
token2.mint(alice, INIT_BAL);
@@ -258,7 +258,7 @@ contract PartyPoolTest is Test {
viewer = Deploy.newViewer();
}
/// @notice Basic sanity: initial mint should have produced LP tokens for this contract and the pool holds tokens.
/// @notice Basic sanity: initial mint should have produced LP _tokens for this contract and the pool holds _tokens.
function testInitialMintAndLP() public view {
uint256 totalLp = pool.totalSupply();
assertTrue(totalLp > 0, "Initial LP supply should be > 0");
@@ -274,7 +274,7 @@ contract PartyPoolTest is Test {
function testProportionalMintZeroLpReverts() public {
// Attempt to request a tiny LP amount (1) and expect revert because calculated actualLpToMint will be zero
// Approve pool to transfer tokens on alice's behalf
// Approve pool to transfer _tokens on alice's behalf
vm.startPrank(alice);
token0.approve(address(pool), type(uint256).max);
token1.approve(address(pool), type(uint256).max);
@@ -290,7 +290,7 @@ contract PartyPoolTest is Test {
/// does not undercharge (no value extraction). This test verifies the request succeeds
/// and that computed deposits are at least the proportional floor (ceil >= floor).
function testProportionalMintOneWeiSucceedsAndProtectsPool() public {
// Request a tiny LP amount (1 wei). Approve pool to transfer tokens on alice's behalf.
// Request a tiny LP amount (1 wei). Approve pool to transfer _tokens on alice's behalf.
vm.startPrank(alice);
token0.approve(address(pool), type(uint256).max);
token1.approve(address(pool), type(uint256).max);
@@ -406,14 +406,14 @@ contract PartyPoolTest is Test {
assertTrue(withdrawAmounts[i] <= poolBal, "withdraw amount cannot exceed pool balance");
}
// Burn by sending LP tokens from this contract (which holds initial LP from setUp)
// Burn by sending LP _tokens from this contract (which holds initial LP from setUp)
// Call burn(payer=this, receiver=bob, lpAmount=totalLp)
pool.burn(address(this), bob, totalLp, 0, false);
// After burning entire pool, totalSupply should be zero or very small (we expect zero since we withdrew all)
assertEq(pool.totalSupply(), 0);
// Bob should have received the withdrawn tokens
// Bob should have received the withdrawn _tokens
for (uint i = 0; i < withdrawAmounts.length; i++) {
assertTrue(IERC20(pool.allTokens()[i]).balanceOf(bob) >= withdrawAmounts[i], "Bob should receive withdrawn tokens");
}
@@ -424,7 +424,7 @@ contract PartyPoolTest is Test {
// Use alice as payer and bob as receiver
uint256 maxIn = 10_000;
// Ensure alice has tokens and approves pool
// Ensure alice has _tokens and approves pool
vm.prank(alice);
token0.approve(address(pool), type(uint256).max);
@@ -503,7 +503,7 @@ contract PartyPoolTest is Test {
// Compute expected deposit amounts via view
uint256[] memory expected = viewer.mintAmounts(pool, req);
// Ensure alice has tokens and approve pool
// Ensure alice has _tokens and approve pool
vm.startPrank(alice);
token0.approve(address(pool), type(uint256).max);
token1.approve(address(pool), type(uint256).max);
@@ -548,7 +548,7 @@ contract PartyPoolTest is Test {
uint256[] memory expected = viewer.mintAmounts(pool10, req);
// Approve all tokens from alice
// Approve all _tokens from alice
vm.startPrank(alice);
token0.approve(address(pool10), type(uint256).max);
token1.approve(address(pool10), type(uint256).max);
@@ -614,7 +614,7 @@ contract PartyPoolTest is Test {
uint256 myLp = pool.balanceOf(address(this));
if (myLp < req) {
uint256 topUp = req - myLp;
// Have alice supply tokens to mint LP into this contract
// Have alice supply _tokens to mint LP into this contract
vm.startPrank(alice);
token0.approve(address(pool), type(uint256).max);
token1.approve(address(pool), type(uint256).max);
@@ -754,7 +754,7 @@ contract PartyPoolTest is Test {
// Very large input relative to pool
uint256 largeInput = 10_000_000_000; // intentionally large
// Ensure alice has sufficient tokens for this large test input (mint top-up)
// Ensure alice has sufficient _tokens for this large test input (mint top-up)
token0.mint(alice, largeInput);
vm.startPrank(alice);
@@ -818,12 +818,12 @@ contract PartyPoolTest is Test {
// Deploy the borrower contract
borrower = new FlashBorrower(address(pool));
// Mint tokens to alice to be used for repayments
// Mint _tokens to alice to be used for repayments
token0.mint(alice, INIT_BAL * 2);
token1.mint(alice, INIT_BAL * 2);
token2.mint(alice, INIT_BAL * 2);
// Alice approves borrower to transfer tokens on their behalf for repayment
// Alice approves borrower to transfer _tokens on their behalf for repayment
vm.startPrank(alice);
token0.approve(address(borrower), type(uint256).max);
token1.approve(address(borrower), type(uint256).max);
@@ -998,7 +998,7 @@ contract PartyPoolTest is Test {
int128 kappaCustom = LMSRStabilized.computeKappaFromSlippage(tokens.length, tradeFrac, targetSlippage);
PartyPool poolCustom = Deploy.newPartyPool("LP_CUSTOM", "LP_CUSTOM", tokens, bases, kappaCustom, feePpm, feePpm, false);
// Mint additional tokens for both pools
// Mint additional _tokens for both pools
token0.mint(address(this), INIT_BAL * 2);
token1.mint(address(this), INIT_BAL * 2);
token2.mint(address(this), INIT_BAL * 2);
@@ -1052,7 +1052,7 @@ contract PartyPoolTest is Test {
}
/// @notice Test that minting the same proportion in pools with different initial LP amounts
/// returns correctly scaled LP tokens
/// returns correctly scaled LP _tokens
function testProportionalMintingScaledByInitialAmount() public {
// Create two identical pools with different initial LP amounts
IERC20[] memory tokens = new IERC20[](3);
@@ -1072,7 +1072,7 @@ contract PartyPoolTest is Test {
int128 kappaCustom2 = LMSRStabilized.computeKappaFromSlippage(tokens.length, tradeFrac, targetSlippage);
PartyPool poolCustom = Deploy.newPartyPool("LP_CUSTOM", "LP_CUSTOM", tokens, bases, kappaCustom2, feePpm, feePpm, false);
// Mint additional tokens
// Mint additional _tokens
token0.mint(address(this), INIT_BAL * 4);
token1.mint(address(this), INIT_BAL * 4);
token2.mint(address(this), INIT_BAL * 4);
@@ -1108,7 +1108,7 @@ contract PartyPoolTest is Test {
vm.startPrank(alice);
// Approve tokens for both pools
// Approve _tokens for both pools
token0.approve(address(poolDefault), type(uint256).max);
token1.approve(address(poolDefault), type(uint256).max);
token2.approve(address(poolDefault), type(uint256).max);