I want to create smart contract on starknet Cairo using remix.
i search on openzeppelin but i can't find or create using template.
any simple method find any sample
Can you clarify what exactly you are looking for? Which version of Cairo are you using? You can find the most recent documentation for the Contracts for Cairo library here: https://docs.openzeppelin.com/contracts-cairo/0.8.0-beta.0/
This does not contain preset contracts yet, but that is planned in https://github.com/OpenZeppelin/cairo-contracts/issues/804
sir i want any sample of smart contract for starknet
like this https://docs.openzeppelin.com/contracts/5.x/wizard
where can find starknet compatible contract code
Are you looking for the Cairo Wizard?
yes sir you currect catch
No problem, I'd still strongly advice to look at the docs as @ericglau suggested
yes sir thanks for fast helping i will check all docs
Note that the Cairo Wizard code is only compatible with Cairo language version 0.x. You would need to see which version of the language you are using.
#[starknet::contract]
mod MyToken {
use openzeppelin::token::erc20::ERC20Component;
use starknet::ContractAddress;
#[starknet::storage]
struct Storage {
erc20: ERC20Component
}
impl Storage {
pub fn new() -> Self {
Self {
erc20: ERC20Component::new()
}
}
}
#[starknet::init]
fn initialize() -> Storage {
Storage::new()
}
#[starknet::view]
fn name() -> String {
let storage = Storage::from_input();
storage.erc20.name()
}
#[starknet::view]
fn symbol() -> String {
let storage = Storage::from_input();
storage.erc20.symbol()
}
#[starknet::view]
fn totalSupply() -> u256 {
let storage = Storage::from_input();
storage.erc20.total_supply()
}
#[starknet::view]
fn balanceOf(account: ContractAddress) -> u256 {
let storage = Storage::from_input();
storage.erc20.balance_of(account)
}
#[starknet::view]
fn allowance(owner: ContractAddress, spender: ContractAddress) -> u256 {
let storage = Storage::from_input();
storage.erc20.allowance(owner, spender)
}
#[starknet::transaction]
fn transfer(to: ContractAddress, value: u256) {
let storage = Storage::from_input();
storage.erc20.transfer(to, value);
}
#[starknet::transaction]
fn approve(spender: ContractAddress, value: u256) {
let storage = Storage::from_input();
storage.erc20.approve(spender, value);
}
#[starknet::transaction]
fn transferFrom(from: ContractAddress, to: ContractAddress, value: u256) {
let storage = Storage::from_input();
storage.erc20.transfer_from(from, to, value);
}
}
this code i can't compile with remix plugin for starknet
Original question was answered. Feel free to open a different topic for another question following the guidelines: