hopli

Module methods

Source
Expand description

This module contains all the methods used for onchain interaction, especially with Safe instance, Mutlicall, and Multisend contracts.

SafeTxOperation corresponds to the Operation Enum used in Safe smart contract.

MultisendTransaction struct is used for building transactions interacting with Multisend contract

Re-exports§

pub use safe_singleton::*;
pub use module_singleton::*;
pub use multi_send::*;

Modules§

module_singleton
This module was auto-generated with ethers-rs Abigen. More information at: https://github.com/gakonst/ethers-rs
multi_send
This module was auto-generated with ethers-rs Abigen. More information at: https://github.com/gakonst/ethers-rs
safe_singleton
This module was auto-generated with ethers-rs Abigen. More information at: https://github.com/gakonst/ethers-rs

Structs§

MultisendTransaction
Struct to make a multisend transaction, mainly used by safe instances

Enums§

SafeTxOperation
Enums of Safe transaction operation

Functions§

debug_node_safe_module_setup_main
Quick check if the following values are correct, for one single node: 4. If Safe is owned by the correct owner(s) 5. Safe’s wxHOPR balance and allowance 6. if the module is enabled 7. if node is included in the module 8. Get all the targets of the safe (then check if channel and announcement are there) 9. Get the owner of the module
debug_node_safe_module_setup_on_balance_and_registries
Quick check if the following values are correct, for one single node:
deploy_multicall3_for_testing
Deploy a MULTICALL contract into Anvil local chain for testing
deploy_proxy 🔒
helper function to compute create2 safe proxy address
deploy_safe_module_with_targets_and_nodes
Deploy a safe and a module proxies via HoprStakeFactory contract with default permissions and announcement targets Within one multicall, as an owner of the safe:
deregister_nodes_from_network_registry
Deregister safes and nodes from the network registry. Does not do any action on the eligibility. It returns the number of removed nodes
deregister_nodes_from_node_safe_registry_and_remove_from_module
Deregister safes and nodes from the node-safe registry. It returns the number of removed nodes
force_sync_safes_on_network_registry
Force-sync the eligibility to given values. This can only be called with a manager account
get_chain_id_and_safe_nonce
Get chain id and safe nonce
get_domain_separator 🔒
get the domain separator of a safe instance contract_address should be safe address
get_native_and_token_balances
Get native balance and hopr token balance for given addresses
get_registered_safes_for_nodes_on_network_registry
Get registered safes for given nodes on the network registry
get_registered_safes_for_nodes_on_node_safe_registry
Get registered safes for given nodes on the node-safe registry
get_safe_transaction_hash 🔒
Implement getTransactionHash() function as in vendor/solidity/safe-contracts-1.4.1/contracts/Safe.sol Note that safeTxGas, baseGas, and gasPrice are zero; gasToken is also address zero
get_salt_from_salt_nonce 🔒
helper function to get salt nonce
include_nodes_to_module
Include nodes to the module
migrate_nodes
Migrate nodes to be able to run in a new network.
predict_module_address
Helper function to predict module address. Note that here the caller is the contract deployer
predict_safe_address
Helper function to predict safe address
prepare_safe_tx_from_owner_contract
Wrap a transaction into a safe transaction payload Add the safe transaction to multicall
register_safes_and_nodes_on_network_registry
Register safes and nodes to the network registry, and force-sync the eligibility to true. It returns the number of removed nodes and nodes being added.
send_multisend_safe_transaction_with_threshold_one
Use safe to delegatecall to multisend contract Note that when no additional signature is provided, the safe must have a threshold of one, so that the transaction can be executed. Note that the refund address is the caller (safe owner) wallet
send_safe_transaction_with_threshold_one
Send one transaction via safe
transfer_native_tokens
Transfer some native tokens from the caller to the list of addresses Address_i receives amounts_i native tokens.
transfer_or_mint_tokens
Transfer some HOPR tokens from the caller to the list of addresses Address_i receives amounts_i HOPR tokens. When there’s not enough token in caller’s balance, if the caller is a minter, mint the missing tokens. If not, returns error