Tradeable Savings Accounts featuring evolving digital artwork and game-mechanisms to incentivize saving.
- Bonsai Banks are bonsai NFT artworks that must be tended to using on-chain transactions
- Each Bonsai Bank...
- is minted by the botanist or contract owner
- must be watered by depositing 20 DAI into the bank every 7 days
- must be fertilized by depositing 0.02 ETH into the bank every 30 days
- can wilt if watering is more than 7 days late and 5% of the deposits will go to the botanist
- can grow if taken care of correctly for 90 days the botanist will make an enhancement to the bonsai art
- must be destroyed to recover the deposits plus an interest earned
address botanist
- The owner of the contract and the producer of the artworksBonsaiBank[] bonsaiBanks
- A list of all the bonsai banks indexable usingbonsaiId
saddress waterToken
- The token used to water the plantaddress fertToken
- The token used to fertilize a plantuint256 waterAmount
- The amount ofwaterToken
needed to water the plantuint256 fertAmount
- The amount offertToken
needed to fertilize the plantuint256 waterRate
- The duration in seconds to wait between wateringsuint256 fertRate
- The duration in seconds to wait between fertilizings
- BonsaiBank
uint256 lastWatered
- The unix timestamp when the plant was last watereduint256 consecutiveWaterings
- The number of consecutive wateringsuint256 lastFertilized
- The unix timestamp when the plant was last fertilizeduint256 consecutiveFertilizings
- The number of consecutive fertilizingsuint265 bonsaiId
- The id of this BonsaiBank, used as the token ID for NFTsstring[] bonsaiUris
- A list of all the images in cronological order for this BonsaiBankint lifeStage
- An index intobonsaiUris
and references the plants current image URImapping(address => uint265) balances
- A mapping of token addresses to amounts deposited to the Bonsai bank
onlybotanist
- modifies methods so they can only be called bybotanist
- Parameters
caretaker
- The address this bonsai is minted tobonsaiURI
- the URI associated with the minted bonsai
- Pre-conditions
- None
- Post-conditions
- 1 BNZI is transferred to
caretaker
- 1 BNZI is transferred to
- Parameters
bonsaiId
- The id of the bonsai to water
- Pre-conditions
- Must approve
waterAmount
amount ofwaterToken
- Must approve
- Post-conditions
- Transfer
waterAmount
amount ofwaterToken
to the BonsaiBank - Resets
lastWatered
timestamp - Increments
consecutiveFertilizings
balances
is increased to reflect the deposit
- Transfer
- Parameters
bonsaiId
- The id of the bonsai to fertilize
- Pre-conditions
- Must approve
fertAmount
amount offertToken
- Must approve
- Post-conditions
- Transfer
fertAmount
amount offertToken
to the BonsaiBank - Resets
lastFertilized
timestamp - Increments
consecutiveFertilizings
balances
is increased to reflect the deposit
- Transfer
- Parameters
bonsaiId
- The id of the bonsai to waterbonsaiUri
- The id of the new image for the plant
- Pre-conditions
- The bonsai has 12 consecutive waterings and 3 consecutive fertilizing
- Post-conditions
- The new
bonsaiURI
is added to thebonsaiUris
- The
lifeStage
is incremented by 1 consecutiveWaterings
andconsecutiveFertilizings
are reset
- The new
- Parameters
bonsaiId
- The id of the bonsai to wiltbonsaiUri
- The id of the new image for the plant
- Pre-conditions
- It has been
waterRate * 2
seconds since the last watering
- It has been
- Post-conditions
- 5% of all
balances
for this bonsai are slashed and set to the botanist consecutiveWaterings
andconsecutiveFertilizings
are reset
- 5% of all
- Parameters
bonsaiId
- The id of the bonsai to destroy
- Pre-conditions
- The message sender is the holder of the bonsai
- Post-conditions
- The NFT is burned and all
balances
are sent to the message sender
- The NFT is burned and all