Skip to content

Commit

Permalink
Merge pull request #123 from Supercolony-net/release/release-1.8.0
Browse files Browse the repository at this point in the history
Release v1.8.0
  • Loading branch information
xgreenx authored Jun 1, 2022
2 parents 69db735 + cbdc74a commit dc666f0
Show file tree
Hide file tree
Showing 296 changed files with 1,552 additions and 1,425 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
yarn build:release
- name: Run Test Mocha
run: |
substrate-contracts-node --tmp --dev & P1=$!
yarn test:mocha & P2=$!
wait $P2
kill $P1
for test in tests/**/*.ts; do
substrate-contracts-node --tmp --dev & P1=$!;
yarn test:mocha-single ./$test;
kill $P1;
done
4 changes: 2 additions & 2 deletions .github/workflows/github_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '16.x'
- name: Test Build
run: |
cd docs
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '16.x'
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }}
Expand Down
68 changes: 47 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[workspace]
members = [
"contracts",
"utils/brush_lang",
"utils/brush_derive",
"lang",
]

exclude = [
Expand All @@ -12,39 +11,66 @@ exclude = [
]

[package]
name = "brush"
version = "1.7.1"
name = "openbrush"
version = "1.8.0"
authors = ["Supercolony <[email protected]>"]
edition = "2018"

license = "MIT"
readme = "README.md"
repository = "https://github.com/Supercolony-net/openbrush-contracts"
documentation = "https://docs.openbrush.io"
homepage = "https://supercolony.net"
description = "OpenBrush library for smart contract development on ink!."
keywords = ["wasm", "supercolony", "smart-contracts", "blockchain", "ink"]
categories = ["no-std", "embedded"]
include = ["Cargo.toml", "src/**/*.rs"]

[dependencies]
contracts = { path = "./contracts", default-features = false }
brush_lang = { path = "./utils/brush_lang", default-features = false }
ink_primitives = { version = "~3.2.0", default-features = false }
ink_metadata = { version = "~3.2.0", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "~3.2.0", default-features = false }
ink_storage = { version = "~3.2.0", default-features = false }
ink_lang = { version = "~3.2.0", default-features = false }
ink_prelude = { version = "~3.2.0", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }

openbrush_contracts = { version = "~1.8.0", path = "contracts", default-features = false }
openbrush_lang = { version = "~1.8.0", path = "lang", default-features = false }

[lib]
name = "brush"
path = "lib.rs"
name = "openbrush"
path = "src/lib.rs"
crate-type = [
"rlib",
]

[features]
default = ["std"]
std = [
"contracts/std",
"brush_lang/std",
"ink_metadata/std",
"ink_env/std",
"ink_storage/std",
"ink_primitives/std",
"scale/std",
"scale-info/std",

"openbrush_contracts/std",
"openbrush_lang/std",
]
psp22 = ["contracts/psp22"]
psp34 = ["contracts/psp34"]
psp1155 = ["contracts/psp1155"]
ownable = ["contracts/ownable"]
access_control = ["contracts/access_control"]
payment_splitter = ["contracts/payment_splitter"]
reentrancy_guard = ["contracts/reentrancy_guard"]
pausable = ["contracts/pausable"]
timelock_controller = ["contracts/timelock_controller"]
proxy = ["contracts/proxy"]
diamond = ["contracts/diamond"]
psp22 = ["openbrush_contracts/psp22"]
psp34 = ["openbrush_contracts/psp34"]
psp1155 = ["openbrush_contracts/psp1155"]
ownable = ["openbrush_contracts/ownable"]
access_control = ["openbrush_contracts/access_control"]
payment_splitter = ["openbrush_contracts/payment_splitter"]
reentrancy_guard = ["openbrush_contracts/reentrancy_guard"]
pausable = ["openbrush_contracts/pausable"]
timelock_controller = ["openbrush_contracts/timelock_controller"]
proxy = ["openbrush_contracts/proxy"]
diamond = ["openbrush_contracts/diamond"]

[profile.release]
panic = "abort"
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ to call methods of that trait from some contract in the network
(do a cross contract call).

```rust
#[brush::trait_definition]
#[openbrush::trait_definition]
pub trait Trait1 {
#[ink(message)]
fn foo(&mut self) -> bool;
}

#[brush::wrapper]
#[openbrush::wrapper]
type Trait1Ref = dyn Trait1;

{
// It should be `AccountId` of some contract in the network
let callee: brush::traits::AccountId = [1; 32].into();
let callee: openbrush::traits::AccountId = [1; 32].into();
// This code will execute a cross contract call to `callee` contract
let result_of_foo: bool = Trait1Ref::foo(&callee);
}
Expand Down Expand Up @@ -110,8 +110,8 @@ All contracts are upgradable by default. It will be refactored after [Storage re
------- Release 0.2.0

- [x] Remove the boilerplate to make the internal implementation external.
- - [x] Implement `brush::contract` macro to consume all brush's stuff before ink!.
- - [x] Implement `brush::trait_definition` which stores definition of trait and allow to use it in `brush::contract` macro.
- - [x] Implement `openbrush::contract` macro to consume all openbrush's stuff before ink!.
- - [x] Implement `openbrush::trait_definition` which stores definition of trait and allow to use it in `openbrush::contract` macro.
- - [x] Implement `impl_trait!` macro which reuse internal implementation in external impl section.
- [x] Refactor examples and tests with new macros.
- [x] Decide how to handle errors and implement it in library (Decided to use `panic!` and `assert!`).
Expand Down Expand Up @@ -188,7 +188,7 @@ After you can run tests by `yarn run test` command. It will build all contracts
## History behind

- [OpenZeppelin in ink!](https://medium.com/supercolony/ink-has-most-of-the-features-required-for-usage-however-the-usability-of-ink-is-low-95f4bc974e22)
- [Openbrush was born](https://supercolony.medium.com/openbrush-an-early-alpha-of-our-openzeppelin-library-for-ink-a0c3f4f9432)
- [Openopenbrush was born](https://supercolony.medium.com/openbrush-an-early-alpha-of-our-openzeppelin-library-for-ink-a0c3f4f9432)

## FAQ

Expand All @@ -202,4 +202,4 @@ After that, we plan to do an audit.

## License

OpenBrush is released under the [MIT License](LICENSE).
OpenBrush is released under the [MIT License](LICENSE).
36 changes: 23 additions & 13 deletions contracts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
[package]
name = "contracts"
version = "1.7.1"
name = "openbrush_contracts"
version = "1.8.0"
authors = ["Supercolony <[email protected]>"]
edition = "2021"

license = "MIT"
readme = "README.md"
repository = "https://github.com/Supercolony-net/openbrush-contracts"
documentation = "https://docs.openbrush.io"
homepage = "https://supercolony.net"
description = "Reusable implementations of contracts and traits for interaction with them."
keywords = ["wasm", "supercolony", "smart-contracts", "blockchain", "ink"]
categories = ["no-std", "embedded"]
include = ["Cargo.toml", "src/**/*.rs"]

[dependencies]
ink_primitives = { version = "3.2.0", default-features = false }
ink_metadata = { version = "3.2.0", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "3.2.0", default-features = false }
ink_storage = { version = "3.2.0", default-features = false }
ink_lang = { version = "3.2.0", default-features = false }
ink_prelude = { version = "3.2.0", default-features = false }
ink_primitives = { version = "~3.2.0", default-features = false }
ink_metadata = { version = "~3.2.0", default-features = false, features = ["derive"], optional = true }
ink_env = { version = "~3.2.0", default-features = false }
ink_storage = { version = "~3.2.0", default-features = false }
ink_lang = { version = "~3.2.0", default-features = false }
ink_prelude = { version = "~3.2.0", default-features = false }

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }

derive = { path = "./derive" }
brush = { package = "brush_lang", path = "../utils/brush_lang", default-features = false }
derive = { package = "openbrush_contracts_derive", version = "1.8.0", path = "derive" }
openbrush = { version = "~1.8.0", package = "openbrush_lang", path = "../lang", default-features = false }

[lib]
name = "contracts"
path = "lib.rs"
name = "openbrush_contracts"
path = "src/lib.rs"
crate-type = [
"rlib",
]
Expand All @@ -35,7 +45,7 @@ std = [
"scale/std",
"scale-info/std",

"brush/std",
"openbrush/std",
]
psp22 = [
"derive/psp22",
Expand Down
4 changes: 2 additions & 2 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Overview

`traits` contains definitions of traits(interfaces) for the popular contracts.
[`traits`](src/traits) contains definitions of traits(interfaces) for the popular contracts.
Anyone can import the trait and use it to do cross-contract calls without
knowing the implementation of the contract.

This folder contains the implementation of popular contracts.
Anyone can re-use the implementation after importing the `brush` crate, enabling
Anyone can re-use the implementation after importing the `openbrush` crate, enabling
the desired feature(s) of the contract, and implementing all required traits.
17 changes: 13 additions & 4 deletions contracts/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
[package]
name = "derive"
version = "1.7.1"
name = "openbrush_contracts_derive"
version = "1.8.0"
authors = ["Supercolony <[email protected]>"]
edition = "2021"

license = "MIT"
repository = "https://github.com/Supercolony-net/openbrush-contracts"
documentation = "https://docs.openbrush.io"
homepage = "https://supercolony.net"
description = "Derives for storage data of each contract in the openbrush."
keywords = ["wasm", "supercolony", "smart-contracts", "blockchain", "ink"]
categories = ["no-std", "embedded"]
include = ["Cargo.toml", "lib.rs"]

[dependencies]
syn = { version = "1.0" }
quote = "1.0"
proc-macro2 = "1"
brush_derive = { path = "../../utils/brush_derive" }
openbrush = { package = "openbrush_lang", version = "1.8.0", path = "../../lang" }

[lib]
name = "derive"
name = "openbrush_contracts_derive"
path = "lib.rs"
proc-macro = true

Expand Down
2 changes: 1 addition & 1 deletion contracts/derive/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
extern crate proc_macro;

#[allow(unused_imports)]
use brush_derive::declare_derive_storage_trait;
use openbrush::declare_derive_storage_trait;

// PSP22
#[cfg(feature = "psp22")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pub use crate::traits::access_control::*;
use brush::{
pub use derive::AccessControlStorage;
use ink_storage::Mapping;
use openbrush::{
declare_storage_trait,
modifier_definition,
modifiers,
traits::AccountId,
};
pub use derive::AccessControlStorage;
use ink_storage::Mapping;

pub const STORAGE_KEY: [u8; 32] = ink_lang::blake2x256!("brush::AccessControlData");
pub const STORAGE_KEY: [u8; 32] = ink_lang::blake2x256!("openbrush::AccessControlData");

#[derive(Default, Debug)]
#[brush::storage(STORAGE_KEY)]
#[openbrush::storage(STORAGE_KEY)]
pub struct AccessControlData {
pub admin_roles: Mapping<RoleType, RoleType>,
pub members: Mapping<(RoleType, AccountId), ()>,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pub use crate::traits::ownable::*;
use brush::{
pub use derive::OwnableStorage;
use openbrush::{
declare_storage_trait,
modifier_definition,
modifiers,
Expand All @@ -30,12 +31,11 @@ use brush::{
ZERO_ADDRESS,
},
};
pub use derive::OwnableStorage;

pub const STORAGE_KEY: [u8; 32] = ink_lang::blake2x256!("brush::OwnableData");
pub const STORAGE_KEY: [u8; 32] = ink_lang::blake2x256!("openbrush::OwnableData");

#[derive(Default, Debug)]
#[brush::storage(STORAGE_KEY)]
#[openbrush::storage(STORAGE_KEY)]
pub struct OwnableData {
pub owner: AccountId,
pub _reserved: Option<()>,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pub use crate::traits::payment_splitter::*;
use brush::{
pub use derive::PaymentSplitterStorage;
use ink_prelude::vec::Vec;
use ink_storage::Mapping;
use openbrush::{
declare_storage_trait,
traits::{
AccountId,
Expand All @@ -29,14 +32,11 @@ use brush::{
ZERO_ADDRESS,
},
};
pub use derive::PaymentSplitterStorage;
use ink_prelude::vec::Vec;
use ink_storage::Mapping;

pub const STORAGE_KEY: [u8; 32] = ink_lang::blake2x256!("brush::PaymentSplitterData");
pub const STORAGE_KEY: [u8; 32] = ink_lang::blake2x256!("openbrush::PaymentSplitterData");

#[derive(Default, Debug)]
#[brush::storage(STORAGE_KEY)]
#[openbrush::storage(STORAGE_KEY)]
pub struct PaymentSplitterData {
pub total_shares: Balance,
pub total_released: Balance,
Expand Down
File renamed without changes.
Loading

0 comments on commit dc666f0

Please sign in to comment.