From a8179a4f4887e83b237ecf562d884e0120465b03 Mon Sep 17 00:00:00 2001 From: Alain Olivier Date: Thu, 7 Mar 2024 10:59:56 +0100 Subject: [PATCH] feat(tasks): add task to check forwarders --- tasks/check-forwarder.js | 22 ++++++++++++++++++++++ tasks/index.js | 1 + 2 files changed, 23 insertions(+) create mode 100644 tasks/check-forwarder.js diff --git a/tasks/check-forwarder.js b/tasks/check-forwarder.js new file mode 100644 index 0000000..05e9665 --- /dev/null +++ b/tasks/check-forwarder.js @@ -0,0 +1,22 @@ +const { task } = require('hardhat/config') + +const { ADDRESSES: _ADDRESSES } = require('../lib/constants') + +const main = async (_args, _hre) => { + if (!(_hre.network.name.toUpperCase() in _ADDRESSES)) { + console.warn('No addresses!') + return + } + const ADDRESSES = _ADDRESSES[_hre.network.name.toUpperCase()] + for (const entry of Object.entries(ADDRESSES)) { + console.log(`Checking ${entry[0]} @ ${entry[1]}`) + const c = await _hre.ethers.getContractAt(['function forwarder() view returns(address)'], entry[1]) + try { + console.log('Forwarder', await c.forwarder()) + } catch (_) { + console.log('No forwarder') + } + } +} + +task('permissions:check-forwarder').setAction(main) diff --git a/tasks/index.js b/tasks/index.js index 79a591f..65ce202 100644 --- a/tasks/index.js +++ b/tasks/index.js @@ -1,6 +1,7 @@ require('./acl-permission') require('./decode-forwarder-metadata') require('./check-all-permissions') +require('./check-forwarder') require('./check-permissions') require('./deploy-dao') require('./deploy_forwarder_bsc')