Hi everyone,
I’ve been working on the Game of Prompts contracts, which currently support prize distribution in both ERG and tokens. While the logic works, handling ERG distribution gets quite complicated: you have to ensure the minimum value in each box, mix ERG and token logic, and the calculation functions become cumbersome.
This made me wonder: why not simplify things and work exclusively with tokens? My proposal:
-
Create a wrappedERG that represents ERG 1:1, issued by a contract that locks the original ERG.
-
The prize contract would then operate entirely with tokens, eliminating conditionals for asset type.
-
Anyone who wants actual ERG would simply unwrap the wrappedERG at the end.
-
With chained transactions, users wouldn’t even need to notice that wrappedERG is being used instead of ERG, both when participating and when receiving the prize.
Advantages I see:
-
Homogeneous logic: everything is calculated as tokens, no branching between ERG and tokens.
-
Avoids errors with ERG minimums in boxes.
-
Scalable and maintainable.
-
Works for users who want ERG without complicating the contract.
Minor drawbacks:
-
Requires a bridge contract for wrappedERG.
-
One extra step for users who want real ERG.
Another alternative I can think of:
-
Require the party executing the prize distribution transaction to cover the ERG minimums if they are not met.
-
However, I still wonder if it’s better design to just use tokens, to keep the contract logic simpler and more robust.
In my view, using tokens internally and wrappedERG when real ERG is needed greatly simplifies the contract while retaining flexibility.
What do you think? Has anyone implemented something similar on Ergo? Do you see any risks I might be missing?