Skip to content

Commit

Permalink
upgrade iotex-core v2.1 & fix candidate id (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc authored Dec 26, 2024
1 parent 2c6059e commit 6d35000
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 302 deletions.
2 changes: 1 addition & 1 deletion apiservice/account_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/iotexproject/iotex-analyser-api/common/accounts"
"github.com/iotexproject/iotex-analyser-api/common/actions"
"github.com/iotexproject/iotex-analyser-api/db"
"github.com/iotexproject/iotex-core/ioctl/util"
"github.com/iotexproject/iotex-core/v2/ioctl/util"
"github.com/pkg/errors"
)

Expand Down
4 changes: 2 additions & 2 deletions apiservice/staking_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/iotexproject/iotex-analyser-api/config"
"github.com/iotexproject/iotex-analyser-api/db"
"github.com/iotexproject/iotex-analyser-api/internal/sync/errgroup"
"github.com/iotexproject/iotex-core/blockchain/genesis"
"github.com/iotexproject/iotex-core/ioctl/util"
"github.com/iotexproject/iotex-core/v2/blockchain/genesis"
"github.com/iotexproject/iotex-core/v2/ioctl/util"
)

type StakingService struct {
Expand Down
2 changes: 1 addition & 1 deletion apiservice/voting_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/iotexproject/iotex-analyser-api/common"
"github.com/iotexproject/iotex-analyser-api/db"
"github.com/iotexproject/iotex-analyser-api/internal/sync/errgroup"
"github.com/iotexproject/iotex-core/blockchain/genesis"
"github.com/iotexproject/iotex-core/v2/blockchain/genesis"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion common/accounts/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package accounts

import (
"github.com/iotexproject/iotex-analyser-api/db"
"github.com/iotexproject/iotex-core/ioctl/util"
"github.com/iotexproject/iotex-core/v2/ioctl/util"
)

func ContractIsExist(contractAddress string) (bool, uint64, error) {
Expand Down
12 changes: 3 additions & 9 deletions common/accounts/erc20.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/iotexproject/iotex-analyser-api/common"
"github.com/iotexproject/iotex-analyser-api/config"
"github.com/iotexproject/iotex-analyser-api/db"
"github.com/iotexproject/iotex-core/action"
"github.com/iotexproject/iotex-core/test/identityset"
"github.com/iotexproject/iotex-core/v2/action"
"github.com/iotexproject/iotex-core/v2/test/identityset"
"github.com/iotexproject/iotex-proto/golang/iotexapi"
)

Expand Down Expand Up @@ -88,16 +88,10 @@ func ReadERC20DecimalsWithCache(contractAddress string) (int, error) {
func ReadERC20Decimals(client iotexapi.APIServiceClient, contractAddr string) (int, error) {
decimals := 6 //default decimal

nonce := uint64(1)
transferAmount := big.NewInt(0)
gasLimit := uint64(100000)
gasPrice := big.NewInt(10000000)
callerAddress := identityset.Address(30).String()
callData, _ := hex.DecodeString("313ce567")
execution, err := action.NewExecution(contractAddr, nonce, transferAmount, gasLimit, gasPrice, callData)
if err != nil {
return decimals, nil
}
execution := action.NewExecution(contractAddr, transferAmount, callData)
request := &iotexapi.ReadContractRequest{
Execution: execution.Proto(),
CallerAddress: callerAddress,
Expand Down
2 changes: 1 addition & 1 deletion common/coin.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/iotexproject/iotex-address/address"
"github.com/iotexproject/iotex-analyser-api/db"
"github.com/iotexproject/iotex-core/ioctl/util"
"github.com/iotexproject/iotex-core/v2/ioctl/util"
"github.com/pkg/errors"
)

Expand Down
4 changes: 2 additions & 2 deletions common/epoch.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package common

import (
"github.com/iotexproject/iotex-core/blockchain/genesis"
"github.com/iotexproject/iotex-core/v2/blockchain/genesis"
)

var (
Expand All @@ -13,7 +13,7 @@ func init() {
genesisCfg.Blockchain.NumSubEpochs = 15
}

//https://github.com/millken/iotex-core/blob/77950cec681d2e441a77b2b9a162ffa1c4ca4f55/action/protocol/rolldpos/epoch.go#L213
// https://github.com/millken/iotex-core/blob/77950cec681d2e441a77b2b9a162ffa1c4ca4f55/action/protocol/rolldpos/epoch.go#L213
// GetEpochNum returns the number of the epoch for a given height
func GetEpochNum(height uint64) uint64 {
if height == 0 {
Expand Down
2 changes: 1 addition & 1 deletion common/votings/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/iotexproject/iotex-analyser-api/db"
"github.com/iotexproject/iotex-core/blockchain/genesis"
"github.com/iotexproject/iotex-core/v2/blockchain/genesis"
"github.com/iotexproject/iotex-proto/golang/iotextypes"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion common/votings/voting.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func getStakingBucketInfoByEpoch(height uint64, epochNum uint64, delegateName st
var candidateAddress string
for _, cand := range candidateList.Candidates {
if cand.Name == delegateName {
candidateAddress = cand.OwnerAddress
candidateAddress = cand.Id
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/imdario/mergo"
"github.com/iotexproject/iotex-core/blockchain/genesis"
"github.com/iotexproject/iotex-core/v2/blockchain/genesis"
homedir "github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
"github.com/sethvargo/go-envconfig"
Expand Down
73 changes: 44 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/iotexproject/iotex-analyser-api

go 1.18
go 1.23.3

require (
github.com/go-chi/httprate v0.7.4
Expand All @@ -12,19 +12,19 @@ require (
github.com/iotexproject/go-pkgs v0.1.13
github.com/iotexproject/iotex-address v0.2.8
github.com/iotexproject/iotex-antenna-go/v2 v2.5.1
github.com/iotexproject/iotex-core v1.12.0-rc0
github.com/iotexproject/iotex-proto v0.5.14
github.com/iotexproject/iotex-core/v2 v2.1.0
github.com/iotexproject/iotex-proto v0.6.4
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.1
github.com/prometheus/client_golang v1.17.0
github.com/sethvargo/go-envconfig v0.4.0
github.com/shopspring/decimal v1.2.0
github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.9.0
github.com/ysugimoto/grpc-graphql-gateway v0.22.0
google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.28.1
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/mysql v1.2.0
gorm.io/driver/postgres v1.2.2
Expand All @@ -34,19 +34,25 @@ require (

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.21.0-beta // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dustinxie/gmsm v1.4.0 // indirect
github.com/ethereum/go-ethereum v1.10.26 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-ethereum v1.14.12 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/holiman/uint256 v1.3.1 // indirect
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
Expand All @@ -61,23 +67,32 @@ require (
github.com/jinzhu/now v1.1.2 // indirect
github.com/magefile/mage v1.9.0 // indirect
github.com/mattn/go-sqlite3 v1.14.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/rjeczalik/notify v0.9.2 // indirect
github.com/spf13/cobra v1.1.1 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/spf13/cobra v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/uptrace/opentelemetry-go-extra/otelutil v0.2.2 // indirect
github.com/uptrace/opentelemetry-go-extra/otelzap v0.2.2 // indirect
go.elastic.co/ecszap v1.0.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.uber.org/config v1.3.1 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.16.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum => github.com/iotexproject/go-ethereum v0.5.0
Loading

0 comments on commit 6d35000

Please sign in to comment.