Skip to content

Commit

Permalink
sfsdfdsf
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhooketh committed Nov 15, 2024
1 parent 031fe34 commit 940edb7
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 3 deletions.
8 changes: 7 additions & 1 deletion contracts/.env.example
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...
5 changes: 3 additions & 2 deletions contracts/script/DeployMainnet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ contract MockSP1Verifier {
contract DeployMainnetScript is Script {
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
bytes memory state = vm.envBytes("GENESIS_STATE");
vm.startBroadcast(deployerPrivateKey);

// Deploy mock verifier
Expand All @@ -26,9 +27,9 @@ contract DeployMainnetScript is Script {
// Deploy proxy
bytes memory initData = abi.encodeWithSelector(
UntronCore.initialize.selector,
"" // empty genesis state
state // genesis state
);

UntronCoreProxy proxy = new UntronCoreProxy(
address(implementation),
vm.addr(deployerPrivateKey), // admin
Expand Down
72 changes: 72 additions & 0 deletions contracts/script/DeployProxy.s.sol
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));
}
}

0 comments on commit 940edb7

Please sign in to comment.