source avatarjayesh

Share

CPPI is short for constant proportion portfolio insurance, and the idea fits in one line: keep a floor of your money safe, and put a multiple of whatever sits above that floor into a risky asset. With a multiplier of 2, $100 and a $90 floor means $20 in ETH and the rest in a safe leg. The vault sells ETH as prices fall and buys it back as they recover. When I built this the first time I had to write everything around that rule myself, which meant the share token, requests that wait to be filled at one price, claims, fees and an emergency pause. It came to about 1,600 lines of code, and less than a fifth of those were the CPPI rule itself. A month later I rebuilt the same vault on @centrifuge's Vault Development Kit (VDK), and I did not write a single line of vault code. The kit gives you the vault as one finished contract that nobody can change once it is deployed, and it already does the requests, the claims, the share issuance and the holding of money in between. It has an instant lane that settles on the spot and an async lane for requests that wait. My plan going in was to write CPPI as several plugins, which is what the kit calls the small contracts a builder adds to the vault, but I ended up needing only one. Centrifuge says a builder should only have to write the one or two plugins that make their product different, and for me that turned out to be true. That one plugin is the oracle, and it is 43 lines long. All it does is tell the vault what a share is worth, by adding up the two legs and dividing by the number of shares. The vault took that number and priced its conversions, instant deposits and instant withdrawals correctly, and I did not have to touch the kit's interfaces to make CPPI fit. The floor and the rebalancing live outside the vault, in two small contracts next to it. That split made sense to me once I saw it, because plugins are about how investors get in and out while the strategy is about what the vault holds. Centrifuge's docs call that second job running the portfolio. If ETH loses half its price in one step, which at a multiplier of 2 is the biggest drop the floor can take, the share price lands on its floor of 0.90 and anyone can trigger the emergency sale that keeps it there. My first vault was async only, on purpose, so that nobody could time their entry around a rebalance. The kit has an instant lane too, and I priced it with my own oracle, while async requests were filled at the price on the Hub, which is where the pool keeps its books. For a while that leaves one share with two prices. Centrifuge's oracles page already covers this case, and it says a gap between the two moves value between instant traders and other holders. Their default path for a strategy is to publish its NAV (net asset value, what everything in the vault is worth) on the Hub, so that both lanes read one price. Looking back, the kit took everything an investor touches off my plate, and my time went into the floor, the multiplier and the rebalancing. Those are the reasons anyone would want a CPPI vault in the first place.

Disclaimer: The information on this page may have been obtained from third parties and does not necessarily reflect the views or opinions of KuCoin. This content is provided for general informational purposes only, without any representation or warranty of any kind, nor shall it be construed as financial or investment advice. KuCoin shall not be liable for any errors or omissions, or for any outcomes resulting from the use of this information. Investments in digital assets can be risky. Please carefully evaluate the risks of a product and your risk tolerance based on your own financial circumstances. For more information, please refer to our Terms of Use and Risk Disclosure.