Skip to content

Commit

Permalink
Remove maToken (#76)
Browse files Browse the repository at this point in the history
* remove matoken from outposts package

* remove matoken from testing package

* remove cw20-related helper function and dependencies

* delete matoken contract

* update entry points

* update workspace members

* update query functions

* update the function for compiling user positions map

* remove a cw20-related helper function

* update init and setting config execute functions

* update init and updating market execute functions

* add `User` helper class

* update an interest rate function to use `User`

* implement helper methods for `Market` for updating collateral/debt amounts

* update deposit and withdraw functions

* remove finalize matoken transfer function

* update borrow function

* update liquidate function

* update update asset collateral status function

* remove unused imports, helper functions, storage variables

* remove unused variables

* fix ownership errors and other issues

* remove cw20 from red bank dependencies

* fix clippy warnings

* update admin tests

* return collateral amount in queries

* return uncollateralized status in debt response

* update query tests

* update deposit tests

* update misc tests and fix bug

* update withdraw tests

* revert the changes to the order of event attributes

* update borrow/repay tests and fix a bug

* shorten a variable name to improve formatting

* update liquidation tests

* disable incentives contract from workspace for now so that CI passes

* fix clippy warnings\

* update changelog

* remove two TODO messages

* remove an unused helper function

* remove two TODO items that are no longer relevant

* rename `{mint,burn}_amount` to `{deposit,withdraw}_amount_scaled`

* remove mentions of "matoken" in comments and readmes

* improve docs

* fix a typo

* fix a import

* fix tests

* update event attributes
  • Loading branch information
larry0x authored Sep 17, 2022
1 parent e6c272d commit ffff685
Show file tree
Hide file tree
Showing 42 changed files with 1,769 additions and 4,458 deletions.
94 changes: 94 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,100 @@ All notable changes to this project will be documented in this file.

This section documents the API changes compared to the Terra Classic deployment, found in the [`mars-core`](https://github.com/mars-protocol/mars-core) repository. This section is **not comprehensive**, as the changes are numerous. Changelog for later version start here should be made comprehensive.

- ([#76](https://github.com/mars-protocol/outposts/pull/76/files)) Red Bank: Execute messages for creating and updating markets have been simplified:

```diff
enum ExecuteMsg {
InitAsset {
denom: String,
- asset_params: InitOrUpdateAssetParams,
- asset_symbol: Option<String>,
+ params: InitOrUpdateAssetParams,
},
UpdateAsset {
denom: String,
- asset_params: InitOrUpdateAssetParams,
+ params: InitOrUpdateAssetParams,
},
}
```

- ([#76](https://github.com/mars-protocol/outposts/pull/76/files)) Red Bank: `underlying_liquidity_amount` query now takes the asset's denom instead of the maToken contract address:

```diff
enum QueryMsg {
UnderlyingLiquidityAmount {
- ma_token_address: String,
+ denom: String,
amount_scaled: Uint128,
},
}
```

- ([#76](https://github.com/mars-protocol/outposts/pull/76/files)) Red Bank: `market` query now no longer returns the maToken address. Additionally, it now returns the total scaled amount of collateral. The frontend should now query this method instead of the maToken's total supply:

```diff
struct Market {
pub denom: String,
- pub ma_token_address: Addr,
pub max_loan_to_value: Decimal,
pub liquidation_threshold: Decimal,
pub liquidation_bonus: Decimal,
pub reserve_factor: Decimal,
pub interest_rate_model: InterestRateModel,
pub borrow_index: Decimal,
pub liquidity_index: Decimal,
pub borrow_rate: Decimal,
pub liquidity_rate: Decimal,
pub indexes_last_updated: u64,
+ pub collateral_total_scaled: Uint128,
pub debt_total_scaled: Uint128,
pub deposit_enabled: bool,
pub borrow_enabled: bool,
pub deposit_cap: Uint128,
}
```

- ([#76](https://github.com/mars-protocol/outposts/pull/76/files)) Red Bank: `user_collateral` query now returns the collateral scaled amount and amount. The frontend should now query this method instead of the maToken contracts:

```diff
struct UserCollateralResponse {
pub denom: String,
+ pub amount_scaled: Uint128,
+ pub amount: Uint128,
pub enabled: bool,
}
```

- ([#76](https://github.com/mars-protocol/outposts/pull/76/files)) Red Bank: `user_debt` query now returns whether the debt is being borrowed as uncollateralized loan:

```diff
struct UserDebtResponse {
pub denom: String,
pub amount_scaled: Uint128,
pub amount: Uint128,
+ pub uncollateralized: bool,
}
```

- ([#76](https://github.com/mars-protocol/outposts/pull/76/files)) Red Bank: Parameters related to maToken have been removed from instantiate message, the `update_config` execute message, and the response type for config query:

```diff
struct CreateOrUpdateConfig {
pub owner: Option<String>,
pub address_provider: Option<String>,
- pub ma_token_code_id: Option<u64>,
pub close_factor: Option<Decimal>,
}

struct Config {
pub owner: Addr,
pub address_provider: Addr,
- pub ma_token_code_id: u64,
pub close_factor: Decimal,
}
```

- ([#69](https://github.com/mars-protocol/outposts/pull/69/files)) Red Bank: `Market` no longer includes an index:

```diff
Expand Down
58 changes: 0 additions & 58 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[workspace]
members = [
"contracts/address-provider",
"contracts/incentives",
"contracts/ma-token",
# "contracts/incentives",
"contracts/oracle/*",
"contracts/red-bank",
"contracts/rewards-collector/*",
Expand Down
3 changes: 2 additions & 1 deletion contracts/incentives/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Incentives
Manage MARS incentives for maToken holders (depositors).

Manage MARS incentives for depositors.
34 changes: 0 additions & 34 deletions contracts/ma-token/Cargo.toml

This file was deleted.

6 changes: 0 additions & 6 deletions contracts/ma-token/README.md

This file was deleted.

Loading

0 comments on commit ffff685

Please sign in to comment.