Skip to content

Commit

Permalink
chore: test valypso and nebula
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanelly95 committed Jul 30, 2024
1 parent a5aab68 commit 0b2d93b
Showing 1 changed file with 22 additions and 33 deletions.
55 changes: 22 additions & 33 deletions scripts/validateResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ async function main() {
// Replace with your contract's ABI

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

// Replace with your _data value
const data = "0xcdf9ab9f5bb7631f812b6ba5f8bbe1053589060a13aae11c802e00553c4c565400000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000259102b37de83bdda9f38ac8254e596f0d9ac61d2035c07936675e873428171600000000000000000000000000000000000000000000000000000000000052417000000000000000000000000000000000000000000000000000000006679304d00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001121342e1ee18563ecb29b769cdc592567969113c02408c2ab64172331f39299e0000000000000000000000000000000000000000000000000000000000000041a62420b72d2473f1e35a5cbaf4a598148b5c75094bee3b7e748657a2911c13e22f2d2641f44533d252d199dd92d59da976eeeec538db0ce8db7f322451baf7761c00000000000000000000000000000000000000000000000000000000000000";
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);
Expand All @@ -19,46 +19,35 @@ async function main() {

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

// const response = await contract.validateResult(data, { gasLimit: 30000000 });
// console.log("Transaction Response:", response);
// const result = ethers.utils.defaultAbiCoder.decode(
// ["bool","uint256", "int8", "uint256"],
// response.data
// );
// console.log(result);
// console.log("Decoded Result:", result);
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 = result[0];
// const uintValue1 = Number(result[1]);
// const intValue = result[2];
// const uintValue2 = Number(result[3]);
// console.log("Success:", success);
// console.log("Uint256 Value 1:", uintValue1);
// console.log("Int8 Value:", intValue);
// console.log("Uint256 Value 2:", uintValue2);
// 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);
// const result = ethers.utils.defaultAbiCoder.decode(
// ["uint256", "int8", "uint256"],
// response.data
// );
// console.log(result);
// console.log("Decoded Result:", result);

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

0 comments on commit 0b2d93b

Please sign in to comment.