Oriorz / topshelf-contracts

Decentralized borrowing protocol. Based on Liquity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

topshelf-finance

Decentralized borrowing protocol. Based on Liquity.

Notable Differences

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:

Changes and Additions to Core Architecture

  1. 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.
  2. 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).
  3. 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.
  4. We have replaced Liquity's LQTYStaker with our own MultiRewards 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.
  5. LockupContract and LockupContractFactory have been removed. Topshelf instead deploys multiple instances of CommunityIssuance that stream the protocol token emissions to different sources (including team vests). Tokens are held within a single deployment of LQTYTreasury which approves each CommunityIssuance to transfer it's allocated token emissions.
  6. Liquity's UniPool has been replaced with our StakingRewardsPenalty. 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 to MultiRewards as a reward for stakers.
  7. Transferring the protocol token to 0x00..dEaD triggers a token burn. Burning is handled in this way to support cross-chain burns via Anyswap. Calling Swapout 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.
  8. 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.
  9. 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.

About

Decentralized borrowing protocol. Based on Liquity.

License:GNU General Public License v3.0


Languages

Language:JavaScript 79.3%Language:Solidity 20.7%