Skip to content

Commit

Permalink
[Feature] Separate mint and burn swap pool (#467)
Browse files Browse the repository at this point in the history
* sperate mint and burn swap pool

* fix lint

* add market migration script
  • Loading branch information
yys authored Apr 26, 2021
1 parent 4a298bb commit cf3213b
Show file tree
Hide file tree
Showing 48 changed files with 1,585 additions and 535 deletions.
3 changes: 2 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,6 @@ func (app *TerraApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs
/* Handle market state. */

// clear all market pools
app.MarketKeeper.SetTerraPoolDelta(ctx, sdk.ZeroDec())
app.MarketKeeper.SetMintPoolDelta(ctx, sdk.ZeroDec())
app.MarketKeeper.SetBurnPoolDelta(ctx, sdk.ZeroDec())
}
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

236 changes: 163 additions & 73 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5725,11 +5725,31 @@ paths:
example: '50'
'500':
description: Internal Server Error
/market/terra_pool_delta:
/market/mint_pool_delta:
get:
summary: >-
Get Terra pool delta, is usdr amount used for swap operation from the
TerraPool.
Get mint pool delta, is usdr amount used for swap operation from the
MintPool.
tags:
- Market
produces:
- application/json
responses:
'200':
description: OK
schema:
type: number
format: float
example: '10000000.00'
'400':
description: Bad Request
'500':
description: Internal Server Error
/market/burn_pool_delta:
get:
summary: >-
Get burn pool delta, is usdr amount used for swap operation from the
BurnPool.
tags:
- Market
produces:
Expand Down Expand Up @@ -5758,15 +5778,18 @@ paths:
schema:
type: object
properties:
daily_luna_delta_limit:
mint_base_pool:
type: number
example: '0.005'
min_swap_spread:
example: '1000000.0'
burn_base_pool:
type: number
example: '0.02'
max_swap_spread:
example: '1000000.0'
pool_recovery_period:
type: number
example: '0.1'
example: '16000'
min_stability_spread:
type: number
example: '0.02'
'400':
description: Bad Request
'500':
Expand Down Expand Up @@ -25107,6 +25130,92 @@ paths:
$ref: '#/definitions/terra.tx.v1beta1.ComputeTaxRequest'
tags:
- Service
/terra/market/v1beta1/burn_pool_delta:
get:
summary: BurnPoolDelta returns burn_pool_delta amount.
operationId: BurnPoolDelta
responses:
'200':
description: A successful response.
schema:
type: object
properties:
burn_pool_delta:
type: string
format: byte
title: >-
burn_pool_delta defines the gap between the BurnPool and the
BurnBasePool
description: >-
QueryBurnPoolDeltaResponse is the response type for the
Query/BurnPoolDelta RPC method.
default:
description: An unexpected error response
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Query
/terra/market/v1beta1/mint_pool_delta:
get:
summary: MintPoolDelta returns mint_pool_delta amount.
operationId: MintPoolDelta
responses:
'200':
description: A successful response.
schema:
type: object
properties:
mint_pool_delta:
type: string
format: byte
title: >-
mint_pool_delta defines the gap between the MintPool and the
MintBasePool
description: >-
QueryMintPoolDeltaResponse is the response type for the
Query/MintPoolDelta RPC method.
default:
description: An unexpected error response
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Query
/terra/market/v1beta1/params:
get:
summary: Params queries all parameters.
Expand All @@ -25121,7 +25230,10 @@ paths:
description: params defines the parameters of the module.
type: object
properties:
base_pool:
mint_base_pool:
type: string
format: byte
burn_base_pool:
type: string
format: byte
pool_recovery_period:
Expand Down Expand Up @@ -25218,49 +25330,6 @@ paths:
type: string
tags:
- Query
/terra/market/v1beta1/terra_pool_delta:
get:
summary: TerraPoolDelta returns terra_pool_delta amount.
operationId: TerraPoolDelta
responses:
'200':
description: A successful response.
schema:
type: object
properties:
terra_pool_delta:
type: string
format: byte
title: >-
terra_pool_delta defines the gap between the TerraPool and the
BasePool
description: >-
QueryTerraPoolDeltaResponse is the response type for the
Query/TerraPoolDelta RPC method.
default:
description: An unexpected error response
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Query
/terra/oracle/v1beta1/denoms/actives:
get:
summary: Actives returns all active denoms
Expand Down Expand Up @@ -37601,15 +37670,18 @@ definitions:
MarketParams:
type: object
properties:
daily_luna_delta_limit:
mint_base_pool:
type: number
example: '0.005'
min_swap_spread:
example: '1000000.0'
burn_base_pool:
type: number
example: '0.02'
max_swap_spread:
example: '1000000.0'
pool_recovery_period:
type: number
example: '16000'
min_stability_spread:
type: number
example: '0.1'
example: '0.02'
PrevoteReq:
type: object
properties:
Expand Down Expand Up @@ -52911,7 +52983,10 @@ definitions:
terra.market.v1beta1.Params:
type: object
properties:
base_pool:
mint_base_pool:
type: string
format: byte
burn_base_pool:
type: string
format: byte
pool_recovery_period:
Expand All @@ -52921,14 +52996,41 @@ definitions:
type: string
format: byte
description: Params defines the parameters for the market module.
terra.market.v1beta1.QueryBurnPoolDeltaResponse:
type: object
properties:
burn_pool_delta:
type: string
format: byte
title: >-
burn_pool_delta defines the gap between the BurnPool and the
BurnBasePool
description: >-
QueryBurnPoolDeltaResponse is the response type for the
Query/BurnPoolDelta RPC method.
terra.market.v1beta1.QueryMintPoolDeltaResponse:
type: object
properties:
mint_pool_delta:
type: string
format: byte
title: >-
mint_pool_delta defines the gap between the MintPool and the
MintBasePool
description: >-
QueryMintPoolDeltaResponse is the response type for the
Query/MintPoolDelta RPC method.
terra.market.v1beta1.QueryParamsResponse:
type: object
properties:
params:
description: params defines the parameters of the module.
type: object
properties:
base_pool:
mint_base_pool:
type: string
format: byte
burn_base_pool:
type: string
format: byte
pool_recovery_period:
Expand All @@ -52952,18 +53054,6 @@ definitions:
amount:
type: string
description: QuerySwapResponse is the response type for the Query/Swap RPC method.
terra.market.v1beta1.QueryTerraPoolDeltaResponse:
type: object
properties:
terra_pool_delta:
type: string
format: byte
title: >-
terra_pool_delta defines the gap between the TerraPool and the
BasePool
description: >-
QueryTerraPoolDeltaResponse is the response type for the
Query/TerraPoolDelta RPC method.
terra.oracle.v1beta1.AggregateExchangeRatePrevote:
type: object
properties:
Expand Down
37 changes: 29 additions & 8 deletions client/docs/swagger_legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2110,9 +2110,27 @@ paths:
$ref: "#/definitions/Coin"
500:
description: Internal Server Error
/market/terra_pool_delta:
/market/mint_pool_delta:
get:
summary: Get Terra pool delta, is usdr amount used for swap operation from the TerraPool.
summary: Get mint pool delta, is usdr amount used for swap operation from the MintPool.
tags:
- Market
produces:
- application/json
responses:
200:
description: OK
schema:
type: number
format: float
example: "10000000.00"
400:
description: Bad Request
500:
description: Internal Server Error
/market/burn_pool_delta:
get:
summary: Get burn pool delta, is usdr amount used for swap operation from the BurnPool.
tags:
- Market
produces:
Expand Down Expand Up @@ -3833,15 +3851,18 @@ definitions:
MarketParams:
type: object
properties:
daily_luna_delta_limit:
mint_base_pool:
type: number
example: "0.005"
min_swap_spread:
example: "1000000.0"
burn_base_pool:
type: number
example: "0.02"
max_swap_spread:
example: "1000000.0"
pool_recovery_period:
type: number
example: "0.1"
example: "16000"
min_stability_spread:
type: number
example: "0.02"
PrevoteReq:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion custom/auth/client/cli/estimate_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func GetTxFeesEstimateCommand() *cobra.Command {
Long: strings.TrimSpace(`
Estimate fees for the given stdTx
$ terracli tx estimate-fee [file] --gas-adjustment 1.4 --gas-prices 0.015uluna
$ terrad tx estimate-fee [file] --gas-adjustment 1.4 --gas-prices 0.015uluna
`),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
Expand Down
Loading

0 comments on commit cf3213b

Please sign in to comment.