-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
An attepmt of re-implementing `Ownable.sol` from the Open Zeppelin directly in ink!
- Loading branch information
Showing
11 changed files
with
110 additions
and
232 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Ignore build artifacts from the local tests sub-crate. | ||
/target/ | ||
|
||
# Ignore backup files creates by cargo fmt. | ||
**/*.rs.bk | ||
|
||
# Remove Cargo.lock when creating an executable, leave it for libraries | ||
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock | ||
Cargo.lock |
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,35 @@ | ||
[package] | ||
name = "tko_interfaces" | ||
version = "0.1.0" | ||
authors = ["[your_name] <[your_email]>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
ink_primitives = { version = "3.0.0-rc3", default-features = false } | ||
ink_metadata = { version = "3.0.0-rc3", default-features = false, features = ["derive"], optional = true } | ||
ink_env = { version = "3.0.0-rc3", default-features = false } | ||
ink_storage = { version = "3.0.0-rc3", default-features = false } | ||
ink_lang = { version = "3.0.0-rc3", default-features = false } | ||
|
||
scale = { package = "parity-scale-codec", version = "2.1", default-features = false, features = ["derive"] } | ||
scale-info = { version = "0.6.0", default-features = false, features = ["derive"], optional = true } | ||
|
||
[lib] | ||
name = "tko_interfaces" | ||
path = "lib.rs" | ||
crate-type = [ | ||
# Used for normal contract Wasm blobs. | ||
"cdylib", | ||
] | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"ink_metadata/std", | ||
"ink_env/std", | ||
"ink_storage/std", | ||
"ink_primitives/std", | ||
"scale/std", | ||
"scale-info/std", | ||
] | ||
ink-as-dependency = [] |
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,36 @@ | ||
use ink_lang as ink; | ||
use ink_env::AccountId; | ||
|
||
#[ink::trait_definition] | ||
pub trait IsOwnable { | ||
// fn initialize(&mut self); | ||
// | ||
// #[ink(message)] | ||
// fn owner(&self) -> Option<Address>; | ||
// | ||
// #[ink(message)] | ||
// fn renounce_ownership(&mut self) { | ||
// self._only_owner(); | ||
// self._set_owner(None); | ||
// } | ||
// | ||
// #[ink(message)] | ||
// fn transfer_ownership(&mut self, new_owner: Address) { | ||
// self._only_owner(); | ||
// self._set_owner(Some(new_owner)); | ||
// } | ||
|
||
/// Tells if the message sender is the owner | ||
#[ink(message)] | ||
fn owner(&self) -> AccountId; | ||
// fn _only_owner(&self) { | ||
// match self.owner() { | ||
// Some(owner) => assert!(owner == self.message_sender(), "Ownable: caller is not the owner"), | ||
// None => panic!("Ownable: caller is not the owner") | ||
// } | ||
// } | ||
// | ||
// fn _set_owner(&mut self, new_owner: Option<Address>); | ||
|
||
// fn _message_sender(&self) -> Address; | ||
} |
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 @@ | ||
pub mod access; |
Oops, something went wrong.