Skip to content

Commit

Permalink
Merge PR #28 from deleterium/develop
Browse files Browse the repository at this point in the history
Release 2.1
  • Loading branch information
deleterium authored Aug 6, 2022
2 parents c1a122d + eb872df commit fabd983
Show file tree
Hide file tree
Showing 31 changed files with 2,016 additions and 547 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- uses: actions/setup-node@v2
with:
Expand Down
21 changes: 21 additions & 0 deletions docs/1.5-Built-in-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ fixed getAmountFx(long transaction);
long getSender(long transaction);
long getType(long transaction);
void readMessage(long transaction, long page, long * buffer);
void readShortMessage(long transaction, long * buffer, long length);
void readAssets(long transaction, long * buffer);
long getQuantity(long transaction, long assetId);

// Sending transaction
void sendAmount(long amount, long accountId);
void sendAmountFx(fixed amount, long accountId);
void sendMessage(long * buffer, long accountId);
void sendShortMessage(long * buffer, long length, long accountId);
void sendAmountAndMessage(long amount, long * buffer, long accountId);
void sendAmountAndMessageFx(fixed amount, long * buffer, long accountId);
void sendBalance(long accountId);
Expand Down Expand Up @@ -186,6 +188,16 @@ First page is 0 and there is no indicator of message size. Control the message e
If 'page' is lower than zero or greater than 32, buffer is filled with zeros.
If 'transaction' is invalid or there is no message attached, buffer is filled with zeros.

### readShortMessage
* Prototype:
`void readShortMessage(long transaction, long * buffer, long length);`
* Description:
Reads the first 'length' longs from message of 'transaction' and store it at 'buffer'.
This function only reads the message at page zero.
Ensure the 'buffer' is at least 'length' longs long, or the function will overflow the buffer.
If 'transaction' is invalid or there is no message attached, buffer is filled with zeros.
Limits: 0 <= length <= 4.

### readAssets
* Prototype:
`void readAssets(long transaction, long * buffer);`
Expand Down Expand Up @@ -230,6 +242,15 @@ If the function is used more than once in a block, the messages are concatenated
If a 32th page is sent, the first 31 pages are disregarded and the loop restarts.
VERIFY: Transaction is sent with empty message? A empty message is one containing only zeros.

### sendShortMessage
* Prototype:
`void sendShortMessage(long * buffer, long length, long accountId);`
* Description:
Enqueues a transaction to send the content of 'buffer' with 'length' as one message page (32 bytes or 4 longs) to 'accountId'.
If 'length' is equal or lower than 3, remaining longs are filled with zeros.
Total message size restriction is the same as SendMessage.
Limits: 0 <= length <= 4.

### sendAmountAndMessage, sendAmountAndMessageFx
* Prototype:
`void sendAmountAndMessage(long amount, long * buffer, long accountId);`
Expand Down
87 changes: 85 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smartc-signum-compiler",
"version": "2.0.1",
"version": "2.1.0",
"description": "C Compiler for smart contracts on Signum network",
"main": "dist/smartc.js",
"types": "dist/smartc.d.ts",
Expand Down Expand Up @@ -42,6 +42,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"globule": "^1.3.4",
"jest": "^27.5.1",
"light-server": "^2.9.1",
"ts-jest": "^27.1.5",
Expand Down
Loading

0 comments on commit fabd983

Please sign in to comment.