Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Clean up 3.0: EOSIO to Antelope #36

Merged
merged 1 commit into from
Sep 22, 2022
Merged
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
2 changes: 1 addition & 1 deletion docs/03_command-reference/cdt-cc.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
content_title: cdt-cc tool
---

To manually compile the source code, use `cdt-cc` and `cdt-ld` as if it were __clang__ and __lld__. All the includes and options specific to EOSIO and CDT are baked in.
To manually compile the source code, use `cdt-cc` and `cdt-ld` as if it were __clang__ and __lld__. All the includes and options specific to Antelope and CDT are baked in.

```
USAGE: cdt-cc [options] <input file> ...
Expand Down
2 changes: 1 addition & 1 deletion docs/03_command-reference/cdt-cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
content_title: cdt-cpp tool
---

To manually compile the source code, use `cdt-cpp` and `cdt-ld` as if it were __clang__ and __lld__. All the includes and options specific to EOSIO and CDT are baked in.
To manually compile the source code, use `cdt-cpp` and `cdt-ld` as if it were __clang__ and __lld__. All the includes and options specific to Antelope and CDT are baked in.

```
USAGE: cdt-cpp [options] <input file> ...
Expand Down
2 changes: 1 addition & 1 deletion docs/03_command-reference/cdt-ld.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
content_title: cdt-ld tool
---

The cdt-ld tool is a the custom web assembly linker for EOSIO platform smart contracts.
The cdt-ld tool is a the custom web assembly linker for Antelope framework smart contracts.


```
Expand Down
4 changes: 2 additions & 2 deletions docs/05_features/10_return_values_from_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ An Antelope blockchain with the `ACTION_RETURN_VALUE` protocol feature activated

## Concept

When you implement an action within a smart contract use the `return` statement and pass any value to the action sender. The returned value can be of any C++ primitive type, any C++ standard library type, or any user defined type. The `EOSIO` framework does all the work necessary to serialize the value returned and send it back to the client. On the client side you deserialize the received value and access it the same way you access any other function’s return value.
When you implement an action within a smart contract use the `return` statement and pass any value to the action sender. The returned value can be of any C++ primitive type, any C++ standard library type, or any user defined type. The `Antelope` framework does all the work necessary to serialize the value returned and send it back to the client. On the client side you deserialize the received value and access it the same way you access any other function’s return value.

## Details

The following list provides important details for when you return a value from an action:

* As mentioned above, the `EOSIO` framework does all the heavy lifting for the return value to convey it to the client. The `EOSIO` framework defines and uses a new intrinsic, namely `set_action_return_value`. To learn more about `EOSIO` returned values functionality, refer to its documentation and [implementation](https://github.com/AntelopeIO/cdt/blob/develop/libraries/native/intrinsics.cpp#L295).
* As mentioned above, the `Antelope` framework does all the heavy lifting for the return value to convey it to the client. The `Antelope` framework defines and uses a new intrinsic, namely `set_action_return_value`. To learn more about `Antelope` returned values functionality, refer to its documentation and [implementation](https://github.com/AntelopeIO/cdt/blob/develop/libraries/native/intrinsics.cpp#L295).
* The CPU time and memory limit of your contract (maximum size of wasm), not RAM or NET, defines the limits of the returned value..
* The action receipt includes a hash of the serialized returned value.
* The action trace includes the serialized returned value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ This guide provides instructions how to perform authorization checks in a smart

See the following code reference guides for functions which can be used to implement authorization checks in a smart contract:

* function [has_auth(name n)](https://developers.eos.io/manuals/eosio.cdt/latest/namespaceeosio#function-has_auth)
* function [require_auth(name n)](https://developers.eos.io/manuals/eosio.cdt/latest/namespaceeosio/#function-require_auth-12)
* function [require_auth2(capi_name name, capi_name permission)](https://developers.eos.io/manuals/eosio.cdt/v1.8/group__action__c#function-require_auth2)
* function [check(bool pred, ...)](https://developers.eos.io/manuals/eosio.cdt/latest/group__system/#function-check)
* function [has_auth(name n)](http://docs.eosnetwork.com/cdt/latest/reference/Namespaces/namespaceeosio#function-has_auth)
* function [require_auth(name n)](http://docs.eosnetwork.com/cdt/latest/reference/Namespaces/namespaceeosio#function-require_auth)
* function [require_auth2(capi_name name, capi_name permission)](http://docs.eosnetwork.com/cdt/latest/reference/Files/action_8h)
* function [check(bool pred, ...)](http://docs.eosnetwork.com/cdt/latest/reference/Namespaces/namespaceeosio#function-check)

## Procedure

Expand All @@ -45,7 +45,7 @@ void hi( name user ) {
}
```

