forked from multiversx/mx-chain-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseAccount.go
48 lines (39 loc) · 1.22 KB
/
baseAccount.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
package state
import (
"github.com/ElrondNetwork/elrond-go/data"
)
type baseAccount struct {
address []byte
code []byte
dataTrieTracker DataTrieTracker
hasNewCode bool
}
// AddressBytes returns the address associated with the account as byte slice
func (ba *baseAccount) AddressBytes() []byte {
return ba.address
}
// SetCode sets the actual code that needs to be run in the VM
func (ba *baseAccount) SetCode(code []byte) {
ba.hasNewCode = true
ba.code = code
}
// DataTrie returns the trie that holds the current account's data
func (ba *baseAccount) DataTrie() data.Trie {
return ba.dataTrieTracker.DataTrie()
}
// SetDataTrie sets the trie that holds the current account's data
func (ba *baseAccount) SetDataTrie(trie data.Trie) {
ba.dataTrieTracker.SetDataTrie(trie)
}
// DataTrieTracker returns the trie wrapper used in managing the SC data
func (ba *baseAccount) DataTrieTracker() DataTrieTracker {
return ba.dataTrieTracker
}
// HasNewCode returns true if there was a code change for the account
func (ba *baseAccount) HasNewCode() bool {
return ba.hasNewCode
}
// IsInterfaceNil returns true if there is no value under the interface
func (ba *baseAccount) IsInterfaceNil() bool {
return ba == nil
}