Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/oracle spread #150

Merged
merged 19 commits into from
Jun 4, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions x/mint/keeper.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package mint

import (
//"fmt"

"github.com/terra-project/core/types/assets"
"github.com/terra-project/core/types/util"

@@ -146,6 +144,10 @@ func (k Keeper) PeekEpochSeigniorage(ctx sdk.Context, epoch sdk.Int) (epochSeign

prevEpochIssuance := k.GetIssuance(ctx, assets.MicroLunaDenom, prevEpochLastDay)
epochIssuance := k.GetIssuance(ctx, assets.MicroLunaDenom, epochLastDay)
<<<<<<< HEAD
=======

>>>>>>> ecd03ecca2ffc49cfd86469fe967ff0a79d45993
epochSeigniorage = epochIssuance.Sub(prevEpochIssuance)
return
}
Binary file added x/treasury/debug.test
Binary file not shown.
2 changes: 1 addition & 1 deletion x/treasury/end_blocker_test.go
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ func TestEndBlockerTiming(t *testing.T) {

tTags := EndBlocker(input.ctx, input.treasuryKeeper)

require.Equal(t, tTags.ToKVPairs()[4].GetValue(), []byte(tags.ActionPolicyUpdate))
require.Equal(t, tTags.ToKVPairs()[0].GetValue(), []byte(tags.ActionPolicyUpdate))
}
}
}
4 changes: 4 additions & 0 deletions x/treasury/indicator_test.go
Original file line number Diff line number Diff line change
@@ -41,9 +41,13 @@ func TestSeigniorageRewardsForEpoch(t *testing.T) {
sAmt := sdk.NewInt(1000)
lnasdrRate := sdk.NewDec(10)

SeigniorageRewardsForEpoch(input.ctx, input.treasuryKeeper, util.GetEpoch(input.ctx))

// Set random prices
input.oracleKeeper.SetLunaSwapRate(input.ctx, assets.MicroSDRDenom, lnasdrRate)

input.ctx = input.ctx.WithBlockHeight(util.BlocksPerEpoch)

// Add seigniorage
input.mintKeeper.Mint(input.ctx, addrs[0], sdk.NewCoin(assets.MicroLunaDenom, sAmt))

7 changes: 5 additions & 2 deletions x/treasury/querier_test.go
Original file line number Diff line number Diff line change
@@ -247,12 +247,15 @@ func TestQuerySeigniorageProceeds(t *testing.T) {
input := createTestInput(t)
querier := NewQuerier(input.treasuryKeeper)

getQueriedSeigniorageProceeds(t, input.ctx, input.cdc, querier, util.GetEpoch(input.ctx))

input.ctx = input.ctx.WithBlockHeight(util.BlocksPerEpoch)
seigniorageProceeds := sdk.NewCoin(assets.MicroLunaDenom, sdk.NewInt(10).MulRaw(assets.MicroUnit))
input.mintKeeper.Mint(input.ctx, addrs[0], sdk.NewCoin(assets.MicroLunaDenom, seigniorageProceeds.Amount))

queriedSeigniorageProceeds := getQueriedSeigniorageProceeds(t, input.ctx, input.cdc, querier, util.GetEpoch(input.ctx))

require.Equal(t, queriedSeigniorageProceeds, seigniorageProceeds)
require.Equal(t, seigniorageProceeds, queriedSeigniorageProceeds)
}

func TestQueryIssuance(t *testing.T) {
@@ -265,5 +268,5 @@ func TestQueryIssuance(t *testing.T) {

queriedIssuance := getQueriedIssuance(t, input.ctx, input.cdc, querier, assets.MicroSDRDenom)

require.Equal(t, queriedIssuance, issuance)
require.Equal(t, issuance, queriedIssuance)
}
2 changes: 2 additions & 0 deletions x/treasury/test_common.go
Original file line number Diff line number Diff line change
@@ -188,6 +188,8 @@ func createTestInput(t *testing.T) testInput {
mintKeeper,
paramsKeeper.Subspace(market.DefaultParamspace))

marketKeeper.SetParams(ctx, market.DefaultParams())

treasuryKeeper := NewKeeper(
cdc,
keyTreasury,