Skip to content

Commit

Permalink
Merge pull request #3 from SecretSaturn/More-Chains
Browse files Browse the repository at this point in the history
Contract improvements & add a lot more chains
  • Loading branch information
SecretSaturn authored Apr 22, 2024
2 parents 55759a9 + 036fa0c commit cf4bab7
Show file tree
Hide file tree
Showing 15 changed files with 953 additions and 289 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# TNLS
This repository is an alpha implementation of the Snakepath Network and its underlying TNLS protocol, currently connecting the Eth Goerli testnet to the Secret Network pulsar-3 testnet.
This repository is a beta implementation of the Secretpath (formerly Snakepath) Network and its underlying TNLS protocol, currently connecting the Eth testnet to the Secret Network pulsar-3 testnet.

Docs (which are relatively barebones atm but will be being improved over time) can be found at [our gitbook](https://fortress-labs.gitbook.io/snakepath/).
This project was started by Leor Fishman, Benjamin Simon, Kent Worchester. Continued by Alex | Secret Saturn.

Docs (which are relatively barebones atm but will be being improved over time) can be found at [the docs](https://fortress-labs.gitbook.io/snakepath/) and [the docs] (https://docs.scrt.network/secret-network-documentation/development/ethereum-evm-developer-toolkit/basics/cross-chain-messaging/snakepath)

# License

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.23;
pragma solidity ^0.8.25;

import "forge-std/Test.sol";
import "forge-std/Vm.sol";
import "forge-std/console2.sol";
import "forge-std/Script.sol";
import {Gateway} from "../src/Gateway.sol";
import {RandomnessReciever} from "../src/RandomnessReciever.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

Expand All @@ -17,7 +14,6 @@ contract DeployGatewayScript is Script {
ProxyAdmin proxyAdmin;
Gateway gatewayLogic;
TransparentUpgradeableProxy gatewayProxy;
RandomnessReciever randomnessAddress;

function run() public {
vm.startBroadcast();
Expand Down
38 changes: 38 additions & 0 deletions TNLS-Gateways/public-gateway/script/DeployProxyScript.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.25;

import "forge-std/Vm.sol";
import "forge-std/Script.sol";
import {Gateway} from "../src/Gateway.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";


contract DeployProxyScript is Script {
function setUp() public {}

ProxyAdmin proxyAdmin;
Gateway gatewayLogic;
TransparentUpgradeableProxy gatewayProxy;

function run() public {
vm.startBroadcast();

// Deploy Gateway Logic Contract
gatewayLogic = Gateway(0xEAe7aC0A51a0441D71A1Ee21005363B36f16EffC);

// Prepare initializer data for Gateway
bytes memory initializerData = abi.encodeWithSelector(
Gateway.initialize.selector
);

// Deploy TransparentUpgradeableProxy
gatewayProxy = new TransparentUpgradeableProxy(
address(gatewayLogic),
address(msg.sender),
initializerData
);

vm.stopBroadcast();
}
}
12 changes: 5 additions & 7 deletions TNLS-Gateways/public-gateway/script/DeployRandomnessScript.s.sol
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.23;
pragma solidity ^0.8.25;

import "forge-std/Test.sol";
import "forge-std/Vm.sol";
import "forge-std/console2.sol";
import "forge-std/Script.sol";
import {Gateway} from "../src/Gateway.sol";
import {RandomnessReciever} from "../src/RandomnessReciever.sol";
import {RandomnessReceiver} from "../src/RandomnessReceiver.sol";


contract DeployRandomnessScript is Script {
function setUp() public {}

RandomnessReciever randomnessAddress;
RandomnessReceiver randomnessAddress;

function run() public {
vm.startBroadcast();

Gateway gateway = Gateway(0x3879E146140b627a5C858a08e507B171D9E43139);
randomnessAddress = new RandomnessReciever();
Gateway gateway = Gateway(0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2);
randomnessAddress = new RandomnessReceiver();
console2.logAddress(address(randomnessAddress));

randomnessAddress.setGatewayAddress(address(gateway));
Expand Down
10 changes: 4 additions & 6 deletions TNLS-Gateways/public-gateway/script/DeployScript.s.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.23;
pragma solidity ^0.8.25;

import "forge-std/Test.sol";
import "forge-std/Vm.sol";
import "forge-std/console2.sol";
import "forge-std/Script.sol";
import {Gateway} from "../src/Gateway.sol";
import {RandomnessReciever} from "../src/RandomnessReciever.sol";
import {RandomnessReceiver} from "../src/RandomnessReceiver.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

Expand All @@ -17,7 +15,7 @@ contract DeployScript is Script {
ProxyAdmin proxyAdmin;
Gateway gatewayLogic;
TransparentUpgradeableProxy gatewayProxy;
RandomnessReciever randomnessAddress;
RandomnessReceiver randomnessAddress;

function run() public {
vm.startBroadcast();
Expand All @@ -40,7 +38,7 @@ contract DeployScript is Script {
// Cast the proxy address to the Gateway interface
Gateway gateway = Gateway(address(gatewayProxy));

randomnessAddress = new RandomnessReciever();
randomnessAddress = new RandomnessReceiver();
console2.logAddress(address(gateway));

randomnessAddress.setGatewayAddress(address(gateway));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.23;
pragma solidity ^0.8.25;

import "forge-std/Test.sol";
import "forge-std/Vm.sol";
Expand All @@ -22,7 +22,7 @@ contract IncreaseTaskIdScript is Script {
vm.startBroadcast();

// Gateway (Proxy) Contract
gateway = Gateway(0xBFE44aF8e40B6468946e9AA88fe2c6c9D0352F62);
gateway = Gateway(0x22A6ddbf431Fb9D657062B8D6eAB27A9Dd499752);

//Increase the task_id to the appropriate value
gateway.increaseTaskId(50);
Expand Down
12 changes: 5 additions & 7 deletions TNLS-Gateways/public-gateway/script/UpgradeScript.s.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.23;
pragma solidity ^0.8.25;

import "forge-std/Test.sol";
import "forge-std/Vm.sol";
import "forge-std/console2.sol";
import "forge-std/Script.sol";
import {Gateway} from "../src/Gateway.sol";
import {RandomnessReciever} from "../src/RandomnessReciever.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";

Expand All @@ -21,12 +18,13 @@ contract UpgradeScript is Script {
vm.startBroadcast();

// Deploy New Gateway Logic Contract
newGatewayLogic = new Gateway();
//newGatewayLogic = new Gateway();
newGatewayLogic = Gateway(0x59D8C9591dB7179c5d592c5bCD42694021885aFC);

gatewayProxyAdmin = ProxyAdmin(0x952350102fd243B353fd734B5Cc4e3b4088a4aE7);
gatewayProxyAdmin = ProxyAdmin(0xdDC6d94d9f9FBb0524f069882d7C98241040472E);

bytes memory selector = abi.encodeWithSelector(Gateway.upgradeHandler.selector);
gatewayProxyAdmin.upgradeAndCall(ITransparentUpgradeableProxy(0x5e16dbD2728d66B4189b2e3AAB71837683Dfd2d7), address(newGatewayLogic),selector);
gatewayProxyAdmin.upgradeAndCall(ITransparentUpgradeableProxy(0xfaFCfceC4e29e9b4ECc8C0a3f7df1011580EEEf2), address(newGatewayLogic),selector);

vm.stopBroadcast();
}
Expand Down
Loading

0 comments on commit cf4bab7

Please sign in to comment.