diff --git a/README.md b/README.md index 9b5a2c4..da6eaa9 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ eosio.evm supports all 9 precompiles All constants are found at [constants.hpp](eosio.evm/include/eosio.evm/constants.hpp) 1. **TESTING** - adds functionality for executing tests, and resetting the contract; default true, remove in production -2. **BN_CURVE** - adds bnadd, bnmul, and bnpair precompiles; default true +2. **BN_CURVE** - adds bnadd, bnmul, and bnpair precompiles; default false 3. **CHARGE_SENDER_FOR_GAS** - toggle charging sender for gas; default false, required for ethereum tests 4. **PRINT_LOGS** - prints logs as part of execution receipt; default false 5. **OPTRACE** - prints the opcode trace for the execution; default false @@ -46,7 +46,7 @@ All constants are found at [constants.hpp](eosio.evm/include/eosio.evm/constants **NOTE:** [TESTING, CHARGE_SENDER_FOR_GAS] must be enabled, and [OPTRACE, PRINT_LOGS] must be disabled for ethereum/tests testing to pass successfuly. -**NOTE:** If ec_add, ec_mul and ec_pairing precompiles are not required, set BN_CURVE to false to reduce WASM size by 210KB (~2MB onchain). +**NOTE:** If ec_add, ec_mul and ec_pairing precompiles are required, set BN_CURVE to true (will increase WASM size by 210KB, or ~2MB onchain). ## Usage instructions Deployment steps are laid out step-by-step in both the JS and cleos guides: diff --git a/eos-evm-js/docs/classes/eosapi.html b/eos-evm-js/docs/classes/eosapi.html index 092cb21..f3595e9 100644 --- a/eos-evm-js/docs/classes/eosapi.html +++ b/eos-evm-js/docs/classes/eosapi.html @@ -1131,7 +1131,7 @@

constructor

  • Parameters

    @@ -1164,7 +1164,7 @@

    eos

    eos: any
    @@ -1174,7 +1174,7 @@

    eosContract

    eosContract: string
    @@ -1184,7 +1184,7 @@

    eosPrivateKeys

    eosPrivateKeys: Array<string>
    @@ -1194,7 +1194,7 @@

    rpc

    rpc: any
    @@ -1204,7 +1204,7 @@

    signatureProvider

    signatureProvider: any
    @@ -1221,7 +1221,7 @@

    call

  • Parameters

    @@ -1256,7 +1256,7 @@

    clearAll

  • Returns Promise<any>

    @@ -1274,7 +1274,7 @@

    create

  • Parameters

    @@ -1306,7 +1306,7 @@

    deposit

  • Parameters

    @@ -1341,7 +1341,7 @@

    devNewAccount

  • Parameters

    @@ -1377,7 +1377,7 @@

    getAllAddresses

  • Returns Promise<any>

    @@ -1395,7 +1395,7 @@

    getEthAccount

  • Parameters

    @@ -1419,7 +1419,7 @@

    getEthAccountByEosAccount

  • Parameters

    @@ -1442,7 +1442,7 @@

    getNonce

  • Parameters

    @@ -1466,7 +1466,7 @@

    getStorageAt

  • Parameters

    @@ -1493,7 +1493,7 @@

    getTable

  • Parameters

    @@ -1517,7 +1517,7 @@

    raw

  • Parameters

    @@ -1552,7 +1552,7 @@

    setupEvmContract

  • Parameters

    @@ -1575,7 +1575,7 @@

    transact

  • Parameters

    @@ -1599,7 +1599,7 @@

    withdraw

  • Parameters

    diff --git a/eos-evm-js/docs/classes/eosevmapi.html b/eos-evm-js/docs/classes/eosevmapi.html index 8b53d5f..258165c 100644 --- a/eos-evm-js/docs/classes/eosevmapi.html +++ b/eos-evm-js/docs/classes/eosevmapi.html @@ -1095,7 +1095,7 @@

    constructor

  • Parameters

    @@ -1137,7 +1137,7 @@

    abi

    abi: any
    @@ -1147,7 +1147,7 @@

    chainConfig

    chainConfig: any
    @@ -1157,7 +1157,7 @@

    chainId

    chainId: any
    @@ -1167,7 +1167,7 @@

    eos

    eos: EosApi
    @@ -1177,7 +1177,7 @@

    eth

    eth: any
    @@ -1187,7 +1187,7 @@

    ethContract

    ethContract: string | undefined
    @@ -1197,7 +1197,7 @@

    ethPrivateKeys

    ethPrivateKeys: any
    @@ -1214,7 +1214,7 @@

    createEthTx

  • Parameters

    @@ -1258,7 +1258,7 @@

    loadContractFromAbi

  • Parameters

    @@ -1292,7 +1292,7 @@

    setEthereumContract

  • Parameters

    @@ -1315,7 +1315,7 @@

    transfer

  • Parameters

    diff --git a/eos-evm-js/docs/globals.html b/eos-evm-js/docs/globals.html index 30361e1..498f070 100644 --- a/eos-evm-js/docs/globals.html +++ b/eos-evm-js/docs/globals.html @@ -1644,7 +1644,7 @@

    Const BN

    BN: any = require('bn.js')
    @@ -1654,7 +1654,7 @@

    Const DEFAULT_CHAIN_ID<
    DEFAULT_CHAIN_ID: 1 = 1
    @@ -1664,7 +1664,7 @@

    Const DEFAULT_GAS_LIMIT
    DEFAULT_GAS_LIMIT: "0x1E8480" = "0x1E8480"
    @@ -1674,7 +1674,7 @@

    Const DEFAULT_GAS_PRICE
    DEFAULT_GAS_PRICE: "0x01" = "0x01"
    @@ -1684,7 +1684,7 @@

    Const DEFAULT_SYMBOL

    DEFAULT_SYMBOL: "EOS" = "EOS"
    @@ -1694,7 +1694,7 @@

    Const DEFAULT_VALUE

    DEFAULT_VALUE: "0x0" = "0x0"
    @@ -1704,7 +1704,7 @@

    Const EOSIO_SYSTEM

    EOSIO_SYSTEM: "eosio" = "eosio"
    @@ -1714,7 +1714,7 @@

    Const EOSIO_TOKEN

    EOSIO_TOKEN: "eosio.token" = "eosio.token"
    @@ -1724,7 +1724,7 @@

    Const EOSIO_TOKEN_PRECI
    EOSIO_TOKEN_PRECISION: 4 = 4
    @@ -1734,7 +1734,7 @@

    Const EOS_TO_WEI_C
    EOS_TO_WEI_CONVERSION: 18 = 18
    @@ -1744,7 +1744,7 @@

    Const ETH_CHAIN

    ETH_CHAIN: "mainnet" = "mainnet"
    @@ -1754,7 +1754,7 @@

    Const FORK

    FORK: "istanbul" = "istanbul"
    @@ -1764,7 +1764,7 @@

    Const abiEncoder

    abiEncoder: any = require('ethereumjs-abi')
    @@ -1774,7 +1774,7 @@

    Const compiledContract

    compiledContract: any = solc.compile(JSON.stringify(contractInput), { import: findImports })
    @@ -1784,7 +1784,7 @@

    Const fs

    fs: any = require('fs')
    @@ -1794,7 +1794,7 @@

    Const path

    path: any = require('path')
    @@ -1804,7 +1804,7 @@

    Const solc

    solc: any = require('solc')
    @@ -1821,7 +1821,7 @@

    Const findImports

  • Parameters

    @@ -1849,7 +1849,7 @@

    getDeployableFilesFromDir

  • Parameters

    @@ -1880,7 +1880,7 @@

    Const transformEthAccou
  • Parameters

    @@ -1902,7 +1902,7 @@

    Const ENDPOINTS

    ENDPOINTS: object
    @@ -1911,7 +1911,7 @@

    jungle

    jungle: string[] = ['https://api.jungle.alohaeos.com']
    @@ -1921,7 +1921,7 @@

    local

    local: string[] = ['http://0.0.0.0:8888']
    @@ -1932,7 +1932,7 @@

    Const chainIds

    chainIds: object
    @@ -1941,7 +1941,7 @@

    jungle

    jungle: string = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473"
    @@ -1951,7 +1951,7 @@

    kylin

    kylin: string = "5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191"
    @@ -1961,7 +1961,7 @@

    local

    local: string = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"
    @@ -1971,7 +1971,7 @@

    mainnet

    mainnet: string = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
    @@ -1982,7 +1982,7 @@

    Const contractInput

    contractInput: object
    @@ -1991,7 +1991,7 @@

    language

    language: string = "Solidity"
    @@ -2001,7 +2001,7 @@

    settings

    settings: object
    @@ -2010,7 +2010,7 @@

    evmVersion

    evmVersion: string = "istanbul"
    @@ -2020,7 +2020,7 @@

    optimizer

    optimizer: object
    @@ -2029,7 +2029,7 @@

    enabled

    enabled: boolean = true
    @@ -2039,7 +2039,7 @@

    runs

    runs: number = 300
    @@ -2050,7 +2050,7 @@

    outputSelection

    outputSelection: object
    @@ -2059,7 +2059,7 @@

    *

    *: object
    @@ -2068,7 +2068,7 @@

    *

    *: string[] = ['abi', 'evm.bytecode']
    @@ -2081,7 +2081,7 @@

    sources

    sources: object
    @@ -2090,7 +2090,7 @@

    ERC20

    ERC20: object
    @@ -2099,7 +2099,7 @@

    content

    content: any = fs.readFileSync(path.join(__dirname, 'ERC20.sol'), 'utf8')
    @@ -2110,7 +2110,7 @@

    ERC721

    ERC721: object
    @@ -2119,7 +2119,7 @@

    content

    content: any = fs.readFileSync(path.join(__dirname, 'ERC721.sol'), 'utf8')
    diff --git a/eos-evm-js/docs/index.html b/eos-evm-js/docs/index.html index bc7c822..fea82d6 100644 --- a/eos-evm-js/docs/index.html +++ b/eos-evm-js/docs/index.html @@ -1645,7 +1645,7 @@

    Const BN

    BN: any = require('bn.js')
    @@ -1655,7 +1655,7 @@

    Const DEFAULT_CHAIN_ID<
    DEFAULT_CHAIN_ID: 1 = 1

    @@ -1665,7 +1665,7 @@

    Const DEFAULT_GAS_LIMIT
    DEFAULT_GAS_LIMIT: "0x1E8480" = "0x1E8480"
    @@ -1675,7 +1675,7 @@

    Const DEFAULT_GAS_PRICE
    DEFAULT_GAS_PRICE: "0x01" = "0x01"
    @@ -1685,7 +1685,7 @@

    Const DEFAULT_SYMBOL

    DEFAULT_SYMBOL: "EOS" = "EOS"
    @@ -1695,7 +1695,7 @@

    Const DEFAULT_VALUE

    DEFAULT_VALUE: "0x0" = "0x0"
    @@ -1705,7 +1705,7 @@

    Const EOSIO_SYSTEM

    EOSIO_SYSTEM: "eosio" = "eosio"
    @@ -1715,7 +1715,7 @@

    Const EOSIO_TOKEN

    EOSIO_TOKEN: "eosio.token" = "eosio.token"
    @@ -1725,7 +1725,7 @@

    Const EOSIO_TOKEN_PRECI
    EOSIO_TOKEN_PRECISION: 4 = 4
    @@ -1735,7 +1735,7 @@

    Const EOS_TO_WEI_C
    EOS_TO_WEI_CONVERSION: 18 = 18
    @@ -1745,7 +1745,7 @@

    Const ETH_CHAIN

    ETH_CHAIN: "mainnet" = "mainnet"
    @@ -1755,7 +1755,7 @@

    Const FORK

    FORK: "istanbul" = "istanbul"
    @@ -1765,7 +1765,7 @@

    Const abiEncoder

    abiEncoder: any = require('ethereumjs-abi')
    @@ -1775,7 +1775,7 @@

    Const compiledContract

    compiledContract: any = solc.compile(JSON.stringify(contractInput), { import: findImports })
    @@ -1785,7 +1785,7 @@

    Const fs

    fs: any = require('fs')
    @@ -1795,7 +1795,7 @@

    Const path

    path: any = require('path')
    @@ -1805,7 +1805,7 @@

    Const solc

    solc: any = require('solc')
    @@ -1822,7 +1822,7 @@

    Const findImports

  • Parameters

    @@ -1850,7 +1850,7 @@

    getDeployableFilesFromDir

  • Parameters

    @@ -1881,7 +1881,7 @@

    Const transformEthAccou
  • Parameters

    @@ -1903,7 +1903,7 @@

    Const ENDPOINTS

    ENDPOINTS: object
    @@ -1912,7 +1912,7 @@

    jungle

    jungle: string[] = ['https://api.jungle.alohaeos.com']
    @@ -1922,7 +1922,7 @@

    local

    local: string[] = ['http://0.0.0.0:8888']
    @@ -1933,7 +1933,7 @@

    Const chainIds

    chainIds: object
    @@ -1942,7 +1942,7 @@

    jungle

    jungle: string = "e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473"
    @@ -1952,7 +1952,7 @@

    kylin

    kylin: string = "5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191"
    @@ -1962,7 +1962,7 @@

    local

    local: string = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"
    @@ -1972,7 +1972,7 @@

    mainnet

    mainnet: string = "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
    @@ -1983,7 +1983,7 @@

    Const contractInput

    contractInput: object
    @@ -1992,7 +1992,7 @@

    language

    language: string = "Solidity"
    @@ -2002,7 +2002,7 @@

    settings

    settings: object
    @@ -2011,7 +2011,7 @@

    evmVersion

    evmVersion: string = "istanbul"
    @@ -2021,7 +2021,7 @@

    optimizer

    optimizer: object
    @@ -2030,7 +2030,7 @@

    enabled

    enabled: boolean = true
    @@ -2040,7 +2040,7 @@

    runs

    runs: number = 300
    @@ -2051,7 +2051,7 @@

    outputSelection

    outputSelection: object
    @@ -2060,7 +2060,7 @@

    *

    *: object
    @@ -2069,7 +2069,7 @@

    *

    *: string[] = ['abi', 'evm.bytecode']
    @@ -2082,7 +2082,7 @@

    sources

    sources: object
    @@ -2091,7 +2091,7 @@

    ERC20

    ERC20: object
    @@ -2100,7 +2100,7 @@

    content

    content: any = fs.readFileSync(path.join(__dirname, 'ERC20.sol'), 'utf8')
    @@ -2111,7 +2111,7 @@

    ERC721

    ERC721: object
    @@ -2120,7 +2120,7 @@

    content

    content: any = fs.readFileSync(path.join(__dirname, 'ERC721.sol'), 'utf8')
    diff --git a/eos-evm-js/docs/interfaces/account.html b/eos-evm-js/docs/interfaces/account.html index e1897f2..9e5fc93 100644 --- a/eos-evm-js/docs/interfaces/account.html +++ b/eos-evm-js/docs/interfaces/account.html @@ -1057,7 +1057,7 @@

    account

    account: string
    @@ -1067,7 +1067,7 @@

    address

    address: string
    @@ -1077,7 +1077,7 @@

    balance

    balance: BN
    @@ -1087,7 +1087,7 @@

    code

    code: string | Buffer
    @@ -1097,7 +1097,7 @@

    index

    index: number
    @@ -1107,7 +1107,7 @@

    nonce

    nonce: number
    diff --git a/eos-evm-js/docs/interfaces/accountstate.html b/eos-evm-js/docs/interfaces/accountstate.html index 8ba345b..4fcd45f 100644 --- a/eos-evm-js/docs/interfaces/accountstate.html +++ b/eos-evm-js/docs/interfaces/accountstate.html @@ -1045,7 +1045,7 @@

    index

    index: number
    @@ -1055,7 +1055,7 @@

    key

    key: string
    @@ -1065,7 +1065,7 @@

    value

    value: string
    diff --git a/eos-evm-js/docs/interfaces/evmreceipt.html b/eos-evm-js/docs/interfaces/evmreceipt.html index a72af22..d079272 100644 --- a/eos-evm-js/docs/interfaces/evmreceipt.html +++ b/eos-evm-js/docs/interfaces/evmreceipt.html @@ -1097,7 +1097,7 @@

    createdAddress

    createdAddress: string
    @@ -1107,7 +1107,7 @@

    errors

    errors: string[]
    @@ -1117,7 +1117,7 @@

    from

    from: string
    @@ -1127,7 +1127,7 @@

    gasLimit

    gasLimit: number
    @@ -1137,7 +1137,7 @@

    gasPrice

    gasPrice: number
    @@ -1147,7 +1147,7 @@

    gasUsed

    gasUsed: number
    @@ -1157,7 +1157,7 @@

    logs

    logs: Log[]
    @@ -1167,7 +1167,7 @@

    nonce

    nonce: number
    @@ -1177,7 +1177,7 @@

    output

    output: string
    @@ -1187,7 +1187,7 @@

    r

    r: string
    @@ -1197,7 +1197,7 @@

    s

    s: string
    @@ -1207,7 +1207,7 @@

    status

    status: string
    @@ -1217,7 +1217,7 @@

    to

    to: string
    @@ -1227,7 +1227,7 @@

    transactionHash

    transactionHash: string
    @@ -1237,7 +1237,7 @@

    v

    v: number
    @@ -1247,7 +1247,7 @@

    value

    value: number
    diff --git a/eos-evm-js/docs/interfaces/evmresponse.html b/eos-evm-js/docs/interfaces/evmresponse.html index 9f71b09..7d1b946 100644 --- a/eos-evm-js/docs/interfaces/evmresponse.html +++ b/eos-evm-js/docs/interfaces/evmresponse.html @@ -1041,7 +1041,7 @@

    eos

    eos: any
    @@ -1051,7 +1051,7 @@

    eth

    diff --git a/eos-evm-js/docs/interfaces/log.html b/eos-evm-js/docs/interfaces/log.html index b33b227..a622b64 100644 --- a/eos-evm-js/docs/interfaces/log.html +++ b/eos-evm-js/docs/interfaces/log.html @@ -1045,7 +1045,7 @@

    address

    address: string
    @@ -1055,7 +1055,7 @@

    data

    data: string
    @@ -1065,7 +1065,7 @@

    topics

    topics: string[]
    diff --git a/eos-evm-js/package.json b/eos-evm-js/package.json index 2f6de75..74c2efa 100644 --- a/eos-evm-js/package.json +++ b/eos-evm-js/package.json @@ -1,6 +1,6 @@ { "name": "eos-evm-js", - "version": "0.2.31", + "version": "0.2.32", "description": "EOSIO EVM JS SDK", "keywords": [], "main": "dist/eos-evm-js.umd.js", diff --git a/eos-evm-js/src/eos-contracts/eosio.evm.wasm b/eos-evm-js/src/eos-contracts/eosio.evm.wasm index 8eb6a60..e67b85c 100755 Binary files a/eos-evm-js/src/eos-contracts/eosio.evm.wasm and b/eos-evm-js/src/eos-contracts/eosio.evm.wasm differ diff --git a/eosio.evm/README.md b/eosio.evm/README.md index 31d498c..c600000 100755 --- a/eosio.evm/README.md +++ b/eosio.evm/README.md @@ -12,7 +12,7 @@ Please note that setting the JS-SDK will not currently work if OPTRACE or PRINT_ - The balance value is printed in explorers, etc as a big-endian hex value with a precision of 10^18, as specified in Ethereum yellow paper. Therefore, 1 EOS is represented as 1000000000000000000, which is de0b6b3a7640000 in big-endian hex. ### Precompile support -eosio.evm supports 9 precompiles +eosio.evm supports all 9 precompiles 1. ec_recover 2. sha256 3. ripemd160 @@ -23,6 +23,22 @@ eosio.evm supports 9 precompiles 8. bn_pairing 9. blake2b +## Constants +All constants are found at [constants.hpp](eosio.evm/include/eosio.evm/constants.hpp) + +1. **TESTING** - adds functionality for executing tests, and resetting the contract; default true, remove in production +2. **BN_CURVE** - adds bnadd, bnmul, and bnpair precompiles; default false +3. **CHARGE_SENDER_FOR_GAS** - toggle charging sender for gas; default false, required for ethereum tests +4. **PRINT_LOGS** - prints logs as part of execution receipt; default false +5. **OPTRACE** - prints the opcode trace for the execution; default false +6. **PRINT_STATE** - prints the state when saved or loaded from tables; default false +7. **TOKEN_SYMBOL_CODE_RAW** - the symbol of the core token on-chain; default "EOS" +8. **TOKEN_CONTRACT_RAW** - the contract of the core token on-chain; default "eosio.token" +9. **TOKEN_PRECISION** - the precision of the core symbol on-chain; default 4 + +**NOTE:** [TESTING, CHARGE_SENDER_FOR_GAS] must be enabled, and [OPTRACE, PRINT_LOGS] must be disabled for ethereum/tests testing to pass successfuly. + +**NOTE:** If ec_add, ec_mul and ec_pairing precompiles are required, set BN_CURVE to true (will increase WASM size by 210KB, or ~2MB onchain). ### Contract Public Actions ```c++ diff --git a/eosio.evm/eosio.evm.wasm b/eosio.evm/eosio.evm.wasm index 99feada..e67b85c 100755 Binary files a/eosio.evm/eosio.evm.wasm and b/eosio.evm/eosio.evm.wasm differ diff --git a/eosio.evm/include/eosio.evm/constants.hpp b/eosio.evm/include/eosio.evm/constants.hpp index 2ba8891..aa84836 100644 --- a/eosio.evm/include/eosio.evm/constants.hpp +++ b/eosio.evm/include/eosio.evm/constants.hpp @@ -8,7 +8,7 @@ #define TESTING true // Adds bnadd, bnmul, and bnpair precompiles and mini-gmp -#define BN_CURVE true +#define BN_CURVE false // Only turn this on when doing ethereum/tests (otherwise balances won't match) #define CHARGE_SENDER_FOR_GAS false diff --git a/evm-mock-rpc/package-lock.json b/evm-mock-rpc/package-lock.json index 8d773ff..69b76cb 100644 --- a/evm-mock-rpc/package-lock.json +++ b/evm-mock-rpc/package-lock.json @@ -299,8 +299,8 @@ "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" }, "eos-evm-js": { - "version": "0.2.31", - "resolved": "https://registry.npmjs.org/eos-evm-js/-/eos-evm-js-0.2.31.tgz", + "version": "0.2.32", + "resolved": "https://registry.npmjs.org/eos-evm-js/-/eos-evm-js-0.2.32.tgz", "integrity": "sha512-/jBDoMqrvkL4DUmAz29yKL5pYleaReHoNdmy/ZNc9/SejDOReCJDTgAa2V4cT8Bz9UwFm5HJMG40FMEp7b+7pA==", "requires": { "@jafri/eosjs2": "^21.0.0-rc.14", diff --git a/evm-mock-rpc/package.json b/evm-mock-rpc/package.json index a0c3888..67cd0e7 100644 --- a/evm-mock-rpc/package.json +++ b/evm-mock-rpc/package.json @@ -14,7 +14,7 @@ "bn.js": "^4.11.8", "body-parser": "^1.19.0", "cors": "^2.8.5", - "eos-evm-js": "^0.2.31", + "eos-evm-js": "^0.2.32", "ethereumjs-abi": "^0.6.8", "ethereumjs-util": "^6.2.0", "express": "^4.17.1"