-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: compile contracts even when uninitialized
- Loading branch information
1 parent
315400e
commit 5871c8c
Showing
6 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
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,17 @@ | ||
# pragma version ^0.4.0 | ||
|
||
# Not export to importing module? | ||
owner: public(address) | ||
|
||
@deploy | ||
def __init__(): | ||
self.owner = msg.sender | ||
|
||
def _check_owner(): | ||
assert self.owner == msg.sender | ||
|
||
# Must be exported by importing module | ||
@external | ||
def set_owner(owner: address): | ||
self._check_owner() | ||
self.owner = owner |
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,16 @@ | ||
# pragma version ^0.4.0 | ||
|
||
import auth | ||
import UninitializedAuth | ||
|
||
initializes: auth | ||
# auth is dependency of auth_2_step | ||
initializes: UninitializedAuth[auth := auth] | ||
|
||
# export all external functions | ||
exports: UninitializedAuth.__interface__ | ||
|
||
@deploy | ||
def __init__(): | ||
auth.__init__() | ||
UninitializedAuth.__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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# pragma version ^0.4.0 | ||
import auth | ||
|
||
# This contract is not a valid contract. auth.__init__() must be called | ||
# by a contract that imports and uses this contract | ||
|
||
uses: auth | ||
|
||
pending_owner: address | ||
|
||
@deploy | ||
def __init__(): | ||
pass | ||
|
||
@external | ||
def begin_transfer(new_owner: address): | ||
auth._check_owner() | ||
self.pending_owner = new_owner | ||
|
||
@external | ||
def accept_transfer(): | ||
assert msg.sender == self.pending_owner | ||
auth.owner = msg.sender | ||
self.pending_owner = empty(address) |