per-asset fees

This commit is contained in:
tim
2025-10-29 18:22:23 -04:00
parent 86410c9a91
commit 20758cfb35
18 changed files with 475 additions and 164 deletions

View File

@@ -64,6 +64,9 @@ library Deploy {
NativeWrapper wrapper,
bool _stable
) internal returns (PartyPool) {
// Build per-asset fee vector from scalar for tests
uint256[] memory feesArr = new uint256[](tokens_.length);
for (uint256 i = 0; i < tokens_.length; i++) { feesArr[i] = _swapFeePpm; }
return _stable && tokens_.length == 2 ?
new PartyPoolBalancedPair(
owner_,
@@ -71,7 +74,7 @@ library Deploy {
symbol_,
tokens_,
_kappa,
_swapFeePpm,
feesArr,
_flashFeePpm,
PROTOCOL_FEE_PPM,
PROTOCOL_FEE_RECEIVER,
@@ -85,7 +88,7 @@ library Deploy {
symbol_,
tokens_,
_kappa,
_swapFeePpm,
feesArr,
_flashFeePpm,
PROTOCOL_FEE_PPM,
PROTOCOL_FEE_RECEIVER,

View File

@@ -304,7 +304,7 @@ contract GasTest is Test {
for (uint256 k = 0; k < iterations; k++) {
// Mint LP by providing single-token input; receive LP minted
uint256 minted = testPool.swapMint(alice, alice, 0, input, 0);
(, 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

View File

@@ -426,7 +426,7 @@ contract NativeTest is Test {
uint256 aliceLpBefore = pool.balanceOf(alice);
// Call swapMint with native currency: deposit ETH as WETH (index 2)
uint256 lpMinted = pool.swapMint{value: maxIn}(
(, uint256 lpMinted, ) = pool.swapMint{value: maxIn}(
alice, // payer
alice, // receiver
2, // inputTokenIndex (WETH)
@@ -457,7 +457,7 @@ contract NativeTest is Test {
uint256 aliceEthBefore = alice.balance;
// Send excess native currency
uint256 lpMinted = pool.swapMint{value: totalSent}(
(, uint256 lpMinted, ) = pool.swapMint{value: totalSent}(
alice,
alice,
2, // WETH

View File

@@ -721,7 +721,7 @@ contract PartyPoolTest is Test {
uint256 input = 10_000;
// Call swapMint as alice, receive LP to alice
uint256 minted = pool.swapMint(alice, alice, 0, input, 0);
(, uint256 minted, ) = pool.swapMint(alice, alice, 0, input, 0);
// minted should be > 0
assertTrue(minted > 0, "swapMint should mint LP");
@@ -751,7 +751,7 @@ contract PartyPoolTest is Test {
uint256 aliceBalBefore = token0.balanceOf(alice);
uint256 minted = pool.swapMint(alice, alice, 0, largeInput, 0);
(, uint256 minted, ) = pool.swapMint(alice, alice, 0, largeInput, 0);
// minted should be > 0
assertTrue(minted > 0, "swapMint large input should still mint LP");