Documentation ¶
Overview ¶
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
- Copyright (c) IBAX. All rights reserved.
- See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------
Index ¶
- Constants
- Variables
- func ActivateContract(tblid, state int64, active bool)
- func AllowChangeCondition(sc *SmartContract, tblname string) error
- func AppParam(sc *SmartContract, app int64, name string, ecosystem int64) (string, error)
- func Append(slice []any, val any) []any
- 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 CheckNumberChars(data string) bool
- func CheckSign(pub, data, sign string) (bool, error)
- func CheckSignature(sc *SmartContract, i map[string]any, name string) error
- func ColumnCondition(sc *SmartContract, tableName, name, coltype, permissions string) error
- func CompileContract(sc *SmartContract, code string, state, id, token int64) (any, error)
- func ContractAccess(sc *SmartContract, names ...any) bool
- func ContractConditions(sc *SmartContract, names ...any) (bool, error)
- func CreateCLB(sc *SmartContract, name, dbUser, dbPassword string, port int64) 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 CreateTable(sc *SmartContract, name, columns, permissions string, applicationID int64) (err error)
- func CreateView(sc *SmartContract, vname, columns, where string, applicationID int64) (err error)
- func DBCollectMetrics(sc *SmartContract) []any
- func DBCount(sc *SmartContract, tableName string, inWhere *types.Map) (count int64, err error)
- func DBInsert(sc *SmartContract, tblname string, values *types.Map) (qcost int64, ret int64, err error)
- func DBSelect(sc *SmartContract, tblname string, inColumns any, id int64, inOrder any, ...) (int64, []any, error)
- func DBSelectMetrics(sc *SmartContract, metric, timeInterval, aggregateFunc string) ([]any, 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 DeleteCLB(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(vt script.VMType) map[string]any
- func EncodeBase64(input string) (out string)
- func EthereumAddress(pub []byte) string
- func Eval(sc *SmartContract, condition string) error
- func EvalCondition(sc *SmartContract, table, name, condfield string) error
- func FillTxData(fieldInfos []*script.FieldInfo, params map[string]any) (map[string]any, error)
- func Float(v any) (ret float64)
- func Floor(x any) (int64, error)
- func FlushContract(sc *SmartContract, iroot any, id int64) error
- func FormatMoney(sc *SmartContract, exp string, digit int64) (string, error)
- func GetAllContracts() (string, error)
- func GetBlock(blockID int64) (*types.Map, error)
- func GetCLBList(sc *SmartContract) map[string]string
- func GetColumnType(sc *SmartContract, tableName, columnName string) (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 []any, err error)
- func GetHistory(sc *SmartContract, tableName string, id int64) ([]any, error)
- func GetHistoryRaw(dbTx *sqldb.DbTransaction, ecosystem int64, tableName string, ...) ([]any, error)
- func GetHistoryRow(sc *SmartContract, tableName string, id, idRollback int64) (*types.Map, error)
- func GetLogTxCount(sc *SmartContract, ecosystemID int64) (int64, error)
- func GetMapKeys(in *types.Map) []any
- func GetRowsCountXLSX(sc *SmartContract, binaryID, sheetNum int64) (int64, error)
- func GetType(val any) string
- func GetUsedContracts(name string, state uint32, full bool) []string
- 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 any) (string, error)
- func HexToBytes(hexdata string) ([]byte, error)
- func InitVM()
- func Int(v any) (int64, error)
- func IsHonorNodeKey(id int64) bool
- func IsObject(sc *SmartContract, name string, state int64) bool
- func JSONDecode(input string) (ret any, err error)
- func JSONEncode(input any) (string, error)
- func JSONEncodeIndent(input any, indent string) (string, error)
- func Join(input []any, sep string) string
- func LangRes(sc *SmartContract, idRes string) string
- func Len(in []any) int64
- func LoadContract(transaction *sqldb.DbTransaction, ecosystem int64) (err error)
- func LoadContracts() error
- func Log(x any) (float64, error)
- func Log10(x any) (float64, error)
- func MathMod(x, y float64) float64
- func MathModDecimal(x, y decimal.Decimal) decimal.Decimal
- func Money(v any) (decimal.Decimal, error)
- func PermColumn(sc *SmartContract, tableName, name, permissions string) error
- func PermTable(sc *SmartContract, name, permissions string) error
- func Pow(x, y any) (float64, error)
- func PrefixName(table string) (prefix, name string)
- func PrepareColumns(columns []string) string
- func PubToHex(in any) (ret string)
- func PubToID(hexkey string) int64
- func RandomDecimal(sc *SmartContract, min decimal.Decimal, max decimal.Decimal) (decimal.Decimal, error)
- func RandomFloat(sc *SmartContract, min float64, max float64) (float64, error)
- func RandomInt(sc *SmartContract, min int64, max int64) (int64, error)
- func RegexpMatch(str, reg string) bool
- func Replace(s, old, new string) string
- func RoleAccess(sc *SmartContract, ids ...any) (bool, error)
- func Round(x any) (int64, error)
- func RowConditions(sc *SmartContract, tblname string, id int64, conditionOnly bool) 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 Size(s string) int64
- func SortedKeys(m *types.Map) []any
- func Split(input, sep string) []any
- func Sqrt(x any) (float64, error)
- func StartCLB(sc *SmartContract, name string) error
- func StopCLBProcess(sc *SmartContract, name string) error
- func Str(v any) (ret string)
- func StringToBytes(src string) []byte
- func Substr(s string, off int64, slen int64) string
- func SysFlushContract(iroot any, 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(dbTx *sqldb.DbTransaction, sysData SysRollData) error
- func SysRollbackContract(name string, EcosystemID int64) error
- func SysRollbackDeactivate(sysData SysRollData) error
- func SysRollbackDeleteColumn(dbTx *sqldb.DbTransaction, sysData SysRollData) error
- func SysRollbackDeleteTable(dbTx *sqldb.DbTransaction, sysData SysRollData) error
- func SysRollbackEcosystem(dbTx *sqldb.DbTransaction, sysData SysRollData) error
- func SysRollbackEditContract(transaction *sqldb.DbTransaction, sysData SysRollData, EcosystemID string) error
- func SysRollbackNewContract(sysData SysRollData, EcosystemID string) error
- func SysRollbackTable(dbTx *sqldb.DbTransaction, sysData SysRollData) error
- func SysRollbackView(DbTransaction *sqldb.DbTransaction, sysData SysRollData) error
- func SysSetContractWallet(tblid, state int64, wallet int64) error
- func TableConditions(sc *SmartContract, name, columns, permissions string) (err error)
- func TransferSelf(sc *SmartContract, value string, source string, target string) (flag bool, err 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 ...any)
- func UpdatePlatformParam(sc *SmartContract, name, value, conditions string) (int64, error)
- func UpdateRolesNotifications(sc *SmartContract, ecosystemID int64, roles ...any)
- func UtxoToken(sc *SmartContract, toID int64, value string) (flag bool, 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 Address
- type Arithmetic
- type Combustion
- type Contract
- type FlushInfo
- type FuelCategory
- type FuelType
- type GasPayAbleType
- type GasScenesType
- type NotifyInfo
- type PaymentInfo
- func (pay *PaymentInfo) Detail() any
- func (pay *PaymentInfo) DetailCombustion() any
- func (pay *PaymentInfo) GetEstimate() decimal.Decimal
- func (pay *PaymentInfo) GetPayMoney() decimal.Decimal
- func (pay *PaymentInfo) PushFuelCategories(fes ...FuelCategory)
- func (pay *PaymentInfo) SetDecimalByType(fuelType FuelType, decimal decimal.Decimal)
- type PaymentType
- 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(point string) (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 TxInfo
- type TxSignJSON
- type ViewColSch
- type ViewWheSch
Constants ¶
const ( CallDelayedContract = "@1CallDelayedContract" NewUserContract = "@1NewUser" NewBadBlockContract = "@1NewBadBlock" )
const (
// AddressLength is the expected length of the address
AddressLength = 20
)
const (
// MaxPrice is a maximal value that price function can return
MaxPrice = 100000000000000000
)
const (
SysName = `@system`
)
Variables ¶
var Arithmetic_name = map[int32]string{
0: "NATIVE",
3: "MUL",
4: "DIV",
}
var Arithmetic_value = map[string]int32{
"NATIVE": 0,
"MUL": 3,
"DIV": 4,
}
var BOM = []byte{0xEF, 0xBB, 0xBF}
var (
ErrNotImplementedOnCLB = errors.New("Contract not implemented on CLB")
)
var FuelType_name = map[int32]string{
0: "UNKNOWN",
1: "vmCost_fee",
2: "storage_fee",
3: "expedite_fee",
}
var FuelType_value = map[string]int32{
"UNKNOWN": 0,
"vmCost_fee": 1,
"storage_fee": 2,
"expedite_fee": 3,
}
var GasPayAbleType_name = map[int32]string{
0: "Invalid",
1: "Unable",
2: "Capable",
}
var GasPayAbleType_value = map[string]int32{
"Invalid": 0,
"Unable": 1,
"Capable": 2,
}
var GasScenesType_name = map[int32]string{
0: "Unknown",
1: "Reward",
2: "Taxes",
15: "Direct",
16: "Combustion",
24: "TransferSelf",
}
var GasScenesType_value = map[string]int32{
"Unknown": 0,
"Reward": 1,
"Taxes": 2,
"Direct": 15,
"Combustion": 16,
"TransferSelf": 24,
}
var PaymentType_name = map[int32]string{
0: "INVALID",
1: "ContractCaller",
2: "ContractBinder",
3: "EcosystemAddress",
}
var PaymentType_value = map[string]int32{
"INVALID": 0,
"ContractCaller": 1,
"ContractBinder": 2,
"EcosystemAddress": 3,
}
Functions ¶
func ActivateContract ¶
ActivateContract sets Active status of the contract in script.GetVM()
func AllowChangeCondition ¶
func AllowChangeCondition(sc *SmartContract, tblname string) error
AllowChangeCondition check access to change condition throught supper contract
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 CheckNumberChars ¶
func CheckSignature ¶
func CheckSignature(sc *SmartContract, i map[string]any, name string) error
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 CompileContract ¶
func CompileContract(sc *SmartContract, code string, state, id, token int64) (any, error)
CompileContract is compiling contract
func ContractAccess ¶
func ContractAccess(sc *SmartContract, names ...any) 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 ...any) (bool, error)
ContractConditions calls the 'conditions' function for each of the contracts specified in the parameters
func CreateCLB ¶
func CreateCLB(sc *SmartContract, name, dbUser, dbPassword string, port int64) error
CreateCLB allow create new CLB throught clbmanager
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 CreateTable ¶
func CreateTable(sc *SmartContract, name, columns, permissions string, applicationID int64) (err error)
CreateTable is creating smart contract table
func CreateView ¶
func CreateView(sc *SmartContract, vname, columns, where string, applicationID int64) (err error)
CreateView is creating smart contract view table
func DBCollectMetrics ¶
func DBCollectMetrics(sc *SmartContract) []any
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 any, id int64, inOrder any, offset, limit int64, inWhere *types.Map, query any, group string, all bool) (int64, []any, 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) ([]any, 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 EthereumAddress ¶
func EvalCondition ¶
func EvalCondition(sc *SmartContract, table, name, condfield string) error
EvalCondition gets the condition and check it
func FillTxData ¶
func FlushContract ¶
func FlushContract(sc *SmartContract, iroot any, id int64) error
FlushContract is flushing contract
func FormatMoney ¶
func FormatMoney(sc *SmartContract, exp string, digit int64) (string, error)
func GetAllContracts ¶
func GetCLBList ¶
func GetCLBList(sc *SmartContract) map[string]string
GetCLBList returns list CLB process with statuses
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 GetDataFromXLSX ¶
func GetDataFromXLSX(sc *SmartContract, binaryID, startLine, linesCount, sheetNum int64) (data []any, err error)
GetDataFromXLSX returns json by parameters range
func GetHistory ¶
func GetHistory(sc *SmartContract, tableName string, id int64) ([]any, error)
func GetHistoryRaw ¶
func GetHistoryRow ¶
func GetLogTxCount ¶
func GetLogTxCount(sc *SmartContract, ecosystemID int64) (int64, error)
func GetMapKeys ¶
GetMapKeys returns the array of keys of the map
func GetRowsCountXLSX ¶
func GetRowsCountXLSX(sc *SmartContract, binaryID, sheetNum int64) (int64, error)
GetRowsCountXLSX returns count of rows from excel file
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 IsHonorNodeKey ¶
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 ¶
JSONEncodeIndent converts object to json string
func LangRes ¶
func LangRes(sc *SmartContract, idRes string) string
LangRes returns the language resource
func LoadContract ¶
func LoadContract(transaction *sqldb.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 RandomDecimal ¶
func RandomFloat ¶
func RandomFloat(sc *SmartContract, min float64, max float64) (float64, error)
func RandomInt ¶
func RandomInt(sc *SmartContract, min int64, max int64) (int64, error)
RandomInt returns a random value between min and max
func RoleAccess ¶
func RoleAccess(sc *SmartContract, ids ...any) (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 SendExternalTransaction ¶
func SetContractWallet ¶
func SetContractWallet(sc *SmartContract, tblid, state int64, wallet int64) error
SetContractWallet changes WalletID of the contract in script.GetVM()
func SortedKeys ¶
SortedKeys returns the sorted array of keys of the map
func StopCLBProcess ¶
func StopCLBProcess(sc *SmartContract, name string) error
StopCLBProcess stops CLB 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(dbTx *sqldb.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(dbTx *sqldb.DbTransaction, sysData SysRollData) error
SysRollbackDeleteColumn is rolling back delete column
func SysRollbackDeleteTable ¶
func SysRollbackDeleteTable(dbTx *sqldb.DbTransaction, sysData SysRollData) error
SysRollbackDeleteTable is rolling back delete table
func SysRollbackEcosystem ¶
func SysRollbackEcosystem(dbTx *sqldb.DbTransaction, sysData SysRollData) error
SysRollbackEcosystem is rolling back ecosystem
func SysRollbackEditContract ¶
func SysRollbackEditContract(transaction *sqldb.DbTransaction, sysData SysRollData, EcosystemID string) error
SysRollbackEditContract rollbacks the contract
func SysRollbackNewContract ¶
func SysRollbackNewContract(sysData SysRollData, EcosystemID string) error
func SysRollbackTable ¶
func SysRollbackTable(dbTx *sqldb.DbTransaction, sysData SysRollData) error
SysRollbackTable is rolling back table
func SysRollbackView ¶
func SysRollbackView(DbTransaction *sqldb.DbTransaction, sysData SysRollData) error
SysRollbackView 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 TransferSelf ¶
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 ...any)
func UpdatePlatformParam ¶
func UpdatePlatformParam(sc *SmartContract, name, value, conditions string) (int64, error)
UpdatePlatformParam updates the system parameter
func UpdateRolesNotifications ¶
func UpdateRolesNotifications(sc *SmartContract, ecosystemID int64, roles ...any)
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 Arithmetic ¶
type Arithmetic int32
const ( Arithmetic_NATIVE Arithmetic = 0 Arithmetic_MUL Arithmetic = 3 Arithmetic_DIV Arithmetic = 4 )
func (Arithmetic) EnumDescriptor ¶
func (Arithmetic) EnumDescriptor() ([]byte, []int)
func (Arithmetic) String ¶
func (x Arithmetic) String() string
type Combustion ¶
type Contract ¶
type Contract struct { Name string Called uint32 FreeRequest bool TxGovAccount int64 // state wallet Rate float64 // money rate TableAccounts string StackCont []any // Stack of called contracts Extend map[string]any Block *script.CodeBlock }
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 FlushInfo ¶
type FuelCategory ¶
type FuelCategory struct { FuelType FuelType Decimal decimal.Decimal ConversionRate float64 Flag GasPayAbleType Arithmetic Arithmetic }
func NewFuelCategory ¶
func NewFuelCategory(fuelType FuelType, decimal decimal.Decimal, flag GasPayAbleType, convert float64) FuelCategory
func (*FuelCategory) Detail ¶
func (f *FuelCategory) Detail() (string, any)
func (*FuelCategory) Fees ¶
func (f *FuelCategory) Fees() decimal.Decimal
func (*FuelCategory) FeesInfo ¶
func (f *FuelCategory) FeesInfo() any
type GasPayAbleType ¶
type GasPayAbleType int32
const ( GasPayAbleType_Invalid GasPayAbleType = 0 GasPayAbleType_Unable GasPayAbleType = 1 GasPayAbleType_Capable GasPayAbleType = 2 )
func (GasPayAbleType) EnumDescriptor ¶
func (GasPayAbleType) EnumDescriptor() ([]byte, []int)
func (GasPayAbleType) String ¶
func (x GasPayAbleType) String() string
type GasScenesType ¶
type GasScenesType int32
const ( GasScenesType_Unknown GasScenesType = 0 GasScenesType_Reward GasScenesType = 1 GasScenesType_Taxes GasScenesType = 2 GasScenesType_Direct GasScenesType = 15 GasScenesType_Combustion GasScenesType = 16 GasScenesType_TransferSelf GasScenesType = 24 )
func (GasScenesType) EnumDescriptor ¶
func (GasScenesType) EnumDescriptor() ([]byte, []int)
func (GasScenesType) String ¶
func (x GasScenesType) String() string
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 PaymentInfo ¶
type PaymentInfo struct { TokenEco int64 ToID int64 TaxesID int64 FromID int64 PaymentType PaymentType FuelRate decimal.Decimal FuelCategories []FuelCategory PayWallet *sqldb.Key Ecosystem *sqldb.Ecosystem TaxesSize int64 Indirect bool Combustion *Combustion Penalty bool }
func (*PaymentInfo) Detail ¶
func (pay *PaymentInfo) Detail() any
func (*PaymentInfo) DetailCombustion ¶
func (pay *PaymentInfo) DetailCombustion() any
func (*PaymentInfo) GetEstimate ¶
func (pay *PaymentInfo) GetEstimate() decimal.Decimal
func (*PaymentInfo) GetPayMoney ¶
func (pay *PaymentInfo) GetPayMoney() decimal.Decimal
func (*PaymentInfo) PushFuelCategories ¶
func (pay *PaymentInfo) PushFuelCategories(fes ...FuelCategory)
func (*PaymentInfo) SetDecimalByType ¶
func (pay *PaymentInfo) SetDecimalByType(fuelType FuelType, decimal decimal.Decimal)
type PaymentType ¶
type PaymentType int32
const ( PaymentType_INVALID PaymentType = 0 PaymentType_ContractCaller PaymentType = 1 PaymentType_ContractBinder PaymentType = 2 PaymentType_EcosystemAddress PaymentType = 3 )
func (PaymentType) EnumDescriptor ¶
func (PaymentType) EnumDescriptor() ([]byte, []int)
func (PaymentType) String ¶
func (x PaymentType) String() string
type SmartContract ¶
type SmartContract struct { CLB bool Rollback bool FullAccess bool SysUpdate bool VM *script.VM TxSmart *types.SmartTransaction TxData map[string]any TxContract *Contract TxFuel int64 // The fuel of executing contract TxCost int64 // Maximum cost of executing contract TxUsedCost decimal.Decimal // Used cost of CPU resources TXBlockFuel decimal.Decimal BlockHeader *types.BlockHeader PreBlockHeader *types.BlockHeader Loop map[string]bool Hash []byte Payload []byte Timestamp int64 TxSignature []byte TxSize int64 Size common.StorageSize PublicKeys [][]byte DbTransaction *sqldb.DbTransaction Rand *rand.Rand FlushRollback []*FlushInfo Notifications types.Notifications GenBlock bool TimeLimit int64 Key *sqldb.Key RollBackTx []*types.RollbackTx Penalty bool TokenEcosystems map[int64]any OutputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo TxInputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo TxOutputsMap map[sqldb.KeyUTXO][]sqldb.SpentInfo PrevSysPar map[string]string EcoParams []sqldb.EcoParam // contains filtered or unexported fields }
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
AccessTable checks the access right to the table
func (*SmartContract) AccessTablePerm ¶
func (sc *SmartContract) AccessTablePerm(table, action string) (map[string]string, error)
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(point string) (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 TxInfo ¶
type TxInfo struct { BlockId int64 `json:"block_id"` BlockHash string `json:"block_hash"` Address string `json:"address"` Ecosystem int64 `json:"ecosystem"` Hash string `json:"hash"` Expedite string `json:"expedite"` ContractName string `json:"contract_name"` Params map[string]any `json:"params"` CreatedAt int64 `json:"created_at"` Size string `json:"size"` Status int64 `json:"status"` //0:success 1:penalty }
type TxSignJSON ¶
type TxSignJSON struct { ForSign string `json:"forsign"` Field string `json:"field"` Title string `json:"title"` Params []SignRes `json:"params"` }
TxSignJSON is a structure for additional signs of transaction