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

Add ERC721ABI, fix other ABIs #741

Closed
50 changes: 50 additions & 0 deletions src/token/erc721/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,53 @@ trait IERC721ReceiverCamel<TState> {
data: Span<felt252>
) -> felt252;
}

//
// ERC721 ABI
//

#[starknet::interface]
trait ERC721ABI<TState> {
fn name(self: @TState) -> felt252;
fn symbol(self: @TState) -> felt252;
fn token_uri(self: @TState, token_id: u256) -> felt252;
fn balance_of(self: @TState, account: ContractAddress) -> u256;
fn owner_of(self: @TState, token_id: u256) -> ContractAddress;
fn transfer_from(ref self: TState, from: ContractAddress, to: ContractAddress, token_id: u256);
fn safe_transfer_from(
ref self: TState,
from: ContractAddress,
to: ContractAddress,
token_id: u256,
data: Span<felt252>
);
fn approve(ref self: TState, to: ContractAddress, token_id: u256);
fn set_approval_for_all(ref self: TState, operator: ContractAddress, approved: bool);
fn get_approved(self: @TState, token_id: u256) -> ContractAddress;
fn is_approved_for_all(
self: @TState, owner: ContractAddress, operator: ContractAddress
) -> bool;
fn supports_interface(self: @TState, interface_id: felt252) -> bool;
}

#[starknet::interface]
trait ERC721CamelABI<TState> {
fn name(self: @TState) -> felt252;
fn symbol(self: @TState) -> felt252;
fn tokenURI(self: @TState, tokenId: u256) -> felt252;
fn balanceOf(self: @TState, account: ContractAddress) -> u256;
fn ownerOf(self: @TState, tokenId: u256) -> ContractAddress;
fn transferFrom(ref self: TState, from: ContractAddress, to: ContractAddress, tokenId: u256);
fn safeTransferFrom(
ref self: TState,
from: ContractAddress,
to: ContractAddress,
tokenId: u256,
data: Span<felt252>
);
fn approve(ref self: TState, to: ContractAddress, tokenId: u256);
fn setApprovalForAll(ref self: TState, operator: ContractAddress, approved: bool);
fn getApproved(self: @TState, tokenId: u256) -> ContractAddress;
fn isApprovedForAll(self: @TState, owner: ContractAddress, operator: ContractAddress) -> bool;
fn supportsInterface(self: @TState, interfaceId: felt252) -> bool;
}