OpenBrushとは
ink!のための、スマートコントラクト開発ライブラリ群です。
EthereumのOpenZipppelinのように、コードの再利用をテーマとしています。
(カンファレンス)
https://hopin.com/events/wasm-conference-2022
(動画)
https://www.youtube.com/watch?v=I5OFGNVvzOc
versions
1.8.0 3days ago
https://crates.io/crates/brush_contracts_derive/versions
どのような機能があるか?
https://github.com/Supercolony-net/openbrush-contracts
https://lib.rs/crates/brush_contracts_derive
PSP22 - Fungible Token (ERC20 equivalent) with extensions
PSP34 - Non-Fungible Token (ERC721 equivalent) with extensions
Multi-Token ERC1155 equivalent with extensions
Ownable Restrict access to action for non-owners
Access Control Define set of roles and restrict access to action by roles
Reentrancy guard Prevent reentrant calls to a function
Pausable Pause/Unpause the contract to disable/enable some operations
Timelock Controller Execute transactions with some delay
Payment Splitter Split amount of native tokens between participants
WASMのPSPとは?
PSP-Polkadot標準Polkadot Standards Proposals(PSP)と呼ばれます。
ERCライクなものと考えればよさそうです。
ためしにpayment splitterを使って実装してみる
#[brush::contract]
use brush::contracts::payment_splitter::*;
$ cargo contract new own_paymenet_splitter_demo
$ cargo +nightly contract buil
ERROR: Mismatching versions of `parity-scale-codec` were found!
Please ensure that your contract and your ink! dependencies use a compatible version of this package.
// parity-scale-codecのversion => 3 に変更
// scale-infoのversion => 2 に変更
scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }
scale-info = { version = "2", default-features = false, features = ["derive"], optional = true }