VenusProtocol / venus-protocol

BNB Smart Chain Venus Protocol
BSD 3-Clause "New" or "Revised" License
255 stars 169 forks source link

[VEN-2840]: add redeemAndRepayBatch to the governance helper #464

Closed kkirka closed 7 months ago

kkirka commented 7 months ago

This PR adds a function to batch-repay multiple debts using either vTokens or underlying.

The way it works is it:

The contract is written in a way that it does it best to provide a sane behavior and not revert – this is useful for VIPs since the external factors (exchange rates, borrow balances, etc.) may change, and in most cases we still want the VIP to be executable.

The contract uses a new Currency library inspired by uniswap v4 to support both native assets and tokens in a seamless fashion.

github-actions[bot] commented 7 months ago

Code Coverage

Package Line Rate Branch Rate Health
contracts 100% 100%
contracts.Admin 88% 41%
contracts.Comptroller 100% 90%
contracts.Comptroller.Diamond 95% 59%
contracts.Comptroller.Diamond.facets 75% 65%
contracts.Comptroller.Diamond.interfaces 100% 100%
contracts.DelegateBorrowers 100% 89%
contracts.Governance 62% 41%
contracts.InterestRateModels 47% 67%
contracts.Lens 45% 37%
contracts.Liquidator 83% 60%
contracts.Oracle 100% 100%
contracts.PegStability 88% 84%
contracts.Swap 88% 58%
contracts.Swap.interfaces 100% 100%
contracts.Swap.lib 81% 55%
contracts.Tokens 100% 100%
contracts.Tokens.Prime 96% 72%
contracts.Tokens.Prime.Interfaces 100% 100%
contracts.Tokens.Prime.libs 90% 76%
contracts.Tokens.VAI 71% 46%
contracts.Tokens.VRT 20% 9%
contracts.Tokens.VTokens 64% 47%
contracts.Tokens.XVS 19% 8%
contracts.Utils 50% 30%
contracts.VAIVault 50% 45%
contracts.VRTVault 49% 36%
contracts.XVSVault 64% 50%
contracts.lib 89% 71%
Summary 69% (3235 / 4701) 49% (1212 / 2458)