Skip to content

Commit

Permalink
(fix) Synced proto definitions with the latest chain upgrade core and…
Browse files Browse the repository at this point in the history
… indexer. Updated example scripts
  • Loading branch information
aarmoa committed Jul 8, 2024
1 parent dbf0eb4 commit d380328
Show file tree
Hide file tree
Showing 107 changed files with 5,393 additions and 1,739 deletions.
66 changes: 33 additions & 33 deletions chain/auction/types/tx.pb.go

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

10 changes: 4 additions & 6 deletions chain/crypto/ethsecp256k1/ethsecp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import (
"crypto/subtle"
"fmt"

ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/secp256k1"

"cosmossdk.io/errors"
tmcrypto "github.com/cometbft/cometbft/crypto"
"github.com/cosmos/cosmos-sdk/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

tmcrypto "github.com/cometbft/cometbft/crypto"
ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
)

const (
Expand Down Expand Up @@ -197,7 +195,7 @@ func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error {
func (pubKey PubKey) VerifySignature(msg, sig []byte) bool {
if len(sig) == 65 {
// remove recovery ID if contained in the signature
sig = sig[:len(sig)-1]
sig = sig[:64]
}

// the signature needs to be in [R || S] format when provided to VerifySignature
Expand Down
2 changes: 1 addition & 1 deletion chain/exchange/types/derivative_orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (o *DerivativeLimitOrder) GetCancelRefundAmount(feeRate math.LegacyDec) mat
if o.IsVanilla() {
// negative fees are only accounted for upon matching
positiveFeePart := math.LegacyMaxDec(math.LegacyZeroDec(), feeRate)
// nolint:all
//nolint:all
// Refund = (FillableQuantity / Quantity) * (Margin + Price * Quantity * feeRate)
notional := o.OrderInfo.Price.Mul(o.OrderInfo.Quantity)
marginHoldRefund = o.Fillable.Mul(o.Margin.Add(notional.Mul(positiveFeePart))).Quo(o.OrderInfo.Quantity)
Expand Down
1 change: 1 addition & 0 deletions chain/exchange/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var (
_ sdk.Msg = &MsgSubaccountTransfer{}
_ sdk.Msg = &MsgExternalTransfer{}
_ sdk.Msg = &MsgIncreasePositionMargin{}
_ sdk.Msg = &MsgDecreasePositionMargin{}
_ sdk.Msg = &MsgLiquidatePosition{}
_ sdk.Msg = &MsgEmergencySettleMarket{}
_ sdk.Msg = &MsgInstantSpotMarketLaunch{}
Expand Down
6 changes: 4 additions & 2 deletions chain/exchange/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"

oracletypes "github.com/InjectiveLabs/sdk-go/chain/oracle/types"
sdk "github.com/cosmos/cosmos-sdk/types"
gov "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/ethereum/go-ethereum/common"

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

// constants
Expand Down Expand Up @@ -728,7 +729,8 @@ func (p *OracleParams) ValidateBasic() error {
}
switch p.OracleType {
case oracletypes.OracleType_Band, oracletypes.OracleType_PriceFeed, oracletypes.OracleType_Coinbase, oracletypes.OracleType_Chainlink, oracletypes.OracleType_Razor,
oracletypes.OracleType_Dia, oracletypes.OracleType_API3, oracletypes.OracleType_Uma, oracletypes.OracleType_Pyth, oracletypes.OracleType_BandIBC, oracletypes.OracleType_Provider:
oracletypes.OracleType_Dia, oracletypes.OracleType_API3, oracletypes.OracleType_Uma, oracletypes.OracleType_Pyth, oracletypes.OracleType_BandIBC, oracletypes.OracleType_Provider,
oracletypes.OracleType_Stork:

default:
return errors.Wrap(ErrInvalidOracleType, p.OracleType.String())
Expand Down
4 changes: 1 addition & 3 deletions chain/exchange/types/spot_orders.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ func (m *SpotOrder) GetBalanceHoldAndMarginDenom(market *SpotMarket) (balanceHol
return balanceHold, denom
}

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

Expand Down
Loading

0 comments on commit d380328

Please sign in to comment.