Skip to main content

VaultTransferHandler

VaultTransferHandler

Addresses

ChainAddress
Arbitrum Sepolia0x0f1E7182946a6fcd7Df42BcE5dC450AEaD341D3C
Base Sepolia0xB813Aad98740bE471bB1a0B524cD9198deF58d13
Base Mainnet0xE6Bf6a30D18E1D5710ed63d2F5e98A71e135A51e

Functions

initialize

function initialize(struct StorageInstance app_) external

transfer

function transfer(address from, address to, uint256 value) external
Dev note

Moves a value amount of tokens from from to to.

This internal function is equivalent to {transfer}, and can be used to e.g. implement automatic token fees, slashing mechanisms, etc.

Emits a {Transfer} event.

NOTE: This function is not virtual, {_update} should be overridden instead.

update

function update(address from, address to, uint256 value) external

beforeTokenTransfer

function beforeTokenTransfer(address from, address to, uint256) public

afterTokenTransfer

Prevent gamesmanship by applying cooldown periods after unexecuted requests. After an expired request, the next one is given a cooldown period. But it would be easy to work around that by transfering shares to a fresh account to make a request with no penalty

So,

  • Prevent transfering tokens "reserved" by an ongoing request
  • If next request will receive a penalty, revert until best-case penalty would have finished
function afterTokenTransfer(address from, address to, uint256 amount) public

deposit

Deposit amount collateral to user, calling ERC-2612 permit() using the attached signature and deadline. See EIP-4626.

function deposit(
uint256 amount,
address user,
uint256 deadline,
struct IVaultDomain.Signature signature,
Shares minShares
) public returns (
Shares shares
)

Parameters

NameTypeDescription
amountuint256Collateral to deposit from msg.sender
useraddressAddress credited with the deposit
deadlineuint256deadline for permit
signaturestruct IVaultDomain.Signaturepermit entitling DomFiVault to amount collateral
minSharesSharesSlippage control. Ignored if zero. If nonzero, revert if a deposit yields less than minShares

Return Values

NameTypeDescription
sharesSharesdfUSDC amount sent to user in exchange for this collateral