From 84b5a6d0129137da762ecb42ae5360869a42aefe Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 12:25:45 -0700 Subject: [PATCH 01/16] test(zora): add referral param to existing tests --- packages/zora/src/Zora.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/zora/src/Zora.test.ts b/packages/zora/src/Zora.test.ts index 91b20cd66..bedfb2723 100644 --- a/packages/zora/src/Zora.test.ts +++ b/packages/zora/src/Zora.test.ts @@ -29,6 +29,7 @@ import { describe, expect, test, vi, beforeEach, MockedFunction } from 'vitest' import { PremintResponse } from './types' import axios from 'axios' import { validatePremint } from './validate' +import { ZORA_DEPLOYER_ADDRESS } from './contract-addresses' const MockedPremintResponse: PremintResponse = [ { @@ -262,6 +263,7 @@ describe('Given the getMintIntent function', () => { contractAddress: CONTRACT_ADDRESS, amount: BigInt('10'), recipient: RECIPIENT_ADDRESS, + referral: ZORA_DEPLOYER_ADDRESS, } const result = await getMintIntent(mint) @@ -276,10 +278,10 @@ describe('Given the getMintIntent function', () => { test('returns a TransactionRequest with correct properties when tokenId is null', async () => { const mint: MintIntentParams = { chainId: 1, - contractAddress: CONTRACT_ADDRESS, amount: BigInt('10'), recipient: RECIPIENT_ADDRESS, + referral: ZORA_DEPLOYER_ADDRESS, } const result = await getMintIntent(mint) @@ -404,11 +406,12 @@ describe('simulateMint function', () => { tokenId: 10, amount: BigInt(1), recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', + referral: ZORA_DEPLOYER_ADDRESS, } const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' - const result = await mockFn.simulateMint(mint, value, account) + const result = await simulateMint(mint, value, account) const request = result.request expect(request.address).toBe(mint.contractAddress) expect(request.value).toBe(value) @@ -431,15 +434,16 @@ describe('simulateMint function', () => { const mint: MintIntentParams = { chainId: Chains.BLAST, - contractAddress: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', + contractAddress: '0x553f0a63858a9000212cdbd0c40cf7861b692dc0', tokenId: 1, amount: BigInt(1), recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', + referral: ZORA_DEPLOYER_ADDRESS, } const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' - const result = await mockFn.simulateMint(mint, value, account) + const result = await simulateMint(mint, value, account) const request = result.request expect(request.address).toBe(mint.contractAddress) expect(request.value).toBe(value) @@ -452,6 +456,7 @@ describe('simulateMint function', () => { tokenId: 1, amount: BigInt(1), recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', + referral: ZORA_DEPLOYER_ADDRESS, } const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' From cd77c8b64d112a91348e412f0394b6c851472325 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 12:26:10 -0700 Subject: [PATCH 02/16] feat(zora): add referral param to mint simulation --- packages/zora/src/Zora.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 4d752deaf..c26dcc960 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -228,7 +228,7 @@ export const simulateMint = async ( account?: Address, client?: PublicClient, ): Promise => { - const { chainId, contractAddress, tokenId, amount, recipient } = mint + const { chainId, contractAddress, tokenId, amount, recipient, referral } = mint const _client = client ?? createPublicClient({ @@ -286,7 +286,7 @@ export const simulateMint = async ( fixedPriceSaleStratAddress, _tokenId, amount, - [ZORA_DEPLOYER_ADDRESS], + [referral ?? ZORA_DEPLOYER_ADDRESS], pad(recipient), ] const result = await _client.simulateContract({ From d961e2d106f2538f16feeb163112f5f8ffe567c3 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 12:26:51 -0700 Subject: [PATCH 03/16] feat(zora): add referral param to mint intents function --- packages/zora/src/Zora.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index c26dcc960..96078caae 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -177,7 +177,7 @@ export const mint = async ( export const getMintIntent = async ( mint: MintIntentParams, ): Promise => { - const { chainId, contractAddress, tokenId, amount, recipient } = mint + const { chainId, contractAddress, tokenId, amount, recipient, referral } = mint let data let fixedPriceSaleStratAddress = FIXED_PRICE_SALE_STRATS[chainId] @@ -197,7 +197,7 @@ export const getMintIntent = async ( fixedPriceSaleStratAddress, tokenId, amount, - [ZORA_DEPLOYER_ADDRESS], + [referral ?? ZORA_DEPLOYER_ADDRESS], pad(recipient), ] // Assume it's an 1155 mint From 7339077a2af1b575da9651f7de563fc4084a36af Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 12:32:08 -0700 Subject: [PATCH 04/16] chore: allow additional types in $and array --- packages/zora/src/types.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/zora/src/types.ts b/packages/zora/src/types.ts index 29155187e..d7729f20b 100644 --- a/packages/zora/src/types.ts +++ b/packages/zora/src/types.ts @@ -1,8 +1,9 @@ -import { z } from 'zod' import { type FilterOperator, EthAddressSchema, } from '@rabbitholegg/questdk-plugin-utils' +import { type Address } from 'viem' +import { z } from 'zod' export const PremintResponseSchema = z.array( z.object({ @@ -49,3 +50,6 @@ export type AndArrayItem = | { quantity: string | number | bigint | FilterOperator } | RecipientCondition | { tokenId: string | number } + | { mintReferral: Address } + | { rewardsRecipients: { $and: [{ $first: Address }, { $last: Address }] } } + | { $or: AndArrayItem[] } \ No newline at end of file From 82c9c1dca665157bb6f669ef5ace99b1ef916d62 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 12:32:26 -0700 Subject: [PATCH 05/16] feat(zora): add referral prop to validation function --- packages/zora/src/Zora.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 96078caae..1ef1aa79f 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -93,7 +93,7 @@ export const create = async ( export const mint = async ( mint: MintActionParams, ): Promise => { - const { chainId, contractAddress, tokenId, amount, recipient } = mint + const { chainId, contractAddress, tokenId, amount, recipient, referral } = mint const universalMinter = zoraUniversalMinterAddress[ @@ -126,6 +126,19 @@ export const mint = async ( tokenId, }) } + if (referral) { + const checksumAddress = getAddress(referral) + andArray1155.push({ + $or: [ + { mintReferral: checksumAddress }, + { + rewardsRecipients: { + $and: [{ $first: checksumAddress }, { $last: checksumAddress }], + }, + }, + ], + }) + } const ERC721_FILTER_ABSTRACT = { $abiAbstract: ZORA_MINTER_ABI_721, From ee615508b6ebe88ad212d6ed47c08919210aec6c Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 12:33:42 -0700 Subject: [PATCH 06/16] refactor(zora): update bytecode retrieval method in simulateMint function --- packages/zora/src/Zora.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 1ef1aa79f..5e04845b8 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -273,7 +273,7 @@ export const simulateMint = async ( )}` // Check if the implementation contracts bytecode contains valid function selectors - const bytecode = await _client.getBytecode({ address: implementationAddress }) + const bytecode = await _client.getCode({ address: implementationAddress }) const containsSelector = FUNCTION_SELECTORS.some((selector) => bytecode?.includes(selector), ) From 58be3c8d2bc8503efecc922b326bcd127672be32 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 12:34:01 -0700 Subject: [PATCH 07/16] chore: format --- packages/zora/src/Zora.ts | 9 ++++++--- packages/zora/src/types.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 5e04845b8..716d3528c 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -93,7 +93,8 @@ export const create = async ( export const mint = async ( mint: MintActionParams, ): Promise => { - const { chainId, contractAddress, tokenId, amount, recipient, referral } = mint + const { chainId, contractAddress, tokenId, amount, recipient, referral } = + mint const universalMinter = zoraUniversalMinterAddress[ @@ -190,7 +191,8 @@ export const mint = async ( export const getMintIntent = async ( mint: MintIntentParams, ): Promise => { - const { chainId, contractAddress, tokenId, amount, recipient, referral } = mint + const { chainId, contractAddress, tokenId, amount, recipient, referral } = + mint let data let fixedPriceSaleStratAddress = FIXED_PRICE_SALE_STRATS[chainId] @@ -241,7 +243,8 @@ export const simulateMint = async ( account?: Address, client?: PublicClient, ): Promise => { - const { chainId, contractAddress, tokenId, amount, recipient, referral } = mint + const { chainId, contractAddress, tokenId, amount, recipient, referral } = + mint const _client = client ?? createPublicClient({ diff --git a/packages/zora/src/types.ts b/packages/zora/src/types.ts index d7729f20b..c704a1d47 100644 --- a/packages/zora/src/types.ts +++ b/packages/zora/src/types.ts @@ -52,4 +52,4 @@ export type AndArrayItem = | { tokenId: string | number } | { mintReferral: Address } | { rewardsRecipients: { $and: [{ $first: Address }, { $last: Address }] } } - | { $or: AndArrayItem[] } \ No newline at end of file + | { $or: AndArrayItem[] } From 1f6b17a55ff7f61add0a9e4f602f16cbcb75348a Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 13:22:57 -0700 Subject: [PATCH 08/16] test(zora): setup test for mint function with referral --- packages/zora/src/test-setup.ts | 10 +++++++++- packages/zora/src/test-transactions.ts | 23 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/zora/src/test-setup.ts b/packages/zora/src/test-setup.ts index 05ea4c96c..a6dade1ab 100644 --- a/packages/zora/src/test-setup.ts +++ b/packages/zora/src/test-setup.ts @@ -3,6 +3,7 @@ import { CREATE_COLLECTION_BASE, CREATE_COLLECTION_ZORA, LAYER_ZERO_MINT, + MINT, MINT_BATCH_WITHOUT_FEES, MINT_WITH_REWARDS, MINT_WITH_REWARDS_1155, @@ -15,7 +16,8 @@ export const passingTestCasesMint = [ createTestCase(MINT_WITH_REWARDS, 'Minting with rewards'), createTestCase(MINT_WITH_REWARDS_1155, 'Minting with rewards 1155'), createTestCase(MINT_BATCH_WITHOUT_FEES, 'When using the batch mint function'), - createTestCase(BATCH_MINT_ARB, 'when using batch mint function on arbitrum'), + createTestCase(BATCH_MINT_ARB, 'when using batch mint function on optimism'), + createTestCase(MINT, 'when using mint function'), createTestCase(MINT_WITH_REWARDS, 'when contractAddress is checksummed', { contractAddress: getAddress(MINT_WITH_REWARDS.params.contractAddress), }), @@ -61,6 +63,12 @@ export const failingTestCasesMint = [ }, ), createTestCase(ZERO_QUANTITY, 'when quantity minted is 0'), + createTestCase(MINT_WITH_REWARDS, 'when referral is incorrect', { + referral: '0xDEAD0940159fB3368F5b06b34212C0cDF4e2C032', + }), + createTestCase(MINT, 'when referral is incorrect', { + referral: '0xDEAD0940159fB3368F5b06b34212C0cDF4e2C032', + }), ] export const passingTestCasesCreate = [ diff --git a/packages/zora/src/test-transactions.ts b/packages/zora/src/test-transactions.ts index 56f7e9043..99e88e810 100644 --- a/packages/zora/src/test-transactions.ts +++ b/packages/zora/src/test-transactions.ts @@ -3,6 +3,7 @@ import type { CreateActionParams, } from '@rabbitholegg/questdk' import { Chains, type TestParams } from '@rabbitholegg/questdk-plugin-utils' +import { zeroAddress } from 'viem' export const BASIC_PURCHASE: TestParams = { transaction: { @@ -21,6 +22,24 @@ export const BASIC_PURCHASE: TestParams = { }, } +export const MINT: TestParams = { + transaction: { + chainId: 7777777, // Zora + from: '0xeE520B72e4772E9bcb29a7B5940ACeC3d82AC9B1', + to: '0x8057c6bf3bc3adfc20b0deaf1898d5294d9701e8', + hash: '0x6e4e91536b59f1027913a77e2bb93ee362de64f95a41467c642ab8b1c0182804', + input: '0x359f130200000000000000000000000004e2516a2c207e84a1839755675dfd8ef6302f0a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000ee520b72e4772e9bcb29a7b5940acec3d82ac9b1', + value: '777000000000000', // 0.000777 ETH + }, + params: { + chainId: Chains.ZORA, + contractAddress: '0x8057C6Bf3bc3aDfc20B0dEaf1898d5294d9701e8', + amount: '1', + tokenId: 1, + referral: zeroAddress, + }, +} + export const MINT_WITH_REWARDS: TestParams = { transaction: { chainId: 1, // Ethereum @@ -53,6 +72,7 @@ export const MINT_WITH_REWARDS_1155: TestParams = { contractAddress: '0x4c0c2dd31d2661e8bcec60a42e803dcc6f81baad', amount: '1', tokenId: 25, + referral: zeroAddress, }, } @@ -71,6 +91,7 @@ export const MINT_BATCH_WITHOUT_FEES: TestParams = { contractAddress: '0xe538598941e4a25f471aef9b1b5dffd6ee0fda54', amount: '1', tokenId: 2, + referral: zeroAddress, }, } @@ -98,7 +119,7 @@ export const EXPECTED_ENCODED_DATA_1155 = export const BATCH_MINT_ARB: TestParams = { transaction: { - chainId: 42161, // Optimism + chainId: 42161, // Arbitrum from: '0x1671b592610fb7427ed788b66fa3e9217ff41047', hash: '0x4c0d898b6f3864332e3e47a3924cad33491b8df0a05590d13175823ee62ef07c', input: From 188b927938c1683c851365ea423aff5178fe8429 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 13:23:30 -0700 Subject: [PATCH 09/16] refactor(zora): use mock tests for intent and simulation --- packages/zora/src/Zora.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/zora/src/Zora.test.ts b/packages/zora/src/Zora.test.ts index bedfb2723..ecbdb73eb 100644 --- a/packages/zora/src/Zora.test.ts +++ b/packages/zora/src/Zora.test.ts @@ -411,7 +411,7 @@ describe('simulateMint function', () => { const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' - const result = await simulateMint(mint, value, account) + const result = await mockFn.simulateMint(mint, value, account) const request = result.request expect(request.address).toBe(mint.contractAddress) expect(request.value).toBe(value) @@ -434,7 +434,7 @@ describe('simulateMint function', () => { const mint: MintIntentParams = { chainId: Chains.BLAST, - contractAddress: '0x553f0a63858a9000212cdbd0c40cf7861b692dc0', + contractAddress: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', tokenId: 1, amount: BigInt(1), recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', @@ -443,7 +443,7 @@ describe('simulateMint function', () => { const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' - const result = await simulateMint(mint, value, account) + const result = await mockFn.simulateMint(mint, value, account) const request = result.request expect(request.address).toBe(mint.contractAddress) expect(request.value).toBe(value) From 4a129b221c94bbd1aa2c67a469c42ba192ba466f Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 13:26:00 -0700 Subject: [PATCH 10/16] chore: format --- packages/zora/src/test-transactions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/zora/src/test-transactions.ts b/packages/zora/src/test-transactions.ts index 99e88e810..70d16626c 100644 --- a/packages/zora/src/test-transactions.ts +++ b/packages/zora/src/test-transactions.ts @@ -28,7 +28,8 @@ export const MINT: TestParams = { from: '0xeE520B72e4772E9bcb29a7B5940ACeC3d82AC9B1', to: '0x8057c6bf3bc3adfc20b0deaf1898d5294d9701e8', hash: '0x6e4e91536b59f1027913a77e2bb93ee362de64f95a41467c642ab8b1c0182804', - input: '0x359f130200000000000000000000000004e2516a2c207e84a1839755675dfd8ef6302f0a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000ee520b72e4772e9bcb29a7b5940acec3d82ac9b1', + input: + '0x359f130200000000000000000000000004e2516a2c207e84a1839755675dfd8ef6302f0a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000ee520b72e4772e9bcb29a7b5940acec3d82ac9b1', value: '777000000000000', // 0.000777 ETH }, params: { From a58a6f626e5446eaf207a39fbab0bfc54d1cb542 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 13:26:32 -0700 Subject: [PATCH 11/16] chore: generate changeset --- .changeset/nine-coats-remember.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nine-coats-remember.md diff --git a/.changeset/nine-coats-remember.md b/.changeset/nine-coats-remember.md new file mode 100644 index 000000000..9a0dced7f --- /dev/null +++ b/.changeset/nine-coats-remember.md @@ -0,0 +1,5 @@ +--- +"@rabbitholegg/questdk-plugin-zora": minor +--- + +use referral param in validation and simulations From 6de5ea98de2bd49567297e339451f3b0138f073c Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 13:27:39 -0700 Subject: [PATCH 12/16] chore: fix typo --- packages/zora/src/test-setup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zora/src/test-setup.ts b/packages/zora/src/test-setup.ts index a6dade1ab..13e58a31f 100644 --- a/packages/zora/src/test-setup.ts +++ b/packages/zora/src/test-setup.ts @@ -16,7 +16,7 @@ export const passingTestCasesMint = [ createTestCase(MINT_WITH_REWARDS, 'Minting with rewards'), createTestCase(MINT_WITH_REWARDS_1155, 'Minting with rewards 1155'), createTestCase(MINT_BATCH_WITHOUT_FEES, 'When using the batch mint function'), - createTestCase(BATCH_MINT_ARB, 'when using batch mint function on optimism'), + createTestCase(BATCH_MINT_ARB, 'when using batch mint function on arbitrum'), createTestCase(MINT, 'when using mint function'), createTestCase(MINT_WITH_REWARDS, 'when contractAddress is checksummed', { contractAddress: getAddress(MINT_WITH_REWARDS.params.contractAddress), From f511250a8ac5079f0921e1d4e523441f92886b97 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 13:34:20 -0700 Subject: [PATCH 13/16] test(zora): update blast test to use mintable contract --- packages/zora/src/Zora.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/zora/src/Zora.test.ts b/packages/zora/src/Zora.test.ts index ecbdb73eb..7ed15c118 100644 --- a/packages/zora/src/Zora.test.ts +++ b/packages/zora/src/Zora.test.ts @@ -425,7 +425,7 @@ describe('simulateMint function', () => { _account: Address, ) => ({ request: { - address: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', + address: '0x553f0a63858a9000212cdbd0c40cf7861b692dc0', value: parseEther('0.000777'), }, }), @@ -434,7 +434,7 @@ describe('simulateMint function', () => { const mint: MintIntentParams = { chainId: Chains.BLAST, - contractAddress: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', + contractAddress: '0x553f0a63858a9000212cdbd0c40cf7861b692dc0', tokenId: 1, amount: BigInt(1), recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', From 633420985878dcfa563ba95b307f2f5eab9f7942 Mon Sep 17 00:00:00 2001 From: mmackz Date: Mon, 15 Jul 2024 22:11:28 -0700 Subject: [PATCH 14/16] refactor(zora): rename variable --- packages/zora/src/Zora.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 716d3528c..15ff5d3bf 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -128,13 +128,13 @@ export const mint = async ( }) } if (referral) { - const checksumAddress = getAddress(referral) + const referralAddress = getAddress(referral) andArray1155.push({ $or: [ - { mintReferral: checksumAddress }, + { mintReferral: referralAddress }, { rewardsRecipients: { - $and: [{ $first: checksumAddress }, { $last: checksumAddress }], + $and: [{ $first: referralAddress }, { $last: referralAddress }], }, }, ], From 2d568ea0ed6a8ef6b24be75b5f910fddbdd4554c Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 12:07:27 -0700 Subject: [PATCH 15/16] refactor(zora): update rewardsRecipients to use array instead of $and operator --- packages/zora/src/Zora.ts | 4 +--- packages/zora/src/types.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 15ff5d3bf..23f2839d7 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -133,9 +133,7 @@ export const mint = async ( $or: [ { mintReferral: referralAddress }, { - rewardsRecipients: { - $and: [{ $first: referralAddress }, { $last: referralAddress }], - }, + rewardsRecipients: [referralAddress], }, ], }) diff --git a/packages/zora/src/types.ts b/packages/zora/src/types.ts index c704a1d47..1b10f5acf 100644 --- a/packages/zora/src/types.ts +++ b/packages/zora/src/types.ts @@ -51,5 +51,5 @@ export type AndArrayItem = | RecipientCondition | { tokenId: string | number } | { mintReferral: Address } - | { rewardsRecipients: { $and: [{ $first: Address }, { $last: Address }] } } + | { rewardsRecipients: Address[] } | { $or: AndArrayItem[] } From bee49ccf39a923ae3030136697e2f87eca75a959 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 15:02:53 -0700 Subject: [PATCH 16/16] refactor(zora): remove checksum on referral --- packages/zora/src/Zora.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 23f2839d7..ced203ea2 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -128,12 +128,11 @@ export const mint = async ( }) } if (referral) { - const referralAddress = getAddress(referral) andArray1155.push({ $or: [ - { mintReferral: referralAddress }, + { mintReferral: referral }, { - rewardsRecipients: [referralAddress], + rewardsRecipients: [referral], }, ], })