|
|
|
@ -19,6 +19,89 @@ module.exports = { |
|
|
|
|
.pause(5000) |
|
|
|
|
// @ts-ignore
|
|
|
|
|
.frame(0) |
|
|
|
|
.waitForElementNotVisible('input[name="apiKey"]') |
|
|
|
|
}
|
|
|
|
|
.waitForElementVisible('input[name="apiKey"]') |
|
|
|
|
.setValue('input[name="apiKey"]', '2HKUX5ZVASZIKWJM8MIQVCRUVZ6JAWT531') |
|
|
|
|
.click('[data-id="save-api-key"]') |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
'Should verify a contract (contract is already verified) #group1': function (browser: NightwatchBrowser) { |
|
|
|
|
browser |
|
|
|
|
.frameParent() |
|
|
|
|
.clickLaunchIcon('udapp') // switch to Goerli
|
|
|
|
|
.switchEnvironment('External Http Provider') |
|
|
|
|
.waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') |
|
|
|
|
.execute(() => { |
|
|
|
|
(document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() |
|
|
|
|
}, [], () => {}) |
|
|
|
|
.setValue('[data-id="modalDialogCustomPromp"]', 'https://remix-goerli.ethdevops.io') |
|
|
|
|
.modalFooterOKClick('basic-http-provider') |
|
|
|
|
.clickLaunchIcon('solidity') // compile
|
|
|
|
|
.testContracts('Owner_1.sol', { content: verifiedContract }, ['Owner']) |
|
|
|
|
.clickLaunchIcon('etherscan') // start etherscan verification
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
.frame(0) |
|
|
|
|
.click('[data-id="home"]') |
|
|
|
|
.setValue('select[name="contractName"]', 'Owner') |
|
|
|
|
.setValue('*[name="contractAddress"]', '0x9981c9d00103da481c3c65b22a79582a3e3ff50b') |
|
|
|
|
.click('[data-id="verify-contract"]') |
|
|
|
|
.waitForElementVisible('[data-id="verify-result"]') |
|
|
|
|
.waitForElementContainsText('[data-id="verify-result"]', 'Contract source code already verified') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const verifiedContract = ` |
|
|
|
|
// SPDX-License-Identifier: GPL-3.0
|
|
|
|
|
|
|
|
|
|
pragma solidity >=0.7.0 <0.9.0; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @title Owner |
|
|
|
|
* @dev Set & change owner |
|
|
|
|
*/ |
|
|
|
|
contract Owner { |
|
|
|
|
|
|
|
|
|
address private owner; |
|
|
|
|
|
|
|
|
|
// event for EVM logging
|
|
|
|
|
event OwnerSet(address indexed oldOwner, address indexed newOwner); |
|
|
|
|
|
|
|
|
|
// modifier to check if caller is owner
|
|
|
|
|
modifier isOwner() { |
|
|
|
|
// If the first argument of 'require' evaluates to 'false', execution terminates and all
|
|
|
|
|
// changes to the state and to Ether balances are reverted.
|
|
|
|
|
// This used to consume all gas in old EVM versions, but not anymore.
|
|
|
|
|
// It is often a good idea to use 'require' to check if functions are called correctly.
|
|
|
|
|
// As a second argument, you can also provide an explanation about what went wrong.
|
|
|
|
|
require(msg.sender == owner, "Caller is not owner"); |
|
|
|
|
_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getInt() public returns (uint) { |
|
|
|
|
return 123498; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Set contract deployer as owner |
|
|
|
|
*/ |
|
|
|
|
constructor() { |
|
|
|
|
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
|
|
|
|
|
emit OwnerSet(address(0), owner); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Change owner |
|
|
|
|
* @param newOwner address of new owner |
|
|
|
|
*/ |
|
|
|
|
function changeOwner(address newOwner) public isOwner { |
|
|
|
|
emit OwnerSet(owner, newOwner); |
|
|
|
|
owner = newOwner; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @dev Return owner address
|
|
|
|
|
* @return address of owner |
|
|
|
|
*/ |
|
|
|
|
function getOwner() external view returns (address) { |
|
|
|
|
return owner; |
|
|
|
|
} |
|
|
|
|
}` |
|
|
|
|