Skip to content

Commit

Permalink
test(zora): setup test for mint function with referral
Browse files Browse the repository at this point in the history
  • Loading branch information
mmackz committed Jul 15, 2024
1 parent 58be3c8 commit 1f6b17a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
10 changes: 9 additions & 1 deletion packages/zora/src/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
}),
Expand Down Expand Up @@ -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 = [
Expand Down
23 changes: 22 additions & 1 deletion packages/zora/src/test-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<MintActionParams> = {
transaction: {
Expand All @@ -21,6 +22,24 @@ export const BASIC_PURCHASE: TestParams<MintActionParams> = {
},
}

export const MINT: TestParams<MintActionParams> = {
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<MintActionParams> = {
transaction: {
chainId: 1, // Ethereum
Expand Down Expand Up @@ -53,6 +72,7 @@ export const MINT_WITH_REWARDS_1155: TestParams<MintActionParams> = {
contractAddress: '0x4c0c2dd31d2661e8bcec60a42e803dcc6f81baad',
amount: '1',
tokenId: 25,
referral: zeroAddress,
},
}

Expand All @@ -71,6 +91,7 @@ export const MINT_BATCH_WITHOUT_FEES: TestParams<MintActionParams> = {
contractAddress: '0xe538598941e4a25f471aef9b1b5dffd6ee0fda54',
amount: '1',
tokenId: 2,
referral: zeroAddress,
},
}

Expand Down Expand Up @@ -98,7 +119,7 @@ export const EXPECTED_ENCODED_DATA_1155 =

export const BATCH_MINT_ARB: TestParams<MintActionParams> = {
transaction: {
chainId: 42161, // Optimism
chainId: 42161, // Arbitrum
from: '0x1671b592610fb7427ed788b66fa3e9217ff41047',
hash: '0x4c0d898b6f3864332e3e47a3924cad33491b8df0a05590d13175823ee62ef07c',
input:
Expand Down

0 comments on commit 1f6b17a

Please sign in to comment.