Another example can be found in the [Tic Tac Toe Tutorial](https://developers.eos.io/welcome/latest/tutorials/tic-tac-toe-game-contract/#action-handler---move).
Another example can be found in the [Tic Tac Toe Tutorial](https://docs.eosnetwork.com/welcome/latest/tutorials/tic-tac-toe-game-contract#action-handler---move).

### 2. Use require_auth

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),

## Procedure

Expand Down Expand Up @@ -78,7 +78,7 @@ Add the definition of the primary index for the multi-index table. The primary i

### 4. Define A Multi-Index Type Alias

For ease of use, define a type alias `test_table_t` based on the `eosio::multi_index` template type, parametarized with a random name `"testtaba"` and the `test_table` data structure. The names must adhere to `EOSIO` account name restrictions.
For ease of use, define a type alias `test_table_t` based on the `eosio::multi_index` template type, parametarized with a random name `"testtaba"` and the `test_table` data structure. The names must adhere to `Antelope` account name restrictions.

```diff
// the data structure which defines each row of the table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),
* A multi-index table `testtab` along with its `test_table` data structure, its mandatory primary index, and the type alias definition `test_table_t`. Please see [How To Define A Primary Index](./how-to-define-a-primary-index) to set up these prerequisites.

## Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),

## Procedure

Expand Down Expand Up @@ -45,7 +45,7 @@ Define the data structure for the multi-index table:

### 3. Define A Singleton Type Alias

For ease of use, define a type alias `singleton_type` based on the `eosio::singleton` template type, parametarized with a random name `"testtable"` and the `testtable` data structure. The names must adhere to `EOSIO` account name restrictions.
For ease of use, define a type alias `singleton_type` based on the `eosio::singleton` template type, parametarized with a random name `"testtable"` and the `testtable` data structure. The names must adhere to `Antelope` account name restrictions.

```diff
struct [[eosio::table]] testtable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),
* A multi-index `testab` table instance which stores `user` objects indexed by the primary key which is of type `eosio::name`. Consult the section [How to instantiate a multi-index table](./how-to-instantiate-a-multi-index-table.md) to learn how to set it up.

## Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),
* A multi-index `testab` table instance which stores `user` objects indexed by the primary key which is of type `eosio::name`. Consult the section [How to instantiate a multi-index table](./how-to-instantiate-a-multi-index-table.md) to learn how to set it up.

## Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),

## Procedure

Expand Down Expand Up @@ -73,7 +73,7 @@ Add the definition of the primary index for the multi-index table. The primary i

### 4. Define A Multi-Index Type Alias

For ease of use, define a type alias `test_table_t` based on the `eosio::multi_index` template type, parametarized with a random name `"testtaba"` and the `test_table` data structure. The names must adhere to `EOSIO` account name restrictions.
For ease of use, define a type alias `test_table_t` based on the `eosio::multi_index` template type, parametarized with a random name `"testtaba"` and the `test_table` data structure. The names must adhere to `Antelope` account name restrictions.

