pull/5370/head
yann300 3 years ago
parent 9d3d8fb121
commit be31b851ee
  1. 8
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  2. 6
      apps/remix-ide-e2e/src/tests/workspace.test.ts
  3. 10
      libs/remix-ws-templates/src/templates/ozerc20/scripts/ethers-lib.ts
  4. 6
      libs/remix-ws-templates/src/templates/ozerc20/scripts/web3-lib.ts
  5. 10
      libs/remix-ws-templates/src/templates/ozerc721/scripts/ethers-lib.ts
  6. 6
      libs/remix-ws-templates/src/templates/ozerc721/scripts/web3-lib.ts
  7. 10
      libs/remix-ws-templates/src/templates/remixDefault/scripts/ethers-lib.ts
  8. 6
      libs/remix-ws-templates/src/templates/remixDefault/scripts/web3-lib.ts
  9. 10
      libs/remix-ws-templates/src/templates/zeroxErc20/scripts/ethers-lib.ts
  10. 6
      libs/remix-ws-templates/src/templates/zeroxErc20/scripts/web3-lib.ts

@ -291,7 +291,7 @@ const deployWithEthersJs = `
// 'web3Provider' is a remix global variable object // 'web3Provider' is a remix global variable object
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner() const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner()
let factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); let factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let contract = await factory.deploy(...constructorArgs); let contract = await factory.deploy(...constructorArgs);
@ -320,7 +320,7 @@ describe("Storage with lib", function () {
// Make sure contract is compiled and artifacts are generated // Make sure contract is compiled and artifacts are generated
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', 'contracts/artifacts/Storage.json')) const metadata = JSON.parse(await remix.call('fileManager', 'getFile', 'contracts/artifacts/Storage.json'))
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner() const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner()
let Storage = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); let Storage = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let storage = await Storage.deploy(); let storage = await Storage.deploy();
console.log('storage contract Address: ' + storage.address); console.log('storage contract Address: ' + storage.address);
await storage.deployed() await storage.deployed()
@ -330,7 +330,7 @@ describe("Storage with lib", function () {
it("test updating and retrieving updated value", async function () { it("test updating and retrieving updated value", async function () {
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', 'contracts/artifacts/Storage.json')) const metadata = JSON.parse(await remix.call('fileManager', 'getFile', 'contracts/artifacts/Storage.json'))
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner() const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner()
let Storage = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); let Storage = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let storage = await Storage.deploy(); let storage = await Storage.deploy();
await storage.deployed() await storage.deployed()
const setValue = await storage.store(56); const setValue = await storage.store(56);
@ -341,7 +341,7 @@ describe("Storage with lib", function () {
it("fail test updating and retrieving updated value", async function () { it("fail test updating and retrieving updated value", async function () {
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', 'contracts/artifacts/Storage.json')) const metadata = JSON.parse(await remix.call('fileManager', 'getFile', 'contracts/artifacts/Storage.json'))
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner() const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner()
let Storage = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); let Storage = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let storage = await Storage.deploy(); let storage = await Storage.deploy();
await storage.deployed() await storage.deployed()
const setValue = await storage.store(56); const setValue = await storage.store(56);

@ -75,7 +75,7 @@ module.exports = {
.click('*[data-id="treeViewLitreeViewItemscripts/ethers-lib.ts"]') .click('*[data-id="treeViewLitreeViewItemscripts/ethers-lib.ts"]')
.pause(100) .pause(100)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf(`export const deploy = async (contractName: string, args: Array<any>, acountIndex?: number): Promise<ethers.Contract> => {`) !== -1, browser.assert.ok(content.indexOf(`export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {`) !== -1,
'Incorrect content') 'Incorrect content')
}) })
.assert.elementPresent('*[data-id="treeViewLitreeViewItemtests"]') .assert.elementPresent('*[data-id="treeViewLitreeViewItemtests"]')
@ -152,7 +152,7 @@ module.exports = {
.click('*[data-id="treeViewLitreeViewItemscripts/ethers-lib.ts"]') .click('*[data-id="treeViewLitreeViewItemscripts/ethers-lib.ts"]')
.pause(100) .pause(100)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf(`export const deploy = async (contractName: string, args: Array<any>, acountIndex?: number): Promise<ethers.Contract> => {`) !== -1, browser.assert.ok(content.indexOf(`export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {`) !== -1,
'Incorrect content') 'Incorrect content')
}) })
.assert.elementPresent('*[data-id="treeViewLitreeViewItemtests"]') .assert.elementPresent('*[data-id="treeViewLitreeViewItemtests"]')
@ -200,7 +200,7 @@ module.exports = {
.click('*[data-id="treeViewLitreeViewItemscripts/ethers-lib.ts"]') .click('*[data-id="treeViewLitreeViewItemscripts/ethers-lib.ts"]')
.pause(100) .pause(100)
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf(`export const deploy = async (contractName: string, args: Array<any>, acountIndex?: number): Promise<ethers.Contract> => {`) !== -1, browser.assert.ok(content.indexOf(`export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {`) !== -1,
'Incorrect content') 'Incorrect content')
}) })
.assert.elementPresent('*[data-id="treeViewLitreeViewItemtests"]') .assert.elementPresent('*[data-id="treeViewLitreeViewItemtests"]')

@ -4,10 +4,10 @@ import { ethers } from 'ethers'
* Deploy the given contract * Deploy the given contract
* @param {string} contractName name of the contract to deploy * @param {string} contractName name of the contract to deploy
* @param {Array<any>} args list of constructor' parameters * @param {Array<any>} args list of constructor' parameters
* @param {Number} acountIndex account index from the exposed account * @param {Number} accountIndex account index from the exposed account
* @return {Contract} deployed contract * @return {Contract} deployed contract
*/ */
export const deploy = async (contractName: string, args: Array<any>, acountIndex?: number): Promise<ethers.Contract> => { export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {
console.log(`deploying ${contractName}`) console.log(`deploying ${contractName}`)
// Note that the script needs the ABI which is generated from the compilation artifact. // Note that the script needs the ABI which is generated from the compilation artifact.
@ -17,11 +17,11 @@ export const deploy = async (contractName: string, args: Array<any>, acountIndex
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
// 'web3Provider' is a remix global variable object // 'web3Provider' is a remix global variable object
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(acountIndex) const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex)
const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let contract = await factory.deploy(...args) const contract = await factory.deploy(...args)
// The contract is NOT deployed yet; we must wait until it is mined // The contract is NOT deployed yet; we must wait until it is mined
await contract.deployed() await contract.deployed()

@ -1,5 +1,5 @@
import Web3 from 'web3' import Web3 from 'web3'
import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'; import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'
/** /**
* Deploy the given contract * Deploy the given contract
@ -21,9 +21,9 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
let contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
let contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,
arguments: args arguments: args
}) })

@ -4,10 +4,10 @@ import { ethers } from 'ethers'
* Deploy the given contract * Deploy the given contract
* @param {string} contractName name of the contract to deploy * @param {string} contractName name of the contract to deploy
* @param {Array<any>} args list of constructor' parameters * @param {Array<any>} args list of constructor' parameters
* @param {Number} acountIndex account index from the exposed account * @param {Number} accountIndex account index from the exposed account
* @return {Contract} deployed contract * @return {Contract} deployed contract
*/ */
export const deploy = async (contractName: string, args: Array<any>, acountIndex?: number): Promise<ethers.Contract> => { export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {
console.log(`deploying ${contractName}`) console.log(`deploying ${contractName}`)
// Note that the script needs the ABI which is generated from the compilation artifact. // Note that the script needs the ABI which is generated from the compilation artifact.
@ -17,11 +17,11 @@ export const deploy = async (contractName: string, args: Array<any>, acountIndex
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
// 'web3Provider' is a remix global variable object // 'web3Provider' is a remix global variable object
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(acountIndex) const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex)
const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let contract = await factory.deploy(...args) const contract = await factory.deploy(...args)
// The contract is NOT deployed yet; we must wait until it is mined // The contract is NOT deployed yet; we must wait until it is mined
await contract.deployed() await contract.deployed()

@ -1,5 +1,5 @@
import Web3 from 'web3' import Web3 from 'web3'
import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'; import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'
/** /**
* Deploy the given contract * Deploy the given contract
@ -21,9 +21,9 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
let contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
let contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,
arguments: args arguments: args
}) })

@ -4,10 +4,10 @@ import { ethers } from 'ethers'
* Deploy the given contract * Deploy the given contract
* @param {string} contractName name of the contract to deploy * @param {string} contractName name of the contract to deploy
* @param {Array<any>} args list of constructor' parameters * @param {Array<any>} args list of constructor' parameters
* @param {Number} acountIndex account index from the exposed account * @param {Number} accountIndex account index from the exposed account
* @return {Contract} deployed contract * @return {Contract} deployed contract
*/ */
export const deploy = async (contractName: string, args: Array<any>, acountIndex?: number): Promise<ethers.Contract> => { export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {
console.log(`deploying ${contractName}`) console.log(`deploying ${contractName}`)
// Note that the script needs the ABI which is generated from the compilation artifact. // Note that the script needs the ABI which is generated from the compilation artifact.
@ -17,11 +17,11 @@ export const deploy = async (contractName: string, args: Array<any>, acountIndex
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
// 'web3Provider' is a remix global variable object // 'web3Provider' is a remix global variable object
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(acountIndex) const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex)
const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let contract = await factory.deploy(...args) const contract = await factory.deploy(...args)
// The contract is NOT deployed yet; we must wait until it is mined // The contract is NOT deployed yet; we must wait until it is mined
await contract.deployed() await contract.deployed()

@ -1,5 +1,5 @@
import Web3 from 'web3' import Web3 from 'web3'
import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'; import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'
/** /**
* Deploy the given contract * Deploy the given contract
@ -21,9 +21,9 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
let contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
let contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,
arguments: args arguments: args
}) })

@ -4,10 +4,10 @@ import { ethers } from 'ethers'
* Deploy the given contract * Deploy the given contract
* @param {string} contractName name of the contract to deploy * @param {string} contractName name of the contract to deploy
* @param {Array<any>} args list of constructor' parameters * @param {Array<any>} args list of constructor' parameters
* @param {Number} acountIndex account index from the exposed account * @param {Number} accountIndex account index from the exposed account
* @return {Contract} deployed contract * @return {Contract} deployed contract
*/ */
export const deploy = async (contractName: string, args: Array<any>, acountIndex?: number): Promise<ethers.Contract> => { export const deploy = async (contractName: string, args: Array<any>, accountIndex?: number): Promise<ethers.Contract> => {
console.log(`deploying ${contractName}`) console.log(`deploying ${contractName}`)
// Note that the script needs the ABI which is generated from the compilation artifact. // Note that the script needs the ABI which is generated from the compilation artifact.
@ -17,11 +17,11 @@ export const deploy = async (contractName: string, args: Array<any>, acountIndex
const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath)) const metadata = JSON.parse(await remix.call('fileManager', 'getFile', artifactsPath))
// 'web3Provider' is a remix global variable object // 'web3Provider' is a remix global variable object
const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(acountIndex) const signer = (new ethers.providers.Web3Provider(web3Provider)).getSigner(accountIndex)
const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer); const factory = new ethers.ContractFactory(metadata.abi, metadata.data.bytecode.object, signer)
let contract = await factory.deploy(...args) const contract = await factory.deploy(...args)
// The contract is NOT deployed yet; we must wait until it is mined // The contract is NOT deployed yet; we must wait until it is mined
await contract.deployed() await contract.deployed()

@ -1,5 +1,5 @@
import Web3 from 'web3' import Web3 from 'web3'
import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'; import { Contract, ContractSendMethod, Options } from 'web3-eth-contract'
/** /**
* Deploy the given contract * Deploy the given contract
@ -21,9 +21,9 @@ export const deploy = async (contractName: string, args: Array<any>, from?: stri
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
let contract: Contract = new web3.eth.Contract(metadata.abi) const contract: Contract = new web3.eth.Contract(metadata.abi)
let contractSend: ContractSendMethod = contract.deploy({ const contractSend: ContractSendMethod = contract.deploy({
data: metadata.data.bytecode.object, data: metadata.data.bytecode.object,
arguments: args arguments: args
}) })

Loading…
Cancel
Save