From 1a9c28a0700bd3a51492b1ffa46f337759ebba7f Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 15 Mar 2023 15:14:24 +0100 Subject: [PATCH] better function wrapping --- .../src/app/plugins/solidity-script.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/solidity-script.tsx b/apps/remix-ide/src/app/plugins/solidity-script.tsx index 908bec0c85..73b17aff85 100644 --- a/apps/remix-ide/src/app/plugins/solidity-script.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-script.tsx @@ -22,11 +22,18 @@ export class SolidityScript extends Plugin { this.call('terminal', 'log', `running ${path}...`) let content = await this.call('fileManager', 'readFile', path) const params = await this.call('solidity', 'getCompilerParameters') + + content = ` - import "hardhat/console.sol"; - contract SolidityScript { - ${content} - }` + import "${path}"; + + contract SolidityScript { + constructor () {} + + function remixRun () public { + run(); + } + }` const targets = { 'script.sol': { content } } // compile @@ -65,7 +72,7 @@ export class SolidityScript extends Plugin { tx = { from: accounts[0], to: receipt.contractAddress, - data: '0xc0406226' // function run() public + data: '0x69d4394b' // function remixRun() public } const receiptCall = await web3.eth.sendTransaction(tx)