Drosera CLI
The Drosera CLI is a command line tool used to create, manage, and monitor Traps on the Drosera Network. It utilizes a configuration file to manage your Traps and their configurations. It can be installed by following the getting started guide here.
Configuration
Drosera.toml
The drosera.toml
file is used to configure the Drosera CLI. The file is used to define the traps that are being mananged and the response contracts that are triggered when a trap is triggered.
[traps]
[traps.hello_world]
path = "out/HelloWorldTrap.sol/HelloWorldTrap.json"
response_contract = "0xea08f7d533C2b9A62F40D5326214f39a8E3A32F8"
response_function = "pause(uint256)"
cooldown_period_blocks = 33
min_number_of_operators = 1
max_number_of_operators = 2
block_sample_size = 10
traps
: The section where all the traps are defined.traps.<name>
: The name of the trap.path
: The path to the trap's JSON file that contains the ABI and bytecode.response_contract
: The address of the contract to call when a response is triggered.response_function
: The function signature to call on the response contract.cooldown_period_blocks
: The number of blocks to wait before triggering another response.min_number_of_operators
: The minimum number of operators to execute the trap and trigger a response.max_number_of_operators
: The maximum number of operators that can opt into the trap.block_sample_size
: The number of blocks required by theshouldRespond
function to make a decision.
CLI Arguments
Argument | Default | Description |
---|---|---|
--config-path (-c) | Looks in current and parent directories | The path to the drosera.toml file |
--non-interactive (-n) | False | Determines if a user prompt is required before creating or updating traps |
Commands
The CLI command options can be configured using CLI arguments, the drosera.toml config file, or with environment variables. A combination of either can also be used. The order of precedence is as follows:
- Command line arguments
- TOML configuration file
./drosera.toml
- Environment variables / .env file
NOTE: Make sure to run the CLI from the same directory as the drosera.toml
file. The DROSERA_PRIVATE_KEY
environment variable is required to deploy the trap. You can also set it in the drosera.toml file as private_key = "0x.."
.
config
Displays the current configuration file.
plan
Displays the traps that will be created or updated based on the configuration file.
Args
Argument | Default | Description |
---|---|---|
--ethereum-rpc | The node used for querying and sending transactions | |
--drosera-rpc | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
dryrun
Runs all traps in the drosera.toml
file on a local ad-hoc operator, testing the collect
and shouldRespond
functions. This is also run for you automatically in the apply
command.
Args
Argument | Default | Description |
---|---|---|
--ethereum-rpc | The node used for querying and sending transactions | |
--drosera-rpc | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
apply
Creates or updates traps based on the configuration file. If an address field is specified in the configuration file, the trap is updated. If the address field is not specified, the trap is created and the address of the deployed Trap Config address is set in the config file by the CLI.
Args
Argument | Default | Description |
---|---|---|
--ethereum-rpc | The node used for querying and sending transactions | |
--drosera-rpc | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
hydrate
Hydrate the specified trap. This is how you incetivize operators to monitor your trap. This sends DRO to the traps' trap_rewards
contract.
Args
Argument | Default | Description |
---|---|---|
--ethereum-rpc | The node used for querying and sending transactions | |
--drosera-rpc | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The address of the on-chain trap (config) to hydrate. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file | |
--dro-amount | The amount of DRO you want to hydrate your trap with. Amount is expected in human form (not on-chain form) |
bloomboost
Bloom boost the specified trap. This is how you boost a trap's emergency response execution with ETH to entice block builders to include the tx in the mempool. This sends ETH to the traps' trap_rewards
contract.
Args
Argument | Default | Description |
---|---|---|
--ethereum-rpc | The node used for querying and sending transactions | |
--drosera-rpc | The url of the seed node or operator to send the trap bytecode to | |
--eth-chain-id | derived from the ethereum rpc | The chain id |
--private-key | The private key used to sign transactions | |
--drosera-address | derived from chain id | The address of the main Drosera proxy contract to interact with |
--non-interactive | false | Normally the command will prompt you for final approval before executing. This will bypass that check. |
--trap-address | The address of the on-chain trap (config) to boost. This is the address you see output when you create a new trap or that you will have for your trap in your drosera.toml file | |
--eth-amount | The amount of ETH you want to boost your trap with. Amount is expected in ETHER (not WEI) |