Skip to content

otmoic-cli monkey

The otmoic-cli monkey command is used to perform automated periodic swap tasks on the blockchain network, often in conjunction with shell scripts such as monkey_mainnet.sh.

Usage

sh
otmoic-cli monkey [OPTIONS]

Options

  • -i, --interval: Interval range for task execution, in the format of [min]-[max] (e.g., 3600-7200).
  • -r, --relay: Relay URL.
  • -a, --amount: Per mille of srctokens exchanged (base of balance) in each test, random within a specific range, in the format of [min]-[max] (e.g., 1000-1000).
  • -p, --privateKey: Your Evm wallet private key for signing the deal.
  • -s, --solanaPrivateKey: Your Solana wallet private key.
  • -t, --task: Task type (e.g., succeed, refund, cheat amount, cheat address, cheat txin).
  • -C, --complaint: Complaint flag (true/false).
  • -n, --network: Network (mainnet/testnet).
  • -T, --to: Your Evm address for receiving token.
  • -S, --solanaTo: Your Solana address for receiving token.
  • -w, --webhook: Webhook URL.
  • -b, --bridge: Bridges to be tested are separated by commas. If it is empty, there is no limit.
  • -c, --chainRpc: RPC config JSON (e.g., {"opt": "https://sepolia.optimism.io"}).
  • -l, --lp: Lp name to be tested. no restriction if empty.
  • -d, --debug: Debug flag for output detailed lp. use -d if want to enable it.
  • -g, --useMaximumGasPriceAtMost: Use the defined maximum gas price if exceeds. usd -g if want to enable it.

Examples

sh
# Run the monkey command with specified parameters
otmoic-cli monkey -i 300-450 -r https://relay.example.com -a 1000-1000 -p <PRIVATE_KEY> -s <SOLANA_PRIVATE_KEY>
# Run the monkey command with specified parameters
otmoic-cli monkey -i 300-450 -r https://relay.example.com -a 1000-1000 -p <PRIVATE_KEY> -s <SOLANA_PRIVATE_KEY> -t "succeed" -C true -n testnet -T 0x945e9704D2735b420363071bB935ACf2B9C4b814 -S 0xfee69ce6840ffcc48af425d5827e8dbcb1a9afd688ef206ee3da5c9ef23503dc -w http://xxx -b "" -c '{"opt": "https://sepolia.optimism.io"}' -l "" -d -g

Detailed Steps

  1. Initialize Log Directory: The script checks if the log directory exists and creates it if it doesn't.
  2. Get Current Date and Time: The script fetches the current date and time.
  3. Set Break Times: The script sets the break start and end times for the day.
  4. Check Break Window: The script checks if the current time is within the break window. If it is, it sleeps until the break ends.
  5. Execute Task: If not in the break window, the script logs the start of the task and executes the monkey command with the specified parameters.
  6. Log Output: The script logs the output of the task execution.
  7. Restart on Exit: If the task exits, the script logs the exit code and restarts the task after a short delay.

Code Reference

The implementation of this command can be found in src/commands/monkey.ts and monkey_mainnet.sh.