Created
May 25, 2022 02:24
-
-
Save suraneti/58ae759d00b92781ccba82f88cc77f63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note that the script needs the ABI which is generated from the compilation artifact. | |
// Make sure contract is compiled and artifacts are generated | |
(async () => { | |
const sleep = ms => new Promise(r => setTimeout(r, ms)); | |
try { | |
const artifactsPath = `browser/contracts/artifacts/Storage.json` // Change this for different path | |
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) | |
// 'web3Provider' is a remix global variable object | |
const signer = new ethers.Wallet("<PRIVATE_KEY>", new ethers.providers.Web3Provider(web3Provider)); | |
let factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); | |
console.log(`deploying contract...`) | |
contract = await factory.deploy(); | |
await contract.deployed() | |
console.log(`ca: ${contract.address}`) | |
// load existing contract | |
// const contract = new ethers.Contract("<CONTRACT_ADDRESS>", metadata.abi, signer) | |
for (let i = 1; i <= 10; i++) { | |
console.log(`store loops: ${i}`) | |
await sleep(30000) | |
contract.store(i).then((tx) => (console.log(`tx ${i}`, tx))).catch(console.log) | |
} | |
} catch (e) { | |
console.log(e) | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kilin testnet faucet
https://kilnfaucet.com/
Kilin RPC
https://rpc.kiln.themerge.dev
Kilin testnet resources
https://kiln.themerge.dev/