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

WL mint, ERC721 with multi metadata, remove total supply #72

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions flex_marketplace/src/marketplace/marketplace.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ mod MarketPlace {

self
.is_user_order_nonce_executed_or_cancelled
.write((maker_ask.signer, maker_ask.nonce), true);
.write((maker_ask.signer, maker_ask.salt_nonce), true);

self
.transfer_fees_and_funds(
Expand Down Expand Up @@ -386,7 +386,7 @@ mod MarketPlace {
.emit(
TakerBid {
order_hash,
order_nonce: maker_ask.nonce,
order_nonce: maker_ask.salt_nonce,
taker: non_fungible_token_recipient,
maker: maker_ask.signer,
strategy: maker_ask.strategy,
Expand Down Expand Up @@ -434,7 +434,7 @@ mod MarketPlace {

self
.is_user_order_nonce_executed_or_cancelled
.write((maker_bid.signer, maker_bid.nonce), true);
.write((maker_bid.signer, maker_bid.salt_nonce), true);
self
.transfer_non_fungible_token(
maker_bid.collection, taker_ask.taker, maker_bid.signer, token_id, amount
Expand All @@ -459,7 +459,7 @@ mod MarketPlace {
.emit(
TakerAsk {
order_hash,
order_nonce: maker_bid.nonce,
order_nonce: maker_bid.salt_nonce,
taker: taker_ask.taker,
maker: maker_bid.signer,
strategy: maker_bid.strategy,
Expand Down Expand Up @@ -504,10 +504,10 @@ mod MarketPlace {

self
.is_user_order_nonce_executed_or_cancelled
.write((maker_ask.signer, maker_ask.nonce), true);
.write((maker_ask.signer, maker_ask.salt_nonce), true);
self
.is_user_order_nonce_executed_or_cancelled
.write((maker_bid.signer, maker_bid.nonce), true);
.write((maker_bid.signer, maker_bid.salt_nonce), true);

self
.transfer_fees_and_funds(
Expand All @@ -534,7 +534,7 @@ mod MarketPlace {
.emit(
TakerBid {
order_hash,
order_nonce: maker_ask.nonce,
order_nonce: maker_ask.salt_nonce,
taker: maker_bid.signer,
maker: maker_ask.signer,
strategy: maker_ask.strategy,
Expand Down Expand Up @@ -715,14 +715,14 @@ mod MarketPlace {
self: @ContractState, order: @MakerOrder, order_signature: Array<felt252>
) {
let executed_order_cancelled = self
.get_is_user_order_nonce_executed_or_cancelled(*order.signer, *order.nonce);
.get_is_user_order_nonce_executed_or_cancelled(*order.signer, *order.salt_nonce);
let min_nonce = self.get_user_min_order_nonce(*order.signer);
assert!(!executed_order_cancelled, "MarketPlace: executed order is cancelled");
assert!(
min_nonce <= *order.nonce,
min_nonce <= *order.salt_nonce,
"MarketPlace: min_nonce {} is higher than order nonce {}",
min_nonce,
*order.nonce
*order.salt_nonce
);
assert!(
!(*order.signer).is_zero(), "MarketPlace: invalid order signer {}", *order.signer
Expand Down
4 changes: 4 additions & 0 deletions flex_marketplace/src/marketplace/openedition.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ mod interfaces {

mod ERC721_open_edition;

mod ERC721_open_edition_multi_metadata;

mod FlexDrop;

mod erc721 {
mod ERC721;
mod ERC721MultiMetadata;
}

use erc721::ERC721;
use erc721::ERC721MultiMetadata;
use interfaces::IFlexDrop::IFlexDrop;
use interfaces::INonFungibleFlexDropToken::INonFungibleFlexDropToken;

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[starknet::contract]
mod ERC721OpenEdition {
use core::array::ArrayTrait;
use alexandria_storage::list::ListTrait;
use openzeppelin::access::ownable::OwnableComponent;
use openzeppelin::introspection::src5::SRC5Component;
Expand Down Expand Up @@ -177,11 +178,6 @@ mod ERC721OpenEdition {
let flex_drop = get_caller_address();
self.assert_allowed_flex_drop(flex_drop);

assert(
self.get_total_minted() + quantity <= self.get_max_supply(),
'Exceeds maximum total supply'
);

self.safe_mint_flex_drop(minter, quantity);
self.reentrancy_guard.end();
}
Expand Down Expand Up @@ -243,11 +239,6 @@ mod ERC721OpenEdition {
fn multi_configure(ref self: ContractState, config: MultiConfigureStruct) {
self.ownable.assert_only_owner();

let mut max_supply = config.max_supply;
if max_supply != 0 {
self.set_max_supply(max_supply);
}

if config.base_uri.len() > 0 {
self.set_base_uri(config.base_uri);
}
Expand Down Expand Up @@ -297,17 +288,20 @@ mod ERC721OpenEdition {
}
}

// return (number minted, current total supply, max supply)
fn get_mint_state(self: @ContractState, minter: ContractAddress) -> (u64, u64, u64) {
// return (number minted, current total supply)
fn get_mint_state(self: @ContractState, minter: ContractAddress) -> (u64, u64) {
let total_minted = self.total_minted_per_wallet.read(minter);
let current_total_supply = self.get_total_minted();
let max_supply = self.get_max_supply();
(total_minted, current_total_supply, max_supply)
(total_minted, current_total_supply)
}

fn get_current_token_id(self: @ContractState) -> u256 {
self.current_token_id.read()
}

fn get_allowed_flex_drops(self: @ContractState) -> Span::<ContractAddress> {
self.enumerated_allowed_flex_drop.read().array().span()
}
}

#[generate_trait]
Expand Down
Loading
Loading