Energy

Energy Vault

Your on-chain Energy account for the API.

The API spends Energy from your vault, not from your wallet. Deposit what you want to use; withdraw what you don't need.

How it works#

  1. deposit(amount) moves ENERGY from your wallet into your vault balance (after an approval).
  2. API requests reserve and use Energy right away, off-chain, so they stay fast.
  3. Every hour a settlement batch lowers each balance by what was used and burns the total.

Withdrawing#

  • requestWithdraw(amount) starts the withdrawal delay (currently 2 hours; the contract only allows 1 hour to 7 days). The delay lets the last hour of usage settle first.
  • withdraw() after the delay sends the ENERGY back to your wallet.
  • cancelWithdraw() makes the amount spendable again.

Guarantees#

  • A charge can never take more than your balance or the per-user limit set in the contract.
  • Batches are numbered in order and each number can be used once, so the same usage can't be charged twice.
  • Used Energy is burned, not sent to anyone.
  • Withdrawals keep working even while deposits are paused.
  • Every charge is a public Charged event on the explorer.

Why doesn't my number change?#

  • The ENERGY is still in your wallet: deposit it.
  • Part of it is set aside for a withdrawal you requested: cancel it to use it again.
  • It's staked in the Liquidity Pool: withdraw it first, then deposit.