Technical Overview Self-Insured Vault (SIV) Contract
Source Code Self-Insured Vault - SIV
The Self Insured Vault (SIV) is a core contract of our system. When users deposit yield-bearing assets, they mint shares in the SIV while simultaneously transferring their assets to the specified YieldSource contract, which is the beneficiary of the yield generated by these assets.
During the deposit process into the subsequent epoch, the yield is harvested within the YieldSource contract and is then converted into the deposit asset of the Insurance provider.
Setup:
constructor args
address _paymentToken | depositAsset of earthquake market, note: all added markets must have the same depositAsset |
address _yieldSource | prev deployed YieldSource contract that follows |
address _emissionsToken |
|
Role Assignment: YieldSource should assign SIV
as owner
.
Market Configuration:
The addMarket
function lets the owner
add new markets with weights. This directly influences how the SIV distributes the purchase amounts to various earthquake markets.
address _provider | Address of Earthquake Insurance provider. V1, V2 and Carousel markets have different providers. |
uint256 _marketId | MarketId of Earthquake market |
uint256 _premiumWeight | needs to be in ratio all weights (totalWeight) |
uint256 _collateralWeight | needs to be in ratio all weights (totalWeight) |
*totalWeight = sum of all market weights (premium and collateral
Deposit Functionality:
The deposit
function allows a user to deposit a yield-bearing asset into the SIV, which results in the minting of new shares for the user. The asset is then transferred to the YieldSource contract.
uint256 amount | amount of yield-bearing asset defined on YieldSource contract |
address receiver | receiver of shares minted |
Insurance Purchase:
The purchaseInsuranceForNextEpoch
function can be called by the owner
and is responsible for checking if there is an open deposit window, claiming yields from the Yield Source and finally initiating the insurance purchase process for all configured markets.
Withdrawal Functionality:
The withdraw
function lets a user withdraw their deposited sourceToken
. It calculates the shares to be withdrawn based on the current total deposit and the user's share.
Claim Payouts:
The claimPayouts
function lets a user claim their pending earthquake yield.
Claim Emission:
The claimEmissions
function lets a user claim their pending earthquake emissions.
These functions serve as the backbone of the SIV contract and enable it to perform its role within the ecosystem. The ability to configure and purchase insurance epochs, manage market allocations, and handle deposits and withdrawals are all made possible through these functions.
Last updated