Skip to content

Commit

Permalink
Build an Across specific transfer bridge test
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesgm committed Nov 15, 2024
1 parent a2d4781 commit 995e88f
Show file tree
Hide file tree
Showing 18 changed files with 249 additions and 31 deletions.
12 changes: 8 additions & 4 deletions src/builder/actions/CometActionsBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
string[] collateralAssetSymbols;
address comet;
address repayer;
bool preferAcross;
}

function cometRepay(
Expand Down Expand Up @@ -84,7 +85,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: repayIntent.preferAcross
});
}

Expand Down Expand Up @@ -115,6 +116,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
uint256[] collateralAmounts;
string[] collateralAssetSymbols;
address comet;
bool preferAcross;
}

function cometBorrow(
Expand Down Expand Up @@ -162,7 +164,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: borrowIntent.preferAcross
});
}

Expand Down Expand Up @@ -191,6 +193,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
uint256 chainId;
address comet;
address sender;
bool preferAcross;
}

function cometSupply(
Expand Down Expand Up @@ -248,7 +251,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
useQuotecall: isMaxSupply,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: cometSupplyIntent.preferAcross
}),
chainAccountsList: chainAccountsList,
payment: payment,
Expand All @@ -273,6 +276,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
uint256 chainId;
address comet;
address withdrawer;
bool preferAcross;
}

function cometWithdraw(
Expand Down Expand Up @@ -334,7 +338,7 @@ contract CometActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: cometWithdrawIntent.preferAcross
}),
chainAccountsList: chainAccountsList,
payment: payment,
Expand Down
9 changes: 6 additions & 3 deletions src/builder/actions/MorphoActionsBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ contract MorphoActionsBuilder is QuarkBuilderBase {
uint256 chainId;
uint256 collateralAmount;
string collateralAssetSymbol;
bool preferAcross;
}

function morphoBorrow(
Expand Down Expand Up @@ -72,7 +73,7 @@ contract MorphoActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: borrowIntent.preferAcross
});
}

Expand Down Expand Up @@ -102,6 +103,7 @@ contract MorphoActionsBuilder is QuarkBuilderBase {
uint256 chainId;
uint256 collateralAmount;
string collateralAssetSymbol;
bool preferAcross;
}

function morphoRepay(
Expand Down Expand Up @@ -165,7 +167,7 @@ contract MorphoActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: repayIntent.preferAcross
}),
chainAccountsList: chainAccountsList,
payment: payment,
Expand All @@ -192,6 +194,7 @@ contract MorphoActionsBuilder is QuarkBuilderBase {
address[] distributors;
address[] rewards;
bytes32[][] proofs;
bool preferAcross;
}

function morphoClaimRewards(
Expand Down Expand Up @@ -249,7 +252,7 @@ contract MorphoActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: claimIntent.preferAcross
});
}

Expand Down
6 changes: 4 additions & 2 deletions src/builder/actions/MorphoVaultActionsBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ contract MorphoVaultActionsBuilder is QuarkBuilderBase {
uint256 blockTimestamp;
address sender;
uint256 chainId;
bool preferAcross;
}

function morphoVaultSupply(
Expand Down Expand Up @@ -81,7 +82,7 @@ contract MorphoVaultActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: supplyIntent.preferAcross
}),
chainAccountsList: chainAccountsList,
payment: payment,
Expand All @@ -105,6 +106,7 @@ contract MorphoVaultActionsBuilder is QuarkBuilderBase {
uint256 blockTimestamp;
uint256 chainId;
address withdrawer;
bool preferAcross;
}

function morphoVaultWithdraw(
Expand Down Expand Up @@ -168,7 +170,7 @@ contract MorphoVaultActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: withdrawIntent.preferAcross
});
}

Expand Down
6 changes: 4 additions & 2 deletions src/builder/actions/SwapActionsBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ contract SwapActionsBuilder is QuarkBuilderBase {
address sender;
bool isExactOut;
uint256 blockTimestamp;
bool preferAcross;
}

