Managing Your Treasury
If you’ve enabled monetization, your service’s canister acts as a secure, on-chain treasury, collecting all funds paid by your users. The project template includes several built-in functions to manage these funds. You can call these functions directly using thedfx
command-line tool.
get_owner()
: View the principal that currently owns and controls the canister.set_owner(new_owner)
: Transfer ownership of the canister to a new principal. (Owner only)get_treasury_balance(ledger_id)
: Check the canister’s balance of any ICRC-1 token.withdraw(ledger_id, amount, destination)
: Withdraw funds from the treasury to any account. (Owner only)
Example: Checking Your Balance
To check your service’s balance of a specific token, you need your service’s canister ID and the token’s ledger canister ID.Example: Withdrawing Funds
To withdraw funds, you’ll also need the amount and the destination account.Enabling Proof of Usage Rewards (Beacon)
You can participate in the protocol’s rewards program by enabling the optional usage beacon. This allows your service to submit Proof of Usage data, making you eligible for ecosystem rewards. What data is collected? The beacon periodically sends aggregated, privacy-preserving usage metrics to a on-chain service. Specifically, it collects:- Tool invocation counts
- Total token amounts processed by your tools
Prerequisite: Your service’s WASM must be verified and listed in the App
Store for its beacon data to be accepted. This is a security measure to
prevent abuse of the rewards system.
How to Enable the Beacon
Enabling the beacon requires a code change. Because the Prometheus Protocol manages all deployments to ensure code is verified, you must publish a new version of your service to activate it.1
Uncomment the Beacon Code
Open
src/main.mo
in your editor, find the beacon section, and uncomment the block of code that initializes the beaconContext
.src/main.mo
2
Commit the Changes
Save the file, build the new wasm (e.g.,
dfx deploy
), and commit the update to your Git repository. The publishing process is tied to your commit history.3
Publish the New Version
You must now re-publish your service. This will submit your new code for verification and, once approved, the protocol will deploy it as a new version.Follow the same steps in the Publishing guide, making sure to use your new Git commit hash. This ensures that the change is audited and transparently recorded on-chain.