Eggforce Weekly Writeup #14: Seeding the Bank – Eska Roy
Work is going smoothly on the bankroll contract. This bankroll contract, nicknamed Treesury, will hold player funds and use interest to fund each Eggforce game round.
I’m currently testing and refining Treesury on the Kovan network (an Ethereum testnet). Treesury is limited in scope, with just three actions offered to users:
- GrowTreesury: send DAI, get Radcorns in return
- HarvestRadcorn: send Radcorns, get DAI in return
- WithdrawBalance: send Radcorns, get DAI in return. Usable only after an emergency withdrawal (more on that later)
Behind the scenes, GrowTreesury also invests this DAI into Compound.Finance so it earns interest.
As for HarvestRadcorn, it redeems Compound tokens for DAI, and then sends this DAI to your wallet.
There’s a couple extra functions available only to the contract owner:
- FundGame: withdraws part of the bankroll to fund the next Eggforce game.
- SendProfit: sends DAI profits from the previous round to Compound.
- SecureBankroll: initiates an emergency withdrawal from Compound.
FundGame is set to redeem a fixed amount of the bankroll, at a rate of 0.025% per day. This comes out to ~0.75% per month, or ~9.125% per year.
That is to say: if the last time an Eggforce game was funded was 2 months ago, the FundGame function will withdraw 1.5% of the bankroll to fund it.
This is roughly in line with the interest earned on Compound, with some margin.
Of course, Compound interest rates may vary with time: a few months ago they were at 15%, today they are at 5%. The introduction of Dai Savings Rate in less than 2 weeks will affect these rates too.
The key part: for Treesury, we have a fixed rate with a low time interval regarding withdrawals. So your funds will always be safe.
Eggforce has no fees of any kind. Game theory suggests we should see at least as much DAI spent in the game as there is in the prize pool; reaching an equilibrium point. Ergo, Treesury holders should come out ahead.
But it’s important to keep in mind game theory may not be the only factor. Low prize pools or lack of participation may account for rounds won with minimal investment. In that case, the brave few playing the game stand to profit.
Ideally, this would encourage more players to play the game, which would bring the DAI invested up to the equilibrium point mentioned above.
Back to owner functions: SendProfit sends the DAI spent by players on Eggforce to the Treesury.
It functions like GrowTreesury, except SendProfit doesn’t get Radcorns in exchange.
Essentially, SendProfit raises the DAI invested while keeping each Radcorn the same. Meaning your Radcorns are worth more and more DAI with time.
SecureBankroll is our contingency plan. As Treesury relies on DAI and Compound, there may be upgrades required to either system (like the Multi-Collateral DAI coming on November 18th).
To keep funds safe, we can’t just allow the owner to change contract addresses. The owner could pick an arbitrary address where he could siphon the funds.
Instead, SecureBankroll redeems all DAI from Compound to the contract, and locks out all other functions except WithdrawBalance. Each player can then get their DAI back by calling WithdrawBalance, which exchanges their Radcorns for the corresponding amount of DAI.
Ideally, we should never have to use SecureBankroll. But if we do, your DAI will stay secure in the Treesury contract until you decide to withdraw it to your wallet.