Simple Lending Protocol – 简单贷款协议区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Simple Lending Protocol – 简单贷款协议区块链毕设代写 是一篇很好的国外资料

Simple Lending Protocol

Borrow a dollar-pegged stablecoin against your productive cryptoassets (starting with xSUSHI) 🚀

Contract System

  • USDZ
    • Dollar-stable token, minted against collateral.
    • Mint/burn managed by Controller.
  • Controller
    • Central system manager.
    • Keeps records of users’ collateralized positions, ratios, etc.
    • Keeps track of USDZ and xSUSHI prices using SushiSwap TWAP
    • Has ability to liquidate undercollateralized positions

Protocol Plan V1

MVP version, for educational purposes. Not intended for real financial use.

  • Protocol Parameters:
    • 3% annual interest on all borrowings
    • Collateral will be xSUSHI to start
    • Stablecoin (dollar-pegged) is called USDZ
    • Can borrow USDZ against collateral up to 150% collateralization ratio
    • At 150% col. ratio or lower, positions can be liquidated for the amount that would bring it back to 150% col. ratio.
    • Can only withdraw collateral if col. ratio over 200%. Can’t withdraw collateral that would make col. ratio < 200%
  • Liquidation:
    • To keep things simple, liquidation will market sell the entire xSUSHI collateral via SushiSwap for USDC. USDC will then be redeemable 1:1 with USDZ. This should keep USDZ approx dollar-pegged even if it has very little trade volume.
    • liquidator executes liquidate or batchLiquidate on address(es) with debt position(s)
    • when liquidating a position, 10% of the xSUSHI is diverted as a liquidation fee, and the remaining 90% is swapped for USDC.
    • Of the 10% liquidation fee: 2% goes to liquidator, 8% to protocol treasury.
  • Borrowing:
    • Delay of 10 blocks between depositing collateral and borrowing (to prevent Flash Loan attacks, as USDZ will likely be very illiquid at the start).

The Lend-Borrow Accounting Process

  • User deposits xSUSHI by approving, then calling deposit()
    • stores amount of xSUSHI deposited, as collateral
    • emits Deposit event
  • User can then call borrow(), passing amount to borrow
    • calculates USDC value of user’s xSUSHI collateral (xSushiPrice) via SushiSwap
    • calculates compound interest user owes on any outstanding debt from lastBorrowed to now (using time, not blocks)
    • calculates collateral ratio (colRatio) of user, given current debt + interest
    • if colRatio <= 200%, reverts with "not enough collateral"
    • if colRatio > 200%, user can borrow up to a 200% colRatio
    • calculates borrowable as
    xSushiPrice * ( colRatio - 200% ) 
    • if amount > borrowable, reverts with "amount too high"
    • sets user debt to prev debt + interest + amount borrowed
    • sets user’s lastBorrowed to now (to restart interest compounding from the new total debt figure)
    • emits Borrow event
  • Anyone can call liquidate(), passing an address that has a position
    • checks if address has a position, if not reverts with "address has no position"
    • calculates totalDebt amount for address as debt + interest on the debt since lastBorrowed. This is a USDZ figure.
    • calculates USDC value of user’s xSUSHI collateral (xSushiPrice) via SushiSwap.
    • calculates the colRatio of the address as
    ( xSushiPrice * collateral ) / totalDebt 
    • if colRatio > 150%, reverts with "collateral ratio still safe"
    • if colRatio <= 150%, liquidation process starts
    • 90% of xSUSHI is swapped for USDC on SushiSwap
    • 8% of xSUSHI is transferred internally to protocol
    • 2% of xSUSHI is transferred internally to liquidater
    • sets user debt and collateral to 0
    • emits a Liquidation event

Protocol Plan V2

Some form of governance token and DAO will be established to develop the protocol after a public version is ready and deployed.

  • Governance:
    • There will be a completely valueless governance token for the protocol. Ticker to be decided. GOV used as a placeholder.
    • GOV can be locked for different periods, in exchange for veGOV (shout out to Curve).
    • GOV lockers get more veGOV, the longer they lock up the GOV for.
    • 1 veGOV = 1 vote in governance issues.
    • Protocol earnings are directed to 2 different accounts: 70% operating funds, and 30% staking rewards. veGOV tokens represent a share of the staking rewards pool.
    • veCRV holders also vote on how the operating funds are used.
  • GOV Token Distribution:
    • 10% founding team allocation, vested for 2 years
    • 25% of supply airdropped to DeFi users
    • 30% operating fund, linear unlocks for 2 years
    • 35% liquidity mining rewards for 2 years
  • Protocol Launch Caps:
    • To prevent whales using large positions to break the USDZ-dollar peg (a potential attack vector), some caps will be in place at launch, and may be changed by protocol governance later.
    • Protocol collateral cap: $10 million in xSUSHI.
    • Protocol borrow cap: $2 million in USDZ.

Resources

  • Abracadabra Docs | GitHub
  • Aave Docs | GitHub
  • Maker Liquidation 2.0 Module
  • Uniswap V2 Prices, Swaps

Added 4 passing tests for setTokenAddresses and setSushiAddresses fun…


简单借贷协议

用你的生产性加密资产(从xSUSHI开始)借一美元挂钩的stablecoin🚀

合同系统

  • 美元稳定代币,针对抵押品铸造。由控制器管理的铸币/烧制
  • 使用掉期TWAP跟踪USDZ和xSUSHI价格

协议计划V1

MVP版本,用于教育目的。不是为了真正的经济用途

  • 稳定货币(美元挂钩)称为USDZ
  • 用户通过审批存入xSUSHI,然后调用deposit()存储xSUSHI存入的金额,作为抵押品发出存款事件
  • 计算用户所欠的复利对于从上次借款到现在的任何未偿债务(使用时间,而不是区块)

借贷会计流程

  • 如果colRatio&lt;=200%,如果colRatio&gt;则用“抵押品不足”回复;200%,用户最多可借200%的贷款比率
  • 将用户上次借款设置为现在(从新的总债务数字重新开始复利)
  • 治理:将出现完全没有价值的协议管理令牌。股票行情待定。GOV用作占位符。政府可以锁定不同的时期,以交换维戈夫(呼喊曲线)。州长储物柜的维戈夫越多,他们锁州长的时间就越长。1维戈夫=治理问题的1票。协议收益被引导到两个不同的账户:70%的运营资金和30%的赌注奖励。veGOV代币代表赌注奖励池的一部分。veCRV持有人还投票决定如何使用运营资金

协议计划V2

在公共版本准备好并部署之后,将建立某种形式的治理令牌和DAO来开发协议

  • Aave Docs | GitHub
  • GOV Token Distribution:
    • 10% founding team allocation, vested for 2 years
    • 25% of supply airdropped to DeFi users
    • 30% operating fund, linear unlocks for 2 years
    • 35% liquidity mining rewards for 2 years
  • Protocol Launch Caps:
    • To prevent whales using large positions to break the USDZ-dollar peg (a potential attack vector), some caps will be in place at launch, and may be changed by protocol governance later.
    • Protocol collateral cap: $10 million in xSUSHI.
    • Protocol borrow cap: $2 million in USDZ.

资源

  • Abracadabra Docs | GitHub
  • Aave Docs | GitHub
  • Maker Liquidation 2.0 Module
  • Uniswap V2 Prices, Swaps

Added 4 passing tests for setTokenAddresses and setSushiAddresses fun…

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/23038.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Simple Lending Protocol – 简单贷款协议区块链毕设代写

提供最优质的资源集合

立即查看 了解详情