function swap(
Expand Down Expand Up @@ -112,7 +113,7 @@ contract SwapActionsBuilder is QuarkBuilderBase {
useQuotecall: isMaxSwap,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: swapIntent.preferAcross
});
}

Expand Down Expand Up @@ -146,6 +147,7 @@ contract SwapActionsBuilder is QuarkBuilderBase {
uint256 interval;
address sender;
uint256 blockTimestamp;
bool preferAcross;
}

// Note: We don't currently bridge the input token or the payment token for recurring swaps. Recurring swaps
Expand Down Expand Up @@ -207,7 +209,7 @@ contract SwapActionsBuilder is QuarkBuilderBase {
useQuotecall: false,
bridgeEnabled: false,
autoWrapperEnabled: false,
preferAcross: true
preferAcross: swapIntent.preferAcross
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/builder/actions/TransferActionsBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ contract TransferActionsBuilder is QuarkBuilderBase {
address sender;
address recipient;
uint256 blockTimestamp;
bool preferAcross;
}

function transfer(
Expand Down Expand Up @@ -82,7 +83,7 @@ contract TransferActionsBuilder is QuarkBuilderBase {
useQuotecall: useQuotecall,
bridgeEnabled: true,
autoWrapperEnabled: true,
preferAcross: true
preferAcross: transferIntent.preferAcross
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/BridgingLogic.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ contract BridgingLogicTest is Test, QuarkBuilderTest {
amount: 1e18,
sender: address(0xb0b),
recipient: address(0xceecee),
blockTimestamp: BLOCK_TIMESTAMP
blockTimestamp: BLOCK_TIMESTAMP,
preferAcross: false
}), // transfer 1e18 WETH on chain 8453 to 0xceecee
chainAccountsList,
paymentUsd_()
Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderCometBorrow.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ contract QuarkBuilderCometBorrowTest is Test, QuarkBuilderTest {
chainId: chainId,
collateralAmounts: collateralAmounts,
collateralAssetSymbols: collateralAssetSymbols,
comet: cometUsdc_(1)
comet: cometUsdc_(1),
preferAcross: false
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderCometRepay.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ contract QuarkBuilderCometRepayTest is Test, QuarkBuilderTest {
collateralAmounts: collateralAmounts,
collateralAssetSymbols: collateralAssetSymbols,
comet: comet,
repayer: address(0xa11ce)
repayer: address(0xa11ce),
preferAcross: false
});
}

Expand Down
6 changes: 4 additions & 2 deletions test/builder/QuarkBuilderCometSupply.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ contract QuarkBuilderCometSupplyTest is Test, QuarkBuilderTest {
blockTimestamp: BLOCK_TIMESTAMP,
chainId: chainId,
comet: COMET_ETH,
sender: address(0xa11ce)
sender: address(0xa11ce),
preferAcross: false
});
}

Expand All @@ -54,7 +55,8 @@ contract QuarkBuilderCometSupplyTest is Test, QuarkBuilderTest {
blockTimestamp: BLOCK_TIMESTAMP,
chainId: chainId,
comet: COMET,
sender: sender
sender: sender,
preferAcross: false
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderCometWithdraw.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ contract QuarkBuilderCometWithdrawTest is Test, QuarkBuilderTest {
blockTimestamp: BLOCK_TIMESTAMP,
chainId: chainId,
comet: comet,
withdrawer: withdrawer
withdrawer: withdrawer,
preferAcross: false
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderMorphoBorrow.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ contract QuarkBuilderMorphoBorrowTest is Test, QuarkBuilderTest {
borrower: borrower,
chainId: chainId,
collateralAmount: collateralAmount,
collateralAssetSymbol: collateralAssetSymbol
collateralAssetSymbol: collateralAssetSymbol,
preferAcross: false
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderMorphoClaimRewards.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ contract QuarkBuilderMorphoClaimRewardsTest is Test, QuarkBuilderTest {
claimables: claimables,
distributors: distributors,
rewards: rewards,
proofs: proofs
proofs: proofs,
preferAcross: false
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderMorphoRepay.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ contract QuarkBuilderMorphoRepayTest is Test, QuarkBuilderTest {
repayer: repayer,
chainId: chainId,
collateralAmount: collateralAmount,
collateralAssetSymbol: collateralAssetSymbol
collateralAssetSymbol: collateralAssetSymbol,
preferAcross: false
});
}

Expand Down
18 changes: 12 additions & 6 deletions test/builder/QuarkBuilderMorphoVaultSupply.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ contract QuarkBuilderMorphoVaultTest is Test, QuarkBuilderTest {
assetSymbol: assetSymbol,
blockTimestamp: BLOCK_TIMESTAMP,
chainId: chainId,
sender: sender
sender: sender,
preferAcross: false
});
}

