Skip to content

Commit 2df27fe

Browse files
authored
Merge branch 'master' into allow-url-language-selection
2 parents efc93ab + 81da09d commit 2df27fe

File tree

94 files changed

+34222
-1824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+34222
-1824
lines changed

apps/debugger/src/app/debugger-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const DebuggerApiMixin = (Base) => class extends Base {
8383
const target = (address && remixDebug.traceHelper.isContractCreation(address)) ? receipt.contractAddress : address
8484
const targetAddress = target || receipt.contractAddress || receipt.to
8585
const codeAtAddress = await this._web3.eth.getCode(targetAddress)
86-
const output = await this.call('fetchAndCompile', 'resolve', targetAddress, codeAtAddress, 'browser/.debug')
86+
const output = await this.call('fetchAndCompile', 'resolve', targetAddress, codeAtAddress, '.debug')
8787
if (output) {
8888
return new CompilerAbstract(output.languageversion, output.data, output.source)
8989
}

apps/remix-ide-e2e/src/tests/defaultLayout.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ module.exports = {
5050

5151
'Toggles Terminal': function (browser: NightwatchBrowser) {
5252
browser.waitForElementVisible('div[data-id="terminalContainer"]')
53-
.assert.elementPresent('div[data-id="terminalContainerDisplay"]')
53+
.assert.elementPresent('div[data-id="terminalCli"]')
54+
.assert.elementPresent('div[data-id="terminalContainer"]')
55+
.waitForElementVisible('div[data-id="terminalContainer"]')
56+
.waitForElementVisible('div[data-id="terminalCli"]')
5457
.click('i[data-id="terminalToggleIcon"]')
5558
.checkElementStyle('div[data-id="terminalToggleMenu"]', 'height', '35px')
59+
.assert.not.elementPresent('div[data-id="terminalCli"]')
5660
.click('i[data-id="terminalToggleIcon"]')
57-
.assert.elementPresent('div[data-id="terminalContainerDisplay"]')
61+
.waitForElementVisible('div[data-id="terminalCli"]')
5862
},
5963

6064
'Switch Tabs using tabs icon': function (browser: NightwatchBrowser) {

apps/remix-ide-e2e/src/tests/generalSettings.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
2020
.waitForElementVisible('*[data-id="settingsTabGenerateContractMetadataLabel"]', 5000)
2121
.verify.elementPresent('[data-id="settingsTabGenerateContractMetadata"]:checked')
22-
.click('*[data-id="verticalIconsFileExplorerIcons"]')
22+
.click('*[data-id="verticalIconsKindfilePanel"]')
2323
.click('[data-id="treeViewLitreeViewItemcontracts"]')
2424
.openFile('contracts/3_Ballot.sol')
2525
.click('*[data-id="verticalIconsKindsolidity"]')

apps/remix-ide-e2e/src/tests/plugin_api.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ module.exports = {
149149
await clickAndCheckLog(browser, 'udapp:getAccounts', '0x5B38Da6a701c568545dCfcB03FcB875f56beddC4', null, null)
150150
},
151151

152+
'Should select another provider #group1': async function (browser: NightwatchBrowser) {
153+
await clickAndCheckLog(browser, 'udapp:setEnvironmentMode', null, null, { context: 'vm', fork: 'berlin' })
154+
await browser
155+
.frameParent()
156+
.useCss()
157+
.clickLaunchIcon('udapp')
158+
.waitForElementContainsText('#selectExEnvOptions option:checked', 'JavaScript VM (Berlin)')
159+
.clickLaunchIcon('localPlugin')
160+
.useXpath()
161+
// @ts-ignore
162+
.frame(0)
163+
},
152164
// context menu item
153165

154166
'Should create context menu item #group1': async function (browser: NightwatchBrowser) {

apps/remix-ide-e2e/src/tests/transactionExecution.test.ts

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,26 @@ module.exports = {
195195
.journalLastChildIncludes('"documentation": "param2 from library"')
196196
.journalLastChildIncludes('"documentation": "param3 from library"')
197197
.journalLastChildIncludes('Debug the transaction to get more information.')
198+
},
199+
200+
'Should compile and deploy 2 simple contracts, the contract creation component state should be correctly reset for the deployment of the second contract #group4': function (browser: NightwatchBrowser) {
201+
browser
202+
.addFile('Storage.sol', sources[6]['Storage.sol'])
203+
.addFile('Owner.sol', sources[6]['Owner.sol'])
204+
.clickLaunchIcon('udapp')
205+
.createContract('42')
206+
.openFile('Storage.sol')
207+
.clickLaunchIcon('udapp')
208+
.createContract('') // this creation will fail if the component hasn't been properly reset.
209+
.clickInstance(1)
210+
.clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '24' })
211+
.testFunction('last', // we check if the contract is actually reachable.
212+
{
213+
status: 'true Transaction mined and execution succeed',
214+
'decoded input': {
215+
'uint256 num': '24'
216+
}
217+
})
198218
.end()
199219
}
200220
}
@@ -322,5 +342,92 @@ contract C {
322342
}
323343
}`
324344
}
345+
},
346+
{
347+
'Owner.sol': {
348+
content: `
349+
// SPDX-License-Identifier: GPL-3.0
350+
351+
pragma solidity >=0.7.0 <0.9.0;
352+
353+
/**
354+
* @title Owner
355+
* @dev Set & change owner
356+
*/
357+
contract Owner {
358+
359+
address private owner;
360+
361+
// event for EVM logging
362+
event OwnerSet(address indexed oldOwner, address indexed newOwner);
363+
364+
// modifier to check if caller is owner
365+
modifier isOwner() {
366+
// If the first argument of 'require' evaluates to 'false', execution terminates and all
367+
// changes to the state and to Ether balances are reverted.
368+
// This used to consume all gas in old EVM versions, but not anymore.
369+
// It is often a good idea to use 'require' to check if functions are called correctly.
370+
// As a second argument, you can also provide an explanation about what went wrong.
371+
require(msg.sender == owner, "Caller is not owner");
372+
_;
373+
}
374+
375+
/**
376+
* @dev Set contract deployer as owner
377+
*/
378+
constructor(uint p) {
379+
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
380+
emit OwnerSet(address(0), owner);
381+
}
382+
383+
/**
384+
* @dev Change owner
385+
* @param newOwner address of new owner
386+
*/
387+
function changeOwner(address newOwner) public isOwner {
388+
emit OwnerSet(owner, newOwner);
389+
owner = newOwner;
390+
}
391+
392+
/**
393+
* @dev Return owner address
394+
* @return address of owner
395+
*/
396+
function getOwner() external view returns (address) {
397+
return owner;
398+
}
399+
}`
400+
},
401+
'Storage.sol': {
402+
content: `
403+
// SPDX-License-Identifier: GPL-3.0
404+
405+
pragma solidity >=0.7.0 <0.9.0;
406+
407+
/**
408+
* @title Storage
409+
* @dev Store & retrieve value in a variable
410+
*/
411+
contract Storage {
412+
413+
uint256 number;
414+
415+
/**
416+
* @dev Store value in variable
417+
* @param num value to store
418+
*/
419+
function store(uint256 num) public {
420+
number = num;
421+
}
422+
423+
/**
424+
* @dev Return value
425+
* @return value of 'number'
426+
*/
427+
function retrieve() public view returns (uint256){
428+
return number;
429+
}
430+
}`
431+
}
325432
}
326433
]

apps/remix-ide/src/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ class AppComponent {
225225
self.engine.register([appPanel, tabProxy])
226226

227227
// those views depend on app_manager
228-
self.menuicons = new VerticalIcons(appManager)
229-
self.sidePanel = new SidePanel(appManager, self.menuicons)
228+
self.menuicons = new VerticalIcons()
229+
self.sidePanel = new SidePanel()
230230
self.hiddenPanel = new HiddenPanel()
231231

232232
const pluginManagerComponent = new PluginManagerComponent(

apps/remix-ide/src/app/components/panel.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ export class AbstractPanel extends HostPlugin {
4949
* @param {String} name The name of the plugin to display the content
5050
*/
5151
showContent (name) {
52-
if (!this.plugins[name]) throw new Error(`Plugin ${name} is not yet activated`)
53-
52+
if (!this.plugins[name]) throw new Error(`Plugin ${name} is not yet activated`)
5453
Object.values(this.plugins).forEach(plugin => {
5554
plugin.active = false
5655
})

apps/remix-ide/src/app/components/side-panel.tsx

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import ReactDOM from 'react-dom'
44
import { AbstractPanel } from './panel'
55
import { RemixPluginPanel } from '@remix-ui/panel'
66
import packageJson from '../../../../../package.json'
7-
import { RemixAppManager } from '../../remixAppManager'
8-
import { VerticalIcons } from 'libs/remix-ui/vertical-icons-panel/types/vertical-icons-panel'
97
import RemixUIPanelHeader from 'libs/remix-ui/panel/src/lib/plugins/panel-header'
108
// const csjs = require('csjs-inject')
119

@@ -17,20 +15,18 @@ const sidePanel = {
1715
methods: ['addView', 'removeView']
1816
}
1917

20-
// TODO merge with vertical-icons.js
2118
export class SidePanel extends AbstractPanel {
22-
appManager: RemixAppManager
2319
sideelement: any
24-
verticalIcons: VerticalIcons;
25-
constructor (appManager: RemixAppManager, verticalIcons: VerticalIcons) {
20+
constructor() {
2621
super(sidePanel)
27-
this.appManager = appManager
2822
this.sideelement = document.createElement('section')
2923
this.sideelement.setAttribute('class', 'panel plugin-manager')
30-
this.verticalIcons = verticalIcons
24+
}
3125

26+
onActivation() {
27+
this.renderComponent()
3228
// Toggle content
33-
verticalIcons.events.on('toggleContent', (name) => {
29+
this.on('menuicons', 'toggleContent', (name) => {
3430
if (!this.plugins[name]) return
3531
if (this.plugins[name].active) {
3632
// TODO: Only keep `this.emit` (issue#2210)
@@ -44,7 +40,7 @@ export class SidePanel extends AbstractPanel {
4440
this.events.emit('showing', name)
4541
})
4642
// Force opening
47-
verticalIcons.events.on('showContent', (name) => {
43+
this.on('menuicons', 'showContent', (name) => {
4844
if (!this.plugins[name]) return
4945
this.showContent(name)
5046
// TODO: Only keep `this.emit` (issue#2210)
@@ -53,43 +49,40 @@ export class SidePanel extends AbstractPanel {
5349
})
5450
}
5551

56-
onActivation () {
57-
this.renderComponent()
58-
}
59-
60-
focus (name) {
52+
focus(name) {
6153
this.emit('focusChanged', name)
6254
super.focus(name)
6355
}
6456

65-
removeView (profile) {
57+
removeView(profile) {
58+
if (this.plugins[profile.name].active) this.call('menuicons', 'select', 'filePanel')
6659
super.removeView(profile)
6760
this.emit('pluginDisabled', profile.name)
6861
this.call('menuicons', 'unlinkContent', profile)
6962
this.renderComponent()
7063
}
7164

72-
addView (profile, view) {
65+
addView(profile, view) {
7366
super.addView(profile, view)
74-
this.verticalIcons.linkContent(profile)
67+
this.call('menuicons', 'linkContent', profile)
7568
this.renderComponent()
7669
}
7770

7871
/**
7972
* Display content and update the header
8073
* @param {String} name The name of the plugin to display
8174
*/
82-
async showContent (name) {
75+
async showContent(name) {
8376
super.showContent(name)
8477
this.emit('focusChanged', name)
8578
this.renderComponent()
8679
}
8780

88-
render () {
81+
render() {
8982
return this.sideelement
9083
}
9184

92-
renderComponent () {
93-
ReactDOM.render(<RemixPluginPanel header={<RemixUIPanelHeader plugins={this.plugins}></RemixUIPanelHeader>} plugins={this.plugins}/>, this.sideelement)
85+
renderComponent() {
86+
ReactDOM.render(<RemixPluginPanel header={<RemixUIPanelHeader plugins={this.plugins}></RemixUIPanelHeader>} plugins={this.plugins} />, this.sideelement)
9487
}
9588
}

0 commit comments

Comments
 (0)