Expand description
This module contains arguments and functions to manage safe and module. SafeModuleSubcommands defines three subcommands: create, move, and migrate.
- SafeModuleSubcommands::Create creates staking wallets (safe and node management module)
and execute necessary on-chain transactions to setup a HOPR node.
Detailed breakdown of the steps:
- create a Safe proxy instance and HOPR node management module proxy instance
- include nodes configure default permissions on the created module proxy
- fund the node and Safe with some native tokens and HOPR tokens respectively
- approve HOPR tokens to be transferred from the Safe proxy instaces by Channels contract
- Use manager wallet to add nodes and staking safes to the Network Registry contract
- SafeModuleSubcommands::Move moves a node from to an existing Safe.
Note that the Safe should has a node management module attached and configured.
Note that the admin key of the old and new safes are the same. This command does not support
moving nodes to safes controled by a different admin key.
Note that all the safes involved (old and new) should have a threshold of 1
Detailed breakdown of the steps:
- use old safes to deregister nodes from Node-safe registry
- use the new safe to include nodes to the module
- use manager wallet to deregister nodes from the network registry
- use manager wallet to register nodes with new safes to the network regsitry
- SafeModuleSubcommands::Migrate migrates a node to a different network.
It performs the following steps:
- add the Channel contract of the new network to the module as target and set default permissions.
- add the Announcement contract as target to the module
- approve HOPR tokens of the Safe proxy to be transferred by the new Channels contract
- Use the manager wallet to add nodes and Safes to the Network Registry contract of the new network.
- SafeModuleSubcommands::Debug goes through a series of checks to debug the setup of a node and safe.
It checks the following: - node xDAI balance - If node has been included on Network Registry - If node and safe are associated on Node Safe Registry - If Safe is owned by the correct owner(s) - Safe’s wxHOPR balance and allowance - if the module is enabled - if node is included in the module - Get all the targets of the safe (then check if channel and announcement are there) - Get the owner of the module
You need to enable the INFO level of the tracing logger to see the output of the debug command.
Some sample commands
- Express creation of a safe and a module
hopli safe-module create \
--network anvil-localhost \
--contracts-root "../ethereum/contracts" \
--identity-directory "./test" \
--password-path "./test/pwd" \
--admin-address 0x47f2710069F01672D01095cA252018eBf08bF85e,0x0D07Eb66Deb54D48D004765E13DcC028cf56592b \
--allowance 10.5 \
--hopr-amount 10 \
--native-amount 0.1 \
--manager-private-key ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--private-key 59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d \
--provider-url "http://localhost:8545"
- Migrate nodes and safe to a new network
hopli safe-module migrate \
--network anvil-localhost2 \
--contracts-root "../ethereum/contracts" \
--identity-directory "./test" \
--password-path "./test/pwd" \
--safe-address 0x6a64fe01c3aba5bdcd04b81fef375369ca47326f \
--module-address 0x5d46d0c5279fd85ce7365e4d668f415685922839 \
--manager-private-key ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--private-key 59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d \
--provider-url "http://localhost:8545"
- Move registered nodes to a different set of safe and module
hopli safe-module move \
--network anvil-localhost \
--contracts-root "../ethereum/contracts" \
--old-module-address 0x5d46d0c5279fd85ce7365e4d668f415685922839 \
--new-safe-address 0xce66d19a86600f3c6eb61edd6c431ded5cc92b21 \
--new-module-address 0x3086c20265cf742b169b05cd0eae1941455e4e9f \
--node-address 0x93a50B0fFF7b4ED36A3C6445e280E72AC2AEFc51,0x58033D3074D001a32bF379801eaf8969817fFfCf,0xeEDaab91158928647a9270Fe290897eBB1230250 \
--manager-private-key ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--private-key 59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d \
--provider-url "http://localhost:8545"
- Debug nodes and safe
```text
hopli safe-module debug \
--network anvil-localhost2 \
--contracts-root "../ethereum/contracts" \
--identity-directory "./test" \
--password-path "./test/pwd" \
--safe-address 0x6a64fe01c3aba5bdcd04b81fef375369ca47326f \
--module-address 0x5d46d0c5279fd85ce7365e4d668f415685922839 \
--provider-url "http://localhost:8545"
Enums§
- Safe
Module Subcommands - CLI arguments for
hopli safe-module