BVault

Write Methods

depositERC20

function depositERC20(uint32 poolId, address asset, uint256 amount, address onBehalf)

Deposits an amount of underlying asset into the pool.

Parameter Name
Type
Description

poolId

uint32

The id of the pool

asset

address

The address of the underlying asset to deposit

amount

uint256

The underlying amount to be deposited, expressed in underlying asset decimals units

onBehalfOf

address

address whom will record the balance. Use msg.sender when the balance should be record to the caller.

withdrawERC20

function withdrawERC20(uint32 poolId, address asset, uint256 amount, address onBehalf, address receiver)

Withdraw an amount of underlying asset from the pool.

Parameter Name
Type
Description

poolId

uint32

The id of the pool

asset

address

The address of the underlying asset to deposit

amount

uint256

The underlying amount to be deposited, expressed in underlying asset decimals units

onBehalfOf

address

Address whom will record the balance. Use msg.sender when the balance should be record to the caller.

receiver

address

Address whom will receive the underlying asset

depositERC721

function depositERC721(uint32 poolId, address asset, uint256[] calldata tokenIds, uint8 supplyMode, address onBehalf)

Deposits some token items of underlying asset into the pool.

Parameter Name
Type
Description

poolId

uint32

The id of the pool

asset

address

The address of the underlying asset to deposit

tokenIds

uint256[]

The token item list to be deposited

supplyMode

uint8

Supply mode, 1-Cross Margin; 2-Isolated Margin

onBehalfOf

address

Address whom will record the balance. Use msg.sender when the balance should be record to the caller.

withdrawERC721

function withdrawERC721(uint32 poolId, address asset, uint256[] calldata tokenIds, , uint8 supplyMode, address onBehalf, address receiver)

Withdraw some token items of underlying asset from the pool.

Parameter Name
Type
Description

poolId

uint32

The id of the pool

asset

address

The address of the underlying asset to deposit

tokenIds

uint256[]

The token item list to be deposited

supplyMode

uint8

Supply mode, 1-Cross Margin; 2-Isolated Margin

onBehalfOf

address

address whom will record the balance. Use msg.sender when the balance should be record to the caller.

receiver

address

Address whom will receive the underlying asset

setERC721SupplyMode

function setERC721SupplyMode( uint32 poolId, address asset, uint256[] calldata tokenIds, uint8 supplyMode, address onBehalf )

Changes the supply mode of underlying asset in the pool.

Parameter Name
Type
Description

poolId

uint32

The id of the pool

asset

address

The address of the underlying asset to deposit

tokenIds

uint256[]

The token item list to be deposited

supplyMode

uint8

Supply mode, 1-Cross Margin; 2-Isolated Margin

onBehalfOf

address

address whom will record the balance. Use msg.sender when the balance should be record to the caller.

delegateERC721

function delegateERC721( uint32 poolId, address nftAsset, uint256[] calldata tokenIds, address delegate, bool value )

Delegate the ownership of ERC721 token items to other users. But the ownership checking rules depends on the third-party protocols.

Parameter Name
Type
Description

poolId

uint32

The id of the pool

asset

address

The address of the underlying asset to deposit

tokenId

uint256[]

The token items to be deposited

delegate

address

Address of the delegatee.

value

bool

Ture or False

setAuthorization

function setAuthorization( uint32 poolId, address asset, address operator, bool approved )

Approve an operator onbehalf of user.

Parameter Name
Type
Description

poolId

uint32

The id of the pool

asset

address

The address of the underlying asset to deposit

operator

address

Address whom will be authorised the operation privilege

approved

bool

True for False

Last updated