Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: hardhat config updates to use frame or ledger hh plugin #103

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ The above script will perform following operation:
| TransparentForwarder | 0xb28AE76CA80a461c633624F9764f37235800F533 |
| Staking | 0x7F56e39f6629e5D5E281fB9F65BdC7121F2F6E69 |

### Calypso hub (hardhat)
<!-- ### Calypso hub (hardhat)

| Contract | Address |
| -------------------- | ------------------------------------------ |
Expand All @@ -168,7 +168,7 @@ The above script will perform following operation:
| ResultManager | 0xBd4642B6E698cE2A6DFD7bd69FDF5Af968bE05d9 |
| Forwarder | 0x951350581E842F85800cC8dA0b96192a71DfEc0d |
| TransparentForwarder | 0xD910E832ead086314409D56ECD3D2dB1256CfF58 |
| Staking | 0xb28AE76CA80a461c633624F9764f37235800F533 |
| Staking | 0xb28AE76CA80a461c633624F9764f37235800F533 | -->

## Testnet
### Calypso Testnet
Expand Down
6 changes: 0 additions & 6 deletions deployments/calypsoMainnet.json

This file was deleted.

6 changes: 0 additions & 6 deletions deployments/nebulaMainnet.json

This file was deleted.

95 changes: 63 additions & 32 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,198 +12,229 @@ const { RINKEBY_RPC } = process.env;
module.exports = {
solidity: "0.8.9",
networks: {
sChainLocal: {
url: "http://localhost:15000",
accounts: [
"0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0",
"0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e",
],
},
ethereum: {
chainId: 1,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://eth.meowrpc.com",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
calypsoMainnet: {
chainId: 1564830818,
url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
timeout: 600000, // this is important, because otherwise the request can time out before you've reviewed and confirmed your transaction on the Ledger
// url: "https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague",
// ledgerAccounts: [
// process.env.DEPLOYER_ADDRESS,
// ],
timeout: 600000,
},
eth: {
chainId: 1,
url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
timeout: 600000, // this is important, because otherwise the request can time out before you've reviewed and confirmed your transaction on the Ledger
},
nebulaMainnet: {
chainId: 1482601649,
url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
// url: "https://mainnet.skalenodes.com/v1/green-giddy-denebola",
// ledgerAccounts: [
// process.env.DEPLOYER_ADDRESS,
// ],
timeout: 600000,
},
titanMainnet: {
chainId: 1350216234,
url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
// url: "https://mainnet.skalenodes.com/v1/parallel-stormy-spica",
// ledgerAccounts: [
// process.env.DEPLOYER_ADDRESS,
// ],
timeout: 600000,
},
europaMainnet: {
chainId: 2046399126,
url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
// url: "https://mainnet.skalenodes.com/v1/elated-tan-skat",
// ledgerAccounts: [
// process.env.DEPLOYER_ADDRESS,
// ],
timeout: 600000,
},
polygon: {
chainId: 137,
url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
// url: "https://1rpc.io/matic",
// ledgerAccounts: [
// process.env.DEPLOYER_ADDRESS,
// ],
timeout: 600000,
},
moonbeam: {
chainId: 1284,
//url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://rpc.api.moonbeam.network",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
meter: {
chainId: 82,
//url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://rpc.meter.io",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
zksyncEra: {
chainId: 324,
//url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://mainnet.era.zksync.io",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
canto: {
chainId: 7700,
//url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://canto.slingshot.finance/",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
BNBMainnet: {
chainId: 56,
//url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://bsc-dataseed4.bnbchain.org",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
opBNBMainnet: {
chainId: 204,
//url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://opbnb-mainnet-rpc.bnbchain.org",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
polygonZkEvmMainnet: {
chainId: 1101,
url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
// url: "https://polygon-zkevm-mainnet.public.blastapi.io ",
// ledgerAccounts: [
// process.env.DEPLOYER_ADDRESS,
// ],
timeout: 600000,
gasPrice: 3000000000
},
xdcMainnet: {
chainId: 50,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://erpc.xinfin.network",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
optimism: {
chainId: 10,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://mainnet.optimism.io",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
arbitrumOne: {
chainId: 42161,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://arb1.arbitrum.io/rpc",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
base: {
chainId: 8453,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://mainnet.base.org",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
linea: {
chainId: 59144,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://rpc.linea.build",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
scroll: {
chainId: 534352,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://rpc.scroll.io/",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
blast: {
chainId: 81457,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://rpc.blast.io",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
gnosis: {
chainId: 100,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://rpc.gnosischain.com",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
avalanche: {
chainId: 43114,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://avax.meowrpc.com",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
conflux: {
chainId: 1030,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://evm.confluxrpc.com",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
fraxtal: {
chainId: 252,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://rpc.frax.com",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
mode: {
chainId: 34443,
// url: "http://127.0.0.1:1248", // this is the RPC endpoint exposed by Frame,
url: "https://mainnet.mode.network/",
ledgerAccounts: [
process.env.DEPLOYER_ADDRESS, // specify Ledger Address here (required) ADMIN ADDRESS
process.env.DEPLOYER_ADDRESS,
],
timeout: 600000,
},
Expand Down
59 changes: 59 additions & 0 deletions scripts/validateResult.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const { ethers } = require("hardhat");
const abi = require("./TransparentForwarder.json");

async function main() {
// Replace with your contract's ABI

// Replace with your contract's address
const contractAddress = "0xa27a80D473a688A75469cb7Ef3bBDf1d250A5003";
const privateKey = process.env.TESTNET_DEPLOYER_KEY;

// Replace with your _data value
const data = "0x05fbf253e685bbe2de2b28b995d65e201e51fe0a72bd99bddd87b84d98d0b30900000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000259102b37de83bdda9f38ac8254e596f0d9ac61d2035c07936675e87342817160000000000000000000000000000000000000000000000000000000000004f7a30000000000000000000000000000000000000000000000000000000066a364fb00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001bf2c3c06061b6a7c6a576269f9263eea0584ef481c8240cad0529a241e6faa9d0000000000000000000000000000000000000000000000000000000000000041903310afa23a0069d70a5086e8ed731eebc21c99f022aa2705b71dea931341c1025089ca1d0b940f3428d07590b67b60ac70aa2523fc31b6098bfc1652c2ec4d1b00000000000000000000000000000000000000000000000000000000000000";
// Get the provider and signer (Assuming you have a local node or network configured in Hardhat)
const provider = new ethers.providers.JsonRpcProvider("https://mainnet.skalenodes.com/v1/green-giddy-denebola");
const wallet = new ethers.Wallet(privateKey, provider);

// Create a contract instance
const contract = new ethers.Contract(contractAddress, abi, wallet);

// Call the validateResult function
try {
// const response = await contract.updateAndGetResult(data, { gasLimit: 30000000 });
// await response.wait();
// console.log(response);

const response = await contract.validateResult(data);
console.log("Transaction Response:", response);
console.log("Decoded Result:", response);

// Convert BigNumber values to strings for readability
const success = response[0];
const uintValue1 = response[1];
const intValue = response[2];
const uintValue2 = response[3];
console.log("Success:", success);
console.log("Value :", Number(uintValue1));
console.log("Power :", intValue);
console.log("Timestamp :", Number(uintValue2));


// const response = await contract.getResult("0x59102b37de83bdda9f38ac8254e596f0d9ac61d2035c07936675e87342817160");
// console.log("Transaction Response:", response);

// // Convert BigNumber values to strings for readability
// const uintValue1 = Number(response[0]);
// const intValue = response[1];
// const uintValue2 = Number(response[2]);
// console.log("Uint256 Value 1:", uintValue1);
// console.log("Int8:", intValue);
// console.log("Uint256 Timestamp 2:", uintValue2);
} catch (error) {
console.error("Error calling validateResult:", error);
}
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});