From 299e90bbaa3c865e2fbe839aad66a1cffaeb45fd Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 17:42:35 -0700 Subject: [PATCH 1/7] feat(utils): export default referral address from utils --- packages/utils/src/constants/index.ts | 1 + packages/utils/src/constants/referral.ts | 4 ++++ packages/utils/src/index.ts | 1 + 3 files changed, 6 insertions(+) create mode 100644 packages/utils/src/constants/referral.ts diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.ts index 2069cc915..e94bc13b5 100644 --- a/packages/utils/src/constants/index.ts +++ b/packages/utils/src/constants/index.ts @@ -4,3 +4,4 @@ export { BOOST_TREASURY_ADDRESS, } from './contract-addresses' export { Chains } from './chain-ids' +export { REFERRAL_ADDRESS } from './referral' diff --git a/packages/utils/src/constants/referral.ts b/packages/utils/src/constants/referral.ts new file mode 100644 index 000000000..256751934 --- /dev/null +++ b/packages/utils/src/constants/referral.ts @@ -0,0 +1,4 @@ +/** + * Boost-Owned EOA for collecting referral fees. + */ +export const REFERRAL_ADDRESS = '0xe3bBA2A4F8E0F5C32EF5097F988a4d88075C8B48' \ No newline at end of file diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index b2929af68..36aa4313c 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -3,6 +3,7 @@ export { Chains, DEFAULT_ACCOUNT, BOOST_TREASURY_ADDRESS, + REFERRAL_ADDRESS, } from './constants/index' export type { TestParams, TestCase } from './helpers/index' From f76913cd1083d0b980a2c8ad155f5adaae5bd0a9 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 17:46:13 -0700 Subject: [PATCH 2/7] refactor(utils): update referral constant name to DEFAULT_REFERRAL --- packages/utils/src/constants/index.ts | 2 +- packages/utils/src/constants/referral.ts | 2 +- packages/utils/src/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.ts index e94bc13b5..cf6ae2539 100644 --- a/packages/utils/src/constants/index.ts +++ b/packages/utils/src/constants/index.ts @@ -4,4 +4,4 @@ export { BOOST_TREASURY_ADDRESS, } from './contract-addresses' export { Chains } from './chain-ids' -export { REFERRAL_ADDRESS } from './referral' +export { DEFAULT_REFERRAL } from './referral' diff --git a/packages/utils/src/constants/referral.ts b/packages/utils/src/constants/referral.ts index 256751934..87bd71a82 100644 --- a/packages/utils/src/constants/referral.ts +++ b/packages/utils/src/constants/referral.ts @@ -1,4 +1,4 @@ /** * Boost-Owned EOA for collecting referral fees. */ -export const REFERRAL_ADDRESS = '0xe3bBA2A4F8E0F5C32EF5097F988a4d88075C8B48' \ No newline at end of file +export const DEFAULT_REFERRAL = '0xe3bBA2A4F8E0F5C32EF5097F988a4d88075C8B48' diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 36aa4313c..9d85f4f5d 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -3,7 +3,7 @@ export { Chains, DEFAULT_ACCOUNT, BOOST_TREASURY_ADDRESS, - REFERRAL_ADDRESS, + DEFAULT_REFERRAL, } from './constants/index' export type { TestParams, TestCase } from './helpers/index' From bb5f48cf5f17e730d627d9cd4ee23c220664babd Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 17:49:14 -0700 Subject: [PATCH 3/7] feat(pods): use ref address from utils --- packages/pods/src/Pods.test.ts | 4 ++-- packages/pods/src/Pods.ts | 16 +++++----------- packages/pods/src/contract-addresses.ts | 4 ---- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/packages/pods/src/Pods.test.ts b/packages/pods/src/Pods.test.ts index 989c4da2f..94389e3ba 100644 --- a/packages/pods/src/Pods.test.ts +++ b/packages/pods/src/Pods.test.ts @@ -1,5 +1,6 @@ import { Chains, + DEFAULT_REFERRAL, type MintActionParams, type MintIntentParams, } from '@rabbitholegg/questdk-plugin-utils' @@ -9,7 +10,6 @@ import { describe, expect, test, vi } from 'vitest' import { getExternalUrl, getMintIntent, mint } from './Pods' import { failingTestCases, passingTestCases } from './test-setup' import { EXPECTED_ENCODED_DATA_1155 } from './test-transactions' -import { ZORA_DEPLOYER_ADDRESS } from './contract-addresses' describe('Given the pods plugin', () => { describe('When handling the mint', () => { @@ -228,7 +228,7 @@ describe('getExternalUrl function', () => { } const result = await getExternalUrl(params) expect(result).toBe( - `https://pods.media/mint-podcast/why-social-needs-a-layer-2-ft-ryan-li-of-cyber?referrer=${ZORA_DEPLOYER_ADDRESS}`, + `https://pods.media/mint-podcast/why-social-needs-a-layer-2-ft-ryan-li-of-cyber?referrer=${DEFAULT_REFERRAL}`, ) }) diff --git a/packages/pods/src/Pods.ts b/packages/pods/src/Pods.ts index 097830485..5073cf963 100644 --- a/packages/pods/src/Pods.ts +++ b/packages/pods/src/Pods.ts @@ -1,10 +1,7 @@ import axios from 'axios' import { FEES_ABI, ZORA_MINTER_ABI_1155 } from './abi' import { CHAIN_ID_ARRAY } from './chain-ids' -import { - FIXED_PRICE_SALE_STRATS, - ZORA_DEPLOYER_ADDRESS, -} from './contract-addresses' +import { FIXED_PRICE_SALE_STRATS } from './contract-addresses' import { type AndArrayItem, getLatestTokenId, getUri } from './utils' import { type MintActionParams, @@ -13,6 +10,7 @@ import { } from '@rabbitholegg/questdk' import { DEFAULT_ACCOUNT, + DEFAULT_REFERRAL, type MintIntentParams, chainIdToViemChain, getExitAddresses, @@ -88,9 +86,7 @@ export const getMintIntent = async ( const fixedPriceSaleStratAddress = FIXED_PRICE_SALE_STRATS[chainId] const _tokenId = tokenId ?? (await getLatestTokenId(contractAddress, chainId)) - const referralAddress = referral - ? getAddress(referral) - : ZORA_DEPLOYER_ADDRESS + const referralAddress = referral ? getAddress(referral) : DEFAULT_REFERRAL const mintArgs = [ fixedPriceSaleStratAddress, @@ -134,9 +130,7 @@ export const simulateMint = async ( } const fixedPriceSaleStratAddress = FIXED_PRICE_SALE_STRATS[chainId] - const referralAddress = referral - ? getAddress(referral) - : ZORA_DEPLOYER_ADDRESS + const referralAddress = referral ? getAddress(referral) : DEFAULT_REFERRAL const mintArgs = [ fixedPriceSaleStratAddress, @@ -221,7 +215,7 @@ export const getExternalUrl = async ( // different properties depending on uri function. One of these will be defined const baseUrl = data.external_link ?? data.external_url - return `${baseUrl}?referrer=${referral ?? ZORA_DEPLOYER_ADDRESS}` + return `${baseUrl}?referrer=${referral ?? DEFAULT_REFERRAL}` } catch (error) { console.error('an error occurred fetching data from the contract') if (error instanceof Error) { diff --git a/packages/pods/src/contract-addresses.ts b/packages/pods/src/contract-addresses.ts index 6f048c1a5..d9cb27ddd 100644 --- a/packages/pods/src/contract-addresses.ts +++ b/packages/pods/src/contract-addresses.ts @@ -9,7 +9,3 @@ export const FIXED_PRICE_SALE_STRATS: { [chainId: number]: Address } = { [Chains.BASE]: '0x04E2516A2c207E84a1839755675dfd8eF6302F0a', [Chains.ARBITRUM_ONE]: '0x1Cd1C1f3b8B779B50Db23155F2Cb244FCcA06B21', } - -// for referrals -export const ZORA_DEPLOYER_ADDRESS = - '0xe3bBA2A4F8E0F5C32EF5097F988a4d88075C8B48' From faa10e15a61acf7af658b7c56d1451ba5087b7d2 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 17:50:54 -0700 Subject: [PATCH 4/7] refactor(sound): use ref address from utils --- packages/soundxyz/src/Soundxyz.test.ts | 8 ++++---- packages/soundxyz/src/Soundxyz.ts | 6 +++--- packages/soundxyz/src/constants.ts | 4 ---- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/soundxyz/src/Soundxyz.test.ts b/packages/soundxyz/src/Soundxyz.test.ts index c2d136495..913f3a0ec 100644 --- a/packages/soundxyz/src/Soundxyz.test.ts +++ b/packages/soundxyz/src/Soundxyz.test.ts @@ -9,7 +9,6 @@ import { SUPERMINTER, SUPERMINTER_V2, SUPERMINTER_V2_ABI, - ZORA_DEPLOYER_ADDRESS, } from './constants' import { OP_SUPERMINTER_V2, @@ -20,6 +19,7 @@ import { Chains } from './utils' import { apply } from '@rabbitholegg/questdk' import { ActionType, + DEFAULT_REFERRAL, type DisctriminatedActionParams, type MintActionParams, type MintIntentParams, @@ -181,7 +181,7 @@ describe('simulateMint function', () => { contractAddress: '0xdf71F2F15bCcDC7c7A89F01dd45cDE5A43F7e79f', amount: BigInt(1), recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', - referral: ZORA_DEPLOYER_ADDRESS, + referral: DEFAULT_REFERRAL, } const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' @@ -198,7 +198,7 @@ describe('simulateMint function', () => { contractAddress: '0x0c418874315698096ecA7ce0e1Dccf0A517DC9DE', amount: BigInt(1), recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', - referral: ZORA_DEPLOYER_ADDRESS, + referral: DEFAULT_REFERRAL, } const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' @@ -236,7 +236,7 @@ describe('getExternalUrl', () => { const link = await getExternalUrl(mintParams) expect(link).equals( - `https://www.sound.xyz/33below/midnight-diner-ii?referral=${ZORA_DEPLOYER_ADDRESS}`, + `https://www.sound.xyz/33below/midnight-diner-ii?referral=${DEFAULT_REFERRAL}`, ) }) }) diff --git a/packages/soundxyz/src/Soundxyz.ts b/packages/soundxyz/src/Soundxyz.ts index c20afbf38..303027412 100644 --- a/packages/soundxyz/src/Soundxyz.ts +++ b/packages/soundxyz/src/Soundxyz.ts @@ -9,7 +9,6 @@ import { SUPERMINTER_V2_ABI, TOTAL_PRICE_AND_FEES_V1_ABI, TOTAL_PRICE_AND_FEES_V2_ABI, - ZORA_DEPLOYER_ADDRESS, } from './constants' import type { TotalPriceAndFees } from './types' import { Chains } from './utils' @@ -21,6 +20,7 @@ import { import { ActionType, DEFAULT_ACCOUNT, + DEFAULT_REFERRAL, type DisctriminatedActionParams, type MintIntentParams, chainIdToViemChain, @@ -135,7 +135,7 @@ export const simulateMint = async ( signedClaimTicket: 0, signedDeadline: 0, signature: zeroHash, - affiliate: referral ?? ZORA_DEPLOYER_ADDRESS, + affiliate: referral ?? DEFAULT_REFERRAL, affiliateProof: [zeroHash], attributionId: 0, } @@ -312,7 +312,7 @@ export const getExternalUrl = async ( const { data } = await axios.get(`https://arweave.net/${cid}`) const { external_link } = data - return `${external_link}?referral=${referral ?? ZORA_DEPLOYER_ADDRESS}` + return `${external_link}?referral=${referral ?? DEFAULT_REFERRAL}` } catch (error) { console.error('an error occurred fetching the contract uri') if (error instanceof Error) { diff --git a/packages/soundxyz/src/constants.ts b/packages/soundxyz/src/constants.ts index 80730eb19..32c88ec34 100644 --- a/packages/soundxyz/src/constants.ts +++ b/packages/soundxyz/src/constants.ts @@ -326,7 +326,3 @@ export const CONTRACT_URI_ABI = [ type: 'function', }, ] - -// for referrals -export const ZORA_DEPLOYER_ADDRESS = - '0xe3bBA2A4F8E0F5C32EF5097F988a4d88075C8B48' From fd15ad928b6b1bf9133872037c658d718e488d1b Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 17:52:48 -0700 Subject: [PATCH 5/7] refactor(zora): use ref address from utils --- packages/zora/src/Zora.test.ts | 2 +- packages/zora/src/Zora.ts | 2 +- packages/zora/src/contract-addresses.ts | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/zora/src/Zora.test.ts b/packages/zora/src/Zora.test.ts index da228ff7b..3048b58ab 100644 --- a/packages/zora/src/Zora.test.ts +++ b/packages/zora/src/Zora.test.ts @@ -19,6 +19,7 @@ import { import { ActionType, Chains, + DEFAULT_REFERRAL as ZORA_DEPLOYER_ADDRESS, type DisctriminatedActionParams, type MintActionParams, type MintIntentParams, @@ -30,7 +31,6 @@ 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 = [ { diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index 0e6703273..51cd22bf0 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -10,7 +10,6 @@ import { CHAIN_ID_ARRAY, CHAIN_ID_TO_ZORA_SLUG } from './chain-ids' import { FIXED_PRICE_SALE_STRATS, ZORA_1155_FACTORY, - ZORA_DEPLOYER_ADDRESS, } from './contract-addresses' import { AndArrayItem } from './types' import { validatePremint } from './validate' @@ -24,6 +23,7 @@ import { formatAmount } from '@rabbitholegg/questdk-plugin-utils' import { ActionType, DEFAULT_ACCOUNT, + DEFAULT_REFERRAL as ZORA_DEPLOYER_ADDRESS, type DisctriminatedActionParams, type MintIntentParams, chainIdToViemChain, diff --git a/packages/zora/src/contract-addresses.ts b/packages/zora/src/contract-addresses.ts index 1c0cc264a..aaeeeeba3 100644 --- a/packages/zora/src/contract-addresses.ts +++ b/packages/zora/src/contract-addresses.ts @@ -12,7 +12,3 @@ export const FIXED_PRICE_SALE_STRATS: { [chainId: number]: Address } = { } export const ZORA_1155_FACTORY = '0x777777c338d93e2c7adf08d102d45ca7cc4ed021' - -// for referrals -export const ZORA_DEPLOYER_ADDRESS = - '0xe3bBA2A4F8E0F5C32EF5097F988a4d88075C8B48' From c6216c1209692f0f2d8e351a36f8c21d5210c838 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 17:55:07 -0700 Subject: [PATCH 6/7] chore: format --- packages/soundxyz/src/Soundxyz.test.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/soundxyz/src/Soundxyz.test.ts b/packages/soundxyz/src/Soundxyz.test.ts index 913f3a0ec..9484b78da 100644 --- a/packages/soundxyz/src/Soundxyz.test.ts +++ b/packages/soundxyz/src/Soundxyz.test.ts @@ -5,11 +5,7 @@ import { mint, simulateMint, } from './Soundxyz' -import { - SUPERMINTER, - SUPERMINTER_V2, - SUPERMINTER_V2_ABI, -} from './constants' +import { SUPERMINTER, SUPERMINTER_V2, SUPERMINTER_V2_ABI } from './constants' import { OP_SUPERMINTER_V2, failingTestCases, From 485708435bcf129d381e54b1faf0024cbae42819 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 16 Jul 2024 17:55:46 -0700 Subject: [PATCH 7/7] chore: generate changeset --- .changeset/chilly-flies-cheer.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/chilly-flies-cheer.md diff --git a/.changeset/chilly-flies-cheer.md b/.changeset/chilly-flies-cheer.md new file mode 100644 index 000000000..d95031765 --- /dev/null +++ b/.changeset/chilly-flies-cheer.md @@ -0,0 +1,8 @@ +--- +"@rabbitholegg/questdk-plugin-soundxyz": patch +"@rabbitholegg/questdk-plugin-utils": patch +"@rabbitholegg/questdk-plugin-pods": patch +"@rabbitholegg/questdk-plugin-zora": patch +--- + +add default ref address to utils package