-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
85 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import "dotenv/config" | ||
import {logger} from "./scripts/helpers/logger"; | ||
import {reTryWithdrawWithExistingTree} from "./scripts/reTryWithdrawWithExistingTree"; | ||
|
||
async function main() { | ||
logger.info('98-re-try-withdraw started') | ||
|
||
await reTryWithdrawWithExistingTree() | ||
|
||
logger.info('98-re-try-withdraw finished') | ||
} | ||
|
||
// We recommend this pattern to be able to use async/await everywhere | ||
// and properly handle errors. | ||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {ethers} from "ethers"; | ||
import {logger} from "./logger"; | ||
|
||
let nonce = 0 | ||
|
||
export async function setInitialNonce() { | ||
logger.info('setInitialNonce started') | ||
|
||
if (!process.env.RPC_URL) { | ||
throw new Error("No RPC_URL in ENV") | ||
} | ||
if (!process.env.PRIVATE_KEY) { | ||
throw new Error("No PRIVATE_KEY in ENV") | ||
} | ||
|
||
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL) | ||
|
||
// @ts-ignore | ||
let wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider) | ||
|
||
nonce = await provider.getTransactionCount(wallet.address) | ||
|
||
logger.info('nonce = ' + nonce) | ||
|
||
logger.info('setInitialNonce finished') | ||
} | ||
|
||
export function incrementNonce() { | ||
nonce++ | ||
} | ||
|
||
export function getNonce() { | ||
return nonce | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import {getOracleContract} from "./helpers/getOracleContract"; | ||
import {getNonce, incrementNonce} from "./helpers/nonce"; | ||
|
||
export async function makeOracleReport(root: string) { | ||
const oracle = getOracleContract() | ||
|
||
await oracle.report(root) | ||
await oracle.report(root, {nonce: getNonce()}) | ||
|
||
incrementNonce() | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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