Skip to content

Commit

Permalink
accounts/abi: change unpacking of abi fields w/ underscores
Browse files Browse the repository at this point in the history
ABI fields with underscores that are being unpacked
into structs expect structs with following form:

int_one -> Int_one

whereas in abigen the generated structs are camelcased

int_one -> IntOne

so updated the unpack method to expect camelcased structs as well.
  • Loading branch information
mkrump authored and gballet committed Dec 28, 2018
1 parent 27ce4eb commit 93d8814
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions accounts/abi/unpack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ var unpackTests = []unpackTest{
Int2 *big.Int
}{big.NewInt(1), big.NewInt(2)},
},
{
def: `[{"name":"int_one","type":"int256"}]`,
enc: "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
want: struct {
IntOne *big.Int
}{big.NewInt(1)},
},
{
def: `[{"name":"int","type":"int256"},{"name":"Int","type":"int256"}]`,
enc: "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
Expand Down

0 comments on commit 93d8814

Please sign in to comment.