Skip to content

Commit

Permalink
Adds Delegation MetaSwap Adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzel98 committed Feb 22, 2025
1 parent d522a38 commit 708d806
Show file tree
Hide file tree
Showing 7 changed files with 1,271 additions and 13 deletions.
22 changes: 12 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ SALT=0
DELEGATION_MANAGER_ADDRESS=
ENTRYPOINT_ADDRESS=0x0000000071727De22E5E9d8BAf0edAc6f37da032
MULTISIG_DELEGATOR_IMPLEMENTATION_ADDRESS=
META_SWAP_ADAPTER_OWNER_ADDRESS=
METASWAP_ADDRESS=

# Required for verifying contracts
ETHERSCAN_API_KEY=
Expand All @@ -15,13 +17,13 @@ POLYGONSCAN_API_KEY=


# RPC URLs
MAINNET_RPC_URL=https://mainnet.infura.io/v3/...
ARBITRUM_RPC_URL=https://arbitrum-mainnet.infura.io/v3/...
BASE_RPC_URL=https://base-mainnet.infura.io/v3/...
LINEA_RPC_URL=https://linea-mainnet.infura.io/v3/...
OPTIMISM_RPC_URL=https://optimism-mainnet.infura.io/v3/...
POLYGON_RPC_URL=https://polygon-mainnet.infura.io/v3/...
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/...
LINEA_SEPOLIA_RPC_URL=https://linea-sepolia.infura.io/v3/...
BASE_SEPOLIA_RPC_URL=https://base-sepolia.infura.io/v3/...

RPC_API_KEY=
MAINNET_RPC_URL=https://mainnet.infura.io/v3/${RPC_API_KEY}
ARBITRUM_RPC_URL=https://arbitrum-mainnet.infura.io/v3/${RPC_API_KEY}
BASE_RPC_URL=https://base-mainnet.infura.io/v3/${RPC_API_KEY}
LINEA_RPC_URL=https://linea-mainnet.infura.io/v3/${RPC_API_KEY}
OPTIMISM_RPC_URL=https://optimism-mainnet.infura.io/v3/${RPC_API_KEY}
POLYGON_RPC_URL=https://polygon-mainnet.infura.io/v3/${RPC_API_KEY}
SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/${RPC_API_KEY}
LINEA_SEPOLIA_RPC_URL=https://linea-sepolia.infura.io/v3/${RPC_API_KEY}
BASE_SEPOLIA_RPC_URL=https://base-sepolia.infura.io/v3/${RPC_API_KEY}
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ jobs:
run: forge install

- name: Check contract sizes
run: forge build --sizes --skip test --skip script
run: forge build --sizes --skip test --skip script --optimize true

- name: Run tests
run: forge test -vvv
env:
LINEA_RPC_URL: ${{ secrets.LINEA_RPC_URL }}
49 changes: 49 additions & 0 deletions script/DeployDelegationMetaSwapAdapter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// SPDX-License-Identifier: MIT AND Apache-2.0
pragma solidity 0.8.23;

import "forge-std/Script.sol";
import { console2 } from "forge-std/console2.sol";

import { DelegationMetaSwapAdapter } from "../src/helpers/DelegationMetaSwapAdapter.sol";
import { IDelegationManager } from "../src/interfaces/IDelegationManager.sol";
import { IMetaSwap } from "../src/helpers/interfaces/IMetaSwap.sol";

/**
* @title DeployDelegationMetaSwapAdapter
* @notice Deploys the delegationMetaSwapAdapter contract.
* @dev These contracts are likely already deployed on a testnet or mainnet as many are singletons.
* @dev Fill the required variables in the .env file
* @dev run the script with:
* forge script script/DeployDelegationMetaSwapAdapter.s.sol --rpc-url <your_rpc_url> --private-key $PRIVATE_KEY --broadcast
*/
contract DeployDelegationMetaSwapAdapter is Script {
bytes32 salt;
address deployer;
address metaSwapAdapterOwner;
IDelegationManager delegationManager;
IMetaSwap metaSwap;

function setUp() public {
salt = bytes32(abi.encodePacked(vm.envString("SALT")));
metaSwapAdapterOwner = vm.envAddress("META_SWAP_ADAPTER_OWNER_ADDRESS");
delegationManager = IDelegationManager(vm.envAddress("DELEGATION_MANAGER_ADDRESS"));
metaSwap = IMetaSwap(vm.envAddress("METASWAP_ADDRESS"));
deployer = msg.sender;
console2.log("~~~");
console2.log("Deployer: %s", address(deployer));
console2.log("DelegationMetaSwapAdapter Owner %s", address(metaSwapAdapterOwner));
console2.log("Salt:");
console2.logBytes32(salt);
}

function run() public {
console2.log("~~~");
vm.startBroadcast();

address delegationMetaSwapAdapter =
address(new DelegationMetaSwapAdapter{ salt: salt }(metaSwapAdapterOwner, delegationManager, metaSwap));
console2.log("DelegationMetaSwapAdapter: %s", delegationMetaSwapAdapter);

vm.stopBroadcast();
}
}
Loading

0 comments on commit 708d806

Please sign in to comment.