-
-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathDeployDelegationMetaSwapAdapter.s.sol
More file actions
60 lines (53 loc) · 2.56 KB
/
DeployDelegationMetaSwapAdapter.s.sol
File metadata and controls
60 lines (53 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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;
address swapApiSignerEnforcer;
IDelegationManager delegationManager;
IMetaSwap metaSwap;
address argsEqualityCheckEnforcer;
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"));
swapApiSignerEnforcer = vm.envAddress("SWAPS_API_SIGNER_ADDRESS");
argsEqualityCheckEnforcer = vm.envAddress("ARGS_EQUALITY_CHECK_ENFORCER_ADDRESS");
deployer = msg.sender;
console2.log("~~~");
console2.log("MetaSwap: %s", address(metaSwap));
console2.log("SwapApiSignerEnforcer: %s", address(swapApiSignerEnforcer));
console2.log("ArgsEqualityCheckEnforcer: %s", address(argsEqualityCheckEnforcer));
console2.log("DelegationManager: %s", address(delegationManager));
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, swapApiSignerEnforcer, delegationManager, metaSwap, argsEqualityCheckEnforcer
)
);
console2.log("DelegationMetaSwapAdapter: %s", delegationMetaSwapAdapter);
vm.stopBroadcast();
}
}