osmosis-labs / isotonic

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

Add denoms to CreditLineResponse #79

Closed uint closed 2 years ago

uint commented 2 years ago

Closes #73

I'm not sure I feel 100% good about what I've done here yet. I'll review again tomorrow, but feel free to rip this apart.

What was previously CreditLineResponse becomes CreditLineValues and is still used internally to do all the math on it, but I added a CreditLineResponse with denom for use with the API:

pub struct CreditLineResponse {
    /// Total value of L-Tokens in common_token
    pub collateral: Coin,
    /// collateral * collateral_ratio
    pub credit_line: Coin,
    /// Total value of B-Tokens in common_token
    pub debt: Coin,
}

And then some helpers for easy validation and moving between the two types.

Should we consider moving all the credit line stuff into utils?