# Asset

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

| **name**          | **type** | **description** |
| ----------------- | -------- | --------------- |
| underlyingToken\_ | address  |                 |
| name\_            | string   |                 |
| symbol\_          | string   |                 |

### *event* Approval

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

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| owner    | address  | indexed         |
| spender  | address  | indexed         |
| value    | uint256  | not indexed     |

### *event* OwnershipTransferred

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

Arguments

| **name**      | **type** | **description** |
| ------------- | -------- | --------------- |
| previousOwner | address  | indexed         |
| newOwner      | address  | indexed         |

### *event* SetMaxSupply

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

> Notice: An event thats emitted when max supply is updated

Arguments

| **name**          | **type** | **description** |
| ----------------- | -------- | --------------- |
| previousMaxSupply | uint256  | not indexed     |
| newMaxSupply      | uint256  | not indexed     |

### *event* SetPool

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

> Notice: An event thats emitted when pool address is updated

Arguments

| **name**         | **type** | **description** |
| ---------------- | -------- | --------------- |
| previousPoolAddr | address  | not indexed     |
| newPoolAddr      | address  | not indexed     |

### *event* Transfer

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

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| from     | address  | indexed         |
| to       | address  | indexed         |
| value    | uint256  | not indexed     |

### *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

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint120  |                 |

### *stateVariable* liability

***Asset.liability() view***

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

> Details: 18.18 fixed point decimals

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint120  |                 |

### *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

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *function* DOMAIN\_SEPARATOR

***Asset.DOMAIN\_SEPARATOR() view***

> Details: See {IERC20Permit-DOMAIN\_SEPARATOR}.

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | bytes32  |                 |

### *function* addCash

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

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

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| amount   | uint256  | amount to add   |

### *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

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| amount   | uint256  | amount to add   |

### *function* allowance

***Asset.allowance(owner, spender) view***

> Details: See {IERC20-allowance}.

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| owner    | address  |                 |
| spender  | address  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *function* approve

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

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

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| spender  | address  |                 |
| amount   | uint256  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | bool     |                 |

### *function* balanceOf

***Asset.balanceOf(account) view***

> Details: See {IERC20-balanceOf}.

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| account  | address  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *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

| **name** | **type** | **description**            |
| -------- | -------- | -------------------------- |
| to       | address  | address holding the tokens |
| amount   | uint256  | amount to burn             |

### *function* decimals

***Asset.decimals() view***

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

Outputs

| **name** | **type** | **description**    |
| -------- | -------- | ------------------ |
|          | uint8    | decimals for asset |

### *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

| **name**        | **type** | **description** |
| --------------- | -------- | --------------- |
| spender         | address  |                 |
| subtractedValue | uint256  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | bool     |                 |

### *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

| **name**   | **type** | **description** |
| ---------- | -------- | --------------- |
| spender    | address  |                 |
| addedValue | uint256  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | bool     |                 |

### *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

| **name** | **type** | **description**                  |
| -------- | -------- | -------------------------------- |
| to       | address  | address to transfer the token to |
| amount   | uint256  | amount to transfer               |

### *function* name

***Asset.name() view***

> Details: Returns the name of the token.

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | string   |                 |

### *function* nonces

***Asset.nonces(owner) view***

> Details: See {IERC20Permit-nonces}.

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| owner    | address  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *function* owner

***Asset.owner() view***

> Details: Returns the address of the current owner.

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | address  |                 |

### *function* permit

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

> Details: See {IERC20Permit-permit}.

Arguments

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| owner    | address  |                 |
| spender  | address  |                 |
| value    | uint256  |                 |
| deadline | uint256  |                 |
| v        | uint8    |                 |
| r        | bytes32  |                 |
| s        | bytes32  |                 |

### *function* pool

***Asset.pool() view***

> Notice: The Pool

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | address  |                 |

### *function* removeCash

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

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

Arguments

| **name** | **type** | **description**  |
| -------- | -------- | ---------------- |
| amount   | uint256  | amount to remove |

### *function* removeLiability

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

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

Arguments

| **name** | **type** | **description**  |
| -------- | -------- | ---------------- |
| amount   | uint256  | amount to remove |

### *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

| **name**    | **type** | **description**            |
| ----------- | -------- | -------------------------- |
| maxSupply\_ | uint256  | the new asset's max supply |

### *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

| **name** | **type** | **description**    |
| -------- | -------- | ------------------ |
| pool\_   | address  | new pool's address |

### *function* symbol

***Asset.symbol() view***

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

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | string   |                 |

### *function* totalSupply

***Asset.totalSupply() view***

> Details: See {IERC20-totalSupply}.

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint256  |                 |

### *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

| **name**  | **type** | **description** |
| --------- | -------- | --------------- |
| recipient | address  |                 |
| amount    | uint256  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | bool     |                 |

### *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

| **name**  | **type** | **description** |
| --------- | -------- | --------------- |
| sender    | address  |                 |
| recipient | address  |                 |
| amount    | uint256  |                 |

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | bool     |                 |

### *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

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
| newOwner | address  |                 |

### *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

| **name** | **type** | **description**                  |
| -------- | -------- | -------------------------------- |
| to       | address  | address to transfer the token to |
| amount   | uint256  | amount to transfer               |

### *function* underlyingToken

***Asset.underlyingToken() view***

> Notice: The underlying underlyingToken represented by this asset

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | address  |                 |

### *function* underlyingTokenBalance

***Asset.underlyingTokenBalance() view***

> Notice: Get underlying Token Balance

Outputs

| **name** | **type** | **description**                                     |
| -------- | -------- | --------------------------------------------------- |
|          | uint256  | Returns the actual balance of ERC20 underlyingToken |

### *function* underlyingTokenDecimals

***Asset.underlyingTokenDecimals() view***

Outputs

| **name** | **type** | **description** |
| -------- | -------- | --------------- |
|          | uint8    |                 |
