|
|
|
@ -95,6 +95,49 @@ module.exports = { |
|
|
|
|
status: 'true Transaction mined and execution succeed', |
|
|
|
|
'decoded input': { 'uint256 _po': '10' } |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
'Run with live "mode"': function (browser: NightwatchBrowser) { |
|
|
|
|
let addressRef: string |
|
|
|
|
browser.addFile('scenario_live_mode.json', { content: JSON.stringify(liveModeScenario, null, '\t') }) |
|
|
|
|
.addFile('scenario_live_mode_storage.sol', { content: testStorageForLiveMode }) |
|
|
|
|
.clickLaunchIcon('solidity') |
|
|
|
|
.click('*[data-id="compilerContainerCompileBtn"]') |
|
|
|
|
.openFile('scenario_live_mode.json') |
|
|
|
|
.clickLaunchIcon('udapp') |
|
|
|
|
.click('*[data-id="deployAndRunClearInstances"]') |
|
|
|
|
.click('i.runtransaction') |
|
|
|
|
.pause(1000) |
|
|
|
|
.clickInstance(0) |
|
|
|
|
.getAddressAtPosition(0, (address) => { |
|
|
|
|
addressRef = address |
|
|
|
|
}) |
|
|
|
|
.clickFunction('retrieve - call') |
|
|
|
|
.perform((done) => { |
|
|
|
|
browser.verifyCallReturnValue(addressRef, ['', '0:uint256: 350']) |
|
|
|
|
.perform(() => done()) |
|
|
|
|
}) |
|
|
|
|
// change the init state and recompile the same contract.
|
|
|
|
|
.openFile('scenario_live_mode_storage.sol') |
|
|
|
|
.setEditorValue(testStorageForLiveMode.replace('number = 350', 'number = 300')) |
|
|
|
|
.pause(5000) |
|
|
|
|
.clickLaunchIcon('solidity') |
|
|
|
|
.click('*[data-id="compilerContainerCompileBtn"]') |
|
|
|
|
.openFile('scenario_live_mode.json') |
|
|
|
|
.clickLaunchIcon('udapp') |
|
|
|
|
.click('*[data-id="deployAndRunClearInstances"]') |
|
|
|
|
.click('i.runtransaction') |
|
|
|
|
.pause(5000) |
|
|
|
|
.clickInstance(0) |
|
|
|
|
.getAddressAtPosition(0, (address) => { |
|
|
|
|
addressRef = address |
|
|
|
|
}) |
|
|
|
|
.clickFunction('retrieve - call') |
|
|
|
|
.perform((done) => { |
|
|
|
|
browser.verifyCallReturnValue(addressRef, ['', '0:uint256: 300']) |
|
|
|
|
.perform(() => done()) |
|
|
|
|
}) |
|
|
|
|
.end() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -364,3 +407,92 @@ const scenario = { |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const liveModeScenario = { |
|
|
|
|
"accounts": { |
|
|
|
|
"account{0}": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4" |
|
|
|
|
}, |
|
|
|
|
"linkReferences": {}, |
|
|
|
|
"live": true, |
|
|
|
|
"transactions": [ |
|
|
|
|
{ |
|
|
|
|
"timestamp": 1656329164297, |
|
|
|
|
"record": { |
|
|
|
|
"value": "0", |
|
|
|
|
"parameters": [], |
|
|
|
|
"abi": "0x8b8c9c14c8e1442e90dd6ff82bb9889ccfe5a54d88ef30776f11047ecce5fedb", |
|
|
|
|
"contractName": "Storage", |
|
|
|
|
"bytecode": "608060405234801561001057600080fd5b5060c88061001f6000396000f3fe6080604052348015600f57600080fd5b5060043610604e577c010000000000000000000000000000000000000000000000000000000060003504632e64cec1811460535780636057361d146068575b600080fd5b60005460405190815260200160405180910390f35b60786073366004607a565b600055565b005b600060208284031215608b57600080fd5b503591905056fea264697066735822122091f1bc250ccda7caf2b0d9f67b0314d92233fdb5952b72cece72bd2a5d43cfc264736f6c63430008070033", |
|
|
|
|
"linkReferences": {}, |
|
|
|
|
"name": "", |
|
|
|
|
"inputs": "()", |
|
|
|
|
"type": "constructor", |
|
|
|
|
"from": "account{0}" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"abis": { |
|
|
|
|
"0x8b8c9c14c8e1442e90dd6ff82bb9889ccfe5a54d88ef30776f11047ecce5fedb": [ |
|
|
|
|
{ |
|
|
|
|
"inputs": [ |
|
|
|
|
{ |
|
|
|
|
"internalType": "uint256", |
|
|
|
|
"name": "num", |
|
|
|
|
"type": "uint256" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"name": "store", |
|
|
|
|
"outputs": [], |
|
|
|
|
"stateMutability": "nonpayable", |
|
|
|
|
"type": "function" |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"inputs": [], |
|
|
|
|
"name": "retrieve", |
|
|
|
|
"outputs": [ |
|
|
|
|
{ |
|
|
|
|
"internalType": "uint256", |
|
|
|
|
"name": "", |
|
|
|
|
"type": "uint256" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"stateMutability": "view", |
|
|
|
|
"type": "function" |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const testStorageForLiveMode = `// SPDX-License-Identifier: GPL-3.0
|
|
|
|
|
|
|
|
|
|
pragma solidity >=0.7.0 <0.9.0; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @title Storage |
|
|
|
|
* @dev Store & retrieve value in a variable |
|
|
|
|
* @custom:dev-run-script ./scripts/deploy_with_ethers.ts |
|
|
|
|
*/ |
|
|
|
|
contract Storage { |
|
|
|
|
|
|
|
|
|
uint256 number; |
|
|
|
|
|
|
|
|
|
constructor () { |
|
|
|
|
number = 350; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Store value in variable |
|
|
|
|
* @param num value to store |
|
|
|
|
*/ |
|
|
|
|
function store(uint256 num) public { |
|
|
|
|
number = num; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return value
|
|
|
|
|
* @return value of 'number' |
|
|
|
|
*/ |
|
|
|
|
function retrieve() public view returns (uint256){ |
|
|
|
|
return number; |
|
|
|
|
} |
|
|
|
|
}` |
|
|
|
|