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
Conversation
hensha256
commented
Nov 23, 2020
•
edited
edited
- Upgrades contracts to 0.6
- Leaves Alien Codex at 0.5
- Introduces HardHat to enable using multiple compiler versions
There was a problem hiding this 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'; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
There's a couple more things that we should do after removing the Truffle dependency:
|
There was a problem hiding this 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.
* 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>