forked from 0xgeorgemathew/tap-that-x
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeploy.s.sol
More file actions
142 lines (120 loc) · 7.03 KB
/
Copy pathDeploy.s.sol
File metadata and controls
142 lines (120 loc) · 7.03 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "./DeployHelpers.s.sol";
import { MockUSDC } from "../contracts/MockUSDC.sol";
import { TapThatXRegistry } from "../contracts/core/TapThatXRegistry.sol";
import { TapThatXProtocol } from "../contracts/core/TapThatXProtocol.sol";
import { TapThatXConfiguration } from "../contracts/core/TapThatXConfiguration.sol";
import { TapThatXExecutor } from "../contracts/core/TapThatXExecutor.sol";
import { USDCTapPayment } from "../contracts/examples/USDCTapPayment.sol";
import { TapThatXAaveRebalancer } from "../contracts/extensions/TapThatXAaveRebalancer.sol";
import { TapThatXAavePositionCloser } from "../contracts/extensions/TapThatXAavePositionCloser.sol";
import { TapThatXBridgeETHViaWETH } from "../contracts/extensions/TapThatXBridgeETHViaWETH.sol";
import { TapThatXPaymentTerminal } from "../contracts/extensions/TapThatXPaymentTerminal.sol";
/**
* @notice Chain-specific deploy script for Tap That X Protocol
* @dev Supports Sepolia (bridge testing + PYUSD) and Base Sepolia (full features)
*
* Sepolia (11155111):
* 1. TapThatXRegistry - Chip registration and ownership
* 2. TapThatXProtocol - Generic chip-authorized execution engine
* 3. TapThatXConfiguration - Store action configurations per chip
* 4. TapThatXExecutor - Execute pre-configured tap actions
* 5. TapThatXPaymentTerminal - Payment terminal with PYUSD (0xcac524bca292aaade2df8a05cc58f0a65b1b3bb9)
* 6. TapThatXBridgeETHViaWETH - Bridge ETH via WETH to OP + Base Sepolia
*
* Base Sepolia (84532):
* 1-4. Core contracts (same as above)
* 5. MockUSDC - Test USDC for ERC20 transfers
* 6. TapThatXPaymentTerminal - Payment terminal with MockUSDC
* 7. TapThatXAaveRebalancer - Aave position rebalancer
* 8. TapThatXAavePositionCloser - Aave position closer
*
* Usage:
* forge script script/Deploy.s.sol --rpc-url sepolia --broadcast # Sepolia
* forge script script/Deploy.s.sol --rpc-url base-sepolia --broadcast # Base Sepolia
*/
contract Deploy is ScaffoldETHDeploy {
// Production USDC addresses for mainnet chains
function run() external ScaffoldEthDeployerRunner {
// Only deploy on Sepolia (bridge testing) or Base Sepolia (full features)
require(
block.chainid == 11155111 || block.chainid == 84532,
"Deploy: Only supported on Sepolia (11155111) or Base Sepolia (84532)"
);
// Deploy TapThatXRegistry
TapThatXRegistry registry = new TapThatXRegistry();
console.log("TapThatXRegistry deployed at:", address(registry));
// Register deployment for frontend
deployments.push(Deployment({ name: "TapThatXRegistry", addr: address(registry) }));
// Deploy TapThatXProtocol
TapThatXProtocol protocol = new TapThatXProtocol(address(registry));
console.log("TapThatXProtocol deployed at:", address(protocol));
// Register deployment for frontend
deployments.push(Deployment({ name: "TapThatXProtocol", addr: address(protocol) }));
// Deploy TapThatXConfiguration
TapThatXConfiguration configuration = new TapThatXConfiguration(address(registry));
console.log("TapThatXConfiguration deployed at:", address(configuration));
// Register deployment for frontend
deployments.push(Deployment({ name: "TapThatXConfiguration", addr: address(configuration) }));
// Deploy TapThatXExecutor
TapThatXExecutor executor = new TapThatXExecutor(address(protocol), address(configuration));
console.log("TapThatXExecutor deployed at:", address(executor));
// Register deployment for frontend
deployments.push(Deployment({ name: "TapThatXExecutor", addr: address(executor) }));
// Deploy TapThatXPaymentTerminal (both chains)
TapThatXPaymentTerminal paymentTerminal = new TapThatXPaymentTerminal(address(registry), address(protocol));
console.log("TapThatXPaymentTerminal deployed at:", address(paymentTerminal));
deployments.push(Deployment({ name: "TapThatXPaymentTerminal", addr: address(paymentTerminal) }));
// Reference PYUSD token for Sepolia
if (block.chainid == 11155111) {
// PYUSD on Sepolia (6 decimals)
address PYUSD_SEPOLIA = 0xCaC524BcA292aaade2DF8A05cC58F0a65B1B3bB9;
console.log("PYUSD (Sepolia) at:", PYUSD_SEPOLIA);
deployments.push(Deployment({ name: "PyUSD", addr: PYUSD_SEPOLIA }));
}
// Deploy TapThatXBridgeETHViaWETH (Sepolia only - for bridging to OP + Base)
if (block.chainid == 11155111) {
// Sepolia addresses for WETH and L1StandardBridges
address WETH_SEPOLIA = 0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9;
address BRIDGE_OP_SEPOLIA = 0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1;
address BRIDGE_BASE_SEPOLIA = 0xfd0Bf71F60660E2f608ed56e1659C450eB113120;
TapThatXBridgeETHViaWETH bridgeExtension = new TapThatXBridgeETHViaWETH(
WETH_SEPOLIA,
BRIDGE_OP_SEPOLIA,
BRIDGE_BASE_SEPOLIA,
address(protocol)
);
console.log("TapThatXBridgeETHViaWETH deployed at:", address(bridgeExtension));
deployments.push(Deployment({ name: "TapThatXBridgeETHViaWETH", addr: address(bridgeExtension) }));
}
// Deploy MockUSDC (Base Sepolia only - for ERC20 transfer testing)
if (block.chainid == 84532) {
MockUSDC usdc = new MockUSDC();
console.log("MockUSDC deployed at:", address(usdc));
deployments.push(Deployment({ name: "MockUSDC", addr: address(usdc) }));
}
// Deploy TapThatXAaveRebalancer (Base Sepolia only)
if (block.chainid == 84532) {
// Base Sepolia Aave V3 Pool address
address aavePool = 0x8bAB6d1b75f19e9eD9fCe8b9BD338844fF79aE27;
TapThatXAaveRebalancer rebalancer = new TapThatXAaveRebalancer(aavePool, address(protocol));
console.log("TapThatXAaveRebalancer deployed at:", address(rebalancer));
deployments.push(Deployment({ name: "TapThatXAaveRebalancer", addr: address(rebalancer) }));
TapThatXAavePositionCloser closer = new TapThatXAavePositionCloser(aavePool, address(protocol));
console.log("TapThatXAavePositionCloser deployed at:", address(closer));
deployments.push(Deployment({ name: "TapThatXAavePositionCloser", addr: address(closer) }));
}
console.log("\n=== Tap That X Protocol Deployed ===");
console.log("Chain ID:", block.chainid);
console.log("TapThatXRegistry:", address(registry));
console.log("TapThatXProtocol:", address(protocol));
console.log("TapThatXConfiguration:", address(configuration));
console.log("TapThatXExecutor:", address(executor));
console.log("TapThatXPaymentTerminal:", address(paymentTerminal));
if (block.chainid == 11155111) {
console.log("PYUSD (Sepolia):", 0xCaC524BcA292aaade2DF8A05cC58F0a65B1B3bB9);
}
console.log("\nNext: yarn verify --network <network>");
}
}