/// <reference types="../../.compose/types.d.ts" />
import { BitcoinOracleContract } from "../.compose/generated";
export async function main(
{ evm, env }: TaskContext,
_args: any
) {
const wallet = await evm.wallet();
const { hash } = await wallet.writeContract(
evm.chains.polygon,
env.CONTRACT_ADDRESS,
"reportPayouts(bytes32,uint256[])",
[resultId, payouts],
{
confirmations: 5,
onReorg: {
action: {
// this will replay the transaction with a fresh nonce and gas if the transaction is reorged off chain after the 5 confirmations specified below
// it will then start watching again for the number of blocks specified in the "depth" property
type: "replay",
},
// we'll watch this transaction in the background for 200 blocks and replay it if the transaction receipt disappears
depth: 200,
},
},
{
max_attempts: 5,
}
);
const { hash } = await wallet.writeContract(
evm.chains.polygon,
env.CONTRACT_ADDRESS,
"reportPayouts(bytes32,uint256[])",
[resultId, payouts],
{
confirmations: 5,
onReorg: {
action: {
// this will just log in your normal app logs if the transaction is reorged off chain after the 5 confirmations specified below
type: "log",
logLevel: "warn", // defaults to "error"
},
// we'll watch this transaction in the background for 200 blocks and log if the transaction receipt disappears
depth: 200,
},
},
{
max_attempts: 5,
}
);
const { hash } = await wallet.writeContract(
evm.chains.polygon,
env.CONTRACT_ADDRESS,
"reportPayouts(bytes32,uint256[])",
[resultId, payouts],
{
confirmations: 5,
onReorg: {
action: {
// this will send the transaction as a payload to the specified task if the transaction is reorged off chain after the 5 confirmations specified below
type: "custom",
task: "reorg-reconciler", // the name of your compose task with custom re-org handling logic
},
// we'll watch this transaction in the background for 200 blocks and call your "reorg-reconciler" if the transaction receipt disappears
depth: 200,
},
},
{
max_attempts: 5,
}
);
}