Skip to content

Commit

Permalink
Merge PR: modify ex prefix , modify cm version (#841)
Browse files Browse the repository at this point in the history
* modify ex prefix , modify cm version

* modify ex prefix , fix ut

Co-authored-by: [email protected] <[email protected]>
  • Loading branch information
zhshy11 and [email protected] authored Apr 23, 2021
1 parent 7513804 commit ca10cbd
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

const (
// EthBech32Prefix defines the Bech32 prefix used for EthAccounts
EthBech32Prefix = "okexchain"
EthBech32Prefix = "ex"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = EthBech32Prefix
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/okex/cosmos-sdk v0.39.2-okexchain3
github.com/cosmos/cosmos-sdk => github.com/okex/cosmos-sdk v0.39.2-okexchain3.1
github.com/tendermint/iavl => github.com/okex/iavl v0.14.1-okexchain1
github.com/tendermint/tendermint => github.com/okex/tendermint v0.33.9-okexchain1
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/okex/cosmos-sdk v0.39.2-okexchain3 h1:19tx5fM8Eh2uBp768XyUXRSnxjLW+/wUKp9p/AaP2NU=
github.com/okex/cosmos-sdk v0.39.2-okexchain3/go.mod h1:Y1C2roqCVZ6gSYG31X77x4NLcbSGS9VP1GIiAE1imcc=
github.com/okex/cosmos-sdk v0.39.2-okexchain3.1 h1:EqamhILf3A7bnOlke44G6yIX0DiqHj9jZKJsFgwYrTo=
github.com/okex/cosmos-sdk v0.39.2-okexchain3.1/go.mod h1:Y1C2roqCVZ6gSYG31X77x4NLcbSGS9VP1GIiAE1imcc=
github.com/okex/iavl v0.14.1-okexchain1 h1:aP9Rpxb1QU06WgTJ/xLyEQbZOiZzKy3once7wGtNLIU=
github.com/okex/iavl v0.14.1-okexchain1/go.mod h1:QmfViflFiXzxKLQE4tAUuWQHq+RSuQFxablW5oJZ6sE=
github.com/okex/tendermint v0.33.9-okexchain1 h1:D/ucsRdls+9fkfmvc9AdrFhSS8gtfzk3jyYt+PSzbEY=
Expand Down
4 changes: 2 additions & 2 deletions x/ammswap/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
)

const addrTest = "okexchain1a20d4xmqj4m9shtm0skt0aaahsgeu4h6746fs2"
const addrTest = "ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658"

func TestKeeper_GetPoolTokenInfo(t *testing.T) {
mapp, _ := GetTestInput(t, 1)
Expand Down Expand Up @@ -88,4 +88,4 @@ func TestGetInputPrice(t *testing.T) {
outputAmount := GetInputPrice(inputAmount, inputReserve, outputReserve, feeRate)
expectedAmount := sdk.NewDec(0)
require.Equal(t, expectedAmount.String(), outputAmount.String())
}
}
6 changes: 3 additions & 3 deletions x/common/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
apptypes "github.com/okex/okexchain/app/types"
"github.com/stretchr/testify/require"
)

