Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.17.81 --depth 1 --single-branch

clone-injective-core:
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.18.0-alpha.3 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.18.0-beta.2 --depth 1 --single-branch

copy-exchange-client: clone-injective-indexer
rm -rf exchange/*
Expand Down Expand Up @@ -108,6 +108,7 @@ copy-chain-types: clone-injective-core
mkdir -p chain/peggy/types && \
cp injective-core/injective-chain/modules/peggy/types/*.pb.go chain/peggy/types && \
cp injective-core/injective-chain/modules/peggy/types/abi_json.go chain/peggy/types && \
cp injective-core/injective-chain/modules/peggy/types/batch.go chain/peggy/types && \
cp injective-core/injective-chain/modules/peggy/types/codec.go chain/peggy/types && \
cp injective-core/injective-chain/modules/peggy/types/ethereum.go chain/peggy/types && \
cp injective-core/injective-chain/modules/peggy/types/ethereum_signer.go chain/peggy/types && \
Expand Down
2 changes: 1 addition & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/)
Copyright © 2020 - 2026 Injective Labs Inc. (https://injectivelabs.org/)

<a href="https://drive.google.com/uc?export=view&id=1-fPQRh_D_dnun2yTtSsPW5MypVBOVYJP"><img src="https://drive.google.com/uc?export=view&id=1-fPQRh_D_dnun2yTtSsPW5MypVBOVYJP" style="width: 300px; max-width: 100%; height: auto" />

Expand Down
141 changes: 71 additions & 70 deletions chain/evm/types/tx.pb.go

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

5 changes: 5 additions & 0 deletions chain/exchange/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@ type DowntimeKeeper interface {
GetLastDowntimeOfLength(ctx sdk.Context, dur downtimetypes.Downtime) (time.Time, error)
GetLastBlockTime(ctx sdk.Context) (time.Time, error)
}

type PermissionsKeeper interface {
IsEnforcedRestrictionsDenom(ctx sdk.Context, denom string) bool
SendRestrictionFn(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amount sdk.Coin) (newToAddr sdk.AccAddress, err error)
}
3 changes: 2 additions & 1 deletion chain/exchange/types/v2/common_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package v2

import (
"cosmossdk.io/math"
"github.com/InjectiveLabs/sdk-go/chain/exchange/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"

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

type SpotLimitOrderDelta struct {
Expand Down
27 changes: 23 additions & 4 deletions chain/exchange/types/v2/derivative.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ type DerivativeMatchingExpansionData struct {
OpenInterestDelta math.LegacyDec
NewRestingLimitBuyOrders []*DerivativeLimitOrder // transient buy orders that become new resting limit orders
NewRestingLimitSellOrders []*DerivativeLimitOrder // transient sell orders that become new resting limit orders
PartialCancelOrders map[common.Hash]struct{}
}

func NewDerivativeMatchingExpansionData(clearingPrice, clearingQuantity math.LegacyDec) *DerivativeMatchingExpansionData {
Expand All @@ -228,6 +229,7 @@ func NewDerivativeMatchingExpansionData(clearingPrice, clearingQuantity math.Leg
MarketBalanceDelta: math.LegacyZeroDec(),
NewRestingLimitBuyOrders: make([]*DerivativeLimitOrder, 0),
NewRestingLimitSellOrders: make([]*DerivativeLimitOrder, 0),
PartialCancelOrders: make(map[common.Hash]struct{}),
}
}

Expand All @@ -254,6 +256,22 @@ func (e *DerivativeMatchingExpansionData) AddNewSellRestingLimitOrder(order *Der
e.NewRestingLimitSellOrders = append(e.NewRestingLimitSellOrders, order)
}

func (e *DerivativeMatchingExpansionData) SetRestingLimitBuyOrderCancels(orders []*DerivativeLimitOrder) {
e.RestingLimitBuyOrderCancels = orders
}

func (e *DerivativeMatchingExpansionData) SetRestingLimitSellOrderCancels(orders []*DerivativeLimitOrder) {
e.RestingLimitSellOrderCancels = orders
}

func (e *DerivativeMatchingExpansionData) SetTransientLimitBuyOrderCancels(orders []*DerivativeLimitOrder) {
e.TransientLimitBuyOrderCancels = orders
}

func (e *DerivativeMatchingExpansionData) SetTransientLimitSellOrderCancels(orders []*DerivativeLimitOrder) {
e.TransientLimitSellOrderCancels = orders
}

func (e *DerivativeMatchingExpansionData) GetLimitMatchingDerivativeBatchExecutionData(
market DerivativeMarketI,
markPrice math.LegacyDec,
Expand Down Expand Up @@ -359,6 +377,7 @@ func (e *DerivativeMatchingExpansionData) GetLimitMatchingDerivativeBatchExecuti
CancelLimitOrderEvents: cancelLimitOrdersEvents,
CancelMarketOrderEvents: nil,
VwapData: vwapData,
PartialCancelOrders: e.PartialCancelOrders,
}

return batch
Expand Down Expand Up @@ -925,10 +944,6 @@ func GetPositionSliceData(p map[common.Hash]*PositionState) ([]*Position, []comm
positions = append(positions, position.Position)
nonNilPositionSubaccountIDs = append(nonNilPositionSubaccountIDs, subaccountID)
}

// else {
// fmt.Println("❌ position is nil for subaccount", subaccountID.Hex())
// }
}

return positions, nonNilPositionSubaccountIDs
Expand Down Expand Up @@ -975,6 +990,10 @@ type DerivativeBatchExecutionData struct {
CancelMarketOrderEvents []*EventCancelDerivativeOrder

VwapData *VwapData

// Orders that were partially filled then became invalid
// Used by persistence layer to handle partial cancellations correctly
PartialCancelOrders map[common.Hash]struct{}
}

func (d *DerivativeBatchExecutionData) GetAtomicDerivativeMarketOrderResults() *DerivativeMarketOrderResults {
Expand Down
Loading