osmosis-labs / isotonic

Smart Contracts for the Lendex Protocol
MIT License
1 stars 0 forks source link

Mint/Burn L Tokens #6

Closed ethanfrey closed 2 years ago

ethanfrey commented 2 years ago

Add two more messages to the Market contract to "deposit" and "withdraw" L tokens.

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
    /// X base_asset must be sent along with this message. If it matches, X l_token is minted of the sender address.
    /// The underlying base_asset is stored in this Market contract
    Deposit { },
    /// This requests to burn amount L Tokens and receive that in base_asset.
    /// In the future we will do a check if this is allowed, for now, you can always allow, assuming enough L Token balance
    /// Dispatches two messages, one to burn amount Token from this, and the other to send amount base asset to the sender.
    Withdraw { amount: Uint128 },
}

There should be a placeholder function can_withdraw(sender: &Addr, amount: Uint128) that always returns true now. This will later check if all the collateral is needed to cover other debts.