aboutsummaryrefslogtreecommitdiffstats
path: root/mobile
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-01-07 01:30:44 +0800
committerGitHub <noreply@github.com>2017-01-07 01:30:44 +0800
commitac93a6ff6cd1200ab0fb67a5bd0c02cb70646632 (patch)
tree2b06aa1b360f1488264058d04e399e84b898f0d8 /mobile
parent444fc892b0a860218dab3e421d92c33408b9eb6d (diff)
parent13e3b2f433c48fe81423c1a13e9a5194ece61b01 (diff)
downloadgo-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.gz
go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.zst
go-tangerine-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.zip
Merge pull request #3525 from fjl/all-gosimple-cleanup
all: clean up lint issues, remove more dead code
Diffstat (limited to 'mobile')
-rw-r--r--mobile/bind.go29
-rw-r--r--mobile/p2p.go2
2 files changed, 6 insertions, 25 deletions
diff --git a/mobile/bind.go b/mobile/bind.go
index a25c37aca..bc4eb25ba 100644
--- a/mobile/bind.go
+++ b/mobile/bind.go
@@ -114,17 +114,12 @@ type BoundContract struct {
// DeployContract deploys a contract onto the Ethereum blockchain and binds the
// deployment address with a wrapper.
func DeployContract(opts *TransactOpts, abiJSON string, bytecode []byte, client *EthereumClient, args *Interfaces) (contract *BoundContract, _ error) {
- // Convert all the deployment parameters to Go types
- params := make([]interface{}, len(args.objects))
- for i, obj := range args.objects {
- params[i] = obj
- }
// Deploy the contract to the network
parsed, err := abi.JSON(strings.NewReader(abiJSON))
if err != nil {
return nil, err
}
- addr, tx, bound, err := bind.DeployContract(&opts.opts, parsed, bytecode, client.client, params...)
+ addr, tx, bound, err := bind.DeployContract(&opts.opts, parsed, bytecode, client.client, args.objects...)
if err != nil {
return nil, err
}
@@ -159,32 +154,18 @@ func (c *BoundContract) GetDeployer() *Transaction {
// Call invokes the (constant) contract method with params as input values and
// sets the output to result.
func (c *BoundContract) Call(opts *CallOpts, out *Interfaces, method string, args *Interfaces) error {
- // Convert all the input and output parameters to Go types
- params := make([]interface{}, len(args.objects))
- for i, obj := range args.objects {
- params[i] = obj
- }
results := make([]interface{}, len(out.objects))
- for i, obj := range out.objects {
- results[i] = obj
- }
- // Execute the call to the contract and wrap any results
- if err := c.contract.Call(&opts.opts, &results, method, params...); err != nil {
+ copy(results, out.objects)
+ if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil {
return err
}
- for i, res := range results {
- out.objects[i] = res
- }
+ copy(out.objects, results)
return nil
}
// Transact invokes the (paid) contract method with params as input values.
func (c *BoundContract) Transact(opts *TransactOpts, method string, args *Interfaces) (tx *Transaction, _ error) {
- params := make([]interface{}, len(args.objects))
- for i, obj := range args.objects {
- params[i] = obj
- }
- rawTx, err := c.contract.Transact(&opts.opts, method, params)
+ rawTx, err := c.contract.Transact(&opts.opts, method, args.objects)
if err != nil {
return nil, err
}
diff --git a/mobile/p2p.go b/mobile/p2p.go
index e717d4004..8d21639e5 100644
--- a/mobile/p2p.go
+++ b/mobile/p2p.go
@@ -38,7 +38,7 @@ func (ni *NodeInfo) GetListenerPort() int { return ni.info.Ports.Listener
func (ni *NodeInfo) GetListenerAddress() string { return ni.info.ListenAddr }
func (ni *NodeInfo) GetProtocols() *Strings {
protos := []string{}
- for proto, _ := range ni.info.Protocols {
+ for proto := range ni.info.Protocols {
protos = append(protos, proto)
}
return &Strings{protos}