payoutor.sh is a Bash script designed to make life easier for members of the Moonbeam Treasury Council by automating the calculation of GLMR and MOVR token Treasury payouts at current prices based on the requested amount in USD and by generating the specific treasury proposals extrinsic call data from that.
- Automated payout calculation for GLMR and MOVR based on a USD input, current 30d EMA token prices and their split ratio
- Fetches recent block numbers for both networks (with offset for Subscan 30d EMA price stability)
- Extracts 30d EMA price for the exact block from Subscan's price converter tool
- Generates extrinsic call data for the treasury proposal on both Moonbeam and Moonriver
- Fetches latest proposal IDs from both networks for council proposals
- Real-time progress logging during council proposal generation
- Customizable config file for adjusting token payout ratios, proxy address, RPC's etc.
- Multiple output formats (terminal, txt, JSON, Markdown)
- Bash (tested on macOS, should work on Linux)
curl(for HTTP requests)awk,bc,grep,sedjq(optional; for config file parsing)- Node.js (for council proposal call data generation)
Install missing dependencies on macOS with Homebrew:
brew install curl jq bc node-
Place
payoutor.shin your working directory. -
Make it executable:
chmod +x payoutor.sh
-
(Optional) Rename
payout_config.example.jsontopayout_config.jsonto load custom settings like split ratios, a proxy address or costum wss endpoints when running the script.
Note: payout_config.json is in .gitignore so your local secrets or preferences won't be tracked by Git.
./payoutor.sh <USD_AMOUNT> [RECIPIENT_ADDRESS] [OPTIONS]<USD_AMOUNT>: The total payout amount in USD (e.g.,1000,1500.50)
# Basic payout calculation
./payoutor.sh 1000
# With recipient address
./payoutor.sh 1000 0x1234567890123456789012345678901234567890
# With proxy call data using address from config
./payoutor.sh 1000 0x1234567890123456789012345678901234567890 --proxy
# With proxy call data using a specific proxy address
./payoutor.sh 1000 0x1234567890123456789012345678901234567890 --proxy-address 0x41D4B02022165Fcd47b4E0F64Aa41eEF9ef1da38You can use a JSON config file (default: payout_config.json) to set custom payout ratios, specify the proxy address for repeated usage and more:
{
"glmr_ratio": 0.6,
"movr_ratio": 0.4,
"retry_attempts": 3,
"timeout": 30,
"block_age_minutes": 5,
"council_threshold": 3,
"council_length_bound": 10000,
"websocket_endpoints": {
"moonbeam": "wss://wss.api.moonbeam.network",
"moonriver": "wss://wss.api.moonriver.moonbeam.network"
},
"proxy_address": "0x1234567890123456789012345678901234567891"
} --proxyenables output of proxy council proposal call data for both Moonbeam and Moonriver.--proxy-address <address>specifies the proxy address to use for proxy call data.- If
--proxyis set but no address is specified, the proxy address will be loaded from theproxy_addressfield inpayout_config.json. - If neither is set, proxy call data is not output.
-h, --helpShow help message-v, --verboseEnable verbose output (debug/logging)-c, --config FILEUse a custom configuration file (default: payout_config.json)-o, --output FILESpecify output file (default: payout_output.txt)-l, --log FILESpecify log file (default: payout.log)--glmr-ratio RATIOSet GLMR allocation ratio (default: 0.6)--movr-ratio RATIOSet MOVR allocation ratio (default: 0.4)--version--h, --helpShow help message-v, --verboseEnable verbose output-d, --dry-runShow calculations without making API calls-c, --config FILEUse custom configuration file-o, --output FILESpecify output file (default: payout_output.txt)-l, --log FILESpecify log file (default: payout.log)--glmr-ratio RATIOGLMR allocation ratio (default: 0.6)--movr-ratio RATIOMOVR allocation ratio (default: 0.4)--council-threshold NCouncil threshold (default: 3)--council-length-bound NLength bound (default: 10000)--moonbeam-ws URLMoonbeam WebSocket endpoint--moonriver-ws URLMoonriver WebSocket endpoint--jsonOutput results in JSON format--markdown|--md-tableOutput results in Markdown table format--proxyOutput proxy council proposal call data in addition to normal call data--proxy-address ADDRSpecify proxy address (overrides config)--versionShow version information Show version information
- Results are printed to the terminal and saved to the output file (default:
payout_output.txt). - Log messages are saved to the log file (default:
payout.log).
- Missing dependencies: The script will alert you if required tools are missing.
- API/network errors: If Subscan is unreachable or the price is unavailable for a block, the script will retry and log errors.
- Locale issues: The script forces
LC_NUMERIC=Cfor all calculations to avoid decimal/comma confusion. - No EMA30 price for block: The script uses a recent block (latest - 200) to ensure a valid, scrapable EMA30 price from Subscan. If you need a different block, adjust the offset in the script.
For questions or improvements, contact the MBTC Team in the Moonbeam Forum or open an issue in the project repository.