Expand All @@ -52,7 +53,8 @@ contract QuarkBuilderMorphoVaultTest is Test, QuarkBuilderTest {
assetSymbol: "USDC",
blockTimestamp: BLOCK_TIMESTAMP,
sender: address(0xa11ce),
chainId: 1
chainId: 1,
preferAcross: false
}),
chainAccountsList_(0e6), // but we are holding 0 USDC in total across 1, 8453
paymentUsd_()
Expand All @@ -69,7 +71,8 @@ contract QuarkBuilderMorphoVaultTest is Test, QuarkBuilderTest {
assetSymbol: "USDC",
blockTimestamp: BLOCK_TIMESTAMP,
sender: address(0xa11ce),
chainId: 1
chainId: 1,
preferAcross: false
}),
chainAccountsList_(2e6), // holding 2 USDC in total across 1, 8453
paymentUsdc_(maxCosts_(1, 1_000e6)) // but costs 1,000 USDC
Expand Down Expand Up @@ -112,7 +115,8 @@ contract QuarkBuilderMorphoVaultTest is Test, QuarkBuilderTest {
assetSymbol: "USDC",
blockTimestamp: BLOCK_TIMESTAMP,
sender: address(0xa11ce),
chainId: 1
chainId: 1,
preferAcross: false
}),
chainAccountsList,
paymentUsd_()
Expand All @@ -127,7 +131,8 @@ contract QuarkBuilderMorphoVaultTest is Test, QuarkBuilderTest {
assetSymbol: "USDC",
blockTimestamp: BLOCK_TIMESTAMP,
sender: address(0xa11ce),
chainId: 1
chainId: 1,
preferAcross: false
}),
chainAccountsList_(3e6), // holding 3 USDC in total across chains 1, 8453
paymentUsd_()
Expand Down Expand Up @@ -202,7 +207,8 @@ contract QuarkBuilderMorphoVaultTest is Test, QuarkBuilderTest {
assetSymbol: "USDC",
blockTimestamp: BLOCK_TIMESTAMP,
sender: address(0xa11ce),
chainId: 1
chainId: 1,
preferAcross: false
}),
chainAccountsList, // holding 3 USDC in total across chains 1, 8453
paymentUsd_()
Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderMorphoVaultWithdraw.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ contract QuarkBuilderMorphoVaultWithdrawTest is Test, QuarkBuilderTest {
assetSymbol: assetSymbol,
blockTimestamp: BLOCK_TIMESTAMP,
chainId: chainId,
withdrawer: withdrawer
withdrawer: withdrawer,
preferAcross: false
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderRecurringSwap.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ contract QuarkBuilderRecurringSwapTest is Test, QuarkBuilderTest {
path: path,
interval: interval,
sender: sender,
blockTimestamp: blockTimestamp
blockTimestamp: blockTimestamp,
preferAcross: false
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/builder/QuarkBuilderSwap.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ contract QuarkBuilderSwapTest is Test, QuarkBuilderTest {
feeAmount: 10,
sender: sender,
isExactOut: false,
blockTimestamp: blockTimestamp
blockTimestamp: blockTimestamp,
preferAcross: false
});
}

Expand Down
Loading

0 comments on commit 995e88f

Please sign in to comment.