func initConfig() {
Expand All @@ -18,7 +18,7 @@ func initConfig() {

func TestHasSufCoins(t *testing.T) {
initConfig()
addr, err := sdk.AccAddressFromBech32("okexchain18mxjm0knqjpkaxk2zd2jr67pgrd8c0ct0tycvl")
addr, err := sdk.AccAddressFromBech32("ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658")
require.Nil(t, err)

availDecCoins, err := sdk.ParseDecCoins(fmt.Sprintf("%d%s,%d%s",
Expand Down Expand Up @@ -54,7 +54,7 @@ func TestBlackHoleAddress(t *testing.T) {
addr := BlackHoleAddress()
a := addr.String()
fmt.Println(a)
require.Equal(t, addr.String(), "okexchain1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqupa6dx")
require.Equal(t, addr.String(), "ex1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqm2k6w2")
}

func TestGetFixedLengthRandomString(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/dex/types/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package types

const (
// TestTokenPairOwner defines owner of token pair, just for test
TestTokenPairOwner = "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"
TestTokenPairOwner = "ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658"
)
4 changes: 2 additions & 2 deletions x/distribution/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func GetCmdSetWithdrawAddr(cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Set the withdraw address for rewards associated with a delegator address.
Example:
$ %s tx distr set-withdraw-addr okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0 --from mykey
$ %s tx distr set-withdraw-addr ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02 --from mykey
`,
version.ClientName,
),
Expand Down Expand Up @@ -122,7 +122,7 @@ Where proposal.json contains:
{
"title": "Community Pool Spend",
"description": "Pay me some %s!",
"recipient": "okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0",
"recipient": "ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02",
"amount": [
{
"denom": "%s",
Expand Down
6 changes: 3 additions & 3 deletions x/farm/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func GetCmdQueryEarnings(storeName string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query available rewards for an address.
Example:
$ %s query farm rewards pool-eth-xxb okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0
$ %s query farm rewards pool-eth-xxb ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02
`,
version.ClientName,
),
Expand Down Expand Up @@ -222,7 +222,7 @@ func GetCmdQueryAccount(storeName string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query the names of all pools that an account has locked coins in.
Example:
$ %s query farm account okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0
$ %s query farm account ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02
`,
version.ClientName,
),
Expand Down Expand Up @@ -329,7 +329,7 @@ func GetCmdQueryLockInfo(storeName string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query the lock info of an account's token locking on a specific pool.
Example:
$ %s query farm lock-info pool-eth-xxb okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0
$ %s query farm lock-info pool-eth-xxb ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02
`,
version.ClientName,
),
Expand Down
8 changes: 4 additions & 4 deletions x/farm/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func TestHandlerMsgDestroyPool(t *testing.T) {
return destroyPoolMsg
},
verification: verification,
expectedErr: types.ErrInvalidPoolOwner("okexchain15ky9du8a2wlstz6fpx3p4mqpjyrm5cgpq6kh8f", "abc"),
expectedErr: types.ErrInvalidPoolOwner("ex15ky9du8a2wlstz6fpx3p4mqpjyrm5cgp83ahy9", "abc"),
},
{
caseName: "failed. insufficient fee coins",
Expand All @@ -374,7 +374,7 @@ func TestHandlerMsgDestroyPool(t *testing.T) {
},
getMsg: normalGetDestroyPoolMsg,
verification: verification,
expectedErr: errors.New("insufficient coins: insufficient funds: insufficient account funds; 10.000000000000000000okt < 1.000000000000000000fff"),
expectedErr: errors.New("insufficient coins: insufficient funds: insufficient account funds; 10.000000000000000000okt < 1.000000000000000000fff"),
},
{
caseName: "failed. the pool is not finished and can not be destroyed",
Expand Down Expand Up @@ -706,7 +706,7 @@ func TestHandlerMsgUnlock(t *testing.T) {
},
getMsg: normalGetUnlockMsg,
verification: verification,
expectedErr: types.ErrNoLockInfoFound("okexchain15ky9du8a2wlstz6fpx3p4mqpjyrm5cgqavzz6m", "abc"),
expectedErr: types.ErrNoLockInfoFound("ex15ky9du8a2wlstz6fpx3p4mqpjyrm5cgq68fzeh", "abc"),
},
{
caseName: "failed. The coin name should be %s, not %s",
Expand Down Expand Up @@ -807,7 +807,7 @@ func TestHandlerMsgUnlock(t *testing.T) {
},
getMsg: normalGetUnlockMsg,
verification: verification,
expectedErr: errors.New(fmt.Sprintf("failed. send coins from module to account failed insufficient funds: insufficient account funds; " + "10.000000000000000000%s < 1.000000000000000000ammswap_aab_ccb", sdk.DefaultBondDenom)),
expectedErr: errors.New(fmt.Sprintf("failed. send coins from module to account failed insufficient funds: insufficient account funds; "+"10.000000000000000000%s < 1.000000000000000000ammswap_aab_ccb", sdk.DefaultBondDenom)),
},
{
caseName: "success. lock and unlock without provide before",
Expand Down
10 changes: 5 additions & 5 deletions x/gov/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/cosmos/cosmos-sdk/version"
"github.com/okex/okexchain/x/gov/client/utils"

"github.com/okex/okexchain/x/gov/types"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/okex/okexchain/x/gov/types"
)

// GetQueryCmd returns the cli query commands for this module
Expand Down Expand Up @@ -92,8 +92,8 @@ func GetCmdQueryProposals(queryRoute string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query for a all proposals. You can filter the returns with the following flags.
Example:
$ %s query gov proposals --depositor okexchain1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
$ %s query gov proposals --voter okexchain1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
$ %s query gov proposals --depositor ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658
$ %s query gov proposals --voter ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658
$ %s query gov proposals --status (DepositPeriod|VotingPeriod|Passed|Rejected)
`,
version.ClientName, version.ClientName, version.ClientName,
Expand Down Expand Up @@ -304,7 +304,7 @@ func getCmdQueryVote(queryRoute string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query details for a single vote on a proposal given its identifier.
Example:
$ %s query gov vote 1 okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0
$ %s query gov vote 1 ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02
`,
version.ClientName,
),
Expand Down Expand Up @@ -422,7 +422,7 @@ func getCmdQueryDeposit(queryRoute string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query details for a single proposal deposit on a proposal by its identifier.
Example:
$ %s query gov deposit 1 okexchain1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk
$ %s query gov deposit 1 ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658
`,
version.ClientName,
),
Expand Down
2 changes: 1 addition & 1 deletion x/order/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ func TestFeesTable(t *testing.T) {
}

func handleOrders(t *testing.T, baseasset string, quoteasset string, orders []*types.Order, blockheight int64) sdk.SysCoins {
TestTokenPairOwner := "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"
TestTokenPairOwner := "ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658"
addr, err := sdk.AccAddressFromBech32(TestTokenPairOwner)
require.Nil(t, err)
mapp, addrKeysSlice := getMockApp(t, len(orders))
Expand Down
4 changes: 2 additions & 2 deletions x/staking/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func GetCmdQueryProxy(storeName string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query the addresses of delegators by a specific proxy
Example:
$ %s query staking proxy okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0
$ %s query staking proxy ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02
`,
version.ClientName,
),
Expand Down Expand Up @@ -240,7 +240,7 @@ func GetCmdQueryDelegator(storeName string, cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Query the information of delegations and all shares recently added by a delegator
Example:
$ %s query staking delegator okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0
$ %s query staking delegator ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02
`,
version.ClientName,
),
Expand Down
2 changes: 1 addition & 1 deletion x/staking/client/cli/tx_vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func GetCmdBindProxy(cdc *codec.Codec) *cobra.Command {
fmt.Sprintf(`Bind proxy relationship.
Example:
$ %s tx staking proxy bind okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0 --from mykey
$ %s tx staking proxy bind ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02 --from mykey
`,
version.ClientName),
),
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestValidatorMarshalUnmarshalJSON(t *testing.T) {
js, err := codec.Cdc.MarshalJSON(validator)
require.NoError(t, err)
require.NotEmpty(t, js)
require.Contains(t, string(js), "\"consensus_pubkey\":\"okexchainvalconspub")
require.Contains(t, string(js), "\"consensus_pubkey\":\"exvalconspub")
got := &Validator{}
err = codec.Cdc.UnmarshalJSON(js, got)
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion x/token/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// default owner of okt
const DefaultTokenOwner = "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9"
const DefaultTokenOwner = "ex1rf9wr069pt64e58f2w3mjs9w72g8vemzw26658"

// all state that must be provided in genesis file
type GenesisState struct {
Expand Down
6 changes: 3 additions & 3 deletions x/token/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,12 @@ func TestNewTokenMultiSend(t *testing.T) {
fromAddr := sdk.AccAddress(fromPubKey.Address())

// correct message
coinStr := `[{"to":"okexchain1dfpljpe0g0206jch32fx95lyagq3z5ws850m6f","amount":"1` + common.NativeToken + `"}]`
coinStr := `[{"to":"ex1jedas2n0pq2c68pelztgel8ht8pz50rh7s7vfz","amount":"1` + common.NativeToken + `"}]`
transfers, err := StrToTransfers(coinStr)
require.Nil(t, err)

// coins not positive
toAddr0, err := sdk.AccAddressFromBech32("okexchain1dfpljpe0g0206jch32fx95lyagq3z5ws850m6f")
toAddr0, err := sdk.AccAddressFromBech32("ex1jedas2n0pq2c68pelztgel8ht8pz50rh7s7vfz")
require.Nil(t, err)
decCoin0 := sdk.NewDecCoinFromDec(common.NativeToken, sdk.NewDec(0))
transfers0 := []TransferUnit{
Expand All @@ -252,7 +252,7 @@ func TestNewTokenMultiSend(t *testing.T) {
}{
{NewMsgMultiSend(fromAddr, transfers), nil},
{NewMsgMultiSend(sdk.AccAddress{}, transfers), ErrAddressIsRequired()},
{NewMsgMultiSend(fromAddr, make([]TransferUnit, MultiSendLimit+1)),ErrMsgTransfersAmountBiggerThanSendLimit()},
{NewMsgMultiSend(fromAddr, make([]TransferUnit, MultiSendLimit+1)), ErrMsgTransfersAmountBiggerThanSendLimit()},
{NewMsgMultiSend(fromAddr, transfers0), ErrInvalidCoins("0.000000000000000000okt")},
{NewMsgMultiSend(fromAddr, transfers1), ErrAddressIsRequired()},
}
Expand Down
2 changes: 1 addition & 1 deletion x/token/types/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Token struct {
WholeName string `json:"whole_name" v2:"whole_name"` // e.g. "OKT"
OriginalTotalSupply sdk.Dec `json:"original_total_supply" v2:"original_total_supply"` // e.g. 1000000000.00000000
Type int `json:"type"` //e.g. 1 common token, 2 interest token
Owner sdk.AccAddress `json:"owner" v2:"owner"` // e.g. okexchain1hw4r48aww06ldrfeuq2v438ujnl6alsz0685a0
Owner sdk.AccAddress `json:"owner" v2:"owner"` // e.g. ex1cftp8q8g4aa65nw9s5trwexe77d9t6cr8ndu02
Mintable bool `json:"mintable" v2:"mintable"` // e.g. false
}

Expand Down
4 changes: 2 additions & 2 deletions x/token/types/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestCurrency(t *testing.T) {
func TestToken(t *testing.T) {

common.InitConfig()
addr, err := sdk.AccAddressFromBech32("okexchain1dfpljpe0g0206jch32fx95lyagq3z5ws850m6f")
addr, err := sdk.AccAddressFromBech32("ex1jedas2n0pq2c68pelztgel8ht8pz50rh7s7vfz")
require.Nil(t, err)

testCase := []struct {
Expand All @@ -84,7 +84,7 @@ func TestToken(t *testing.T) {
Type: 0,
Owner: addr,
Mintable: true,
}, `{"description":"okblockchain coin","symbol":"` + common.NativeToken + `","original_symbol":"` + common.NativeToken + `","whole_name":"ok coin","original_total_supply":"1000000000.000000000000000000","type":0,"owner":"okexchain1dfpljpe0g0206jch32fx95lyagq3z5ws850m6f","mintable":true}`},
}, `{"description":"okblockchain coin","symbol":"` + common.NativeToken + `","original_symbol":"` + common.NativeToken + `","whole_name":"ok coin","original_total_supply":"1000000000.000000000000000000","type":0,"owner":"ex1jedas2n0pq2c68pelztgel8ht8pz50rh7s7vfz","mintable":true}`},
}
for _, tokenCase := range testCase {
b, err := json.Marshal(tokenCase.token)
Expand Down
8 changes: 4 additions & 4 deletions x/token/types/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func TestStrToTransfers(t *testing.T) {
common.InitConfig()
//coinStr := `[{"to": "cosmos18ragjd23yv4ctjg3vadh43q5zf8z0hafm4qjrf", "amount": "1BNB,2BTC"},
//{"to": "cosmos18ragjd23yv4ctjg3vadh43q5zf8z0hafm4qjrf", "amount": "1OKB,2BTC"}]`
coinStr := `[{"to":"okexchain1dfpljpe0g0206jch32fx95lyagq3z5ws850m6f","amount":"1` + common.NativeToken + `"}]`
coinStr := `[{"to":"ex1jedas2n0pq2c68pelztgel8ht8pz50rh7s7vfz","amount":"1` + common.NativeToken + `"}]`
coinStrError := `[{"to":"kochain1dfpljpe0g0206jch32fx95lyagq3z5ws2vgwx3","amount":"1` + common.NativeToken + `"}]`
addr, err := sdk.AccAddressFromBech32("okexchain1dfpljpe0g0206jch32fx95lyagq3z5ws850m6f")
addr, err := sdk.AccAddressFromBech32("ex1jedas2n0pq2c68pelztgel8ht8pz50rh7s7vfz")
require.Nil(t, err)
_, err = StrToTransfers(coinStrError)
require.Error(t, err)
Expand All @@ -44,7 +44,7 @@ func TestStrToTransfers(t *testing.T) {
}
require.EqualValues(t, transfer, transfers)

coinStr = `[{"to":"okexchain1dfpljpe0g0206jch32fx95lyagq3z5ws850m6f",amount":"1"}]`
coinStr = `[{"to":"ex1jedas2n0pq2c68pelztgel8ht8pz50rh7s7vfz",amount":"1"}]`
_, err = StrToTransfers(coinStr)
require.Error(t, err)
}
Expand Down Expand Up @@ -199,4 +199,4 @@ func TestValidateDenom(t *testing.T) {

name = notAllowedPrefix + "_abc-123" + "_bcd"
require.Nil(t, sdk.ValidateDenom(name))
}
}

0 comments on commit ca10cbd

Please sign in to comment.