Here's the code. Enjoy it.
For other bits and pieces:
https://tinyurl.com/wildcat-whitepaper
License: Other
Here's the code. Enjoy it.
For other bits and pieces:
https://tinyurl.com/wildcat-whitepaper
Fixed by 9f44603
Current thinking is to set it to max( 2 * (newRate - oldRate)/oldRate, currentReserve )
.
This means that a reduction in APR from 10% to 7% (a 30% change) would produce a temporary reserve ratio of 60%. If the existing reserve ratio is higher than 60%, it would keep that rate as is.
The relative difference change is capped out at 100% - i.e. reducing the APR by 60% doesn't produce a 120% reserve.
Designed to force liquidity back into the market for a ragequit option, but without completely crippling the borrowers ability to utilise the market for those two weeks.
Demo commit here: 1a5e4bc
Fixed by 2259d2a
Only call controller isAuthorizedLender
if account has null status.
Replace grant/revoke functions with single update function.
Add ability to remove Blocked
role from an account once sanctioned status is lifted.
WildcatMarketConfig
Modify sentinel to allow borrower to override an account's sanctioned status so that accounts can't immediately be blocked after escrowed assets are released.
SafeTransferLib is used everywhere else, update this to use that as well.
This doesn't actually impact anything, but just makes more 'sense'
Fixed by b68c108
Update wd tests to check withdrawal batch data after calls
Fixed by dea6ce9
My thinking here is that if the lenders notice that borrower is sanctioned, they're going to want to withdraw quick - someone who's sanctioned might not give a damn because they're clearly already in trouble and just borrow right up to the reserve limit if there's anything still available.
Say a market is at 50% reserves on a 20% minimum reserve ratio vault, then borrower is sanctioned - this could be the difference between an 80% and 50% haircut in the scenario where borrower goes 'well, better take all I can!'.
The way this is overridden is just that they get unsanctioned (we obviously shouldn't allow borrowers to override their own sanction) - they can still deposit assets either directly or via repay
, which is bad in terms of strict liability but we can't prevent it, and a sanctioned borrower can still close a market, so even though that's a real mess the functionality is still all there.
Fixed by 299833d
Fixed by 016f6f2
Add events for excess reserve ratio activation/expiry
Rearrange arguments in MarketDeployed
to match subgraph.
Fix missing/erroneous members of interface
See code-423n4/2023-10-wildcat-findings#499.
Fixed by e93bcd9.
Ref: code-423n4/2023-10-wildcat-findings#365
Currently there is no way for borrowers to avoid interest accrual on pending batches with sufficient available liquidity, absent a call to queueWithdrawal.
Fix: apply payments to pending batches in _getUpdatedState.
This will also require a change to _calculateCurrentState which returns the expired batch data if one exists so that queries for withdrawal batches can retrieve the correct pending status of that batch. This should be modified to return the pending batch if one exists but has not expired.
Fixed by 371891a
Fixed by 3261f45
Use mcopy for returndata structs
Use tstore/tload for reentrancy locks
These should have additional data to reduce the complexity of indexing the protocol off-chain.
Replace ScaleFactorUpdated
with:
event InterestAndFeesAccrued(
uint256 fromTimestamp,
uint256 toTimestamp,
uint256 scaleFactor,
uint256 baseInterestRay,
uint256 delinquencyFeeRay,
uint256 protocolFees
);
Replace MarketDeployed
with:
event MarketDeployed(
address indexed market,
address asset,
uint256 maxTotalSupply,
uint256 annualInterestBips,
uint256 delinquencyFeeBips,
uint256 withdrawalBatchDuration,
uint256 reserveRatioBips,
uint256 delinquencyGracePeriod,
string name,
string symbol
);
Additionally, WildcatMarketController
does not actually emit the MarketDeployed
event, so fix that.
Fixed by 3b33a2f
totalDebts
outstandingDebt
delinquentDebt
The problem with this is that it means that the scale factor will still inflate according to the delinquencyFee
for as long as it's in excess of the grace period - the result is that the last person who attempts to redeem their market tokens when exiting won't be able to access enough reserves.
The check on the unpaidBatches.length() > 0
isn't actually checking for delinquency (which is state.timeDelinquent > delinquencyGracePeriod) it's just checking whether or not there's anything that still needs assigning assets to.
delinquencyFee
is an immutable value, so it's cleaner to just zero the tracker.
Fixed by 292ebda
wildcat-protocol/src/market/WildcatMarketBase.sol
Lines 538 to 539 in c28b889
wildcat-protocol/src/market/WildcatMarketBase.sol
Lines 562 to 563 in c28b889
Add the original interest rate to the TemporaryReserveRatio
struct.
When setting the interest rate, modify the code so that:
Interface is outdated and factory does not emit events for controller deployment or protocol fee configuration updates.
Index expiry
in all withdrawal events.
Index account
in SanctionedAccountAssetsSentToEscrow
and SanctionedAccountWithdrawalSentToEscrow
Add normalizedAmount
to WithdrawalQueued
Fixed by 2b8a3e0
ref:
Maximum fixed by 6cd7317
Change the timestamp check from
if (expiry > block.timestamp) {
revert WithdrawalBatchNotExpired();
}
```
to
```solidity
if (expiry >= block.timestamp) {
revert WithdrawalBatchNotExpired();
}
```
Add isClosed
to VaultState.
Add revert check to deposit function, add tests.
wildcat-protocol/src/libraries/MathUtils.sol
Line 168 in ce7d832
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.