Skip to content

Commit

Permalink
Update to latest Quark version (#91)
Browse files Browse the repository at this point in the history
Updates the Quark submodule to the latest
[commit](compound-finance/quark@4e5ba95)
in the Quark repo , which notably includes the changes to:

1. Move from `v,r,s` to `bytes` signatures
2. Switch from `CALLCODE` to `DELEGATECALL` 
3. Remove the `onlyWallet` reentrancy guard in favor of the
`nonReentrant` guard.
  • Loading branch information
kevincheng96 authored Oct 21, 2024
1 parent 14f377b commit 08f7025
Show file tree
Hide file tree
Showing 31 changed files with 405 additions and 396 deletions.
216 changes: 109 additions & 107 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,118 +1,120 @@
ApproveAndSwapTest:testSwap() (gas: 273935)
ApproveAndSwapTest:testSwapFailsIfWeExpectedTooMuch() (gas: 335013)
ApproveAndSwapTest:testSwapFailsWithNoApproval() (gas: 92109)
CCTPBridge:testBridgeToBase() (gas: 128036)
CometClaimRewardsTest:testClaimComp() (gas: 127404)
CometRepayAndWithdrawMultipleAssetsTest:testInvalidInput() (gas: 44602)
CometRepayAndWithdrawMultipleAssetsTest:testRepayAndWithdrawMultipleAssets() (gas: 134584)
CometSupplyMultipleAssetsAndBorrowTest:testInvalidInput() (gas: 44546)
CometSupplyMultipleAssetsAndBorrowTest:testSupplyMultipleAssetsAndBorrow() (gas: 276105)
ConditionalMulticallTest:testConditionalRunEmptyInputIsValid() (gas: 44953)
ConditionalMulticallTest:testConditionalRunInvalidInput() (gas: 45053)
ConditionalMulticallTest:testConditionalRunMulticallError() (gas: 288790)
ConditionalMulticallTest:testConditionalRunOnPeriodicRepay() (gas: 276093)
ConditionalMulticallTest:testConditionalRunPassed() (gas: 266956)
ConditionalMulticallTest:testConditionalRunUnmet() (gas: 76859)
EthcallTest:testEthcallCallReraiseError() (gas: 53333)
EthcallTest:testEthcallCounter() (gas: 65125)
EthcallTest:testEthcallShouldReturnCallResult() (gas: 45940)
EthcallTest:testEthcallSupplyUSDCToComet() (gas: 152864)
EthcallTest:testEthcallWithdrawUSDCFromComet() (gas: 305482)
GetDripTest:testDrip() (gas: 117212)
MorphoActionsTest:testRepayAndWithdrawCollateral() (gas: 124949)
MorphoActionsTest:testRepayMaxAndWithdrawCollateral() (gas: 99344)
MorphoActionsTest:testSupplyCollateralAndBorrow() (gas: 246334)
ApproveAndSwapTest:testSwap() (gas: 275122)
ApproveAndSwapTest:testSwapFailsIfWeExpectedTooMuch() (gas: 339569)
ApproveAndSwapTest:testSwapFailsWithNoApproval() (gas: 96664)
CCTPBridge:testBridgeToBase() (gas: 128986)
CometClaimRewardsTest:testClaimComp() (gas: 128593)
CometRepayAndWithdrawMultipleAssetsTest:testInvalidInput() (gas: 45788)
CometRepayAndWithdrawMultipleAssetsTest:testRepayAndWithdrawMultipleAssets() (gas: 135531)
CometSupplyMultipleAssetsAndBorrowTest:testInvalidInput() (gas: 45732)
CometSupplyMultipleAssetsAndBorrowTest:testSupplyMultipleAssetsAndBorrow() (gas: 277062)
ConditionalMulticallTest:testConditionalRunEmptyInputIsValid() (gas: 46140)
ConditionalMulticallTest:testConditionalRunInvalidInput() (gas: 46239)
ConditionalMulticallTest:testConditionalRunMulticallError() (gas: 290012)
ConditionalMulticallTest:testConditionalRunOnPeriodicRepay() (gas: 282038)
ConditionalMulticallTest:testConditionalRunPassed() (gas: 268155)
ConditionalMulticallTest:testConditionalRunUnmet() (gas: 78046)
EthcallTest:testEthcallCallReraiseError() (gas: 54519)
EthcallTest:testEthcallCounter() (gas: 66310)
EthcallTest:testEthcallShouldReturnCallResult() (gas: 47126)
EthcallTest:testEthcallSupplyUSDCToComet() (gas: 155234)
EthcallTest:testEthcallWithdrawUSDCFromComet() (gas: 309037)
GetDripTest:testDrip() (gas: 118389)
MorphoActionsTest:testRepayAndWithdrawCollateral() (gas: 126133)
MorphoActionsTest:testRepayMaxAndWithdrawCollateral() (gas: 100292)
MorphoActionsTest:testSupplyCollateralAndBorrow() (gas: 247518)
MorphoInfoTest:testBaseMainnet() (gas: 1622233)
MorphoInfoTest:testBaseSepolia() (gas: 743646)
MorphoInfoTest:testEthMainnet() (gas: 2636638)
MorphoInfoTest:testEthSepolia() (gas: 644206)
MorphoRewardsActionsTest:testClaim() (gas: 107567)
MorphoRewardsActionsTest:testClaimAll() (gas: 179400)
MorphoVaultActionsTest:testDeposit() (gas: 758763)
MorphoVaultActionsTest:testWithdraw() (gas: 567620)
MulticallTest:testCallcodeToMulticallSucceedsWhenUninitialized() (gas: 73035)
MulticallTest:testCreateSubWalletAndExecute() (gas: 602078)
MulticallTest:testEmptyInputIsValid() (gas: 44599)
MulticallTest:testExecutorCanMulticallAcrossSubwallets() (gas: 251487)
MulticallTest:testInvalidInput() (gas: 44813)
MulticallTest:testInvokeCounterTwice() (gas: 73189)
MulticallTest:testMulticallError() (gas: 281688)
MulticallTest:testMulticallShouldReturnCallResults() (gas: 75670)
MorphoRewardsActionsTest:testClaim() (gas: 108754)
MorphoRewardsActionsTest:testClaimAll() (gas: 180588)
MorphoVaultActionsTest:testDeposit() (gas: 759946)
MorphoVaultActionsTest:testWithdraw() (gas: 568804)
MulticallTest:testCallcodeToMulticallSucceedsWhenUninitialized() (gas: 74223)
MulticallTest:testCreateSubWalletAndExecute() (gas: 603893)
MulticallTest:testEmptyInputIsValid() (gas: 45785)
MulticallTest:testExecutorCanMulticallAcrossSubwallets() (gas: 253685)
MulticallTest:testInvalidInput() (gas: 45999)
MulticallTest:testInvokeCounterTwice() (gas: 74377)
MulticallTest:testMulticallError() (gas: 282876)
MulticallTest:testMulticallShouldReturnCallResults() (gas: 76844)
MulticallTest:testRevertsForInvalidCallContext() (gas: 11543)
MulticallTest:testSupplyWETHWithdrawUSDCOnComet() (gas: 246618)
MulticallTest:testSupplyWETHWithdrawUSDCOnComet() (gas: 247803)
PaycallTest:testInitializeProperlyFromConstructor() (gas: 6412)
PaycallTest:testPaycallAddress() (gas: 204118)
PaycallTest:testPaycallForPayWithUSDT() (gas: 115625)
PaycallTest:testPaycallForPayWithWBTC() (gas: 108765)
PaycallTest:testPaycallRevertsWhenCallReverts() (gas: 49555)
PaycallTest:testReturnCallResult() (gas: 85461)
PaycallTest:testRevertWhenCostIsMoreThanMaxPaymentCost() (gas: 95221)
PaycallTest:testPaycallAddress() (gas: 204488)
PaycallTest:testPaycallForPayWithUSDT() (gas: 116809)
PaycallTest:testPaycallForPayWithWBTC() (gas: 109949)
PaycallTest:testPaycallRevertsWhenCallReverts() (gas: 50738)
PaycallTest:testReturnCallResult() (gas: 86647)
PaycallTest:testRevertWhenCostIsMoreThanMaxPaymentCost() (gas: 96405)
PaycallTest:testRevertsForInvalidCallContext() (gas: 15789)
PaycallTest:testSimpleCounterAndPayWithUSDC() (gas: 136629)
PaycallTest:testSimpleTransferTokenAndPayWithUSDC() (gas: 137984)
PaycallTest:testSupplyWETHWithdrawUSDCOnCometAndPayWithUSDC() (gas: 289774)
PaycallTest:testSimpleCounterAndPayWithUSDC() (gas: 137814)
PaycallTest:testSimpleTransferTokenAndPayWithUSDC() (gas: 139168)
PaycallTest:testSupplyWETHWithdrawUSDCOnCometAndPayWithUSDC() (gas: 290960)
QuotecallTest:testInitializeProperlyFromConstructor() (gas: 6996)
QuotecallTest:testQuotecallForPayWithUSDT() (gas: 115729)
QuotecallTest:testQuotecallForPayWithWBTC() (gas: 108950)
QuotecallTest:testQuotecallRevertsWhenCallReverts() (gas: 85838)
QuotecallTest:testReturnCallResult() (gas: 105548)
QuotecallTest:testQuotecallForPayWithUSDT() (gas: 116913)
QuotecallTest:testQuotecallForPayWithWBTC() (gas: 110134)
QuotecallTest:testQuotecallRevertsWhenCallReverts() (gas: 87021)
QuotecallTest:testReturnCallResult() (gas: 106734)
QuotecallTest:testRevertsForInvalidCallContext() (gas: 15764)
QuotecallTest:testRevertsWhenQuoteTooHigh() (gas: 131301)
QuotecallTest:testRevertsWhenQuoteTooLow() (gas: 131143)
QuotecallTest:testSimpleCounterAndPayWithUSDC() (gas: 136765)
QuotecallTest:testSimpleTransferTokenAndPayWithUSDC() (gas: 138132)
RecurringSwapTest:testCancelRecurringSwap() (gas: 272600)
RecurringSwapTest:testRecurringSwapCanSwapMultipleTimes() (gas: 337021)
RecurringSwapTest:testRecurringSwapExactInAlternateSwap() (gas: 216061)
RecurringSwapTest:testRecurringSwapExactInSwap() (gas: 223781)
RecurringSwapTest:testRecurringSwapExactOutAlternateSwap() (gas: 219405)
RecurringSwapTest:testRecurringSwapExactOutSwap() (gas: 225744)
RecurringSwapTest:testRecurringSwapWithDifferentCalldata() (gas: 570083)
RecurringSwapTest:testRecurringSwapWithMultiplePriceFeeds() (gas: 240880)
RecurringSwapTest:testRevertsForExpiredQuarkOperation() (gas: 9578)
RecurringSwapTest:testRevertsForInvalidInput() (gas: 91043)
RecurringSwapTest:testRevertsForSwapBeforeNextSwapWindow() (gas: 245871)
QuotecallTest:testRevertsWhenQuoteTooHigh() (gas: 132485)
QuotecallTest:testRevertsWhenQuoteTooLow() (gas: 132327)
QuotecallTest:testSimpleCounterAndPayWithUSDC() (gas: 137950)
QuotecallTest:testSimpleTransferTokenAndPayWithUSDC() (gas: 139316)
RecurringSwapTest:testCancelRecurringSwap() (gas: 275992)
RecurringSwapTest:testRecurringSwapCanSwapMultipleTimes() (gas: 340719)
RecurringSwapTest:testRecurringSwapCannotSwapMultipleTimesForMissedWindows() (gas: 341492)
RecurringSwapTest:testRecurringSwapExactInAlternateSwap() (gas: 217681)
RecurringSwapTest:testRecurringSwapExactInSwap() (gas: 225425)
RecurringSwapTest:testRecurringSwapExactOutAlternateSwap() (gas: 220999)
RecurringSwapTest:testRecurringSwapExactOutSwap() (gas: 227339)
RecurringSwapTest:testRecurringSwapWithDifferentCalldata() (gas: 577151)
RecurringSwapTest:testRecurringSwapWithMultiplePriceFeeds() (gas: 242483)
RecurringSwapTest:testRevertsForExpiredQuarkOperation() (gas: 9916)
RecurringSwapTest:testRevertsForInvalidInput() (gas: 93610)
RecurringSwapTest:testRevertsForSwapBeforeNextSwapWindow() (gas: 248353)
RecurringSwapTest:testRevertsForSwapBeforeStartTime() (gas: 9223372036854754743)
RecurringSwapTest:testRevertsWhenSlippageParamsConfiguredWrong() (gas: 227765)
RecurringSwapTest:testRevertsWhenSlippageTooHigh() (gas: 227969)
SupplyActionsTest:testInvalidInput() (gas: 44611)
SupplyActionsTest:testRepayBorrow() (gas: 70904)
SupplyActionsTest:testSupply() (gas: 113213)
SupplyActionsTest:testSupplyFrom() (gas: 93016)
SupplyActionsTest:testSupplyMultipleCollateral() (gas: 251264)
SupplyActionsTest:testSupplyTo() (gas: 112708)
TransferActionsTest:testRevertsForTransferERC777ReentrancyAttackWithReentrancyGuard() (gas: 98027)
TransferActionsTest:testRevertsForTransferReentrancyAttackWithReentrancyGuard() (gas: 78814)
TransferActionsTest:testRevertsForTransferReentrancyAttackWithoutCallbackEnabled() (gas: 73817)
TransferActionsTest:testRevertsForTransferReentrantAttackWithStolenSignature() (gas: 84625)
TransferActionsTest:testTransferERC20TokenToEOA() (gas: 51656)
TransferActionsTest:testTransferERC20TokenToQuarkWallet() (gas: 52976)
TransferActionsTest:testTransferERC777SuccessWithEvilReceiverWithoutAttackAttempt() (gas: 74483)
TransferActionsTest:testTransferERC777TokenReentrancyAttackSuccessWithCallbackEnabled() (gas: 110337)
TransferActionsTest:testTransferNativeTokenToEOA() (gas: 75996)
TransferActionsTest:testTransferNativeTokenToQuarkWallet() (gas: 50662)
TransferActionsTest:testTransferReentrancyAttackSuccessWithCallbackEnabled() (gas: 93738)
TransferActionsTest:testTransferSuccessWithEvilReceiverWithoutAttackAttempt() (gas: 54853)
UniswapFlashLoanTest:testFlashLoanForCollateralSwapOnCompound() (gas: 368458)
UniswapFlashLoanTest:testRevertsForInsufficientFundsToRepayFlashLoan() (gas: 138730)
UniswapFlashLoanTest:testRevertsForInvalidCaller() (gas: 46273)
UniswapFlashLoanTest:testTokensOrderInvariant() (gas: 81719)
UniswapFlashSwapExactOutTest:testInvalidCallerFlashSwap() (gas: 46469)
UniswapFlashSwapExactOutTest:testNotEnoughToPayFlashSwap() (gas: 233929)
RecurringSwapTest:testRevertsForSwapWhenSwapWindowIsClosed() (gas: 342645)
RecurringSwapTest:testRevertsWhenSlippageParamsConfiguredWrong() (gas: 229363)
RecurringSwapTest:testRevertsWhenSlippageTooHigh() (gas: 229583)
SupplyActionsTest:testInvalidInput() (gas: 45797)
SupplyActionsTest:testRepayBorrow() (gas: 71850)
SupplyActionsTest:testSupply() (gas: 114160)
SupplyActionsTest:testSupplyFrom() (gas: 93963)
SupplyActionsTest:testSupplyMultipleCollateral() (gas: 252211)
SupplyActionsTest:testSupplyTo() (gas: 113656)
TransferActionsTest:testRevertsForTransferERC777ReentrancyAttackWithReentrancyGuard() (gas: 99528)
TransferActionsTest:testRevertsForTransferReentrancyAttackWithReentrancyGuard() (gas: 80304)
TransferActionsTest:testRevertsForTransferReentrancyAttackWithoutCallbackEnabled() (gas: 75206)
TransferActionsTest:testRevertsForTransferReentrantAttackWithStolenSignature() (gas: 87371)
TransferActionsTest:testTransferERC20TokenToEOA() (gas: 52858)
TransferActionsTest:testTransferERC20TokenToQuarkWallet() (gas: 54177)
TransferActionsTest:testTransferERC777SuccessWithEvilReceiverWithoutAttackAttempt() (gas: 75987)
TransferActionsTest:testTransferERC777TokenReentrancyAttackSuccessWithCallbackEnabled() (gas: 111522)
TransferActionsTest:testTransferNativeTokenToEOA() (gas: 77491)
TransferActionsTest:testTransferNativeTokenToQuarkWallet() (gas: 52157)
TransferActionsTest:testTransferReentrancyAttackSuccessWithCallbackEnabled() (gas: 94922)
TransferActionsTest:testTransferSuccessWithEvilReceiverWithoutAttackAttempt() (gas: 56348)
UniswapFlashLoanTest:testFlashLoanForCollateralSwapOnCompound() (gas: 369646)
UniswapFlashLoanTest:testRevertsForInsufficientFundsToRepayFlashLoan() (gas: 139917)
UniswapFlashLoanTest:testRevertsForInvalidCaller() (gas: 47459)
UniswapFlashLoanTest:testTokensOrderInvariant() (gas: 82904)
UniswapFlashSwapExactOutTest:testInvalidCallerFlashSwap() (gas: 47655)
UniswapFlashSwapExactOutTest:testNotEnoughToPayFlashSwap() (gas: 235116)
UniswapFlashSwapExactOutTest:testRevertsIfCalledDirectly() (gas: 104305)
UniswapFlashSwapExactOutTest:testUniswapFlashSwapExactOutLeverageComet() (gas: 311072)
UniswapSwapActionsTest:testApprovalRefund() (gas: 159188)
UniswapSwapActionsTest:testBuyAssetOneStop() (gas: 250010)
UniswapSwapActionsTest:testBuyAssetTwoStops() (gas: 363122)
UniswapSwapActionsTest:testSellAssetOneStop() (gas: 246694)
UniswapSwapActionsTest:testSellAssetTwoStops() (gas: 368042)
WithdrawActionsTest:testBorrow() (gas: 150239)
WithdrawActionsTest:testInvalidInput() (gas: 44591)
WithdrawActionsTest:testWithdraw() (gas: 64886)
WithdrawActionsTest:testWithdrawFrom() (gas: 64296)
WithdrawActionsTest:testWithdrawMultipleAssets() (gas: 139993)
WithdrawActionsTest:testWithdrawTo() (gas: 64824)
WrapperScriptsTest:testUnwrapWETH() (gas: 39141)
WrapperScriptsTest:testUnwrapWstETH() (gas: 87724)
WrapperScriptsTest:testWrapETH() (gas: 73485)
WrapperScriptsTest:testWrapStETH() (gas: 105947)
UniswapFlashSwapExactOutTest:testUniswapFlashSwapExactOutLeverageComet() (gas: 312269)
UniswapSwapActionsTest:testApprovalRefund() (gas: 160372)
UniswapSwapActionsTest:testBuyAssetOneStop() (gas: 252378)
UniswapSwapActionsTest:testBuyAssetTwoStops() (gas: 365490)
UniswapSwapActionsTest:testSellAssetOneStop() (gas: 249062)
UniswapSwapActionsTest:testSellAssetTwoStops() (gas: 370410)
WithdrawActionsTest:testBorrow() (gas: 151422)
WithdrawActionsTest:testInvalidInput() (gas: 45776)
WithdrawActionsTest:testWithdraw() (gas: 65832)
WithdrawActionsTest:testWithdrawFrom() (gas: 65244)
WithdrawActionsTest:testWithdrawMultipleAssets() (gas: 140950)
WithdrawActionsTest:testWithdrawTo() (gas: 65772)
WrapperScriptsTest:testUnwrapWETH() (gas: 40088)
WrapperScriptsTest:testUnwrapWstETH() (gas: 88908)
WrapperScriptsTest:testWrapETH() (gas: 74669)
WrapperScriptsTest:testWrapStETH() (gas: 106893)
2 changes: 1 addition & 1 deletion lib/quark
Submodule quark updated 56 files
+212 −162 .gas-snapshot
+3 −3 .github/workflows/gas-snapshot.yml
+2 −2 .github/workflows/lint.yml
+4 −4 .github/workflows/test.yml
+8 −13 README.md
+11 −40 diagrams/diagrams.md
+7 −4 foundry.toml
+1 −1 script/deploy-code-jar.sh
+1 −1 script/deploy-quark.sh
+1 −1 script/prepare-release.sh
+1 −1 script/update-snapshot.sh
+7 −2 src/codejar/foundry.toml
+9 −2 src/quark-core-scripts/foundry.toml
+1 −1 src/quark-core-scripts/src/Cancel.sol
+2 −0 src/quark-core-scripts/src/UniswapFlashLoan.sol
+2 −0 src/quark-core-scripts/src/UniswapFlashSwapExactOut.sol
+9 −2 src/quark-core/foundry.toml
+8 −10 src/quark-core/src/QuarkNonceManager.sol
+57 −39 src/quark-core/src/QuarkScript.sol
+50 −78 src/quark-core/src/QuarkWallet.sol
+14 −9 src/quark-core/src/interfaces/IQuarkWallet.sol
+2 −4 src/quark-core/src/periphery/BatchExecutor.sol
+9 −2 src/quark-factory/foundry.toml
+4 −6 src/quark-proxy/foundry.toml
+14 −30 src/quark-proxy/src/QuarkWalletProxyFactory.sol
+33 −35 test/ReplayableTransactions.t.sol
+1 −1 test/lib/AllowCallbacks.sol
+4 −8 test/lib/BatchCallback.sol
+0 −81 test/lib/EvilReceiver.sol
+9 −2 test/lib/ExecuteOtherOperation.sol
+16 −0 test/lib/GetCallbackDetails.sol
+2 −2 test/lib/GetMessageDetails.sol
+16 −24 test/lib/Noncer.sol
+7 −4 test/lib/Reentrancy.sol
+25 −10 test/lib/SignatureHelper.sol
+2 −2 test/lib/Transfer.sol
+21 −23 test/quark-core-scripts/ConditionalMulticall.t.sol
+17 −19 test/quark-core-scripts/Ethcall.t.sol
+20 −22 test/quark-core-scripts/Multicall.t.sol
+17 −19 test/quark-core-scripts/Paycall.t.sol
+17 −19 test/quark-core-scripts/Quotecall.t.sol
+59 −13 test/quark-core-scripts/UniswapFlashLoan.t.sol
+57 −9 test/quark-core-scripts/UniswapFlashSwapExactOut.t.sol
+3 −3 test/quark-core/BatchCallback.t.sol
+81 −42 test/quark-core/Callbacks.t.sol
+4 −4 test/quark-core/EIP1271.t.sol
+24 −60 test/quark-core/EIP712.t.sol
+2 −2 test/quark-core/Executor.t.sol
+39 −59 test/quark-core/Noncer.t.sol
+16 −0 test/quark-core/QuarkNonceManager.t.sol
+224 −168 test/quark-core/QuarkWallet.t.sol
+8 −8 test/quark-core/Reverts.t.sol
+5 −5 test/quark-core/isValidSignature.t.sol
+20 −40 test/quark-core/periphery/BatchExecutor.t.sol
+2 −2 test/quark-proxy/QuarkMinimalProxy.t.sol
+31 −29 test/quark-proxy/QuarkWalletProxyFactory.t.sol
2 changes: 1 addition & 1 deletion src/Cancel.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.27;

import {IQuarkWallet} from "quark-core/src/QuarkWallet.sol";
import {IQuarkWallet} from "quark-core/src/interfaces/IQuarkWallet.sol";
import {QuarkNonceManager} from "quark-core/src/QuarkNonceManager.sol";

/**
Expand Down
4 changes: 2 additions & 2 deletions src/DeFiScripts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ contract TransferActions is QuarkScript {
* @param recipient The recipient address
* @param amount The amount to transfer
*/
function transferERC20Token(address token, address recipient, uint256 amount) external onlyWallet {
function transferERC20Token(address token, address recipient, uint256 amount) external nonReentrant {
IERC20(token).safeTransfer(recipient, amount);
}

Expand All @@ -207,7 +207,7 @@ contract TransferActions is QuarkScript {
* @param recipient The recipient address
* @param amount The amount to transfer
*/
function transferNativeToken(address recipient, uint256 amount) external onlyWallet {
function transferNativeToken(address recipient, uint256 amount) external nonReentrant {
(bool success, bytes memory data) = payable(recipient).call{value: amount}("");
if (!success) {
revert DeFiScriptErrors.TransferFailed(data);
Expand Down
2 changes: 1 addition & 1 deletion src/RecurringSwap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ contract RecurringSwap is QuarkScript {

// Emit the swap event
emit SwapExecuted(
msg.sender,
address(this),
config.swapParams.recipient,
config.swapParams.tokenIn,
config.swapParams.tokenOut,
Expand Down
12 changes: 6 additions & 6 deletions test/ApproveAndSwap.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ contract ApproveAndSwapTest is Test {
abi.encodeCall(ApproveAndSwap.run, (ZEROX_PROXY, USDC, sellAmount, WETH, buyAmount, data)),
ScriptType.ScriptSource
);
(uint8 v, bytes32 r, bytes32 s) = new SignatureHelper().signOp(alicePrivateKey, wallet, op);
bytes memory signature = new SignatureHelper().signOp(alicePrivateKey, wallet, op);

vm.resumeGasMetering();

wallet.executeQuarkOperation(op, v, r, s);
wallet.executeQuarkOperation(op, signature);

// The swap will always yield the same amount of WETH since we test at a specific block
assertEq(IERC20(WETH).balanceOf(address(wallet)), 420691117291334340);
Expand Down Expand Up @@ -91,12 +91,12 @@ contract ApproveAndSwapTest is Test {
abi.encodeCall(ApproveAndSwap.run, (ZEROX_PROXY, USDC, sellAmount, WETH, buyAmount, data)),
ScriptType.ScriptSource
);
(uint8 v, bytes32 r, bytes32 s) = new SignatureHelper().signOp(alicePrivateKey, wallet, op);
bytes memory signature = new SignatureHelper().signOp(alicePrivateKey, wallet, op);

vm.resumeGasMetering();

vm.expectRevert();
wallet.executeQuarkOperation(op, v, r, s);
wallet.executeQuarkOperation(op, signature);

// The swap will always yield the same amount of WETH since we test at a specific block
assertEq(IERC20(WETH).balanceOf(address(wallet)), 0);
Expand Down Expand Up @@ -125,12 +125,12 @@ contract ApproveAndSwapTest is Test {
abi.encodeCall(ApproveAndSwap.run, (ZEROX_PROXY, USDC, sellAmount, WETH, buyAmount, data)),
ScriptType.ScriptSource
);
(uint8 v, bytes32 r, bytes32 s) = new SignatureHelper().signOp(alicePrivateKey, wallet, op);
bytes memory signature = new SignatureHelper().signOp(alicePrivateKey, wallet, op);

vm.resumeGasMetering();

vm.expectRevert();
wallet.executeQuarkOperation(op, v, r, s);
wallet.executeQuarkOperation(op, signature);

// The swap will always yield the same amount of WETH since we test at a specific block
assertEq(IERC20(WETH).balanceOf(address(wallet)), 0);
Expand Down
4 changes: 2 additions & 2 deletions test/CCTPBridgeActions.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ contract CCTPBridge is Test {
),
ScriptType.ScriptSource
);
(uint8 v, bytes32 r, bytes32 s) = new SignatureHelper().signOp(alicePrivateKey, wallet, op);
bytes memory signature = new SignatureHelper().signOp(alicePrivateKey, wallet, op);

assertEq(IERC20(USDC).balanceOf(address(wallet)), 1_000_000e6);
vm.resumeGasMetering();
wallet.executeQuarkOperation(op, v, r, s);
wallet.executeQuarkOperation(op, signature);
assertEq(IERC20(USDC).balanceOf(address(wallet)), 500_000e6);
}
}
4 changes: 2 additions & 2 deletions test/CometClaimRewards.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ contract CometClaimRewardsTest is Test {
abi.encodeCall(CometClaimRewards.claim, (cometRewards, comets, address(wallet))),
ScriptType.ScriptSource
);
(uint8 v, bytes32 r, bytes32 s) = new SignatureHelper().signOp(alicePrivateKey, wallet, op);
bytes memory signature = new SignatureHelper().signOp(alicePrivateKey, wallet, op);
assertEq(IERC20(COMP).balanceOf(address(wallet)), 0e6);

vm.resumeGasMetering();
wallet.executeQuarkOperation(op, v, r, s);
wallet.executeQuarkOperation(op, signature);

assertGt(IERC20(COMP).balanceOf(address(wallet)), 0e6);
}
Expand Down
Loading

0 comments on commit 08f7025

Please sign in to comment.