accounts/abi/abigen: use golang uint256.Int for solidity uint256 params

Fixes type safety of abigen bindings for uint256 solidity parameters.
This commit is contained in:
Miro 2025-04-09 12:11:26 -04:00
parent 3a1d958458
commit 8663d9268e
35 changed files with 230 additions and 143 deletions

View file

@ -304,6 +304,9 @@ func bindBasicType(kind abi.Type) string {
case "8", "16", "32", "64": case "8", "16", "32", "64":
return fmt.Sprintf("%sint%s", parts[1], parts[2]) return fmt.Sprintf("%sint%s", parts[1], parts[2])
} }
if parts[1] == "u" {
return "*uint256.Int"
}
return "*big.Int" return "*big.Int"
case abi.FixedBytesTy: case abi.FixedBytesTy:
return fmt.Sprintf("[%d]byte", kind.Size) return fmt.Sprintf("[%d]byte", kind.Size)

View file

@ -77,6 +77,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
`, `,
` `
if b, err := NewToken(common.Address{}, nil); b == nil || err != nil { if b, err := NewToken(common.Address{}, nil); b == nil || err != nil {
@ -90,8 +91,10 @@ var bindTests = []struct {
sim := backends.NewSimulatedBackend(types.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000000000)}}, 10000000) sim := backends.NewSimulatedBackend(types.GenesisAlloc{auth.From: {Balance: big.NewInt(10000000000000000)}}, 10000000)
defer sim.Close() defer sim.Close()
maxUint256 := uint256.MustFromHex("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
// Deploy an interaction tester contract and call a transaction on it // Deploy an interaction tester contract and call a transaction on it
_, _, interactor, err := DeployToken(auth, sim, big.NewInt(-1), "TestToken", 19, "Test") _, _, interactor, err := DeployToken(auth, sim, maxUint256, "TestToken", 19, "Test")
if err != nil { if err != nil {
t.Fatalf("Failed to deploy interactor contract: %v", err) t.Fatalf("Failed to deploy interactor contract: %v", err)
} }
@ -101,7 +104,7 @@ var bindTests = []struct {
toKey, _ := crypto.GenerateKey() toKey, _ := crypto.GenerateKey()
toAddr := crypto.PubkeyToAddress(toKey.PublicKey) toAddr := crypto.PubkeyToAddress(toKey.PublicKey)
transferValue := big.NewInt(-1) transferValue := maxUint256
_, err = interactor.Transfer(auth, toAddr, transferValue) _, err = interactor.Transfer(auth, toAddr, transferValue)
if err != nil { if err != nil {
t.Fatalf("Failed to transfer tokens: %v", err) t.Fatalf("Failed to transfer tokens: %v", err)
@ -249,6 +252,7 @@ var bindTests = []struct {
"reflect" "reflect"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/holiman/uint256"
`, `,
`if e, err := NewEventChecker(common.Address{}, nil); e == nil || err != nil { `if e, err := NewEventChecker(common.Address{}, nil); e == nil || err != nil {
t.Fatalf("binding (%v) nil or error (%v) not nil", e, nil) t.Fatalf("binding (%v) nil or error (%v) not nil", e, nil)
@ -291,7 +295,7 @@ var bindTests = []struct {
fmt.Println(res, str, dat, hash, err) fmt.Println(res, str, dat, hash, err)
oit, err := e.FilterUnnamed(nil, []*big.Int{}, []*big.Int{}) oit, err := e.FilterUnnamed(nil, []*uint256.Int{}, []*uint256.Int{})
arg0 := oit.Event.Arg0 // Make sure unnamed arguments are handled correctly arg0 := oit.Event.Arg0 // Make sure unnamed arguments are handled correctly
arg1 := oit.Event.Arg1 // Make sure unnamed arguments are handled correctly arg1 := oit.Event.Arg1 // Make sure unnamed arguments are handled correctly
@ -958,6 +962,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
`, `,
` `
// Generate a new random account and a funded simulator // Generate a new random account and a funded simulator
@ -977,7 +982,7 @@ var bindTests = []struct {
// Inject a few events into the contract, gradually more in each block // Inject a few events into the contract, gradually more in each block
for i := 1; i <= 3; i++ { for i := 1; i <= 3; i++ {
for j := 1; j <= i; j++ { for j := 1; j <= i; j++ {
if _, err := eventer.RaiseSimpleEvent(auth, common.Address{byte(j)}, [32]byte{byte(j)}, true, big.NewInt(int64(10*i+j))); err != nil { if _, err := eventer.RaiseSimpleEvent(auth, common.Address{byte(j)}, [32]byte{byte(j)}, true, uint256.NewInt(uint64(10*i+j))); err != nil {
t.Fatalf("block %d, event %d: raise failed: %v", i, j, err) t.Fatalf("block %d, event %d: raise failed: %v", i, j, err)
} }
} }
@ -1014,12 +1019,12 @@ var bindTests = []struct {
t.Fatalf("simple event iteration failed: %v", err) t.Fatalf("simple event iteration failed: %v", err)
} }
// Test raising and filtering for an event with no data component // Test raising and filtering for an event with no data component
if _, err := eventer.RaiseNodataEvent(auth, big.NewInt(314), 141, 271); err != nil { if _, err := eventer.RaiseNodataEvent(auth, uint256.NewInt(314), 141, 271); err != nil {
t.Fatalf("failed to raise nodata event: %v", err) t.Fatalf("failed to raise nodata event: %v", err)
} }
sim.Commit() sim.Commit()
nit, err := eventer.FilterNodataEvent(nil, []*big.Int{big.NewInt(314)}, []int16{140, 141, 142}, []uint32{271}) nit, err := eventer.FilterNodataEvent(nil, []*uint256.Int{uint256.NewInt(314)}, []int16{140, 141, 142}, []uint32{271})
if err != nil { if err != nil {
t.Fatalf("failed to filter for nodata events: %v", err) t.Fatalf("failed to filter for nodata events: %v", err)
} }
@ -1094,7 +1099,7 @@ var bindTests = []struct {
if err != nil { if err != nil {
t.Fatalf("failed to subscribe to simple events: %v", err) t.Fatalf("failed to subscribe to simple events: %v", err)
} }
if _, err := eventer.RaiseSimpleEvent(auth, common.Address{255}, [32]byte{255}, true, big.NewInt(255)); err != nil { if _, err := eventer.RaiseSimpleEvent(auth, common.Address{255}, [32]byte{255}, true, uint256.NewInt(255)); err != nil {
t.Fatalf("failed to raise subscribed simple event: %v", err) t.Fatalf("failed to raise subscribed simple event: %v", err)
} }
sim.Commit() sim.Commit()
@ -1110,7 +1115,7 @@ var bindTests = []struct {
// Unsubscribe from the event and make sure we're not delivered more // Unsubscribe from the event and make sure we're not delivered more
sub.Unsubscribe() sub.Unsubscribe()
if _, err := eventer.RaiseSimpleEvent(auth, common.Address{254}, [32]byte{254}, true, big.NewInt(254)); err != nil { if _, err := eventer.RaiseSimpleEvent(auth, common.Address{254}, [32]byte{254}, true, uint256.NewInt(254)); err != nil {
t.Fatalf("failed to raise subscribed simple event: %v", err) t.Fatalf("failed to raise subscribed simple event: %v", err)
} }
sim.Commit() sim.Commit()
@ -1283,6 +1288,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
`, `,
` `
@ -1305,16 +1311,16 @@ var bindTests = []struct {
} }
a := TupleS{ a := TupleS{
A: big.NewInt(1), A: uint256.NewInt(1),
B: []*big.Int{big.NewInt(2), big.NewInt(3)}, B: []*uint256.Int{uint256.NewInt(2), uint256.NewInt(3)},
C: []TupleT{ C: []TupleT{
{ {
X: big.NewInt(4), X: uint256.NewInt(4),
Y: big.NewInt(5), Y: uint256.NewInt(5),
}, },
{ {
X: big.NewInt(6), X: uint256.NewInt(6),
Y: big.NewInt(7), Y: uint256.NewInt(7),
}, },
}, },
} }
@ -1322,12 +1328,12 @@ var bindTests = []struct {
b := [][2]TupleT{ b := [][2]TupleT{
{ {
{ {
X: big.NewInt(8), X: uint256.NewInt(8),
Y: big.NewInt(9), Y: uint256.NewInt(9),
}, },
{ {
X: big.NewInt(10), X: uint256.NewInt(10),
Y: big.NewInt(11), Y: uint256.NewInt(11),
}, },
}, },
} }
@ -1335,25 +1341,25 @@ var bindTests = []struct {
c := [2][]TupleT{ c := [2][]TupleT{
{ {
{ {
X: big.NewInt(12), X: uint256.NewInt(12),
Y: big.NewInt(13), Y: uint256.NewInt(13),
}, },
{ {
X: big.NewInt(14), X: uint256.NewInt(14),
Y: big.NewInt(15), Y: uint256.NewInt(15),
}, },
}, },
{ {
{ {
X: big.NewInt(16), X: uint256.NewInt(16),
Y: big.NewInt(17), Y: uint256.NewInt(17),
}, },
}, },
} }
d := []TupleS{a} d := []TupleS{a}
e := []*big.Int{big.NewInt(18), big.NewInt(19)} e := []*uint256.Int{uint256.NewInt(18), uint256.NewInt(19)}
ret1, ret2, ret3, ret4, ret5, err := contract.Func1(nil, a, b, c, d, e) ret1, ret2, ret3, ret4, ret5, err := contract.Func1(nil, a, b, c, d, e)
if err != nil { if err != nil {
t.Fatalf("invoke contract failed, err %v", err) t.Fatalf("invoke contract failed, err %v", err)
@ -1425,6 +1431,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
`, `,
` `
// Generate a new random account and a funded simulator // Generate a new random account and a funded simulator
@ -1448,11 +1455,11 @@ var bindTests = []struct {
res, err := testContract.Add(&bind.CallOpts{ res, err := testContract.Add(&bind.CallOpts{
From: auth.From, From: auth.From,
Pending: false, Pending: false,
}, big.NewInt(1), big.NewInt(2)) }, uint256.NewInt(1), uint256.NewInt(2))
if err != nil { if err != nil {
t.Fatalf("Failed to call linked contract: %v", err) t.Fatalf("Failed to call linked contract: %v", err)
} }
if res.Cmp(big.NewInt(3)) != 0 { if res.Cmp(uint256.NewInt(3)) != 0 {
t.Fatalf("Add did not return the correct result: %d != %d", res, 3) t.Fatalf("Add did not return the correct result: %d != %d", res, 3)
} }
`, `,
@ -1491,6 +1498,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
`, `,
` `
// Initialize test accounts // Initialize test accounts
@ -1529,7 +1537,7 @@ var bindTests = []struct {
} }
} }
}() }()
contract.Foo(auth, big.NewInt(1), big.NewInt(2)) contract.Foo(auth, uint256.NewInt(1), uint256.NewInt(2))
sim.Commit() sim.Commit()
select { select {
case n := <-resCh: case n := <-resCh:
@ -1540,7 +1548,7 @@ var bindTests = []struct {
t.Fatalf("Wait bar0 event timeout") t.Fatalf("Wait bar0 event timeout")
} }
contract.Foo0(auth, big.NewInt(1)) contract.Foo0(auth, uint256.NewInt(1))
sim.Commit() sim.Commit()
select { select {
case n := <-resCh: case n := <-resCh:
@ -1642,6 +1650,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
`, `,
` `
key, _ := crypto.GenerateKey() key, _ := crypto.GenerateKey()
@ -1658,7 +1667,7 @@ var bindTests = []struct {
} }
sim.Commit() sim.Commit()
err = c1.Foo(nil, ExternalLibSharedStruct{ err = c1.Foo(nil, ExternalLibSharedStruct{
F1: big.NewInt(100), F1: uint256.NewInt(100),
F2: [32]byte{0x01, 0x02, 0x03}, F2: [32]byte{0x01, 0x02, 0x03},
}) })
if err != nil { if err != nil {
@ -1670,7 +1679,7 @@ var bindTests = []struct {
} }
sim.Commit() sim.Commit()
err = c2.Bar(nil, ExternalLibSharedStruct{ err = c2.Bar(nil, ExternalLibSharedStruct{
F1: big.NewInt(100), F1: uint256.NewInt(100),
F2: [32]byte{0x01, 0x02, 0x03}, F2: [32]byte{0x01, 0x02, 0x03},
}) })
if err != nil { if err != nil {
@ -1704,6 +1713,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
`, `,
` `
// Generate a new random account and a funded simulator // Generate a new random account and a funded simulator
@ -1723,12 +1733,12 @@ var bindTests = []struct {
// This test the existence of the free retriever call for view and pure functions // This test the existence of the free retriever call for view and pure functions
if num, err := pav.PureFunc(nil); err != nil { if num, err := pav.PureFunc(nil); err != nil {
t.Fatalf("Failed to call anonymous field retriever: %v", err) t.Fatalf("Failed to call anonymous field retriever: %v", err)
} else if num.Cmp(big.NewInt(42)) != 0 { } else if num.Cmp(uint256.NewInt(42)) != 0 {
t.Fatalf("Retrieved value mismatch: have %v, want %v", num, 42) t.Fatalf("Retrieved value mismatch: have %v, want %v", num, 42)
} }
if num, err := pav.ViewFunc(nil); err != nil { if num, err := pav.ViewFunc(nil); err != nil {
t.Fatalf("Failed to call anonymous field retriever: %v", err) t.Fatalf("Failed to call anonymous field retriever: %v", err)
} else if num.Cmp(big.NewInt(1)) != 0 { } else if num.Cmp(uint256.NewInt(1)) != 0 {
t.Fatalf("Retrieved value mismatch: have %v, want %v", num, 1) t.Fatalf("Retrieved value mismatch: have %v, want %v", num, 1)
} }
`, `,
@ -1749,7 +1759,7 @@ var bindTests = []struct {
emit Fallback(msg.data); emit Fallback(msg.data);
} }
event Received(address addr, uint value); event Received(address addr, uint256 value);
receive() external payable { receive() external payable {
emit Received(msg.sender, msg.value); emit Received(msg.sender, msg.value);
} }
@ -1856,6 +1866,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/holiman/uint256"
`, `,
` `
var ( var (
@ -1894,10 +1905,10 @@ var bindTests = []struct {
} }
var count int var count int
for it.Next() { for it.Next() {
if it.Event.S.A.Cmp(big.NewInt(1)) != 0 { if it.Event.S.A.Cmp(uint256.NewInt(1)) != 0 {
t.Fatal("Unexpected contract event") t.Fatal("Unexpected contract event")
} }
if it.Event.S.B.Cmp(big.NewInt(2)) != 0 { if it.Event.S.B.Cmp(uint256.NewInt(2)) != 0 {
t.Fatal("Unexpected contract event") t.Fatal("Unexpected contract event")
} }
count += 1 count += 1
@ -1991,6 +2002,7 @@ var bindTests = []struct {
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/holiman/uint256"
`, `,
tester: ` tester: `
var ( var (
@ -2000,7 +2012,7 @@ var bindTests = []struct {
) )
defer sim.Close() defer sim.Close()
_, tx, _, err := DeployConstructorWithStructParam(user, sim, ConstructorWithStructParamStructType{Field: big.NewInt(42)}) _, tx, _, err := DeployConstructorWithStructParam(user, sim, ConstructorWithStructParamStructType{Field: uint256.NewInt(42)})
if err != nil { if err != nil {
t.Fatalf("DeployConstructorWithStructParam() got err %v; want nil err", err) t.Fatalf("DeployConstructorWithStructParam() got err %v; want nil err", err)
} }

View file

@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -27,6 +28,7 @@ var (
_ = types.BloomLookup _ = types.BloomLookup
_ = event.NewSubscription _ = event.NewSubscription
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
{{$structs := .Structs}} {{$structs := .Structs}}

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
{{$structs := .Structs}} {{$structs := .Structs}}

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// CallbackParamMetaData contains all meta data concerning the CallbackParam contract. // CallbackParamMetaData contains all meta data concerning the CallbackParam contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// CrowdsaleMetaData contains all meta data concerning the Crowdsale contract. // CrowdsaleMetaData contains all meta data concerning the Crowdsale contract.
@ -55,7 +57,7 @@ func (c *Crowdsale) Instance(backend bind.ContractBackend, addr common.Address)
// contract deployment. // contract deployment.
// //
// Solidity: constructor(address ifSuccessfulSendTo, uint256 fundingGoalInEthers, uint256 durationInMinutes, uint256 etherCostOfEachToken, address addressOfTokenUsedAsReward) returns() // Solidity: constructor(address ifSuccessfulSendTo, uint256 fundingGoalInEthers, uint256 durationInMinutes, uint256 etherCostOfEachToken, address addressOfTokenUsedAsReward) returns()
func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, fundingGoalInEthers *big.Int, durationInMinutes *big.Int, etherCostOfEachToken *big.Int, addressOfTokenUsedAsReward common.Address) []byte { func (crowdsale *Crowdsale) PackConstructor(ifSuccessfulSendTo common.Address, fundingGoalInEthers *uint256.Int, durationInMinutes *uint256.Int, etherCostOfEachToken *uint256.Int, addressOfTokenUsedAsReward common.Address) []byte {
enc, err := crowdsale.abi.Pack("", ifSuccessfulSendTo, fundingGoalInEthers, durationInMinutes, etherCostOfEachToken, addressOfTokenUsedAsReward) enc, err := crowdsale.abi.Pack("", ifSuccessfulSendTo, fundingGoalInEthers, durationInMinutes, etherCostOfEachToken, addressOfTokenUsedAsReward)
if err != nil { if err != nil {
panic(err) panic(err)
@ -79,12 +81,12 @@ func (crowdsale *Crowdsale) PackAmountRaised() []byte {
// from invoking the contract method with ID 0x7b3e5e7b. // from invoking the contract method with ID 0x7b3e5e7b.
// //
// Solidity: function amountRaised() returns(uint256) // Solidity: function amountRaised() returns(uint256)
func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*big.Int, error) { func (crowdsale *Crowdsale) UnpackAmountRaised(data []byte) (*uint256.Int, error) {
out, err := crowdsale.abi.Unpack("amountRaised", data) out, err := crowdsale.abi.Unpack("amountRaised", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -141,12 +143,12 @@ func (crowdsale *Crowdsale) PackDeadline() []byte {
// from invoking the contract method with ID 0x29dcb0cf. // from invoking the contract method with ID 0x29dcb0cf.
// //
// Solidity: function deadline() returns(uint256) // Solidity: function deadline() returns(uint256)
func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) { func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*uint256.Int, error) {
out, err := crowdsale.abi.Unpack("deadline", data) out, err := crowdsale.abi.Unpack("deadline", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -154,7 +156,7 @@ func (crowdsale *Crowdsale) UnpackDeadline(data []byte) (*big.Int, error) {
// the contract method with ID 0xdc0d3dff. // the contract method with ID 0xdc0d3dff.
// //
// Solidity: function funders(uint256 ) returns(address addr, uint256 amount) // Solidity: function funders(uint256 ) returns(address addr, uint256 amount)
func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte { func (crowdsale *Crowdsale) PackFunders(arg0 *uint256.Int) []byte {
enc, err := crowdsale.abi.Pack("funders", arg0) enc, err := crowdsale.abi.Pack("funders", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
@ -166,7 +168,7 @@ func (crowdsale *Crowdsale) PackFunders(arg0 *big.Int) []byte {
// method Funders. // method Funders.
type FundersOutput struct { type FundersOutput struct {
Addr common.Address Addr common.Address
Amount *big.Int Amount *uint256.Int
} }
// UnpackFunders is the Go binding that unpacks the parameters returned // UnpackFunders is the Go binding that unpacks the parameters returned
@ -180,7 +182,7 @@ func (crowdsale *Crowdsale) UnpackFunders(data []byte) (FundersOutput, error) {
return *outstruct, err return *outstruct, err
} }
outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Addr = *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Amount = abi.ConvertType(out[1], new(uint256.Int)).(*uint256.Int)
return *outstruct, err return *outstruct, err
} }
@ -201,12 +203,12 @@ func (crowdsale *Crowdsale) PackFundingGoal() []byte {
// from invoking the contract method with ID 0x7a3a0e84. // from invoking the contract method with ID 0x7a3a0e84.
// //
// Solidity: function fundingGoal() returns(uint256) // Solidity: function fundingGoal() returns(uint256)
func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*big.Int, error) { func (crowdsale *Crowdsale) UnpackFundingGoal(data []byte) (*uint256.Int, error) {
out, err := crowdsale.abi.Unpack("fundingGoal", data) out, err := crowdsale.abi.Unpack("fundingGoal", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -226,12 +228,12 @@ func (crowdsale *Crowdsale) PackPrice() []byte {
// from invoking the contract method with ID 0xa035b1fe. // from invoking the contract method with ID 0xa035b1fe.
// //
// Solidity: function price() returns(uint256) // Solidity: function price() returns(uint256)
func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*big.Int, error) { func (crowdsale *Crowdsale) UnpackPrice(data []byte) (*uint256.Int, error) {
out, err := crowdsale.abi.Unpack("price", data) out, err := crowdsale.abi.Unpack("price", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -263,7 +265,7 @@ func (crowdsale *Crowdsale) UnpackTokenReward(data []byte) (common.Address, erro
// CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract. // CrowdsaleFundTransfer represents a FundTransfer event raised by the Crowdsale contract.
type CrowdsaleFundTransfer struct { type CrowdsaleFundTransfer struct {
Backer common.Address Backer common.Address
Amount *big.Int Amount *uint256.Int
IsContribution bool IsContribution bool
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// DAOMetaData contains all meta data concerning the DAO contract. // DAOMetaData contains all meta data concerning the DAO contract.
@ -55,7 +57,7 @@ func (c *DAO) Instance(backend bind.ContractBackend, addr common.Address) *bind.
// contract deployment. // contract deployment.
// //
// Solidity: constructor(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority, address congressLeader) returns() // Solidity: constructor(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority, address congressLeader) returns()
func (dAO *DAO) PackConstructor(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int, congressLeader common.Address) []byte { func (dAO *DAO) PackConstructor(minimumQuorumForProposals *uint256.Int, minutesForDebate *uint256.Int, marginOfVotesForMajority *big.Int, congressLeader common.Address) []byte {
enc, err := dAO.abi.Pack("", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority, congressLeader) enc, err := dAO.abi.Pack("", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority, congressLeader)
if err != nil { if err != nil {
panic(err) panic(err)
@ -79,7 +81,7 @@ func (dAO *DAO) PackChangeMembership(targetMember common.Address, canVote bool,
// the contract method with ID 0xbcca1fd3. // the contract method with ID 0xbcca1fd3.
// //
// Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns() // Solidity: function changeVotingRules(uint256 minimumQuorumForProposals, uint256 minutesForDebate, int256 marginOfVotesForMajority) returns()
func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minutesForDebate *big.Int, marginOfVotesForMajority *big.Int) []byte { func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *uint256.Int, minutesForDebate *uint256.Int, marginOfVotesForMajority *big.Int) []byte {
enc, err := dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority) enc, err := dAO.abi.Pack("changeVotingRules", minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority)
if err != nil { if err != nil {
panic(err) panic(err)
@ -91,7 +93,7 @@ func (dAO *DAO) PackChangeVotingRules(minimumQuorumForProposals *big.Int, minute
// the contract method with ID 0xeceb2945. // the contract method with ID 0xeceb2945.
// //
// Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut) // Solidity: function checkProposalCode(uint256 proposalNumber, address beneficiary, uint256 etherAmount, bytes transactionBytecode) returns(bool codeChecksOut)
func (dAO *DAO) PackCheckProposalCode(proposalNumber *big.Int, beneficiary common.Address, etherAmount *big.Int, transactionBytecode []byte) []byte { func (dAO *DAO) PackCheckProposalCode(proposalNumber *uint256.Int, beneficiary common.Address, etherAmount *uint256.Int, transactionBytecode []byte) []byte {
enc, err := dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode) enc, err := dAO.abi.Pack("checkProposalCode", proposalNumber, beneficiary, etherAmount, transactionBytecode)
if err != nil { if err != nil {
panic(err) panic(err)
@ -128,12 +130,12 @@ func (dAO *DAO) PackDebatingPeriodInMinutes() []byte {
// from invoking the contract method with ID 0x69bd3436. // from invoking the contract method with ID 0x69bd3436.
// //
// Solidity: function debatingPeriodInMinutes() returns(uint256) // Solidity: function debatingPeriodInMinutes() returns(uint256)
func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) { func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*uint256.Int, error) {
out, err := dAO.abi.Unpack("debatingPeriodInMinutes", data) out, err := dAO.abi.Unpack("debatingPeriodInMinutes", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -141,7 +143,7 @@ func (dAO *DAO) UnpackDebatingPeriodInMinutes(data []byte) (*big.Int, error) {
// the contract method with ID 0x237e9492. // the contract method with ID 0x237e9492.
// //
// Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result) // Solidity: function executeProposal(uint256 proposalNumber, bytes transactionBytecode) returns(int256 result)
func (dAO *DAO) PackExecuteProposal(proposalNumber *big.Int, transactionBytecode []byte) []byte { func (dAO *DAO) PackExecuteProposal(proposalNumber *uint256.Int, transactionBytecode []byte) []byte {
enc, err := dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode) enc, err := dAO.abi.Pack("executeProposal", proposalNumber, transactionBytecode)
if err != nil { if err != nil {
panic(err) panic(err)
@ -203,12 +205,12 @@ func (dAO *DAO) PackMemberId(arg0 common.Address) []byte {
// from invoking the contract method with ID 0x39106821. // from invoking the contract method with ID 0x39106821.
// //
// Solidity: function memberId(address ) returns(uint256) // Solidity: function memberId(address ) returns(uint256)
func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) { func (dAO *DAO) UnpackMemberId(data []byte) (*uint256.Int, error) {
out, err := dAO.abi.Unpack("memberId", data) out, err := dAO.abi.Unpack("memberId", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -216,7 +218,7 @@ func (dAO *DAO) UnpackMemberId(data []byte) (*big.Int, error) {
// the contract method with ID 0x5daf08ca. // the contract method with ID 0x5daf08ca.
// //
// Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince) // Solidity: function members(uint256 ) returns(address member, bool canVote, string name, uint256 memberSince)
func (dAO *DAO) PackMembers(arg0 *big.Int) []byte { func (dAO *DAO) PackMembers(arg0 *uint256.Int) []byte {
enc, err := dAO.abi.Pack("members", arg0) enc, err := dAO.abi.Pack("members", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
@ -230,7 +232,7 @@ type MembersOutput struct {
Member common.Address Member common.Address
CanVote bool CanVote bool
Name string Name string
MemberSince *big.Int MemberSince *uint256.Int
} }
// UnpackMembers is the Go binding that unpacks the parameters returned // UnpackMembers is the Go binding that unpacks the parameters returned
@ -246,7 +248,7 @@ func (dAO *DAO) UnpackMembers(data []byte) (MembersOutput, error) {
outstruct.Member = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Member = *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool) outstruct.CanVote = *abi.ConvertType(out[1], new(bool)).(*bool)
outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string) outstruct.Name = *abi.ConvertType(out[2], new(string)).(*string)
outstruct.MemberSince = abi.ConvertType(out[3], new(big.Int)).(*big.Int) outstruct.MemberSince = abi.ConvertType(out[3], new(uint256.Int)).(*uint256.Int)
return *outstruct, err return *outstruct, err
} }
@ -267,12 +269,12 @@ func (dAO *DAO) PackMinimumQuorum() []byte {
// from invoking the contract method with ID 0x8160f0b5. // from invoking the contract method with ID 0x8160f0b5.
// //
// Solidity: function minimumQuorum() returns(uint256) // Solidity: function minimumQuorum() returns(uint256)
func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) { func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*uint256.Int, error) {
out, err := dAO.abi.Unpack("minimumQuorum", data) out, err := dAO.abi.Unpack("minimumQuorum", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -280,7 +282,7 @@ func (dAO *DAO) UnpackMinimumQuorum(data []byte) (*big.Int, error) {
// the contract method with ID 0xb1050da5. // the contract method with ID 0xb1050da5.
// //
// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID)
func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int, jobDescription string, transactionBytecode []byte) []byte { func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *uint256.Int, jobDescription string, transactionBytecode []byte) []byte {
enc, err := dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode) enc, err := dAO.abi.Pack("newProposal", beneficiary, etherAmount, jobDescription, transactionBytecode)
if err != nil { if err != nil {
panic(err) panic(err)
@ -292,12 +294,12 @@ func (dAO *DAO) PackNewProposal(beneficiary common.Address, etherAmount *big.Int
// from invoking the contract method with ID 0xb1050da5. // from invoking the contract method with ID 0xb1050da5.
// //
// Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID) // Solidity: function newProposal(address beneficiary, uint256 etherAmount, string JobDescription, bytes transactionBytecode) returns(uint256 proposalID)
func (dAO *DAO) UnpackNewProposal(data []byte) (*big.Int, error) { func (dAO *DAO) UnpackNewProposal(data []byte) (*uint256.Int, error) {
out, err := dAO.abi.Unpack("newProposal", data) out, err := dAO.abi.Unpack("newProposal", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -317,12 +319,12 @@ func (dAO *DAO) PackNumProposals() []byte {
// from invoking the contract method with ID 0x400e3949. // from invoking the contract method with ID 0x400e3949.
// //
// Solidity: function numProposals() returns(uint256) // Solidity: function numProposals() returns(uint256)
func (dAO *DAO) UnpackNumProposals(data []byte) (*big.Int, error) { func (dAO *DAO) UnpackNumProposals(data []byte) (*uint256.Int, error) {
out, err := dAO.abi.Unpack("numProposals", data) out, err := dAO.abi.Unpack("numProposals", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -355,7 +357,7 @@ func (dAO *DAO) UnpackOwner(data []byte) (common.Address, error) {
// the contract method with ID 0x013cf08b. // the contract method with ID 0x013cf08b.
// //
// Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash) // Solidity: function proposals(uint256 ) returns(address recipient, uint256 amount, string description, uint256 votingDeadline, bool executed, bool proposalPassed, uint256 numberOfVotes, int256 currentResult, bytes32 proposalHash)
func (dAO *DAO) PackProposals(arg0 *big.Int) []byte { func (dAO *DAO) PackProposals(arg0 *uint256.Int) []byte {
enc, err := dAO.abi.Pack("proposals", arg0) enc, err := dAO.abi.Pack("proposals", arg0)
if err != nil { if err != nil {
panic(err) panic(err)
@ -367,12 +369,12 @@ func (dAO *DAO) PackProposals(arg0 *big.Int) []byte {
// method Proposals. // method Proposals.
type ProposalsOutput struct { type ProposalsOutput struct {
Recipient common.Address Recipient common.Address
Amount *big.Int Amount *uint256.Int
Description string Description string
VotingDeadline *big.Int VotingDeadline *uint256.Int
Executed bool Executed bool
ProposalPassed bool ProposalPassed bool
NumberOfVotes *big.Int NumberOfVotes *uint256.Int
CurrentResult *big.Int CurrentResult *big.Int
ProposalHash [32]byte ProposalHash [32]byte
} }
@ -388,12 +390,12 @@ func (dAO *DAO) UnpackProposals(data []byte) (ProposalsOutput, error) {
return *outstruct, err return *outstruct, err
} }
outstruct.Recipient = *abi.ConvertType(out[0], new(common.Address)).(*common.Address) outstruct.Recipient = *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
outstruct.Amount = abi.ConvertType(out[1], new(big.Int)).(*big.Int) outstruct.Amount = abi.ConvertType(out[1], new(uint256.Int)).(*uint256.Int)
outstruct.Description = *abi.ConvertType(out[2], new(string)).(*string) outstruct.Description = *abi.ConvertType(out[2], new(string)).(*string)
outstruct.VotingDeadline = abi.ConvertType(out[3], new(big.Int)).(*big.Int) outstruct.VotingDeadline = abi.ConvertType(out[3], new(uint256.Int)).(*uint256.Int)
outstruct.Executed = *abi.ConvertType(out[4], new(bool)).(*bool) outstruct.Executed = *abi.ConvertType(out[4], new(bool)).(*bool)
outstruct.ProposalPassed = *abi.ConvertType(out[5], new(bool)).(*bool) outstruct.ProposalPassed = *abi.ConvertType(out[5], new(bool)).(*bool)
outstruct.NumberOfVotes = abi.ConvertType(out[6], new(big.Int)).(*big.Int) outstruct.NumberOfVotes = abi.ConvertType(out[6], new(uint256.Int)).(*uint256.Int)
outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int) outstruct.CurrentResult = abi.ConvertType(out[7], new(big.Int)).(*big.Int)
outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte) outstruct.ProposalHash = *abi.ConvertType(out[8], new([32]byte)).(*[32]byte)
return *outstruct, err return *outstruct, err
@ -416,7 +418,7 @@ func (dAO *DAO) PackTransferOwnership(newOwner common.Address) []byte {
// the contract method with ID 0xd3c0715b. // the contract method with ID 0xd3c0715b.
// //
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justificationText string) []byte { func (dAO *DAO) PackVote(proposalNumber *uint256.Int, supportsProposal bool, justificationText string) []byte {
enc, err := dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText) enc, err := dAO.abi.Pack("vote", proposalNumber, supportsProposal, justificationText)
if err != nil { if err != nil {
panic(err) panic(err)
@ -428,19 +430,19 @@ func (dAO *DAO) PackVote(proposalNumber *big.Int, supportsProposal bool, justifi
// from invoking the contract method with ID 0xd3c0715b. // from invoking the contract method with ID 0xd3c0715b.
// //
// Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID) // Solidity: function vote(uint256 proposalNumber, bool supportsProposal, string justificationText) returns(uint256 voteID)
func (dAO *DAO) UnpackVote(data []byte) (*big.Int, error) { func (dAO *DAO) UnpackVote(data []byte) (*uint256.Int, error) {
out, err := dAO.abi.Unpack("vote", data) out, err := dAO.abi.Unpack("vote", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
// DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract. // DAOChangeOfRules represents a ChangeOfRules event raised by the DAO contract.
type DAOChangeOfRules struct { type DAOChangeOfRules struct {
MinimumQuorum *big.Int MinimumQuorum *uint256.Int
DebatingPeriodInMinutes *big.Int DebatingPeriodInMinutes *uint256.Int
MajorityMargin *big.Int MajorityMargin *big.Int
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }
@ -524,9 +526,9 @@ func (dAO *DAO) UnpackMembershipChangedEvent(log *types.Log) (*DAOMembershipChan
// DAOProposalAdded represents a ProposalAdded event raised by the DAO contract. // DAOProposalAdded represents a ProposalAdded event raised by the DAO contract.
type DAOProposalAdded struct { type DAOProposalAdded struct {
ProposalID *big.Int ProposalID *uint256.Int
Recipient common.Address Recipient common.Address
Amount *big.Int Amount *uint256.Int
Description string Description string
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }
@ -568,9 +570,9 @@ func (dAO *DAO) UnpackProposalAddedEvent(log *types.Log) (*DAOProposalAdded, err
// DAOProposalTallied represents a ProposalTallied event raised by the DAO contract. // DAOProposalTallied represents a ProposalTallied event raised by the DAO contract.
type DAOProposalTallied struct { type DAOProposalTallied struct {
ProposalID *big.Int ProposalID *uint256.Int
Result *big.Int Result *big.Int
Quorum *big.Int Quorum *uint256.Int
Active bool Active bool
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }
@ -612,7 +614,7 @@ func (dAO *DAO) UnpackProposalTalliedEvent(log *types.Log) (*DAOProposalTallied,
// DAOVoted represents a Voted event raised by the DAO contract. // DAOVoted represents a Voted event raised by the DAO contract.
type DAOVoted struct { type DAOVoted struct {
ProposalID *big.Int ProposalID *uint256.Int
Position bool Position bool
Voter common.Address Voter common.Address
Justification string Justification string

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// DeeplyNestedArrayMetaData contains all meta data concerning the DeeplyNestedArray contract. // DeeplyNestedArrayMetaData contains all meta data concerning the DeeplyNestedArray contract.
@ -55,7 +57,7 @@ func (c *DeeplyNestedArray) Instance(backend bind.ContractBackend, addr common.A
// the contract method with ID 0x98ed1856. // the contract method with ID 0x98ed1856.
// //
// Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64) // Solidity: function deepUint64Array(uint256 , uint256 , uint256 ) view returns(uint64)
func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *big.Int, arg1 *big.Int, arg2 *big.Int) []byte { func (deeplyNestedArray *DeeplyNestedArray) PackDeepUint64Array(arg0 *uint256.Int, arg1 *uint256.Int, arg2 *uint256.Int) []byte {
enc, err := deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2) enc, err := deeplyNestedArray.abi.Pack("deepUint64Array", arg0, arg1, arg2)
if err != nil { if err != nil {
panic(err) panic(err)

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// EmptyMetaData contains all meta data concerning the Empty contract. // EmptyMetaData contains all meta data concerning the Empty contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// EventCheckerMetaData contains all meta data concerning the EventChecker contract. // EventCheckerMetaData contains all meta data concerning the EventChecker contract.
@ -220,8 +222,8 @@ func (eventChecker *EventChecker) UnpackMixedEvent(log *types.Log) (*EventChecke
// EventCheckerUnnamed represents a unnamed event raised by the EventChecker contract. // EventCheckerUnnamed represents a unnamed event raised by the EventChecker contract.
type EventCheckerUnnamed struct { type EventCheckerUnnamed struct {
Arg0 *big.Int Arg0 *uint256.Int
Arg1 *big.Int Arg1 *uint256.Int
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// GetterMetaData contains all meta data concerning the Getter contract. // GetterMetaData contains all meta data concerning the Getter contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// IdentifierCollisionMetaData contains all meta data concerning the IdentifierCollision contract. // IdentifierCollisionMetaData contains all meta data concerning the IdentifierCollision contract.
@ -67,12 +69,12 @@ func (identifierCollision *IdentifierCollision) PackMyVar() []byte {
// from invoking the contract method with ID 0x4ef1f0ad. // from invoking the contract method with ID 0x4ef1f0ad.
// //
// Solidity: function MyVar() view returns(uint256) // Solidity: function MyVar() view returns(uint256)
func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*big.Int, error) { func (identifierCollision *IdentifierCollision) UnpackMyVar(data []byte) (*uint256.Int, error) {
out, err := identifierCollision.abi.Unpack("MyVar", data) out, err := identifierCollision.abi.Unpack("MyVar", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -92,11 +94,11 @@ func (identifierCollision *IdentifierCollision) PackPubVar() []byte {
// from invoking the contract method with ID 0x01ad4d87. // from invoking the contract method with ID 0x01ad4d87.
// //
// Solidity: function _myVar() view returns(uint256) // Solidity: function _myVar() view returns(uint256)
func (identifierCollision *IdentifierCollision) UnpackPubVar(data []byte) (*big.Int, error) { func (identifierCollision *IdentifierCollision) UnpackPubVar(data []byte) (*uint256.Int, error) {
out, err := identifierCollision.abi.Unpack("_myVar", data) out, err := identifierCollision.abi.Unpack("_myVar", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// InputCheckerMetaData contains all meta data concerning the InputChecker contract. // InputCheckerMetaData contains all meta data concerning the InputChecker contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// InteractorMetaData contains all meta data concerning the Interactor contract. // InteractorMetaData contains all meta data concerning the Interactor contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// Oraclerequest is an auto generated low-level Go binding around an user-defined struct. // Oraclerequest is an auto generated low-level Go binding around an user-defined struct.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// NumericMethodNameMetaData contains all meta data concerning the NumericMethodName contract. // NumericMethodNameMetaData contains all meta data concerning the NumericMethodName contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// OutputCheckerMetaData contains all meta data concerning the OutputChecker contract. // OutputCheckerMetaData contains all meta data concerning the OutputChecker contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// OverloadMetaData contains all meta data concerning the Overload contract. // OverloadMetaData contains all meta data concerning the Overload contract.
@ -55,7 +57,7 @@ func (c *Overload) Instance(backend bind.ContractBackend, addr common.Address) *
// the contract method with ID 0x04bc52f8. // the contract method with ID 0x04bc52f8.
// //
// Solidity: function foo(uint256 i, uint256 j) returns() // Solidity: function foo(uint256 i, uint256 j) returns()
func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte { func (overload *Overload) PackFoo(i *uint256.Int, j *uint256.Int) []byte {
enc, err := overload.abi.Pack("foo", i, j) enc, err := overload.abi.Pack("foo", i, j)
if err != nil { if err != nil {
panic(err) panic(err)
@ -67,7 +69,7 @@ func (overload *Overload) PackFoo(i *big.Int, j *big.Int) []byte {
// the contract method with ID 0x2fbebd38. // the contract method with ID 0x2fbebd38.
// //
// Solidity: function foo(uint256 i) returns() // Solidity: function foo(uint256 i) returns()
func (overload *Overload) PackFoo0(i *big.Int) []byte { func (overload *Overload) PackFoo0(i *uint256.Int) []byte {
enc, err := overload.abi.Pack("foo0", i) enc, err := overload.abi.Pack("foo0", i)
if err != nil { if err != nil {
panic(err) panic(err)
@ -77,7 +79,7 @@ func (overload *Overload) PackFoo0(i *big.Int) []byte {
// OverloadBar represents a bar event raised by the Overload contract. // OverloadBar represents a bar event raised by the Overload contract.
type OverloadBar struct { type OverloadBar struct {
I *big.Int I *uint256.Int
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }
@ -118,8 +120,8 @@ func (overload *Overload) UnpackBarEvent(log *types.Log) (*OverloadBar, error) {
// OverloadBar0 represents a bar0 event raised by the Overload contract. // OverloadBar0 represents a bar0 event raised by the Overload contract.
type OverloadBar0 struct { type OverloadBar0 struct {
I *big.Int I *uint256.Int
J *big.Int J *uint256.Int
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// RangeKeywordMetaData contains all meta data concerning the RangeKeyword contract. // RangeKeywordMetaData contains all meta data concerning the RangeKeyword contract.
@ -55,7 +57,7 @@ func (c *RangeKeyword) Instance(backend bind.ContractBackend, addr common.Addres
// the contract method with ID 0x527a119f. // the contract method with ID 0x527a119f.
// //
// Solidity: function functionWithKeywordParameter(uint256 range) pure returns() // Solidity: function functionWithKeywordParameter(uint256 range) pure returns()
func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *big.Int) []byte { func (rangeKeyword *RangeKeyword) PackFunctionWithKeywordParameter(arg0 *uint256.Int) []byte {
enc, err := rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0) enc, err := rangeKeyword.abi.Pack("functionWithKeywordParameter", arg0)
if err != nil { if err != nil {
panic(err) panic(err)

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// SlicerMetaData contains all meta data concerning the Slicer contract. // SlicerMetaData contains all meta data concerning the Slicer contract.
@ -105,7 +107,7 @@ func (slicer *Slicer) UnpackEchoBools(data []byte) ([]bool, error) {
// the contract method with ID 0xd88becc0. // the contract method with ID 0xd88becc0.
// //
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte { func (slicer *Slicer) PackEchoFancyInts(input [23]*uint256.Int) []byte {
enc, err := slicer.abi.Pack("echoFancyInts", input) enc, err := slicer.abi.Pack("echoFancyInts", input)
if err != nil { if err != nil {
panic(err) panic(err)
@ -117,12 +119,12 @@ func (slicer *Slicer) PackEchoFancyInts(input [23]*big.Int) []byte {
// from invoking the contract method with ID 0xd88becc0. // from invoking the contract method with ID 0xd88becc0.
// //
// Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output) // Solidity: function echoFancyInts(uint24[23] input) returns(uint24[23] output)
func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*big.Int, error) { func (slicer *Slicer) UnpackEchoFancyInts(data []byte) ([23]*uint256.Int, error) {
out, err := slicer.abi.Unpack("echoFancyInts", data) out, err := slicer.abi.Unpack("echoFancyInts", data)
if err != nil { if err != nil {
return *new([23]*big.Int), err return *new([23]*uint256.Int), err
} }
out0 := *abi.ConvertType(out[0], new([23]*big.Int)).(*[23]*big.Int) out0 := *abi.ConvertType(out[0], new([23]*uint256.Int)).(*[23]*uint256.Int)
return out0, err return out0, err
} }

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// Struct0 is an auto generated low-level Go binding around an user-defined struct. // Struct0 is an auto generated low-level Go binding around an user-defined struct.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// Struct0 is an auto generated low-level Go binding around an user-defined struct. // Struct0 is an auto generated low-level Go binding around an user-defined struct.
@ -72,7 +74,7 @@ func (structs *Structs) PackF() []byte {
// method F. // method F.
type FOutput struct { type FOutput struct {
A []Struct0 A []Struct0
C []*big.Int C []*uint256.Int
D []bool D []bool
} }
@ -87,7 +89,7 @@ func (structs *Structs) UnpackF(data []byte) (FOutput, error) {
return *outstruct, err return *outstruct, err
} }
outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0) outstruct.A = *abi.ConvertType(out[0], new([]Struct0)).(*[]Struct0)
outstruct.C = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) outstruct.C = *abi.ConvertType(out[1], new([]*uint256.Int)).(*[]*uint256.Int)
outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool) outstruct.D = *abi.ConvertType(out[2], new([]bool)).(*[]bool)
return *outstruct, err return *outstruct, err

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// TokenMetaData contains all meta data concerning the Token contract. // TokenMetaData contains all meta data concerning the Token contract.
@ -55,7 +57,7 @@ func (c *Token) Instance(backend bind.ContractBackend, addr common.Address) *bin
// contract deployment. // contract deployment.
// //
// Solidity: constructor(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol) returns() // Solidity: constructor(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol) returns()
func (token *Token) PackConstructor(initialSupply *big.Int, tokenName string, decimalUnits uint8, tokenSymbol string) []byte { func (token *Token) PackConstructor(initialSupply *uint256.Int, tokenName string, decimalUnits uint8, tokenSymbol string) []byte {
enc, err := token.abi.Pack("", initialSupply, tokenName, decimalUnits, tokenSymbol) enc, err := token.abi.Pack("", initialSupply, tokenName, decimalUnits, tokenSymbol)
if err != nil { if err != nil {
panic(err) panic(err)
@ -79,12 +81,12 @@ func (token *Token) PackAllowance(arg0 common.Address, arg1 common.Address) []by
// from invoking the contract method with ID 0xdd62ed3e. // from invoking the contract method with ID 0xdd62ed3e.
// //
// Solidity: function allowance(address , address ) returns(uint256) // Solidity: function allowance(address , address ) returns(uint256)
func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) { func (token *Token) UnpackAllowance(data []byte) (*uint256.Int, error) {
out, err := token.abi.Unpack("allowance", data) out, err := token.abi.Unpack("allowance", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -92,7 +94,7 @@ func (token *Token) UnpackAllowance(data []byte) (*big.Int, error) {
// the contract method with ID 0xcae9ca51. // the contract method with ID 0xcae9ca51.
// //
// Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success) // Solidity: function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns(bool success)
func (token *Token) PackApproveAndCall(spender common.Address, value *big.Int, extraData []byte) []byte { func (token *Token) PackApproveAndCall(spender common.Address, value *uint256.Int, extraData []byte) []byte {
enc, err := token.abi.Pack("approveAndCall", spender, value, extraData) enc, err := token.abi.Pack("approveAndCall", spender, value, extraData)
if err != nil { if err != nil {
panic(err) panic(err)
@ -129,12 +131,12 @@ func (token *Token) PackBalanceOf(arg0 common.Address) []byte {
// from invoking the contract method with ID 0x70a08231. // from invoking the contract method with ID 0x70a08231.
// //
// Solidity: function balanceOf(address ) returns(uint256) // Solidity: function balanceOf(address ) returns(uint256)
func (token *Token) UnpackBalanceOf(data []byte) (*big.Int, error) { func (token *Token) UnpackBalanceOf(data []byte) (*uint256.Int, error) {
out, err := token.abi.Unpack("balanceOf", data) out, err := token.abi.Unpack("balanceOf", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -204,12 +206,12 @@ func (token *Token) PackSpentAllowance(arg0 common.Address, arg1 common.Address)
// from invoking the contract method with ID 0xdc3080f2. // from invoking the contract method with ID 0xdc3080f2.
// //
// Solidity: function spentAllowance(address , address ) returns(uint256) // Solidity: function spentAllowance(address , address ) returns(uint256)
func (token *Token) UnpackSpentAllowance(data []byte) (*big.Int, error) { func (token *Token) UnpackSpentAllowance(data []byte) (*uint256.Int, error) {
out, err := token.abi.Unpack("spentAllowance", data) out, err := token.abi.Unpack("spentAllowance", data)
if err != nil { if err != nil {
return new(big.Int), err return new(uint256.Int), err
} }
out0 := abi.ConvertType(out[0], new(big.Int)).(*big.Int) out0 := abi.ConvertType(out[0], new(uint256.Int)).(*uint256.Int)
return out0, err return out0, err
} }
@ -242,7 +244,7 @@ func (token *Token) UnpackSymbol(data []byte) (string, error) {
// the contract method with ID 0xa9059cbb. // the contract method with ID 0xa9059cbb.
// //
// Solidity: function transfer(address _to, uint256 _value) returns() // Solidity: function transfer(address _to, uint256 _value) returns()
func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte { func (token *Token) PackTransfer(to common.Address, value *uint256.Int) []byte {
enc, err := token.abi.Pack("transfer", to, value) enc, err := token.abi.Pack("transfer", to, value)
if err != nil { if err != nil {
panic(err) panic(err)
@ -254,7 +256,7 @@ func (token *Token) PackTransfer(to common.Address, value *big.Int) []byte {
// the contract method with ID 0x23b872dd. // the contract method with ID 0x23b872dd.
// //
// Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success) // Solidity: function transferFrom(address _from, address _to, uint256 _value) returns(bool success)
func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *big.Int) []byte { func (token *Token) PackTransferFrom(from common.Address, to common.Address, value *uint256.Int) []byte {
enc, err := token.abi.Pack("transferFrom", from, to, value) enc, err := token.abi.Pack("transferFrom", from, to, value)
if err != nil { if err != nil {
panic(err) panic(err)
@ -279,7 +281,7 @@ func (token *Token) UnpackTransferFrom(data []byte) (bool, error) {
type TokenTransfer struct { type TokenTransfer struct {
From common.Address From common.Address
To common.Address To common.Address
Value *big.Int Value *uint256.Int
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// TupleP is an auto generated low-level Go binding around an user-defined struct. // TupleP is an auto generated low-level Go binding around an user-defined struct.
@ -38,15 +40,15 @@ type TupleQ struct {
// TupleS is an auto generated low-level Go binding around an user-defined struct. // TupleS is an auto generated low-level Go binding around an user-defined struct.
type TupleS struct { type TupleS struct {
A *big.Int A *uint256.Int
B []*big.Int B []*uint256.Int
C []TupleT C []TupleT
} }
// TupleT is an auto generated low-level Go binding around an user-defined struct. // TupleT is an auto generated low-level Go binding around an user-defined struct.
type TupleT struct { type TupleT struct {
X *big.Int X *uint256.Int
Y *big.Int Y *uint256.Int
} }
// TupleMetaData contains all meta data concerning the Tuple contract. // TupleMetaData contains all meta data concerning the Tuple contract.
@ -80,7 +82,7 @@ func (c *Tuple) Instance(backend bind.ContractBackend, addr common.Address) *bin
// the contract method with ID 0x443c79b4. // the contract method with ID 0x443c79b4.
// //
// Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[]) // Solidity: function func1((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) pure returns((uint256,uint256[],(uint256,uint256)[]), (uint256,uint256)[2][], (uint256,uint256)[][2], (uint256,uint256[],(uint256,uint256)[])[], uint256[])
func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte { func (tuple *Tuple) PackFunc1(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*uint256.Int) []byte {
enc, err := tuple.abi.Pack("func1", a, b, c, d, e) enc, err := tuple.abi.Pack("func1", a, b, c, d, e)
if err != nil { if err != nil {
panic(err) panic(err)
@ -95,7 +97,7 @@ type Func1Output struct {
Arg1 [][2]TupleT Arg1 [][2]TupleT
Arg2 [2][]TupleT Arg2 [2][]TupleT
Arg3 []TupleS Arg3 []TupleS
Arg4 []*big.Int Arg4 []*uint256.Int
} }
// UnpackFunc1 is the Go binding that unpacks the parameters returned // UnpackFunc1 is the Go binding that unpacks the parameters returned
@ -112,7 +114,7 @@ func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) {
outstruct.Arg1 = *abi.ConvertType(out[1], new([][2]TupleT)).(*[][2]TupleT) outstruct.Arg1 = *abi.ConvertType(out[1], new([][2]TupleT)).(*[][2]TupleT)
outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT) outstruct.Arg2 = *abi.ConvertType(out[2], new([2][]TupleT)).(*[2][]TupleT)
outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS) outstruct.Arg3 = *abi.ConvertType(out[3], new([]TupleS)).(*[]TupleS)
outstruct.Arg4 = *abi.ConvertType(out[4], new([]*big.Int)).(*[]*big.Int) outstruct.Arg4 = *abi.ConvertType(out[4], new([]*uint256.Int)).(*[]*uint256.Int)
return *outstruct, err return *outstruct, err
} }
@ -121,7 +123,7 @@ func (tuple *Tuple) UnpackFunc1(data []byte) (Func1Output, error) {
// the contract method with ID 0xd0062cdd. // the contract method with ID 0xd0062cdd.
// //
// Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns() // Solidity: function func2((uint256,uint256[],(uint256,uint256)[]) a, (uint256,uint256)[2][] b, (uint256,uint256)[][2] c, (uint256,uint256[],(uint256,uint256)[])[] d, uint256[] e) returns()
func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*big.Int) []byte { func (tuple *Tuple) PackFunc2(a TupleS, b [][2]TupleT, c [2][]TupleT, d []TupleS, e []*uint256.Int) []byte {
enc, err := tuple.abi.Pack("func2", a, b, c, d, e) enc, err := tuple.abi.Pack("func2", a, b, c, d, e)
if err != nil { if err != nil {
panic(err) panic(err)
@ -147,7 +149,7 @@ type TupleTupleEvent struct {
B [][2]TupleT B [][2]TupleT
C [2][]TupleT C [2][]TupleT
D []TupleS D []TupleS
E []*big.Int E []*uint256.Int
Raw *types.Log // Blockchain specific contextual infos Raw *types.Log // Blockchain specific contextual infos
} }

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// TuplerMetaData contains all meta data concerning the Tupler contract. // TuplerMetaData contains all meta data concerning the Tupler contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// UnderscorerMetaData contains all meta data concerning the Underscorer contract. // UnderscorerMetaData contains all meta data concerning the Underscorer contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// DBStats is an auto generated low-level Go binding around an user-defined struct. // DBStats is an auto generated low-level Go binding around an user-defined struct.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// CMetaData contains all meta data concerning the C contract. // CMetaData contains all meta data concerning the C contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// C1MetaData contains all meta data concerning the C1 contract. // C1MetaData contains all meta data concerning the C1 contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// CMetaData contains all meta data concerning the C contract. // CMetaData contains all meta data concerning the C contract.

View file

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/v2" "github.com/ethereum/go-ethereum/accounts/abi/bind/v2"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/holiman/uint256"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -22,6 +23,7 @@ var (
_ = common.Big1 _ = common.Big1
_ = types.BloomLookup _ = types.BloomLookup
_ = abi.ConvertType _ = abi.ConvertType
_ = uint256.NewInt
) )
// MyContractMetaData contains all meta data concerning the MyContract contract. // MyContractMetaData contains all meta data concerning the MyContract contract.

View file

@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/common/math"
"github.com/holiman/uint256"
) )
// packBytesSlice packs the given bytes as [L, V] as the canonical representation // packBytesSlice packs the given bytes as [L, V] as the canonical representation
@ -78,6 +79,9 @@ func packNum(value reflect.Value) []byte {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return math.U256Bytes(big.NewInt(value.Int())) return math.U256Bytes(big.NewInt(value.Int()))
case reflect.Ptr: case reflect.Ptr:
if v, ok := value.Interface().(*uint256.Int); ok {
return math.U256Bytes(v.ToBig())
}
return math.U256Bytes(new(big.Int).Set(value.Interface().(*big.Int))) return math.U256Bytes(new(big.Int).Set(value.Interface().(*big.Int)))
default: default:
panic("abi: fatal error") panic("abi: fatal error")

View file

@ -22,6 +22,8 @@ import (
"math/big" "math/big"
"reflect" "reflect"
"strings" "strings"
"github.com/holiman/uint256"
) )
// ConvertType converts an interface of a runtime type into an interface of the // ConvertType converts an interface of a runtime type into an interface of the
@ -51,9 +53,9 @@ func ConvertType(in interface{}, proto interface{}) interface{} {
} }
// indirect recursively dereferences the value until it either gets the value // indirect recursively dereferences the value until it either gets the value
// or finds a big.Int // or finds a big.Int or uint256.Int
func indirect(v reflect.Value) reflect.Value { func indirect(v reflect.Value) reflect.Value {
if v.Kind() == reflect.Ptr && v.Elem().Type() != reflect.TypeOf(big.Int{}) { if v.Kind() == reflect.Ptr && v.Elem().Type() != reflect.TypeOf(big.Int{}) && v.Elem().Type() != reflect.TypeOf(uint256.Int{}) {
return indirect(v.Elem()) return indirect(v.Elem())
} }
return v return v
@ -73,6 +75,7 @@ func reflectIntType(unsigned bool, size int) reflect.Type {
case 64: case 64:
return reflect.TypeOf(uint64(0)) return reflect.TypeOf(uint64(0))
} }
return reflect.TypeOf(&uint256.Int{})
} }
switch size { switch size {
case 8: case 8:
@ -104,7 +107,7 @@ func set(dst, src reflect.Value) error {
switch { switch {
case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Ptr || dst.Elem().CanSet()): case dstType.Kind() == reflect.Interface && dst.Elem().IsValid() && (dst.Elem().Type().Kind() == reflect.Ptr || dst.Elem().CanSet()):
return set(dst.Elem(), src) return set(dst.Elem(), src)
case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeOf(big.Int{}): case dstType.Kind() == reflect.Ptr && dstType.Elem() != reflect.TypeOf(big.Int{}) && dstType.Elem() != reflect.TypeOf(uint256.Int{}):
return set(dst.Elem(), src) return set(dst.Elem(), src)
case srcType.AssignableTo(dstType) && dst.CanSet(): case srcType.AssignableTo(dstType) && dst.CanSet():
dst.Set(src) dst.Set(src)

View file

@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/holiman/uint256"
) )
// MakeTopics converts a filter query argument list into a filter topic set. // MakeTopics converts a filter query argument list into a filter topic set.
@ -43,6 +44,8 @@ func MakeTopics(query ...[]interface{}) ([][]common.Hash, error) {
copy(topic[common.HashLength-common.AddressLength:], rule[:]) copy(topic[common.HashLength-common.AddressLength:], rule[:])
case *big.Int: case *big.Int:
copy(topic[:], math.U256Bytes(new(big.Int).Set(rule))) copy(topic[:], math.U256Bytes(new(big.Int).Set(rule)))
case *uint256.Int:
copy(topic[:], math.U256Bytes(rule.ToBig()))
case bool: case bool:
if rule { if rule {
topic[common.HashLength-1] = 1 topic[common.HashLength-1] = 1

View file

@ -25,6 +25,7 @@ import (
"reflect" "reflect"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/holiman/uint256"
) )
var ( var (
@ -36,9 +37,10 @@ var (
// ReadInteger reads the integer based on its kind and returns the appropriate value. // ReadInteger reads the integer based on its kind and returns the appropriate value.
func ReadInteger(typ Type, b []byte) (interface{}, error) { func ReadInteger(typ Type, b []byte) (interface{}, error) {
ret := new(big.Int).SetBytes(b)
if typ.T == UintTy { if typ.T == UintTy {
ret := new(uint256.Int).SetBytes(b)
u64, isu64 := ret.Uint64(), ret.IsUint64() u64, isu64 := ret.Uint64(), ret.IsUint64()
switch typ.Size { switch typ.Size {
case 8: case 8:
@ -67,6 +69,8 @@ func ReadInteger(typ Type, b []byte) (interface{}, error) {
} }
} }
ret := new(big.Int).SetBytes(b)
// big.SetBytes can't tell if a number is negative or positive in itself. // big.SetBytes can't tell if a number is negative or positive in itself.
// On EVM, if the returned number > max int256, it is negative. // On EVM, if the returned number > max int256, it is negative.
// A number is > max int256 if the bit at position 255 is set. // A number is > max int256 if the bit at position 255 is set.