A cryptonative credit marketplace for fully anon and trustless loans to DAOs.
Platform: Code4rena
Start Date: 03/11/2022
End Date: 10/11/2022
Period: 7 days
Status: Completed
Pot Size: $115,500 USDC
Participants: 120
Reporter: itsmetechjay
Judge: LSDan
Id: 174
League: ETH
Trust | 1/120 | $11,613.69 | 6 | 3 | 0 | 2 | 0 | Grade B | 0 | 0 |
adriro | 2/120 | $9,439.35 | 11 | 5 | 0 | 5 | 0 | Grade B | 0 | 0 |
bin2chen | 3/120 | $8,432.71 | 4 | 2 | 0 | 2 | 0 | 0 | 0 | 0 |
rvierdiiev | 4/120 | $7,858.73 | 8 | 1 | 0 | 6 | 1 | Grade B | 0 | 0 |
berndartmueller | 5/120 | $7,817.37 | 7 | 4 | 0 | 3 | 0 | 0 | 0 | 0 |
Lambda | 6/120 | $5,717.17 | 5 | 2 | 0 | 3 | 0 | 0 | 0 | 0 |
aphak5010 | 7/120 | $5,199.79 | 9 | 2 | 0 | 5 | 0 | Grade A | Grade B | 0 |
hansfriese | 8/120 | $3,471.29 | 5 | 2 | 0 | 3 | 0 | 0 | 0 | 0 |
Jeiwan | 9/120 | $2,743.33 | 5 | 1 | 0 | 4 | 0 | 0 | 0 | 0 |
0xdeadbeef0x | 10/120 | $2,648.01 | 5 | 1 | 0 | 4 | 0 | 0 | 0 | 0 |
Auditor per page
The C4udit output for the contest can be found here.
Note for C4 wardens: Anything included in the C4udit output is considered a publicly known issue and is ineligible for awards.
Go to our project repo and follow the instructions there (commit hash: code4rena-2022-11-03
)
Code4rena discord channel for contest https://discord.gg/bD4nnRwYPN
We highly recommend reading our entire docs website https://docs.debtdao.finance/
These are the most relevant sections for Code4rena wardens.
fRate
that a Borrower DAO pays to have access to immediate liquidity. It SHOULD be below the dRate
charged when the Borrower does have debt but does not explicitly have to be less.ids
array in LineOfCredit.sol to prioritize Lenders that were drawn down on first. They must be paid back first.File |
---|
contracts/modules/credit/LineOfCredit.sol |
contracts/modules/credit/SpigotedLine.sol |
contracts/modules/credit/SecuredLine.sol |
contracts/modules/credit/EscrowedLine.sol |
contracts/modules/spigot/Spigot.sol |
contracts/modules/escrow/Escrow.sol |
contracts/modules/oracle/Oracle.sol |
contracts/modules/interest-rate/InterestRateCredit.sol |
contracts/modules/factories/LineFactory.sol |
contracts/utils/CreditLib.sol |
contracts/utils/LineLib.sol |
contracts/utils/CreditListLib.sol |
contracts/utils/EscrowLib.sol |
contracts/utils/SpigotLib.sol |
contracts/utils/SpigotedLineLib.sol |
contracts/utils/MutualConsent.sol |
contracts/utils/LineFactoryLib.sol |
Since the Spigot takes ownership of another protocol/DAO's smart contracts to secure their revenue streams (e.g. owning a Yearn vault to ensure vault fees repays Yearn's debt) we want to make sure that the Spigot can't get bricked locking their contract forever, that their contract can't be stolen from the Spigot and that revenue tokens are securely escrowed inside the Spigot for the Owner to claim.
Our integration between the Line of Credit and Spigot contracts. It owns the Spigot so it's important that it doesn't lose ownership of the Spigot (unless releaseSpigot()
successfully executes) so that it can properly manage and call the Spigot contract. It must be able to trade revenue tokens captured by the Spigot to credit tokens owed to Lenders using 0x protocol.
LineOfCredit.sol is the core contract responsible for:
Inherited by SecuredLine.sol
Recording credit lines, positions and accounting for Borrowers and Lenders
Defining Line of Credit terms (Oracle, Arbiter, Borrower, term length, interest rate, escrow and spigot collateral)
Coordinating the Escrow, Spigot, and InterestRateCredit modules
External calls to Oracle.sol and InterestRateCredit.sol
Libraries - LineLib.sol, CreditLib.sol, CreditListLib.sol
An integration between Spigot.sol and LineOfCredit.sol.
Inherited by SecuredLine.sol
It owns the Spigot so it's important that it can properly manage and call Spigot.sol and doesn't lose ownership of it unless releaseSpigot()
successfully executes.
Manages a Spigot's configuration based on the health status of a Line of Credit
Trades a DAO's Revenue Tokens for Credit Tokens owed to lenders using 0x protocol
Stores excess revenue or trade slippage in 'unused' tokens for later use in repayment
Allows Borrowers to clawback escrowed tokens if a Line of Credit is fully repaid
Allows liquidating 'unused' tokens or the Spigot itself if a Line of Credit's status is LIQUIDATABLE
External calls to - 0x protocol, Spigot.sol
Libraries - LineLib.sol, SpigotedLineLib.sol
EscrowedLine.sol is an abstract contract holding all the collateral of a Borrower.
Inherited by SecuredLine.sol
It doesn't contain any external functions.
Allows an Arbiter to liquidate collateral if the Line of Credit's status is LIQUIDATABLE
Updates a Line of Credit's status based on the latest collateral ratio vs minimum collateral ratio (in Escrow.sol)
External calls to - Escrow.sol
Libraries - LineLib.sol
Combines the logic of LineofCredit.sol, EscrowedLine.sol, and SpigotedLine.sol to create a fully secured lending solution.
Allows transferring all collateral to a new Line of Credit contract
External calls to - Oracle.sol, InterestRateCredit.sol, EscrowedLine.sol, Spigot.sol, 0x protocol
Libraries - LineLib.sol, SpigotedLineLib.sol
Allows a Borrower to deposit tokens as collateral for a Line of Credit
Allows a Borrower to withdraw collateral so long as that actions does't cause the status of a Line of Credit to be LIQUIDATABLE
Allows Arbiter to whitelist (enable) specific collateral allowed for a Line of Credit
Allows Arbiter to liquidate collateral if the status is LIQUIDATABLE
External calls to - Oracle.sol, LineOfCredit.sol
Libraries - LineLib.sol, CreditLib.sol, EscrowLib.sol
Takes full ownership of a DAO or a protocol's contracts to escrow revenue earned by them
Allows the Spigot Owner to pull escrowed funds at anytime
Allows arbitrary payment splits between Spigot Owner and the Spigot Treasury (a contract of the DAO/protocol
Allows updating stakeholder addresses
External calls to arbitrary contract with arbitrary calls
Libraries - SpigotLib.sol, LineLib.sol
A wrapper contract to simplify integration with Chainlink FeedRegistry
Returns all token prices in USD 8-decimal denomination
External calls to - Chainlink FeedRegistry
Libraries - Chainlink Denominations