Skip to content

Commit

Permalink
Update scripts to compilable state
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincheng96 committed Sep 16, 2024
1 parent 8e03cb1 commit 2b91662
Show file tree
Hide file tree
Showing 99 changed files with 457 additions and 280 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: "nightly-de33b6af53005037b463318d2628b5cfcaf39916"
version: nightly

- name: Install dependencies
run: forge install
Expand Down
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
src = "src"
out = "out"
test = "test"
solc = "0.8.23"
evm_version = "paris"
solc = "0.8.27"
evm_version = "cancun"
bytecode_hash = "none"
cbor_metadata = false

Expand Down
7 changes: 1 addition & 6 deletions script/DeployQuarkScripts.s.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import "forge-std/Script.sol";
import "forge-std/console.sol";

import {CodeJar} from "codejar/src/CodeJar.sol";

import {QuarkWallet} from "quark-core/src/QuarkWallet.sol";
import {QuarkStateManager} from "quark-core/src/QuarkStateManager.sol";

import {Ethcall} from "quark-core-scripts/src/Ethcall.sol";
import {Multicall} from "quark-core-scripts/src/Multicall.sol";

import {QuarkWalletProxyFactory} from "quark-proxy/src/QuarkWalletProxyFactory.sol";

import {
CometSupplyActions,
CometWithdrawActions,
Expand Down
2 changes: 1 addition & 1 deletion src/BridgeScripts.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {ITokenMessenger} from "./interfaces/ITokenMessenger.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/ConditionalMulticall.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import "./lib/ConditionalChecker.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/DeFiScripts.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/Ethcall.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

/**
* @title Ethcall Core Script
Expand Down
2 changes: 1 addition & 1 deletion src/GetDrip.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.8.23;
pragma solidity 0.8.27;

// To handle loading up new accounts on stage and dev
interface Fauceteer {
Expand Down
2 changes: 1 addition & 1 deletion src/MorphoScripts.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/Multicall.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

/**
* @title Multicall Core Script
Expand Down
2 changes: 1 addition & 1 deletion src/Paycall.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import "./vendor/chainlink/AggregatorV3Interface.sol";
import "openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/Quotecall.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import "./vendor/chainlink/AggregatorV3Interface.sol";
import "openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down
9 changes: 4 additions & 5 deletions src/RecurringSwap.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
Expand Down Expand Up @@ -41,7 +41,7 @@ contract RecurringSwap is QuarkScript {
uint256 public constant PRECISION_FACTOR = 1e18;

/**
* @dev Note: This script uses the following storage layout in the QuarkStateManager:
* @dev Note: This script uses the following storage layout in the QuarkNonceManager:
* mapping(bytes32 hashedSwapConfig => uint256 nextSwapTime)
* where hashedSwapConfig = keccak256(SwapConfig)
*/
Expand Down Expand Up @@ -82,16 +82,15 @@ contract RecurringSwap is QuarkScript {

/// @notice Cancel the recurring swap for the current nonce
function cancel() external {
// Not explicitly clearing the nonce just cancels the replayable txn
// A no-op that can be called with `QuarkOperation.isReplayable = false` to cancel the
// replayable operation
}

/**
* @notice Execute a swap given a configuration for a recurring swap
* @param config The configuration for a recurring swap order
*/
function swap(SwapConfig calldata config) public {
allowReplay();

if (config.slippageParams.priceFeeds.length == 0) {
revert InvalidInput();
}
Expand Down
2 changes: 1 addition & 1 deletion src/UniswapFlashLoan.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import "openzeppelin/token/ERC20/utils/SafeERC20.sol";
import "v3-core/contracts/interfaces/IUniswapV3Pool.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/UniswapFlashSwapExactOut.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import "openzeppelin/token/ERC20/utils/SafeERC20.sol";
import "v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/WrapperScripts.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol";
import {IWETH} from "./interfaces/IWETH.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/builder/Accounts.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {Math} from "src/lib/Math.sol";
import {PaymentInfo} from "./PaymentInfo.sol";
Expand Down
41 changes: 27 additions & 14 deletions src/builder/Actions.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {Accounts} from "./Accounts.sol";
import {BridgeRoutes, CCTP} from "./BridgeRoutes.sol";
Expand Down Expand Up @@ -593,7 +593,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(scriptSources[0]),
scriptCalldata: CCTP.encodeBridgeUSDC(
bridge.srcChainId, bridge.destinationChainId, bridge.amount, bridge.recipient, srcUSDCPositions.asset
Expand Down Expand Up @@ -668,7 +669,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(CometSupplyMultipleAssetsAndBorrow).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -742,7 +744,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(CometRepayAndWithdrawMultipleAssets).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -804,7 +807,8 @@ library Actions {
}
// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(CometSupplyActions).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -863,7 +867,8 @@ library Actions {
}
// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(CometWithdrawActions).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -925,7 +930,8 @@ library Actions {
}
// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(TransferActions).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -987,7 +993,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(MorphoActions).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -1054,7 +1061,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(MorphoActions).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -1118,7 +1126,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(MorphoVaultActions).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -1175,7 +1184,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(MorphoVaultActions).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -1226,7 +1236,8 @@ library Actions {
Accounts.QuarkState memory accountState = Accounts.findQuarkState(wrapOrUnwrap.sender, accounts.quarkStates);
// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(WrapperActions).creationCode),
scriptCalldata: TokenWrapper.encodeActionToWrapOrUnwrap(
wrapOrUnwrap.chainId, wrapOrUnwrap.assetSymbol, wrapOrUnwrap.amount
Expand Down Expand Up @@ -1296,7 +1307,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: false,
scriptAddress: CodeJarHelper.getCodeAddress(type(ApproveAndSwap).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down Expand Up @@ -1385,7 +1397,8 @@ library Actions {

// Construct QuarkOperation
IQuarkWallet.QuarkOperation memory quarkOperation = IQuarkWallet.QuarkOperation({
nonce: accountState.quarkNextNonce,
nonce: bytes32(uint256(accountState.quarkNextNonce)),
isReplayable: true,
scriptAddress: CodeJarHelper.getCodeAddress(type(RecurringSwap).creationCode),
scriptCalldata: scriptCalldata,
scriptSources: scriptSources,
Expand Down
2 changes: 1 addition & 1 deletion src/builder/BridgeRoutes.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {QuarkBuilder} from "./QuarkBuilder.sol";
import {CCTPBridgeActions} from "../BridgeScripts.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/builder/CodeJarHelper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

library CodeJarHelper {
/* ===== Constants ===== */
Expand Down
2 changes: 1 addition & 1 deletion src/builder/EIP712Helper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {IQuarkWallet} from "quark-core/src/interfaces/IQuarkWallet.sol";
import {QuarkWalletMetadata} from "quark-core/src/QuarkWallet.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/builder/Errors.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

/// Library of shared errors used across Quark Builder files
library Errors {
Expand Down
2 changes: 1 addition & 1 deletion src/builder/HashMap.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {List} from "./List.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/builder/List.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.23;
pragma solidity 0.8.27;

import {IQuarkWallet} from "quark-core/src/interfaces/IQuarkWallet.sol";
import {Actions} from "./Actions.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/builder/MorphoInfo.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {MarketParams} from "src/interfaces/IMorpho.sol";
import {HashMap} from "./HashMap.sol";
Expand Down
3 changes: 2 additions & 1 deletion src/builder/PaycallWrapper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {CodeJarHelper} from "./CodeJarHelper.sol";
import {IQuarkWallet} from "quark-core/src/interfaces/IQuarkWallet.sol";
Expand All @@ -25,6 +25,7 @@ library PaycallWrapper {

return IQuarkWallet.QuarkOperation({
nonce: operation.nonce,
isReplayable: operation.isReplayable,
scriptAddress: CodeJarHelper.getCodeAddress(paycallSource),
scriptCalldata: abi.encodeWithSelector(
Paycall.run.selector, operation.scriptAddress, operation.scriptCalldata, maxPaymentCost
Expand Down
2 changes: 1 addition & 1 deletion src/builder/PaymentInfo.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {Strings} from "./Strings.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/builder/PriceFeeds.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {Strings} from "./Strings.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/builder/QuarkBuilder.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

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

Expand Down
2 changes: 1 addition & 1 deletion src/builder/QuarkBuilderHelper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.23;
pragma solidity ^0.8.27;

import {BridgeRoutes} from "./BridgeRoutes.sol";

Expand Down
Loading

0 comments on commit 2b91662

Please sign in to comment.