Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: QA

on:
pull_request:
branches:
- main

defaults:
run:
shell: bash

jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
override: true

- uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}

- run: |
make lint

test:
needs:
- lint
runs-on: ${{ matrix.platform.on }}
name: ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
platform:
# - { on: ubuntu-20.04, name: linux, target: x86_64-unknown-linux-musl }
- { on: macos-11, name: macos, target: x86_64-apple-darwin }
# - { on: windows-2022, name: windows, target: x86_64-pc-windows-gnu }

steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform.target }}
profile: minimal
override: true

- uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('Cargo.lock') }}

- run: |
make test
93 changes: 93 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Release

on:
push:
tags:
- '*'

defaults:
run:
shell: bash

jobs:
qa:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
override: true

- uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}

- run: |
make qa

build:
needs:
- qa
runs-on: ${{ matrix.platform.on }}
name: ${{ matrix.platform.name }}
strategy:
fail-fast: false
matrix:
platform:
- { on: ubuntu-20.04, name: linux-amd64, target: x86_64-unknown-linux-musl }
- { on: ubuntu-20.04, name: freebsd-amd64, target: x86_64-unknown-freebsd }
- { on: macos-11, name: darwin-amd64, target: x86_64-apple-darwin }
- { on: macos-11, name: darwin-arm64, target: aarch64-apple-darwin }
- { on: windows-2022, name: windows-amd64, target: x86_64-pc-windows-gnu }

steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform.target }}
profile: minimal
override: true

- uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('Cargo.lock') }}

- run: |
make release
tar -czvf sold-${{ github.ref_name }}-${{ matrix.platform.name }}.tar.gz -C release sold*

- uses: actions/upload-artifact@v3
with:
name: sold-${{ github.ref_name }}-${{ matrix.platform.name }}
path: |
release/sold*

- uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
files: |
sold-${{ github.ref_name }}-${{ matrix.platform.name }}.tar.gz
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ build/
sold/target/
target/
.idea/
.deps-ready
release
53 changes: 29 additions & 24 deletions API.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# **TON Solidity API**
# **Ever Solidity**

TON Solidity compiler expands Solidity language with different API functions to facilitate TON
contract development.
Ever Solidity compiler expands Solidity language with different API functions to facilitate contract development.

## Table of Contents

