Loading...
Loading...
Compare original and translation side by side
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknowncargo install --force cargo-styluscargo stylus new my_projectA Rust nightly toolchain is required. The project should include aspecifying the nightly channel,rust-toolchain.tomlcomponent, andrust-srctarget. Check the rust-contracts-stylus repo for the current recommended nightly date.wasm32-unknown-unknown
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknowncargo install --force cargo-styluscargo stylus new my_project需要使用Rust nightly工具链。项目应包含一个文件,指定nightly频道、rust-toolchain.toml组件以及rust-src目标环境。请查看rust-contracts-stylus仓库获取当前推荐的nightly版本日期。wasm32-unknown-unknown
Cargo.toml[dependencies]
openzeppelin-stylus = "=<VERSION>"export-abi[features]
export-abi = ["openzeppelin-stylus/export-abi"][lib]
crate-type = ["lib", "cdylib"]Cargo.toml[dependencies]
openzeppelin-stylus = "=<VERSION>"export-abi[features]
export-abi = ["openzeppelin-stylus/export-abi"][lib]
crate-type = ["lib", "cdylib"]openzeppelin_stylususe openzeppelin_stylus::token::erc20::{Erc20, IErc20};
use openzeppelin_stylus::access::ownable::{Ownable, IOwnable};
use openzeppelin_stylus::utils::pausable::{Pausable, IPausable};
use openzeppelin_stylus::utils::introspection::erc165::IErc165;#[storage]#[entrypoint]#[entrypoint]
#[storage]
struct MyToken {
erc20: Erc20,
ownable: Ownable,
}#[public]#[implements(...)]#[public]
#[implements(IErc20<Error = erc20::Error>, IOwnable<Error = ownable::Error>)]
impl MyToken {}
#[public]
impl IErc20 for MyToken {
type Error = erc20::Error;
// delegate to self.erc20 ...
}accessfinanceproxytokenutilsopenzeppelin_stylususe openzeppelin_stylus::token::erc20::{Erc20, IErc20};
use openzeppelin_stylus::access::ownable::{Ownable, IOwnable};
use openzeppelin_stylus::utils::pausable::{Pausable, IPausable};
use openzeppelin_stylus::utils::introspection::erc165::IErc165;#[storage]#[entrypoint]#[entrypoint]
#[storage]
struct MyToken {
erc20: Erc20,
ownable: Ownable,
}#[public]#[implements(...)]#[public]
#[implements(IErc20<Error = erc20::Error>, IOwnable<Error = ownable::Error>)]
impl MyToken {}
#[public]
impl IErc20 for MyToken {
type Error = erc20::Error;
// delegate to self.erc20 ...
}accessfinanceproxytokenutilscargo stylus checkcargo stylus export-abicargo stylus deploy --endpoint="<RPC_URL>" --private-key-path="<KEY_FILE>"cargo stylus checkcargo stylus export-abicargo stylus deploy --endpoint="<RPC_URL>" --private-key-path="<KEY_FILE>"