Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
feat: fix modify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ifelsedeveloper committed Dec 5, 2024
1 parent 461db37 commit 98649f3
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 17 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"rarible_editions:deploy:solana-dev-net": "anchor build -p rarible_editions && anchor deploy -p rarible_editions --provider.cluster https://api.devnet.solana.com --provider.wallet ~/.config/solana/id.json",
"extend": "solana program extend Rarim7DMoD45z1o25QWPsWvTdFSSEdxaxriwWZLLTic 1028896",
"extend2": "solana program extend RariUNM3vz1rwxPg8UJyRAN7rSKXxgd2ncS2ddCa4ZE 1005440",
"extend-market": "solana program extend Rarim7DMoD45z1o25QWPsWvTdFSSEdxaxriwWZLLTic 916424",

"double-size": "echo $(( $(stat -f%z target/deploy/rarible_editions.so) * 2 ))",
"rarible_editions:upgrade:solana-dev-net": "anchor upgrade target/deploy/rarible_editions.so --program-id Rari9ftBd6vFdtpn8TDLwN2ze24KKkM5MLEETNiBMNn --provider.cluster https://api.devnet.solana.com --provider.wallet ~/.config/solana/id.json",
Expand Down Expand Up @@ -51,6 +52,7 @@
"rarible_editions_controls:deploy:buffer:eclipse-main-net": "solana program deploy ./target/deploy/rarible_editions_controls.so --program-id target/deploy/rarible_editions_controls-keypair.json --url https://mainnetbeta-rpc.eclipse.xyz --buffer ./deploy.json",
"rarible_marketplace:deploy:eclipse-main-net": "anchor build -p rarible_marketplace && anchor deploy -p rarible_marketplace --provider.cluster https://mainnetbeta-rpc.eclipse.xyz --provider.wallet ~/.config/solana/prod-keypair.json",
"rarible_marketplace:upgrade:manual:eclipse-main-net": "solana program deploy target/deploy/rarible_marketplace.so --buffer ./deploy.json --url https://mainnetbeta-rpc.eclipse.xyz --keypair ~/.config/solana/prod-keypair.json",
"rarible_marketplace:upgrade:eclipse-main-net": "anchor upgrade target/deploy/rarible_marketplace.so --program-id Rarim7DMoD45z1o25QWPsWvTdFSSEdxaxriwWZLLTic --provider.cluster https://mainnetbeta-rpc.eclipse.xyz --provider.wallet ~/.config/solana/prod-keypair.json",
"extend-editions": "solana program extend Rari9ftBd6vFdtpn8TDLwN2ze24KKkM5MLEETNiBMNn 1028896",
"extend-controls": "solana program extend RariUNM3vz1rwxPg8UJyRAN7rSKXxgd2ncS2ddCa4ZE 1005440",
"rarible_editions:upgrade:eclipse-main-net": "anchor upgrade target/deploy/rarible_editions.so --program-id Rari9ftBd6vFdtpn8TDLwN2ze24KKkM5MLEETNiBMNn --provider.cluster https://mainnetbeta-rpc.eclipse.xyz --provider.wallet ~/.config/solana/prod-keypair.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,33 @@ npx ts-node ./src/cli/createDeployment.ts \
npx ts-node ./src/cli/addPhase.ts -d 5rPxHARWC3XVjXfFueVzUibCNKUw22hkhdjmj5BqBxEg -k ~/.config/solana/id.json -r https://testnet.dev2.eclipsenetwork.xyz --maxMintsPerWallet 100 --maxMintsTotal 1000 --priceAmount 500 -s 1709564319 -e 1991938380

npx ts-node ./src/cli/mintWithControls.ts -d 5rPxHARWC3XVjXfFueVzUibCNKUw22hkhdjmj5BqBxEg -k ~/.config/solana/id.json -r https://testnet.dev2.eclipsenetwork.xyz -p 0 -n 1


