@ -11,13 +11,13 @@ import { InjectedProvider } from './providers/injected'
import { NodeProvider } from './providers/node'
import { NodeProvider } from './providers/node'
import { execution , EventManager , helpers } from '@remix-project/remix-lib'
import { execution , EventManager , helpers } from '@remix-project/remix-lib'
import { etherScanLink } from './helper'
import { etherScanLink } from './helper'
import { logBuilder , cancelUpgradeMsg , cancelProxyMsg , addressToString } from "@remix-ui/helper"
import { logBuilder , cancelUpgradeMsg , cancelProxyMsg , addressToString } from '@remix-ui/helper'
const { txFormat , txExecution , typeConversion , txListener : Txlistener , TxRunner , TxRunnerWeb3 , txHelper } = execution
const { txFormat , txExecution , typeConversion , txListener : Txlistener , TxRunner , TxRunnerWeb3 , txHelper } = execution
const { txResultHelper } = helpers
const { txResultHelper } = helpers
const { resultToRemixTx } = txResultHelper
const { resultToRemixTx } = txResultHelper
import * as packageJson from '../../../../package.json'
import * as packageJson from '../../../../package.json'
const _paq = window . _paq = window . _paq || [ ] //eslint-disable-line
const _paq = ( window . _paq = window . _paq || [ ] ) //eslint-disable-line
const profile = {
const profile = {
name : 'blockchain' ,
name : 'blockchain' ,
@ -28,19 +28,19 @@ const profile = {
}
}
export type TransactionContextAPI = {
export type TransactionContextAPI = {
getAddress : ( cb : ( error : Error , result : string ) = > void ) = > void ,
getAddress : ( cb : ( error : Error , result : string ) = > void ) = > void
getValue : ( cb : ( error : Error , result : string ) = > void ) = > void ,
getValue : ( cb : ( error : Error , result : string ) = > void ) = > void
getGasLimit : ( cb : ( error : Error , result : string ) = > void ) = > void
getGasLimit : ( cb : ( error : Error , result : string ) = > void ) = > void
}
}
// see TxRunner.ts in remix-lib
// see TxRunner.ts in remix-lib
export type Transaction = {
export type Transaction = {
from : string ,
from : string
to : string ,
to : string
value : string ,
value : string
data : string ,
data : string
gasLimit : number ,
gasLimit : number
useCall : boolean ,
useCall : boolean
timestamp? : number
timestamp? : number
}
}
@ -54,7 +54,7 @@ export class Blockchain extends Plugin {
networkcallid : number
networkcallid : number
networkStatus : {
networkStatus : {
network : {
network : {
name : string ,
name : string
id : string
id : string
}
}
error? : string
error? : string
@ -71,16 +71,22 @@ export class Blockchain extends Plugin {
this . events = new EventEmitter ( )
this . events = new EventEmitter ( )
this . config = config
this . config = config
const web3Runner = new TxRunnerWeb3 ( {
const web3Runner = new TxRunnerWeb3 (
{
config : this.config ,
config : this.config ,
detectNetwork : ( cb ) = > {
detectNetwork : ( cb ) = > {
this . executionContext . detectNetwork ( cb )
this . executionContext . detectNetwork ( cb )
} ,
} ,
isVM : ( ) = > { return this . executionContext . isVM ( ) } ,
isVM : ( ) = > {
return this . executionContext . isVM ( )
} ,
personalMode : ( ) = > {
personalMode : ( ) = > {
return this . getProvider ( ) === 'web3' ? this . config . get ( 'settings/personal-mode' ) : false
return this . getProvider ( ) === 'web3' ? this . config . get ( 'settings/personal-mode' ) : false
}
}
} , _ = > this . executionContext . web3 ( ) , _ = > this . executionContext . currentblockGasLimit ( ) )
} ,
( _ ) = > this . executionContext . web3 ( ) ,
( _ ) = > this . executionContext . currentblockGasLimit ( )
)
this . txRunner = new TxRunner ( web3Runner , { } )
this . txRunner = new TxRunner ( web3Runner , { } )
this . networkcallid = 0
this . networkcallid = 0
@ -193,30 +199,47 @@ export class Blockchain extends Plugin {
deployContractAndLibraries ( selectedContract , args , contractMetadata , compilerContracts , callbacks , confirmationCb ) {
deployContractAndLibraries ( selectedContract , args , contractMetadata , compilerContracts , callbacks , confirmationCb ) {
const { continueCb , promptCb , statusCb , finalCb } = callbacks
const { continueCb , promptCb , statusCb , finalCb } = callbacks
const constructor = selectedContract . getConstructorInterface ( )
const constructor = selectedContract . getConstructorInterface ( )
txFormat . buildData ( selectedContract . name , selectedContract . object , compilerContracts , true , constructor , args , ( error , data ) = > {
txFormat . buildData (
selectedContract . name ,
selectedContract . object ,
compilerContracts ,
true ,
constructor ,
args ,
( error , data ) = > {
if ( error ) {
if ( error ) {
return statusCb ( ` creation of ${ selectedContract . name } errored: ${ error . message ? error.message : error } ` )
return statusCb ( ` creation of ${ selectedContract . name } errored: ${ error . message ? error.message : error } ` )
}
}
statusCb ( ` creation of ${ selectedContract . name } pending... ` )
statusCb ( ` creation of ${ selectedContract . name } pending... ` )
this . createContract ( selectedContract , data , continueCb , promptCb , confirmationCb , finalCb )
this . createContract ( selectedContract , data , continueCb , promptCb , confirmationCb , finalCb )
} , statusCb , ( data , runTxCallback ) = > {
} ,
statusCb ,
( data , runTxCallback ) = > {
// called for libraries deployment
// called for libraries deployment
this . runTx ( data , confirmationCb , continueCb , promptCb , runTxCallback )
this . runTx ( data , confirmationCb , continueCb , promptCb , runTxCallback )
} )
}
)
}
}
deployContractWithLibrary ( selectedContract , args , contractMetadata , compilerContracts , callbacks , confirmationCb ) {
deployContractWithLibrary ( selectedContract , args , contractMetadata , compilerContracts , callbacks , confirmationCb ) {
const { continueCb , promptCb , statusCb , finalCb } = callbacks
const { continueCb , promptCb , statusCb , finalCb } = callbacks
const constructor = selectedContract . getConstructorInterface ( )
const constructor = selectedContract . getConstructorInterface ( )
txFormat . encodeConstructorCallAndLinkLibraries ( selectedContract . object , args , constructor , contractMetadata . linkReferences , selectedContract . bytecodeLinkReferences , ( error , data ) = > {
txFormat . encodeConstructorCallAndLinkLibraries (
selectedContract . object ,
args ,
constructor ,
contractMetadata . linkReferences ,
selectedContract . bytecodeLinkReferences ,
( error , data ) = > {
if ( error ) {
if ( error ) {
return statusCb ( ` creation of ${ selectedContract . name } errored: ${ error . message ? error.message : error } ` )
return statusCb ( ` creation of ${ selectedContract . name } errored: ${ error . message ? error.message : error } ` )
}
}
statusCb ( ` creation of ${ selectedContract . name } pending... ` )
statusCb ( ` creation of ${ selectedContract . name } pending... ` )
this . createContract ( selectedContract , data , continueCb , promptCb , confirmationCb , finalCb )
this . createContract ( selectedContract , data , continueCb , promptCb , confirmationCb , finalCb )
} )
}
)
}
}
async deployProxy ( proxyData , implementationContractObject ) {
async deployProxy ( proxyData , implementationContractObject ) {
@ -249,8 +272,12 @@ export class Blockchain extends Plugin {
// continue using original authorization given by user
// continue using original authorization given by user
continueTxExecution ( null )
continueTxExecution ( null )
}
}
const continueCb = ( error , continueTxExecution , cancelCb ) = > { continueTxExecution ( ) }
const continueCb = ( error , continueTxExecution , cancelCb ) = > {
const promptCb = ( okCb , cancelCb ) = > { okCb ( ) }
continueTxExecution ( )
}
const promptCb = ( okCb , cancelCb ) = > {
okCb ( )
}
const finalCb = async ( error , txResult , address , returnValue ) = > {
const finalCb = async ( error , txResult , address , returnValue ) = > {
if ( error ) {
if ( error ) {
const log = logBuilder ( error )
const log = logBuilder ( error )
@ -296,8 +323,12 @@ export class Blockchain extends Plugin {
networkInfo = network
networkInfo = network
continueTxExecution ( null )
continueTxExecution ( null )
}
}
const continueCb = ( error , continueTxExecution , cancelCb ) = > { continueTxExecution ( ) }
const continueCb = ( error , continueTxExecution , cancelCb ) = > {
const promptCb = ( okCb , cancelCb ) = > { okCb ( ) }
continueTxExecution ( )
}
const promptCb = ( okCb , cancelCb ) = > {
okCb ( )
}
const finalCb = async ( error , txResult , address , returnValue ) = > {
const finalCb = async ( error , txResult , address , returnValue ) = > {
if ( error ) {
if ( error ) {
const log = logBuilder ( error )
const log = logBuilder ( error )
@ -336,17 +367,40 @@ export class Blockchain extends Plugin {
solcOutput : contractObject.compiler.data ,
solcOutput : contractObject.compiler.data ,
solcInput : contractObject.compiler.source
solcInput : contractObject.compiler.source
}
}
await this . call ( 'fileManager' , 'writeFile' , ` .deploys/upgradeable-contracts/ ${ networkName } /solc- ${ implementationAddress } .json ` , JSON . stringify ( {
await this . call (
'fileManager' ,
'writeFile' ,
` .deploys/upgradeable-contracts/ ${ networkName } /solc- ${ implementationAddress } .json ` ,
JSON . stringify (
{
solcInput : contractObject.compiler.source ,
solcInput : contractObject.compiler.source ,
solcOutput : contractObject.compiler.data
solcOutput : contractObject.compiler.data
} , null , 2 ) )
} ,
null ,
2
)
)
await this . call ( 'fileManager' , 'writeFile' , ` .deploys/upgradeable-contracts/ ${ networkName } /UUPS.json ` , JSON . stringify ( parsedDeployments , null , 2 ) )
await this . call ( 'fileManager' , 'writeFile' , ` .deploys/upgradeable-contracts/ ${ networkName } /UUPS.json ` , JSON . stringify ( parsedDeployments , null , 2 ) )
} else {
} else {
await this . call ( 'fileManager' , 'writeFile' , ` .deploys/upgradeable-contracts/ ${ networkName } /solc- ${ implementationAddress } .json ` , JSON . stringify ( {
await this . call (
'fileManager' ,
'writeFile' ,
` .deploys/upgradeable-contracts/ ${ networkName } /solc- ${ implementationAddress } .json ` ,
JSON . stringify (
{
solcInput : contractObject.compiler.source ,
solcInput : contractObject.compiler.source ,
solcOutput : contractObject.compiler.data
solcOutput : contractObject.compiler.data
} , null , 2 ) )
} ,
await this . call ( 'fileManager' , 'writeFile' , ` .deploys/upgradeable-contracts/ ${ networkName } /UUPS.json ` , JSON . stringify ( {
null ,
2
)
)
await this . call (
'fileManager' ,
'writeFile' ,
` .deploys/upgradeable-contracts/ ${ networkName } /UUPS.json ` ,
JSON . stringify (
{
id : networkInfo.id ,
id : networkInfo.id ,
network : networkInfo.name ,
network : networkInfo.name ,
deployments : {
deployments : {
@ -357,7 +411,11 @@ export class Blockchain extends Plugin {
implementationAddress : implementationAddress
implementationAddress : implementationAddress
}
}
}
}
} , null , 2 ) )
} ,
null ,
2
)
)
}
}
}
}
@ -386,8 +444,7 @@ export class Blockchain extends Plugin {
data . contractABI = selectedContract . abi
data . contractABI = selectedContract . abi
}
}
this . runTx ( { data : data , useCall : false } , confirmationCb , continueCb , promptCb ,
this . runTx ( { data : data , useCall : false } , confirmationCb , continueCb , promptCb , ( error , txResult , address ) = > {
( error , txResult , address ) = > {
if ( error ) {
if ( error ) {
return finalCb ( ` creation of ${ selectedContract . name } errored: ${ error . message ? error.message : error } ` )
return finalCb ( ` creation of ${ selectedContract . name } errored: ${ error . message ? error.message : error } ` )
}
}
@ -395,8 +452,7 @@ export class Blockchain extends Plugin {
return finalCb ( ` creation of ${ selectedContract . name } errored: transaction execution failed ` )
return finalCb ( ` creation of ${ selectedContract . name } errored: transaction execution failed ` )
}
}
finalCb ( null , selectedContract , address )
finalCb ( null , selectedContract , address )
}
} )
)
}
}
determineGasPrice ( cb ) {
determineGasPrice ( cb ) {
@ -482,7 +538,7 @@ export class Blockchain extends Plugin {
isWeb3Provider() {
isWeb3Provider() {
const isVM = this . executionContext . isVM ( )
const isVM = this . executionContext . isVM ( )
const isInjected = this . getProvider ( ) === 'injected'
const isInjected = this . getProvider ( ) === 'injected'
return ( ! isVM && ! isInjected )
return ! isVM && ! isInjected
}
}
isInjectedWeb3() {
isInjectedWeb3() {
@ -517,7 +573,14 @@ export class Blockchain extends Plugin {
runOrCallContractMethod ( contractName , contractAbi , funABI , contract , value , address , callType , lookupOnly , logMsg , logCallback , outputCb , confirmationCb , continueCb , promptCb ) {
runOrCallContractMethod ( contractName , contractAbi , funABI , contract , value , address , callType , lookupOnly , logMsg , logCallback , outputCb , confirmationCb , continueCb , promptCb ) {
// contractsDetails is used to resolve libraries
// contractsDetails is used to resolve libraries
txFormat . buildData ( contractName , contractAbi , { } , false , funABI , callType , ( error , data ) = > {
txFormat . buildData (
contractName ,
contractAbi ,
{ } ,
false ,
funABI ,
callType ,
( error , data ) = > {
if ( error ) {
if ( error ) {
return logCallback ( ` ${ logMsg } errored: ${ error . message ? error.message : error } ` )
return logCallback ( ` ${ logMsg } errored: ${ error . message ? error.message : error } ` )
}
}
@ -548,12 +611,15 @@ export class Blockchain extends Plugin {
} ,
} ,
( data , runTxCallback ) = > {
( data , runTxCallback ) = > {
// called for libraries deployment
// called for libraries deployment
this . runTx ( data , confirmationCb , runTxCallback , promptCb , ( ) = > { /* Do nothing. */ } )
this . runTx ( data , confirmationCb , runTxCallback , promptCb , ( ) = > {
/* Do nothing. */
} )
} )
}
}
)
}
context() {
context() {
return ( this . executionContext . isVM ( ) ? 'memory' : 'blockchain' )
return this . executionContext . isVM ( ) ? 'memory' : 'blockchain'
}
}
// NOTE: the config is only needed because exectuionContext.init does
// NOTE: the config is only needed because exectuionContext.init does
@ -583,16 +649,29 @@ export class Blockchain extends Plugin {
async resetEnvironment() {
async resetEnvironment() {
await this . getCurrentProvider ( ) . resetEnvironment ( )
await this . getCurrentProvider ( ) . resetEnvironment ( )
// TODO: most params here can be refactored away in txRunner
// TODO: most params here can be refactored away in txRunner
const web3Runner = new TxRunnerWeb3 ( {
const web3Runner = new TxRunnerWeb3 (
{
config : this.config ,
config : this.config ,
detectNetwork : ( cb ) = > {
detectNetwork : ( cb ) = > {
this . executionContext . detectNetwork ( cb )
this . executionContext . detectNetwork ( cb )
} ,
} ,
isVM : ( ) = > { return this . executionContext . isVM ( ) } ,
isVM : ( ) = > {
return this . executionContext . isVM ( )
} ,
personalMode : ( ) = > {
personalMode : ( ) = > {
return this . getProvider ( ) === 'web3' ? this . config . get ( 'settings/personal-mode' ) : false
return this . getProvider ( ) === 'web3' ? this . config . get ( 'settings/personal-mode' ) : false
}
}
} , _ = > this . executionContext . web3 ( ) , _ = > this . executionContext . currentblockGasLimit ( ) )
} ,
// isVM: () => { return this.executionContext.isVM() },
// personalMode: () => {
// return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false
// }
// }, _ => this.executionContext.web3(), _ => this.executionContext.currentblockGasLimit())
( _ ) = > this . executionContext . web3 ( ) ,
( _ ) = > this . executionContext . currentblockGasLimit ( )
)
web3Runner . event . register ( 'transactionBroadcasted' , ( txhash ) = > {
web3Runner . event . register ( 'transactionBroadcasted' , ( txhash ) = > {
this . executionContext . detectNetwork ( ( error , network ) = > {
this . executionContext . detectNetwork ( ( error , network ) = > {
@ -601,10 +680,13 @@ export class Blockchain extends Plugin {
const viewEtherScanLink = etherScanLink ( network . name , txhash )
const viewEtherScanLink = etherScanLink ( network . name , txhash )
if ( viewEtherScanLink ) {
if ( viewEtherScanLink ) {
this . call ( 'terminal' , 'logHtml' ,
this . call (
( < a href = { etherScanLink ( network . name , txhash ) } target = "_blank" >
'terminal' ,
'logHtml' ,
< a href = { etherScanLink ( network . name , txhash ) } target = "_blank" >
view on etherscan
view on etherscan
< / a > ) )
< / a >
)
}
}
} )
} )
} )
} )
@ -659,17 +741,26 @@ export class Blockchain extends Plugin {
this . txRunner . rawRun (
this . txRunner . rawRun (
tx ,
tx ,
( network , tx , gasEstimation , continueTxExecution , cancelCb ) = > { continueTxExecution ( ) } ,
( network , tx , gasEstimation , continueTxExecution , cancelCb ) = > {
( error , continueTxExecution , cancelCb ) = > { if ( error ) { reject ( error ) } else { continueTxExecution ( ) } } ,
continueTxExecution ( )
( okCb , cancelCb ) = > { okCb ( ) } ,
} ,
( error , continueTxExecution , cancelCb ) = > {
if ( error ) {
reject ( error )
} else {
continueTxExecution ( )
}
} ,
( okCb , cancelCb ) = > {
okCb ( )
} ,
async ( error , result ) = > {
async ( error , result ) = > {
if ( error ) return reject ( error )
if ( error ) return reject ( error )
try {
try {
if ( this . executionContext . isVM ( ) ) {
if ( this . executionContext . isVM ( ) ) {
const execResult = await this . web3 ( ) . testPlugin . getExecutionResultFromSimulator ( result . transactionHash )
const execResult = await this . web3 ( ) . testPlugin . getExecutionResultFromSimulator ( result . transactionHash )
resolve ( resultToRemixTx ( result , execResult ) )
resolve ( resultToRemixTx ( result , execResult ) )
} else
} else resolve ( resultToRemixTx ( result ) )
resolve ( resultToRemixTx ( result ) )
} catch ( e ) {
} catch ( e ) {
reject ( e )
reject ( e )
}
}
@ -713,7 +804,10 @@ export class Blockchain extends Plugin {
if ( this . transactionContextAPI . getAddress ) {
if ( this . transactionContextAPI . getAddress ) {
return this . transactionContextAPI . getAddress ( function ( err , address ) {
return this . transactionContextAPI . getAddress ( function ( err , address ) {
if ( err ) return reject ( err )
if ( err ) return reject ( err )
if ( ! address ) return reject ( '"from" is not defined. Please make sure an account is selected. If you are using a public node, it is likely that no account will be provided. In that case, add the public node to your injected provider (type Metamask) and use injected provider in Remix.' )
if ( ! address )
return reject (
'"from" is not defined. Please make sure an account is selected. If you are using a public node, it is likely that no account will be provided. In that case, add the public node to your injected provider (type Metamask) and use injected provider in Remix.'
)
return resolve ( address )
return resolve ( address )
} )
} )
}
}
@ -744,21 +838,39 @@ export class Blockchain extends Plugin {
return
return
}
}
const tx = { to : args.to , data : args.data.dataHex , useCall : args.useCall , from : fromAddress , value : value , gasLimit : gasLimit , timestamp : args.data.timestamp }
const tx = {
const payLoad = { funAbi : args.data.funAbi , funArgs : args.data.funArgs , contractBytecode : args.data.contractBytecode , contractName : args.data.contractName , contractABI : args.data.contractABI , linkReferences : args.data.linkReferences }
to : args.to ,
data : args.data.dataHex ,
useCall : args.useCall ,
from : fromAddress ,
value : value ,
gasLimit : gasLimit ,
timestamp : args.data.timestamp
}
const payLoad = {
funAbi : args.data.funAbi ,
funArgs : args.data.funArgs ,
contractBytecode : args.data.contractBytecode ,
contractName : args.data.contractName ,
contractABI : args.data.contractABI ,
linkReferences : args.data.linkReferences
}
if ( ! tx . timestamp ) tx . timestamp = Date . now ( )
if ( ! tx . timestamp ) tx . timestamp = Date . now ( )
const timestamp = tx . timestamp
const timestamp = tx . timestamp
this . _triggerEvent ( 'initiatingTransaction' , [ timestamp , tx , payLoad ] )
this . _triggerEvent ( 'initiatingTransaction' , [ timestamp , tx , payLoad ] )
try {
try {
this . txRunner . rawRun ( tx , confirmationCb , continueCb , promptCb ,
this . txRunner . rawRun ( tx , confirmationCb , continueCb , promptCb , async ( error , result ) = > {
async ( error , result ) = > {
if ( error ) {
if ( error ) {
if ( typeof ( error ) !== 'string' ) {
if ( typeof error !== 'string' ) {
if ( error . message ) error = error . message
if ( error . message ) error = error . message
else {
else {
try { error = 'error: ' + JSON . stringify ( error ) } catch ( e ) { console . log ( e ) }
try {
error = 'error: ' + JSON . stringify ( error )
} catch ( e ) {
console . log ( e )
}
}
}
}
}
return reject ( error )
return reject ( error )
@ -767,23 +879,26 @@ export class Blockchain extends Plugin {
const isVM = this . executionContext . isVM ( )
const isVM = this . executionContext . isVM ( )
if ( isVM && tx . useCall ) {
if ( isVM && tx . useCall ) {
try {
try {
result . transactionHash = await this . web3 ( ) . testPlugin . getHashFromTagBySimulator ( timestamp )
result . transactionHash = await this . web3 ( ) . eth . getHashFromTagBySimulator ( timestamp )
} catch ( e ) {
} catch ( e ) {
console . log ( 'unable to retrieve back the "call" hash' , e )
console . log ( 'unable to retrieve back the "call" hash' , e )
}
}
}
}
const eventName = ( tx . useCall ? 'callExecuted' : 'transactionExecuted' )
const eventName = tx . useCall ? 'callExecuted' : 'transactionExecuted'
this . _triggerEvent ( eventName , [ error , tx . from , tx . to , tx . data , tx . useCall , result , timestamp , payLoad ] )
this . _triggerEvent ( eventName , [ error , tx . from , tx . to , tx . data , tx . useCall , result , timestamp , payLoad ] )
return resolve ( { result , tx } )
return resolve ( { result , tx } )
}
} )
)
} catch ( err ) {
} catch ( err ) {
let error = err
let error = err
if ( error && ( typeof ( error ) !== 'string' ) ) {
if ( error && typeof error !== 'string' ) {
if ( error . message ) error = error . message
if ( error . message ) error = error . message
else {
else {
try { error = 'error: ' + JSON . stringify ( error ) } catch ( e ) { console . log ( e ) }
try {
error = 'error: ' + JSON . stringify ( error )
} catch ( e ) {
console . log ( e )
}
}
}
}
}
return reject ( error )
return reject ( error )
@ -808,9 +923,12 @@ export class Blockchain extends Plugin {
const hhlogs = await this . web3 ( ) . testPlugin . getHHLogsForTx ( txResult . transactionHash )
const hhlogs = await this . web3 ( ) . testPlugin . getHHLogsForTx ( txResult . transactionHash )
if ( hhlogs && hhlogs . length ) {
if ( hhlogs && hhlogs . length ) {
const finalLogs = < div > < div > < b > console . log : < / b > < / div >
const finalLogs = (
{
< div >
hhlogs . map ( ( log ) = > {
< div >
< b > console . log : < / b >
< / div >
{ hhlogs . map ( ( log ) = > {
let formattedLog
let formattedLog
// Hardhat implements the same formatting options that can be found in Node.js' console.log,
// Hardhat implements the same formatting options that can be found in Node.js' console.log,
// which in turn uses util.format: https://nodejs.org/dist/latest-v12.x/docs/api/util.html#util_util_format_format_args
// which in turn uses util.format: https://nodejs.org/dist/latest-v12.x/docs/api/util.html#util_util_format_format_args
@ -824,13 +942,16 @@ export class Blockchain extends Plugin {
return < div > { formattedLog } < / div >
return < div > { formattedLog } < / div >
} ) }
} ) }
< / div >
< / div >
)
_paq . push ( [ 'trackEvent' , 'udapp' , 'hardhat' , 'console.log' ] )
_paq . push ( [ 'trackEvent' , 'udapp' , 'hardhat' , 'console.log' ] )
this . call ( 'terminal' , 'logHtml' , finalLogs )
this . call ( 'terminal' , 'logHtml' , finalLogs )
}
}
execResult = await this . web3 ( ) . testPlugin . getExecutionResultFromSimulator ( txResult . transactionHash )
execResult = await this . web3 ( ) . testPlugin . getExecutionResultFromSimulator ( txResult . transactionHash )
if ( execResult ) {
if ( execResult ) {
// if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value.
// if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value.
returnValue = execResult ? toBuffer ( execResult . returnValue ) : toBuffer ( addHexPrefix ( txResult . result ) || '0x0000000000000000000000000000000000000000000000000000000000000000' )
returnValue = execResult
? toBuffer ( execResult . returnValue )
: toBuffer ( addHexPrefix ( txResult . result ) || '0x0000000000000000000000000000000000000000000000000000000000000000' )
const compiledContracts = await this . call ( 'compilerArtefacts' , 'getAllContractDatas' )
const compiledContracts = await this . call ( 'compilerArtefacts' , 'getAllContractDatas' )
const vmError = txExecution . checkVMError ( execResult , compiledContracts )
const vmError = txExecution . checkVMError ( execResult , compiledContracts )
if ( vmError . error ) {
if ( vmError . error ) {