diff --git a/CHANGELOG.md b/CHANGELOG.md index 704ac598a..f6c2f1877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#2000](https://github.com/NibiruChain/nibiru/pull/2000) - refactor(evm): simplify ERC-20 keeper methods - [#2001](https://github.com/NibiruChain/nibiru/pull/2001) - refactor(evm): simplify FunToken methods and tests - [#2003](https://github.com/NibiruChain/nibiru/pull/2003) - fix(evm): fix FunToken conversions between Cosmos and EVM +- [#2004](https://github.com/NibiruChain/nibiru/pull/2004) - refactor(evm)!: replace `HexAddr` with `EIP55Addr` #### Dapp modules: perp, spot, oracle, etc diff --git a/eth/eip55.go b/eth/eip55.go new file mode 100644 index 000000000..5a47664b9 --- /dev/null +++ b/eth/eip55.go @@ -0,0 +1,88 @@ +package eth + +import ( + "encoding/json" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + gethcommon "github.com/ethereum/go-ethereum/common" +) + +var _ sdk.CustomProtobufType = (*EIP55Addr)(nil) + +// EIP55Addr is a wrapper around gethcommon.Address that provides JSON marshaling +// and unmarshalling as well as Protobuf serialization and deserialization. +// The constructors ensure that the input string is a valid 20 byte hex address. +type EIP55Addr struct { + gethcommon.Address +} + +// Checks input length, but not case-sensitive hex. +func NewEIP55AddrFromStr(input string) (EIP55Addr, error) { + if !gethcommon.IsHexAddress(input) { + return EIP55Addr{}, fmt.Errorf( + "EIP55AddrError: input \"%s\" is not an ERC55-compliant, 20 byte hex address", + input, + ) + } + + addr := EIP55Addr{ + Address: gethcommon.HexToAddress(input), + } + + return addr, nil +} + +// Marshal implements the gogo proto custom type interface. +// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md +func (h EIP55Addr) Marshal() ([]byte, error) { + return h.Bytes(), nil +} + +// MarshalJSON returns the [EIP55Addr] as JSON bytes. +// Implements the gogo proto custom type interface. +// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md +func (h EIP55Addr) MarshalJSON() ([]byte, error) { + return json.Marshal(h.String()) +} + +// MarshalTo serializes a EIP55Addr directly into a pre-allocated byte slice ("data"). +// MarshalTo implements the gogo proto custom type interface. +// Implements the gogo proto custom type interface. +// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md +func (h *EIP55Addr) MarshalTo(data []byte) (n int, err error) { + copy(data, h.Bytes()) + return h.Size(), nil +} + +// Unmarshal implements the gogo proto custom type interface. +// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md +func (h *EIP55Addr) Unmarshal(data []byte) error { + addr := gethcommon.BytesToAddress(data) + *h = EIP55Addr{Address: addr} + return nil +} + +// UnmarshalJSON implements the gogo proto custom type interface. +// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md +func (h *EIP55Addr) UnmarshalJSON(bz []byte) error { + text := new(string) + if err := json.Unmarshal(bz, text); err != nil { + return err + } + + addr, err := NewEIP55AddrFromStr(*text) + if err != nil { + return err + } + + *h = addr + + return nil +} + +// Size implements the gogo proto custom type interface. +// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md +func (h EIP55Addr) Size() int { + return len(h.Bytes()) +} diff --git a/eth/eip55_test.go b/eth/eip55_test.go new file mode 100644 index 000000000..c0f1b9de4 --- /dev/null +++ b/eth/eip55_test.go @@ -0,0 +1,175 @@ +package eth_test + +import ( + "strconv" + "testing" + + gethcommon "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/suite" + + "github.com/NibiruChain/nibiru/v2/eth" +) + +// MustNewEIP55AddrFromStr is the same as [NewEIP55AddrFromStr], except it panics +// when there's an error. +func MustNewEIP55AddrFromStr(input string) eth.EIP55Addr { + addr, err := eth.NewEIP55AddrFromStr(input) + if err != nil { + panic(err) + } + return addr +} + +var threeValidAddrs []eth.EIP55Addr = []eth.EIP55Addr{ + MustNewEIP55AddrFromStr("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"), + MustNewEIP55AddrFromStr("0xAe967917c465db8578ca9024c205720b1a3651A9"), + MustNewEIP55AddrFromStr("0x1111111111111111111112222222222223333323"), +} + +func (s *EIP55AddrSuite) TestEquivalence() { + expectedGethAddr := gethcommon.HexToAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed") + expectedEIP55Addr := MustNewEIP55AddrFromStr("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed") + + equivalentAddrs := []string{ + "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", + "0x5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED", + "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", + "0X5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED", + } + + for _, addr := range equivalentAddrs { + eip55Addr, err := eth.NewEIP55AddrFromStr(addr) + s.Require().NoError(err) + + s.Equal(expectedEIP55Addr, eip55Addr) + s.Equal(expectedGethAddr, eip55Addr.Address) + } +} + +// TestEIP55Addr_NewEIP55Addr: Test to showcase the flexibility of inputs that can be +// passed to `eth.NewEIP55AddrFromStr` and result in a "valid" `EIP55Addr` that preserves +// bijectivity with `gethcommon.Address` and has a canonical string +// representation. +// +// We only want to store valid `EIP55Addr` strings in state. Hex addresses that +// include or remove the prefix, or change the letters to and from lower and +// upper case will all produce the same `EIP55Addr` when passed to +// `eth.NewEIP55AddrFromStr`. +func (s *EIP55AddrSuite) TestNewEIP55Addr() { + // TestCase: An instance of a "EIP55Addr" that derives to the + // expected Ethereum address and results in the same string representation. + type TestCase struct { + input string + name string + wantErr bool + } + + want := "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed" + + for _, tc := range []TestCase{ + { + input: "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", + name: "happy: no-op (sanity check to show constructor doesn't break a valid input)", + }, + { + input: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", + name: "happy: lower case is valid", + }, + { + input: "0x5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED", + name: "happy: upper case is valid", + }, + { + input: "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", + name: "happy: 0x prefix: missing", + }, + { + input: "0X5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", + name: "happy: 0X prefix: typo", + }, + { + input: "nibi1zaa12312312aacbcbeabea123", + name: "sad: bech32 is not hex", + wantErr: true, + }, + } { + tc := tc + s.Run(tc.name, func() { + got, err := eth.NewEIP55AddrFromStr(tc.input) + if tc.wantErr { + s.Require().Error(err) + return + } + + // string input should give the canonical EIP55Addr + s.Equal(want, got.String()) + s.Equal(gethcommon.HexToAddress(tc.input), got.Address) + }) + } +} + +func (s *EIP55AddrSuite) TestProtobufEncoding() { + for tcIdx, tc := range []struct { + input eth.EIP55Addr + expectedJson string + wantErr string + }{ + { + input: threeValidAddrs[0], + expectedJson: "\"0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed\"", + }, + { + input: threeValidAddrs[1], + expectedJson: "\"0xAe967917c465db8578ca9024c205720b1a3651A9\"", + }, + { + input: threeValidAddrs[2], + expectedJson: "\"0x1111111111111111111112222222222223333323\"", + }, + } { + s.Run(strconv.Itoa(tcIdx), func() { + givenMut := tc.input + jsonBz, err := givenMut.MarshalJSON() + s.NoError(err) + s.Equal(tc.expectedJson, string(jsonBz)) + + eip55Addr := new(eth.EIP55Addr) + s.NoError(eip55Addr.UnmarshalJSON(jsonBz)) + s.Equal(givenMut, tc.input, + "Given -> MarshalJSON -> UnmarshalJSON returns a different value than the given when it should be an identity operation (no-op). test case #%d", tcIdx) + + bz, err := tc.input.Marshal() + s.NoError(err) + s.Equal(tc.input.Bytes(), bz, + "Marshaling to bytes gives different value than the test case specifies. test case #%d", tcIdx) + + err = eip55Addr.Unmarshal(bz) + s.NoError(err) + s.Equal(tc.input.Address, eip55Addr.Address, + "Given -> Marshal -> Unmarshal returns a different value than the given when it should be an identity operation (no-op). test case #%d", tcIdx) + + s.Equal(len(tc.input.Bytes()), tc.input.Size()) + }) + } +} + +// showcases how geth checks for valid hex addresses and treats invalid inputs +func (s *EIP55AddrSuite) TestIsEIP55Address() { + s.True(gethcommon.IsHexAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed")) + s.True(gethcommon.IsHexAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAED")) + s.False(gethcommon.IsHexAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed1234")) + s.False(gethcommon.IsHexAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1B")) + + s.Equal("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", gethcommon.HexToAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed").Hex()) + s.Equal("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", gethcommon.HexToAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAED").Hex()) + s.Equal("0xb6053f3e94c9B9a09f33669435e7eF1BEAEd1234", gethcommon.HexToAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed1234").Hex()) + s.Equal("0x00005AaEb6053f3e94c9b9A09f33669435e7Ef1b", gethcommon.HexToAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1B").Hex()) +} + +type EIP55AddrSuite struct { + suite.Suite +} + +func TestEIP55AddrSuite(t *testing.T) { + suite.Run(t, new(EIP55AddrSuite)) +} diff --git a/eth/hex.go b/eth/hex.go deleted file mode 100644 index 4f4017bc5..000000000 --- a/eth/hex.go +++ /dev/null @@ -1,128 +0,0 @@ -package eth - -import ( - "encoding/json" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - gethcommon "github.com/ethereum/go-ethereum/common" -) - -/////////// HexAddr - -// HexAddr: An ERC55-compliant hexadecimal-encoded string representing the 20 -// byte address of an Ethereum account. -type HexAddr string - -var _ sdk.CustomProtobufType = (*HexAddr)(nil) - -func NewHexAddr(addr gethcommon.Address) HexAddr { - return HexAddr(addr.Hex()) -} - -func NewHexAddrFromStr(addr string) (HexAddr, error) { - hexAddr := HexAddr(gethcommon.HexToAddress(addr).Hex()) - if !gethcommon.IsHexAddress(addr) { - return hexAddr, fmt.Errorf( - "%s: input \"%s\" is not an ERC55-compliant, 20 byte hex address", - HexAddrError, addr, - ) - } - return hexAddr, hexAddr.Valid() -} - -// MustNewHexAddrFromStr is the same as [NewHexAddrFromStr], except it panics -// when there's an error. -func MustNewHexAddrFromStr(addr string) HexAddr { - hexAddr, err := NewHexAddrFromStr(addr) - if err != nil { - panic(err) - } - return hexAddr -} - -const HexAddrError = "HexAddrError" - -func (h HexAddr) Valid() error { - // Check address encoding bijectivity - wantAddr := h.ToAddr().Hex() // gethcommon.Address.Hex() - haveAddr := string(h) // should be equivalent to ↑ - - if !gethcommon.IsHexAddress(haveAddr) || haveAddr != wantAddr { - return fmt.Errorf( - "%s: Ethereum address is not represented as expected. We have encoding \"%s\" and instead need \"%s\" (gethcommon.Address.Hex)", - HexAddrError, haveAddr, wantAddr, - ) - } - - return nil -} - -func (h HexAddr) ToAddr() gethcommon.Address { - return gethcommon.HexToAddress(string(h)) -} - -// ToBytes gets the string representation of the underlying address. -func (h HexAddr) ToBytes() []byte { - return h.ToAddr().Bytes() -} - -func (h HexAddr) String() string { return h.ToAddr().Hex() } - -// Marshal implements the gogo proto custom type interface. -// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md -func (h HexAddr) Marshal() ([]byte, error) { - return []byte(h), nil -} - -// MarshalJSON returns the [HexAddr] as JSON bytes. -// Implements the gogo proto custom type interface. -// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md -func (h HexAddr) MarshalJSON() ([]byte, error) { - return []byte("\"" + h.String() + "\""), nil // a string is already JSON -} - -// MarshalTo serializes a pre-allocated byte slice ("data") directly into the -// [HexAddr] value, avoiding unnecessary memory allocations. -// MarshalTo implements the gogo proto custom type interface. -// Implements the gogo proto custom type interface. -// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md -func (h *HexAddr) MarshalTo(data []byte) (n int, err error) { - bz := []byte(*h) - copy(data, bz) - hexAddr, err := NewHexAddrFromStr(string(bz)) - *h = hexAddr - return h.Size(), err -} - -// Unmarshal implements the gogo proto custom type interface. -// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md -func (h *HexAddr) Unmarshal(data []byte) error { - hexAddr, err := NewHexAddrFromStr(string(data)) - *h = hexAddr - return err -} - -// UnmarshalJSON implements the gogo proto custom type interface. -// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md -func (h *HexAddr) UnmarshalJSON(bz []byte) error { - text := new(string) - if err := json.Unmarshal(bz, text); err != nil { - return err - } - - hexAddr, err := NewHexAddrFromStr(*text) - if err != nil { - return err - } - - *h = hexAddr - - return nil -} - -// Size implements the gogo proto custom type interface. -// Ref: https://github.com/cosmos/gogoproto/blob/v1.5.0/custom_types.md -func (h HexAddr) Size() int { - return len(h) -} diff --git a/eth/hex_test.go b/eth/hex_test.go deleted file mode 100644 index 28694b6f9..000000000 --- a/eth/hex_test.go +++ /dev/null @@ -1,281 +0,0 @@ -package eth_test - -import ( - "fmt" - "strconv" - "strings" - - gethcommon "github.com/ethereum/go-ethereum/common" - - "github.com/NibiruChain/nibiru/v2/eth" - "github.com/NibiruChain/nibiru/v2/x/common/set" -) - -var threeValidAddrs []eth.HexAddr = []eth.HexAddr{ - eth.MustNewHexAddrFromStr("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"), - eth.MustNewHexAddrFromStr("0xAe967917c465db8578ca9024c205720b1a3651A9"), - eth.MustNewHexAddrFromStr("0x1111111111111111111112222222222223333323"), -} - -func (s *Suite) TestHexAddr_UniqueMapping() { - type CorrectAnswer struct { - gethAddrOut gethcommon.Address - hexAddrOut eth.HexAddr - } - - for tcIdx, tc := range []struct { - equivSet set.Set[string] - }{ - { - equivSet: set.New( - "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", - "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", - "0x5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED", - "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", - "0X5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED", - ), - }, - } { - s.Run(strconv.Itoa(tcIdx), func() { - s.T().Log("Show that each member of the set is equivalent") - var answer CorrectAnswer - for idx, equivHexAddrString := range tc.equivSet.ToSlice() { - gethAddrOut := gethcommon.HexToAddress(equivHexAddrString) - hexAddrOut, err := eth.NewHexAddrFromStr(equivHexAddrString) - s.NoError(err) - if idx == 0 { - answer = CorrectAnswer{ - gethAddrOut: gethAddrOut, - hexAddrOut: hexAddrOut, - } - continue - } - - s.Equal(answer.gethAddrOut, gethAddrOut) - s.Equal(answer.gethAddrOut, hexAddrOut.ToAddr()) - s.Equal(answer.hexAddrOut, hexAddrOut) - } - }) - } -} - -// TestHexAddr_NewHexAddr: Test to showcase the flexibility of inputs that can be -// passed to `eth.NewHexAddrFromStr` and result in a "valid" `HexAddr` that preserves -// bijectivity with `gethcommon.Address` and has a canonical string -// representation. -// -// We only want to store valid `HexAddr` strings in state. Hex addresses that -// include or remove the prefix, or change the letters to and from lower and -// upper case will all produce the same `HexAddr` when passed to -// `eth.NewHexAddrFromStr`. -func (s *Suite) TestHexAddr_NewHexAddr() { - // InputAddrVariation: An instance of a "hexAddr" that derives to the - // expected Ethereum address and results in the same string representation. - type InputAddrVariation struct { - hexAddr string - testCaseName string - wantNotEqual bool - } - - for _, tcGroup := range []struct { - want eth.HexAddr - hexAddrs []InputAddrVariation - }{ - { - want: threeValidAddrs[0], - hexAddrs: []InputAddrVariation{ - { - hexAddr: "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", - testCaseName: "happy: no-op (sanity check to show constructor doesn't break a valid input)", - }, - { - hexAddr: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", - testCaseName: "happy: lower case is valid", - }, - { - hexAddr: "0x5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED", - testCaseName: "happy: upper case is valid", - }, - { - hexAddr: "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", - testCaseName: "happy: 0x prefix: missing", - }, - { - hexAddr: "nibi1zaa12312312aacbcbeabea123", - testCaseName: "sad: bech32 is not hex", - wantNotEqual: true, - }, - }, - }, - { - want: threeValidAddrs[1], - hexAddrs: []InputAddrVariation{ - { - hexAddr: "0XAe967917c465db8578ca9024c205720b1a3651A9", - testCaseName: "happy: 0x prefix: typo", - }, - { - hexAddr: "0xae967917c465db8578ca9024c205720b1a3651A9", - testCaseName: "happy: mixed case checksum not valid according to ERC55", - }, - { - hexAddr: "not-a-hex-addr", - testCaseName: "sad: sanity check: clearly not a hex addr", - wantNotEqual: true, - }, - }, - }, - { - want: threeValidAddrs[2], - hexAddrs: []InputAddrVariation{ - { - hexAddr: "0x1111111111111111111112222222222223333323", - testCaseName: "happy", - }, - }, - }, - } { - want := tcGroup.want - for _, tc := range tcGroup.hexAddrs { - tcName := fmt.Sprintf("want %s, %s", want, tc.testCaseName) - s.Run(tcName, func() { - got, err := eth.NewHexAddrFromStr(tc.hexAddr) - - // gethcommon.Address input should give the same thing - got2 := eth.NewHexAddr(gethcommon.HexToAddress(tc.hexAddr)) - if tc.wantNotEqual { - s.NotEqual(want, got) - s.NotEqual(want.ToAddr(), got.ToAddr()) - s.NotEqual(want, got2) - s.NotEqual(want.ToAddr(), got2.ToAddr()) - s.Require().Error(err) - return - } else { - // string input should give the canonical HexAddr - s.Equal(want, got) - s.Equal(want.ToAddr(), got.ToAddr()) - - // gethcommon.Address input should give the same thing - got2 := eth.NewHexAddr(gethcommon.HexToAddress(tc.hexAddr)) - s.Equal(want, got2) - s.Equal(want.ToAddr(), got2.ToAddr()) - } - - s.Require().NoError(err) - }) - } - } -} - -// TestHexAddr_Valid: Test that demonstrates -func (s *Suite) TestHexAddr_Valid() { - for _, tc := range []struct { - name string - hexAddr string - wantErr string - }{ - { - name: "happy 0", - hexAddr: threeValidAddrs[0].String(), - }, - { - name: "happy 1", - hexAddr: threeValidAddrs[1].String(), - }, - { - name: "happy 2", - hexAddr: threeValidAddrs[2].String(), - }, - { - name: "0x prefix: missing", - hexAddr: "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", - wantErr: eth.HexAddrError, - }, - { - name: "0x prefix: typo", - hexAddr: "0XAe967917c465db8578ca9024c205720b1a3651A9", - wantErr: eth.HexAddrError, - }, - { - name: "mixed case checksum not valid according to ERC55", - hexAddr: "0xae967917c465db8578ca9024c205720b1a3651A9", - wantErr: eth.HexAddrError, - }, - { - name: "sad 1", - hexAddr: "0x5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", - wantErr: eth.HexAddrError, - }, - } { - s.Run(tc.name, func() { - err := eth.HexAddr(tc.hexAddr).Valid() - if tc.wantErr != "" { - s.Require().ErrorContains(err, tc.wantErr) - return - } - s.Require().NoError(err) - }) - } -} - -func withQuotes(s string) string { return fmt.Sprintf("\"%s\"", s) } - -func withoutQuotes(s string) string { - return strings.TrimPrefix(strings.TrimSuffix(s, "\""), "\"") -} - -func (s *Suite) TestProtobufEncoding() { - for tcIdx, tc := range []struct { - given eth.HexAddr - json string - wantErr string - }{ - { - given: threeValidAddrs[0], - json: withQuotes(threeValidAddrs[0].String()), - }, - { - given: threeValidAddrs[1], - json: withQuotes(threeValidAddrs[1].String()), - }, - { - given: threeValidAddrs[2], - json: withQuotes(threeValidAddrs[2].String()), - }, - } { - s.Run(strconv.Itoa(tcIdx), func() { - givenMut := tc.given - jsonBz, err := givenMut.MarshalJSON() - s.NoError(err) - s.Equal(tc.json, string(jsonBz)) - - err = (&givenMut).UnmarshalJSON(jsonBz) - s.NoError(err) - s.Equal(givenMut, tc.given, - "Given -> MarshalJSON -> UnmarshalJSON returns a different value than the given when it should be an identity operation (no-op). test case #%d", tcIdx) - - bz, err := tc.given.Marshal() - s.NoError(err) - jsonBzWithoutQuotes := withoutQuotes(tc.json) - s.Equal(jsonBzWithoutQuotes, string(bz), - "Marshaling to bytes gives different value than the test case specifies. test case #%d", tcIdx) - - err = (&givenMut).Unmarshal(bz) - s.NoError(err) - s.Equal(tc.given, givenMut, - "Given -> Marshal -> Unmarshal returns a different value than the given when it should be an identity operation (no-op). test case #%d", tcIdx) - - s.Equal(len(tc.given), tc.given.Size()) - s.Equal(len(tc.json), tc.given.Size()+2) - }) - } -} - -func (s *Suite) TestHexAddrToString() { - hexAddr := eth.HexAddr("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed") - s.Equal("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", hexAddr.String()) - s.Equal("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", string(hexAddr)) - - ethAddr := gethcommon.HexToAddress("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed") - s.Equal("0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed", ethAddr.String()) -} diff --git a/proto/eth/evm/v1/evm.proto b/proto/eth/evm/v1/evm.proto index 9bc560a52..ce50798a7 100644 --- a/proto/eth/evm/v1/evm.proto +++ b/proto/eth/evm/v1/evm.proto @@ -13,7 +13,7 @@ option go_package = "github.com/NibiruChain/nibiru/v2/x/evm"; message FunToken { // Hexadecimal address of the ERC20 token to which the `FunToken` maps string erc20_addr = 1 [ - (gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.HexAddr", + (gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.EIP55Addr", (gogoproto.nullable) = false ]; diff --git a/proto/eth/evm/v1/tx.proto b/proto/eth/evm/v1/tx.proto index 583a6c598..e97a81e5c 100644 --- a/proto/eth/evm/v1/tx.proto +++ b/proto/eth/evm/v1/tx.proto @@ -194,7 +194,7 @@ message MsgUpdateParamsResponse {} message MsgCreateFunToken { // Hexadecimal address of the ERC20 token to which the `FunToken` maps string from_erc20 = 1 [ - (gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.HexAddr", + (gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.EIP55Addr", (gogoproto.nullable) = true ]; @@ -214,7 +214,7 @@ message MsgCreateFunTokenResponse { message MsgConvertCoinToEvm { // Hexadecimal address of the ERC20 token to which the `FunToken` maps string to_eth_addr = 1 [ - (gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.HexAddr", + (gogoproto.customtype) = "github.com/NibiruChain/nibiru/v2/eth.EIP55Addr", (gogoproto.nullable) = false ]; diff --git a/x/evm/cli/tx.go b/x/evm/cli/tx.go index 9ee6ad88a..c8a625a21 100644 --- a/x/evm/cli/tx.go +++ b/x/evm/cli/tx.go @@ -84,7 +84,7 @@ func CmdCreateFunTokenFromERC20() *cobra.Command { txFactory = txFactory. WithTxConfig(clientCtx.TxConfig). WithAccountRetriever(clientCtx.AccountRetriever) - erc20Addr, err := eth.NewHexAddrFromStr(args[0]) + erc20Addr, err := eth.NewEIP55AddrFromStr(args[0]) if err != nil { return err } @@ -118,6 +118,11 @@ func ConvertCoinToEvm() *cobra.Command { WithTxConfig(clientCtx.TxConfig). WithAccountRetriever(clientCtx.AccountRetriever) + eip55Addr, err := eth.NewEIP55AddrFromStr(args[0]) + if err != nil { + return err + } + coin, err := sdk.ParseCoinNormalized(args[1]) if err != nil { return err @@ -125,7 +130,7 @@ func ConvertCoinToEvm() *cobra.Command { msg := &evm.MsgConvertCoinToEvm{ Sender: clientCtx.GetFromAddress().String(), BankCoin: coin, - ToEthAddr: eth.MustNewHexAddrFromStr(args[0]), + ToEthAddr: eip55Addr, } return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txFactory, msg) }, diff --git a/x/evm/evm.go b/x/evm/evm.go index b991acaa1..d0e368aad 100644 --- a/x/evm/evm.go +++ b/x/evm/evm.go @@ -15,10 +15,10 @@ import ( // tokens that are valid ERC20s with the same address. // https://github.com/NibiruChain/nibiru/issues/1933 func (fun FunToken) ID() []byte { - return NewFunTokenID(fun.Erc20Addr, fun.BankDenom) + return NewFunTokenID(fun.Erc20Addr.Address, fun.BankDenom) } -func NewFunTokenID(erc20 eth.HexAddr, bankDenom string) []byte { +func NewFunTokenID(erc20 gethcommon.Address, bankDenom string) []byte { return tmhash.Sum([]byte(erc20.String() + "|" + bankDenom)) } @@ -31,10 +31,6 @@ func (fun FunToken) Validate() error { return funTokenValidationError(err) } - if err := fun.Erc20Addr.Valid(); err != nil { - return funTokenValidationError(err) - } - return nil } @@ -45,7 +41,9 @@ func NewFunToken( erc20 gethcommon.Address, bankDenom string, isMadeFromCoin bool, ) FunToken { return FunToken{ - Erc20Addr: eth.NewHexAddr(erc20), + Erc20Addr: eth.EIP55Addr{ + Address: erc20, + }, BankDenom: bankDenom, IsMadeFromCoin: isMadeFromCoin, } diff --git a/x/evm/evm.pb.go b/x/evm/evm.pb.go index 2136ccecb..c8e6bebf3 100644 --- a/x/evm/evm.pb.go +++ b/x/evm/evm.pb.go @@ -31,7 +31,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // "Coin" type in Golang. type FunToken struct { // Hexadecimal address of the ERC20 token to which the `FunToken` maps - Erc20Addr github_com_NibiruChain_nibiru_v2_eth.HexAddr `protobuf:"bytes,1,opt,name=erc20_addr,json=erc20Addr,proto3,customtype=github.com/NibiruChain/nibiru/v2/eth.HexAddr" json:"erc20_addr"` + Erc20Addr github_com_NibiruChain_nibiru_v2_eth.EIP55Addr `protobuf:"bytes,1,opt,name=erc20_addr,json=erc20Addr,proto3,customtype=github.com/NibiruChain/nibiru/v2/eth.EIP55Addr" json:"erc20_addr"` // bank_denom: Coin denomination in the Bank Module. BankDenom string `protobuf:"bytes,2,opt,name=bank_denom,json=bankDenom,proto3" json:"bank_denom,omitempty"` // True if the `FunToken` mapping was created from an existing bank coin and @@ -637,77 +637,78 @@ func init() { func init() { proto.RegisterFile("eth/evm/v1/evm.proto", fileDescriptor_98abbdadb327b7d0) } var fileDescriptor_98abbdadb327b7d0 = []byte{ - // 1120 bytes of a gzipped FileDescriptorProto + // 1123 bytes of a gzipped FileDescriptorProto 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 0x5d, 0x7b, 0xe3, 0xed, 0xbb, + 0xf6, 0xc6, 0xef, 0xef, 0xda, 0x1b, 0xdf, 0x7d, 0xfc, 0xbf, 0x7f, 0xc5, 0x85, 0xfc, 0x1d, 0x4f, + 0xb6, 0xd4, 0xdf, 0xf6, 0xb3, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa2, 0xa8, 0xe3, 0xf2, 0xa7, + 0x07, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { diff --git a/x/evm/evm_test.go b/x/evm/evm_test.go index 4d653cdd2..d6eb1f5f1 100644 --- a/x/evm/evm_test.go +++ b/x/evm/evm_test.go @@ -26,59 +26,53 @@ func TestSuite_RunAll(t *testing.T) { } func (s *TestSuite) TestFunToken() { - for testIdx, tc := range []struct { + for idx, tc := range []struct { bankDenom string - erc20Addr eth.HexAddr - wantErr string + input string + wantErr bool }{ { // sad: Invalid bank denom bankDenom: "", - erc20Addr: eth.HexAddr(""), - wantErr: "FunTokenError", + input: "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", + wantErr: true, }, { bankDenom: "unibi", - erc20Addr: eth.MustNewHexAddrFromStr("5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"), - wantErr: "", + input: "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", }, { bankDenom: "unibi", - erc20Addr: eth.MustNewHexAddrFromStr("5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED"), - wantErr: "", + input: "5AAEB6053F3E94C9B9A09F33669435E7EF1BEAED", }, { - // NOTE: notice how this one errors using the same happy path - // input as above because an unsafe constructor was used. - // Naked type overrides should not be used with eth.HexAddr. - // Always use NewHexAddr, NewHexAddrFromStr, or MustNewHexAddr... bankDenom: "unibi", - erc20Addr: eth.HexAddr("5aaeb6053f3e94c9b9a09f33669435e7ef1beaed"), - wantErr: "not encoded as expected", + input: "5aaeb6053f3e94c9b9a09f33669435e7ef1beaed", }, { bankDenom: "ibc/AAA/BBB", - erc20Addr: eth.MustNewHexAddrFromStr("0xE1aA1500b962528cBB42F05bD6d8A6032a85602f"), - wantErr: "", + input: "0xE1aA1500b962528cBB42F05bD6d8A6032a85602f", }, { bankDenom: "tf/contract-addr/subdenom", - erc20Addr: eth.MustNewHexAddrFromStr("0x6B2e60f1030aFa69F584829f1d700b47eE5Fc74a"), - wantErr: "", + input: "0x6B2e60f1030aFa69F584829f1d700b47eE5Fc74a", }, } { - s.Run(strconv.Itoa(testIdx), func() { + s.Run(strconv.Itoa(idx), func() { + eip55Addr, err := eth.NewEIP55AddrFromStr(tc.input) + s.Require().NoError(err) + funtoken := evm.FunToken{ - Erc20Addr: tc.erc20Addr, + Erc20Addr: eip55Addr, BankDenom: tc.bankDenom, } - err := funtoken.Validate() - if tc.wantErr != "" { - s.Require().Error(err, "funtoken %s", funtoken) + if tc.wantErr { + s.Require().Error(funtoken.Validate()) return } - s.Require().NoError(err) + + s.Require().NoError(funtoken.Validate()) }) } @@ -109,10 +103,16 @@ func (s *TestSuite) TestFunToken() { }, } { s.Run(tc.name, func() { - funA := evm.FunToken{Erc20Addr: eth.HexAddr(tc.A)} - funB := evm.FunToken{Erc20Addr: eth.HexAddr(tc.B)} + addrA, err := eth.NewEIP55AddrFromStr(tc.A) + s.Require().NoError(err) + + addrB, err := eth.NewEIP55AddrFromStr(tc.B) + s.Require().NoError(err) + + funA := evm.FunToken{Erc20Addr: addrA} + funB := evm.FunToken{Erc20Addr: addrB} - s.EqualValues(funA.Erc20Addr.ToAddr(), funB.Erc20Addr.ToAddr()) + s.EqualValues(funA.Erc20Addr.Address, funB.Erc20Addr.Address) }) } } diff --git a/x/evm/evmmodule/genesis_test.go b/x/evm/evmmodule/genesis_test.go index bc6a3d081..690745e84 100644 --- a/x/evm/evmmodule/genesis_test.go +++ b/x/evm/evmmodule/genesis_test.go @@ -64,7 +64,7 @@ func (s *Suite) TestExportInitGenesis() { // Create fungible token from bank coin funToken := evmtest.CreateFunTokenForBankCoin(&deps, "unibi", &s.Suite) s.Require().NoError(err) - funTokenAddr := funToken.Erc20Addr.ToAddr() + funTokenAddr := funToken.Erc20Addr.Address // Fund sender's wallet spendableCoins := sdk.NewCoins(sdk.NewInt64Coin("unibi", totalSupply.Int64())) @@ -75,13 +75,15 @@ func (s *Suite) TestExportInitGenesis() { ) s.Require().NoError(err) + eip55Addr, err := eth.NewEIP55AddrFromStr(toUserC.String()) + s.Require().NoError(err) // Send fungible token coins from bank to evm _, err = deps.EvmKeeper.ConvertCoinToEvm( deps.Ctx, &evm.MsgConvertCoinToEvm{ Sender: deps.Sender.NibiruAddr.String(), BankCoin: sdk.Coin{Denom: "unibi", Amount: math.NewInt(amountToSendC.Int64())}, - ToEthAddr: eth.MustNewHexAddrFromStr(toUserC.String()), + ToEthAddr: eip55Addr, }, ) s.Require().NoError(err) diff --git a/x/evm/evmtest/eth_test.go b/x/evm/evmtest/eth_test.go index 60e2087ee..612beb05d 100644 --- a/x/evm/evmtest/eth_test.go +++ b/x/evm/evmtest/eth_test.go @@ -35,13 +35,11 @@ func (s *Suite) TestSampleFns() { func (s *Suite) TestERC20Helpers() { deps := evmtest.NewTestDeps() - bankDenom := "token" - funtoken := evmtest.CreateFunTokenForBankCoin(&deps, bankDenom, &s.Suite) - erc20Contract := funtoken.Erc20Addr.ToAddr() + funtoken := evmtest.CreateFunTokenForBankCoin(&deps, "token", &s.Suite) evmtest.AssertERC20BalanceEqual( s.T(), deps, - erc20Contract, + funtoken.Erc20Addr.Address, deps.Sender.EthAddr, big.NewInt(0), ) diff --git a/x/evm/keeper/erc20_test.go b/x/evm/keeper/erc20_test.go index 58d001eb5..d328ea4e6 100644 --- a/x/evm/keeper/erc20_test.go +++ b/x/evm/keeper/erc20_test.go @@ -12,7 +12,7 @@ func (s *Suite) TestERC20Calls() { deps := evmtest.NewTestDeps() bankDenom := "ibc/btc" funtoken := evmtest.CreateFunTokenForBankCoin(&deps, bankDenom, &s.Suite) - contract := funtoken.Erc20Addr.ToAddr() + contract := funtoken.Erc20Addr.Address s.T().Log("Mint tokens - Fail from non-owner") { diff --git a/x/evm/keeper/funtoken_from_coin.go b/x/evm/keeper/funtoken_from_coin.go index 30592a747..82d7017f6 100644 --- a/x/evm/keeper/funtoken_from_coin.go +++ b/x/evm/keeper/funtoken_from_coin.go @@ -41,7 +41,9 @@ func (k *Keeper) createFunTokenFromCoin( // 5 | Officially create the funtoken mapping funtoken = &evm.FunToken{ - Erc20Addr: eth.NewHexAddr(erc20Addr), + Erc20Addr: eth.EIP55Addr{ + Address: erc20Addr, + }, BankDenom: bankDenom, IsMadeFromCoin: true, } diff --git a/x/evm/keeper/funtoken_from_coin_test.go b/x/evm/keeper/funtoken_from_coin_test.go index 4ae2355a4..cb9b87ffb 100644 --- a/x/evm/keeper/funtoken_from_coin_test.go +++ b/x/evm/keeper/funtoken_from_coin_test.go @@ -109,7 +109,7 @@ func (s *FunTokenFromCoinSuite) TestCreateFunTokenFromCoin() { s.Require().NoError(err) s.T().Log("Expect ERC20 metadata on contract") - info, err := deps.EvmKeeper.FindERC20Metadata(deps.Ctx, erc20Addr.ToAddr()) + info, err := deps.EvmKeeper.FindERC20Metadata(deps.Ctx, erc20Addr.Address) s.Require().NoError(err, info) s.Equal( keeper.ERC20Metadata{ @@ -210,9 +210,11 @@ func (s *FunTokenFromCoinSuite) TestConvertCoinToEvmAndBack() { _, err = deps.EvmKeeper.ConvertCoinToEvm( sdk.WrapSDKContext(deps.Ctx), &evm.MsgConvertCoinToEvm{ - Sender: deps.Sender.NibiruAddr.String(), - BankCoin: sdk.NewCoin(bankDenom, sdk.NewInt(10)), - ToEthAddr: eth.NewHexAddr(alice.EthAddr), + Sender: deps.Sender.NibiruAddr.String(), + BankCoin: sdk.NewCoin(bankDenom, sdk.NewInt(10)), + ToEthAddr: eth.EIP55Addr{ + Address: alice.EthAddr, + }, }, ) s.Require().NoError(err) @@ -238,7 +240,7 @@ func (s *FunTokenFromCoinSuite) TestConvertCoinToEvmAndBack() { s.Require().Equal(sdk.NewInt(90), senderBalance.Amount) // Check 3: erc-20 balance - balance, err := deps.EvmKeeper.ERC20().BalanceOf(funTokenErc20Addr.ToAddr(), alice.EthAddr, deps.Ctx) + balance, err := deps.EvmKeeper.ERC20().BalanceOf(funTokenErc20Addr.Address, alice.EthAddr, deps.Ctx) s.Require().NoError(err) s.Require().Zero(balance.Cmp(big.NewInt(10))) @@ -246,9 +248,11 @@ func (s *FunTokenFromCoinSuite) TestConvertCoinToEvmAndBack() { _, err = deps.EvmKeeper.ConvertCoinToEvm( sdk.WrapSDKContext(deps.Ctx), &evm.MsgConvertCoinToEvm{ - Sender: deps.Sender.NibiruAddr.String(), - BankCoin: sdk.NewCoin(bankDenom, sdk.NewInt(100)), - ToEthAddr: eth.NewHexAddr(alice.EthAddr), + Sender: deps.Sender.NibiruAddr.String(), + BankCoin: sdk.NewCoin(bankDenom, sdk.NewInt(100)), + ToEthAddr: eth.EIP55Addr{ + Address: alice.EthAddr, + }, }, ) s.Require().ErrorContains(err, "insufficient funds") @@ -261,7 +265,7 @@ func (s *FunTokenFromCoinSuite) TestConvertCoinToEvmAndBack() { &precompile.PrecompileAddr_FunToken, true, "bankSend", - funTokenErc20Addr.ToAddr(), + funTokenErc20Addr.Address, big.NewInt(10), deps.Sender.NibiruAddr.String(), ) @@ -276,7 +280,7 @@ func (s *FunTokenFromCoinSuite) TestConvertCoinToEvmAndBack() { s.Require().Equal(sdk.NewInt(100), senderBalance.Amount) // Check 3: erc-20 balance - balance, err = deps.EvmKeeper.ERC20().BalanceOf(funTokenErc20Addr.ToAddr(), alice.EthAddr, deps.Ctx) + balance, err = deps.EvmKeeper.ERC20().BalanceOf(funTokenErc20Addr.Address, alice.EthAddr, deps.Ctx) s.Require().NoError(err) s.Require().Zero(balance.Cmp(big.NewInt(0))) @@ -288,7 +292,7 @@ func (s *FunTokenFromCoinSuite) TestConvertCoinToEvmAndBack() { &precompile.PrecompileAddr_FunToken, true, "bankSend", - funTokenErc20Addr.ToAddr(), + funTokenErc20Addr.Address, big.NewInt(10), deps.Sender.NibiruAddr.String(), ) diff --git a/x/evm/keeper/funtoken_from_erc20.go b/x/evm/keeper/funtoken_from_erc20.go index 1da6d411a..ab7186aa3 100644 --- a/x/evm/keeper/funtoken_from_erc20.go +++ b/x/evm/keeper/funtoken_from_erc20.go @@ -139,14 +139,14 @@ func (k *Keeper) createFunTokenFromERC20( // 5 | Officially create the funtoken mapping funtoken = &evm.FunToken{ - Erc20Addr: eth.NewHexAddr(erc20), + Erc20Addr: eth.EIP55Addr{ + Address: erc20, + }, BankDenom: bankDenom, IsMadeFromCoin: false, } return funtoken, k.FunTokens.SafeInsert( - ctx, funtoken.Erc20Addr.ToAddr(), - funtoken.BankDenom, - funtoken.IsMadeFromCoin, + ctx, erc20, bankDenom, false, ) } diff --git a/x/evm/keeper/funtoken_from_erc20_test.go b/x/evm/keeper/funtoken_from_erc20_test.go index 13af650da..e09d4e748 100644 --- a/x/evm/keeper/funtoken_from_erc20_test.go +++ b/x/evm/keeper/funtoken_from_erc20_test.go @@ -50,7 +50,9 @@ func (s *FunTokenFromErc20Suite) TestCreateFunTokenFromERC20() { }) s.Require().NoError(err) - erc20Addr := eth.NewHexAddr(deployResp.ContractAddr) + erc20Addr := eth.EIP55Addr{ + Address: deployResp.ContractAddr, + } s.T().Log("sad: insufficient funds to create FunToken mapping") _, err = deps.EvmKeeper.CreateFunToken( @@ -155,7 +157,6 @@ func (s *FunTokenFromErc20Suite) TestSendFromEvmToCosmos() { metadata.Name, metadata.Symbol, metadata.Decimals, ) s.Require().NoError(err) - erc20Addr := eth.NewHexAddr(deployResp.ContractAddr) s.T().Log("CreateFunToken for the ERC20") s.Require().NoError(testapp.FundAccount( @@ -168,20 +169,21 @@ func (s *FunTokenFromErc20Suite) TestSendFromEvmToCosmos() { resp, err := deps.EvmKeeper.CreateFunToken( sdk.WrapSDKContext(deps.Ctx), &evm.MsgCreateFunToken{ - FromErc20: &erc20Addr, - Sender: deps.Sender.NibiruAddr.String(), + FromErc20: ð.EIP55Addr{ + Address: deployResp.ContractAddr, + }, + Sender: deps.Sender.NibiruAddr.String(), }, ) - s.Require().NoError(err, "erc20 %s", erc20Addr) + s.Require().NoError(err, "erc20 %s", deployResp.ContractAddr) bankDemon := resp.FuntokenMapping.BankDenom s.T().Logf("mint erc20 tokens to %s", deps.Sender.EthAddr.String()) - erc20 := erc20Addr.ToAddr() _, err = deps.EvmKeeper.CallContract( deps.Ctx, embeds.SmartContract_ERC20Minter.ABI, deps.Sender.EthAddr, - &erc20, + &deployResp.ContractAddr, true, "mint", deps.Sender.EthAddr, @@ -199,15 +201,15 @@ func (s *FunTokenFromErc20Suite) TestSendFromEvmToCosmos() { &precompile.PrecompileAddr_FunToken, true, "bankSend", - erc20Addr.ToAddr(), + deployResp.ContractAddr, big.NewInt(1), randomAcc.String(), ) s.Require().NoError(err) s.T().Log("check balances") - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20, deps.Sender.EthAddr, big.NewInt(69_419)) - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20, evm.EVM_MODULE_ADDRESS, big.NewInt(1)) + evmtest.AssertERC20BalanceEqual(s.T(), deps, deployResp.ContractAddr, deps.Sender.EthAddr, big.NewInt(69_419)) + evmtest.AssertERC20BalanceEqual(s.T(), deps, deployResp.ContractAddr, evm.EVM_MODULE_ADDRESS, big.NewInt(1)) s.Require().Equal(sdk.NewInt(1), deps.App.BankKeeper.GetBalance(deps.Ctx, randomAcc, bankDemon).Amount, ) @@ -220,7 +222,7 @@ func (s *FunTokenFromErc20Suite) TestSendFromEvmToCosmos() { &precompile.PrecompileAddr_FunToken, true, "bankSend", - erc20Addr.ToAddr(), + deployResp.ContractAddr, big.NewInt(70_000), randomAcc.String(), ) @@ -229,16 +231,18 @@ func (s *FunTokenFromErc20Suite) TestSendFromEvmToCosmos() { s.T().Log("send cosmos tokens back to erc20") _, err = deps.EvmKeeper.ConvertCoinToEvm(sdk.WrapSDKContext(deps.Ctx), &evm.MsgConvertCoinToEvm{ - ToEthAddr: eth.NewHexAddr(deps.Sender.EthAddr), - Sender: randomAcc.String(), - BankCoin: sdk.NewCoin(bankDemon, sdk.NewInt(1)), + ToEthAddr: eth.EIP55Addr{ + Address: deps.Sender.EthAddr, + }, + Sender: randomAcc.String(), + BankCoin: sdk.NewCoin(bankDemon, sdk.NewInt(1)), }, ) s.Require().NoError(err) s.T().Log("check balances") - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20, deps.Sender.EthAddr, big.NewInt(69_420)) - evmtest.AssertERC20BalanceEqual(s.T(), deps, erc20, evm.EVM_MODULE_ADDRESS, big.NewInt(0)) + evmtest.AssertERC20BalanceEqual(s.T(), deps, deployResp.ContractAddr, deps.Sender.EthAddr, big.NewInt(69_420)) + evmtest.AssertERC20BalanceEqual(s.T(), deps, deployResp.ContractAddr, evm.EVM_MODULE_ADDRESS, big.NewInt(0)) s.Require().True( deps.App.BankKeeper.GetBalance(deps.Ctx, randomAcc, bankDemon).Amount.Equal(sdk.NewInt(0)), ) @@ -246,9 +250,11 @@ func (s *FunTokenFromErc20Suite) TestSendFromEvmToCosmos() { s.T().Log("sad: send too many cosmos tokens back to erc20") _, err = deps.EvmKeeper.ConvertCoinToEvm(sdk.WrapSDKContext(deps.Ctx), &evm.MsgConvertCoinToEvm{ - ToEthAddr: eth.NewHexAddr(deps.Sender.EthAddr), - Sender: randomAcc.String(), - BankCoin: sdk.NewCoin(bankDemon, sdk.NewInt(1)), + ToEthAddr: eth.EIP55Addr{ + Address: deps.Sender.EthAddr, + }, + Sender: randomAcc.String(), + BankCoin: sdk.NewCoin(bankDemon, sdk.NewInt(1)), }, ) s.Require().Error(err) diff --git a/x/evm/keeper/funtoken_state.go b/x/evm/keeper/funtoken_state.go index a1966148c..c8f36fa07 100644 --- a/x/evm/keeper/funtoken_state.go +++ b/x/evm/keeper/funtoken_state.go @@ -33,7 +33,7 @@ func NewFunTokenState( eth.KeyEncoderEthAddr, // indexing key (IK): ERC-20 addr primaryKeyEncoder, func(v evm.FunToken) gethcommon.Address { - return v.Erc20Addr.ToAddr() + return v.Erc20Addr.Address }, ), BankDenom: collections.NewMultiIndex( diff --git a/x/evm/keeper/funtoken_state_test.go b/x/evm/keeper/funtoken_state_test.go index d16b616b1..32ba7d3ed 100644 --- a/x/evm/keeper/funtoken_state_test.go +++ b/x/evm/keeper/funtoken_state_test.go @@ -3,7 +3,6 @@ package keeper_test import ( gethcommon "github.com/ethereum/go-ethereum/common" - "github.com/NibiruChain/nibiru/v2/eth" "github.com/NibiruChain/nibiru/v2/x/evm" "github.com/NibiruChain/nibiru/v2/x/evm/evmtest" ) @@ -21,9 +20,9 @@ func (s *Suite) TestInsertAndGet() { s.Require().NoError(err) // test Get - funToken, err := deps.EvmKeeper.FunTokens.Get(deps.Ctx, evm.NewFunTokenID(eth.NewHexAddr(erc20Addr), "unibi")) + funToken, err := deps.EvmKeeper.FunTokens.Get(deps.Ctx, evm.NewFunTokenID(erc20Addr, "unibi")) s.Require().NoError(err) - s.Require().Equal(eth.HexAddr("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), funToken.Erc20Addr) + s.Require().Equal(gethcommon.HexToAddress("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), funToken.Erc20Addr.Address) s.Require().Equal("unibi", funToken.BankDenom) s.Require().True(funToken.IsMadeFromCoin) @@ -47,7 +46,7 @@ func (s *Suite) TestCollect() { iter := deps.EvmKeeper.FunTokens.Indexes.BankDenom.ExactMatch(deps.Ctx, "unibi") funTokens := deps.EvmKeeper.FunTokens.Collect(deps.Ctx, iter) s.Require().Len(funTokens, 1) - s.Require().Equal(eth.HexAddr("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), funTokens[0].Erc20Addr) + s.Require().Equal(gethcommon.HexToAddress("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), funTokens[0].Erc20Addr.Address) s.Require().Equal("unibi", funTokens[0].BankDenom) s.Require().True(funTokens[0].IsMadeFromCoin) @@ -55,7 +54,7 @@ func (s *Suite) TestCollect() { iter2 := deps.EvmKeeper.FunTokens.Indexes.ERC20Addr.ExactMatch(deps.Ctx, erc20Addr) funTokens = deps.EvmKeeper.FunTokens.Collect(deps.Ctx, iter2) s.Require().Len(funTokens, 1) - s.Require().Equal(eth.HexAddr("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), funTokens[0].Erc20Addr) + s.Require().Equal(gethcommon.HexToAddress("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), funTokens[0].Erc20Addr.Address) s.Require().Equal("unibi", funTokens[0].BankDenom) s.Require().True(funTokens[0].IsMadeFromCoin) } @@ -73,10 +72,10 @@ func (s *Suite) TestDelete() { s.Require().NoError(err) // test Delete - err = deps.EvmKeeper.FunTokens.Delete(deps.Ctx, evm.NewFunTokenID(eth.NewHexAddr(erc20Addr), "unibi")) + err = deps.EvmKeeper.FunTokens.Delete(deps.Ctx, evm.NewFunTokenID(erc20Addr, "unibi")) s.Require().NoError(err) // test Get - _, err = deps.EvmKeeper.FunTokens.Get(deps.Ctx, evm.NewFunTokenID(eth.NewHexAddr(erc20Addr), "unibi")) + _, err = deps.EvmKeeper.FunTokens.Get(deps.Ctx, evm.NewFunTokenID(erc20Addr, "unibi")) s.Require().Error(err) } diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index be0bdc8bd..2a1e2b86b 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -931,7 +931,9 @@ func (s *Suite) TestQueryFunTokenMapping() { } wantResp = &evm.QueryFunTokenMappingResponse{ FunToken: &evm.FunToken{ - Erc20Addr: "0xAEf9437FF23D48D73271a41a8A094DEc9ac71477", + Erc20Addr: eth.EIP55Addr{ + Address: gethcommon.HexToAddress("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), + }, BankDenom: "unibi", IsMadeFromCoin: true, }, @@ -956,7 +958,9 @@ func (s *Suite) TestQueryFunTokenMapping() { } wantResp = &evm.QueryFunTokenMappingResponse{ FunToken: &evm.FunToken{ - Erc20Addr: "0xAEf9437FF23D48D73271a41a8A094DEc9ac71477", + Erc20Addr: eth.EIP55Addr{ + Address: gethcommon.HexToAddress("0xAEf9437FF23D48D73271a41a8A094DEc9ac71477"), + }, BankDenom: "unibi", IsMadeFromCoin: true, }, diff --git a/x/evm/keeper/msg_server.go b/x/evm/keeper/msg_server.go index f7b3b3d7f..275735d0a 100644 --- a/x/evm/keeper/msg_server.go +++ b/x/evm/keeper/msg_server.go @@ -500,7 +500,7 @@ func (k *Keeper) CreateFunToken( emptyErc20 := msg.FromErc20 == nil || msg.FromErc20.Size() == 0 switch { case !emptyErc20 && msg.FromBankDenom == "": - funtoken, err = k.createFunTokenFromERC20(ctx, msg.FromErc20.ToAddr()) + funtoken, err = k.createFunTokenFromERC20(ctx, msg.FromErc20.Address) case emptyErc20 && msg.FromBankDenom != "": funtoken, err = k.createFunTokenFromCoin(ctx, msg.FromBankDenom) default: @@ -552,7 +552,6 @@ func (k *Keeper) ConvertCoinToEvm( ctx := sdk.UnwrapSDKContext(goCtx) sender := sdk.MustAccAddressFromBech32(msg.Sender) - ethRecipient := msg.ToEthAddr.ToAddr() funTokens := k.FunTokens.Collect(ctx, k.FunTokens.Indexes.BankDenom.ExactMatch(ctx, msg.BankCoin.Denom)) if len(funTokens) == 0 { @@ -565,9 +564,9 @@ func (k *Keeper) ConvertCoinToEvm( fungibleTokenMapping := funTokens[0] if fungibleTokenMapping.IsMadeFromCoin { - return k.convertCoinNativeCoin(ctx, sender, ethRecipient, msg.BankCoin, fungibleTokenMapping) + return k.convertCoinNativeCoin(ctx, sender, msg.ToEthAddr.Address, msg.BankCoin, fungibleTokenMapping) } else { - return k.convertCoinNativeERC20(ctx, sender, ethRecipient, msg.BankCoin, fungibleTokenMapping) + return k.convertCoinNativeERC20(ctx, sender, msg.ToEthAddr.Address, msg.BankCoin, fungibleTokenMapping) } } @@ -578,7 +577,7 @@ func (k Keeper) convertCoinNativeCoin( sender sdk.AccAddress, recipient gethcommon.Address, coin sdk.Coin, - fungibleTokenMapping evm.FunToken, + funTokenMapping evm.FunToken, ) (*evm.MsgConvertCoinToEvmResponse, error) { // Step 1: Escrow bank coins with EVM module account err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, evm.ModuleName, sdk.NewCoins(coin)) @@ -586,14 +585,14 @@ func (k Keeper) convertCoinNativeCoin( return nil, errors.Wrap(err, "failed to send coins to module account") } - erc20ContractAddr := fungibleTokenMapping.Erc20Addr.ToAddr() + erc20Addr := funTokenMapping.Erc20Addr.Address // Step 2: mint ERC-20 tokens for recipient evmResp, err := k.CallContract( ctx, embeds.SmartContract_ERC20Minter.ABI, evm.EVM_MODULE_ADDRESS, - &erc20ContractAddr, + &erc20Addr, true, "mint", recipient, @@ -604,11 +603,11 @@ func (k Keeper) convertCoinNativeCoin( } if evmResp.Failed() { return nil, - fmt.Errorf("failed to mint erc-20 tokens of contract %s", erc20ContractAddr.String()) + fmt.Errorf("failed to mint erc-20 tokens of contract %s", erc20Addr.String()) } _ = ctx.EventManager().EmitTypedEvent(&evm.EventConvertCoinToEvm{ Sender: sender.String(), - Erc20ContractAddress: erc20ContractAddr.String(), + Erc20ContractAddress: erc20Addr.String(), ToEthAddr: recipient.String(), BankCoin: coin, }) @@ -624,9 +623,9 @@ func (k Keeper) convertCoinNativeERC20( sender sdk.AccAddress, recipient gethcommon.Address, coin sdk.Coin, - fungibleTokenMapping evm.FunToken, + funTokenMapping evm.FunToken, ) (*evm.MsgConvertCoinToEvmResponse, error) { - erc20Addr := fungibleTokenMapping.Erc20Addr.ToAddr() + erc20Addr := funTokenMapping.Erc20Addr.Address recipientBalanceBefore, err := k.ERC20().BalanceOf(erc20Addr, recipient, ctx) if err != nil { @@ -700,7 +699,7 @@ func (k Keeper) convertCoinNativeERC20( _ = ctx.EventManager().EmitTypedEvent(&evm.EventConvertCoinToEvm{ Sender: sender.String(), - Erc20ContractAddress: fungibleTokenMapping.Erc20Addr.String(), + Erc20ContractAddress: funTokenMapping.Erc20Addr.String(), ToEthAddr: recipient.String(), BankCoin: coin, }) diff --git a/x/evm/msg.go b/x/evm/msg.go index 3d10c5ff6..d7d190aca 100644 --- a/x/evm/msg.go +++ b/x/evm/msg.go @@ -525,7 +525,7 @@ func (m *MsgConvertCoinToEvm) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil { return fmt.Errorf("invalid sender addr") } - if m.ToEthAddr == "" { + if m.ToEthAddr.Address.String() == "" || m.ToEthAddr.Size() == 0 { return fmt.Errorf("empty to_eth_addr") } return nil diff --git a/x/evm/precompile/funtoken_test.go b/x/evm/precompile/funtoken_test.go index 629487596..14f6368ad 100644 --- a/x/evm/precompile/funtoken_test.go +++ b/x/evm/precompile/funtoken_test.go @@ -67,7 +67,7 @@ func (s *Suite) TestHappyPath() { s.T().Log("Create FunToken mapping and ERC20") bankDenom := "unibi" funtoken := evmtest.CreateFunTokenForBankCoin(&deps, bankDenom, &s.Suite) - contract := funtoken.Erc20Addr.ToAddr() + contract := funtoken.Erc20Addr.Address s.T().Log("Balances of the ERC20 should start empty") evmtest.AssertERC20BalanceEqual(s.T(), deps, contract, deps.Sender.EthAddr, big.NewInt(0)) @@ -83,9 +83,11 @@ func (s *Suite) TestHappyPath() { _, err := deps.EvmKeeper.ConvertCoinToEvm( sdk.WrapSDKContext(deps.Ctx), &evm.MsgConvertCoinToEvm{ - Sender: deps.Sender.NibiruAddr.String(), - BankCoin: sdk.NewCoin(bankDenom, sdk.NewInt(69_420)), - ToEthAddr: eth.NewHexAddr(deps.Sender.EthAddr), + Sender: deps.Sender.NibiruAddr.String(), + BankCoin: sdk.NewCoin(bankDenom, sdk.NewInt(69_420)), + ToEthAddr: eth.EIP55Addr{ + Address: deps.Sender.EthAddr, + }, }, ) s.Require().NoError(err) diff --git a/x/evm/tx.pb.go b/x/evm/tx.pb.go index 19daadd03..6c61d6357 100644 --- a/x/evm/tx.pb.go +++ b/x/evm/tx.pb.go @@ -447,7 +447,7 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo // denomination for a bank coin can be given to create the mapping to an ERC20. type MsgCreateFunToken struct { // Hexadecimal address of the ERC20 token to which the `FunToken` maps - FromErc20 *github_com_NibiruChain_nibiru_v2_eth.HexAddr `protobuf:"bytes,1,opt,name=from_erc20,json=fromErc20,proto3,customtype=github.com/NibiruChain/nibiru/v2/eth.HexAddr" json:"from_erc20,omitempty"` + FromErc20 *github_com_NibiruChain_nibiru_v2_eth.EIP55Addr `protobuf:"bytes,1,opt,name=from_erc20,json=fromErc20,proto3,customtype=github.com/NibiruChain/nibiru/v2/eth.EIP55Addr" json:"from_erc20,omitempty"` // Coin denomination in the Bank Module. FromBankDenom string `protobuf:"bytes,2,opt,name=from_bank_denom,json=fromBankDenom,proto3" json:"from_bank_denom,omitempty"` // Sender: Address for the signer of the transaction. @@ -549,7 +549,7 @@ func (m *MsgCreateFunTokenResponse) GetFuntokenMapping() FunToken { // MsgConvertCoinToEvm: Arguments to send a bank coin to ERC-20 representation type MsgConvertCoinToEvm struct { // Hexadecimal address of the ERC20 token to which the `FunToken` maps - ToEthAddr github_com_NibiruChain_nibiru_v2_eth.HexAddr `protobuf:"bytes,1,opt,name=to_eth_addr,json=toEthAddr,proto3,customtype=github.com/NibiruChain/nibiru/v2/eth.HexAddr" json:"to_eth_addr"` + ToEthAddr github_com_NibiruChain_nibiru_v2_eth.EIP55Addr `protobuf:"bytes,1,opt,name=to_eth_addr,json=toEthAddr,proto3,customtype=github.com/NibiruChain/nibiru/v2/eth.EIP55Addr" json:"to_eth_addr"` // Sender: Address for the signer of the transaction. Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` // Bank coin to get converted to ERC20 @@ -657,85 +657,85 @@ func init() { func init() { proto.RegisterFile("eth/evm/v1/tx.proto", fileDescriptor_82a0bfe4f0bab953) } var fileDescriptor_82a0bfe4f0bab953 = []byte{ - // 1243 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xda, 0x8e, 0x3f, 0x9e, 0xdd, 0x24, 0x6c, 0x53, 0xba, 0x76, 0x5b, 0x6f, 0xd8, 0x8a, - 0x12, 0x21, 0xb2, 0xdb, 0x18, 0x84, 0xd4, 0x9c, 0x88, 0x13, 0x17, 0x8a, 0x12, 0x88, 0xb6, 0x2e, - 0x07, 0x84, 0x64, 0x8d, 0x77, 0x27, 0xeb, 0x55, 0xb2, 0x33, 0xab, 0x9d, 0xf1, 0xca, 0xe1, 0xd8, - 0x13, 0x12, 0x07, 0x40, 0xdc, 0x11, 0x47, 0xc4, 0x89, 0x43, 0x0f, 0xfc, 0x09, 0x15, 0xa7, 0x0a, - 0x84, 0x84, 0x7a, 0x30, 0x28, 0x45, 0x42, 0xea, 0xb1, 0x07, 0x6e, 0x48, 0x68, 0x66, 0xd7, 0x8e, - 0x9d, 0x90, 0x94, 0x56, 0x88, 0xdb, 0xbc, 0x79, 0x1f, 0xf3, 0xde, 0xef, 0xf7, 0xe6, 0xcd, 0xc0, - 0x79, 0xcc, 0x7b, 0x16, 0x8e, 0x03, 0x2b, 0x5e, 0xb5, 0xf8, 0xc0, 0x0c, 0x23, 0xca, 0xa9, 0x0a, - 0x98, 0xf7, 0x4c, 0x1c, 0x07, 0x66, 0xbc, 0x5a, 0xbb, 0xe8, 0x50, 0x16, 0x50, 0x66, 0x05, 0xcc, - 0x13, 0x36, 0x01, 0xf3, 0x12, 0xa3, 0x5a, 0x3d, 0x55, 0x74, 0x11, 0xc3, 0x56, 0xbc, 0xda, 0xc5, - 0x1c, 0xad, 0x5a, 0x0e, 0xf5, 0x49, 0xaa, 0xaf, 0x26, 0xfa, 0x8e, 0x94, 0xac, 0x44, 0x48, 0x55, - 0x8b, 0x13, 0x87, 0x8a, 0x63, 0xd2, 0x5d, 0x8f, 0x7a, 0x34, 0xb1, 0x16, 0xab, 0x74, 0xf7, 0xb2, - 0x47, 0xa9, 0xb7, 0x8f, 0x2d, 0x14, 0xfa, 0x16, 0x22, 0x84, 0x72, 0xc4, 0x7d, 0x4a, 0x46, 0x91, - 0xaa, 0xa9, 0x56, 0x4a, 0xdd, 0xfe, 0xae, 0x85, 0xc8, 0x41, 0xa2, 0x32, 0x3e, 0x53, 0xe0, 0xdc, - 0x36, 0xf3, 0x5a, 0xbc, 0x87, 0x23, 0xdc, 0x0f, 0xda, 0x03, 0x75, 0x19, 0x72, 0x2e, 0xe2, 0x48, - 0x53, 0x96, 0x94, 0xe5, 0x72, 0x63, 0xd1, 0x4c, 0x7c, 0xcd, 0x91, 0xaf, 0xb9, 0x4e, 0x0e, 0x6c, - 0x69, 0xa1, 0x56, 0x21, 0xc7, 0xfc, 0x8f, 0xb1, 0x96, 0x59, 0x52, 0x96, 0x95, 0xe6, 0xec, 0xe3, - 0xa1, 0xae, 0xac, 0xd8, 0x72, 0x4b, 0xd5, 0x21, 0xd7, 0x43, 0xac, 0xa7, 0x65, 0x97, 0x94, 0xe5, - 0x52, 0xb3, 0xfc, 0x64, 0xa8, 0x17, 0xa2, 0xfd, 0x70, 0xcd, 0x58, 0x31, 0x6c, 0xa9, 0x50, 0x55, - 0xc8, 0xed, 0x46, 0x34, 0xd0, 0x72, 0xc2, 0xc0, 0x96, 0xeb, 0xb5, 0xdc, 0x27, 0x5f, 0xeb, 0x33, - 0xc6, 0x17, 0x19, 0x28, 0x6e, 0x61, 0x0f, 0x39, 0x07, 0xed, 0x81, 0xba, 0x08, 0xb3, 0x84, 0x12, - 0x07, 0xcb, 0x6c, 0x72, 0x76, 0x22, 0xa8, 0x6f, 0x42, 0xc9, 0x43, 0x02, 0x33, 0xdf, 0x49, 0x4e, - 0x2f, 0x35, 0xab, 0x0f, 0x87, 0xfa, 0x85, 0x04, 0x3e, 0xe6, 0xee, 0x99, 0x3e, 0xb5, 0x02, 0xc4, - 0x7b, 0xe6, 0x2d, 0xc2, 0xed, 0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a5, 0x5a, 0x85, 0x62, 0x1c, 0x74, 0x70, 0x14, 0xd1, 0x28, 0x9d, 0x6d, 0x85, 0x38, - 0x68, 0x09, 0x51, 0xa8, 0x04, 0xdd, 0x7d, 0x86, 0xdd, 0x84, 0x38, 0xbb, 0xe0, 0x21, 0x76, 0x87, - 0x61, 0x37, 0x4d, 0xf0, 0x53, 0x05, 0xe6, 0xb7, 0x99, 0x77, 0x27, 0x74, 0x11, 0xc7, 0x3b, 0x28, - 0x42, 0x01, 0x13, 0x93, 0x01, 0xf5, 0x79, 0x8f, 0x46, 0x3e, 0x3f, 0x48, 0x3b, 0x58, 0xfb, 0xf1, - 0xde, 0xca, 0x62, 0xfa, 0x78, 0xad, 0xbb, 0x6e, 0x84, 0x19, 0xbb, 0xcd, 0x23, 0x9f, 0x78, 0xf6, - 0x91, 0xa9, 0x7a, 0x1d, 0xf2, 0xa1, 0x8c, 0x20, 0xbb, 0xb5, 0xdc, 0x50, 0x27, 0x0b, 0x48, 0x62, - 0x37, 0x73, 0x82, 0x1a, 0x3b, 0xb5, 0x5b, 0x9b, 0xbb, 0xfb, 0xc7, 0x77, 0xaf, 0x1e, 0x45, 0x30, - 0xaa, 0x70, 0xf1, 0x58, 0x32, 0x23, 0xbc, 0x8c, 0x6f, 0x14, 0x78, 0x61, 0x9b, 0x79, 0x1b, 0x11, - 0x46, 0x1c, 0xdf, 0xec, 0x93, 0x36, 0xdd, 0xc3, 0x44, 0xbd, 0x0d, 0x20, 0x5e, 0x96, 0x0e, 0x8e, - 0x9c, 0xc6, 0xf5, 0x34, 0xd7, 0x37, 0xee, 0x0f, 0x75, 0xe5, 0xe1, 0x50, 0x7f, 0xcd, 0xf3, 0x79, + // 1246 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0xda, 0x8e, 0x7f, 0x3c, 0x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0, 0x93, 0xca, + 0xda, 0xf5, 0x73, 0x94, 0xe3, 0x4e, 0xb8, 0x0f, 0x73, 0x27, 0xfa, 0xf9, 0xda, 0x09, 0xb7, 0x69, + 0x75, 0xed, 0xf5, 0x73, 0xd5, 0xe3, 0xb8, 0x1f, 0xc1, 0xc2, 0xa9, 0xb6, 0xd0, 0x4f, 0xba, 0x9e, + 0x30, 0xa8, 0xbd, 0xf1, 0x12, 0x83, 0x51, 0xf4, 0xe6, 0xdb, 0x8f, 0x8f, 0xea, 0xca, 0x93, 0xa3, + 0xba, 0xf2, 0xcb, 0x51, 0x5d, 0xf9, 0xfc, 0x59, 0x7d, 0xe6, 0xc9, 0xb3, 0xfa, 0xcc, 0x4f, 0xcf, + 0xea, 0x33, 0x1f, 0xde, 0x78, 0x69, 0x77, 0x0d, 0x04, 0xb0, 0xdd, 0xbc, 0xfc, 0x6b, 0xbe, 0xf5, + 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0xcb, 0xec, 0xc3, 0x76, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3754,7 +3754,7 @@ func (m *MsgCreateFunToken) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_NibiruChain_nibiru_v2_eth.HexAddr + var v github_com_NibiruChain_nibiru_v2_eth.EIP55Addr m.FromErc20 = &v if err := m.FromErc20.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err