Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial SDK release #10

Merged
merged 77 commits into from
Jul 23, 2024
Merged

Conversation

sammccord
Copy link
Contributor

@sammccord sammccord commented Jun 17, 2024

  • add @boostxyz/sdk, v0 structure, functionality for all protocol artifacts (except ERC1155Incentive)
  • tsdoc comments + gha for automatic tsdoc release flow
  • sdk integration tests using hardhat
  • release pipeline

Copy link

linear bot commented Jun 17, 2024

BOOST-3883 Protocol V2 SDK Creation Flow

Create

This is our current data structure for creation:

export const CreateQuestInputSchema = z.object({
  networkId: z.string().optional(), // used to specify the network when a task supports multiple
  projectId: z.string().uuid(),
  actionId: z.string().uuid().optional(), // this is actually taskId
  taskId: z.string().uuid().optional(),
  // TODO: update to support reward network like quests query
  actionParams: QuestActionParamsSchema,
  rewardTokenId: z.string(), // TODO: remove this in favor of rewardTokenAddress & rewardTokenNetworkId
  rewardTokenAddress: z.string(),
  rewardTokenNetworkId: z.string().optional(),
  rewardAmount: z.string(),
  participantLimit: z.number(),
  startTime: z.string().optional(),
  endTime: z.string(),
  accessList: z
    .object({
      allow: z.array(z.string()).optional(),
      deny: z.array(z.string()).optional(),
    })
    .optional(),
});

There's two different networks in play - the action network and the reward network. Assuming we're going to be using a node-based architecture with edges on each network we presumably don't need to monitor the chain-state.

Initially it probably makes sense for the contract network to be the reward network. In the new architecture we handle this by passing asset in instead of rewardTokenAddress POOL in for Strategy, reward in for rewardAmount and limit in for participationLimit

There isn't currently a notion of startTime or endTime in the contract system. A SimpleAllowList can work when the accessList is small, but it requires all the addresses to be passed on-chain so we may need a different solution near term. We could continue to rely on signatures for this, at which point we would need an on-chain allowlist that serves to store our backend identifiers for the off-chain allowlists.

This leaves all of the remaining fields that need to be represented on-chain in some fashion:

networkId: z.string().optional(), // used to specify the network when a task supports multiple
projectId: z.string().uuid(),
actionId: z.string().uuid().optional(), // this is actually taskId
taskId: z.string().uuid().optional(),
// TODO: update to support reward network like quests query
actionParams: QuestActionParamsSchema,

We need to create an Action that encodes all of this information.

packages/sdk/src/index.ts Outdated Show resolved Hide resolved
}),
]);

await core.write.createBoost([
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hell yeah this looking sexy af 🔥

// // create simple budget
// }

// if (!payload.action) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I'm going to start working on today

this.config = config;
}

public async *createBoost({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like an AsyncGenerator for this to provide incremental updates to the calling context, you could potentially feed them into SSE or websockets for good feedback, and you have better clarity into how far the task got if something went wrong.

@sammccord sammccord marked this pull request as ready for review July 17, 2024 22:40
@sammccord sammccord requested a review from a team as a code owner July 17, 2024 22:40
@sammccord sammccord changed the title [WIP] Sample creation functionality Initial SDK release Jul 23, 2024
@boostxyz boostxyz deleted a comment from vercel bot Jul 23, 2024
@sammccord sammccord merged commit d5d8db3 into main Jul 23, 2024
3 checks passed
@sammccord sammccord deleted the sam/boost-3883-protocol-v2-sdk-creation-flow branch July 23, 2024 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants