Skip to main content

Overview

MakxYieldVault is an ERC-20 contract that holds ETH and lends it to MakxYieldPad. Depositors receive METH shares. YieldPad borrows ETH for token launches and pays interest back. Interest raises the share price, benefiting all depositors proportionally. All interest accrual logic is owned by YieldPad — the vault simply receives ETH via repay() and depositInterest().

State

VariableTypeDescription
yieldPadaddressAddress of the authorized MakxYieldPad
totalBondedETHuint256ETH currently lent out (accounting marker, not physical balance)
withdrawalCooldownuint24Seconds between withdrawal request and redemption
feeBpsuint256Protocol fee in BPS on deposit and redeem (max 1000)
withdrawalRequestsmapping(address => WithdrawalRequest)Pending withdrawal requests
struct WithdrawalRequest {
    uint256 shares;
    uint48 requestedAt;
}

Depositor functions

deposit()

function deposit() external payable returns (uint256 shares)
Deposit ETH, receive METH shares. Calls collectInterest() on YieldPad first. Deducts feeBps if non-zero.

requestWithdrawal(uint256 shares)

function requestWithdrawal(uint256 shares) external
Starts the withdrawal cooldown. One active request per address.

cancelWithdrawal()

function cancelWithdrawal() external
Cancels a pending withdrawal request.

redeem()

function redeem() external nonReentrant returns (uint256 ethOut)
After cooldown: burns shares, sends ETH. Capped at idle vault balance — partial redemption possible. Deducts feeBps from output.

Lending interface (YieldPad only)

borrow(uint256 amount)

function borrow(uint256 amount) external onlyYieldPad
Lends ETH to YieldPad. Increments totalBondedETH. Reverts if amount > address(this).balance.

repay()

function repay() external payable onlyYieldPad
Receives ETH back from YieldPad (bond repayment or interest). Decrements totalBondedETH by msg.value.

View functions

totalAssets()

function totalAssets() public view returns (uint256)
Returns address(this).balance + totalBondedETH. This is the full ETH value backing all METH shares.

sharePrice()

function sharePrice() external view returns (uint256)
Returns ETH per METH share, scaled by 1e18. Returns 1e18 if supply is zero.

Owner functions

configure(address _yieldPad, uint24 _withdrawalCooldown)

Sets the authorized YieldPad address and withdrawal cooldown.

setFeeBps(uint256 _feeBps)

Sets the protocol fee on deposit/redeem. Capped at 1000 (10%).

Events

EventEmitted when
Deposited(user, ethAmount, shares)ETH deposited
WithdrawalRequested(user, shares, requestedAt)Withdrawal request started
WithdrawalCancelled(user)Request cancelled
Redeemed(user, shares, ethOut)Shares redeemed for ETH
Borrowed(amount)ETH lent to YieldPad
Repaid(amount)ETH returned from YieldPad
FeeBpsUpdated(feeBps)Protocol fee updated

Errors

ErrorCondition
ZeroAmountZero ETH deposit or zero shares
InsufficientSharesCaller has fewer shares than requested
InsufficientAvailableETHVault idle balance too low to lend
NoWithdrawalPendingNo active request to redeem or cancel
CooldownNotElapsedCooldown period not yet passed
NotYieldPadCaller is not the authorized YieldPad
TransferFailedETH transfer reverted
FeeTooHighfeeBps > 1000