Skip to content

Commit 0495311

Browse files
authored
Merge pull request #263 from InjectiveLabs/feat/add_exchange_v2_support
Feat/add exchange v2 support
2 parents 77e624d + 0da105a commit 0495311

File tree

411 files changed

+170594
-8836
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

411 files changed

+170594
-8836
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ jobs:
1313
name: lint
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- uses: actions/setup-go@v5
1818
with:
1919
go-version-file: "go.mod"
2020
check-latest: true
2121
- name: golangci-lint
22-
uses: golangci/golangci-lint-action@v6
22+
uses: golangci/golangci-lint-action@v8
2323
with:
2424
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
25-
version: latest
25+
version: v2.1.6
2626

2727
# Optional: working directory, useful for monorepos
2828
# working-directory: somedir

.golangci.yml

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,66 @@
1+
version: "2"
2+
run:
3+
tests: false
14
linters:
2-
fast: false
35
enable:
46
- errcheck
57
- errorlint
6-
- gas
78
- gocritic
8-
- gofmt
9-
- goimports
10-
- gosimple
119
- govet
1210
- ineffassign
13-
- megacheck
1411
- misspell
1512
- nakedret
1613
- prealloc
1714
- revive
18-
- staticcheck
1915
- unconvert
2016
- unparam
2117
disable:
2218
- unused
23-
24-
linters-settings:
25-
revive:
26-
enable-all-rules: true
19+
settings:
20+
gocritic:
21+
disabled-checks:
22+
- singleCaseSwitch
23+
- deferInLoop
24+
- hugeParam
25+
- unnamedResult
26+
enabled-tags:
27+
- performance
28+
- diagnostic
29+
- style
30+
- opinionated
31+
- experimental
32+
revive:
33+
enable-all-rules: true
34+
rules:
35+
- name: var-naming
36+
arguments:
37+
- - ID
38+
- name: add-constant
39+
disabled: true
40+
- name: line-length-limit
41+
arguments:
42+
- 140
43+
- name: cognitive-complexity
44+
arguments:
45+
- 20
46+
disabled: false
47+
exclusions:
48+
generated: lax
49+
presets:
50+
- comments
51+
- common-false-positives
52+
- legacy
53+
- std-error-handling
2754
rules:
28-
- name: var-naming
29-
arguments:
30-
- ["ID"]
31-
- name: add-constant
32-
disabled: true
33-
- name: line-length-limit
34-
arguments:
35-
- 140
36-
gocritic:
37-
enabled-tags:
38-
- performance
39-
- diagnostic
40-
- style
41-
- opinionated
42-
- experimental
43-
disabled-checks:
44-
- singleCaseSwitch
45-
- deferInLoop
46-
- hugeParam
47-
- unnamedResult
55+
- linters:
56+
- revive
57+
text: ALL_CAPS
58+
paths:
59+
- chain
60+
- exchange
61+
- injective_data
62+
- proto
63+
- client/keyring/testdata
64+
- client/chain/chain_test_support.go
4865
issues:
49-
exclude-rules:
50-
- linters:
51-
- revive
52-
text: ALL_CAPS
53-
exclude-dirs:
54-
- chain
55-
- exchange
56-
- injective_data
57-
- proto
58-
- client/keyring/testdata
5966
max-issues-per-linter: 0
60-
61-
run:
62-
tests: false

Makefile

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
all:
22

33
clone-injective-indexer:
4-
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.15.6 --depth 1 --single-branch
4+
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.0-rc2 --depth 1 --single-branch
55

66
clone-injective-core:
7-
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.15.0 --depth 1 --single-branch
7+
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.16.0-beta.2 --depth 1 --single-branch
88

