Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Solidity 06 #186

Merged
merged 22 commits into from Dec 1, 2020
Merged

Upgrade to Solidity 06 #186

merged 22 commits into from Dec 1, 2020

Conversation

hensha256
Copy link
Contributor

@hensha256 hensha256 commented Nov 23, 2020

  • Upgrades contracts to 0.6
  • Leaves Alien Codex at 0.5
  • Introduces HardHat to enable using multiple compiler versions

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

Is it a problem for users who are in the middle of a game if we deploy a new version (with the new Solidity version) of that game? I'm thinking it's fine because the contract ABI remains the same.

import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import '../helpers/Ownable-05.sol';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can install a previous version of OZ Contracts under a different name:

npm install -D openzeppelin-contracts-2.5@npm:@openzeppelin/contracts@2.5.0

Later:

import 'openzeppelin-contracts-2.5/ownership/Ownable.sol';

Do you think this would be better than vendoring the Ownable contract?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah I didnt know that. The Ownable contract was also breaking the game because it emits an event in the constructor - do you know if there was an 0.5 version that didnt do that? The game definitely used to work so I'm wondering how that was

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ownable emits an event in the constructor since the contracts were for solidity 0.4.

So wait is the level working as intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The level works with this Ownable-05 because I removed the event from the constructor. I could use the official OZ 05 Ownable and figure out a work around into the front end if you prefer?

gamedata/gamedata.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
scripts/transfer_money.js Outdated Show resolved Hide resolved
gamedata/deploy.rinkeby.json Outdated Show resolved Hide resolved
@frangio
Copy link
Contributor

frangio commented Nov 25, 2020

There's a couple more things that we should do after removing the Truffle dependency:

  • Update package-lock.json by running npm install.
  • Remove the migrations directory.
  • Update the README.md instructions which mention Truffle.

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Now that Hardhat is in place we should at some point get rid of all of the custom network handling code, web3 initialization, etc, and use what comes built in to Hardhat as much as possible.

@hensha256 hensha256 merged commit a8bec38 into master Dec 1, 2020
@hensha256 hensha256 deleted the solidity-06 branch December 1, 2020 14:35
CeliktepeMurat pushed a commit to CeliktepeMurat/ethernaut that referenced this pull request Jan 9, 2023
* package versions, and pragma 0.6

* 0.6 fallbacks, virtual, override

* hardhat addition to support old levels

* personalise artifacts

* most of deployment working with hardhat

* updating front end for solidity 0.6

* Fixed Alient Codex interaction

* removing ES6 syntax

* removing unnecessary script

* updated package lock

* updating test command to use hardhat

* adding stack traces to debug CI

* updating node from 9 to 10

* adding netlify build commands to the repo

* Update package.json

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>

* removing unneeded script

* removing truffle

* going back to old Ethernaut instance

* removing truffle from package lock

* removing truffle entirely

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants