Open source contract written in EOSIO C++ for blockchain messaging and RAM logging. This contract is available on
the Telos Network Blockchain under data.scribe account (testnet and mainnet).
This contract is written to handle:
- Blockchain Messaging
- Oracle data posting / Oracle RAM data updates
- Stats logging in RAM, organized by hour / day / month / year (your choice)
- Front-End dApp User Settings stored in RAM (users can later delete their settings to free RAM)
- Smart contract stats logging / tracking in RAM, just have your contract call
ACTION update
WARNING: This project is insufficiently tested / audited to secure financial data. Daily Telos reserves the right to reset the public contract for any reason including the discovery a bug.
- Can organize variables by year / month / day / hour, (ie. daily totals, daily average)
- Variety of valid operations:
set+-*/%minmax - Stores RAM data in following formats:
uint128_tint128_tstd::stringasset - Single RAM row can contain multiple values
- Messagings can multiple variable updates using
|!|...|!|formatting
Send string data for logging to the blockchain. It will filter for |!| to find RAM variable updates.
sender(name) - EOSIO account to pay for all RAM, the one authorized to send the message.message(std::string) - String of the message that may or may not contain RAM updates.
-
|!|var_name|vtype|value|!|-- Will performsetoperation for var_name at index = 0, setting to value -
|!|var_name|vtype|value|operation|index|!|-- Will perform specified operation for var_name at index using *value. -
|!|var_name|vtype|value|operation|index|vardgt(regvar)|type(regvar)|tlimit|vlimit|!|-- Includes additional variable registration details. -
vtype- set tosfor string,ufor uint128_t,afor asset,nfor int128_t
set: Sets variable at vector index, valid for uint64_t, int64_t, and std::string+: Adds value to variable at vector index, for std::string this will append on the end of the string-: Subtracts value to variable at vector index, invalid for std::string*: Multiplies at index, invalid for std::string/: Divides at index, invalid for std::string%: Modulus at index, invalid for std::stringmin: Checks new value against old value at index, keeps the lesser, invalid for std::stringmax: Checks new value against old value at index, keeps the higher, invalid for std::string
Called by the contract function itself get_self(), as a by-product of calling ACTION message it registers a message identifier under global.msgid inside TABLE vregister using a uval.
Registers a new variable in TABLE vregister using varname under the scope. When specifying a type other than x, the signor can create
RAM variable logging / mathematical operations by hour, day, month, year. This could be used to perform daily totals, monthly averages,
daily lows, daily highs, etc. vardgt must be the unique 3 digit identifier for this variable.
signor(name) - EOSIO account to pay for all RAM, the authorized signor to update the variable.scope(name) - EOSIO account (default contract setup must equalsignor) to which the variable is scopedvarname(name) - EOSIO name used to register the variable inregvarACTIONvardgt(name) - EOSIO name that is exactly 3 digits long when converted to string format. InsideTABLE vartablethese digits will follow the type character in the row id:tXXXyymmddhh(the XXX position). As such, the three digits must be unique.type(std::string) -xnormal,hhourly,ddaily,mmonthly,nyearly. This value will comprise the first character of the id inTABLE vartable.tlimit(uint64_t) - Max number of rows assigned to this variable (pertains totype=hdmn)vlimit(uint8_t) - Inside each row, this is the maximum vector size foruvalsvalandnval
This action controls a direct update to a RAM variable, this is great for oracles to use, or more advanced users. It is specifically to handle updates to variables. It provides for finer controls of uploading multiple operations at once and having vectors of uint128_t / int128_t / std::string / asset uploaded to the blockchain in one action.
signor(name) - EOSIO account to pay for all RAM, the authorized signor to update the variable.scope(name) - EOSIO account (default contract setup must equalsignor) to which the variable is scopedvarname(name) - EOSIO name used to register the variable inregvarACTIONheader(vectorstd::string) - Provides a column header description for the data in uval, sval, nval, aval, currently does nothing in the contractoperation(vectorstd::string) - Valid operations to perform on all data:set+-*/%minmaxindex(uint8_t) - Index of where to apply value and operation intouvalsvalandnvaluval(vector<uint128_t>) - Vector of uint128_tsval(vectorstd::string) - Vector of std::stringnval(vector<int128_t>) - Vector of int128_taval(vectoreosio::asset) - Vector of asset
Deletes a registered variable from TABLE vregister, so long as all the rows were deleted.
signor(name) - EOSIO account to pay for all RAM, the authorized signor to update the variable.scope(name) - EOSIO account (default contract setup must equalsignor) to which the variable is scopedvarname(name) - EOSIO name used to register the variable inregvarACTION
Deletes item from TABLE vartable by time specified
signor(name) - EOSIO account to pay for all RAM, the authorized signor to update the variable.scope(name) - EOSIO account (default contract setup must equalsignor) to which the variable is scopedvarname(name) - EOSIO name used to register the variable inregvarACTIONtime(time_point_sec) - Specify the time of variable you want to deleted
Deletes item from TABLE vartable by last items in that table. Good for quickly clearing out RAM.
signor(name) - EOSIO account to pay for all RAM, the authorized signor to update the variable.scope(name) - EOSIO account (default contract setup must equalsignor) to which the variable is scopedqty(uint8_t) - Quantity of variables to delete