npx ts-node ./src/cli/createDeployment.ts \
-t GKJipHv2dn58S4fxFjdBjyGJY5KTvhY7mYAjUd2hMtFV \
-k ~/.config/solana/prod-keypair.json \
-r https://mainnetbeta-rpc.eclipse.xyz \
-s SECONDARYSALES \
--maxNumberOfTokens 0 \
--maxMintsPerWallet 99999 \
-u "https://ipfs.raribleuserdata.com/ipfs/QmXTfspj4ebkVUW6jTF8cfyrQUip4xs5PehKK2qMaCBJgX" \
-n "Secondary Sales" \
--creators GKJipHv2dn58S4fxFjdBjyGJY5KTvhY7mYAjUd2hMtFV:100 \
--royaltyBasisPoints 1000 \
--platformFeeValue 0 \
--platformFeeRecipients GKJipHv2dn58S4fxFjdBjyGJY5KTvhY7mYAjUd2hMtFV:100 \
--isFeeFlat \
--itemBaseUri "https://ipfs.raribleuserdata.com/ipfs/QmaqDcqLjdhYmhp5XMy1xPLnp4vpEpnPyTA43tSby9kcjR" \
--itemBaseName "Secondary Sales"

npx ts-node ./src/cli/addPhase.ts \
-d 3KY1iu4xuCqVokQNQpkXGL4Tu2PrNDjfG4DUPtjCCDfV \
-k ~/.config/solana/prod-keypair.json \
-r https://mainnetbeta-rpc.eclipse.xyz \
--maxMintsPerWallet 99998 \
--maxMintsTotal 0 \
--priceAmount 0 \
-s 1732986000 \
-e 1764522000

npx ts-node ./src/cli/mintWithControls.ts -d 3KY1iu4xuCqVokQNQpkXGL4Tu2PrNDjfG4DUPtjCCDfV -k ~/.config/solana/prod-keypair.json -r https://mainnetbeta-rpc.eclipse.xyz -p 0 -n 1
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,28 @@ npx ts-node ./src/cli/initMarket.ts \
-m Rari4ReeeT8bhbsRGP5J8RBhTFXTAP7iMm7VHuNQTs5 \
--feeBps 500 \
--feeRecipient AsSKqK7CkxFUf3KaoQzzr8ZLPm5fFguUtVE5QwGALQQn \
--ledger true
--ledger true

npx ts-node ./src/cli/modifyMarket.ts \
-k ~/.config/solana/id.json \
-r https://api.devnet.solana.com \
-m Rari4ReeeT8bhbsRGP5J8RBhTFXTAP7iMm7VHuNQTs5 \
--feeBps 0 \
--feeRecipient AsSKqK7CkxFUf3KaoQzzr8ZLPm5fFguUtVE5QwGALQQn


npx ts-node ./src/cli/initMarket.ts \
-k ~/.config/solana/id.json \
-r https://mainnetbeta-rpc.eclipse.xyz \
-m Rarij1uVBewyCkCMNixNcAWtqoeyJfvKjvaj7d196Mt \
--feeBps 0 \
--feeRecipient AsSKqK7CkxFUf3KaoQzzr8ZLPm5fFguUtVE5QwGALQQn \
--ledger true

npx ts-node ./src/cli/initMarket.ts \
-k ~/.config/solana/id.json \
-r https://testnet.dev2.eclipsenetwork.xyz \
-m Rarij1uVBewyCkCMNixNcAWtqoeyJfvKjvaj7d196Mt \
--feeBps 0 \
--feeRecipient AsSKqK7CkxFUf3KaoQzzr8ZLPm5fFguUtVE5QwGALQQn

13 changes: 12 additions & 1 deletion packages/protocol-contracts-svm-marketplace/scripts/listNft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,15 @@ npx ts-node ./src/cli/listNft.ts \
--nftMint JTRgY2JXDa1JRqnTWRxyzRpwLTeJfUvP8brVaWmZG7i \
--paymentMint So11111111111111111111111111111111111111112 \
--size 1 \
--price 1000000000
--price 1000000000

6GQA9MbSCFmyUu1SVTzzNJxPkBPQXugJWU3ci7ghJnFL