* [Compiler version](#compiler-version)
* [TON specific types](#ton-specific-types)
* [TON units](#ton-units)
* [Specific types](#specific-types)
* [Units](#units)
* [TvmCell](#tvmcell)
* [\<TvmCell\>.depth()](#tvmcelldepth)
* [\<TvmCell\>.dataSize()](#tvmcelldatasize)
Expand Down Expand Up @@ -68,10 +67,10 @@ contract development.
* [\<vector(Type)\>.pop()](#vectortypepop)
* [\<vector(Type)\>.length()](#vectortypelength)
* [\<vector(Type)\>.empty()](#vectortypeempty)
* [TON specific control structures](#ton-specific-control-structures)
* [Specific control structures](#specific-control-structures)
* [Range-based for loop](#range-based-for-loop)
* [repeat](#repeat)
* [try-catch](#trycatch)
* [try-catch](#try-catch)
* [Changes and extensions in Solidity types](#changes-and-extensions-in-solidity-types)
* [Integers](#integers)
* [bitSize() and uBitSize()](#bitsize-and-ubitsize)
Expand Down Expand Up @@ -274,7 +273,7 @@ contract development.

### Compiler version

TON Solidity compiler add its current version to the generated code. This version can be obtained:
Ever Solidity compiler add its current version to the generated code. This version can be obtained:

1) using [tvm_linker](https://github.com/tonlabs/TVM-linker#2-decoding-of-boc-messages-prepared-externally) from a `*.tvc` file:

Expand All @@ -288,13 +287,13 @@ tvm_linker decode --tvm <tvc-file>
tonos-cli decode tvc [--tvc] [--boc] <input>
```

### TON specific types
### Specific types

TON Solidity compiler expands functionality of some existing types and adds several new TVM specific types: TvmCell, TvmSlice, TvmBuilder and ExtraCurrencyCollection. Full description of these types can be found in [TVM][1] and [TON Blockchain][2] specifications.
Ever Solidity compiler expands functionality of some existing types and adds several new TVM specific types: TvmCell, TvmSlice, TvmBuilder and ExtraCurrencyCollection. Full description of these types can be found in [TVM][1] and [TON Blockchain][2] specifications.

#### TON units
#### Units

A literal number can take a suffix to specify a subdenomination of TON currency, where numbers without a postfix are assumed to be nanotons.
A literal number can take a suffix to specify a subdenomination of currency, where numbers without a postfix are assumed to be nanotons.

```TVMSolidity
uint a0 = 1 nano; // a0 == 1
Expand Down Expand Up @@ -645,7 +644,7 @@ Skips the first `length` bits and `refs` references from the `TvmSlice`.

#### TvmBuilder

`TvmBuilder` represents *TVM cell builder* ([TVM][1] - 1.1.3). TON Solidity compiler defines the following
`TvmBuilder` represents *TVM cell builder* ([TVM][1] - 1.1.3). Ever Solidity compiler defines the following
functions to work with this type:

##### \<TvmBuilder\>.toSlice()
Expand Down Expand Up @@ -994,7 +993,7 @@ vector(uint) vect;
bool is_empty = vect.empty();
```

### TON specific control structures
### Specific control structures

### Range-based for loop

Expand Down Expand Up @@ -1376,7 +1375,7 @@ If `bytes` object has less than **N** bytes, extra bytes are padded with zero bi

#### string

TON Solidity compiler expands `string` type with the following functions:
Ever Solidity compiler expands `string` type with the following functions:

**Note**: Due to VM restrictions string length can't exceed `1024 * 127 = 130048` bytes.

Expand Down Expand Up @@ -1558,7 +1557,7 @@ If `string` object has less than **N** bytes, extra bytes are padded with zero b
#### address

`address` represents different types of TVM addresses: **addr_none**, **addr_extern**,
**addr_std** and **addr_var**. TON Solidity compiler expands `address` type with the following
**addr_std** and **addr_var**. Ever Solidity compiler expands `address` type with the following
members and functions:

##### Object creating
Expand Down Expand Up @@ -1771,7 +1770,7 @@ See example of `address.transfer()` usage:

#### mapping

TON Solidity compiler expands `mapping` type with the following functions. In examples
Ever Solidity compiler expands `mapping` type with the following functions. In examples
below `\<map\>` defines the object of `mapping(KeyType => ValueType)` type.

Address, bytes, string, bool, contract, enum, fixed bytes, integer and struct types can
Expand Down Expand Up @@ -1805,6 +1804,9 @@ If `bytes`, `string` or `TvmCell` types are used as `KeyType` then `mapping` sto
only hashes of mapping keys. That's why for these types the `delMin`/`min`/`next` and
another mapping methods return `uint256` as key (not `bytes`/`string`/`TvmCell`).

If you use mapping as an input or output param for public/external functions,
`KeyType` of the mapping can only be of type `address` or of `int<M>`/`uint<M>` types with M from 8 to 256.

See example of how to work with mappings:

* [database](https://github.com/tonlabs/samples/blob/master/solidity/13_BankCollector.sol)
Expand Down Expand Up @@ -2146,7 +2148,7 @@ contract MyContract {

##### Function call via object

In TON solidity **arguments of a function call passed by value not by
In Ever Solidity **arguments of a function call passed by value not by
reference**. It's effective for numbers and even for huge arrays.
See ([TVM][1] - A.2.3.2).
**But if a library function is called like `obj.func(b, c)` then the
Expand Down Expand Up @@ -2202,7 +2204,7 @@ contract MyContract {

### Import

TON Solidity compiler allows user to import remote files using link starting with `http`.
Ever Solidity compiler allows user to import remote files using link starting with `http`.
If import file name starts with `http`, then compiler tries to download the file using this
link and saves it to the folder `.solc_imports`. If compiler fails to create this folder or
to download the file, then an error is emitted.
Expand Down Expand Up @@ -2283,7 +2285,7 @@ pragma AbiHeader expire;

Defines headers that are used in external messages:

* `pubkey` (`uint256`) - optional public key that the message can be signed with.
* `pubkey` (`uint256`) - optional public key that can be used to verify the signature of the message.
* `time` (`uint64`) - local time when message was created. Used for replay protection.
* `expire` (`uint32`) - time when the message should be meant as expired.

Expand Down Expand Up @@ -2556,6 +2558,9 @@ function onCodeUpgrade(...) private {
}
```

Function `onCodeUpgrade` had function id = 2 (for compiler <= 0.65.0). Now, it has another id, but you can set
`functionID(2)` in new contracts for the `onCodeUpgrade` to upgrade old ones.

See example of how to upgrade code of the contract:

* [old contract](https://github.com/tonlabs/samples/blob/master/solidity/12_BadContract.sol)
Expand Down Expand Up @@ -2765,7 +2770,7 @@ function f(uint n) public responsible pure {

### External function calls

TON Solidity compiler allows specifying different parameters of the outbound internal message that
Ever Solidity compiler allows specifying different parameters of the outbound internal message that
is sent via external function call. Note, all external function calls are asynchronous, so
callee function will be called after termination of the current transaction.
`value`, `currencies`, `bounce` or `flag` options can be set. See [\<address\>.transfer()](#addresstransfer)
Expand Down Expand Up @@ -2849,7 +2854,7 @@ and [4.1_CurrencyExchange.sol](https://github.com/tonlabs/samples/blob/master/so

#### Synchronous calls

TON Solidity compiler allows user to perform synchronous calls. To do it user should call a remote contract
Ever Solidity compiler allows user to perform synchronous calls. To do it user should call a remote contract
function with `.await` suffix. Example:

```TVMSolidity
Expand Down Expand Up @@ -3494,7 +3499,7 @@ uint16 dataDepth = data.depth();
uint256 hash = tvm.stateInitHash(codeHash, dataHash, codeDepth, dataDepth);
```

See also [internal doc](https://github.com/tonlabs/TON-Solidity-Compiler/blob/master/docs/internal/stateInit_hash.md) to read more about this
See also [internal doc](docs/internal/stateInit_hash.md) to read more about this
function mechanics.

##### Deploy via new
Expand Down Expand Up @@ -4174,7 +4179,7 @@ Returns the starting logical time of the current block.

The pseudorandom number generator uses the random seed. The
initial value of the random seed before a smart contract execution in
TON Blockchain is a hash of the smart contract address and the global
Everscale is a hash of the smart contract address and the global
block random seed. If there are several runs of the same smart contract
inside a block, then all of these runs will have the same random seed.
This can be fixed, for example, by running `rnd.shuffle()` (without
Expand Down
Loading