-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
031fe34
commit 940edb7
Showing
3 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# private key that will be used to deploy the contracts | ||
PRIVATE_KEY=0x... | ||
PRIVATE_KEY=0x... | ||
|
||
# implementation address | ||
IMPLEMENTATION=0x... | ||
|
||
# genesis state | ||
GENESIS_STATE=0x... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.20; | ||
|
||
import "forge-std/Script.sol"; | ||
import "../src/UntronCore.sol"; | ||
import "../src/UntronCoreProxy.sol"; | ||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract MockSP1Verifier { | ||
function verifyProof(bytes32, bytes calldata, bytes calldata) external pure returns (bool) { | ||
return true; | ||
} | ||
} | ||
|
||
contract DeployProxyScript is Script { | ||
function run() external { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address implementation = vm.envAddress("IMPLEMENTATION"); | ||
bytes memory state = vm.envBytes("GENESIS_STATE"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
// Deploy mock verifier | ||
MockSP1Verifier mockVerifier = new MockSP1Verifier(); | ||
|
||
// Deploy proxy | ||
bytes memory initData = abi.encodeWithSelector( | ||
UntronCore.initialize.selector, | ||
state // genesis state | ||
); | ||
|
||
UntronCoreProxy proxy = new UntronCoreProxy( | ||
address(implementation), | ||
vm.addr(deployerPrivateKey), // admin | ||
initData | ||
); | ||
|
||
// Configure the proxy | ||
UntronCore untron = UntronCore(address(proxy)); | ||
|
||
// Set core variables | ||
untron.setCoreVariables( | ||
10000 * 1e6, // maxOrderSize: 10K USDT | ||
0 * 1e6, // requiredCollateral: 0 USDT | ||
300 * 1000 // orderTtlMillis: 5 minutes | ||
); | ||
|
||
// Set fees variables | ||
untron.setFeesVariables( | ||
0, // relayerFee: 0% | ||
0.05 * 1e6 // fulfillerFee: 0.05 USDT | ||
); | ||
|
||
// Set transfers variables | ||
untron.setTransfersVariables( | ||
0x493257fD37EDB34451f62EDf8D2a0C418852bA4C, // USDT | ||
0x341e94069f53234fE6DabeF707aD424830525715 // LiFi | ||
); | ||
|
||
// Set ZK variables | ||
untron.setZKVariables( | ||
vm.addr(deployerPrivateKey), // trusted relayer | ||
address(mockVerifier), | ||
bytes32(0) // empty vkey | ||
); | ||
|
||
vm.stopBroadcast(); | ||
|
||
console.log("Deployed UntronCore implementation at:", address(implementation)); | ||
console.log("Deployed UntronCore proxy at:", address(proxy)); | ||
console.log("Deployed Mock Verifier at:", address(mockVerifier)); | ||
} | ||
} |