Asset

Contract presenting LP tokens in a pool.

contracts/wombat-core/asset/Asset.sol

Title: Asset

Notice: Contract presenting an asset in a pool

Details: Expect to be owned by Timelock for management, and pool links to Pool for coordination

constructor

constructor(underlyingToken_, name_, symbol_)

Arguments

event Approval

***Asset.Approval(owner, spender, value) ***

Arguments

event OwnershipTransferred

***Asset.OwnershipTransferred(previousOwner, newOwner) ***

Arguments

event SetMaxSupply

***Asset.SetMaxSupply(previousMaxSupply, newMaxSupply) ***

Notice: An event thats emitted when max supply is updated

Arguments

event SetPool

***Asset.SetPool(previousPoolAddr, newPoolAddr) ***

Notice: An event thats emitted when pool address is updated

Arguments

event Transfer

***Asset.Transfer(from, to, value) ***

Arguments

stateVariable cash

Asset.cash() view

Notice: Cash balance, normally it should align with IERC20(underlyingToken).balanceOf(address(this))

Details: 18.18 fixed point decimals

Outputs

stateVariable liability

Asset.liability() view

Notice: Total liability, equals to the sum of deposit and dividend

Details: 18.18 fixed point decimals

Outputs

stateVariable maxSupply

Asset.maxSupply() view

Notice: maxSupply the maximum amount of asset the pool is allowed to mint. The unit is the same as the underlying token

Details: if 0, means asset has no max

Outputs

function DOMAIN_SEPARATOR

Asset.DOMAIN_SEPARATOR() view

Details: See {IERC20Permit-DOMAIN_SEPARATOR}.

Outputs

function addCash

***Asset.addCash(amount) ***

Notice: Adds cash, expects actual ERC20 underlyingToken got transferred in. Can only be called by Pool.

Arguments

function addLiability

***Asset.addLiability(amount) ***

Notice: Adds deposit or dividend, expect LP underlyingToken minted in case of deposit. Can only be called by Pool.

Arguments

function allowance

Asset.allowance(owner, spender) view

Details: See {IERC20-allowance}.

Arguments

Outputs

function approve

***Asset.approve(spender, amount) ***

Details: See {IERC20-approve}. Requirements: - spender cannot be the zero address.

Arguments

Outputs

function balanceOf

Asset.balanceOf(account) view

Details: See {IERC20-balanceOf}.

Arguments

Outputs

function burn

***Asset.burn(to, amount) ***

Notice: Burn ERC20 Asset LP Token, expect pool coordinates other state updates. Can only be called by Pool.

Arguments

function decimals

Asset.decimals() view

Notice: Returns the decimals of Asset, fixed to 18 decimals

Outputs

function decreaseAllowance

***Asset.decreaseAllowance(spender, subtractedValue) ***

Details: Atomically decreases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address. - spender must have allowance for the caller of at least subtractedValue.

Arguments

Outputs

function increaseAllowance

***Asset.increaseAllowance(spender, addedValue) ***

Details: Atomically increases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address.

Arguments

Outputs

function mint

***Asset.mint(to, amount) ***

Notice: Mint ERC20 Asset LP Token, expect pool coordinates other state updates. Can only be called by Pool.

Arguments

function name

Asset.name() view

Details: Returns the name of the token.

Outputs

function nonces

Asset.nonces(owner) view

Details: See {IERC20Permit-nonces}.

Arguments

Outputs

function owner

Asset.owner() view

Details: Returns the address of the current owner.

Outputs

function permit

***Asset.permit(owner, spender, value, deadline, v, r, s) ***

Details: See {IERC20Permit-permit}.

Arguments

function pool

Asset.pool() view

Notice: The Pool

Outputs

function removeCash

***Asset.removeCash(amount) ***

Notice: Deducts cash, expect actual ERC20 got transferred out (by transferUnderlyingToken()). Can only be called by Pool.

Arguments

function removeLiability

***Asset.removeLiability(amount) ***

Notice: Removes deposit and dividend earned, expect LP underlyingToken burnt. Can only be called by Pool.

Arguments

function renounceOwnership

***Asset.renounceOwnership() ***

Details: Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

function setMaxSupply

***Asset.setMaxSupply(maxSupply_) ***

Notice: Changes asset max supply. Can only be set by the contract owner. 18 decimals

Arguments

function setPool

***Asset.setPool(pool_) ***

Notice: TODO: move pool address setup within contract initializationChanges the pool. Can only be set by the contract owner.

Arguments

function symbol

Asset.symbol() view

Details: Returns the symbol of the token, usually a shorter version of the name.

Outputs

function totalSupply

Asset.totalSupply() view

Details: See {IERC20-totalSupply}.

Outputs

function transfer

***Asset.transfer(recipient, amount) ***

Details: See {IERC20-transfer}. Requirements: - recipient cannot be the zero address. - the caller must have a balance of at least amount.

Arguments

Outputs

function transferFrom

***Asset.transferFrom(sender, recipient, amount) ***

Details: See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. Requirements: - sender and recipient cannot be the zero address. - sender must have a balance of at least amount. - the caller must have allowance for sender's tokens of at least amount.

Arguments

Outputs

function transferOwnership

***Asset.transferOwnership(newOwner) ***

Details: Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Arguments

function transferUnderlyingToken

***Asset.transferUnderlyingToken(to, amount) ***

Notice: Transfers ERC20 underlyingToken from this contract to another account. Can only be called by Pool.

Details: Not to be confused with transferring Wombat Assets.

Arguments

function underlyingToken

Asset.underlyingToken() view

Notice: The underlying underlyingToken represented by this asset

Outputs

function underlyingTokenBalance

Asset.underlyingTokenBalance() view

Notice: Get underlying Token Balance

Outputs

function underlyingTokenDecimals

Asset.underlyingTokenDecimals() view

Outputs

Last updated