Skip to content

Commit

Permalink
chore: update chain protos
Browse files Browse the repository at this point in the history
  • Loading branch information
proofofze committed Jul 10, 2024
1 parent c644192 commit c35ed22
Show file tree
Hide file tree
Showing 28 changed files with 381 additions and 279 deletions.
2 changes: 1 addition & 1 deletion chain/auction/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

chaintypes "github.com/InjectiveLabs/sdk-go/chain/types"
chaintypes "github.com/InjectiveLabs/injective-core/injective-chain/types"

Check failure on line 8 in chain/auction/types/msgs.go

View workflow job for this annotation

GitHub Actions / run-tests

no required module provides package github.com/InjectiveLabs/injective-core/injective-chain/types; to add it:
)

const (
Expand Down
2 changes: 1 addition & 1 deletion chain/exchange/types/events.pb.go

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

2 changes: 1 addition & 1 deletion chain/exchange/types/exchange.pb.go

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

6 changes: 3 additions & 3 deletions chain/exchange/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

insurancetypes "github.com/InjectiveLabs/sdk-go/chain/insurance/types"
oracletypes "github.com/InjectiveLabs/sdk-go/chain/oracle/types"
wasmxtypes "github.com/InjectiveLabs/sdk-go/chain/wasmx/types"
insurancetypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/insurance/types"

Check failure on line 16 in chain/exchange/types/expected_keepers.go

View workflow job for this annotation

GitHub Actions / run-tests

no required module provides package github.com/InjectiveLabs/injective-core/injective-chain/modules/insurance/types; to add it:
oracletypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/oracle/types"
wasmxtypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/wasmx/types"

Check failure on line 18 in chain/exchange/types/expected_keepers.go

View workflow job for this annotation

GitHub Actions / run-tests

no required module provides package github.com/InjectiveLabs/injective-core/injective-chain/modules/wasmx/types; to add it:
)

// BankKeeper defines the expected bank keeper methods.
Expand Down
7 changes: 4 additions & 3 deletions chain/exchange/types/fee_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ func ValidateMakerWithTakerFee(makerFeeRate, takerFeeRate, relayerFeeShareRate,
return nil
}

// if makerFeeRate is negative, must hold: takerFeeRate * (1 - relayerFeeShareRate) + makerFeeRate > minimalProtocolFeeRate
if takerFeeRate.Mul(math.LegacyOneDec().Sub(relayerFeeShareRate)).Add(makerFeeRate).LT(minimalProtocolFeeRate) {
errMsg := fmt.Sprintf("if makerFeeRate (%v) is negative, (takerFeeRate = %v) * (1 - relayerFeeShareRate = %v) + makerFeeRate < %v", makerFeeRate.String(), takerFeeRate.String(), relayerFeeShareRate.String(), minimalProtocolFeeRate.String())
return errors.Wrap(ErrFeeRatesRelation, errMsg)
// if makerFeeRate is negative then takerFeeRate >= (minimalProtocolFeeRate - relayerFeeShareRate)/(1 - makerFeeRate)
numerator := minimalProtocolFeeRate.Sub(relayerFeeShareRate)
denominator := math.LegacyOneDec().Sub(makerFeeRate)
return errors.Wrap(ErrFeeRatesRelation, fmt.Sprintf("if maker_fee_rate is negative (%v), taker_fee_rate must be GTE than %v [ taker_fee_rate >= (minimum_protocol_fee_rate - maker_fee_rate)/(1 - relayer_fee_share_rate) ]", makerFeeRate.String(), numerator.Quo(denominator).String()))
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions chain/exchange/types/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"

oracletypes "github.com/InjectiveLabs/sdk-go/chain/oracle/types"
peggytypes "github.com/InjectiveLabs/sdk-go/chain/peggy/types"
oracletypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/oracle/types"
peggytypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/peggy/types"

Check failure on line 11 in chain/exchange/types/market.go

View workflow job for this annotation

GitHub Actions / run-tests

no required module provides package github.com/InjectiveLabs/injective-core/injective-chain/modules/peggy/types; to add it:
)

var BinaryOptionsMarketRefundFlagPrice = math.LegacyNewDec(-1)
Expand Down
4 changes: 2 additions & 2 deletions chain/exchange/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/ethereum/go-ethereum/common"

oracletypes "github.com/InjectiveLabs/sdk-go/chain/oracle/types"
wasmxtypes "github.com/InjectiveLabs/sdk-go/chain/wasmx/types"
oracletypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/oracle/types"
wasmxtypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/wasmx/types"
)

const RouterKey = ModuleName
Expand Down
2 changes: 1 addition & 1 deletion chain/exchange/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/ethereum/go-ethereum/common"

oracletypes "github.com/InjectiveLabs/sdk-go/chain/oracle/types"
oracletypes "github.com/InjectiveLabs/injective-core/injective-chain/modules/oracle/types"
)

// constants
Expand Down
2 changes: 1 addition & 1 deletion chain/exchange/types/proposal.pb.go

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

2 changes: 1 addition & 1 deletion chain/exchange/types/query.pb.go

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

8 changes: 6 additions & 2 deletions chain/exchange/types/spot_orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ func (m *SpotLimitOrder) GetUnfilledFeeAmount(fee math.LegacyDec) math.LegacyDec
return m.GetUnfilledNotional().Mul(fee)
}

func (m *SpotOrder) GetBalanceHoldAndMarginDenom(market *SpotMarket) (balanceHold math.LegacyDec, denom string) {
func (m *SpotOrder) GetBalanceHoldAndMarginDenom(market *SpotMarket) (math.LegacyDec, string) {
var denom string
var balanceHold math.LegacyDec
if m.IsBuy() {
denom = market.QuoteDenom
if m.OrderType.IsPostOnly() {
Expand All @@ -165,7 +167,9 @@ func (m *SpotOrder) GetBalanceHoldAndMarginDenom(market *SpotMarket) (balanceHol
return balanceHold, denom
}

func (m *SpotLimitOrder) GetUnfilledMarginHoldAndMarginDenom(market *SpotMarket, isTransient bool) (balanceHold math.LegacyDec, denom string) {
func (m *SpotLimitOrder) GetUnfilledMarginHoldAndMarginDenom(market *SpotMarket, isTransient bool) (math.LegacyDec, string) {
var denom string
var balanceHold math.LegacyDec
if m.IsBuy() {
var tradeFeeRate math.LegacyDec

Expand Down
Loading

0 comments on commit c35ed22

Please sign in to comment.