Appearance
Smart Contract
The Rhadow vault is an ERC-4626 tokenized vault implemented in Cairo.
Contract Address
0x05693c7efe1a28d808f388907467cc3edcaeb01749a718d72e0da7c21a4070c3Key Functions
User Functions (ERC-4626)
| Function | Description |
|---|---|
deposit(assets, receiver) | Deposit USDC, receive rUSDC shares |
withdraw(assets, receiver, owner) | Withdraw USDC by burning shares |
redeem(shares, receiver, owner) | Redeem shares for USDC |
View Functions
| Function | Description |
|---|---|
total_assets() | Total vault value in USDC |
convert_to_shares(assets) | Preview shares for deposit |
convert_to_assets(shares) | Preview USDC for redemption |
get_available_liquidity() | Liquid USDC in vault |
Keeper Functions
| Function | Description |
|---|---|
allocate_margin(amount) | Move USDC to trading account |
deallocate_margin(amount) | Return USDC from trading |
swap_usdc_to_wbtc(amount, min_out, routes) | Buy wBTC via AVNU |
swap_wbtc_to_usdc(amount, min_out, routes) | Sell wBTC via AVNU |
report(profit, loss) | Report PnL, update share price |
set_btc_price(price) | Update BTC price oracle |
Admin Functions
| Function | Description |
|---|---|
set_trading_account(address) | Set keeper account |
set_risk_parameters(params) | Update risk limits |
pause() / unpause() | Emergency controls |
upgrade(new_class_hash) | Upgrade implementation |
Total Assets Calculation
cairo
fn total_assets() -> u256 {
vault_usdc_balance
+ allocated_margin
+ (wbtc_balance * btc_price / 10^8)
}Events
| Event | Description |
|---|---|
Deposit | User deposited USDC |
Withdraw | User withdrew USDC |
Report | Keeper reported profit/loss |
MarginAllocated | USDC sent to Extended |
MarginDeallocated | USDC returned from Extended |
Dependencies
Built with OpenZeppelin Cairo Contracts:
ERC20ComponentAccessControlComponentPausableComponentReentrancyGuardComponentUpgradeableComponent
