The Market contract is the entry point for all lending and borrowing for one base asset.
For now, we will just create it and add more functionality to it later.
In order to store the balances, the market contract will create 2 sub-contracts, both instances of lendex-token with 0 balance and a 1.0 multiplier, referring to itself as the controller. It must store both addresses after creation. One will be called the L-Token, the other the B-Token. These labels will be important later in determining it's interaction with the two.
#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone, PartialEq)]
pub struct InstantiateMsg {
/// we use to create the sub-tokens (`Lent ${name}` and `Borrowed ${name}`)
pub name: String,
/// we use to create the sub-tokens (`L${symbol}` and `B${symbol}`)
pub symbol: String,
/// set for both sub-tokens
pub decimals: u8,
/// codeId used to create them
pub token_id: u64,
/// native denom for the base asset (only native assets for now)
pub base_asset: String,
}
This should create both sub-contracts and store their addresses. In the first version, we don't have any execution commands, but have one basic query:
pub struct QueryMsg {
MarketConfig {}
}
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
pub struct MarketConfigResponse {
pub base_asset: String,
/// the two token addresses created on initialization
pub l_token: String,
pub b_token: String,
}
The Market contract is the entry point for all lending and borrowing for one base asset. For now, we will just create it and add more functionality to it later.
In order to store the balances, the market contract will create 2 sub-contracts, both instances of lendex-token with 0 balance and a 1.0 multiplier, referring to itself as the controller. It must store both addresses after creation. One will be called the L-Token, the other the B-Token. These labels will be important later in determining it's interaction with the two.
This should create both sub-contracts and store their addresses. In the first version, we don't have any execution commands, but have one basic query: