-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fees): customizable gas limit and JSON flag (#43)
- Loading branch information
Showing
2 changed files
with
27 additions
and
14 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
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,19 +1,34 @@ | ||
import { task } from "hardhat/config"; | ||
import { task, types } from "hardhat/config"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
|
||
import { fetchCCMFees, fetchFees } from "../helpers/fees"; | ||
import { fetchFees } from "../helpers/fees"; | ||
|
||
const main = async (args: any, hre: HardhatRuntimeEnvironment) => { | ||
const fees = await fetchFees(); | ||
const fees = await fetchFees(args.gas); | ||
|
||
console.log("\nOmnichain fees (in native gas tokens of destination chain):"); | ||
console.table(fees.feesZEVM); | ||
console.log("\nCross-chain messaging fees (in ZETA):"); | ||
console.table(fees.feesCCM); | ||
if (args.json) { | ||
console.log(JSON.stringify(fees, null, 2)); | ||
} else { | ||
console.log( | ||
"\nOmnichain fees (in native gas tokens of destination chain):" | ||
); | ||
console.table(fees.feesZEVM); | ||
console.log( | ||
`\nCross-chain messaging fees (in ZETA, gas limit: ${args.gas}):` | ||
); | ||
console.table(fees.feesCCM); | ||
} | ||
}; | ||
|
||
export const feesTask = task( | ||
"fees", | ||
"Show omnichain and cross-chain messaging fees", | ||
main | ||
); | ||
) | ||
.addOptionalParam( | ||
"gas", | ||
"Gas limit for a cross-chain messaging transaction", | ||
500000, | ||
types.int | ||
) | ||
.addFlag("json", "Print the result in JSON format"); |