-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Make
Ownable2Step
Module-Friendly (#219)
### 🕓 Changelog This PR refactors the `Ownable2Step` contract to make it module-friendly and ready for the breaking `0.4.0` release. Furthermore, I enhance the `VyperDeployer` to display an informative message if the locally installed Vyper version is not compatible with the Vyper contract to be compiled. --------- Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
- Loading branch information
1 parent
ac7f64f
commit 87cabde
Showing
7 changed files
with
761 additions
and
636 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# pragma version ~=0.4.0b5 | ||
""" | ||
@title Ownable2Step Module Reference Implementation | ||
@custom:contract-name Ownable2StepMock | ||
@license GNU Affero General Public License v3.0 only | ||
@author pcaversaccio | ||
""" | ||
|
||
|
||
# @dev We import and initialise the `Ownable` module. | ||
from .. import Ownable as ow | ||
initializes: ow | ||
|
||
|
||
# @dev We import and initialise the `Ownable2Step` module. | ||
from .. import Ownable2Step as o2 | ||
initializes: o2[ownable := ow] | ||
|
||
|
||
# @dev We export (i.e. the runtime bytecode exposes these | ||
# functions externally, allowing them to be called using | ||
# the ABI encoding specification) all `external` functions | ||
# from the `Ownable2Step` module. | ||
# @notice Please note that you must always also export (if | ||
# required by the contract logic) `public` declared `constant`, | ||
# `immutable`, and state variables, for which Vyper automatically | ||
# generates an `external` getter function for the variable. | ||
exports: ( | ||
o2.owner, | ||
o2.pending_owner, | ||
o2.transfer_ownership, | ||
o2.accept_ownership, | ||
o2.renounce_ownership, | ||
) | ||
|
||
|
||
@deploy | ||
@payable | ||
def __init__(): | ||
""" | ||
@dev To omit the opcodes for checking the `msg.value` | ||
in the creation-time EVM bytecode, the constructor | ||
is declared as `payable`. | ||
@notice The `owner` role will be assigned to | ||
the `msg.sender`. | ||
""" | ||
# The following line assigns the `owner` | ||
# to the `msg.sender`. | ||
ow.__init__() | ||
o2.__init__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters