Bancor protocol powered VET/Energy(VeThor) exchange contract.
Demo page(on testnet) https://energy.outofgas.io/
The Bancor Protocol enables automatic price determination and an autonomous liquidity mechanism for tokens on smart contract blockchains. In this case,we took advantage of the automatic price adjust mechanism from bancor protocol.We use the concept of Relay Token but simplified the process of buying and selling. So the concepts of Energy Station
are:
- Create an bancor convert contract that connecting two tokens
- One connector token is VET, the other one is VeThor token
- The weight of connector token is 50%
- No smart token concept just allow the convention between VET and VeThor token
+----+ +--------------+
| | ---VET-->| |
|User| |Energy-Station|
| | <--VTHO--| |
+----+ +--------------+
+----+ +--------------+
| | --VTHO-->| |
|User| |Energy-Station|
| | <--VET---| |
+----+ +--------------+
- Deploy
EnergyStation
EnergyStation.setConversionFee(conversionFee in ppm)
- Send VET by
EnergyStation.fillVET()
- Approve EnergyStation for VTHO token
- Send VTHO by
EnergyStation.fillEnergy()
- Enable conversion by
EnergyStation.disableConversions(false)
The amount of VET and VTHO sent to EnergyStation
will be the initial supply of two connector token.
- Simulate
EnergyStation.getEnergyReturn(amount)
orEnergyStation.getVETReturn(amount)
to get converted value and calc minimum return asminReturn
- Convert VET to VTHO:
EnergyStation.convertForVET(minReturn)
- Convert VTHO to VET:
Energy.approve(EnergyStation, amount)
andEnergyStation.convertForEnergy(amount,minReturn)