Skip to content

Commit

Permalink
Update dependencies and add batch minting logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Arn0d committed Jan 18, 2024
1 parent b84f68e commit abee0c3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.1.0"
starknet = ">=2.3.1"
alexandria_storage = { git = "https://github.com/tekkac/alexandria", branch = "feat/interpolation-fast" }
alexandria_numeric = { git = "https://github.com/tekkac/alexandria", branch = "feat/interpolation-fast" }
openzeppelin = { git = "https://github.com/cloudvenger/cairo-contracts.git", rev = "8836cdd494908dc40457e2c900ed1cc1fd84a436" }
openzeppelin = { git = "https://github.com/cloudvenger/cairo-contracts.git", rev = "fd41fdb9d04a701b2353c4cd0a8bd19f3139e88a" }

[[target.starknet-contract]]
sierra = true
Expand Down
2 changes: 1 addition & 1 deletion src/components/mint/module.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ mod MintComponent {
// TODO : define the vintage
let projects_contract = self.Mint_carbonable_project_address.read();
let project = IProjectDispatcher { contract_address: projects_contract };
project.mint_specific_cc(user_address.into(), 1, booking.value);
project.mint(user_address.into(), 1, booking.value);

// [Event] Emit
self.emit(BookingClaimed { address: user_address, id, value: booking.value, });
Expand Down
21 changes: 15 additions & 6 deletions src/contracts/project.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ use starknet::ContractAddress;

#[starknet::interface]
trait IExternal<ContractState> {
fn mint_specific_cc(ref self: ContractState, to: ContractAddress, token_id: u256, value: u256);
fn burn_specific_cc(ref self: ContractState, token_id: u256, value: u256);
fn mint(ref self: ContractState, to: ContractAddress, token_id: u256, value: u256);
fn burn(ref self: ContractState, token_id: u256, value: u256);
fn batch_mint(ref self: ContractState, to: ContractAddress, token_ids: Span<u256>, values: Span<u256>);
fn batch_burn(ref self: ContractState, token_ids: Span<u256>, values: Span<u256>);
fn set_uri(ref self: ContractState, token_id: u256, uri: felt252);
fn set_list_uri(ref self: ContractState, token_ids: Span<u256>, uris: Span<felt252>);
}
Expand Down Expand Up @@ -84,7 +86,6 @@ use core::traits::Into;
}

mod Errors {
const UNEQUAL_ARRAYS_VALUES: felt252 = 'Values array len do not match';
const UNEQUAL_ARRAYS_URI: felt252 = 'URI Array len do not match';
}

Expand All @@ -104,12 +105,20 @@ use core::traits::Into;
#[external(v0)]
impl ExternalImpl of super::IExternal<ContractState> {

fn mint_specific_cc(ref self: ContractState, to: ContractAddress, token_id: u256, value: u256) {
fn mint(ref self: ContractState, to: ContractAddress, token_id: u256, value: u256) {
self.erc1155._mint(to, token_id, value);
}

fn burn_specific_cc(ref self: ContractState, token_id: u256, value: u256) {
self.erc1155._burn(token_id, value);
fn burn(ref self: ContractState, token_id: u256, value: u256) {
self.erc1155._burn(get_caller_address(), token_id, value);
}

fn batch_mint(ref self: ContractState, to: ContractAddress, token_ids: Span<u256>, values: Span<u256>) {
self.erc1155._batch_mint(to, token_ids, values);
}

fn batch_burn(ref self: ContractState, token_ids: Span<u256>, values: Span<u256>) {
self.erc1155._batch_burn(get_caller_address(), token_ids, values);
}

fn set_uri(ref self: ContractState, token_id: u256, uri: felt252) {
Expand Down

0 comments on commit abee0c3

Please sign in to comment.