Documentation ¶
Overview ¶
MIT License
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MIT License ¶
Copyright (c) 2016 GenesisCommunity ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func Activate(sc *SmartContract, tblid int64, state int64) error
- 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) (string, error)
- func Append(slice []interface{}, val interface{}) []interface{}
- func BlockTime(sc *SmartContract) string
- func BytesToString(src []byte) string
- 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, ...) (int64, error)
- func CreateEcosystem(sc *SmartContract, wallet int64, name string) (int64, error)
- func CreateLanguage(sc *SmartContract, name, trans string, appID int64) (id int64, err error)
- func CreateTable(sc *SmartContract, name, columns, permissions string, applicationID int64) error
- func CreateVDE(sc *SmartContract, name, dbUser, dbPassword string, port int64) error
- func DBCollectMetrics() []interface{}
- func DBInsert(sc *SmartContract, tblname string, params string, val ...interface{}) (qcost int64, ret int64, err error)
- func DBSelect(sc *SmartContract, tblname string, columns string, id int64, order string, ...) (int64, []interface{}, error)
- func DBSelectMetrics(sc *SmartContract, metric, timeInterval, aggregateFunc string) ([]interface{}, error)
- func DBUpdate(sc *SmartContract, tblname string, id int64, params string, val ...interface{}) (qcost int64, err error)
- func DBUpdateExt(sc *SmartContract, tblname string, column string, value interface{}, ...) (qcost int64, err error)
- func Date(time_format string, timestamp int64) string
- func Deactivate(sc *SmartContract, tblid int64, state int64) error
- func DecodeBase64(input string) (out string, err error)
- func DeleteVDE(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, appID int64) 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 Float(v interface{}) (ret float64)
- func FlushBlock(root *script.Block)
- func FlushContract(sc *SmartContract, iroot interface{}, id int64, active bool) error
- func FuncCallsDB(funcCallsDB map[string]struct{})
- func GetBlock(blockID int64) (map[string]int64, error)
- func GetBlockHistory(sc *SmartContract, id int64) ([]interface{}, error)
- func GetBlockHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
- func GetColumnType(sc *SmartContract, tableName, columnName string) (string, error)
- func GetContractById(sc *SmartContract, id int64) string
- func GetContractByName(sc *SmartContract, name string) int64
- func GetContractHistory(sc *SmartContract, id int64) ([]interface{}, error)
- func GetContractHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
- func GetDataFromXLSX(sc *SmartContract, binaryID, startLine, linesCount, sheetNum int64) (data []interface{}, err error)
- func GetHistory(transaction *model.DbTransaction, ecosystem int64, tableName string, ...) ([]interface{}, error)
- func GetHistoryRow(sc *SmartContract, tableName string, id, idRollback int64) (map[string]interface{}, error)
- func GetMapKeys(in map[string]interface{}) []interface{}
- func GetMenuHistory(sc *SmartContract, id int64) ([]interface{}, error)
- func GetMenuHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
- func GetPageHistory(sc *SmartContract, id int64) ([]interface{}, error)
- func GetPageHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
- func GetRowsCountXLSX(sc *SmartContract, binaryID, sheetNum int64) (int64, error)
- func GetTableName(sc *SmartContract, tblname string, ecosystem int64) string
- func GetTestValue(name string) string
- func GetType(val interface{}) string
- func GetUsedContracts(name string, state uint32, full bool) []string
- func GetVDEList(sc *SmartContract) (map[string]string, error)
- func GetVM() *script.VM
- func HMac(key, data string, raw_output bool) (ret string, err error)
- func HTTPPostJSON(requrl string, headers map[string]interface{}, json_str string) (string, error)
- func HTTPRequest(requrl, method string, headers map[string]interface{}, ...) (string, error)
- func HexToBytes(hexdata string) ([]byte, error)
- func IDToAddress(id int64) (out string)
- func Int(v interface{}) (int64, error)
- func JSONDecode(input string) (interface{}, error)
- func JSONEncode(input interface{}) (string, error)
- func Join(input []interface{}, sep string) string
- func LangRes(sc *SmartContract, appID int64, idRes, lang string) string
- func Len(in []interface{}) int64
- func LoadContract(transaction *model.DbTransaction, prefix string) (err error)
- func LoadContracts(transaction *model.DbTransaction) error
- func LoadSysFuncs(vm *script.VM, state int) error
- func LoadVDEContracts(transaction *model.DbTransaction, prefix string) (err error)
- func MD5(data interface{}) (string, error)
- func Money(v interface{}) (decimal.Decimal, error)
- func NewMoney(sc *SmartContract, id int64, amount, comment string) (err error)
- func PermColumn(sc *SmartContract, tableName, name, permissions string) error
- func PermTable(sc *SmartContract, name, permissions string) error
- func PrefixName(table string) (prefix, name string)
- func PrepareColumns(columns string) string
- func PrepareWhere(where string) string
- func PubToID(hexkey string) int64
- func Random(min int64, max int64) (int64, error)
- func Replace(s, old, new string) string
- func RollbackColumn(sc *SmartContract, tableName, name string) error
- func RollbackContract(sc *SmartContract, name string) error
- func RollbackEcosystem(sc *SmartContract) error
- func RollbackEditContract(sc *SmartContract) error
- func RollbackNewContract(sc *SmartContract, value string) error
- func RollbackTable(sc *SmartContract, name string) 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 SetContractWallet(sc *SmartContract, tblid, state int64, wallet int64) error
- func SetPubKey(sc *SmartContract, id int64, pubKey []byte) (qcost int64, err error)
- func Sha256(text string) string
- func Size(s string) int64
- func SortedKeys(m map[string]interface{}) []interface{}
- func Split(input, sep string) []interface{}
- func StartVDE(sc *SmartContract, name string) error
- func StopVDEProcess(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 SysFuel(state int64) string
- func SysParamInt(name string) int64
- func SysParamString(name string) string
- func TableConditions(sc *SmartContract, name, columns, permissions string) (err error)
- func UUID(sc *SmartContract) string
- func UpdateContract(sc *SmartContract, id int64, value, conditions, walletID string, ...) error
- func UpdateCron(sc *SmartContract, id int64) error
- func UpdateNodesBan(smartContract *SmartContract, timestamp int64) error
- 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) error
- func ValidateEditContractNewValue(sc *SmartContract, newValue, oldValue string) error
- type Contract
- 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(contract string) error
- func (sc *SmartContract) CallContract(flags int) (string, error)
- func (sc *SmartContract) EvalIf(conditions string) (bool, error)
- func (sc *SmartContract) GetContractLimit() (ret int64)
- func (sc SmartContract) GetLogger() *log.Entry
- func (sc *SmartContract) IsCustomTable(table string) (isCustom bool, err error)
- type TxSignJSON
Constants ¶
const ( // CallInit is a flag for calling init function of the contract CallInit = 0x01 // CallCondition is a flag for calling condition function of the contract CallCondition = 0x02 // CallAction is a flag for calling action function of the contract CallAction = 0x04 // CallRollback is a flag for calling rollback function of the contract CallRollback = 0x08 MaxPrice = 100000000000000000 )
Variables ¶
var ( ErrCurrentBalance = errors.New(`current balance is not enough`) ErrDeletedKey = errors.New(`The key is deleted`) ErrDiffKeys = errors.New(`Contract and user public keys are different`) ErrEmptyPublicKey = errors.New(`empty public key`) ErrFounderAccount = errors.New(`Unknown founder account`) ErrFuelRate = errors.New(`Fuel rate must be greater than 0`) ErrIncorrectSign = errors.New(`incorrect sign`) ErrInvalidValue = errors.New(`Invalid value`) ErrUnknownNodeID = errors.New(`Unknown node id`) ErrWrongPriceFunc = errors.New(`Wrong type of price function`) ErrNegPrice = errors.New(`Price value is negative`) ErrMaxPrice = errors.New(fmt.Sprintf(`Price value is more than %d`, MaxPrice)) )
var BOM = []byte{0xEF, 0xBB, 0xBF}
Functions ¶
func Activate ¶
func Activate(sc *SmartContract, tblid int64, state int64) error
Activate sets Active status of the contract in smartVM
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 AppParam ¶
func AppParam(sc *SmartContract, app int64, name string) (string, error)
AppParam returns the value of the specified app parameter for the ecosystem
func Append ¶
func Append(slice []interface{}, val interface{}) []interface{}
Append syn for golang 'append' function
func BlockTime ¶
func BlockTime(sc *SmartContract) string
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, walletID, 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, appID int64) (id int64, err error)
NewLang creates new language
func CreateTable ¶
func CreateTable(sc *SmartContract, name, columns, permissions string, applicationID int64) error
CreateTable is creating smart contract table
func CreateVDE ¶
func CreateVDE(sc *SmartContract, name, dbUser, dbPassword string, port int64) error
CreateVDE allow create new VDE throw vdemanager
func DBCollectMetrics ¶
func DBCollectMetrics() []interface{}
DBCollectMetrics returns actual values of all metrics This function used to further store these values
func DBInsert ¶
func DBInsert(sc *SmartContract, tblname string, params string, val ...interface{}) (qcost int64, ret int64, err error)
DBInsert inserts a record into the specified database table
func DBSelect ¶
func DBSelect(sc *SmartContract, tblname string, columns string, id int64, order string, offset, limit, ecosystem int64, where string, params []interface{}) (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, params string, val ...interface{}) (qcost int64, err error)
DBUpdate updates the item with the specified id in the table
func DBUpdateExt ¶
func DBUpdateExt(sc *SmartContract, tblname string, column string, value interface{}, params string, val ...interface{}) (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 Deactivate ¶
func Deactivate(sc *SmartContract, tblid int64, state int64) error
Deactivate sets Active status of the contract in smartVM
func DecodeBase64 ¶
DecodeBase64 decodes base64 string
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, appID int64) 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 FlushContract ¶
func FlushContract(sc *SmartContract, iroot interface{}, id int64, active bool) error
FlushContract is flushing contract
func FuncCallsDB ¶
func FuncCallsDB(funcCallsDB map[string]struct{})
func GetBlockHistory ¶
func GetBlockHistory(sc *SmartContract, id int64) ([]interface{}, error)
func GetBlockHistoryRow ¶
func GetBlockHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
func GetColumnType ¶
func GetColumnType(sc *SmartContract, tableName, columnName string) (string, error)
GetColumnType returns the type of the column
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 GetContractHistory ¶
func GetContractHistory(sc *SmartContract, id int64) ([]interface{}, error)
func GetContractHistoryRow ¶
func GetContractHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
func GetDataFromXLSX ¶
func GetDataFromXLSX(sc *SmartContract, binaryID, startLine, linesCount, sheetNum int64) (data []interface{}, err error)
GetDataFromXLSX returns json by parameters range
func GetHistory ¶
func GetHistoryRow ¶
func GetHistoryRow(sc *SmartContract, tableName string, id, idRollback int64) (map[string]interface{}, error)
func GetMapKeys ¶
func GetMapKeys(in map[string]interface{}) []interface{}
Returns the array of keys of the map
func GetMenuHistory ¶
func GetMenuHistory(sc *SmartContract, id int64) ([]interface{}, error)
func GetMenuHistoryRow ¶
func GetMenuHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
func GetPageHistory ¶
func GetPageHistory(sc *SmartContract, id int64) ([]interface{}, error)
func GetPageHistoryRow ¶
func GetPageHistoryRow(sc *SmartContract, id, idRollback int64) (map[string]interface{}, error)
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, ecosystem int64) string
func GetTestValue ¶
GetTestValue returns the test value of the specified key
func GetUsedContracts ¶
GetUsedContracts returns the list of contracts which are called from the specified contract
func GetVDEList ¶
func GetVDEList(sc *SmartContract) (map[string]string, error)
GetVDEList returns list VDE process with statuses
func HTTPPostJSON ¶
HTTPPostJSON sends post http request with json
func HTTPRequest ¶
func HTTPRequest(requrl, method string, headers map[string]interface{}, params map[string]interface{}) (string, error)
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 JSONDecode ¶
JSONDecode converts json string to object
func JSONEncode ¶
JSONEncode converts object to json string
func LangRes ¶
func LangRes(sc *SmartContract, appID int64, idRes, lang string) string
LangRes returns the language resource
func LoadContract ¶
func LoadContract(transaction *model.DbTransaction, prefix string) (err error)
LoadContract reads and compiles contract of new state
func LoadContracts ¶
func LoadContracts(transaction *model.DbTransaction) error
LoadContracts reads and compiles contracts from smart_contracts tables
func LoadVDEContracts ¶
func LoadVDEContracts(transaction *model.DbTransaction, prefix string) (err error)
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 PrepareWhere ¶
func PubToID ¶
PubToID returns a numeric identifier for the public key specified in the hexadecimal form.
func RollbackColumn ¶
func RollbackColumn(sc *SmartContract, tableName, name string) error
RollbackColumn is rolling back column
func RollbackContract ¶
func RollbackContract(sc *SmartContract, name string) error
RollbackContract performs rollback for the contract
func RollbackEcosystem ¶
func RollbackEcosystem(sc *SmartContract) error
RollbackEcosystem is rolling back ecosystem
func RollbackEditContract ¶
func RollbackEditContract(sc *SmartContract) error
RollbackEditContract rollbacks the contract
func RollbackNewContract ¶
func RollbackNewContract(sc *SmartContract, value string) error
func RollbackTable ¶
func RollbackTable(sc *SmartContract, name string) error
RollbackTable is rolling back table
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 SetContractWallet ¶
func SetContractWallet(sc *SmartContract, tblid, state int64, wallet int64) error
SetContractWallet changes WalletID of the contract in smartVM
func SetPubKey ¶
func SetPubKey(sc *SmartContract, id int64, pubKey []byte) (qcost int64, err error)
SetPubKey updates the publis key
func SortedKeys ¶
func SortedKeys(m map[string]interface{}) []interface{}
Returns the sorted array of keys of the map
func StopVDEProcess ¶
func StopVDEProcess(sc *SmartContract, name string) error
StopVDEProcess stops VDE process
func SysParamInt ¶
SysParamInt returns the value of the system parameter
func SysParamString ¶
SysParamString returns the value of the system parameter
func TableConditions ¶
func TableConditions(sc *SmartContract, name, columns, permissions string) (err error)
TableConditions is contract func
func UpdateContract ¶
func UpdateCron ¶
func UpdateCron(sc *SmartContract, id int64) error
func UpdateNodesBan ¶
func UpdateNodesBan(smartContract *SmartContract, timestamp int64) error
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
type SmartContract ¶
type SmartContract struct { VDE 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 PublicKeys [][]byte DbTransaction *model.DbTransaction }
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(contract 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(flags int) (string, error)
CallContract calls the contract functions according to the specified flags
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) IsCustomTable ¶
func (sc *SmartContract) IsCustomTable(table string) (isCustom bool, err error)