-
Notifications
You must be signed in to change notification settings - Fork 0
/
deposit.go
108 lines (85 loc) · 2.7 KB
/
deposit.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Code generated by ethgo/abigen. DO NOT EDIT.
// Hash: c7ac9f62b1ca54bf9b6bcedde8041ba5961c2ef62683c4ff6b77a19ae09bab7a
// Version: 0.1.2
package deposit
import (
"fmt"
"math/big"
"github.com/umbracle/ethgo"
"github.com/umbracle/ethgo/contract"
"github.com/umbracle/ethgo/jsonrpc"
)
var (
_ = big.NewInt
_ = jsonrpc.NewClient
)
// Deposit is a solidity contract
type Deposit struct {
c *contract.Contract
}
// DeployDeposit deploys a new Deposit contract
func DeployDeposit(provider *jsonrpc.Client, from ethgo.Address, args []interface{}, opts ...contract.ContractOption) (contract.Txn, error) {
return contract.DeployContract(abiDeposit, binDeposit, args, opts...)
}
// NewDeposit creates a new instance of the contract at a specific address
func NewDeposit(addr ethgo.Address, opts ...contract.ContractOption) *Deposit {
return &Deposit{c: contract.NewContract(addr, abiDeposit, opts...)}
}
// calls
// GetDepositCount calls the get_deposit_count method in the solidity contract
func (d *Deposit) GetDepositCount(block ...ethgo.BlockNumber) (retval0 []byte, err error) {
var out map[string]interface{}
var ok bool
out, err = d.c.Call("get_deposit_count", ethgo.EncodeBlock(block...))
if err != nil {
return
}
// decode outputs
retval0, ok = out["0"].([]byte)
if !ok {
err = fmt.Errorf("failed to encode output at index 0")
return
}
return
}
// GetDepositRoot calls the get_deposit_root method in the solidity contract
func (d *Deposit) GetDepositRoot(block ...ethgo.BlockNumber) (retval0 [32]byte, err error) {
var out map[string]interface{}
var ok bool
out, err = d.c.Call("get_deposit_root", ethgo.EncodeBlock(block...))
if err != nil {
return
}
// decode outputs
retval0, ok = out["0"].([32]byte)
if !ok {
err = fmt.Errorf("failed to encode output at index 0")
return
}
return
}
// SupportsInterface calls the supportsInterface method in the solidity contract
func (d *Deposit) SupportsInterface(interfaceId [4]byte, block ...ethgo.BlockNumber) (retval0 bool, err error) {
var out map[string]interface{}
var ok bool
out, err = d.c.Call("supportsInterface", ethgo.EncodeBlock(block...), interfaceId)
if err != nil {
return
}
// decode outputs
retval0, ok = out["0"].(bool)
if !ok {
err = fmt.Errorf("failed to encode output at index 0")
return
}
return
}
// txns
// Deposit sends a deposit transaction in the solidity contract
func (d *Deposit) Deposit(pubkey []byte, withdrawalCredentials []byte, signature []byte, depositDataRoot [32]byte) (contract.Txn, error) {
return d.c.Txn("deposit", pubkey, withdrawalCredentials, signature, depositDataRoot)
}
// events
func (d *Deposit) DepositEventEventSig() ethgo.Hash {
return d.c.GetABI().Events["DepositEvent"].ID()
}