Files
p2pix-smart-contracts/scripts/setDefaultBlocks.ts
arthur 9cc62efb8a fix_lint (#11)
Co-authored-by: Arthur Abeilice <afa7789@gmail.com>
Reviewed-on: https://git.p2pix.co/doiim/p2pix-smart-contracts/pulls/11
Co-authored-by: arthur <abeilice@kosmos.org>
Co-committed-by: arthur <abeilice@kosmos.org>
2026-05-29 20:09:12 +00:00

49 lines
1.1 KiB
TypeScript

import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import * as fs from "fs";
import { ethers, network } from "hardhat";
import { Deploys } from "../test/utils/interfaces";
import { P2PIX__factory } from "../src/types";
let deploysJson: Deploys;
const main = async () => {
try {
const data = fs.readFileSync(
`./deploys/${network.name}.json`,
{ encoding: "utf-8" },
);
deploysJson = JSON.parse(data);
} catch (err) {
console.log("Error loading Master address: ", err);
process.exit(1);
}
const [deployer] = await ethers.getSigners();
console.log(
`Signing transactions with ${deployer.address}`,
);
const iface = new ethers.utils.Interface(
P2PIX__factory.abi,
);
const calldata = iface.encodeFunctionData(
"setDefaultLockBlocks",
["10000"],
);
const tx = await deployer.sendTransaction({
to: deploysJson.p2pix,
data: calldata,
});
const done = await tx.wait();
console.log(done.transactionHash);
};
main()
.then(() => process.exit(0))
.catch(error => {
console.log(error);
process.exit(1);
});