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

Update examples and modules #230

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
[dependencies]
odra = { path = "../core", default-features = false }
odra-modules = { path = "../modules", default-features = false }
sha3 = { version = "0.10.6", default-features = false }

[dev-dependencies]
hex = "0.4.3"
Expand Down
8 changes: 8 additions & 0 deletions examples/Odra.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,11 @@ fqn = "odra_examples::features::modules::ModulesContract"
[[contracts]]
name = "public_wallet"
fqn = "odra_examples::features::native_token::PublicWallet"

[[contracts]]
name = "mock_moderated"
fqn = "odra_examples::features::access_control::MockModerated"

[[contracts]]
name = "pauseable_counter"
fqn = "odra_examples::features::pauseable::PauseableCounter"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use odra::{contract_env, types::Address};
use sha3::{Digest, Keccak256};

use crate::access::{AccessControl, Role, DEFAULT_ADMIN_ROLE};
use odra_modules::access::{AccessControl, Role, DEFAULT_ADMIN_ROLE};

pub const ROLE_MODERATOR: &str = "moderator";
pub const ROLE_MODERATOR_ADMIN: &str = "moderator_admin";
Expand Down Expand Up @@ -75,13 +75,14 @@ pub fn keccak_256(input: &str) -> Role {

#[cfg(test)]
pub mod test {
use super::{MockModeratedDeployer, MockModeratedRef, ROLE_MODERATOR, ROLE_MODERATOR_ADMIN};
use crate::access::{
use super::{
keccak_256, MockModeratedDeployer, MockModeratedRef, ROLE_MODERATOR, ROLE_MODERATOR_ADMIN
};
use odra::{assert_events, test_env, types::Address};
use odra_modules::access::{
errors::Error,
events::{RoleGranted, RoleRevoked}
};
use crate::mock::access_control::keccak_256;
use odra::{assert_events, test_env, types::Address};

#[test]
fn deploy_works() {
Expand Down
2 changes: 2 additions & 0 deletions examples/src/features/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod access_control;
pub mod collecting_events;
pub mod composer;
pub mod cross_calls;
Expand All @@ -8,6 +9,7 @@ pub mod module_nesting;
pub mod modules;
pub mod native_token;
pub mod nested_mapping;
pub mod pauseable;
pub mod reentrancy_guard;
pub mod signature_verifier;
pub mod storage;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use odra::Variable;

use crate::security::Pauseable;
use odra_modules::security::Pauseable;

#[odra::module]
pub struct PauseableCounter {
Expand Down Expand Up @@ -42,11 +42,11 @@ impl PauseableCounter {
#[cfg(test)]
mod test {
use super::PauseableCounterDeployer;
use crate::security::{
use odra::{assert_events, test_env};
use odra_modules::security::{
errors::Error,
events::{Paused, Unpaused}
};
use odra::{assert_events, test_env};

#[test]
fn pause_works() {
Expand Down
1 change: 0 additions & 1 deletion modules/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ categories = ["wasm"]
[dependencies]
odra = { path = "../core", version = "0.6.0", default-features = false }
hex = { version = "0.4.3", default-features = false }
sha3 = { version = "0.10.6", default-features = false }

[features]
default = [ "mock-vm" ]
Expand Down
7 changes: 0 additions & 7 deletions modules/Odra.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,3 @@ fqn = "odra_modules::access::Ownable"
name = "ownable2_step"
fqn = "odra_modules::access::Ownable2Step"

[[contracts]]
name = "mock_moderated"
fqn = "odra_modules::mock::MockModerated"

[[contracts]]
name = "pauseable_counter"
fqn = "odra_modules::mock::PauseableCounter"
2 changes: 0 additions & 2 deletions modules/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ pub mod erc20;
pub mod erc721;
pub mod erc721_receiver;
pub mod erc721_token;
#[doc(hidden)]
pub mod mock;
pub mod security;
pub mod wrapped_native;
5 changes: 0 additions & 5 deletions modules/src/mock/mod.rs

This file was deleted.