Echo has an Ethereum virtual machine (EVM) integrated, which allows for uploading and implementing smart contracts written in Solidity, on Echo network.
Solidity - is a high-level object-oriented programming language for writing smart contracts. Full documentation on it is available here.
Unlike Ethereum, where addresses are presented in the form of hashes, Echo uses incremental IDs in the form of triplets for account and contract identification.
1.17.x- contract performance result
In order to use the address of an account or a contract, it needs to be converted to an Ethereum address.
Ethereum address represents 20 bytes, where:
uint64_tnumber takes the last 8 bytes.
ff0000000000000000000000ffffffffffffffff | Conversion of decimal Echo type [ 11 bytes of zeros ][ 8 bytes ] | to hex short type: ^ 1 byte id short type id instance | 2 -> 00 - account | 16 -> 01 - contract 1.2.26 = account 26 (0x1a) = | dd -> xx - everything else 000000000000000000000000000000000000001a | | 1.16.5 = contract 5 = | 0100000000000000000000000000000000000005 |
In the context of smart contracts, the Echo network has 2 major differences from the Ethereum network, which would not allow the use of contracts without their adaptation. Firstly, unlike the Ethereum network, the Echo network has not just one currency, but a list of assets. Secondly, each asset accuracy is different from the accuracy of Eth (18), since it can be configured specifically for each asset.
To preserve the compatibility of contracts between networks and configure the contract operation, contract creation parameters have been added to the Echo network.
Since Echo is a multi-asset system while Ethereum is not, it gives rise to many problems based on such asset differences as course, accuracy, balance, etc. To solve these problems, the
supported_asset_id parameter was introduced. The parameter limits the assets, that are compatible with the contract, to the one specified in the parameter.
This parameter is optional and can be specified when creating a contract, transferring the name of the asset as the parameter
In Echo contracts there was added a flag showing the need to attaining an Ethereum accuracy while working with balance sheets in contracts.
By default, this flag is set to
false. The flag can be set when creating a contract by making
false the parameter of
For example, let's take an asset
ECHO that has 5 decimal places and, if the flag is set to
false, then, when sending 1 ECHO, the contract will receive the amount of
100000. And if the flag is set to
true, when sending the same 1 ECHO, the contract will receive the amount of
10000000000000000. The flag was added to enable full-fledged contracts written for