This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented admin & emergency halt for bridge (#77)
- Use Ownable and Pausable to manage bridge contract - Adds modifier to handlers to assert calls are from the bridge (which are actually calls from the owner) - adds admin methods to add/remove relayers, whitelist tokenAddresses & resourceIDs, change relayer threshold from the bridge, set burnable contracts and pause transfers - Adds interface `IMinterBurner` for handlers that have a burn list - remove use of relayer contract in favour of admin functions
- Loading branch information
1 parent
7bd128e
commit 6fd3a7a
Showing
43 changed files
with
411 additions
and
1,003 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,45 @@ | ||
const ethers = require('ethers'); | ||
const constants = require('../constants'); | ||
|
||
const {Command} = require('commander'); | ||
const {setupParentArgs} = require("./utils") | ||
|
||
const registerResourceCmd = new Command("register-resource") | ||
.description("register a resource ID with a contract address for a handler") | ||
.option('--bridge <address>', 'Custom bridge address', constants.BRIDGE_ADDRESS) | ||
.option('--handler <address>', 'Custom handler', constants.ERC20_HANDLER_ADDRESS) | ||
.option('--targetContract <address>', `Custom addresses to be whitelisted`, constants.ERC20_ADDRESS) | ||
.option('--resourceID <address>', `Custom resourceID to be whitelisted`, constants.ERC20_RESOURCEID) | ||
.action(async function (args) { | ||
await setupParentArgs(args, args.parent.parent) | ||
|
||
// Instances | ||
const bridgeInstance = new ethers.Contract(args.bridge, constants.ContractABIs.Bridge.abi, args.wallet); | ||
|
||
await bridgeInstance.adminSetResourceIDAndContractAddress(args.handler, args.resourceID, args.targetContract); | ||
console.log(`[BRIDGE] Successfully registered contract ${args.targetContract} with id ${args.resourceID} on handler ${args.handler}`); | ||
|
||
}) | ||
|
||
const setBurnCmd = new Command("set-burn") | ||
.description("set a a token contract as burnable in a handler") | ||
.option('--bridge <address>', 'Custom bridge address', constants.BRIDGE_ADDRESS) | ||
.option('--handler <address>', 'Custom erc20 handler', constants.ERC20_HANDLER_ADDRESS) | ||
.option('--tokenContract <address>', `Custom addresses to be whitelisted`, constants.ERC20_ADDRESS) | ||
.action(async function (args) { | ||
await setupParentArgs(args, args.parent.parent) | ||
|
||
// Instances | ||
const bridgeInstance = new ethers.Contract(args.bridge, constants.ContractABIs.Bridge.abi, args.wallet); | ||
|
||
await bridgeInstance.adminSetBurnable(args.handler, args.tokenContract); | ||
console.log(`[BRIDGE] Successfully set contract ${args.tokenContract} as burnable on handler ${args.handler}`); | ||
|
||
}) | ||
|
||
const bridgeCmd = new Command("bridge") | ||
|
||
bridgeCmd.addCommand(registerResourceCmd) | ||
bridgeCmd.addCommand(setBurnCmd) | ||
|
||
module.exports = bridgeCmd |
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
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
Oops, something went wrong.