Documentation
¶
Index ¶
- Variables
- func DeSmartContractKey(deKey string) (string, string)
- func EnSmartContractKey(scAddr string, key string) string
- type CacheKVs
- type ContractStateDelta
- type ILedgerSmartContract
- type ISmartConstract
- type SmartConstract
- func (sctx *SmartConstract) AddChangesForPersistence(writeBatch []*db.WriteBatch) ([]*db.WriteBatch, error)
- func (sctx *SmartConstract) AddState(key string, value []byte)
- func (sctx *SmartConstract) AddTransfer(fromAddr, toAddr string, amount *big.Int, txType uint32)
- func (sctx *SmartConstract) CurrentBlockHeight() uint32
- func (sctx *SmartConstract) DelState(key string)
- func (sctx *SmartConstract) ExecTransaction(tx *types.Transaction, scAddr string)
- func (sctx *SmartConstract) FinishContractTransaction() (types.Transactions, error)
- func (sctx *SmartConstract) GetBalances(addr string) (*big.Int, error)
- func (sctx *SmartConstract) GetState(key string) ([]byte, error)
- func (sctx *SmartConstract) InProgress() bool
- func (sctx *SmartConstract) SmartContractCommitted()
- func (sctx *SmartConstract) SmartContractFailed()
- func (sctx *SmartConstract) StartConstract(blockHeight uint32)
- func (sctx *SmartConstract) StopContract(blockHeight uint32)
- type StateExtra
Constants ¶
This section is empty.
Variables ¶
View Source
var DeployAddr = []byte("00000000000000000000")
Functions ¶
func DeSmartContractKey ¶
func EnSmartContractKey ¶
Types ¶
type ContractStateDelta ¶
type ContractStateDelta struct {
// contains filtered or unexported fields
}
type ILedgerSmartContract ¶
type ISmartConstract ¶
type ISmartConstract interface {
GetState(key string) ([]byte, error)
AddState(key string, value []byte)
DelState(key string)
GetBalances(addr string) (*big.Int, error)
CurrentBlockHeight() uint32
AddTransfer(fromAddr, toAddr string, amount *big.Int, txType uint32)
SmartContractFailed()
SmartContractCommitted()
}
type SmartConstract ¶
type SmartConstract struct {
// contains filtered or unexported fields
}
State represents the account state
func NewSmartConstract ¶
func NewSmartConstract(db *db.BlockchainDB, ledgerHandler ILedgerSmartContract) *SmartConstract
NewSmartConstract returns a new State
func (*SmartConstract) AddChangesForPersistence ¶
func (sctx *SmartConstract) AddChangesForPersistence(writeBatch []*db.WriteBatch) ([]*db.WriteBatch, error)
AddChangesForPersistence put cache data into db
func (*SmartConstract) AddState ¶
func (sctx *SmartConstract) AddState(key string, value []byte)
AddState put key-value into cache
func (*SmartConstract) AddTransfer ¶
func (sctx *SmartConstract) AddTransfer(fromAddr, toAddr string, amount *big.Int, txType uint32)
AddTransfer add transfer to make new transaction
func (*SmartConstract) CurrentBlockHeight ¶
func (sctx *SmartConstract) CurrentBlockHeight() uint32
CurrentBlockHeight get currentBlockHeight
func (*SmartConstract) DelState ¶
func (sctx *SmartConstract) DelState(key string)
DelState remove key-value
func (*SmartConstract) ExecTransaction ¶
func (sctx *SmartConstract) ExecTransaction(tx *types.Transaction, scAddr string)
ExecTransaction exec transaction
func (*SmartConstract) FinishContractTransaction ¶
func (sctx *SmartConstract) FinishContractTransaction() (types.Transactions, error)
FinishContractTransaction finish contract transaction
func (*SmartConstract) GetBalances ¶
func (sctx *SmartConstract) GetBalances(addr string) (*big.Int, error)
GetBalances get balance
func (*SmartConstract) GetState ¶
func (sctx *SmartConstract) GetState(key string) ([]byte, error)
GetState get value
func (*SmartConstract) SmartContractCommitted ¶
func (sctx *SmartConstract) SmartContractCommitted()
SmartContractCommitted execute smartContract successfully
func (*SmartConstract) SmartContractFailed ¶
func (sctx *SmartConstract) SmartContractFailed()
SmartContractFailed execute smartContract fail
func (*SmartConstract) StartConstract ¶
func (sctx *SmartConstract) StartConstract(blockHeight uint32)
StartConstract start constract
func (*SmartConstract) StopContract ¶
func (sctx *SmartConstract) StopContract(blockHeight uint32)
StopContract start contract
type StateExtra ¶
type StateExtra struct {
ContractStateDeltas map[string]*ContractStateDelta
// contains filtered or unexported fields
}
func NewStateExtra ¶
func NewStateExtra() *StateExtra
Click to show internal directories.
Click to hide internal directories.