```diff
// the data structure which defines each row of the table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),
* A multi-index `testab` table instance which stores `user` objects indexed by the primary key which is of type `eosio::name` and a secondary index for data member `secondary` of type `eosio::name` accessible through `by_secondary()` method. Consult the section [How to define a secondary index](./how-to-define-a-secondary-index) to learn how to set it up.

## Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),
* A multi-index `testab` table instance which stores `user` objects indexed by the primary key which is of type `eosio::name`. Consult the section [How to instantiate a multi-index table](./how-to-instantiate-a-multi-index-table) to learn how to set it up.

## Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See the following code reference:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index),
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/),
* A multi-index `testab` table instance which stores `user` objects indexed by the primary key which is of type `eosio::name`. Consult the section [How to instantiate a multi-index table](./how-to-instantiate-a-multi-index-table) to learn how to set it up.

## Procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ See the following code reference guide for action wrapper:

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index).
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/).
* A smart contract named `multi_index_example`, defined in file `multi_index_example.hpp`.
* An action `mod` which modifies the integer value `n` stored for row with key `user`.

Expand Down
4 changes: 2 additions & 2 deletions docs/06_how-to-guides/60_how-to-return-values-from-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In order to accomplish this, use the `return` statement and pass the desired ret

Make sure you have the following prerequisites in place:

* An EOSIO development environment, for details consult the [Get Started Guide](https://developers.eos.io/welcome/latest/getting-started-guide/index).
* An Antelope development environment, for details consult the [Get Started Guide](https://docs.eosnetwork.com/welcome/latest/getting-started/).
* A smart contract, let’s call it `smrtcontract`, which builds without error.
* An action, let’s call it `checkwithrv`, from which you want to return a value of a user defined type `action_response`.

Expand Down Expand Up @@ -68,7 +68,7 @@ For a complete example of a smart contract that implements an action which retur

## Next Steps

* Compile the smart contract and deploy it to the EOSIO testnet or any EOSIO based blockchain.
* Compile the smart contract and deploy it to the Antelope testnet or any Antelope based blockchain.
* Use the `cleos` command to send the `checkwithrv` action to the smart contract and observe the returned value in the `cleos` output.
* Use other means (e.g. programmatically) to send the `checkwithrv` action to the smart contract and observe the returned value in the action trace.

Expand Down
16 changes: 8 additions & 8 deletions docs/07_best-practices/02_naming-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
content_title: Naming conventions
---

When implementing EOSIO smart contracts and when storing data in an EOSIO blockchain, it is important to follow the established EOSIO conventions for naming accounts, actions, tables, etc.
When implementing Antelope smart contracts and when storing data in an Antelope blockchain, it is important to follow the established Antelope conventions for naming accounts, actions, tables, etc.

## EOSIO names
## Antelope names

* Applies to all EOSIO encoded names (accounts, actions, tables, etc.)
* Applies to all Antelope encoded names (accounts, actions, tables, etc.)
* Encoded as a 64-bit unsigned integer (`uint64_t`) on the blockchain.
* First 12 characters, if any, encoded in `base32` using characters: `.`, `1-5`, `a-z`
* 13th character, if applicable, encoded in `base16` using characters: `.`, `1-5`, `a-j`
Expand Down Expand Up @@ -34,15 +34,15 @@ When implementing EOSIO smart contracts and when storing data in an EOSIO blockc

The figure below showcases a 12 character string formatted into a 64-bit unsigned integer. Note: the 13th char, if any, contains 2<sup>4</sup> = 16 cases per 1 digit (char): 1 (`.`) + 5 (`1-5`) + 10 (`a-j`).

![](naming-conventions-format.png "EOSIO name format")
![](naming-conventions-format.png "Antelope name format")

## Encoding and decoding

EOSIO name objects can be created, encoded, and decoded via the `eosio::name` class.
Antelope name objects can be created, encoded, and decoded via the `eosio::name` class.

1. To encode an `std::string` into an EOSIO name object, use the appropriate `eosio::name()` constructor.
2. To encode a `char *` string literal into an EOSIO name object, you can also use the `""_n` operator.
3. To decode an EOSIO name object into an `std::string`, use the `eosio::to_string()` function.
1. To encode an `std::string` into an Antelope name object, use the appropriate `eosio::name()` constructor.
2. To encode a `char *` string literal into an Antelope name object, you can also use the `""_n` operator.
3. To decode an Antelope name object into an `std::string`, use the `eosio::to_string()` function.

### Examples

Expand Down
6 changes: 3 additions & 3 deletions docs/07_best-practices/03_resource-planning.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ How much RAM do I need? This is not an easy question to answer, and there's real

You need to test and simulate various business scenarios that apply to your blockchain application and measure their resource usage. Hence, the existence of the public test networks. These allow you to measure how much RAM, CPU, and NET each action consumes, and to measure worst and best case business scenarios. You can then extrapolate and build a fairly good view of your blockchain application's resource needs.

Once you have a fair idea of how your contract, blockchain application, and user base are consuming blockchain resources on a public test-net you can estimate what you'll need to start with on any EOSIO-based networks, public or private. From that point onward, as with any other application, it is advisable to have monitors that tell you statistics and metrics about your application performance.
Once you have a fair idea of how your contract, blockchain application, and user base are consuming blockchain resources on a public test-net you can estimate what you'll need to start with on any Antelope-based networks, public or private. From that point onward, as with any other application, it is advisable to have monitors that tell you statistics and metrics about your application performance.

Of course some aspects might differ from network to network, because each network might have altered its system contracts. The EOSIO code base is open sourced and it can be tailored to each network's requirements. You need to be aware of these differences and take them into account if this is the case with a network you're testing on.
Of course some aspects might differ from network to network, because each network might have altered its system contracts. The Antelope code base is open sourced and it can be tailored to each network's requirements. You need to be aware of these differences and take them into account if this is the case with a network you're testing on.

The EOSIO community is also providing tools that can help you in this endeavor. One example is https://www.eosrp.io
The Antelope community is also providing tools that can help you in this endeavor. One example is https://www.eosrp.io
Because the RAM price varies and because the CPU and NET bandwidth allocations vary too, as it is explained in the previous section, this tool can help you estimate how much of each resource you can allocate based on a specific amount of tokens and vice-versa.

Another aspect of resource planning involves making sure your contract is efficient, that is, not consuming resources unnecessarily. Therefore, it is beneficial for you to find answers to the following questions when writing your own smart contracts and blockchain applications:
Expand Down
Loading