Skip to content

GandalfThePink/Vampire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vampire

A stablecoin build on Uniswap. Currently deployed on Kovan at 0xb18919e5152Bf82e9089338E7fCcA3Fe37668212 (vampire token) and 0xE022Af7CAEe18Ac700feD555A8ec0c11F07C3860 (vials)

WARNING THIS IS EXPERIMENTAL TECH. IT IS NOT IN A FINAL STAGE AND THE CURRENT VERIOSN IS JUST THE MINIMAL VIABLE PRODUCT. USE CONTRACTS AT YOUR OWN RISK OR STAY AWAY. THIS IS NOT YIELD FARMING, THERE IS NO MONEY TO BE MADE, NO TOKENS TO BE GIVEN AWAY.

The idea of this project is to build a decentralised stablecoin using a smart contract based on Uniswap. We release two tokens, Vials which are designed to be value stable at the price of one dai per token, and vampries which represent the collateral and thus equate to a long position on eth. We do not have a governenace token and there is no controller set for the contract. Everything is done without relying on a special entity. The protocol does not belong to anyone and simply acts based on the code. The advantage of this approach is that we can create a stablecoin without relying an a big goverancne layer such as seen in makerdao and neither rely on a central custody such as used for tether. The protocol is also minimalsitic in the sense that there is only one pool of collateral and not many indiviudal cdps that might need to be liquidated in case of a price drop of the collateral causing significant congestion of the ethereum network or the failure of such auctions leading to losses for collateral providers. This was seen in makerdao after prices collapsed due to the pandemic economic fears. The basic idea of the protocoll is simple. The contract has a reserve of ethereum tokens. When the price of vials is lower than one dai it will buy back Vials and burn them to drive the price up and restrict the supply. If the price above one it will instead mint new tokens and sell them to lower the price and increase the supply. As a consequence the price remains stable at one dollar and the supply can adjust to the usage of the protocoll dynamically.

The two token model

A stablecoin is usually created by locking up some collateral, as done for example by makerdao. This collateral provides the safety and serves as a gurantee to uphold a lower peg on the price. We do not change this basic mechanism. Each Vial issued is sold on the market at a price of at least one dai thereby creating ether reserves for the contract. If the price of eth rises the collateral does further increase giving the protocoll more abilities to enfore the lower price peg. But as soon as the price of eth falls the protocll may become undercollateralised and find itself unable to defent the peg of one dai per vial. This illustrates the need for a second token. Economically when creating syntetic assets between two parties, one party has to loose if the other wins. It is not possible to gaurantee a stable coin without someone assuming the risk of the collateral. We store ether and aim to create a syntetic stablecoin. On the flipside we always also create a long position on the collateral such that both positions combined simply trace the price of the underlying collateral. In makerdao, the cdp is effectively a non-tradable long posotion on the collateral, while dai is the resulting stablecoin. If one holds both the dai and the corresponding cdp the entrie position simply trails the ethereum collateral. But if the dai is sold and one only keeps the cdp, then if the value of the collateral goes up the cdp holder wins as the same number of dai can now unlock a more valuable collateral. But if the value of the collateral goes down the cdp will eventually get liquidated in a debt auction before it would no longer profitable to use the dai to redeem the devalued collateral. The cdp owner can suffer a total loss since the owenership of the cdp is a long position. We modify this mechanism by bundeling the collateral cdps into one single contract that is represented by tradable erc20 tokens represetning a fraction of the protocolls collateral. This is the vampire token.

How Vampires are used to secure a healthy collateral

The protocll computes its collateraisation ratio, targeting a 150% overcollateralisation. This means that price drops of 33% can be absorbed without causing any problems. If above this value the system is deemed sufficently safe from ethereum price movements and no further action is taken. But if below 150% the protocll will mint new vampire tokens and sell them on the market to raise additional funds and raise the collateralisation. It is important to note that this does not dilute existing vampire holders as the new tokens are backed by the newly aquired ethereum. While a maker cdp provides an individual leverage, vampire tokens are flexiby leveraged. The higher the overcollateralisation the lower their leverage. In the theoretical limit infinite overcollateralisation vamprie tokens simply represent eth at a levereage of 1x. At the target value of 150% they are 3x leveraged. Since the overcollateralisation changes dynamically the leverage of vampires will vary in time. Note that while the issuance of new vampires does not dilute the value of existing vampires, it will lower the leverage of all vampire tokens.

Vitrual liquidation

