Documentation ¶
Index ¶
- Constants
- Variables
- func ActivateContract(tblid, state int64, active bool)
- func AddressToID(input string) (addr int64)
- func AllowChangeCondition(sc *SmartContract, tblname string) error
- func AppParam(sc *SmartContract, app int64, name string, ecosystem int64) (string, error)
- func Append(slice []interface{}, val interface{}) []interface{}
- func BlockTime(sc *SmartContract) string
- func BndWallet(sc *SmartContract, tblid int64, state int64) error
- func BytesToString(src []byte) string
- func CheckCondition(sc *SmartContract, condition string) (bool, error)
- func CheckSignature(i *map[string]interface{}, name string) error
- func ColumnCondition(sc *SmartContract, tableName, name, coltype, permissions string) error
- func Compile(src string, owner *script.OwnerInfo) error
- func CompileBlock(src string, owner *script.OwnerInfo) (*script.Block, error)
- func CompileContract(sc *SmartContract, code string, state, id, token int64) (interface{}, error)
- func CompileEval(src string, prefix uint32) error
- func ContractAccess(sc *SmartContract, names ...interface{}) bool
- func ContractConditions(sc *SmartContract, names ...interface{}) (bool, error)
- func CreateColumn(sc *SmartContract, tableName, name, colType, permissions string) (err error)
- func CreateContract(sc *SmartContract, name, value, conditions string, tokenEcosystem, appID int64) (int64, error)
- func CreateEcosystem(sc *SmartContract, wallet int64, name string) (int64, error)
- func CreateLanguage(sc *SmartContract, name, trans string) (id int64, err error)
- func CreateOBS(sc *SmartContract, name, dbUser, dbPassword string, port int64) error
- func CreateTable(sc *SmartContract, name, columns, permissions string, applicationID int64) (err error)
- func DBCollectMetrics(sc *SmartContract) []interface{}
- func DBInsert(sc *SmartContract, tblname string, values *types.Map) (qcost int64, ret int64, err error)
- func DBSelect(sc *SmartContract, tblname string, inColumns interface{}, id int64, ...) (int64, []interface{}, error)
- func DBSelectMetrics(sc *SmartContract, metric, timeInterval, aggregateFunc string) ([]interface{}, error)
- func DBUpdate(sc *SmartContract, tblname string, id int64, values *types.Map) (qcost int64, err error)
- func DBUpdateExt(sc *SmartContract, tblname string, where *types.Map, values *types.Map) (qcost int64, err error)
- func Date(timeFormat string, timestamp int64) string
- func DateTime(unix int64) string
- func DateTimeLocation(unix int64, locationName string) (string, error)
- func DecodeBase64(input string) (out string, err error)
- func DelColumn(sc *SmartContract, tableName, name string) (err error)
- func DelTable(sc *SmartContract, tableName string) (err error)
- func DeleteOBS(sc *SmartContract, name string) error
- func EcosysParam(sc *SmartContract, name string) string
- func EditEcosysName(sc *SmartContract, sysID int64, newName string) error
- func EditLanguage(sc *SmartContract, id int64, name, trans string) error
- func EmbedFuncs(vm *script.VM, vt script.VMType)
- func EncodeBase64(input string) (out string)
- func Eval(sc *SmartContract, condition string) error
- func EvalCondition(sc *SmartContract, table, name, condfield string) error
- func EvalIf(src string, state uint32, extend *map[string]interface{}) (bool, error)
- func Extend(ext *script.ExtendData)
- func ExtendCost(ext func(string) int64)
- func ExternOff()
- func FillTxData(fieldInfos []*script.FieldInfo, params map[string]interface{}) (map[string]interface{}, error)
- func Float(v interface{}) (ret float64)
- func Floor(x interface{}) (int64, error)
- func FlushBlock(root *script.Block)
- func FlushContract(sc *SmartContract, iroot interface{}, id int64) error
- func FormatMoney(sc *SmartContract, exp string, digit int64) (string, error)
- func FuncCallsDB(funcCallsDB map[string]struct{})
- func GetBlock(blockID int64) (*types.Map, error)
- func GetColumnType(sc *SmartContract, tableName, columnName string) (string, error)
- func GetColumns(inColumns interface{}) ([]string, error)
- func GetContractById(sc *SmartContract, id int64) string
- func GetContractByName(sc *SmartContract, name string) int64
- func GetDataFromXLSX(sc *SmartContract, binaryID, startLine, linesCount, sheetNum int64) (data []interface{}, err error)
- func GetHistory(sc *SmartContract, tableName string, id int64) ([]interface{}, error)
- func GetHistoryRaw(transaction *model.DbTransaction, ecosystem int64, tableName string, ...) ([]interface{}, error)
- func GetHistoryRow(sc *SmartContract, tableName string, id, idRollback int64) (*types.Map, error)
- func GetMapKeys(in *types.Map) []interface{}
- func GetOBSList(sc *SmartContract) map[string]string
- func GetOrder(tblname string, inOrder interface{}) (string, error)
- func GetRowsCountXLSX(sc *SmartContract, binaryID, sheetNum int64) (int64, error)
- func GetTableName(sc *SmartContract, tblname string) string
- func GetTestValue(name string) string
- func GetType(val interface{}) string
- func GetUsedContracts(name string, state uint32, full bool) []string
- func GetVM() *script.VM
- func HMac(key, data string, raw_output bool) (ret string, err error)
- func HTTPPostJSON(requrl string, head *types.Map, json_str string) (string, error)
- func HTTPRequest(requrl, method string, head *types.Map, params *types.Map) (string, error)
- func Hash(data interface{}) (string, error)
- func HexToBytes(hexdata string) ([]byte, error)
- func IDToAddress(id int64) (out string)
- func InitVM()
- func Int(v interface{}) (int64, error)
- func IsObject(sc *SmartContract, name string, state int64) bool
- func JSONDecode(input string) (ret interface{}, err error)
- func JSONEncode(input interface{}) (string, error)
- func JSONEncodeIndent(input interface{}, indent string) (string, error)
- func Join(input []interface{}, sep string) string
- func LangRes(sc *SmartContract, idRes, lang string) string
- func Len(in []interface{}) int64
- func LoadContract(transaction *model.DbTransaction, ecosystem int64) (err error)
- func LoadContracts() error
- func LoadSysFuncs(vm *script.VM, state int) error
- func Log(x interface{}) (float64, error)
- func Log10(x interface{}) (float64, error)
- func Money(v interface{}) (decimal.Decimal, error)
- func PermColumn(sc *SmartContract, tableName, name, permissions string) error
- func PermTable(sc *SmartContract, name, permissions string) error
- func Pow(x, y interface{}) (float64, error)
- func PrefixName(table string) (prefix, name string)
- func PrepareColumns(columns []string) string
- func PubToHex(in interface{}) (ret string)
- func PubToID(hexkey string) int64
- func Random(sc *SmartContract, min int64, max int64) (int64, error)
- func Replace(s, old, new string) string
- func RoleAccess(sc *SmartContract, ids ...interface{}) (bool, error)
- func Round(x interface{}) (int64, error)
- func RowConditions(sc *SmartContract, tblname string, id int64, conditionOnly bool) error
- func Run(block *script.Block, params []interface{}, extend *map[string]interface{}) (ret []interface{}, err error)
- func SendExternalTransaction(sc *SmartContract, uid, url, externalContract string, params *types.Map, ...) (err error)
- func SetContractWallet(sc *SmartContract, tblid, state int64, wallet int64) error
- func Sha256(text string) (string, error)
- func Size(s string) int64
- func SortedKeys(m *types.Map) []interface{}
- func Split(input, sep string) []interface{}
- func Sqrt(x interface{}) (float64, error)
- func StackOverflow(sc *SmartContract)
- func StartOBS(sc *SmartContract, name string) error
- func StopOBSProcess(sc *SmartContract, name string) error
- func Str(v interface{}) (ret string)
- func StringToBytes(src string) []byte
- func Substr(s string, off int64, slen int64) string
- func SysFlushContract(iroot interface{}, id int64, active bool) error
- func SysFuel(state int64) string
- func SysParamInt(name string) int64
- func SysParamString(name string) string
- func SysRollback(sc *SmartContract, data SysRollData) error
- func SysRollbackActivate(sysData SysRollData) error
- func SysRollbackColumn(DbTransaction *model.DbTransaction, sysData SysRollData) error
- func SysRollbackContract(name string, EcosystemID int64) error
- func SysRollbackDeactivate(sysData SysRollData) error
- func SysRollbackDeleteColumn(DbTransaction *model.DbTransaction, sysData SysRollData) error
- func SysRollbackDeleteTable(DbTransaction *model.DbTransaction, sysData SysRollData) error
- func SysRollbackEcosystem(DbTransaction *model.DbTransaction, sysData SysRollData) error
- func SysRollbackEditContract(transaction *model.DbTransaction, sysData SysRollData, EcosystemID string) error
- func SysRollbackNewContract(sysData SysRollData, EcosystemID string) error
- func SysRollbackTable(DbTransaction *model.DbTransaction, sysData SysRollData) error
- func SysSetContractWallet(tblid, state int64, wallet int64) error
- func TableConditions(sc *SmartContract, name, columns, permissions string) (err error)
- func Throw(code, errText string) error
- func TransactionInfo(txHash string) (string, error)
- func UnbndWallet(sc *SmartContract, tblid int64, state int64) error
- func UnixDateTime(value string) int64
- func UnixDateTimeLocation(value, locationName string) (int64, error)
- func UpdateContract(sc *SmartContract, id int64, value, conditions string, recipient int64, ...) error
- func UpdateCron(sc *SmartContract, id int64) error
- func UpdateNodesBan(smartContract *SmartContract, timestamp int64) error
- func UpdateNotifications(sc *SmartContract, ecosystemID int64, accounts ...interface{})
- func UpdateRolesNotifications(sc *SmartContract, ecosystemID int64, roles ...interface{})
- func UpdateSysParam(sc *SmartContract, name, value, conditions string) (int64, error)
- func VMCompileBlock(vm *script.VM, src string, owner *script.OwnerInfo) (*script.Block, error)
- func VMCompileEval(vm *script.VM, src string, prefix uint32) error
- func VMEvalIf(vm *script.VM, src string, state uint32, extend *map[string]interface{}) (bool, error)
- func VMFlushBlock(vm *script.VM, root *script.Block)
- func VMObjectExists(vm *script.VM, name string, state uint32) bool
- func VMRun(vm *script.VM, block *script.Block, params []interface{}, ...) (ret []interface{}, err error)
- func ValidateCondition(sc *SmartContract, condition string, state int64) error
- func ValidateCron(cronSpec string) (err error)
- func ValidateEditContractNewValue(sc *SmartContract, newValue, oldValue string) error
- type Contract
- type FlushInfo
- type NotifyInfo
- type SignRes
- type SmartContract
- func (sc *SmartContract) AccessColumns(table string, columns *[]string, update bool) error
- func (sc *SmartContract) AccessRights(condition string, iscondition bool) error
- func (sc *SmartContract) AccessTable(table, action string) error
- func (sc *SmartContract) AccessTablePerm(table, action string) (map[string]string, error)
- func (sc *SmartContract) AppendStack(fn string) error
- func (sc *SmartContract) CallContract() (string, error)
- func (sc *SmartContract) CheckAccess(tableName, columns string, ecosystem int64) (table string, perm map[string]string, cols string, err error)
- func (sc *SmartContract) EvalIf(conditions string) (bool, error)
- func (sc *SmartContract) GetContractLimit() (ret int64)
- func (sc SmartContract) GetLogger() *log.Entry
- func (sc *SmartContract) GetSignedBy(public []byte) (int64, error)
- func (sc *SmartContract) IsCustomTable(table string) (isCustom bool, err error)
- func (sc *SmartContract) PopStack(fn string)
- type SysRollData
- type TableInfo
- type ThrowError
- type TxInfo
- type TxSignJSON
Constants ¶
const ( // MaxPrice is a maximal value that price function can return MaxPrice = 100000000000000000 CallDelayedContract = "@1CallDelayedContract" NewUserContract = "@1NewUser" NewBadBlockContract = "@1NewBadBlock" )
const (
SysName = `@system`
)
Variables ¶
var BOM = []byte{0xEF, 0xBB, 0xBF}
var (
ErrNotImplementedOnOBS = errors.New("Contract not implemented on OBS")
)
Functions ¶
func ActivateContract ¶
ActivateContract sets Active status of the contract in smartVM
func AddressToID ¶
AddressToID converts the string representation of the wallet number to a numeric
func AllowChangeCondition ¶
func AllowChangeCondition(sc *SmartContract, tblname string) error
AllowChangeCondition check acces to change condition throught supper contract
func Append ¶
func Append(slice []interface{}, val interface{}) []interface{}
Append syn for golang 'append' function
func BlockTime ¶
func BlockTime(sc *SmartContract) string
func BndWallet ¶
func BndWallet(sc *SmartContract, tblid int64, state int64) error
BndWallet sets wallet_id to current wallet and updates value in vm
func CheckCondition ¶
func CheckCondition(sc *SmartContract, condition string) (bool, error)
CheckCondition evaluates the condition
func CheckSignature ¶
CheckSignature checks the additional signatures for the contract
func ColumnCondition ¶
func ColumnCondition(sc *SmartContract, tableName, name, coltype, permissions string) error
ColumnCondition is contract func
func CompileBlock ¶
CompileBlock calls CompileBlock for smartVM
func CompileContract ¶
func CompileContract(sc *SmartContract, code string, state, id, token int64) (interface{}, error)
CompileContract is compiling contract
func CompileEval ¶
CompileEval calls CompileEval for smartVM
func ContractAccess ¶
func ContractAccess(sc *SmartContract, names ...interface{}) bool
ContractAccess checks whether the name of the executable contract matches one of the names listed in the parameters.
func ContractConditions ¶
func ContractConditions(sc *SmartContract, names ...interface{}) (bool, error)
ContractConditions calls the 'conditions' function for each of the contracts specified in the parameters
func CreateColumn ¶
func CreateColumn(sc *SmartContract, tableName, name, colType, permissions string) (err error)
CreateColumn is creating column
func CreateContract ¶
func CreateContract(sc *SmartContract, name, value, conditions string, tokenEcosystem, appID int64) (int64, error)
func CreateEcosystem ¶
func CreateEcosystem(sc *SmartContract, wallet int64, name string) (int64, error)
CreateEcosystem creates a new ecosystem
func CreateLanguage ¶
func CreateLanguage(sc *SmartContract, name, trans string) (id int64, err error)
NewLang creates new language
func CreateOBS ¶
func CreateOBS(sc *SmartContract, name, dbUser, dbPassword string, port int64) error
CreateOBS allow create new OBS throught obsmanager
func CreateTable ¶
func CreateTable(sc *SmartContract, name, columns, permissions string, applicationID int64) (err error)
CreateTable is creating smart contract table
func DBCollectMetrics ¶
func DBCollectMetrics(sc *SmartContract) []interface{}
DBCollectMetrics returns actual values of all metrics This function used to further store these values
func DBInsert ¶
func DBInsert(sc *SmartContract, tblname string, values *types.Map) (qcost int64, ret int64, err error)
DBInsert inserts a record into the specified database table
func DBSelect ¶
func DBSelect(sc *SmartContract, tblname string, inColumns interface{}, id int64, inOrder interface{}, offset, limit int64, inWhere *types.Map) (int64, []interface{}, error)
DBSelect returns an array of values of the specified columns when there is selection of data 'offset', 'limit', 'where'
func DBSelectMetrics ¶
func DBSelectMetrics(sc *SmartContract, metric, timeInterval, aggregateFunc string) ([]interface{}, error)
DBSelectMetrics returns list of metrics by name and time interval
func DBUpdate ¶
func DBUpdate(sc *SmartContract, tblname string, id int64, values *types.Map) (qcost int64, err error)
DBUpdate updates the item with the specified id in the table
func DBUpdateExt ¶
func DBUpdateExt(sc *SmartContract, tblname string, where *types.Map, values *types.Map) (qcost int64, err error)
DBUpdateExt updates the record in the specified table. You can specify 'where' query in params and then the values for this query
func DecodeBase64 ¶
DecodeBase64 decodes base64 string
func DelColumn ¶
func DelColumn(sc *SmartContract, tableName, name string) (err error)
func DelTable ¶
func DelTable(sc *SmartContract, tableName string) (err error)
func EcosysParam ¶
func EcosysParam(sc *SmartContract, name string) string
EcosysParam returns the value of the specified parameter for the ecosystem
func EditEcosysName ¶
func EditEcosysName(sc *SmartContract, sysID int64, newName string) error
EditEcosysName set newName for ecosystem
func EditLanguage ¶
func EditLanguage(sc *SmartContract, id int64, name, trans string) error
EditLanguage edits language
func EmbedFuncs ¶
EmbedFuncs is extending vm with embedded functions
func EncodeBase64 ¶
EncodeBase64 encodes string in base64
func EvalCondition ¶
func EvalCondition(sc *SmartContract, table, name, condfield string) error
EvalCondition gets the condition and check it
func Extend ¶
func Extend(ext *script.ExtendData)
Extend set extended variable and functions in smartVM
func ExtendCost ¶
ExtendCost sets the cost of calling extended obj in smartVM
func FillTxData ¶
func FlushContract ¶
func FlushContract(sc *SmartContract, iroot interface{}, id int64) error
FlushContract is flushing contract
func FormatMoney ¶
func FormatMoney(sc *SmartContract, exp string, digit int64) (string, error)
func FuncCallsDB ¶
func FuncCallsDB(funcCallsDB map[string]struct{})
func GetColumnType ¶
func GetColumnType(sc *SmartContract, tableName, columnName string) (string, error)
GetColumnType returns the type of the column
func GetColumns ¶
func GetContractById ¶
func GetContractById(sc *SmartContract, id int64) string
GetContractById returns the name of the contract with this id
func GetContractByName ¶
func GetContractByName(sc *SmartContract, name string) int64
GetContractByName returns id of the contract with this name
func GetDataFromXLSX ¶
func GetDataFromXLSX(sc *SmartContract, binaryID, startLine, linesCount, sheetNum int64) (data []interface{}, err error)
GetDataFromXLSX returns json by parameters range
func GetHistory ¶
func GetHistory(sc *SmartContract, tableName string, id int64) ([]interface{}, error)
func GetHistoryRaw ¶
func GetHistoryRow ¶
func GetMapKeys ¶
GetMapKeys returns the array of keys of the map
func GetOBSList ¶
func GetOBSList(sc *SmartContract) map[string]string
GetOBSList returns list OBS process with statuses
func GetRowsCountXLSX ¶
func GetRowsCountXLSX(sc *SmartContract, binaryID, sheetNum int64) (int64, error)
GetRowsCountXLSX returns count of rows from excel file
func GetTableName ¶
func GetTableName(sc *SmartContract, tblname string) string
func GetTestValue ¶
GetTestValue returns the test value of the specified key
func GetType ¶
func GetType(val interface{}) string
GetType returns the name of the type of the value
func GetUsedContracts ¶
GetUsedContracts returns the list of contracts which are called from the specified contract
func HTTPPostJSON ¶
HTTPPostJSON sends post http request with json
func HTTPRequest ¶
HTTPRequest sends http request
func HexToBytes ¶
HexToBytes converts the hexadecimal representation to []byte
func IDToAddress ¶
IDToAddress converts the identifier of account to a string of the form XXXX -...- XXXX
func IsObject ¶
func IsObject(sc *SmartContract, name string, state int64) bool
IsObject returns true if there is the specified contract
func JSONDecode ¶
JSONDecode converts json string to object
func JSONEncode ¶
JSONEncode converts object to json string
func JSONEncodeIndent ¶
JSONEncodeIdent converts object to json string
func LangRes ¶
func LangRes(sc *SmartContract, idRes, lang string) string
LangRes returns the language resource
func LoadContract ¶
func LoadContract(transaction *model.DbTransaction, ecosystem int64) (err error)
LoadContract reads and compiles contract of new state
func LoadContracts ¶
func LoadContracts() error
LoadContracts reads and compiles contracts from smart_contracts tables
func PermColumn ¶
func PermColumn(sc *SmartContract, tableName, name, permissions string) error
PermColumn is contract func
func PermTable ¶
func PermTable(sc *SmartContract, name, permissions string) error
PermTable is changing permission of table
func PrefixName ¶
func PrepareColumns ¶
PrepareColumns replaces jsonb fields -> in the list of columns for db selecting For example, name,doc->title => name,doc::jsonb->>'title' as "doc.title"
func PubToID ¶
PubToID returns a numeric identifier for the public key specified in the hexadecimal form.
func Random ¶
func Random(sc *SmartContract, min int64, max int64) (int64, error)
Random returns a random value between min and max
func RoleAccess ¶
func RoleAccess(sc *SmartContract, ids ...interface{}) (bool, error)
RoleAccess checks whether the name of the role matches one of the names listed in the parameters.
func RowConditions ¶
func RowConditions(sc *SmartContract, tblname string, id int64, conditionOnly bool) error
RowConditions checks conditions for table row by id
func Run ¶
func Run(block *script.Block, params []interface{}, extend *map[string]interface{}) (ret []interface{}, err error)
Run executes Block in smartVM
func SendExternalTransaction ¶
func SetContractWallet ¶
func SetContractWallet(sc *SmartContract, tblid, state int64, wallet int64) error
SetContractWallet changes WalletID of the contract in smartVM
func SortedKeys ¶
SortedKeys returns the sorted array of keys of the map
func StackOverflow ¶
func StackOverflow(sc *SmartContract)
func StopOBSProcess ¶
func StopOBSProcess(sc *SmartContract, name string) error
StopOBSProcess stops OBS process
func SysFlushContract ¶
SysFlushContract is flushing contract
func SysParamInt ¶
SysParamInt returns the value of the system parameter
func SysParamString ¶
SysParamString returns the value of the system parameter
func SysRollback ¶
func SysRollback(sc *SmartContract, data SysRollData) error
func SysRollbackActivate ¶
func SysRollbackActivate(sysData SysRollData) error
SysRollbackActivate sets Deactive status of the contract in smartVM
func SysRollbackColumn ¶
func SysRollbackColumn(DbTransaction *model.DbTransaction, sysData SysRollData) error
SysRollbackColumn is rolling back column
func SysRollbackContract ¶
SysRollbackContract performs rollback for the contract
func SysRollbackDeactivate ¶
func SysRollbackDeactivate(sysData SysRollData) error
SysRollbackDeactivate sets Active status of the contract in smartVM
func SysRollbackDeleteColumn ¶
func SysRollbackDeleteColumn(DbTransaction *model.DbTransaction, sysData SysRollData) error
SysRollbackDeleteColumn is rolling back delete column
func SysRollbackDeleteTable ¶
func SysRollbackDeleteTable(DbTransaction *model.DbTransaction, sysData SysRollData) error
SysRollbackDeleteTable is rolling back delete table
func SysRollbackEcosystem ¶
func SysRollbackEcosystem(DbTransaction *model.DbTransaction, sysData SysRollData) error
SysRollbackEcosystem is rolling back ecosystem
func SysRollbackEditContract ¶
func SysRollbackEditContract(transaction *model.DbTransaction, sysData SysRollData, EcosystemID string) error
SysRollbackEditContract rollbacks the contract
func SysRollbackNewContract ¶
func SysRollbackNewContract(sysData SysRollData, EcosystemID string) error
func SysRollbackTable ¶
func SysRollbackTable(DbTransaction *model.DbTransaction, sysData SysRollData) error
SysRollbackTable is rolling back table
func SysSetContractWallet ¶
SysSetContractWallet changes WalletID of the contract in smartVM
func TableConditions ¶
func TableConditions(sc *SmartContract, name, columns, permissions string) (err error)
TableConditions is contract func
func TransactionInfo ¶
func UnbndWallet ¶
func UnbndWallet(sc *SmartContract, tblid int64, state int64) error
UnbndWallet sets Active status of the contract in smartVM
func UnixDateTime ¶
func UnixDateTimeLocation ¶
func UpdateContract ¶
func UpdateCron ¶
func UpdateCron(sc *SmartContract, id int64) error
func UpdateNodesBan ¶
func UpdateNodesBan(smartContract *SmartContract, timestamp int64) error
func UpdateNotifications ¶
func UpdateNotifications(sc *SmartContract, ecosystemID int64, accounts ...interface{})
func UpdateRolesNotifications ¶
func UpdateRolesNotifications(sc *SmartContract, ecosystemID int64, roles ...interface{})
func UpdateSysParam ¶
func UpdateSysParam(sc *SmartContract, name, value, conditions string) (int64, error)
UpdateSysParam updates the system parameter
func VMCompileBlock ¶
VMCompileBlock is compiling block
func ValidateCondition ¶
func ValidateCondition(sc *SmartContract, condition string, state int64) error
ValidateCondition checks if the condition can be compiled
func ValidateCron ¶
func ValidateEditContractNewValue ¶
func ValidateEditContractNewValue(sc *SmartContract, newValue, oldValue string) error
Types ¶
type Contract ¶
type Contract struct { Name string Called uint32 FreeRequest bool TxGovAccount int64 // state wallet EGSRate float64 // money/EGS rate TableAccounts string StackCont []interface{} // Stack of called contracts Extend *map[string]interface{} Block *script.Block }
Contract contains the information about the contract.
func GetContract ¶
GetContract returns true if the contract exists in smartVM
func GetContractByID ¶
GetContractByID returns true if the contract exists
func (*Contract) Info ¶
func (c *Contract) Info() *script.ContractInfo
type NotifyInfo ¶
type NotifyInfo struct { Roles bool // if true then UpdateRolesNotifications, otherwise UpdateNotifications EcosystemID int64 List []string }
NotifyInfo is used for sending delayed notifications
type SmartContract ¶
type SmartContract struct { OBS bool Rollback bool FullAccess bool SysUpdate bool VM *script.VM TxSmart tx.SmartContract TxData map[string]interface{} TxContract *Contract TxFuel int64 // The fuel of executing contract TxCost int64 // Maximum cost of executing contract TxUsedCost decimal.Decimal // Used cost of CPU resources BlockData *utils.BlockData Loop map[string]bool TxHash []byte TxSignature []byte TxSize int64 PublicKeys [][]byte DbTransaction *model.DbTransaction Rand *rand.Rand FlushRollback []FlushInfo Notifications types.Notifications GenBlock bool TimeLimit int64 Key *model.Key }
SmartContract is storing smart contract data
func (*SmartContract) AccessColumns ¶
func (sc *SmartContract) AccessColumns(table string, columns *[]string, update bool) error
AccessColumns checks access rights to the columns
func (*SmartContract) AccessRights ¶
func (sc *SmartContract) AccessRights(condition string, iscondition bool) error
AccessRights checks the access right by executing the condition value
func (*SmartContract) AccessTable ¶
func (sc *SmartContract) AccessTable(table, action string) error
func (*SmartContract) AccessTablePerm ¶
func (sc *SmartContract) AccessTablePerm(table, action string) (map[string]string, error)
AccessTable checks the access right to the table
func (*SmartContract) AppendStack ¶
func (sc *SmartContract) AppendStack(fn string) error
AppendStack adds an element to the stack of contract call or removes the top element when name is empty
func (*SmartContract) CallContract ¶
func (sc *SmartContract) CallContract() (string, error)
CallContract calls the contract functions according to the specified flags
func (*SmartContract) CheckAccess ¶
func (*SmartContract) EvalIf ¶
func (sc *SmartContract) EvalIf(conditions string) (bool, error)
EvalIf counts and returns the logical value of the specified expression
func (*SmartContract) GetContractLimit ¶
func (sc *SmartContract) GetContractLimit() (ret int64)
GetContractLimit returns the default maximal cost of contract
func (SmartContract) GetLogger ¶
func (sc SmartContract) GetLogger() *log.Entry
GetLogger is returning logger
func (*SmartContract) GetSignedBy ¶
func (sc *SmartContract) GetSignedBy(public []byte) (int64, error)
func (*SmartContract) IsCustomTable ¶
func (sc *SmartContract) IsCustomTable(table string) (isCustom bool, err error)
func (*SmartContract) PopStack ¶
func (sc *SmartContract) PopStack(fn string)
type SysRollData ¶
type ThrowError ¶
type ThrowError struct { Type string `json:"type"` Code string `json:"id"` ErrText string `json:"error"` }
func (*ThrowError) Error ¶
func (throw *ThrowError) Error() string