/// <reference types="../../.compose/types.d.ts" />
export async function main(
{ evm, env }: TaskContext,
_args: any
) {
// This is a local-only private key I've funded on my test chain (thus safe to hard code)
// For private keys used on mainnets and testnets, always use Secrets
const privateKey = "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
const wallet = await evm.wallet({ privateKey });
export const localChain: Chain = {
id: 0,
name: "foundry-local",
testnet: true,
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: { http: ["http://127.0.0.1:8545"] }, // this is the url used by your local Anvil (etc) node
public: { http: ["http://127.0.0.1:8545"] },
},
blockExplorers: {
default: { name: "na", url: "http://127.0.0.1:8545" }, // not used for local dev, so you can pass in any value here
},
};
const localContractAddress = "0x1234567890abcdef1234567890abcdef12345678";
const { hash } = await wallet.writeContract(
localChain,
localContractAddress,
"reportPayouts(bytes32,uint256[])",
[resultId, payouts],
{
confirmations: 3,
}
);
}