At a value below 100% collateralisation the protocoll can no longer garantee a stable value for the vials. A maker cdp would be liquidated at this point. We choose to go a different route that is quite experimental. We allow the protocll to temporarily run under 100% collateralisation and continue to issue a large amount of new vampire tokens trying to regain the collateral. At this point vampires should be very cheap and this effectively equates to a liquidation for the holders. But the price should remain above zero since a move up in the value of eth will provide a huge leverage to the upside. Hopefully the protocoll will quickly return above 100% collateralisation, but the exact dynamics remains to be seen in practive given all the complexities of the ethereum ecosystem.
The protocll will become increasingly unstable the lower the collateralisation falls. This is why we have implemented an eventual rebase. If the collateralisation falls below 80% the vial holders will loose a percentage of their vials using a rebase mechanism (similiar to ampleforth) until the vials agian matches the collateral. This effectively menas that the stability of the stablecoin is broken and instead vial holder assume controll over the entire collateral. We have choosen to build a stablecoin that is not fully stable in all conditions. It behaves as a stablecoin as long as there is enough collateral, but eventually falls with the value of the collateral. This problem we face is a fundamental problem of syntetic assests. One can never gurantee more value than is locked up backing the system. Synthetix tries to avoid this by trying to maintain 750% overcollateralisation but this severly limits the liquidity of the minted assets. Makerdao uses liquidations and will compensate users by printing more maker tokens in case they fail. Our design is different from those with its unique advanatges and challanges. While our stablecoin Vials underperforms a theoretically value-stable asset, vampires overperform a pure long position. This is because the system has only two parties and every loss by one side is assumed by the other. It is a long position that will suffer heavily from price losses of the underlying collateral, but can never get fully liquidated. Ideally this would be compensated by an interest payment from vampire to the vials. We have not implemented such a system since it is impossible to aprior define a viable interest rate. We have are several ideas on how to imporove this in v2.

Callable fucntions

Normal users never need to call any protocoll fucntions. They simply buy/sell vampires or vials on uniswap. We list the functions here to demonstrate how the protocoll works. All fucntions can be called by anyowne, but we expect that only advanced users will find the need to use them.

BLOOD RITUAL: This is the main function of the protocoll. It first updates the uniswap vwap price oracles for dai, vials and vampires. Then it computes the collateralisation of the system and mints new vampires as required. It then checks the price of a vials and buys them back/sells them on uniswap with the goal to bring the price to 1 dai. If the collateralisation is critial it will rebase the Vials to bring the protocoll back to stability. It also sends some free vampires to the caller of the function to compensate for gas fees and as an incentivse to call this fucntion regularly. This dilutes the value of vampires at less than 1% per year. This seems fair given that vampires are a bit better than a regular long as explained above.

GET DARK ENERGY: This function simply returns the collateralisation of the protocoll in permille. Target value is 1500.

SILVER BULLET: This function allows vampire holders to burn their vampires and redeem their share of the collateral. It can only be called at a collateralisation over 200% since we do not want collateral holders to leave the protocoll undercollateralised. At lower values one can exit by market selling or the following function instead

BLOOD GARLIC: This fucntion destroys an equal amount of vials and vampires and releases corresponding protocol funds. It can always be called and game theretically provides a lower bound on the combined value of Vials and Vampries to equal at least the ether reserves.

ETHER RITUAL: This function allows the creation of both new vials and vampires by paying ether to the contract. It can only be called above 150% collateralisation. In this case it provides an upper bound on the combined value of Vampires and Vials.

shortcommings and ideas for v2

We have avoided a governance layer on purpose and want to test how this minimal model performs first. Espeically our innovation of trying to run undercollateralised for a limited time. Everyhting the protocoll does is hard coded with zero wiggle room. This means that we have set a lot of constants in the code and we cannot be sure if those are ideal or if a fixed value is even reasonable over extended periods of time. One example is the reward for calling the blood ritual. If there is significant value locked up 1% per year may far exceed the transaction fees. Another important example is an interest rate for Vial holders, or liquidity incentives such that the protocoll has more room to infuence the supply.

We intend to add a second version with a new model of "fair governance". In this model the issuance of governenace tokens is exponentially increasing such that old holders are constantly diluted. The goal is to give the power over governance to recent users of the protocll and not to generate a quick yield farming hype and a group of entitled bagholders. The governance should be limited, only able to set some key varaibles but not change the protocoll entirely. It has been shown that in such a case governance will always try to limit the issuance of new tokens. The advantage of having a governance is that savings rates and so on can be ste dynamically.

Furhtermore we are unhappy basing the protocll only on dai which we do so far to keep everything minimalistic for the first experiments. Dai may fail and loose its peg. We can solve this by adding more oracles, and give the controll over those to the governance of the protocoll. We currenty plan to have three oracles and use the median value. In such a case one oracle can fail without casuing troubles.

If sucesfull this method can be used to create not only $-stablecoins but all kinds of sytetic assets.

About

A stablecoin build on Uniswap

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published