99
copy-exchange-client: clone-injective-indexer
1010
rm -rf exchange/*
@@ -51,9 +51,34 @@ copy-chain-types: clone-injective-core
5151
mkdir -p chain/auction/types && \
5252
cp injective-core/injective-chain/modules/auction/types/*.pb.go chain/auction/types && \
5353
cp injective-core/injective-chain/modules/auction/types/codec.go chain/auction/types
54+
mkdir -p chain/erc20/types && \
55+
cp injective-core/injective-chain/modules/erc20/types/*.pb.go chain/erc20/types && \
56+
cp injective-core/injective-chain/modules/erc20/types/codec.go chain/erc20/types
57+
mkdir -p chain/evm/types && \
58+
cp injective-core/injective-chain/modules/evm/types/*.pb.go chain/evm/types && \
59+
cp injective-core/injective-chain/modules/evm/types/access_list.go chain/evm/types && \
60+
cp injective-core/injective-chain/modules/evm/types/access_list_tx.go chain/evm/types && \
61+
cp injective-core/injective-chain/modules/evm/types/chain_config.go chain/evm/types && \
62+
cp injective-core/injective-chain/modules/evm/types/codec.go chain/evm/types && \
63+
cp injective-core/injective-chain/modules/evm/types/dynamic_fee_tx.go chain/evm/types && \
64+
cp injective-core/injective-chain/modules/evm/types/errors.go chain/evm/types && \
65+
cp injective-core/injective-chain/modules/evm/types/eth.go chain/evm/types && \
66+
cp injective-core/injective-chain/modules/evm/types/events.go chain/evm/types && \
67+
cp injective-core/injective-chain/modules/evm/types/key.go chain/evm/types && \
68+
cp injective-core/injective-chain/modules/evm/types/legacy_tx.go chain/evm/types && \
69+
cp injective-core/injective-chain/modules/evm/types/logs.go chain/evm/types && \
70+
cp injective-core/injective-chain/modules/evm/types/msg.go chain/evm/types && \
71+
cp injective-core/injective-chain/modules/evm/types/params.go chain/evm/types && \
72+
cp injective-core/injective-chain/modules/evm/types/storage.go chain/evm/types && \
73+
cp injective-core/injective-chain/modules/evm/types/tx.go chain/evm/types && \
74+
cp injective-core/injective-chain/modules/evm/types/tx_data.go chain/evm/types && \
75+
cp injective-core/injective-chain/modules/evm/types/utils.go chain/evm/types
5476
mkdir -p chain/exchange/types && \
5577
cp injective-core/injective-chain/modules/exchange/types/*.go chain/exchange/types && \
5678
rm -rf chain/exchange/types/*test.go && rm -rf chain/exchange/types/*gw.go
79+
mkdir -p chain/exchange/types/v2 && \
80+
cp injective-core/injective-chain/modules/exchange/types/v2/*.go chain/exchange/types/v2 && \
81+
rm -rf chain/exchange/types/v2/*test.go && rm -rf chain/exchange/types/v2/*gw.go
5782
mkdir -p chain/insurance/types && \
5883
cp injective-core/injective-chain/modules/insurance/types/*.pb.go chain/insurance/types && \
5984
cp injective-core/injective-chain/modules/insurance/types/codec.go chain/insurance/types
@@ -109,10 +134,14 @@ copy-chain-types: clone-injective-core
109134
cp injective-core/injective-chain/modules/wasmx/types/proposal.go chain/wasmx/types
110135
mkdir -p chain/stream/types && \
111136
cp injective-core/injective-chain/stream/types/*.pb.go chain/stream/types
137+
mkdir -p chain/stream/types/v2 && \
138+
cp injective-core/injective-chain/stream/types/v2/*.pb.go chain/stream/types/v2
112139
mkdir -p chain/types && \
113140
cp injective-core/injective-chain/types/*.pb.go injective-core/injective-chain/types/config.go chain/types && \
114141
cp injective-core/injective-chain/types/codec.go chain/types && \
115-
cp injective-core/injective-chain/types/util.go chain/types
142+
cp injective-core/injective-chain/types/int.go chain/types && \
143+
cp injective-core/injective-chain/types/util.go chain/types && \
144+
cp injective-core/injective-chain/types/validation.go chain/types
116145

117146
@find ./chain -type f -name "*.go" -exec sed -i "" -e "s|github.com/InjectiveLabs/injective-core/injective-chain/modules|github.com/InjectiveLabs/sdk-go/chain|g" {} \;
118147
@find ./chain -type f -name "*.go" -exec sed -i "" -e "s|github.com/InjectiveLabs/injective-core/injective-chain|github.com/InjectiveLabs/sdk-go/chain|g" {} \;
@@ -168,4 +197,8 @@ lint-master: export GOPROXY=direct
168197
lint-master:
169198
golangci-lint run --timeout=15m -v --new-from-rev=master
170199

171-
.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master
200+
lint-all: export GOPROXY=direct
201+
lint-all:
202+
golangci-lint run --timeout=15m -v
203+
204+
.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master lint-all

auth_vote/authz_vote.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import (
1414
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
1515
)
1616

17+
//revive:disable:function-length // this is an example script
1718
func main() {
1819
network := common.LoadNetwork("testnet", "lb")
19-
tmClient, err := rpchttp.New(network.TmEndpoint, "/websocket")
20+
tmClient, err := rpchttp.New(network.TmEndpoint)
2021
if err != nil {
2122
panic(err)
2223
}

chain/auction/types/query.pb.go

Lines changed: 48 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chain/crypto/ethsecp256k1/ethsecp256k1.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (privKey *PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool {
7373
}
7474

7575
// Type returns eth_secp256k1
76-
func (privKey *PrivKey) Type() string {
76+
func (*PrivKey) Type() string {
7777
return KeyType
7878
}
7979

@@ -153,7 +153,7 @@ func (pubKey *PubKey) String() string {
153153
}
154154

155155
// Type returns eth_secp256k1
156-
func (pubKey *PubKey) Type() string {
156+
func (*PubKey) Type() string {
157157
return KeyType
158158
}
159159

chain/crypto/hd/algorithm.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ const (
2020
)
2121

2222
var (
23-
// SupportedAlgorithms defines the list of signing algorithms used on Ethermint:
23+
// SupportedAlgorithms defines the list of signing algorithms used on Injective:
2424
// - eth_secp256k1 (Ethereum)
2525
// - secp256k1 (Tendermint)
2626
SupportedAlgorithms = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1}
27-
// SupportedAlgorithmsLedger defines the list of signing algorithms used on Ethermint for the Ledger device:
27+
// SupportedAlgorithmsLedger defines the list of signing algorithms used on Injective for the Ledger device:
2828
// - eth_secp256k1 (Ethereum)
2929
// - secp256k1 (Tendermint)
3030
SupportedAlgorithmsLedger = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1}
@@ -49,7 +49,7 @@ type ethSecp256k1Algo struct {
4949
}
5050

5151
// Name returns eth_secp256k1
52-
func (s ethSecp256k1Algo) Name() hd.PubKeyType {
52+
func (ethSecp256k1Algo) Name() hd.PubKeyType {
5353
return EthSecp256k1Type
5454
}
5555

@@ -94,7 +94,7 @@ func (s ethSecp256k1Algo) Derive() hd.DeriveFn {
9494
}
9595

9696
// Generate generates a secp256k1 private key from the given bytes.
97-
func (s ethSecp256k1Algo) Generate() hd.GenerateFn {
97+
func (ethSecp256k1Algo) Generate() hd.GenerateFn {
9898
return func(bz []byte) cryptotypes.PrivKey {
9999
var bzArr = make([]byte, ethsecp256k1.PrivKeySize)
100100
copy(bzArr, bz)

0 commit comments

Comments
 (0)