diff --git a/apps/etherscan/src/app/components/HeaderWithSettings.tsx b/apps/etherscan/src/app/components/HeaderWithSettings.tsx index f0ba96ae6b..14e048d6cd 100644 --- a/apps/etherscan/src/app/components/HeaderWithSettings.tsx +++ b/apps/etherscan/src/app/components/HeaderWithSettings.tsx @@ -18,6 +18,7 @@ interface IconProps { const HomeIcon: React.FC = ({ from, themeType }: IconProps) => { return ( = ({ text, + dataId, isSubmitting = false, }) => { return ( diff --git a/apps/etherscan/src/app/views/CaptureKeyView.tsx b/apps/etherscan/src/app/views/CaptureKeyView.tsx index 2bac179293..9703ec10ff 100644 --- a/apps/etherscan/src/app/views/CaptureKeyView.tsx +++ b/apps/etherscan/src/app/views/CaptureKeyView.tsx @@ -48,7 +48,7 @@ export const CaptureKeyView: React.FC = () => {
- +
)} diff --git a/apps/etherscan/src/app/views/VerifyView.tsx b/apps/etherscan/src/app/views/VerifyView.tsx index 0cf383dc8b..3e85d471b7 100644 --- a/apps/etherscan/src/app/views/VerifyView.tsx +++ b/apps/etherscan/src/app/views/VerifyView.tsx @@ -284,12 +284,12 @@ export const VerifyView: React.FC = ({ /> - + )} -
diff --git a/apps/remix-ide-e2e/src/tests/etherscan_api.ts b/apps/remix-ide-e2e/src/tests/etherscan_api.ts index 719db61972..7089d5b563 100644 --- a/apps/remix-ide-e2e/src/tests/etherscan_api.ts +++ b/apps/remix-ide-e2e/src/tests/etherscan_api.ts @@ -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; + } +}`