Skip to content

Commit

Permalink
Merge branch 'master' into pause-unpause-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
juniuszhou authored Sep 14, 2022
2 parents 3ae5808 + 4fb2b95 commit 2722d99
Show file tree
Hide file tree
Showing 15 changed files with 299 additions and 86 deletions.
4 changes: 2 additions & 2 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

const releaseVersion = "1.0-beta"
const releaseVersion = "1.0-beta.11"

func SetupHandlers(app *SifchainApp) {
app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm m.VersionMap) (m.VersionMap, error) {
Expand All @@ -21,7 +21,7 @@ func SetupHandlers(app *SifchainApp) {
}
if upgradeInfo.Name == releaseVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{"margin"},
// Added: []string{},
}
// Use upgrade store loader for the initial loading of all stores when app starts,
// it checks if version == upgradeHeight and applies store upgrades before loading the stores,
Expand Down
8 changes: 8 additions & 0 deletions proto/sifnode/clp/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ message Pool {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
string block_interest_native = 17 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
string block_interest_external = 18 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
}

message LiquidityProvider {
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0-beta
1.0-beta.11
10 changes: 10 additions & 0 deletions x/clp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ func TestBeginBlocker_Incremental(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand All @@ -442,6 +444,8 @@ func TestBeginBlocker_Incremental(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand All @@ -467,6 +471,8 @@ func TestBeginBlocker_Incremental(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand All @@ -492,6 +498,8 @@ func TestBeginBlocker_Incremental(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand Down Expand Up @@ -553,6 +561,8 @@ func TestBeginBlocker_Incremental(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
},
Expand Down
2 changes: 2 additions & 0 deletions x/clp/keeper/calculations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,8 @@ func TestKeeper_SwapOneFromGenesis(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
SwapPriceNative: &SwapPriceNative,
Expand Down
12 changes: 12 additions & 0 deletions x/clp/keeper/pmtp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func TestKeeper_PolicyRun(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand Down Expand Up @@ -97,6 +99,8 @@ func TestKeeper_PolicyRun(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand Down Expand Up @@ -131,6 +135,8 @@ func TestKeeper_PolicyRun(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand Down Expand Up @@ -165,6 +171,8 @@ func TestKeeper_PolicyRun(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand Down Expand Up @@ -199,6 +207,8 @@ func TestKeeper_PolicyRun(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
RewardPeriodNativeDistributed: sdk.ZeroUint(),
Expand Down Expand Up @@ -253,6 +263,8 @@ func TestKeeper_PolicyRun(t *testing.T) {
ExternalLiabilities: sdk.ZeroUint(),
UnsettledExternalLiabilities: sdk.ZeroUint(),
UnsettledNativeLiabilities: sdk.ZeroUint(),
BlockInterestExternal: sdk.ZeroUint(),
BlockInterestNative: sdk.ZeroUint(),
Health: sdk.ZeroDec(),
InterestRate: sdk.NewDecWithPrec(1, 1),
},
Expand Down
42 changes: 42 additions & 0 deletions x/clp/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -71,6 +73,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -98,6 +102,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -125,6 +131,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -152,6 +160,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -179,6 +189,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -206,6 +218,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -265,6 +279,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -292,6 +308,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -319,6 +337,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -346,6 +366,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -373,6 +395,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -400,6 +424,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -427,6 +453,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -454,6 +482,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -481,6 +511,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -508,6 +540,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -535,6 +569,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -562,6 +598,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -589,6 +627,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down Expand Up @@ -616,6 +656,8 @@
"external_liabilities": "0",
"unsettled_native_liabilities": "0",
"unsettled_external_liabilities": "0",
"block_interest_native": "0",
"block_interest_external": "0",
"health": "0",
"interest_rate": "0.000000000000000000",
"reward_period_native_distributed": "0"
Expand Down
Loading

0 comments on commit 2722d99

Please sign in to comment.