From 1949d2060440b90645a72b8e0227d93b329f61fa Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 29 Oct 2024 21:53:09 -0700 Subject: [PATCH 1/7] feat(snippets): add BoostCore and BoostRegistry imports --- snippets/config.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/config.mdx b/snippets/config.mdx index 8f43aba3..656dba0e 100644 --- a/snippets/config.mdx +++ b/snippets/config.mdx @@ -1,4 +1,6 @@ ```ts config.ts +import { BoostCore } from "@boostxyz/sdk/BoostCore"; +import { BoostRegistry } from "@boostxyz/sdk/BoostRegistry"; import { http, createConfig } from '@wagmi/core' import { mainnet, sepolia } from '@wagmi/core/chains' @@ -9,4 +11,7 @@ export const config = createConfig({ [sepolia.id]: http(), }, }) + +export const core = new BoostCore({ config }) +export const registry = new BoostRegistry({ config }) ``` \ No newline at end of file From be0b5429fc7811a919214e38e27ad8a61947b846 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 29 Oct 2024 21:53:26 -0700 Subject: [PATCH 2/7] docs: Add create-boost page to documentation list --- mint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mint.json b/mint.json index 74907608..0f68a125 100644 --- a/mint.json +++ b/mint.json @@ -232,7 +232,8 @@ "pages": [ "v2/boost-sdk/boost-core/overview", "v2/boost-sdk/boost-core/get-boosts", - "v2/boost-sdk/boost-core/claim-incentive" + "v2/boost-sdk/boost-core/claim-incentive", + "v2/boost-sdk/boost-core/create-boost" ] }, { From e7bd644e16184298db21973e87373c7a71846bf2 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 29 Oct 2024 21:53:38 -0700 Subject: [PATCH 3/7] feat(docs): add createBoost documentation and examples --- v2/boost-sdk/boost-core/create-boost.mdx | 140 +++++++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/v2/boost-sdk/boost-core/create-boost.mdx b/v2/boost-sdk/boost-core/create-boost.mdx index 800b87aa..b8a19dc6 100644 --- a/v2/boost-sdk/boost-core/create-boost.mdx +++ b/v2/boost-sdk/boost-core/create-boost.mdx @@ -4,5 +4,145 @@ title: "Create Boosts" import SDKDisclaimer from '/snippets/sdk-disclaimer.mdx'; import ReadParams from '/snippets/read-params.mdx'; +import Config from '/snippets/config.mdx'; + +The SDK provides a `createBoost` function that simplifies the process of creating a Boost. +To create a Boost, you need to provide a budget with available funds, an action you want to incentivize, +and create the incentives you want to offer. + +{/* TODO: Link out to the budget, action and incentives docs */} + +You can also specify a validator, accesslist, and other parameters to further customize your Boost. + +{/* TODO: Link out to the validator, accesslist docs */} + +In most cases you will want to use the default parameters for the validator, as this allows Boost to handle validation and signature logic for you. +If you do want to use a custom validator, you can learn more how it works [here](/temp-link). + +## API + +### `createBoost` + +Creates a new Boost. + + +```ts index.ts +import { core } from './config' +import { action } from './action' +import { incentives } from './incentives' + +const budget = core.ManagedBudget( + "0xBUDGET_ADDRESS" +) + +const boosts = await core.createBoost({ + maxParticipants: 100n, + budget, + action, + allowList: core.OpenAllowList(), + incentives, +}); +``` + + + +```ts action.ts +import { core } from './config' +import { + ActionStep, + SignatureType, + FilterType, + PrimitiveType, + ActionClaimant, +} from '@boostxyz/sdk/Actions/EventAction' +import { selectors as funcSelectors } from '@boostxyz/signatures/functions' +import { Hex, toHex } from 'viem'; +import { zora } from 'viem/chains'; + +const targetContract = '0x777777722d078c97c6ad07d9f36801e653e356ae' +const mintSelector = funcSelectors['mint(address mintTo,uint256 quantity,address collection,uint256 tokenId,address mintReferral,string comment)'] as Hex; + +const commonParams = { + chainid: zora.id, + signature: mintSelector, + signatureType: SignatureType.FUNC, + targetContract: targetContract, +} as const + +// Target a specific collection on Zora TimedSalesStrategy contract +const mintActionStep1: ActionStep = { + ...commonParams, + actionParameter: { + filterType: FilterType.EQUAL, + fieldType: PrimitiveType.ADDRESS, + fieldIndex: 2, // collection + filterData: '0x3263023c87502f1676f00df902b1237f93da26a9', + }, +}; + +// Target a specific tokenId on the collection +const mintActionStep2: ActionStep = { + ...commonParams, + actionParameter: { + filterType: FilterType.EQUAL, + fieldType: PrimitiveType.UINT, + fieldIndex: 3, // tokenId + filterData: toHex(1), + }, +} + +// Target the mintTo field for the claimant +const actionClaimant: ActionClaimant = { + ...commonParams, + fieldIndex: 0, // mintTo +} + +const eventActionPayload = { + actionClaimant, + actionSteps: [mintActionStep1, mintActionStep2], +}; + +export const action = core.EventAction(eventActionPayload) +``` + +```ts incentives.ts +import { core } from './config' +import { StrategyType } from '@boostxyz/sdk' +import { parseEther } from 'viem' + +export const incentives = [ + core.ERC20Incentive({ + asset: "0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D", + reward: parseEther("0.5"), + limit: 2n, + strategy: StrategyType.POOL, + manager: "0xMANAGER_ADDRESS" + }), +], +``` + + +#### Parameters + +CreateBoostPayload} required> + + Budget} required /> + Action} required /> + Validator} /> + AllowList} /> + Incentive[]} required /> + + + + + + + + +#### Returns + + + Returns the created Boost. + From 9daa58ce0195735523ba6f1c7a016f71cf59de0e Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 29 Oct 2024 21:57:31 -0700 Subject: [PATCH 4/7] fix(boost-core): update limit for ERC20 incentive --- v2/boost-sdk/boost-core/create-boost.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/boost-sdk/boost-core/create-boost.mdx b/v2/boost-sdk/boost-core/create-boost.mdx index b8a19dc6..900cc8bd 100644 --- a/v2/boost-sdk/boost-core/create-boost.mdx +++ b/v2/boost-sdk/boost-core/create-boost.mdx @@ -116,7 +116,7 @@ export const incentives = [ core.ERC20Incentive({ asset: "0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D", reward: parseEther("0.5"), - limit: 2n, + limit: 100n, strategy: StrategyType.POOL, manager: "0xMANAGER_ADDRESS" }), From e518497e8b7b5a2bcb336afd0232c5856d6ec2b1 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 29 Oct 2024 21:57:53 -0700 Subject: [PATCH 5/7] docs: update parameter name in create-boost.mdx --- v2/boost-sdk/boost-core/create-boost.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/boost-sdk/boost-core/create-boost.mdx b/v2/boost-sdk/boost-core/create-boost.mdx index 900cc8bd..4354c6a9 100644 --- a/v2/boost-sdk/boost-core/create-boost.mdx +++ b/v2/boost-sdk/boost-core/create-boost.mdx @@ -126,7 +126,7 @@ export const incentives = [ #### Parameters -CreateBoostPayload} required> +CreateBoostPayload} required> Budget} required /> Action} required /> From 5aee4a7ded3ed92413d1dbdc7ba386ffe3cc17de Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 29 Oct 2024 22:02:00 -0700 Subject: [PATCH 6/7] feat(boost-core): update action handling in create-boost.mdx --- v2/boost-sdk/boost-core/create-boost.mdx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/v2/boost-sdk/boost-core/create-boost.mdx b/v2/boost-sdk/boost-core/create-boost.mdx index 4354c6a9..f92210a2 100644 --- a/v2/boost-sdk/boost-core/create-boost.mdx +++ b/v2/boost-sdk/boost-core/create-boost.mdx @@ -30,7 +30,7 @@ Creates a new Boost. ```ts index.ts import { core } from './config' -import { action } from './action' +import { eventActionPayload } from './action' import { incentives } from './incentives' const budget = core.ManagedBudget( @@ -40,8 +40,8 @@ const budget = core.ManagedBudget( const boosts = await core.createBoost({ maxParticipants: 100n, budget, - action, - allowList: core.OpenAllowList(), + action: core.EventAction(eventActionPayload), + allowList: core.OpenAllowList(), // public allowlist incentives, }); ``` @@ -99,16 +99,13 @@ const actionClaimant: ActionClaimant = { fieldIndex: 0, // mintTo } -const eventActionPayload = { +export const eventActionPayload = { actionClaimant, actionSteps: [mintActionStep1, mintActionStep2], }; - -export const action = core.EventAction(eventActionPayload) ``` ```ts incentives.ts -import { core } from './config' import { StrategyType } from '@boostxyz/sdk' import { parseEther } from 'viem' From e1442d1f3c848bed8adf23e119958d2d53bf5299 Mon Sep 17 00:00:00 2001 From: mmackz Date: Tue, 29 Oct 2024 22:03:06 -0700 Subject: [PATCH 7/7] docs: update import from ReadParams to WriteParams --- v2/boost-sdk/boost-core/create-boost.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/boost-sdk/boost-core/create-boost.mdx b/v2/boost-sdk/boost-core/create-boost.mdx index f92210a2..2257c56a 100644 --- a/v2/boost-sdk/boost-core/create-boost.mdx +++ b/v2/boost-sdk/boost-core/create-boost.mdx @@ -3,7 +3,7 @@ title: "Create Boosts" --- import SDKDisclaimer from '/snippets/sdk-disclaimer.mdx'; -import ReadParams from '/snippets/read-params.mdx'; +import WriteParams from '/snippets/write-params.mdx'; import Config from '/snippets/config.mdx'; @@ -136,7 +136,7 @@ export const incentives = [ - + #### Returns