-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevm_contract.go
51 lines (47 loc) · 1.34 KB
/
evm_contract.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
package chain
import (
"github.com/saveio/themis-go-sdk/auth"
"github.com/saveio/themis-go-sdk/client"
"github.com/saveio/themis-go-sdk/dns"
"github.com/saveio/themis-go-sdk/fs"
cgp "github.com/saveio/themis-go-sdk/globalparam"
"github.com/saveio/themis-go-sdk/governance"
"github.com/saveio/themis-go-sdk/ontid"
"github.com/saveio/themis-go-sdk/usdt"
"github.com/saveio/themis/account"
)
type EVMContract struct {
ERC20 *usdt.ERC20
OntId *ontid.OntId
GlobalParams *cgp.GlobalParam
Auth *auth.Auth
Fs *fs.Fs
Dns *dns.Dns
Governance *governance.Governance
}
func newEVMContract(client *client.ClientMgr) *EVMContract {
evm := &EVMContract{}
evm.ERC20 = &usdt.ERC20{Client: client}
evm.OntId = &ontid.OntId{Client: client}
evm.GlobalParams = &cgp.GlobalParam{Client: client}
evm.Auth = &auth.Auth{Client: client}
evm.Dns = &dns.Dns{}
evm.Dns.NewClient(&dns.EVM{
Client: client,
DefAcc: nil,
})
evm.Fs = &fs.Fs{}
evm.Fs.NewClient(&fs.EVM{
Client: client,
DefAcc: nil,
PollForTxDuration: DEFAULT_POLL_FOR_CONFIRM_DURATION,
})
evm.Governance = &governance.Governance{Client: client}
return evm
}
func (e *EVMContract) SetDefaultAccount(acc *account.Account) {
e.ERC20.DefAcc = acc
e.Fs.SetDefaultAccount(acc)
e.Dns.SetDefaultAccount(acc)
e.Governance.DefAcc = acc
}