diff --git a/.circleci/config.yml b/.circleci/config.yml index 988b8940ea..4c24890cab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,10 +35,10 @@ jobs: key: v1-deps-{{ checksum "yarn.lock" }} paths: - node_modules - - run: yarn run downloadsolc_assets + - run: yarn run downloadsolc_assets - run: npx nx build remix-ide - run: npx nx build remix-ide-e2e-src-local-plugin - + - run: yarn run build:libs - run: mkdir persist && zip -r persist/dist.zip dist - persist_to_workspace: @@ -266,6 +266,50 @@ jobs: path: ./reports/tests - store_artifacts: path: ./reports/screenshots + + remix-ide-vyper-plugin: + docker: + # specify the version you desire here + - image: cimg/node:14.17.6-browsers + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + resource_class: xlarge + # - image: circleci/mongo:3.4.4 + environment: + - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org" + - COMMIT_AUTHOR: "Circle CI" + working_directory: ~/remix-project + parallelism: 10 + steps: + - browser-tools/install-chrome + - browser-tools/install-chromedriver + - run: + command: | + google-chrome --version + chromedriver --version + java -jar /usr/local/bin/selenium.jar --version + name: Check install + - checkout + - checkout + - attach_workspace: + at: . + - run: unzip ./persist/dist.zip + - restore_cache: + keys: + - v1-deps-{{ checksum "yarn.lock" }} + - run: yarn install + - run: + name: Start Selenium + command: java -jar /usr/local/bin/selenium.jar + background: true + - run: npx nx build vyper + - run: ./apps/remix-ide/ci/browser_tests_vyper_plugin.sh + - store_test_results: + path: ./reports/tests + - store_artifacts: + path: ./reports/screenshots remix-ide-plugin-api: docker: @@ -420,6 +464,9 @@ workflows: - remix-ide-plugin-api: requires: - build + - remix-ide-vyper-plugin: + requires: + - build - remix-ide-chrome: requires: - build @@ -433,6 +480,7 @@ workflows: - remix-ide-chrome - remix-ide-firefox - remix-ide-plugin-api + - remix-ide-vyper-plugin filters: branches: only: remix_live @@ -443,6 +491,7 @@ workflows: - remix-ide-chrome - remix-ide-firefox - remix-ide-plugin-api + - remix-ide-vyper-plugin filters: branches: only: master @@ -453,6 +502,7 @@ workflows: - remix-ide-chrome - remix-ide-firefox - remix-ide-plugin-api + - remix-ide-vyper-plugin filters: branches: only: remix_beta diff --git a/README.md b/README.md index 84cc44a09b..8692c7c4ba 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ To do this you need to: browser.waitForElementPresent('*[data-id="verticalIconsKindfilePanel"]') ``` -- add '@disable': true to the test file you want to split: +- add '@disabled': true to the test file you want to split: ``` module.exports = { diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index 8b56b54b5a..8bc3ab8eda 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -2,13 +2,28 @@ import { NightwatchBrowser } from 'nightwatch' require('dotenv').config() -export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true): void { +type LoadPlugin = { + name: string + url: string +} + +export default function (browser: NightwatchBrowser, callback: VoidFunction, url?: string, preloadPlugins = true, loadPlugin?: LoadPlugin): void { browser .url(url || 'http://127.0.0.1:8080') .pause(6000) .switchBrowserTab(0) .waitForElementVisible('[id="remixTourSkipbtn"]') .click('[id="remixTourSkipbtn"]') + .perform((done) => { + if (!loadPlugin) return done() + browser.execute(function (loadPlugin) { // override a plugin url for testing purpose + localStorage.setItem('test-plugin-name', loadPlugin.name) + localStorage.setItem('test-plugin-url', loadPlugin.url) + }, [loadPlugin]) + .refresh() + .pause(6000) + .perform(done) + }) .maximizeWindow() .fullscreenWindow(() => { if (preloadPlugins) { diff --git a/apps/remix-ide-e2e/src/tests/ballot.test.ts b/apps/remix-ide-e2e/src/tests/ballot.test.ts index 1c8383f047..fc090988e1 100644 --- a/apps/remix-ide-e2e/src/tests/ballot.test.ts +++ b/apps/remix-ide-e2e/src/tests/ballot.test.ts @@ -134,6 +134,23 @@ module.exports = { .sendKeys('*[data-id$="scConfigFilePathInput"]', browser.Keys.ENTER) .openFile('Untitled.sol') .verifyContracts(['Ballot'], {wait: 2000, runs: '300'}) + }, + + 'Compile and deploy sample yul file': function (browser: NightwatchBrowser) { + browser + .addFile('sample.yul', {content: yulSample}) + .clickLaunchIcon('solidity') + .waitForElementVisible('*[data-id="scConfigExpander"]') + .click('*[data-id="scManualConfiguration"]') + .waitForElementVisible('select[id="compilierLanguageSelector"]', 10000) + .click('select[id="compilierLanguageSelector"]') + .click('select[id="compilierLanguageSelector"] option[value=Yul]') + .waitForElementContainsText('[data-id="compiledContracts"]', 'Contract', 60000) + .clickLaunchIcon('udapp') + .click('*[data-id="Deploy - transact (not payable)"]') + .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]', 60000) + .journalLastChildIncludes('Contract.(constructor)') + .journalLastChildIncludes('data: 0x602...0565b') .end() } } @@ -387,4 +404,19 @@ const configFile = ` "evmVersion": "byzantium" } } +` + +const yulSample = ` +object "Contract" { + code { + function power(base, exponent) -> result + { + result := 1 + for { let i := 0 } lt(i, exponent) { i := add(i, 1) } + { + result := mul(result, base) + } + } + } +} ` \ No newline at end of file diff --git a/apps/remix-ide-e2e/src/tests/search.test.ts b/apps/remix-ide-e2e/src/tests/search.test.ts index 9791bae4c5..c8f90c5978 100644 --- a/apps/remix-ide-e2e/src/tests/search.test.ts +++ b/apps/remix-ide-e2e/src/tests/search.test.ts @@ -4,10 +4,11 @@ import { NightwatchBrowser } from 'nightwatch' import init from '../helpers/init' module.exports = { + '@disabled': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { init(browser, done, 'http://127.0.0.1:8080', true) }, - 'Should find text': function (browser: NightwatchBrowser) { + 'Should find text #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .click('*[plugin="search"]').waitForElementVisible('*[id="search_input"]') .waitForElementVisible('*[id="search_include"]') @@ -26,7 +27,7 @@ module.exports = { Array.isArray(res.value) && browser.assert.equal(res.value.length, 6) }) }, - 'Should find text with exclude': function (browser: NightwatchBrowser) { + 'Should find text with exclude #group1': function (browser: NightwatchBrowser) { browser .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', 'contract').pause(1000) @@ -42,7 +43,7 @@ module.exports = { .clearValue('*[id="search_include"]').setValue('*[id="search_include"]', '*.sol, *.js, *.txt') .clearValue('*[id="search_exclude"]').setValue('*[id="search_exclude"]', '.*/**/*') }, - 'Should find regex': function (browser: NightwatchBrowser) { + 'Should find regex #group1': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[id="search_input"]') .clearValue('*[id="search_input"]').pause(2000) @@ -57,7 +58,7 @@ module.exports = { Array.isArray(res.value) && browser.assert.equal(res.value.length, 4) }) }, - 'Should find matchcase': function (browser: NightwatchBrowser) { + 'Should find matchcase #group1': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[data-id="search_use_regex"]').click('*[data-id="search_use_regex"]') .waitForElementVisible('*[data-id="search_case_sensitive"]').click('*[data-id="search_case_sensitive"]').pause(4000) @@ -71,7 +72,7 @@ module.exports = { }) .waitForElementContainsText('*[data-id="search_results"]', 'STORAGE.TEST.JS', 60000) }, - 'Should find matchword': function (browser: NightwatchBrowser) { + 'Should find matchword #group1': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[data-id="search_case_sensitive"]').click('*[data-id="search_case_sensitive"]') .waitForElementVisible('*[data-id="search_whole_word"]').click('*[data-id="search_whole_word"]').pause(2000) @@ -81,7 +82,7 @@ module.exports = { Array.isArray(res.value) && browser.assert.equal(res.value.length, 15) }) }, - 'Should replace text': function (browser: NightwatchBrowser) { + 'Should replace text #group1': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[data-id="toggle_replace"]').click('*[data-id="toggle_replace"]') .waitForElementVisible('*[id="search_replace"]') @@ -95,7 +96,7 @@ module.exports = { browser.assert.ok(content.includes('replacing deployer for a constructor'), 'should replace text ok') }) }, - 'Should replace text without confirmation': function (browser: NightwatchBrowser) { + 'Should replace text without confirmation #group1': function (browser: NightwatchBrowser) { browser.click('*[data-id="confirm_replace_label"]').pause(500) .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', 'replacing').sendKeys('*[id="search_input"]', browser.Keys.ENTER).pause(1000) @@ -108,7 +109,7 @@ module.exports = { browser.assert.ok(content.includes('replacing2 deployer for a constructor'), 'should replace text ok') }) }, - 'Should replace all & undo': function (browser: NightwatchBrowser) { + 'Should replace all & undo #group1': function (browser: NightwatchBrowser) { browser .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', 'storage').sendKeys('*[id="search_input"]', browser.Keys.ENTER) @@ -127,7 +128,7 @@ module.exports = { browser.assert.ok(content.includes('title Storage'), 'should undo text ok') }) }, - 'Should replace all & undo & switch between files': function (browser: NightwatchBrowser) { + 'Should replace all & undo & switch between files #group1': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[id="search_input"]') .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', 'storage').sendKeys('*[id="search_input"]', browser.Keys.ENTER) @@ -163,14 +164,20 @@ module.exports = { browser.assert.ok(content.includes("Storage' contract"), 'should replace text ok') }) }, - 'Should hide button when edited content is the same': function (browser: NightwatchBrowser) { + 'Should hide button when edited content is the same #group2': function (browser: NightwatchBrowser) { browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]') .addFile('test.sol', { content: '123' }) - .click('*[plugin="search"]').waitForElementVisible('*[id="search_input"]') + .click('*[plugin="search"]') + .waitForElementVisible('*[id="search_input"]') + .waitForElementVisible('*[data-id="toggle_replace"]') + .click('*[data-id="toggle_replace"]') .clearValue('*[id="search_input"]') - .setValue('*[id="search_input"]', '123').sendKeys('*[id="search_input"]', browser.Keys.ENTER) + .setValue('*[id="search_input"]', '123') + .sendKeys('*[id="search_input"]', browser.Keys.ENTER) + .waitForElementVisible('*[id="search_replace"]') .clearValue('*[id="search_replace"]') .setValue('*[id="search_replace"]', '456').pause(1000) + .click('*[data-id="confirm_replace_label"]').pause(500) .waitForElementVisible('*[data-id="replace-all-test.sol"]') .click('*[data-id="replace-all-test.sol"]').pause(2000) .getEditorValue((content) => { @@ -181,13 +188,14 @@ module.exports = { .getEditorValue((content) => { browser.assert.ok(content.includes('123'), 'should have text ok') } - ).pause(1000) + ).pause(5000) .waitForElementNotPresent('*[data-id="undo-replace-test.sol"]') }, - 'Should disable/enable button when edited content changed': function (browser: NightwatchBrowser) { + 'Should disable/enable button when edited content changed #group2': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[id="search_input"]') .clearValue('*[id="search_input"]') + .clearValue('*[id="search_input"]') .setValue('*[id="search_input"]', '123').sendKeys('*[id="search_input"]', browser.Keys.ENTER) .clearValue('*[id="search_replace"]') .setValue('*[id="search_replace"]', 'replaced').pause(1000) @@ -201,7 +209,7 @@ module.exports = { .getEditorValue((content) => { browser.assert.ok(content.includes('changed'), 'should have text ok') } - ).pause(1000) + ).pause(5000) .waitForElementVisible('*[data-id="undo-replace-test.sol"]') .getAttribute('[data-id="undo-replace-test.sol"]', 'disabled', (result) => { browser.assert.equal(result.value, 'true', 'should be disabled') @@ -222,7 +230,7 @@ module.exports = { .waitForElementNotPresent('*[data-id="undo-replace-test.sol"]') }, - 'should clear search': function (browser: NightwatchBrowser) { + 'should clear search #group2': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[id="search_input"]') .setValue('*[id="search_input"]', 'nodata').sendKeys('*[id="search_input"]', browser.Keys.ENTER).pause(1000) @@ -230,4 +238,4 @@ module.exports = { Array.isArray(res.value) && browser.assert.equal(res.value.length, 0) }) } -} \ No newline at end of file +} diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 7cc5268933..79305cd22d 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -7,7 +7,6 @@ module.exports = { before: function (browser: NightwatchBrowser, done: VoidFunction) { init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false) }, - 'Should execution a simple console command #group1 #group999': function (browser: NightwatchBrowser) { browser .waitForElementVisible('*[data-id="terminalCli"]', 10000) @@ -164,10 +163,9 @@ module.exports = { 'Should print hardhat logs #group4': function (browser: NightwatchBrowser) { browser .click('*[data-id="terminalClearConsole"]') // clear the terminal - .addFile('printHardhatlog.sol', { content: hardhatLog }) - .clickLaunchIcon('solidity') .waitForElementVisible('[for="autoCompile"]') .click('[for="autoCompile"]') + .clickLaunchIcon('udapp') .testContracts('printHardhatlog.sol', { content: hardhatLog }, ['OwnerTest']) .clickLaunchIcon('udapp') .click('*[data-id="deployAndRunClearInstances"]') diff --git a/apps/remix-ide-e2e/src/tests/url.test.ts b/apps/remix-ide-e2e/src/tests/url.test.ts index 00885338b4..b85b2caa1e 100644 --- a/apps/remix-ide-e2e/src/tests/url.test.ts +++ b/apps/remix-ide-e2e/src/tests/url.test.ts @@ -5,7 +5,39 @@ import init from '../helpers/init' import examples from '../examples/example-contracts' const sources = [ - { 'Untitled.sol': { content: examples.ballot.content } } + { 'Untitled.sol': { content: examples.ballot.content } }, + { + 'myTokenV1.sol': { + content: ` + // SPDX-License-Identifier: MIT + pragma solidity ^0.8.4; + + import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; + import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; + import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; + import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; + + contract MyToken is Initializable, ERC721Upgradeable, OwnableUpgradeable, UUPSUpgradeable { + /// @custom:oz-upgrades-unsafe-allow constructor + constructor() { + _disableInitializers(); + } + + function initialize() initializer public { + __ERC721_init("MyToken", "MTK"); + __Ownable_init(); + __UUPSUpgradeable_init(); + } + + function _authorizeUpgrade(address newImplementation) + internal + onlyOwner + override + {} + } + ` + } + } ] module.exports = { @@ -76,7 +108,58 @@ module.exports = { .openFile('ethereum/remix-project/apps/remix-ide/contracts/app/solidity/mode.sol') }, - 'Should load using URL compiler params': function (browser: NightwatchBrowser) { + 'Should load the code from language & code params': function (browser: NightwatchBrowser) { + browser + .pause(5000) + .url('http://127.0.0.1:8080/#language=yul&version=soljson-v0.8.7+commit.e28d00a7.js&code=Ly8gQSBjb250cmFjdCBjb25zaXN0cyBvZiBhIHNpbmdsZSBvYmplY3Qgd2l0aCBzdWItb2JqZWN0cyByZXByZXNlbnRpbmcKLy8gdGhlIGNvZGUgdG8gYmUgZGVwbG95ZWQgb3Igb3RoZXIgY29udHJhY3RzIGl0IGNhbiBjcmVhdGUuCi8vIFRoZSBzaW5nbGUgImNvZGUiIG5vZGUgaXMgdGhlIGV4ZWN1dGFibGUgY29kZSBvZiB0aGUgb2JqZWN0LgovLyBFdmVyeSAob3RoZXIpIG5hbWVkIG9iamVjdCBvciBkYXRhIHNlY3Rpb24gaXMgc2VyaWFsaXplZCBhbmQKLy8gbWFkZSBhY2Nlc3NpYmxlIHRvIHRoZSBzcGVjaWFsIGJ1aWx0LWluIGZ1bmN0aW9ucyBkYXRhY29weSAvIGRhdGFvZmZzZXQgLyBkYXRhc2l6ZQovLyBUaGUgY3VycmVudCBvYmplY3QsIHN1Yi1vYmplY3RzIGFuZCBkYXRhIGl0ZW1zIGluc2lkZSB0aGUgY3VycmVudCBvYmplY3QKLy8gYXJlIGluIHNjb3BlLgpvYmplY3QgIkNvbnRyYWN0MSIgewogICAgLy8gVGhpcyBpcyB0aGUgY29uc3RydWN0b3IgY29kZSBvZiB0aGUgY29udHJhY3QuCiAgICBjb2RlIHsKICAgICAgICBmdW5jdGlvbiBhbGxvY2F0ZShzaXplKSAtPiBwdHIgewogICAgICAgICAgICBwdHIgOj0gbWxvYWQoMHg0MCkKICAgICAgICAgICAgaWYgaXN6ZXJvKHB0cikgeyBwdHIgOj0gMHg2MCB9CiAgICAgICAgICAgIG1zdG9yZSgweDQwLCBhZGQocHRyLCBzaXplKSkKICAgICAgICB9CgogICAgICAgIC8vIGZpcnN0IGNyZWF0ZSAiQ29udHJhY3QyIgogICAgICAgIGxldCBzaXplIDo9IGRhdGFzaXplKCJDb250cmFjdDIiKQogICAgICAgIGxldCBvZmZzZXQgOj0gYWxsb2NhdGUoc2l6ZSkKICAgICAgICAvLyBUaGlzIHdpbGwgdHVybiBpbnRvIGNvZGVjb3B5IGZvciBFVk0KICAgICAgICBkYXRhY29weShvZmZzZXQsIGRhdGFvZmZzZXQoIkNvbnRyYWN0MiIpLCBzaXplKQogICAgICAgIC8vIGNvbnN0cnVjdG9yIHBhcmFtZXRlciBpcyBhIHNpbmdsZSBudW1iZXIgMHgxMjM0CiAgICAgICAgbXN0b3JlKGFkZChvZmZzZXQsIHNpemUpLCAweDEyMzQpCiAgICAgICAgcG9wKGNyZWF0ZShvZmZzZXQsIGFkZChzaXplLCAzMiksIDApKQoKICAgICAgICAvLyBub3cgcmV0dXJuIHRoZSBydW50aW1lIG9iamVjdCAodGhlIGN1cnJlbnRseQogICAgICAgIC8vIGV4ZWN1dGluZyBjb2RlIGlzIHRoZSBjb25zdHJ1Y3RvciBjb2RlKQogICAgICAgIHNpemUgOj0gZGF0YXNpemUoIkNvbnRyYWN0MV9kZXBsb3llZCIpCiAgICAgICAgb2Zmc2V0IDo9IGFsbG9jYXRlKHNpemUpCiAgICAgICAgLy8gVGhpcyB3aWxsIHR1cm4gaW50byBhIG1lbW9yeS0+bWVtb3J5IGNvcHkgZm9yIEV3YXNtIGFuZAogICAgICAgIC8vIGEgY29kZWNvcHkgZm9yIEVWTQogICAgICAgIGRhdGFjb3B5KG9mZnNldCwgZGF0YW9mZnNldCgiQ29udHJhY3QxX2RlcGxveWVkIiksIHNpemUpCiAgICAgICAgcmV0dXJuKG9mZnNldCwgc2l6ZSkKICAgIH0KCiAgICBkYXRhICJUYWJsZTIiIGhleCI0MTIzIgoKICAgIG9iamVjdCAiQ29udHJhY3QxX2RlcGxveWVkIiB7CiAgICAgICAgY29kZSB7CiAgICAgICAgICAgIGZ1bmN0aW9uIGFsbG9jYXRlKHNpemUpIC0+IHB0ciB7CiAgICAgICAgICAgICAgICBwdHIgOj0gbWxvYWQoMHg0MCkKICAgICAgICAgICAgICAgIGlmIGlzemVybyhwdHIpIHsgcHRyIDo9IDB4NjAgfQogICAgICAgICAgICAgICAgbXN0b3JlKDB4NDAsIGFkZChwdHIsIHNpemUpKQogICAgICAgICAgICB9CgogICAgICAgICAgICAvLyBydW50aW1lIGNvZGUKCiAgICAgICAgICAgIG1zdG9yZSgwLCAiSGVsbG8sIFdvcmxkISIpCiAgICAgICAgICAgIHJldHVybigwLCAweDIwKQogICAgICAgIH0KICAgIH0KCiAgICAvLyBFbWJlZGRlZCBvYmplY3QuIFVzZSBjYXNlIGlzIHRoYXQgdGhlIG91dHNpZGUgaXMgYSBmYWN0b3J5IGNvbnRyYWN0LAogICAgLy8gYW5kIENvbnRyYWN0MiBpcyB0aGUgY29kZSB0byBiZSBjcmVhdGVkIGJ5IHRoZSBmYWN0b3J5CiAgICBvYmplY3QgIkNvbnRyYWN0MiIgewogICAgICAgIGNvZGUgewogICAgICAgICAgICAvLyBjb2RlIGhlcmUgLi4uCiAgICAgICAgfQoKICAgICAgICBvYmplY3QgIkNvbnRyYWN0Ml9kZXBsb3llZCIgewogICAgICAgICAgICBjb2RlIHsKICAgICAgICAgICAgICAgIC8vIGNvZGUgaGVyZSAuLi4KICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgZGF0YSAiVGFibGUxIiBoZXgiNDEyMyIKICAgIH0KfQ&optimize=false&runs=200&evmVersion=null') + .refresh() + .pause(5000) + .clickLaunchIcon('filePanel') + .currentWorkspaceIs('code-sample') + .waitForElementVisible('*[data-id="treeViewLitreeViewItemcontract-eaa022e37e.yul"]', 6000) + .openFile('contract-eaa022e37e.yul') + .getEditorValue((content) => { + browser.assert.ok(content && content.indexOf( + 'object "Contract1" {') !== -1) + }) + }, + + 'Should select deploy with proxy option from URL params': function (browser: NightwatchBrowser) { + browser + .url('http://127.0.0.1:8080/#optimize=false&runs=200&deployProxy=true') + .refresh() + .pause(5000) + .switchWorkspace('default_workspace') + .addFile('myTokenV1.sol', sources[1]['myTokenV1.sol']) + .clickLaunchIcon('solidity') + .pause(2000) + .click('[data-id="compilerContainerCompileBtn"]') + .waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000) + .clickLaunchIcon('udapp') + .click('select.udapp_contractNames') + .click('select.udapp_contractNames option[value=MyToken]') + .waitForElementPresent('[data-id="contractGUIDeployWithProxyLabel"]') + .expect.element('[data-id="contractGUIDeployWithProxy"]').to.be.selected + }, + + 'Should select upgrade with proxy option from URL params': function (browser: NightwatchBrowser) { + browser + .url('http://127.0.0.1:8080/#optimize=false&runs=200&upgradeProxy=true') + .refresh() + .pause(5000) + .openFile('myTokenV1.sol') + .clickLaunchIcon('solidity') + .pause(2000) + .click('[data-id="compilerContainerCompileBtn"]') + .waitForElementPresent('select[id="compiledContracts"] option[value=MyToken]', 60000) + .clickLaunchIcon('udapp') + .click('select.udapp_contractNames') + .click('select.udapp_contractNames option[value=MyToken]') + .waitForElementPresent('[data-id="contractGUIUpgradeImplementationLabel"]') + .expect.element('[data-id="contractGUIUpgradeImplementation"]').to.be.selected + }, + + 'Should load using various URL compiler params': function (browser: NightwatchBrowser) { browser .pause(5000) .url('http://127.0.0.1:8080/#optimize=true&runs=300&autoCompile=true&evmVersion=istanbul&version=soljson-v0.7.4+commit.3f05b770.js&language=Yul') @@ -90,6 +173,16 @@ module.exports = { .verify.elementPresent('#optimize:checked') .verify.elementPresent('#autoCompile:checked') .verify.attributeEquals('#runs', 'value', '300') + .url('http://127.0.0.1:8080/#version=0.8.7') + .refresh() + .pause(5000) + .clickLaunchIcon('solidity') + .assert.containsText('#versionSelector option[data-id="selected"]', '0.8.7+commit.e28d00a7') + .url('http://127.0.0.1:8080/#version=0.8.15+commit.e14f2714') + .refresh() + .pause(5000) + .clickLaunchIcon('solidity') + .assert.containsText('#versionSelector option[data-id="selected"]', '0.8.15+commit.e14f2714') }, 'Should load using compiler from link passed in remix URL': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide-e2e/src/tests/vyper_api.ts b/apps/remix-ide-e2e/src/tests/vyper_api.ts new file mode 100644 index 0000000000..f168372963 --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/vyper_api.ts @@ -0,0 +1,96 @@ +'use strict' +import { NightwatchBrowser } from 'nightwatch' +import init from '../helpers/init' + +declare global { + interface Window { testplugin: { name: string, url: string }; } +} + +module.exports = { + '@disabled': true, + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done, null, true, { name: 'vyper', url: 'http://127.0.0.1:5002'}) + }, + + 'Should connect to vyper plugin #group1': function (browser: NightwatchBrowser) { + browser.clickLaunchIcon('pluginManager') + .scrollAndClick('[data-id="pluginManagerComponentActivateButtonvyper"]') + .clickLaunchIcon('vyper') + .pause(5000) + // @ts-ignore + .frame(0) + }, + + 'Should add the Ballot.vy #group1': function (browser: NightwatchBrowser) { + browser.click('button[data-id="add-ballot"]') + .frameParent() + .openFile('ballot.vy') + }, + + 'Compile ballot.vy should error #group1': function (browser: NightwatchBrowser) { + browser.clickLaunchIcon('vyper') + // @ts-ignore + .frame(0) + .click('[data-id="remote-compiler"]') + .click('[data-id="compile"]') + .assert.containsText('[data-id="error-message"]', 'unexpected indent') + }, + + 'Compile test contract should success #group1': function (browser: NightwatchBrowser) { + let contractAddress + browser + .frameParent() + .addFile('test.vy', { content: testContract }) + .clickLaunchIcon('vyper') + // @ts-ignore + .frame(0) + .click('[data-id="compile"]') + .frameParent() + .clickLaunchIcon('udapp') + .createContract('') + .clickInstance(0) + .clickFunction('totalPokemonCount - call') + .getAddressAtPosition(0, (address) => { + console.log('Vyper contract ' + address) + contractAddress = address + }) + .perform((done) => { + browser.verifyCallReturnValue(contractAddress, ['0:uint256: 0']) + .perform(() => done()) + }) + } +} + +const testContract = ` +# @version >=0.2.4 <0.3.0 + +DNA_DIGITS: constant(uint256) = 16 +DNA_MODULUS: constant(uint256) = 10 ** DNA_DIGITS +# add HP_LIMIT + +struct Pokemon: + name: String[32] + dna: uint256 + HP: uint256 + matches: uint256 + wins: uint256 + +totalPokemonCount: public(uint256) +pokemonList: HashMap[uint256, Pokemon] + +@pure +@internal +def _generateRandomDNA(_name: String[32]) -> uint256: + random: uint256 = convert(keccak256(_name), uint256) + return random % DNA_MODULUS +# modify _createPokemon +@internal +def _createPokemon(_name: String[32], _dna: uint256, _HP: uint256): + self.pokemonList[self.totalPokemonCount] = Pokemon({ + name: _name, + dna: _dna, + HP: _HP, + matches: 0, + wins: 0 + }) + self.totalPokemonCount += 1` \ No newline at end of file diff --git a/apps/remix-ide/ci/browser_tests_vyper_plugin.sh b/apps/remix-ide/ci/browser_tests_vyper_plugin.sh new file mode 100755 index 0000000000..4c82c9f768 --- /dev/null +++ b/apps/remix-ide/ci/browser_tests_vyper_plugin.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}} +echo "$BUILD_ID" +TEST_EXITCODE=0 + +yarn run serve:production & +npx nx serve vyper & + +sleep 5 + +yarn run build:e2e + +TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "vyper_api" | sort | circleci tests split ) +for TESTFILE in $TESTFILES; do + npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js $TESTFILE --env=chrome || TEST_EXITCODE=1 +done + +echo "$TEST_EXITCODE" +if [ "$TEST_EXITCODE" -eq 1 ] +then + exit 1 +fi diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index d9c93fd4f6..9fecce5b50 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -410,6 +410,29 @@ class AppComponent { this.appManager.call(...callDetails).catch(console.error) } } + + if (params.calls) { + const calls = params.calls.split("///"); + + // call all functions in the list, one after the other + for (const call of calls) { + const callDetails = call.split("//"); + if (callDetails.length > 1) { + this.appManager.call( + "notification", + "toast", + `initiating ${callDetails[0]} ...` + ); + + // @todo(remove the timeout when activatePlugin is on 0.3.0) + try { + await this.appManager.call(...callDetails) + } catch (e) { + console.error(e) + } + } + } + } }) .catch(console.error) } diff --git a/apps/remix-ide/src/app/tabs/abstract-provider.tsx b/apps/remix-ide/src/app/tabs/abstract-provider.tsx index 31b1a4e317..ae923bd88b 100644 --- a/apps/remix-ide/src/app/tabs/abstract-provider.tsx +++ b/apps/remix-ide/src/app/tabs/abstract-provider.tsx @@ -101,7 +101,7 @@ export abstract class AbstractProvider extends Plugin { reject('Unable to connect') } }, 2000) - await this.provider.ready + await this.provider.detectNetwork() // this throws if the network cannot be detected this.connected = true } catch (e) { this.switchAway(true) @@ -116,6 +116,7 @@ export abstract class AbstractProvider extends Plugin { } private async switchAway (showError) { + if (!this.provider) return this.provider = null this.blocked = true this.connected = false diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 332b119542..1bebbc7083 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -146,9 +146,11 @@ export class RemixAppManager extends PluginManager { } } } - return plugins.map(plugin => { + const testPluginName = localStorage.getItem('test-plugin-name') + const testPluginUrl = localStorage.getItem('test-plugin-url') + return plugins.map(plugin => { + if (plugin.name === testPluginName) plugin.url = testPluginUrl return new IframePlugin(plugin) - // return new IframeReactPlugin(plugin) }) } diff --git a/apps/vyper/.babelrc b/apps/vyper/.babelrc new file mode 100644 index 0000000000..b1fc975456 --- /dev/null +++ b/apps/vyper/.babelrc @@ -0,0 +1,13 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", { + "runtime": "automatic" + + } + ] + ], + "plugins": [ + + ] +} diff --git a/apps/vyper/.browserslistrc b/apps/vyper/.browserslistrc new file mode 100644 index 0000000000..f1d12df4fa --- /dev/null +++ b/apps/vyper/.browserslistrc @@ -0,0 +1,16 @@ +# This file is used by: +# 1. autoprefixer to adjust CSS to support the below specified browsers +# 2. babel preset-env to adjust included polyfills +# +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries +# +# If you need to support different browsers in production, you may tweak the list below. + +last 1 Chrome version +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major version +last 2 iOS major versions +Firefox ESR +not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file diff --git a/apps/vyper/.eslintrc b/apps/vyper/.eslintrc new file mode 100644 index 0000000000..b7d498eea1 --- /dev/null +++ b/apps/vyper/.eslintrc @@ -0,0 +1,18 @@ +{ + "env": { + "browser": true, + "es6": true + }, + "extends": "../../.eslintrc.json", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 11, + "sourceType": "module" + }, + "rules": { + "standard/no-callback-literal": "off" + } +} diff --git a/apps/vyper/src/app/app.css b/apps/vyper/src/app/app.css new file mode 100644 index 0000000000..978406926a --- /dev/null +++ b/apps/vyper/src/app/app.css @@ -0,0 +1,124 @@ +* { + box-sizing: border-box; +} +html, body, #root, main { + height: 100%; + margin: 0; +} + +#vyper-plugin header { + display: flex; + justify-content: space-between; + align-items: center; + height: 50px; + padding: 5px 15px; +} + +#vyper-plugin header a, +#vyper-plugin header .title { + display: flex; + height: 60%; +} + +#vyper-plugin header svg, +#vyper-plugin header img { + width: auto; + height: 100%; +} + +#vyper-plugin section { + display: flex; + flex-direction: column; + align-items: center; + height: calc(100% - 50px); +} + +.btn-group-toggle { + width: 90%; + text-transform: uppercase; + margin: 10px 0; +} + +.btn-group-toggle .btn { + cursor: pointer; + font-size: 0.8rem; +} + +#local-url { + width: 90%; +} + +#compile-btn { + width: 90%; +} + +#compile-btn * { + width: 100%; +} + +#result { + flex: 1; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + padding-top: 10px; + overflow: hidden; +} + +#result.error { + justify-content: flex-start; +} +#result.error svg { + width: 40px; + height: 40px; + margin: 10px; +} + +#result nav { + width: 100%; + flex-wrap: nowrap; + justify-content: space-evenly; +} + + +#result nav a { + padding: 0.5rem 1rem; + font-size: 0.8rem; +} + +#result .tab-content { + flex: 1; + width: 100%; + padding: 15px; + overflow: auto; +} + +#result .tab-pane.active { + height: 100%; + display: flex; + flex-direction: column; + align-items: stretch; +} + +#result .copy { + padding: 5x; + font-size: 0.8rem; + margin: 10px; +} + +#result p { + text-align: center; + width: 100% !important; +} + +#result .react-json-view { + overflow-y: auto; +} + +#result textarea { + border: none; + height: 100%; + width: 100%; +} \ No newline at end of file diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx new file mode 100644 index 0000000000..e11684d409 --- /dev/null +++ b/apps/vyper/src/app/app.tsx @@ -0,0 +1,118 @@ +import React, { useState, useEffect } from 'react' + +import { VyperCompilationOutput, remixClient } from './utils' +import { CompilationResult } from '@remixproject/plugin-api' + +// Components +import CompilerButton from './components/CompilerButton' +import WarnRemote from './components/WarnRemote' +import VyperResult from './components/VyperResult' +import LocalUrlInput from './components/LocalUrl' +import ToggleButtonGroup from 'react-bootstrap/ToggleButtonGroup' +import ToggleButton from 'react-bootstrap/ToggleButton' + +import vyperLogo from './logo.svg' +import './app.css' + +interface AppState { + status: 'idle' | 'inProgress' + environment: 'remote' | 'local' + compilationResult?: CompilationResult + localUrl: string +} + +interface OutputMap { + [fileName: string]: VyperCompilationOutput +} + +const App: React.FC = () => { + const [contract, setContract] = useState() + const [output, setOutput] = useState({}) + const [state, setState] = useState({ + status: 'idle', + environment: 'local', + localUrl: 'http://localhost:8000/compile' + }) + + useEffect(() => { + async function start() { + try { + await remixClient.loaded() + remixClient.onFileChange(name => setContract(name)) + const name = await remixClient.getContractName() + setContract(name) + } catch (err) { + console.log(err) + } + } + start() + }, []) + + /** Update the environment state value */ + function setEnvironment(environment: 'local' | 'remote') { + setState({ ...state, environment }) + } + + function setLocalUrl(url: string) { + setState({ ...state, localUrl: url }) + } + + function compilerUrl() { + return state.environment === 'remote' + ? 'https://vyper.live/compile' + : state.localUrl + } + + return ( +
+
+
+ Vyper logo +

