✔️How to create a bank

You can create a new custom Bank using the BankFactory contract. This process involves calling the createBank function and specifying various parameters to configure the initial settings of the Bank.

Function Signature

function createBank(
    IERC20 asset,
    string memory name,
    string memory symbol,
    uint256 initialFee,
    address initialFeeRecipient,
    uint256 minDelay,
    IBank.BankType bankType
) external returns (Bank)

Parameters

Parameter
Type
Description

asset

IERC20

The address of the base asset (token) to be used in the Bank

name

string

The name of the Bank

symbol

string

The symbol of the Bank

initialFee

uint256

Initial fee setting (max 1000, which represents 10%)

initialFeeRecipient

address

The initial address to receive fees

minDelay

uint256

Minimum delay for timelock operations (in seconds)

bankType

IBank.BankType

Type of the Bank (Public or Private)

Returns

  • Bank: The address of the newly created Bank contract

Usage Example (using ethers.js)

Important Notes

  • initialFee should be a value between 0 and 1000 (0% - 10%).

  • minDelay should be set carefully. Too short may pose security risks, while too long may cause operational inconvenience. (minimum: 600 seconds)

  • If creating a Private Bank (type: 1), subsequent whitelist management will be necessary.

  • After creating the Bank, you need to add the required Markets and set allocations.

Event

A BankCreated event is emitted when a Bank is created:

You can monitor this event to track the creation of new Banks.

After creating a Bank, you can use its address to perform additional setup and management operations.

Last updated