Skip to content

Commit

Permalink
Merge pull request #117 from rabbitholegg/add_zora_plugin
Browse files Browse the repository at this point in the history
Feat(zora): add mint plugin
  • Loading branch information
Quazia authored Dec 5, 2023
2 parents a88d22f + 237ea18 commit e3b4f08
Show file tree
Hide file tree
Showing 41 changed files with 837 additions and 107 deletions.
6 changes: 6 additions & 0 deletions .changeset/wicked-spoons-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rabbitholegg/questdk-plugin-registry": patch
"@rabbitholegg/questdk-plugin-zora": patch
---

Release Zora plugin
5 changes: 5 additions & 0 deletions .changeset/witty-zoos-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rabbitholegg/questdk-plugin-basepaint": patch
---

update mint action params
2 changes: 1 addition & 1 deletion packages/across/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/arbitrum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/balancer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/basepaint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.16.6"
}
}
12 changes: 8 additions & 4 deletions packages/basepaint/src/Basepaint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ describe('Given the basepaint plugin', () => {
describe('When handling the mint filter', () => {
test('should return a valid action filter', async () => {
const filter = await mint({
address: CONTRACT_ADDRESS,
chainId: 8453,
contractAddress: CONTRACT_ADDRESS,
tokenId: 69,
amount: GreaterThanOrEqual(1),
})
Expand All @@ -27,7 +28,8 @@ describe('Given the basepaint plugin', () => {
test('should pass filter with valid transactions', async () => {
const transaction = TEST_TRANSACTIONS[0]
const filter = await mint({
address: CONTRACT_ADDRESS,
chainId: 8453,
contractAddress: CONTRACT_ADDRESS,
tokenId: 52,
amount: GreaterThanOrEqual(1),
})
Expand All @@ -37,7 +39,8 @@ describe('Given the basepaint plugin', () => {
test('should fail filter with invalid tokenId', async () => {
const transaction = TEST_TRANSACTIONS[1]
const filter = await mint({
address: CONTRACT_ADDRESS,
chainId: 8453,
contractAddress: CONTRACT_ADDRESS,
tokenId: 52, // valid tokenId is 62
amount: GreaterThanOrEqual(1),
})
Expand All @@ -47,7 +50,8 @@ describe('Given the basepaint plugin', () => {
test('should fail filter with invalid amount', async () => {
const transaction = TEST_TRANSACTIONS[0]
const filter = await mint({
address: CONTRACT_ADDRESS,
chainId: 8453,
contractAddress: CONTRACT_ADDRESS,
tokenId: 52,
amount: GreaterThanOrEqual(2),
})
Expand Down
4 changes: 2 additions & 2 deletions packages/basepaint/src/Basepaint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { BASE_CHAIN_ID, CONTRACT_ADDRESS, MINT_ABI } from './constants'
export const mint = async (
mint: MintActionParams,
): Promise<TransactionFilter> => {
const { address, tokenId, amount } = mint
const { contractAddress, tokenId, amount } = mint

return compressJson({
chainId: BASE_CHAIN_ID,
to: address, // mint contract address
to: contractAddress, // mint contract address
input: {
$abi: MINT_ABI,
day: tokenId,
Expand Down
2 changes: 1 addition & 1 deletion packages/camelot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/connext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@connext/nxtp-txservice": "^2.0.0",
"@connext/nxtp-utils": "^2.0.4",
"@connext/smart-contracts": "^2.0.0",
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.16.6"
}
}
2 changes: 1 addition & 1 deletion packages/gmx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"axios": "1.5.0",
"viem": "1.2.15"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/hop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"@hop-protocol/core": "0.0.1-beta.182",
"@hop-protocol/sdk": "0.0.1-beta.535",
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/hyphen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/okutrade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.16.6"
}
}
2 changes: 1 addition & 1 deletion packages/optimism/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@eth-optimism/contracts-ts": "0.15.0",
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/paraswap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"dependencies": {
"@paraswap/sdk": "^6.2.4",
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"axios": "1.5.0",
"viem": "1.2.15"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/polygon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@maticnetwork/pos-portal": "1.5.2",
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "1.2.15"
}
}
2 changes: 1 addition & 1 deletion packages/rabbithole/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.16.6"
}
}
3 changes: 2 additions & 1 deletion packages/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"@rabbitholegg/questdk-plugin-across": "workspace:*",
"@rabbitholegg/questdk-plugin-arbitrum": "workspace:*",
"@rabbitholegg/questdk-plugin-basepaint": "workspace:*",
Expand All @@ -63,6 +63,7 @@
"@rabbitholegg/questdk-plugin-okutrade": "workspace:*",
"@rabbitholegg/questdk-plugin-balancer": "workspace:*",
"@rabbitholegg/questdk-plugin-traderjoe": "workspace:*",
"@rabbitholegg/questdk-plugin-zora": "workspace:*",
"viem": "^1.16.6"
}
}
2 changes: 2 additions & 0 deletions packages/registry/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Paraswap } from '@rabbitholegg/questdk-plugin-paraswap'
import { Rabbithole } from '@rabbitholegg/questdk-plugin-rabbithole'
import { Symbiosis } from '@rabbitholegg/questdk-plugin-symbiosis'
import { OkuTrade } from '@rabbitholegg/questdk-plugin-okutrade'
import { Zora } from '@rabbitholegg/questdk-plugin-zora'
import { Balancer } from '@rabbitholegg/questdk-plugin-balancer'
import { TraderJoe } from '@rabbitholegg/questdk-plugin-traderjoe'
import { ENTRYPOINT } from './contract-addresses'
Expand All @@ -51,6 +52,7 @@ export const plugins: Record<string, IActionPlugin> = {
[Rabbithole.pluginId]: Rabbithole,
[Symbiosis.pluginId]: Symbiosis,
[OkuTrade.pluginId]: OkuTrade,
[Zora.pluginId]: Zora,
[Balancer.pluginId]: Balancer,
[TraderJoe.pluginId]: TraderJoe,
}
Expand Down
2 changes: 1 addition & 1 deletion packages/stargate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "1.6.7"
}
}
2 changes: 1 addition & 1 deletion packages/symbiosis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"ethers": "^5.2.0",
"symbiosis-js-sdk": "^3.0.9",
"viem": "^1.2.15"
Expand Down
2 changes: 1 addition & 1 deletion packages/tally/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.16.6"
}
}
2 changes: 1 addition & 1 deletion packages/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.16.6"
}
}
2 changes: 1 addition & 1 deletion packages/traderjoe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"@traderjoe-xyz/sdk-v2": "^2.1.8",
"viem": "^1.16.6"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/uniswap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.27",
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"@uniswap/sdk-core": "^4.0.9",
"@uniswap/universal-router-sdk": "^2.0.2",
"viem": "^1.16.6"
Expand Down
Empty file added packages/zora/CHANGELOG.md
Empty file.
Empty file added packages/zora/README.md
Empty file.
49 changes: 49 additions & 0 deletions packages/zora/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "@rabbitholegg/questdk-plugin-zora",
"version": "1.0.0-alpha.1",
"type": "module",
"exports": {
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts"
},
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"packageManager": "pnpm@8.3.1",
"description": "",
"scripts": {
"bench": "vitest bench",
"bench:ci": "CI=true vitest bench",
"build": "pnpm run clean && pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir ./dist/esm && echo > ./dist/esm/package.json '{\"type\":\"module\",\"sideEffects\":false}'",
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
"clean": "rimraf dist",
"format": "rome format . --write",
"lint": "rome check .",
"lint:fix": "pnpm lint --apply",
"test": "vitest dev",
"test:cov": "vitest dev --coverage",
"test:ci": "CI=true vitest --coverage",
"test:ui": "vitest dev --ui"
},
"keywords": [],
"author": "",
"license": "ISC",
"types": "./dist/types/index.d.ts",
"typings": "./dist/types/index.d.ts",
"devDependencies": {
"@types/node": "^20.8.7",
"@vitest/coverage-v8": "^0.33.0",
"rimraf": "^5.0.5",
"rome": "^12.1.3",
"ts-node": "^10.9.1",
"tsconfig": "workspace:*",
"typescript": "^5.2.2",
"vitest": "^0.33.0"
},
"dependencies": {
"@rabbitholegg/questdk": "2.0.0-alpha.28",
"viem": "^1.16.6"
}
}
57 changes: 57 additions & 0 deletions packages/zora/src/Zora.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { apply } from '@rabbitholegg/questdk/filter'
import { describe, expect, test } from 'vitest'
import { failingTestCases, passingTestCases } from './test-setup'
import { BASIC_PURCHASE } from './test-transactions'
import { mint } from './Zora'
import { ZORA_MINTER_ABI } from './abi'

describe('Given the zora plugin', () => {
describe('When handling the mint', () => {
test('should return a valid action filter', async () => {
const { params } = BASIC_PURCHASE
const filter = await mint(params)
expect(filter).to.deep.equal({
chainId: 10,
to: '0xfff631ef40557f8705e89053af794a1dcfa0a90b',
input: {
$abi: ZORA_MINTER_ABI,
$and: [
{
$or: [
{
recipient: '0x628d4c61d81ac4f286b1778a063ed2f8810bc367',
},
{
tokenRecipient: '0x628d4c61d81ac4f286b1778a063ed2f8810bc367',
},
{
to: '0x628d4c61d81ac4f286b1778a063ed2f8810bc367',
},
],
},
],
},
})
})

describe('should pass filter with valid transactions', () => {
passingTestCases.forEach((testCase) => {
const { transaction, params, description } = testCase
test(description, async () => {
const filter = await mint(params)
expect(apply(transaction, filter)).to.be.true
})
})
})

describe('should not pass filter with invalid transactions', () => {
failingTestCases.forEach((testCase) => {
const { transaction, params, description } = testCase
test(description, async () => {
const filter = await mint(params)
expect(apply(transaction, filter)).to.be.false
})
})
})
})
})
Loading

0 comments on commit e3b4f08

Please sign in to comment.