npx ts-node ./src/cli/listNft.ts \
-k ~/.config/solana/prod-keypair.json \
-r https://mainnetbeta-rpc.eclipse.xyz \
-m Rari4ReeeT8bhbsRGP5J8RBhTFXTAP7iMm7VHuNQTs5 \
--nftMint CYh9fw33qfcCkd7tZwkHZ8i2CgkWKZD4XL2ahFCmH9ia \
--paymentMint So11111111111111111111111111111111111111112 \
--size 1 \
--price 650000
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
npx ts-node ./src/cli/modifyMarket.ts \
-k ~/.config/solana/id.json \
-r https://mainnetbeta-rpc.eclipse.xyz \
-m Rari4ReeeT8bhbsRGP5J8RBhTFXTAP7iMm7VHuNQTs5 \
--feeBps 0 \
--feeRecipient AsSKqK7CkxFUf3KaoQzzr8ZLPm5fFguUtVE5QwGALQQn \
--ledger true


npx ts-node ./src/cli/modifyMarket.ts \
-k ~/.config/solana/id.json \
-r https://testnet.dev2.eclipsenetwork.xyz \
-m Rari4ReeeT8bhbsRGP5J8RBhTFXTAP7iMm7VHuNQTs5 \
--feeBps 0 \
--feeRecipient AsSKqK7CkxFUf3KaoQzzr8ZLPm5fFguUtVE5QwGALQQn

npx ts-node ./src/cli/modifyMarket.ts \
-k ~/.config/solana/id.json \
-r https://api.devnet.solana.com \
-m Rarim7DMoD45z1o25QWPsWvTdFSSEdxaxriwWZLLTic \
--feeBps 500 \
-m Rari4ReeeT8bhbsRGP5J8RBhTFXTAP7iMm7VHuNQTs5 \
--feeBps 0 \
--feeRecipient AsSKqK7CkxFUf3KaoQzzr8ZLPm5fFguUtVE5QwGALQQn
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const modifyMarket = async ({
.accountsStrict({
initializer: wallet.publicKey,
marketIdentifier: params.marketIdentifier,
market,
market: market.toBase58(),
systemProgram: SystemProgram.programId,
program: PROGRAM_ID_MARKETPLACE,
eventAuthority,
Expand Down
20 changes: 8 additions & 12 deletions programs/rarible_marketplace/src/instructions/market/modify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ pub struct ModifyMarketParams {
#[instruction()]
#[event_cpi]
pub struct ModifyMarket<'info> {
#[account(mut)]
#[account(mut,
constraint = market.initializer == initializer.key())]
pub initializer: Signer<'info>,
#[account()]
/// CHECK: doesn't actually need to be a mint
pub market_identifier: UncheckedAccount<'info>,
#[account(
#[account(mut,
seeds = [MARKET_SEED,
market_identifier.key().as_ref()],
bump,
constraint = market.initializer == initializer.key()
)]
pub market: Box<Account<'info, Market>>,
pub system_program: Program<'info, System>,
Expand All @@ -30,15 +30,11 @@ pub struct ModifyMarket<'info> {
#[inline(always)]
pub fn handler(ctx: Context<ModifyMarket>, params: ModifyMarketParams) -> Result<()> {
msg!("Modify existing market");
let market = &mut ctx.accounts.market;
Market::modify_fee(
&mut ctx.accounts.market,
params.fee_recipient,
params.fee_bps,
);

market.fee_recipient = params.fee_recipient;
market.fee_bps = params.fee_bps;

emit_cpi!(Market::get_edit_event(
&mut ctx.accounts.market.clone(),
ctx.accounts.market.key(),
MarketEditType::Modify
));
Ok(())
}
9 changes: 9 additions & 0 deletions programs/rarible_marketplace/src/state/market.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ impl Market {
self.fee_bps = fee_bps;
}

pub fn modify_fee(
&mut self,
fee_recipient: Pubkey,
fee_bps: u64,
) {
self.fee_recipient = fee_recipient;
self.fee_bps = fee_bps;
}

/// return true if the market is active
pub fn is_active(state: u8) -> bool {
state != <MarketState as Into<u8>>::into(MarketState::Closed)
Expand Down

0 comments on commit 98649f3

Please sign in to comment.