Energy Market
The energy market is a decentralized order book where players can trade energy for SES. It is powered by the EnergyMarket.sol contract.
Selling Energy (Creating an Order)
Operation
createOrder(energyAmount, sesPrice)
- Enter the amount of energy you want to sell
- Enter the total price in SES you're asking for
- Confirm the transaction
Energy Locking
When you create an order, the contract immediately locks your energy (marked as energyReserved), preventing you from spending it while the order is active.
Canceling an Order
cancelOrder(orderId)
- The order must be at least 3 seconds old before cancellation (prevents same-block frontrunning)
- After cancellation, the energy is unlocked
Buying Energy (Filling an Order)
Operation
fillOrder(orderId, energyAmount, maxUnitPrice)
- Browse the list of active sell orders
- Select an order
- Enter the maximum price you're willing to accept
- Confirm the transaction
Fees
A 1% SES protocol fee is deducted from the seller's proceeds:
Buyer pays = order price (exact listing price)
Seller receives = order price × 99%
Protocol fee = order price × 1% (accumulated in contract)
The 1% protocol fee accumulates in the contract and can be withdrawn by the admin.
Market Parameters
| Parameter | Value |
|---|---|
| Protocol Fee | 1% (deducted from seller) |
| Minimum Order Age | 3 seconds (before cancel/fill) |
| Order Status | active / inactive (becomes inactive after cancel or fill) |
Trade Example
Alice Sells Energy
- Alice creates a sell order:
createOrder(10000, 100 SES)— selling 10,000 energy for a total of 100 SES - The contract locks Alice's 10,000 energy
Bob Buys Energy
- Bob sees Alice's order
- Calls
fillOrder(orderId, 100, maxUnitPrice)— buys exactly 100 energy - Alice receives 99 SES (100 - 1% fee)
- 1 SES is accumulated as protocol fee
Strategy Tips
| Scenario | Suggestion |
|---|---|
| Need energy urgently for battle | Accept the lowest-priced sell orders |
| Not in a hurry | Place a limit order and wait for the right price |
| SES price is rising | Sell energy for SES to profit |
| Surplus energy | List sell orders to earn SES |
Recommended next step: Daily Mint →