Contract Interactions
Overview
This provides a V1 overview of how protocols and applications can integrate and interact with Karak's restaking smart contracts.
Terms
Vault: A vault serves as the storage for tokens, with each token having its own dedicated vault deployed.
VaultSupervisor: The VaultSupervisor contract acts as the central hub connecting all vaults, managing all deposit and withdrawal calls for each vault.
DelegationSupervisor: The DelegationSupervisor contract handles withdrawals and soon
Deposit
Deposit function: The deposit function takes in ERC-20 tokens that have been whitelisted.
vault
: Vault you’d like to deposit in
amount
: Amount you’d like to deposit
shares
: The amount of shares allotted to you in the vault
Interface IVault
can be found here
Usage: IVault(address of Vault)
Deposit with Signature (Gasless approval)
The deposit with signature function can be used for tokens that have an ERC-20 Permit implementation.
vault
: Vault you’d like to deposit in
user
: Address of the user who will approve the allowance for ERC-20 tokens
value
: Amount you’d like to deposit
deadline
: The UNIX timestamp till the signature is valid
permit
: The signature for ERC-20 Permit approval
vaultAllowance
: The signature that specifies which vault to deposit and the amount
shares
: The amount of shares allotted to you in the vault
Interface IVault
can be found here
Usage: IVault(address of Vault)
Withdraw
To withdraw tokens in a vault the user needs to call two functions on the DelegationSupervisor
:
First the user needs to call startWithdraw
function
withdrawalRequests
: Array of the WithdrawRequest
struct.
After the withdrawDelay
amount of time, which can be found by calling
You can finish the withdrawal by calling finishWithdraw
on the DelegationSupervisor
startedWithdrawals: Array of the QueuedWithdrawal
struct
Last updated