Decentralized borrowing protocol. Based on Liquity.
We have attempted to minimize the diff between our codebase and that of Liquity. Variable names such as LUSD and LQTY were preserved; while this may hinder readability soley in the context of our codebase, we feel there is a larger benefit gained when drawing comparisons between Topshelf and Liquity (which is well audited and battle-tested in a production environment).
Liquity's technical documentation is extensive, and a good starting point as a reference for Topshelf. Below we outline the differences from the original codebase:
- Topshelf replaces all references to native Ether within the codebase, instead accepting an ERC20 as collateral. This opens us to a wider range of collaterals and is the biggest fundamental change from Liquity. Whereas Liquity has exactly one collateral and minted token, Topshelf is designed to have
n
collaterals and tokens. However, each collateral / mint pair still exists as it's own isolated system - failure in one should not affect the others. - Within the
PriceFeed
contract, Band is used as a backup oracle instead of Tellor. This was done because Tellor is only available on Ethereum, and Topshelf will operate on various sidechains. The contract also allows modification of the final price based on the virtual price of a Curve-style LP token (allowing Curve LP tokens as a collateral). - The
FlashLender
contract has been added to support flashloans of collaterals and flash-minting of native tokens. Flashloans allow users to efficiently enter and exit leveraged positions. - We have replaced Liquity's
LQTYStaker
with our ownMultiRewards
contract. The functionality is similar, allowing users to stake our protocol token to receive a share of the generated revenue. This is the main point where our otherwise-isolated systems converge, as a single staking contract exists for users to receive fees across all systems. LockupContract
andLockupContractFactory
have been removed. Topshelf instead deploys multiple instances ofCommunityIssuance
that stream the protocol token emissions to different sources (including team vests). Tokens are held within a single deployment ofLQTYTreasury
which approves eachCommunityIssuance
to transfer it's allocated token emissions.- Liquity's
UniPool
has been replaced with ourStakingRewardsPenalty
. Users stake a UniV2 LP token and are rewarded with our protocol token. The contract applies a 1% deposit fee, and a variable fee between 0-4% upon withdrawal. Fees are held within the contract for 8 weeks. After that time the liquity is withdrawn, the received protocol tokens are burned, and the paired tokens are sent toMultiRewards
as a reward for stakers. - Transferring the protocol token to
0x00..dEaD
triggers a token burn. Burning is handled in this way to support cross-chain burns via Anyswap. CallingSwapout
on an Anyswap token, with the receiver as the burn address, will initiate a regular transfer on the root chain that correctly completes the burn. MerkleDistributor
was added for a one-time airdrop of the protocol token. Recipients have 7 days to claim after which any unclaimed tokens are burned.SystemShutdown
has been added, allowing us to pause individual systems in the event of an emergency. While paused, new tokens cannot be minted and all protocol token emissions go to zero. We added this in case of a black swan event causing a sudden devaluation of a collateral token. Ownership will be placed behind a community-owned multisig.