FundLockUser.sol

View Source: contracts/fund-lock/FundLockUser.sol

↗ Extends: FundLockBase, IFundLockUser

FundLockUser

FundLock contract responsible for all user related token operations like deposits, withdrawals and funds release to a wallet.

Contract Members

Constants & Variables

bytes32 private constant UTILITY_ACCOUNT_ROLE_NAME;

Functions

  • deposit(address tokenAddress, uint256 value)

  • withdraw(address tokenAddress, uint256 value)

  • release(address tokenAddress, uint256 withdrawTimestamp)

deposit

User facing function for depositing funds to be used in Elektro. value deposited will go to the client's {balanceSheetS}.

function deposit(address tokenAddress, uint256 value) external payable onlyRouterAccess 
returns(bool)

Arguments

NameTypeDescription

tokenAddress

address

- address of the token to be deposited

value

uint256

- amount of the token to be deposited

withdraw

Marking funds that need to be withdrawn by the depositor. This function does NOT do any transfers. It only marks funds by creating Funds structs and mapping them to user and token addresses. Also changes {balanceSheetS} and emits event. Created for security purposes.

function withdraw(address tokenAddress, uint256 value) external nonpayable onlyRouterAccess 
returns(bool)

Arguments

NameTypeDescription

tokenAddress

address

address of the token to be marked for withdrawal

value

uint256

amount of the token to be marked for withdrawal

release

Actual withdrawal through releasing funds and making transfer to the client who called the function. In order to be released, funds first have to be marked as {fundsToWithdrawS} by the {withdraw()} function and time interval set as {releaseLock} has to pass since withdraw() was called. Uses different transfer logic depending on which token is used (ETH/WETH/ERC20).

function release(address tokenAddress, uint256 withdrawTimestamp) external nonpayable onlyRouterAccess 
returns(bool)

Arguments

NameTypeDescription

tokenAddress

address

- address of the token to be released

withdrawTimestamp

uint256

- timestamp associated with a certain withdraw request (can be found in {Funds} struct included in the {fundsToWithdrawS} mapping).

Last updated