Update support_functions.md

This commit is contained in:
CaptainDero 2021-02-28 16:01:03 +00:00 committed by GitHub
parent 03c6c16f69
commit 95b2d193f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,33 +1,32 @@
Support Functions are inbuilt functions which provide some functionality or expose internals for speed and technical reasons.
**Support Functions are inbuilt functions which provide some functionality or expose internals for speed and technical reasons.**
LOAD(variable)
==============
LOAD loads a variable which was previously stored in the blockchain using STORE function. Return type will be Uint64/String depending on what is stored.
It will panic if the value does NOT exists
It will panic if the value does NOT exists.
Uint64 EXISTS(variable)
=======================
EXISTS return 1 if the variable is store in DB and 0 otherwise
EXISTS return 1 if the variable is store in DB and 0 otherwise.
STORE(key variable, value variable)
===================================
STORE stores key and value in the DB. All storage state of the SC is accessible only from the SC which created it.
Uint64 RANDOM()
Uint64 RANDOM(limit Uin64)
============================
Uint64 RANDOM() or Uint64 RANDOM(limit Uint64)
==============================================
RANDOM returns a random using a PRNG seeded on BLID,SCID,TXID. First form gives a uint64, second form returns
random number in the range 0 - (limit), 0 is inclusive, limit is exclusive
random number in the range 0 - (limit), 0 is inclusive, limit is exclusive.
String SCID()
==============
Returns SMART CONTRACT ID which is currently running
Returns SMART CONTRACT ID which is currently running.
String BLID()
==============
Returns current BLOCK ID which contains current execution-in-progress TXID
Returns current BLOCK ID which contains current execution-in-progress TXID.
String TXID()
=============
@ -35,28 +34,28 @@ Returns current TXID which is execution-in-progress.
Uint64 BLOCK_HEIGHT()
=====================
Returns current chain height of BLID()
Returns current chain height of BLID().
Uint64 BLOCK_TOPOHEIGHT()
===========================
Returns current topoheight of BLID()
Returns current topoheight of BLID().
String SIGNER()
=================
Returns address of who signed this transaction
Returns address of who signed/sent this transaction. SIGNER() returns the raw address.
Uint64 IS_ADDRESS_VALID(p String)
=================================
Returns 1 if address is valid, 0 otherwise
Returns 1 if address is valid, 0 otherwise.
String ADDRESS_RAW(p String)
============================
Returns address in RAW form as 33 byte keys, stripping away textual/presentation form. 2 address should always be compared in RAW form
Returns address in RAW form as 33 byte keys, stripping away textual/presentation form. Addresses should always be compared in RAW form.
SEND_DERO_TO_ADDRESS(a String, amount Uint64)
==============================================
Sends amount DERO from SC DERO balance to a address which should be raw form. address must in string form DERO/DETO form
Sends amount DERO from SC DERO balance to a address which should be raw form. address must in string form DERO/DETO form.
If the SC does not have enough balance, it will panic
@ -64,6 +63,12 @@ ADD_VALUE(a String, amount Uint64)
====================================
Send specific number of token to specific account.
If account is bring touched for the first time, it is done simply.
If account is already initialized ( it already has some balance, but SC does not know how much). So, it gives additional balance homomorphically
If account is already initialized ( it already has some balance, but SC does not know how much). So, it gives additional balance homomorphically.
DEROVALUE()
============
DEROVALUE() gives DERO transacted/deposited in current transaction.
TOKENVALUE()
============
TOKENVALUE() gives particular token transacted/deposited in currrent transaction.