yper Compiler

+
+ + + +
+
+ + + Remote Compiler + + + Local Compiler + + + + +
+ + setOutput({ ...output, [name]: update }) + } + /> +
+
+ +
+
+
+ ) +} + +export default App diff --git a/apps/vyper/src/app/components/CompilerButton.tsx b/apps/vyper/src/app/components/CompilerButton.tsx new file mode 100644 index 0000000000..fb0fb6ff05 --- /dev/null +++ b/apps/vyper/src/app/components/CompilerButton.tsx @@ -0,0 +1,75 @@ +import React from 'react' +import { + isVyper, + compile, + toStandardOutput, + VyperCompilationOutput, + isCompilationError, + remixClient +} from '../utils' +import Button from 'react-bootstrap/Button' + +interface Props { + compilerUrl: string + contract?: string, + setOutput: (name: string, output: VyperCompilationOutput) => void +} + +function CompilerButton({ contract, setOutput, compilerUrl }: Props) { + + if (!contract || !contract) { + return + } + + if (!isVyper(contract)) { + return + } + + /** Compile a Contract */ + async function compileContract() { + try { + const _contract = await remixClient.getContract() + remixClient.changeStatus({ + key: 'loading', + type: 'info', + title: 'Compiling' + }) + const output = await compile(compilerUrl, _contract) + setOutput(_contract.name, output) + // ERROR + if (isCompilationError(output)) { + const line = output.line + const lineColumnPos = { + start: { line: line - 1 }, + end: { line: line - 1 } + } + remixClient.highlight(lineColumnPos as any, _contract.name, '#e0b4b4') + throw new Error(output.message) + } + // SUCCESS + remixClient.discardHighlight() + remixClient.changeStatus({ + key: 'succeed', + type: 'success', + title: 'succeed' + }) + const data = toStandardOutput(_contract.name, output) + remixClient.compilationFinish(_contract.name, _contract.content, data) + } catch (err: any) { + remixClient.changeStatus({ + key: 'failed', + type: 'error', + title: err.message + }) + console.error(err) + } + } + + return ( + + ) +} + +export default CompilerButton diff --git a/apps/vyper/src/app/components/LocalUrl.tsx b/apps/vyper/src/app/components/LocalUrl.tsx new file mode 100644 index 0000000000..3659b4094e --- /dev/null +++ b/apps/vyper/src/app/components/LocalUrl.tsx @@ -0,0 +1,36 @@ +import React from 'react' +import Form from 'react-bootstrap/Form' + +interface Props { + url: string + setUrl: (url: string) => void, + environment: 'remote' | 'local' +} + +function LocalUrlInput({ url, setUrl, environment }: Props) { + + if (environment === 'remote') { + return <> + } + + function updateUrl(event: React.FocusEvent) { + setUrl(event.target.value) + } + + return ( +
+ + Local Compiler Url + + + The url to your local compiler + + +
+ ) +} + +export default LocalUrlInput; \ No newline at end of file diff --git a/apps/vyper/src/app/components/VyperResult.tsx b/apps/vyper/src/app/components/VyperResult.tsx new file mode 100644 index 0000000000..f550d17370 --- /dev/null +++ b/apps/vyper/src/app/components/VyperResult.tsx @@ -0,0 +1,70 @@ +import React, { useState } from 'react'; +import { + VyperCompilationResult, + VyperCompilationOutput, + isCompilationError, + remixClient +} from '../utils'; +import Tabs from 'react-bootstrap/Tabs' +import Tab from 'react-bootstrap/Tab' +import { Ballot } from '../examples/ballot'; +import Button from 'react-bootstrap/Button'; +import JSONTree from 'react-json-view' +import { CopyToClipboard } from '@remix-ui/clipboard' + + +interface VyperResultProps { + output?: VyperCompilationOutput; +} + +function VyperResult({ output }: VyperResultProps) { + const [ active, setActive ] = useState('abi'); + + if (!output) return ( +
+

No contract compiled yet.

+ +
+ ) + + if (isCompilationError(output)) { + return ( +
+ +

{output.message}

+
) + } + + return ( + setActive(key)}> + + JSON.stringify(output.abi)}> + + + + + + output.bytecode}> + + + + + + output.bytecode_runtime}> + + + + + + output.ir}> + + + + + + ); +} + +export default VyperResult; \ No newline at end of file diff --git a/apps/vyper/src/app/components/WarnRemote.tsx b/apps/vyper/src/app/components/WarnRemote.tsx new file mode 100644 index 0000000000..3ece01895b --- /dev/null +++ b/apps/vyper/src/app/components/WarnRemote.tsx @@ -0,0 +1,19 @@ +import React from 'react' + +interface Props { + environment: 'remote' | 'local' +} + +function WarnRemoteLabel({ environment }: Props) { + + if (environment === 'local') { + return <> + } + + return ( +
It is really important to not use the remote compiler for production environment. + Please only use it for testing purpose and prefer to using a local compiler for production like environment.
+ ) +} + +export default WarnRemoteLabel; \ No newline at end of file diff --git a/apps/vyper/src/app/examples/ballot.tsx b/apps/vyper/src/app/examples/ballot.tsx new file mode 100644 index 0000000000..4b368c6fda --- /dev/null +++ b/apps/vyper/src/app/examples/ballot.tsx @@ -0,0 +1,161 @@ +export const Ballot = { + name: 'browser/ballot.vy', + content: `# Voting with delegation. + + # Information about voters + struct Voter: + # weight is accumulated by delegation + weight: int128 + # if true, that person already voted (which includes voting by delegating) + voted: bool + # person delegated to + delegate: address + # index of the voted proposal, which is not meaningful unless 'voted' is True. + vote: int128 + + # Users can create proposals + struct Proposal: + # short name (up to 32 bytes) + name: bytes32 + # number of accumulated votes + voteCount: int128 + + voters: public(map(address, Voter)) + proposals: public(map(int128, Proposal)) + voterCount: public(int128) + chairperson: public(address) + int128Proposals: public(int128) + + + @public + @constant + def delegated(addr: address) -> bool: + return self.voters[addr].delegate != ZERO_ADDRESS + + + @public + @constant + def directlyVoted(addr: address) -> bool: + return self.voters[addr].voted and (self.voters[addr].delegate == ZERO_ADDRESS) + + + # Setup global variables + @public + def __init__(_proposalNames: bytes32[2]): + self.chairperson = msg.sender + self.voterCount = 0 + for i in range(2): + self.proposals[i] = Proposal({ + name: _proposalNames[i], + voteCount: 0 + }) + self.int128Proposals += 1 + + # Give a 'voter' the right to vote on this ballot. + # This may only be called by the 'chairperson'. + @public + def giveRightToVote(voter: address): + # Throws if the sender is not the chairperson. + assert msg.sender == self.chairperson + # Throws if the voter has already voted. + assert not self.voters[voter].voted + # Throws if the voter's voting weight isn't 0. + assert self.voters[voter].weight == 0 + self.voters[voter].weight = 1 + self.voterCount += 1 + + # Used by 'delegate' below, and can be called by anyone. + @public + def forwardWeight(delegate_with_weight_to_forward: address): + assert self.delegated(delegate_with_weight_to_forward) + # Throw if there is nothing to do: + assert self.voters[delegate_with_weight_to_forward].weight > 0 + + target: address = self.voters[delegate_with_weight_to_forward].delegate + for i in range(4): + if self.delegated(target): + target = self.voters[target].delegate + # The following effectively detects cycles of length <= 5, + # in which the delegation is given back to the delegator. + # This could be done for any int128ber of loops, + # or even infinitely with a while loop. + # However, cycles aren't actually problematic for correctness; + # they just result in spoiled votes. + # So, in the production version, this should instead be + # the responsibility of the contract's client, and this + # check should be removed. + assert target != delegate_with_weight_to_forward + else: + # Weight will be moved to someone who directly voted or + # hasn't voted. + break + + weight_to_forward: int128 = self.voters[delegate_with_weight_to_forward].weight + self.voters[delegate_with_weight_to_forward].weight = 0 + self.voters[target].weight += weight_to_forward + + if self.directlyVoted(target): + self.proposals[self.voters[target].vote].voteCount += weight_to_forward + self.voters[target].weight = 0 + + # To reiterate: if target is also a delegate, this function will need + # to be called again, similarly to as above. + + # Delegate your vote to the voter 'to'. + @public + def delegate(to: address): + # Throws if the sender has already voted + assert not self.voters[msg.sender].voted + # Throws if the sender tries to delegate their vote to themselves or to + # the default address value of 0x0000000000000000000000000000000000000000 + # (the latter might not be problematic, but I don't want to think about it). + assert to != msg.sender + assert to != ZERO_ADDRESS + + self.voters[msg.sender].voted = True + self.voters[msg.sender].delegate = to + + # This call will throw if and only if this delegation would cause a loop + # of length <= 5 that ends up delegating back to the delegator. + self.forwardWeight(msg.sender) + + # Give your vote (including votes delegated to you) + # to proposal 'proposals[proposal].name'. + @public + def vote(proposal: int128): + # can't vote twice + assert not self.voters[msg.sender].voted + # can only vote on legitimate proposals + assert proposal < self.int128Proposals + + self.voters[msg.sender].vote = proposal + self.voters[msg.sender].voted = True + + # transfer msg.sender's weight to proposal + self.proposals[proposal].voteCount += self.voters[msg.sender].weight + self.voters[msg.sender].weight = 0 + + # Computes the winning proposal taking all + # previous votes into account. + @public + @constant + def winningProposal() -> int128: + winning_vote_count: int128 = 0 + winning_proposal: int128 = 0 + for i in range(2): + if self.proposals[i].voteCount > winning_vote_count: + winning_vote_count = self.proposals[i].voteCount + winning_proposal = i + return winning_proposal + + # Calls winningProposal() function to get the index + # of the winner contained in the proposals array and then + # returns the name of the winner + @public + @constant + def winnerName() -> bytes32: + return self.proposals[self.winningProposal()].name + + ` + } + \ No newline at end of file diff --git a/apps/vyper/src/app/logo.svg b/apps/vyper/src/app/logo.svg new file mode 100644 index 0000000000..78302e19f4 --- /dev/null +++ b/apps/vyper/src/app/logo.svg @@ -0,0 +1,14 @@ + diff --git a/apps/vyper/src/app/star.svg b/apps/vyper/src/app/star.svg new file mode 100644 index 0000000000..901053d385 --- /dev/null +++ b/apps/vyper/src/app/star.svg @@ -0,0 +1,11 @@ + + + + + diff --git a/apps/vyper/src/app/utils/compiler.tsx b/apps/vyper/src/app/utils/compiler.tsx new file mode 100644 index 0000000000..ebc117dba1 --- /dev/null +++ b/apps/vyper/src/app/utils/compiler.tsx @@ -0,0 +1,139 @@ +import { CompilationResult, ABIDescription } from "@remixproject/plugin-api"; + +export interface Contract { + name: string; + content: string; +} + +export interface VyperCompilationResult { + status: 'success', + bytecode: string, + bytecode_runtime: string, + abi: ABIDescription[], + ir: string, + method_identifiers: { + [method: string]: string + } +} + +export interface VyperCompilationError { + status: 'failed' + column: number + line: number + message: string +} + +export type VyperCompilationOutput = VyperCompilationResult | VyperCompilationError + +/** Check if the output is an error */ +export function isCompilationError(output: VyperCompilationOutput): output is VyperCompilationError { + return output.status === 'failed' +} + +/** + * Compile the a contract + * @param url The url of the compiler + * @param contract The name and content of the contract + */ +export async function compile(url: string, contract: Contract): Promise { + if (!contract.name) { + throw new Error('Set your Vyper contract file.') + } + const extension = contract.name.split('.')[1] + if (extension !== 'vy') { + throw new Error('Use extension .vy for Vyper.') + } + const response = await fetch(url, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ code: contract.content }) + }) + + if (response.status === 404) { + throw new Error(`Vyper compiler not found at "${url}".`) + } + /*if (response.status === 400) { + throw new Error(`Vyper compilation failed: ${response.statusText}`) + }*/ + return response.json() +} + +/** + * Transform Vyper Output to Solidity-like Compiler output + * @param name Name of the contract file + * @param compilationResult Result returned by the compiler + */ +export function toStandardOutput(fileName: string, compilationResult: VyperCompilationResult): CompilationResult { + const contractName = fileName.split('/').slice(-1)[0].split('.')[0]; + const methodIdentifiers = JSON.parse(JSON.stringify(compilationResult['method_identifiers']).replace(/0x/g,'')); + return { + sources: { + [fileName]: { + id: 1, + ast: {} as any, + legacyAST: {} as any + } + }, + contracts: { + [fileName]: { + // If the language used has no contract names, this field should equal to an empty string + [contractName]: { + // The Ethereum Contract ABI. If empty, it is represented as an empty array. + // See https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI + abi: compilationResult['abi'], + evm: { + bytecode: { + linkReferences: {}, + object: compilationResult['bytecode'].replace('0x',''), + opcodes: "" + }, + deployedBytecode: { + linkReferences: {}, + object: compilationResult['bytecode_runtime'].replace('0x',''), + opcodes: "" + }, + methodIdentifiers: methodIdentifiers + } + } + } as any + } + }; +} + + +/* +export function createCompilationResultMessage(name: string, result: any) { + if(result.status == 'success') { + return { + bytecode: this.state.compilationResult['bytecode'], + bytecode_runtime: this.state.compilationResult['bytecode_runtime'], + abi: JSON.stringify(this.state.compilationResult['abi'], null , "\t"), + ir: this.state.compilationResult['ir'] + } + } else if(result.status == 'failed' && result.column && result.line) { + const header = `${name}:${result.line}:${result.column}` + const body = this.state.compilationResult.message.split(/\r\n|\r|\n/) + const arr = [header].concat(body).join("\n") + return { + bytecode: arr, + bytecode_runtime: arr, + abi: arr, + ir: arr + } + } else if(result.status == 'failed') { + const message = this.state.compilationResult.message + return { + bytecode: message, + bytecode_runtime: message, + abi: message, + ir: message + } + } + return { + bytecode: "", + bytecode_runtime: "", + abi: "", + ir: "" + } +} +*/ \ No newline at end of file diff --git a/apps/vyper/src/app/utils/index.ts b/apps/vyper/src/app/utils/index.ts new file mode 100644 index 0000000000..cb094b5d7b --- /dev/null +++ b/apps/vyper/src/app/utils/index.ts @@ -0,0 +1,12 @@ +export * from './compiler' +export * from './remix-client' + +export function contractName(fileName: string): string { + const parts = fileName.split('/') + return parts[parts.length - 1] +} + +export function isVyper(name: string): boolean { + const parts = name.split('.') + return parts[parts.length - 1] === 'vy' +} \ No newline at end of file diff --git a/apps/vyper/src/app/utils/remix-client.tsx b/apps/vyper/src/app/utils/remix-client.tsx new file mode 100644 index 0000000000..080ba64a75 --- /dev/null +++ b/apps/vyper/src/app/utils/remix-client.tsx @@ -0,0 +1,71 @@ +import { HighlightPosition, CompilationResult, RemixApi } from '@remixproject/plugin-api'; +import { Api, Status } from '@remixproject/plugin-utils'; +import { createClient } from '@remixproject/plugin-webview' +import { PluginClient } from '@remixproject/plugin'; +import { Contract } from './compiler'; + +export class RemixClient extends PluginClient { + private client = createClient>(this); + + loaded() { + return this.client.onload() + } + + /** Emit an event when file changed */ + async onFileChange(cb: (contract: string) => any) { + this.client.on('fileManager', 'currentFileChanged', async (name: string) => { + if (!name) return + cb(name) + }) + } + + /** Load Ballot contract example into the file manager */ + async loadContract({name, content}: Contract) { + try { + await this.client.call('fileManager', 'setFile', name, content) + await this.client.call('fileManager', 'switchFile', name) + } catch (err) { + console.log(err) + } + } + + /** Update the status of the plugin in remix */ + changeStatus(status: Status) { + this.client.emit('statusChanged', status); + } + + /** Highlight a part of the editor */ + highlight(lineColumnPos: HighlightPosition, name: string, color: string) { + return this.client.call('editor', 'highlight', lineColumnPos, name, color) + } + + /** Remove current Hightlight */ + discardHighlight() { + return this.client.call('editor', 'discardHighlight') + } + + /** Get the name of the current contract */ + async getContractName(): Promise { + await this.client.onload() + return this.client.call('fileManager', 'getCurrentFile') + } + + /** Get the current contract file */ + async getContract(): Promise { + const name = await this.getContractName() + if (!name) throw new Error('No contract selected yet') + const content = await this.client.call('fileManager', 'getFile', name) + return { + name, + content, + } + } + + /** Emit an event to Remix with compilation result */ + compilationFinish(title: string, content: string, data: CompilationResult) { + this.client.emit('compilationFinished', title, content, 'vyper', data); + } +} + +export const remixClient = new RemixClient() +// export const RemixClientContext = React.createContext(new RemixClient()) \ No newline at end of file diff --git a/apps/vyper/src/assets/.gitkeep b/apps/vyper/src/assets/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/apps/vyper/src/environments/environment.prod.ts b/apps/vyper/src/environments/environment.prod.ts new file mode 100644 index 0000000000..3612073bc3 --- /dev/null +++ b/apps/vyper/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/apps/vyper/src/environments/environment.ts b/apps/vyper/src/environments/environment.ts new file mode 100644 index 0000000000..d9370e924b --- /dev/null +++ b/apps/vyper/src/environments/environment.ts @@ -0,0 +1,6 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// When building for production, this file is replaced with `environment.prod.ts`. + +export const environment = { + production: false +}; diff --git a/apps/vyper/src/favicon.ico b/apps/vyper/src/favicon.ico new file mode 100644 index 0000000000..317ebcb233 Binary files /dev/null and b/apps/vyper/src/favicon.ico differ diff --git a/apps/vyper/src/index.html b/apps/vyper/src/index.html new file mode 100644 index 0000000000..b6b64f4a61 --- /dev/null +++ b/apps/vyper/src/index.html @@ -0,0 +1,14 @@ + + + + + Vyper + + + + + + +
+ + diff --git a/apps/vyper/src/main.tsx b/apps/vyper/src/main.tsx new file mode 100644 index 0000000000..353ad43f6d --- /dev/null +++ b/apps/vyper/src/main.tsx @@ -0,0 +1,7 @@ +import { StrictMode } from 'react'; +import * as ReactDOM from 'react-dom'; + + +import App from './app/app'; + +ReactDOM.render(, document.getElementById('root')); diff --git a/apps/vyper/src/polyfills.ts b/apps/vyper/src/polyfills.ts new file mode 100644 index 0000000000..2adf3d05b6 --- /dev/null +++ b/apps/vyper/src/polyfills.ts @@ -0,0 +1,7 @@ +/** + * Polyfill stable language features. These imports will be optimized by `@babel/preset-env`. + * + * See: https://github.com/zloirock/core-js#babel + */ +import 'core-js/stable'; +import 'regenerator-runtime/runtime'; diff --git a/apps/vyper/src/styles.css b/apps/vyper/src/styles.css new file mode 100644 index 0000000000..90d4ee0072 --- /dev/null +++ b/apps/vyper/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/vyper/tsconfig.app.json b/apps/vyper/tsconfig.app.json new file mode 100644 index 0000000000..62d6d52c3d --- /dev/null +++ b/apps/vyper/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + + "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": ["**/*.spec.ts", "**/*.spec.tsx"], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/apps/vyper/tsconfig.json b/apps/vyper/tsconfig.json new file mode 100644 index 0000000000..a3e71f89f3 --- /dev/null +++ b/apps/vyper/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + } + ] +} \ No newline at end of file diff --git a/libs/remix-core-plugin/src/lib/compiler-metadata.ts b/libs/remix-core-plugin/src/lib/compiler-metadata.ts index 2f065e769f..9a69e616f4 100644 --- a/libs/remix-core-plugin/src/lib/compiler-metadata.ts +++ b/libs/remix-core-plugin/src/lib/compiler-metadata.ts @@ -87,7 +87,7 @@ export class CompilerMetadata extends Plugin { let parsedMetadata try { - parsedMetadata = JSON.parse(contract.object.metadata) + parsedMetadata = contract.object && contract.object.metadata ? JSON.parse(contract.object.metadata) : null } catch (e) { console.log(e) } diff --git a/libs/remix-core-plugin/src/lib/constants/uups.ts b/libs/remix-core-plugin/src/lib/constants/uups.ts index 606d62dd77..e161929f01 100644 --- a/libs/remix-core-plugin/src/lib/constants/uups.ts +++ b/libs/remix-core-plugin/src/lib/constants/uups.ts @@ -102,4 +102,6 @@ export const UUPSupgradeAbi = { "outputs": [], "stateMutability": "nonpayable", "type": "function" -} \ No newline at end of file +} +export const EnableProxyURLParam = 'deployProxy' +export const EnableUpgradeURLParam = 'upgradeProxy' \ No newline at end of file diff --git a/libs/remix-core-plugin/src/lib/editor-context-listener.ts b/libs/remix-core-plugin/src/lib/editor-context-listener.ts index 6fd5674e8a..3785c8ffd1 100644 --- a/libs/remix-core-plugin/src/lib/editor-context-listener.ts +++ b/libs/remix-core-plugin/src/lib/editor-context-listener.ts @@ -92,7 +92,7 @@ export class EditorContextListener extends Plugin { this._stopHighlighting() this.currentPosition = cursorPosition this.currentFile = file - if (compilationResult && compilationResult.data && compilationResult.data.sources[file]) { + if (compilationResult && compilationResult.data && compilationResult.data.sources && compilationResult.data.sources[file]) { const nodes = sourceMappingDecoder.nodesAtPosition(null, cursorPosition, compilationResult.data.sources[file]) this.nodes = nodes if (nodes && nodes.length && nodes[nodes.length - 1]) { diff --git a/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts b/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts index ef03092cb8..879351c58f 100644 --- a/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts +++ b/libs/remix-core-plugin/src/lib/openzeppelin-proxy.ts @@ -1,6 +1,6 @@ import { Plugin } from '@remixproject/engine' import { ContractAST, ContractSources, DeployOptions } from '../types/contract' -import { UUPS, UUPSABI, UUPSBytecode, UUPSfunAbi, UUPSupgradeAbi } from './constants/uups' +import { EnableProxyURLParam, EnableUpgradeURLParam, UUPS, UUPSABI, UUPSBytecode, UUPSfunAbi, UUPSupgradeAbi } from './constants/uups' const proxyProfile = { name: 'openzeppelin-proxy', @@ -33,31 +33,40 @@ export class OpenZeppelinProxy extends Plugin { async getProxyOptions (data: ContractSources, file: string): Promise<{ [name: string]: DeployOptions }> { const contracts = data.contracts[file] const ast = data.sources[file].ast - const inputs = {} if (this.kind === 'UUPS') { - Object.keys(contracts).map(name => { - if (ast) { - const UUPSSymbol = ast.exportedSymbols[UUPS] ? ast.exportedSymbols[UUPS][0] : null - - ast.absolutePath === file && ast.nodes.map((node) => { - if (node.name === name && node.linearizedBaseContracts.includes(UUPSSymbol)) { - const abi = contracts[name].abi - const initializeInput = abi.find(node => node.name === 'initialize') - - inputs[name] = { - options: [{ title: 'Deploy with Proxy', active: false }, { title: 'Upgrade with Proxy', active: false }], - initializeOptions: { - inputs: initializeInput, - initializeInputs: initializeInput ? this.blockchain.getInputs(initializeInput) : null - } + const options = await (this.getUUPSContractOptions(contracts, ast, file)) + + return options + } + } + + async getUUPSContractOptions (contracts, ast, file) { + const options = {} + + await Promise.all(Object.keys(contracts).map(async (name) => { + if (ast) { + const UUPSSymbol = ast.exportedSymbols[UUPS] ? ast.exportedSymbols[UUPS][0] : null + + await Promise.all(ast.absolutePath === file && ast.nodes.map(async (node) => { + if (node.name === name && node.linearizedBaseContracts.includes(UUPSSymbol)) { + const abi = contracts[name].abi + const initializeInput = abi.find(node => node.name === 'initialize') + const isDeployWithProxyEnabled: boolean = await this.call('config', 'getAppParameter', EnableProxyURLParam) || false + const isDeployWithUpgradeEnabled: boolean = await this.call('config', 'getAppParameter', EnableUpgradeURLParam) || false + + options[name] = { + options: [{ title: 'Deploy with Proxy', active: isDeployWithProxyEnabled }, { title: 'Upgrade with Proxy', active: isDeployWithUpgradeEnabled }], + initializeOptions: { + inputs: initializeInput, + initializeInputs: initializeInput ? this.blockchain.getInputs(initializeInput) : null } } - }) - } - }) - } - return inputs + } + })) + } + })) + return options } async executeUUPSProxy(implAddress: string, args: string | string [] = '', initializeABI, implementationContractObject): Promise { diff --git a/libs/remix-tests/package.json b/libs/remix-tests/package.json index c4a02aef60..7aab939286 100644 --- a/libs/remix-tests/package.json +++ b/libs/remix-tests/package.json @@ -42,6 +42,7 @@ "@remix-project/remix-lib": "^0.5.15", "@remix-project/remix-simulator": "^0.2.15", "@remix-project/remix-solidity": "^0.5.1", + "@remix-project/remix-url-resolver": "^0.0.36", "ansi-gray": "^0.1.1", "async": "^2.6.0", "axios": ">=0.21.1", diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index f16c925edc..b399f7376e 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -4,6 +4,7 @@ import path from 'path' import deepequal from 'deep-equal' import Log from './logger' import { Compiler as RemixCompiler } from '@remix-project/remix-solidity' +import { RemixURLResolver } from '@remix-project/remix-url-resolver' import { SrcIfc, CompilerConfiguration, CompilationErrors } from './types' const logger = new Log() const log = logger.logger @@ -85,6 +86,17 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts 'remix_accounts.sol': { content: writeTestAccountsContract(accounts) } } const filepath: string = (isDirectory ? filename : path.dirname(filename)) + const importsCallback = (url, cb) => { + try { + if(fs.existsSync(url)) cb(null, fs.readFileSync(url, 'utf-8')) + else { + const urlResolver = new RemixURLResolver() + urlResolver.resolve(url).then((result) => cb(null, result.content)).catch((error) => cb(error.message)) + } + } catch (e) { + cb(e.message) + } + } try { if (!isDirectory && fs.existsSync(filename)) { if (filename.split('.').pop() === 'sol') { @@ -114,13 +126,7 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts } finally { async.waterfall([ function loadCompiler (next) { - compiler = new RemixCompiler((url, cb) => { - try { - cb(null, fs.readFileSync(url, 'utf-8')) - } catch (e) { - cb(e.message) - } - }) + compiler = new RemixCompiler(importsCallback) if (compilerConfig) { const { currentCompilerUrl, evmVersion, optimize, runs } = compilerConfig if (evmVersion) compiler.set('evmVersion', evmVersion) diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 45b89df5e7..d428b2d6f2 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -4,7 +4,7 @@ import path from 'path' import axios, { AxiosResponse } from 'axios' import { runTestFiles } from './runTestFiles' import fs from './fileSystem' -import { Provider } from '@remix-project/remix-simulator' +import { Provider, extend } from '@remix-project/remix-simulator' import { CompilerConfiguration } from './types' import Log from './logger' import colors from 'colors' @@ -68,7 +68,7 @@ commander } // Console message - console.log(colors.white('\n\t👁\t:: Running remix-tests - Unit testing for solidity ::\t👁\n')) + console.log(colors.bold('\n\t👁\t:: Running tests using remix-tests ::\t👁\n')) // Set logger verbosity if (commander.verbose) { @@ -115,7 +115,7 @@ commander const provider: any = new Provider() await provider.init() web3.setProvider(provider) - + extend(web3) runTestFiles(path.resolve(testsPath), isDirectory, web3, compilerConfig) }) diff --git a/libs/remix-tests/src/runTestFiles.ts b/libs/remix-tests/src/runTestFiles.ts index ebaaf27f98..143f38e45c 100644 --- a/libs/remix-tests/src/runTestFiles.ts +++ b/libs/remix-tests/src/runTestFiles.ts @@ -4,7 +4,7 @@ import { runTest } from './testRunner' import { TestResultInterface, ResultsInterface, CompilerConfiguration, compilationInterface, ASTInterface, Options, AstNode } from './types' import colors from 'colors' import Web3 from 'web3' - +import { format } from 'util' import { compileFileOrFiles } from './compiler' import { deployAll } from './deployer' @@ -22,6 +22,15 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3 opts = opts || {} compilerConfig = compilerConfig || {} as CompilerConfiguration const sourceASTs: any = {} + const printLog = (log: string[]) => { + let formattedLog + if (typeof log[0] === 'string' && (log[0].includes('%s') || log[0].includes('%d'))) { + formattedLog = format(log[0], ...log.slice(1)) + } else { + formattedLog = log.join(' ') + } + signale.log(formattedLog) + } const { Signale } = require('signale') // eslint-disable-line // signale configuration const options = { @@ -34,6 +43,11 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3 name: { badge: '\n\t◼', label: '', + color: 'whiteBright' + }, + log: { + badge: '\t', + label: '', color: 'white' }, error: { @@ -104,17 +118,24 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3 let totalPassing = 0 let totalFailing = 0 let totalTime = 0 - const errors: any[] = [] const _testCallback = function (err: Error | null | undefined, result: TestResultInterface) { if (err) throw err if (result.type === 'contract') { - signale.name(result.value.white) + signale.name(result.value) + console.log('\n') } else if (result.type === 'testPass') { - signale.result(result.value) + if (result?.hhLogs?.length) result.hhLogs.forEach(printLog) + signale.result(result.value.white) } else if (result.type === 'testFailure') { - signale.error(result.value.red) - errors.push(result) + if (result?.hhLogs?.length) result.hhLogs.forEach(printLog) + signale.error(result.value.white) + if (result.assertMethod) { + console.log(colors.green('\t Expected value should be ' + result.assertMethod + ' to: ' + result.expected)) + console.log(colors.red('\t Received: ' + result.returned)) + } + console.log(colors.red('\t Message: ' + result.errMsg)) + console.log('\n') } } const _resultsCallback = (_err: Error | null | undefined, result: ResultsInterface, cb) => { @@ -127,7 +148,7 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3 async.eachOfLimit(contractsToTest, 1, (contractName: string, index, cb) => { try { const fileAST: AstNode = sourceASTs[contracts[contractName]['filename']] - runTest(contractName, contracts[contractName], contractsToTestDetails[index], fileAST, { accounts }, _testCallback, (err, result) => { + runTest(contractName, contracts[contractName], contractsToTestDetails[index], fileAST, { accounts, web3 }, _testCallback, (err, result) => { if (err) { console.log(err) return cb(err) @@ -141,23 +162,16 @@ export function runTestFiles (filepath: string, isDirectory: boolean, web3: Web3 if (err) { return next(err) } - console.log('\n') - if (totalPassing > 0) { - console.log(colors.green(totalPassing + ' passing ') + colors.grey('(' + totalTime + 's)')) + console.log(colors.bold.underline('Tests Summary: ')) + + if (totalPassing >= 0) { + console.log(colors.green('Passed: ' + totalPassing)) } - if (totalFailing > 0) { - console.log(colors.red(totalFailing + ' failing')) + if (totalFailing >= 0) { + console.log(colors.red('Failed: ' + totalFailing)) } - console.log('') - - errors.forEach((error, index) => { - console.log(' ' + (index + 1) + ') ' + colors.bold(error.context + ': ') + error.value) - console.log('') - console.log(colors.red('\t error: ' + error.errMsg)) - console.log(colors.green('\t expected value to be ' + error.assertMethod + ' to: ' + error.expected)) - console.log(colors.red('\t returned: ' + error.returned)) - }) + console.log(colors.white('Time Taken: ' + totalTime + 's')) console.log('') next() diff --git a/libs/remix-tests/tests/examples_0/assert_ok_test.sol b/libs/remix-tests/tests/examples_0/assert_ok_test.sol index 04af584e63..497d0dd7ec 100644 --- a/libs/remix-tests/tests/examples_0/assert_ok_test.sol +++ b/libs/remix-tests/tests/examples_0/assert_ok_test.sol @@ -1,7 +1,5 @@ import "remix_tests.sol"; // this import is automatically injected by Remix. - - -import "./hardhat/console.sol"; +import "hardhat/console.sol"; contract AssertOkTest { diff --git a/libs/remix-tests/tests/examples_0/assert_ok_without_console_test.sol b/libs/remix-tests/tests/examples_0/assert_ok_without_console_test.sol deleted file mode 100644 index 030552b16a..0000000000 --- a/libs/remix-tests/tests/examples_0/assert_ok_without_console_test.sol +++ /dev/null @@ -1,12 +0,0 @@ -import "remix_tests.sol"; // this import is automatically injected by Remix. - -contract AssertOkTest { - - function okPassTest() public { - Assert.ok(true, "okPassTest passes"); - } - - function okFailTest() public { - Assert.ok(false, "okFailTest fails"); - } -} \ No newline at end of file diff --git a/libs/remix-tests/tests/examples_0/hardhat/console.sol b/libs/remix-tests/tests/examples_0/hardhat/console.sol deleted file mode 100644 index d65e3b412e..0000000000 --- a/libs/remix-tests/tests/examples_0/hardhat/console.sol +++ /dev/null @@ -1,1532 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >= 0.4.22 <0.9.0; - -library console { - address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); - - function _sendLogPayload(bytes memory payload) private view { - uint256 payloadLength = payload.length; - address consoleAddress = CONSOLE_ADDRESS; - assembly { - let payloadStart := add(payload, 32) - let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) - } - } - - function log() internal view { - _sendLogPayload(abi.encodeWithSignature("log()")); - } - - function logInt(int p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); - } - - function logUint(uint p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); - } - - function logString(string memory p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); - } - - function logBool(bool p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); - } - - function logAddress(address p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); - } - - function logBytes(bytes memory p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); - } - - function logBytes1(bytes1 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); - } - - function logBytes2(bytes2 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); - } - - function logBytes3(bytes3 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); - } - - function logBytes4(bytes4 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); - } - - function logBytes5(bytes5 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); - } - - function logBytes6(bytes6 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); - } - - function logBytes7(bytes7 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); - } - - function logBytes8(bytes8 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); - } - - function logBytes9(bytes9 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); - } - - function logBytes10(bytes10 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); - } - - function logBytes11(bytes11 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); - } - - function logBytes12(bytes12 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); - } - - function logBytes13(bytes13 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); - } - - function logBytes14(bytes14 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); - } - - function logBytes15(bytes15 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); - } - - function logBytes16(bytes16 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); - } - - function logBytes17(bytes17 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); - } - - function logBytes18(bytes18 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); - } - - function logBytes19(bytes19 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); - } - - function logBytes20(bytes20 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); - } - - function logBytes21(bytes21 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); - } - - function logBytes22(bytes22 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); - } - - function logBytes23(bytes23 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); - } - - function logBytes24(bytes24 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); - } - - function logBytes25(bytes25 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); - } - - function logBytes26(bytes26 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); - } - - function logBytes27(bytes27 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); - } - - function logBytes28(bytes28 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); - } - - function logBytes29(bytes29 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); - } - - function logBytes30(bytes30 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); - } - - function logBytes31(bytes31 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); - } - - function logBytes32(bytes32 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); - } - - function log(uint p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); - } - - function log(string memory p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); - } - - function log(bool p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); - } - - function log(address p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); - } - - function log(uint p0, uint p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); - } - - function log(uint p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); - } - - function log(uint p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); - } - - function log(uint p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); - } - - function log(string memory p0, uint p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); - } - - function log(string memory p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); - } - - function log(string memory p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); - } - - function log(string memory p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); - } - - function log(bool p0, uint p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); - } - - function log(bool p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); - } - - function log(bool p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); - } - - function log(bool p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); - } - - function log(address p0, uint p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); - } - - function log(address p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); - } - - function log(address p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); - } - - function log(address p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); - } - - function log(uint p0, uint p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); - } - - function log(uint p0, uint p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); - } - - function log(uint p0, uint p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); - } - - function log(uint p0, uint p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); - } - - function log(uint p0, string memory p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); - } - - function log(uint p0, string memory p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); - } - - function log(uint p0, string memory p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); - } - - function log(uint p0, string memory p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); - } - - function log(uint p0, bool p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); - } - - function log(uint p0, bool p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); - } - - function log(uint p0, bool p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); - } - - function log(uint p0, bool p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); - } - - function log(uint p0, address p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); - } - - function log(uint p0, address p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); - } - - function log(uint p0, address p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); - } - - function log(uint p0, address p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); - } - - function log(string memory p0, uint p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); - } - - function log(string memory p0, uint p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); - } - - function log(string memory p0, uint p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); - } - - function log(string memory p0, uint p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); - } - - function log(string memory p0, string memory p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); - } - - function log(string memory p0, string memory p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); - } - - function log(string memory p0, string memory p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); - } - - function log(string memory p0, string memory p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); - } - - function log(string memory p0, bool p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); - } - - function log(string memory p0, bool p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); - } - - function log(string memory p0, bool p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); - } - - function log(string memory p0, bool p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); - } - - function log(string memory p0, address p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); - } - - function log(string memory p0, address p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); - } - - function log(string memory p0, address p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); - } - - function log(string memory p0, address p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); - } - - function log(bool p0, uint p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); - } - - function log(bool p0, uint p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); - } - - function log(bool p0, uint p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); - } - - function log(bool p0, uint p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); - } - - function log(bool p0, string memory p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); - } - - function log(bool p0, string memory p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); - } - - function log(bool p0, string memory p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); - } - - function log(bool p0, string memory p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); - } - - function log(bool p0, bool p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); - } - - function log(bool p0, bool p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); - } - - function log(bool p0, bool p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); - } - - function log(bool p0, bool p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); - } - - function log(bool p0, address p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); - } - - function log(bool p0, address p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); - } - - function log(bool p0, address p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); - } - - function log(bool p0, address p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); - } - - function log(address p0, uint p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); - } - - function log(address p0, uint p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); - } - - function log(address p0, uint p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); - } - - function log(address p0, uint p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); - } - - function log(address p0, string memory p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); - } - - function log(address p0, string memory p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); - } - - function log(address p0, string memory p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); - } - - function log(address p0, string memory p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); - } - - function log(address p0, bool p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); - } - - function log(address p0, bool p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); - } - - function log(address p0, bool p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); - } - - function log(address p0, bool p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); - } - - function log(address p0, address p1, uint p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); - } - - function log(address p0, address p1, string memory p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); - } - - function log(address p0, address p1, bool p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); - } - - function log(address p0, address p1, address p2) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); - } - - function log(uint p0, uint p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, uint p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, string memory p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, bool p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); - } - - function log(uint p0, address p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, uint p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, string memory p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, bool p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); - } - - function log(string memory p0, address p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, uint p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, string memory p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, bool p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); - } - - function log(bool p0, address p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); - } - - function log(address p0, uint p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); - } - - function log(address p0, string memory p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); - } - - function log(address p0, bool p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, uint p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, uint p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, uint p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, uint p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, string memory p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, string memory p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, string memory p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, string memory p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, bool p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, bool p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, bool p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, bool p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, address p2, uint p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, address p2, string memory p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, address p2, bool p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); - } - - function log(address p0, address p1, address p2, address p3) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); - } - -} diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 65bea514da..a7b9953dd9 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -42,101 +42,103 @@ Commands: }) test('remix-tests running a test file', () => { - const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines - expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/:: Running tests using remix-tests ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result expect(res.stdout.toString().trim()).toMatch(/AssertOkTest/) + expect(res.stdout.toString().trim()).toMatch(/AssertOkTest okPassTest/) // check if console.log is printed expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) + expect(res.stdout.toString().trim()).toMatch(/AssertOkTest okFailTest/) // check if console.log is printed expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) // match fail test details - expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) - expect(res.stdout.toString().trim()).toMatch(/expected value to be ok to: true/) - expect(res.stdout.toString().trim()).toMatch(/returned: false/) + expect(res.stdout.toString().trim()).toMatch(/Expected value should be ok to: true/) + expect(res.stdout.toString().trim()).toMatch(/Received: false/) + expect(res.stdout.toString().trim()).toMatch(/Message: okFailTest fails/) }) test('remix-tests running a test file with custom compiler version', () => { - const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim().includes('Compiler version set to 0.7.4. Latest version is')).toBeTruthy() expect(res.stdout.toString().trim().includes('Loading remote solc version v0.7.4+commit.3f05b770 ...')).toBeTruthy() - expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/:: Running tests using remix-tests ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) // match fail test details - expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + expect(res.stdout.toString().trim()).toMatch(/Message: okFailTest fails/) }) test('remix-tests running a test file with unavailable custom compiler version (should fail)', () => { - const res = spawnSync(executablePath, ['--compiler', '1.10.4', resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, ['--compiler', '1.10.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim().includes('No compiler found in releases with version 1.10.4')).toBeTruthy() }) test('remix-tests running a test file with custom EVM', () => { - const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim().includes('EVM set to petersburg')).toBeTruthy() - expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/:: Running tests using remix-tests ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) // match fail test details - expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + expect(res.stdout.toString().trim()).toMatch(/Message: okFailTest fails/) }) test('remix-tests running a test file by enabling optimization', () => { - const res = spawnSync(executablePath, ['--optimize', 'true', resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, ['--optimize', 'true', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim().includes('Optimization is enabled')).toBeTruthy() - expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/:: Running tests using remix-tests ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) // match fail test details - expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + expect(res.stdout.toString().trim()).toMatch(/Message: okFailTest fails/) }) test('remix-tests running a test file by enabling optimization and setting runs', () => { - const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim().includes('Optimization is enabled')).toBeTruthy() expect(res.stdout.toString().trim().includes('Runs set to 300')).toBeTruthy() - expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/:: Running tests using remix-tests ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) // match fail test details - expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + expect(res.stdout.toString().trim()).toMatch(/Message: okFailTest fails/) }) test('remix-tests running a test file without enabling optimization and setting runs (should fail)', () => { - const res = spawnSync(executablePath, ['--runs', '300', resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, ['--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim().includes('Optimization should be enabled for runs')).toBeTruthy() }) test('remix-tests running a test file with all options', () => { - const res = spawnSync(executablePath, ['--compiler', '0.7.5', '--evm', 'istanbul', '--optimize', 'true', '--runs', '250', resolve(__dirname + '/examples_0/assert_ok_without_console_test.sol')]) + const res = spawnSync(executablePath, ['--compiler', '0.7.5', '--evm', 'istanbul', '--optimize', 'true', '--runs', '250', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines expect(res.stdout.toString().trim().includes('Compiler version set to 0.7.5. Latest version is')).toBeTruthy() expect(res.stdout.toString().trim().includes('Loading remote solc version v0.7.5+commit.eb77ed08 ...')).toBeTruthy() expect(res.stdout.toString().trim().includes('EVM set to istanbul')).toBeTruthy() expect(res.stdout.toString().trim().includes('Optimization is enabled')).toBeTruthy() expect(res.stdout.toString().trim().includes('Runs set to 250')).toBeTruthy() - expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/:: Running tests using remix-tests ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) // match fail test details - expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + expect(res.stdout.toString().trim()).toMatch(/Message: okFailTest fails/) }) }) }) \ No newline at end of file diff --git a/libs/remix-tests/tests/testRunner.spec.ts b/libs/remix-tests/tests/testRunner.spec.ts index 2f6d363a31..c475914522 100644 --- a/libs/remix-tests/tests/testRunner.spec.ts +++ b/libs/remix-tests/tests/testRunner.spec.ts @@ -129,7 +129,7 @@ describe('testRunner', () => { { type: 'accountList', value: accounts }, { type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' }, { type: 'testPass', debugTxHash: '0x5b665752a4faf83229259b9b2811d3295be0af633b0051d4b90042283ef55707', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest', hhLogs: hhLogs1 }, - { type: 'testFailure', debugTxHash: '0xa0a30ad042a7fc3495f72be7ba788d705888ffbbec7173f60bb27e07721510f2',value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', hhLogs: hhLogs2, assertMethod: 'ok', location: '370:36:0', expected: 'true', returned: 'false'}, + { type: 'testFailure', debugTxHash: '0xa0a30ad042a7fc3495f72be7ba788d705888ffbbec7173f60bb27e07721510f2',value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', hhLogs: hhLogs2, assertMethod: 'ok', location: '366:36:0', expected: 'true', returned: 'false'}, ], ['time', 'web3']) }) diff --git a/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx b/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx index 2220bc1d1b..a90dc433af 100644 --- a/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx +++ b/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx @@ -36,7 +36,7 @@ export const CopyToClipboard = (props: ICopyToClipboard) => { } } - const handleClick = (e) => { + const handleClick = (e: any) => { if (content) { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory copyData() } else { diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 1b1863a4da..99eb2a1b03 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -249,7 +249,6 @@ export const EditorUI = (props: EditorUIProps) => { defineAndSetTheme(monacoRef.current) }) - useEffect(() => { if (!editorRef.current || !props.currentFile) return currentFileRef.current = props.currentFile @@ -471,6 +470,8 @@ export const EditorUI = (props: EditorUIProps) => { (window as any).addRemixBreakpoint(e.target.position) } }) + + // zoomin zoomout editor.addCommand(monacoRef.current.KeyMod.CtrlCmd | monacoRef.current.KeyCode.US_EQUAL, () => { editor.updateOptions({ fontSize: editor.getOption(43).fontSize + 1 }) }) @@ -478,6 +479,32 @@ export const EditorUI = (props: EditorUIProps) => { editor.updateOptions({ fontSize: editor.getOption(43).fontSize - 1 }) }) + // add context menu items + const zoominAction = { + id: "zoomIn", + label: "Zoom In", + contextMenuOrder: 0, // choose the order + contextMenuGroupId: "zooming", // create a new grouping + keybindings: [ + // eslint-disable-next-line no-bitwise + monacoRef.current.KeyMod.CtrlCmd | monacoRef.current.KeyCode.Equal, + ], + run: () => { editor.updateOptions({ fontSize: editor.getOption(43).fontSize + 1 }) }, + } + const zoomOutAction = { + id: "zoomOut", + label: "Zoom Out", + contextMenuOrder: 0, // choose the order + contextMenuGroupId: "zooming", // create a new grouping + keybindings: [ + // eslint-disable-next-line no-bitwise + monacoRef.current.KeyMod.CtrlCmd | monacoRef.current.KeyCode.Minus, + ], + run: () => { editor.updateOptions({ fontSize: editor.getOption(43).fontSize - 1 }) }, + } + editor.addAction(zoomOutAction) + editor.addAction(zoominAction) + const editorService = editor._codeEditorService; const openEditorBase = editorService.openCodeEditor.bind(editorService); editorService.openCodeEditor = async (input, source) => { diff --git a/libs/remix-ui/run-tab/src/lib/actions/events.ts b/libs/remix-ui/run-tab/src/lib/actions/events.ts index 4355f4e87e..46af1dba0d 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/events.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/events.ts @@ -95,17 +95,20 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch) => { const broadcastCompilationResult = async (plugin: RunTab, dispatch: React.Dispatch, file, source, languageVersion, data, input?) => { // TODO check whether the tab is configured const compiler = new CompilerAbstract(languageVersion, data, source, input) - plugin.compilersArtefacts[languageVersion] = compiler plugin.compilersArtefacts.__last = compiler const contracts = getCompiledContracts(compiler).map((contract) => { return { name: languageVersion, alias: contract.name, file: contract.file, compiler } }) - const index = contracts.findIndex(contract => contract.alias === plugin.REACT_API.contracts.currentContract) - - if ((index < 0) && (contracts.length > 0)) dispatch(setCurrentContract(contracts[0].alias)) - const isUpgradeable = await plugin.call('openzeppelin-proxy', 'isConcerned', data.sources[file] ? data.sources[file].ast : {}) + if ((contracts.length > 0)) { + const contractsInCompiledFile = contracts.filter(obj => obj.file === file) + let currentContract + if (contractsInCompiledFile.length) currentContract = contractsInCompiledFile[0].alias + else currentContract = contracts[0].alias + dispatch(setCurrentContract(currentContract)) + } + const isUpgradeable = await plugin.call('openzeppelin-proxy', 'isConcerned', data.sources && data.sources[file] ? data.sources[file].ast : {}) if (isUpgradeable) { const options = await plugin.call('openzeppelin-proxy', 'getProxyOptions', data, file) diff --git a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx index 7fe409e511..c5f6f394ce 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx @@ -24,6 +24,13 @@ export function ContractGUI (props: ContractGUIProps) { const initializeFields = useRef>([]) const basicInputRef = useRef() + useEffect(() => { + if (props.deployOption && Array.isArray(props.deployOption)) { + if (props.deployOption[0] && props.deployOption[0].title === 'Deploy with Proxy' && props.deployOption[0].active) handleDeployProxySelect(true) + else if (props.deployOption[1] && props.deployOption[1].title === 'Upgrade with Proxy' && props.deployOption[1].active) handleUpgradeImpSelect(true) + } + }, [props.deployOption]) + useEffect(() => { if (props.title) { setTitle(props.title) @@ -131,12 +138,10 @@ export function ContractGUI (props: ContractGUIProps) { } const makeMultiVal = () => { - let inputString = basicInput + const inputString = basicInput if (inputString) { - inputString = inputString.replace(/(^|,\s+|,)(\d+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted number by quoted number - inputString = inputString.replace(/(^|,\s+|,)(0[xX][0-9a-fA-F]+)(\s+,|,|$)/g, '$1"$2"$3') // replace non quoted hex string by quoted hex string - const inputJSON = JSON.parse('[' + inputString + ']') + const inputJSON = remixLib.execution.txFormat.parseFunctionParams(inputString) const multiInputs = multiFields.current for (let k = 0; k < multiInputs.length; k++) { @@ -179,9 +184,7 @@ export function ContractGUI (props: ContractGUIProps) { setToggleDeployProxy(!toggleDeployProxy) } - const handleDeployProxySelect = (e) => { - const value = e.target.checked - + const handleDeployProxySelect = (value: boolean) => { if (value) setToggleUpgradeImp(false) setToggleDeployProxy(value) setDeployState({ upgrade: false, deploy: value }) @@ -191,9 +194,7 @@ export function ContractGUI (props: ContractGUIProps) { setToggleUpgradeImp(!toggleUpgradeImp) } - const handleUpgradeImpSelect = (e) => { - const value = e.target.checked - + const handleUpgradeImpSelect = (value: boolean) => { setToggleUpgradeImp(value) if (value) { setToggleDeployProxy(false) @@ -264,7 +265,7 @@ export function ContractGUI (props: ContractGUIProps) { data-id="contractGUIDeployWithProxy" className="form-check-input custom-control-input" type="checkbox" - onChange={handleDeployProxySelect} + onChange={(e) => handleDeployProxySelect(e.target.checked)} checked={deployState.deploy} />