Skip to content

Commit

Permalink
fix: update scripts & readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kwiss committed Nov 19, 2024
1 parent 7d51aa7 commit d78f8ed
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 7 deletions.
23 changes: 23 additions & 0 deletions examples/core/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
STARKNET_RPC_URL=
STARKNET_NETWORK_ID=
SOLIS_NETWORK_ID=
BROKER_ID=
STARKNET_ACCOUNT1_ADDRESS=
STARKNET_ACCOUNT1_PRIVATE_KEY=
STARKNET_ACCOUNT2_ADDRESS=
STARKNET_ACCOUNT2_PRIVATE_KEY=
STARKNET_LISTING_BROKER_ACCOUNT_ADDRESS=
STARKNET_LISTING_BROKER_ACCOUNT_PRIVATE_KEY=
STARKNET_SALE_BROKER_ACCOUNT_ADDRESS=
STARKNET_SALE_BROKER_ACCOUNT_PRIVATE_KEY=
STARKNET_ADMIN_ADDRESS=
STARKNET_ADMIN_PRIVATE_KEY=
STARKNET_ARK_RECEIVER_ADDRESS=
STARKNET_ARK_RECEIVER_PRIVATE_KEY=
STARKNET_ARK_COLLECTION_RECEIVER_ADDRESS=
STARKNET_ARK_COLLECTION_RECEIVER_PRIVATE_KEY=
STARKNET_ARK_COLLECTION_2981_RECEIVER_ADDRESS=
STARKNET_ARK_COLLECTION_2981_RECEIVER_PRIVATE_KEY=
NFT_CONTRACT_ADDRESS=
NFT_CONTRACT_FIXED_FEES_ADDRESS=
NFT_CONTRACT_ROYALTIES_ADDRESS=
36 changes: 36 additions & 0 deletions examples/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Core Examples Scripts

Example scripts demonstrating marketplace functionalities using the Ark Protocol.

## Environment Setup

Set up the required environment variables before running any scripts.

## Available Scripts

### Fee Management
- `setup-fees.ts`: Configure marketplace fee structure

### Offer Management
- `fulfill-offer.ts`: Create and fulfill token-specific offers
- `fulfill-collection-offer.ts`: Create and fulfill collection-wide offers

### Listing Operations
- `fulfill-listing-default.ts`: Process listings with default royalties
- `fulfill-listing-collection.ts`: Handle listings with collection royalties
- `fulfill-listing-2981.ts`: Execute listings using EIP-2981 royalty standard
- `cancel-listing.ts`: Create and cancel listings

### Auction Operations
- `fulfill-auction.ts`: Create and complete auctions
- `cancel-auction.ts`: Create and cancel auctions

## Usage

1. Configure environment variables
2. Execute scripts:
```bash
npx bun scripts/<script-name>.ts
```

Each script includes detailed logging for tracking execution progress and error handling.
5 changes: 3 additions & 2 deletions examples/core/scripts/fulfillAuction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ async function createAndFulfillAuction(
relatedOrderHash: offerOrderHash,
tokenAddress: auction.tokenAddress,
tokenId,
brokerAddress: brokerAddressSale
brokerAddress: brokerAddressSale,
};

logger.info("Fulfilling auction...");
const { transactionHash } = await fulfillAuction(config, {
account: accounts.fulfiller,
...fulfillAuctionInfo
...fulfillAuctionInfo,
quantity: 1n
});

logger.info("Auction fulfilled.");
Expand Down
3 changes: 2 additions & 1 deletion examples/core/scripts/fulfillCollectionOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ async function createAndFulfillCollectionOffer(
orderHash: orderHash,
tokenAddress: offer.tokenAddress,
tokenId: tokenId,
brokerAddress: offer.brokerAddress
brokerAddress: offer.brokerAddress,
quantity: 1n
});

logger.info("Collection offer created and fulfilled.");
Expand Down
3 changes: 2 additions & 1 deletion examples/core/scripts/fulfillListing2981Royalties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ async function createAndFulfillListing(
tokenId: order.tokenId,
brokerAddress: accounts.broker_sale.address,
currencyAddress: config.starknetCurrencyContract,
amount: order.amount
amount: order.amount,
quantity: 1n
});

logger.info("Listing created and fulfilled.");
Expand Down
3 changes: 2 additions & 1 deletion examples/core/scripts/fulfillListingCollectionRoyalties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ async function createAndFulfillListing(
tokenId: order.tokenId,
brokerAddress: accounts.broker_sale.address,
currencyAddress: config.starknetCurrencyContract,
amount: order.amount
amount: order.amount,
quantity: 1n
});

logger.info("Listing created and fulfilled.");
Expand Down
3 changes: 2 additions & 1 deletion examples/core/scripts/fulfillListingDefaultRoyalties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ async function createAndFulfillListing(
tokenId: order.tokenId,
brokerAddress: accounts.broker_sale.address,
currencyAddress: config.starknetCurrencyContract,
amount: order.amount
amount: order.amount,
quantity: 1n
});

logger.info("Listing created and fulfilled.");
Expand Down
3 changes: 2 additions & 1 deletion examples/core/scripts/fulfillOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ async function createAndFulfillOffer(
orderHash: orderHash,
tokenAddress: offer.tokenAddress,
tokenId: tokenId,
brokerAddress: offer.brokerAddress
brokerAddress: offer.brokerAddress,
quantity: 1n
});

logger.info("Offer created and fulfilled.");
Expand Down

0 comments on commit d78f8ed

Please sign in to comment.