Skip to content

Commit

Permalink
Release to production (#1254)
Browse files Browse the repository at this point in the history
* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* Feat/deploy to celo (#1135)

* Add HC contracts to OpenZeppelin Defender (#1134)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* feat(defender): use hc packages in oz defender

* feat(celo): graph deploy, sdk and defender config

* chore(bump): SDK 0.8.14 Celo deployment

* feat(celo): add celo support to frontend

* chore(graph): fix turbo test flow

* chore(graph): add comment to p.json

* fix(gha): use pnpm cache in graph gha (#1138)

* chore: add wrapper components for split and merge functionality

* Fix/handle batch transfers graph (#1149)

* feat(batch): add batch transfers to grap

* SDK remove default chainID dependency (#1146)

* Feat/batch burn (#1051)

* feat(batch_burn): add batch burn function

* fix(docs): update SemiFungible1155 docs

* chore(lint): cleanup lint ignores

* chore(lint): defender lint errors

* chore(deploy): reduce optimizer run for kb limit

* chore(script): update upgrade script

* feat(gha): split graph deploy develop-main

* chore(lint): line length rule to warn from err

* chore(gha): run CI on PR to develop

* chore(gha): run e2e,ci on pr,push to develop

* feat(graph): update graph for burn methods

* chore(turbo): split graph deploys (#1055)

* Fix/workspace label (#1060)

chore(yarn): update workspace label

* 1052 subgraph a claimed token should indicate whether it was claimed from an allowlist (#1058)

* fix(graph): link claim with allowlist

* chore(tweak): yada

* fix(graph): update mapping to claim (#1061)

* nitial trader implementation (#1063)

* feat(iface): draft of trader interface

* feat(trader): simple offer, buy, cancel flow

* feat(db): update allowlist query (#1057)

* feat(test): tweaks and initial tests for Trader

* chore(gha): remove hardcoded foundry nightly

* feat(test): add initial test for trader sales

* feat(test): sales tests

* feat(deploy): deployed to goerli

* chore(ci): updated hh scripts for trader contract

* feat(pause): pausable controls and tests

* feat(trader): init trader graph

* feat(tokens): surface accepted tokens (#1065)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* Feat/accepted tokens (#1066)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* Feat/accepted tokens (#1067)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* fix(log): add logging to trader mapping

* [Prod]:Deployed to Celo, updated Defender, version bumps for everyone (#1137)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* Feat/deploy to celo (#1135)

* Add HC contracts to OpenZeppelin Defender (#1134)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* feat(defender): use hc packages in oz defender

* feat(celo): graph deploy, sdk and defender config

* chore(bump): SDK 0.8.14 Celo deployment

* feat(celo): add celo support to frontend

* chore(graph): fix turbo test flow

* chore(graph): add comment to p.json

* fix(gha): use pnpm cache in graph gha (#1138)

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* Feat/init marketplace (#1139)

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* feat(marketplace): inject, build, refactor, test

* chore(gha): run gha on push and develop-branches

* fix(build): build and lint errors

* chore(pnpm): refresh lock file

* chore(build): reduce turbo concurrency

* fix(build): whac a mole

* chore(build): restore prettier in solhint

* chore(build): env.template vars

* chore(dist): clean and remap output contracts

* chore(clean): last tests

* fix(build): ignore cors-proxy type errors

* chore(gha): add rpc env vars for fork testing

---------

Co-authored-by: jipstavenuiter <[email protected]>

* chore(lint): cleanup config and affiliate flows (#1140)

* chore(license): dual licensing contracts + repo (#1141)

* feat(config): updated sdk init config

* feat(tests): fix all tests to use updated init

* feat(test): uncommented all SDK tests

* fix(log): remove result logging

* [Test] Release marketplace contracts on testnet and add to contracts package (#1150)

* feat(deploy): deploy to testnets

* chore(build): hardhat build

* feat(pack): release, test, bump updated contracts

* chore(gha): updated env vars

* chore(pnpm): updated lock file

* fix(build): build error, replaced util with viem

* fix(pnpm): root dir ethers resolution

* chore(pnpm): updated lockfile

* fix(pnpm): overrides

* chore(build): resolving build issues sdk

* chore(refactor): dep resolution bug - del eth v5

* fix(test): mock ipfs in minting, remove timeout

* chore(build): fresh build

* chore(clean): remove contracts/contracts dir

* fix(gha): non-next env var in gha for sdk

* chore(run): kick

* fix(jest): forceExit hanging async call

* chore(build): fresh run for sanity

* fix(lint): ignore **/abi instead of **/src/abi

* feat(fe): integrate in FE and SDK 0.9.1

* chore(bump): sdk 0.9.1-viem

* feat(fe): update FE to use SDK 0.9.1

* chore(cleanup): code cleanup SDK

* chore(bump): sdk version bump

* chore(fe): update SDK dep version

* fix(sdk): chainId config

* chore(parse): fix parse calc

* fix parse allowlist csv tests

* fix injected chain id in config

* update component config.tsx

* chore(bump): updated sdk alpha

* chore(run): sanity check passed

* chore(build): graphSDK

* feat(fe): plasmic rendering issues.

* feat(sdk): web3 token

* chore(defender): removed api_key sep network conf

* chore(defender): remove verbose log batch action

* chore(gha): deduplicate runs - now on all push

* chore(lint): lint fe lib

* chore(gha): cleaned up env vars

---------

Co-authored-by: jipstavenuiter <[email protected]>

* Fix/gha graph (#1165)

* feat(event): add event to merge

* chore(deploy): deployed to goerli and sepolia

* Feat/allowlist proof util (#1168)

* feat(util): allowlist utils and updated docs

* feat(test): updated test and docs

* chore(bump): alpha-7

* feat(merkle): test merkleProof fetcher

* chore(bump): 1.0.0-alpha.8

* fix(import): allowlist default export

* chore(run): local validation run

* Add hypercerts to marketplace functionality (#1170)

* Feat/batch burn (#1051)

* feat(batch_burn): add batch burn function

* fix(docs): update SemiFungible1155 docs

* chore(lint): cleanup lint ignores

* chore(lint): defender lint errors

* chore(deploy): reduce optimizer run for kb limit

* chore(script): update upgrade script

* feat(gha): split graph deploy develop-main

* chore(lint): line length rule to warn from err

* chore(gha): run CI on PR to develop

* chore(gha): run e2e,ci on pr,push to develop

* feat(graph): update graph for burn methods

* chore(turbo): split graph deploys (#1055)

* Fix/workspace label (#1060)

chore(yarn): update workspace label

* 1052 subgraph a claimed token should indicate whether it was claimed from an allowlist (#1058)

* fix(graph): link claim with allowlist

* chore(tweak): yada

* fix(graph): update mapping to claim (#1061)

* nitial trader implementation (#1063)

* feat(iface): draft of trader interface

* feat(trader): simple offer, buy, cancel flow

* feat(db): update allowlist query (#1057)

* feat(test): tweaks and initial tests for Trader

* chore(gha): remove hardcoded foundry nightly

* feat(test): add initial test for trader sales

* feat(test): sales tests

* feat(deploy): deployed to goerli

* chore(ci): updated hh scripts for trader contract

* feat(pause): pausable controls and tests

* feat(trader): init trader graph

* feat(tokens): surface accepted tokens (#1065)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* Feat/accepted tokens (#1066)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* Feat/accepted tokens (#1067)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* fix(log): add logging to trader mapping

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* Feat/init marketplace (#1139)

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* feat(marketplace): inject, build, refactor, test

* chore(gha): run gha on push and develop-branches

* fix(build): build and lint errors

* chore(pnpm): refresh lock file

* chore(build): reduce turbo concurrency

* fix(build): whac a mole

* chore(build): restore prettier in solhint

* chore(build): env.template vars

* chore(dist): clean and remap output contracts

* chore(clean): last tests

* fix(build): ignore cors-proxy type errors

* chore(gha): add rpc env vars for fork testing

---------

Co-authored-by: jipstavenuiter <[email protected]>

* chore(lint): cleanup config and affiliate flows (#1140)

* chore(license): dual licensing contracts + repo (#1141)

* [Test] Release marketplace contracts on testnet and add to contracts package (#1150)

* feat(deploy): deploy to testnets

* chore(build): hardhat build

* feat(pack): release, test, bump updated contracts

* chore(gha): updated env vars

* chore(pnpm): updated lock file

* fix(build): build error, replaced util with viem

* fix(pnpm): root dir ethers resolution

* chore(pnpm): updated lockfile

* fix(pnpm): overrides

* chore(build): resolving build issues sdk

* chore(refactor): dep resolution bug - del eth v5

* fix(test): mock ipfs in minting, remove timeout

* Direct Hypercert fraction sale (#1142)

* feat(tranfer): transfer single hypercert fraction

* feat(transfer): batch transfers and across collections

* feat(transfer): reduce cyclomatic complexity

* feat(offers): hypercert offer signatures

* feat(transfer): standard txs tests hypercerts

* chore(gha): only run on every push

* fix(merge): merge artifacts

---------

Co-authored-by: jipstavenuiter <[email protected]>

* feat(restriction): add transfer restriction to fe (#1173)

* feat(metadata): add application name (#1174)

* feat(deployments): typed deployment contracts

* fix(props): props from plas to form (#1176)

* format external url in case it is a direct ipfs link (#1182)

* fix(fix formatting of ipfs urls on hypercert page) (#1183)

* Feat/split and merge (#1185)

* Add split and merge functionality to plasmic and add component logic.

* Feat/hardhat deploy script (#1177)

* feat(init): first pass hh script marketplace

* feat(deploy): marketplace deploy and verify script

* chore(deploy): add feerecipient to deploy

* chore(scripts): remove scripts

* feat(pack): deployment data and fresh pack

* 1.0.0-alpha.0

* chore(npm): release 1.0.0-alpha.0 contracts

* chore(npm): update contracts and sdk releases

* fix(build): viem update fe

* fix(default): remove default_chain_id

* remove usage of NEXT_PUBLIC_DEFAULT_CHAIN_ID

* fix build error

---------

Co-authored-by: jipstavenuiter <[email protected]>

* feat(merkle): account allowlist strategy (#1186)

* Added strategy and tests for hypercert functionality (#1188)

* feat(fractions): added strategy and tests

* feat(tests): update tests and tweak strat

* feat(test): fix all the test and clean comms

* fix(dist): moar contracts

* fix(tweak): little cleanups

* chore(lint): fix lint errors

* fix(lint): updated foundry lint

* Feat/partial fraction sale (#1190)

* feat(fractions): added strategy and tests

* feat(tests): update tests and tweak strat

* feat(test): fix all the test and clean comms

* fix(dist): moar contracts

* fix(tweak): little cleanups

* chore(lint): fix lint errors

* fix(lint): updated foundry lint

* feat(test): uncomment unused tests

* Feat/sdk common js (#1191)

* feat(fractions): added strategy and tests

* feat(tests): update tests and tweak strat

* feat(test): fix all the test and clean comms

* fix(dist): moar contracts

* fix(tweak): little cleanups

* chore(lint): fix lint errors

* fix(lint): updated foundry lint

* feat(test): uncomment unused tests

* feat(bugs): cjs build and import alpha.13

* fix(only): unexpected only in sdk test

* feat(abis): updated SDK abis and restored tests (#1193)

* feat(abis): updated SDK abis and restored tests

* chore(bump): viem in fe

* fix(test): add currency admin to test (#1197)

* fix build error - set output:export in next config (#1199)

* fix build error

* lock nextjs version to 13.x.x

* add placeholder for transfer fraction button (#1201)

* add placeholder for transfer fraction button

* remove unnecessary logic from transfer-fraction-button.tsx

* change next build back to next export (#1202)

remove unnecessary logic from transfer-fraction-button.tsx

* Feature/transfer fraction button (#1203)

* add transfer fraction button inside split fraction button

* add confirmation dialog when transferring fraction

* use override chain id in hypercert fetcher within plasmic

* add reading of transfer restrictions to transfer fraction button

* add override chain id functionality for plasmic editing (#1204)

* Bugfix/add override chain id for plasmit editing (#1205)

* add override chain id functionality for plasmic editing

* add override chain id to effect dependencies

* remove transfer fraction button from split fraction button (#1206)

* Bugfix/only show transfer button for fraction owned (#1207)

* only show transfer button for fractions owned

* only show transfer button for fractions owned

* Feat/more robust split transfer logic with hc strategy (#1208)

* feat(hc): split NFT HC flow

* feat(hc): hypercert order routing and validation

* fix(e2e): disable faulty E2E tests

* Feat/docs tests cleanup (#1210)

* feat(checks): checkValidityHC, error code, 0.8.17

* feat(validator): overvalidator HC tests

* fix(clean): remove hyperboard references

* fix(lint): pragma protocol tests

* fix(pragma): restore FeeManagerRoy.. pragma

* feat(docs): updated version

* feat(build): docs 1.0.0-alpha

* Feat/docs tests cleanup (#1211)

* feat(checks): checkValidityHC, error code, 0.8.17

* feat(validator): overvalidator HC tests

* fix(clean): remove hyperboard references

* fix(lint): pragma protocol tests

* fix(pragma): restore FeeManagerRoy.. pragma

* feat(docs): updated version

* feat(build): docs 1.0.0-alpha

* chore(docs): natspec tweaks

* Feat/docs tests cleanup (#1212)

* feat(checks): checkValidityHC, error code, 0.8.17

* feat(validator): overvalidator HC tests

* fix(clean): remove hyperboard references

* fix(lint): pragma protocol tests

* fix(pragma): restore FeeManagerRoy.. pragma

* feat(docs): updated version

* feat(build): docs 1.0.0-alpha

* chore(docs): natspec tweaks

* feat(docs): docs sidebar

* Feat/add batch transfer method to client methods (#1215)

* feat(transfer): add method to client and type

* feat(err): simulation and tx error handlers

* feat(err): error handling test

* chore(pack): dep cleanup and updates

* Chore/lets merge together (#1220)

* [Prod]:Deployed to Celo, updated Defender, version bumps for everyone (#1137)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* Feat/deploy to celo (#1135)

* Add HC contracts to OpenZeppelin Defender (#1134)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* feat(defender): use hc packages in oz defender

* feat(celo): graph deploy, sdk and defender config

* chore(bump): SDK 0.8.14 Celo deployment

* feat(celo): add celo support to frontend

* chore(graph): fix turbo test flow

* chore(graph): add comment to p.json

* fix(gha): use pnpm cache in graph gha (#1138)

* chore: add wrapper components for split and merge functionality (#1148)

* format external url in case it is a direct ipfs link (#1181)

* merge fixes

---------

Co-authored-by: bitbeckers <[email protected]>

* feat(urql): refactored to urql and own codegen (#1223)

* feat(urql): refactored to urql and own codegen

* chore(graph): cleanup schema

* fix(build): graph build and test

* Feat/docs updates docusaurs v3 search release (#1226)

* chore(bump): docusaurs v3

* feat(docgen): docusaurus pulls SDK docs

* feat(version): version 1.0.0

* fix(p.json): updated package-lock

* fix(build): remove contract docs build from docs

* Feat/sdk npm docs release 1 (#1228)

* chore(bump): released contracts 1.0.0

* chore(bump): update graph testnet deploy

* chore(bump): sdk version 1.0.0

* chore(bump): update deps in fe

* chore(bump): sdk 1.0.3 in fe

* fix(lint): test type lint

* Feat/sdk npm docs release 1 (#1231)

* [Prod]:Deployed to Celo, updated Defender, version bumps for everyone (#1137)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* Feat/deploy to celo (#1135)

* Add HC contracts to OpenZeppelin Defender (#1134)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* feat(defender): use hc packages in oz defender

* feat(celo): graph deploy, sdk and defender config

* chore(bump): SDK 0.8.14 Celo deployment

* feat(celo): add celo support to frontend

* chore(graph): fix turbo test flow

* chore(graph): add comment to p.json

* fix(gha): use pnpm cache in graph gha (#1138)

* chore: add wrapper components for split and merge functionality (#1148)

* format external url in case it is a direct ipfs link (#1181)

* Chore/lets merge together (#1221)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* Feat/deploy to celo (#1135)

* Add HC contracts to OpenZeppelin Defender (#1134)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* feat(defender): use hc packages in oz defender

* feat(celo): graph deploy, sdk and defender config

* chore(bump): SDK 0.8.14 Celo deployment

* feat(celo): add celo support to frontend

* chore(graph): fix turbo test flow

* chore(graph): add comment to p.json

* fix(gha): use pnpm cache in graph gha (#1138)

* chore: add wrapper components for split and merge functionality

* Fix/handle batch transfers graph (#1149)

* feat(batch): add batch transfers to grap

* SDK remove default chainID dependency (#1146)

* Feat/batch burn (#1051)

* feat(batch_burn): add batch burn function

* fix(docs): update SemiFungible1155 docs

* chore(lint): cleanup lint ignores

* chore(lint): defender lint errors

* chore(deploy): reduce optimizer run for kb limit

* chore(script): update upgrade script

* feat(gha): split graph deploy develop-main

* chore(lint): line length rule to warn from err

* chore(gha): run CI on PR to develop

* chore(gha): run e2e,ci on pr,push to develop

* feat(graph): update graph for burn methods

* chore(turbo): split graph deploys (#1055)

* Fix/workspace label (#1060)

chore(yarn): update workspace label

* 1052 subgraph a claimed token should indicate whether it was claimed from an allowlist (#1058)

* fix(graph): link claim with allowlist

* chore(tweak): yada

* fix(graph): update mapping to claim (#1061)

* nitial trader implementation (#1063)

* feat(iface): draft of trader interface

* feat(trader): simple offer, buy, cancel flow

* feat(db): update allowlist query (#1057)

* feat(test): tweaks and initial tests for Trader

* chore(gha): remove hardcoded foundry nightly

* feat(test): add initial test for trader sales

* feat(test): sales tests

* feat(deploy): deployed to goerli

* chore(ci): updated hh scripts for trader contract

* feat(pause): pausable controls and tests

* feat(trader): init trader graph

* feat(tokens): surface accepted tokens (#1065)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* Feat/accepted tokens (#1066)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* Feat/accepted tokens (#1067)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* fix(log): add logging to trader mapping

* [Prod]:Deployed to Celo, updated Defender, version bumps for everyone (#1137)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* Feat/deploy to celo (#1135)

* Add HC contracts to OpenZeppelin Defender (#1134)

* Fix/package build (#1124)

* chore(npm): sdk to workspace to stop link:
* chore(npm): contracts in workspace, no link:
* chore(bump): 0.8.7
* chore(bump): contracts 0.8.7 into sdk 0.8.8
* fix(ci): linting errors from updated ws
* fix(doc): optimism chainId to 10 from 100
* chore(build): remove type module from package.json
* chore(contracts): package sol files
* chore(pack): add sol files to contracts package
* chore(bump): contract 0.8.9
* chore(pack): exports setup
* chore(pack): contracts dir in package
* chore(pack): cleanup build scripts
* chore(bump): contracts 0.8.10
* chore(pack): add all contracts for inheritence
* chore(bump): contracts 0.8.11
* chore(bump): sdk 0.8.10 with updated contracts package
* chore(bump): updated packages in frontend
* chore(gha): run action on pr and push to develop

* feat(defender): use hc packages in oz defender

* feat(celo): graph deploy, sdk and defender config

* chore(bump): SDK 0.8.14 Celo deployment

* feat(celo): add celo support to frontend

* chore(graph): fix turbo test flow

* chore(graph): add comment to p.json

* fix(gha): use pnpm cache in graph gha (#1138)

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* Feat/init marketplace (#1139)

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* feat(marketplace): inject, build, refactor, test

* chore(gha): run gha on push and develop-branches

* fix(build): build and lint errors

* chore(pnpm): refresh lock file

* chore(build): reduce turbo concurrency

* fix(build): whac a mole

* chore(build): restore prettier in solhint

* chore(build): env.template vars

* chore(dist): clean and remap output contracts

* chore(clean): last tests

* fix(build): ignore cors-proxy type errors

* chore(gha): add rpc env vars for fork testing

---------

Co-authored-by: jipstavenuiter <[email protected]>

* chore(lint): cleanup config and affiliate flows (#1140)

* chore(license): dual licensing contracts + repo (#1141)

* feat(config): updated sdk init config

* feat(tests): fix all tests to use updated init

* feat(test): uncommented all SDK tests

* fix(log): remove result logging

* [Test] Release marketplace contracts on testnet and add to contracts package (#1150)

* feat(deploy): deploy to testnets

* chore(build): hardhat build

* feat(pack): release, test, bump updated contracts

* chore(gha): updated env vars

* chore(pnpm): updated lock file

* fix(build): build error, replaced util with viem

* fix(pnpm): root dir ethers resolution

* chore(pnpm): updated lockfile

* fix(pnpm): overrides

* chore(build): resolving build issues sdk

* chore(refactor): dep resolution bug - del eth v5

* fix(test): mock ipfs in minting, remove timeout

* chore(build): fresh build

* chore(clean): remove contracts/contracts dir

* fix(gha): non-next env var in gha for sdk

* chore(run): kick

* fix(jest): forceExit hanging async call

* chore(build): fresh run for sanity

* fix(lint): ignore **/abi instead of **/src/abi

* feat(fe): integrate in FE and SDK 0.9.1

* chore(bump): sdk 0.9.1-viem

* feat(fe): update FE to use SDK 0.9.1

* chore(cleanup): code cleanup SDK

* chore(bump): sdk version bump

* chore(fe): update SDK dep version

* fix(sdk): chainId config

* chore(parse): fix parse calc

* fix parse allowlist csv tests

* fix injected chain id in config

* update component config.tsx

* chore(bump): updated sdk alpha

* chore(run): sanity check passed

* chore(build): graphSDK

* feat(fe): plasmic rendering issues.

* feat(sdk): web3 token

* chore(defender): removed api_key sep network conf

* chore(defender): remove verbose log batch action

* chore(gha): deduplicate runs - now on all push

* chore(lint): lint fe lib

* chore(gha): cleaned up env vars

---------

Co-authored-by: jipstavenuiter <[email protected]>

* Fix/gha graph (#1165)

* Feat/allowlist proof util (#1168)

* feat(util): allowlist utils and updated docs

* feat(test): updated test and docs

* chore(bump): alpha-7

* feat(merkle): test merkleProof fetcher

* chore(bump): 1.0.0-alpha.8

* fix(import): allowlist default export

* chore(run): local validation run

* Add hypercerts to marketplace functionality (#1170)

* Feat/batch burn (#1051)

* feat(batch_burn): add batch burn function

* fix(docs): update SemiFungible1155 docs

* chore(lint): cleanup lint ignores

* chore(lint): defender lint errors

* chore(deploy): reduce optimizer run for kb limit

* chore(script): update upgrade script

* feat(gha): split graph deploy develop-main

* chore(lint): line length rule to warn from err

* chore(gha): run CI on PR to develop

* chore(gha): run e2e,ci on pr,push to develop

* feat(graph): update graph for burn methods

* chore(turbo): split graph deploys (#1055)

* Fix/workspace label (#1060)

chore(yarn): update workspace label

* 1052 subgraph a claimed token should indicate whether it was claimed from an allowlist (#1058)

* fix(graph): link claim with allowlist

* chore(tweak): yada

* fix(graph): update mapping to claim (#1061)

* nitial trader implementation (#1063)

* feat(iface): draft of trader interface

* feat(trader): simple offer, buy, cancel flow

* feat(db): update allowlist query (#1057)

* feat(test): tweaks and initial tests for Trader

* chore(gha): remove hardcoded foundry nightly

* feat(test): add initial test for trader sales

* feat(test): sales tests

* feat(deploy): deployed to goerli

* chore(ci): updated hh scripts for trader contract

* feat(pause): pausable controls and tests

* feat(trader): init trader graph

* feat(tokens): surface accepted tokens (#1065)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* Feat/accepted tokens (#1066)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* Feat/accepted tokens (#1067)

* feat(tokens): surface accepted tokens

* fix(tokens): acceptedTokens test and fix

* chore(address): update trader address graph

* fix(import): add bigint to import

* fix(log): add logging to trader mapping

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* Feat/init marketplace (#1139)

* chore(prep): protocol contracts to protocol dir

* chore(prep): tests to protocol dir and remappings

* chore(license): MIT license

* feat(marketplace): inject, build, refactor, test

* chore(gha): run gha on push and develop-branches

* fix(build): build and lint errors

* chore(pnpm): refresh lock file

* chore(build): reduce turbo concurrency

* fix(build): whac a mole

* chore(build): restore prettier in solhint

* chore(build): env.template vars

* chore(dist): clean and remap output contracts

* chore(clean): last tests

* fix(build): ignore cors-proxy type errors

* chore(gha): add rpc env vars for fork testing

---------

Co-authored-by: jipstavenuiter <[email protected]>

* chore(lint): cleanup config and affiliate flows (#1140)

* chore(license): dual licensing contracts + repo (#1141)

* [Test] Release marketplace contracts on testnet and add to contracts package (#1150)

* feat(deploy): deploy to testnets

* chore(build): hardhat build

* feat(pack): release, test, bump updated contracts

* chore(gha): updated env vars

* chore(pnpm): updated lock file

* fix(build): build error, replaced util with viem

* fix(pnpm): root dir ethers resolution

* chore(pnpm): updated lockfile

* fix(pnpm): overrides

* chore(build): resolving build issues sdk

* chore(refactor): dep resolution bug - del eth v5

* fix(test): mock ipfs in minting, remove timeout

* Direct Hypercert fraction sale (#1142)

* feat(tranfer): transfer single hypercert fraction

* feat(transfer): batch transfers and across collections

* feat(transfer): reduce cyclomatic complexity

* feat(offers): hypercert offer signatures

* feat(transfer): standard txs tests hypercerts

* chore(gha): only run on every push

* fix(merge): merge artifacts

---------

Co-authored-by: jipstavenuiter <[email protected]>

* feat(restriction): add transfer restriction to fe (#1173)

* feat(metadata): add application name (#1174)

* feat(deployments): typed deployment contracts

* fix(props): props from plas to form (#1176)

* format external url in case it is a direct ipfs link (#1182)

* fix(fix formatting of ipfs urls on hypercert page) (#1183)

* Feat/split and merge (#1185)

* Add split and merge functionality to plasmic and add component logic.

* Feat/hardhat deploy script (#1177)

* feat(init): first pass hh script marketplace

* feat(deploy): marketplace deploy and verify script

* chore(deploy): add feerecipient to deploy

* chore(scripts): remove scripts

* feat(pack): deployment data and fresh pack

* 1.0.0-alpha.0

* chore(npm): release 1.0.0-alpha.0 contracts

* chore(npm): update contracts and sdk releases

* fix(build): viem update fe

* fix(default): remove default_chain_id

* remove usage of NEXT_PUBLIC_DEFAULT_CHAIN_ID

* fix build error

---------

Co-authored-by: jipstavenuiter <[email protected]>

* feat(merkle): account allowlist strategy (#1186)

* Added strategy and tests for hypercert functionality (#1188)

* feat(fractions): added strategy and tests

* feat(tests): update tests and tweak strat

* feat(test): fix all the test and clean comms

* fix(dist): moar contracts

* fix(tweak): little cleanups

* chore(lint): fix lint errors

* fix(lint): updated foundry lint

* Feat/partial fraction sale (#1190)

* feat(fractions): added strategy and tests

* feat(tests): update tests and tweak strat

* feat(test): fix all the test and clean comms

* fix(dist): moar contracts

* fix(tweak): little cleanups

* chore(lint): fix lint errors

* fix(lint): updated foundry lint

* feat(test): uncomment unused tests

* Feat/sdk common js (#1191)

* feat(fractions): added strategy and tests

* feat(tests): update tests and tweak strat

* feat(test): fix all the test and clean comms

* fix(dist): moar contracts

* fix(tweak): little cleanups

* chore(lint): fix lint errors

* fix(lint): updated foundry lint

* feat(test): uncomment unused tests

* feat(bugs): cjs build and import alpha.13

* fix(only): unexpected only in sdk test

* feat(abis): updated SDK abis and restored tests (#1193)

* feat(abis): updated SDK abis and restored tests

* chore(bump): viem in fe

* fix(test): add currency admin to test (#1197)

* fix build error - set output:export in next config (#1199)

* fix build error

* lock nextjs version to 13.x.x

* add placeholder for transfer fraction button (#1201)

* add placeholder for transfer fraction button

* remove unnecessary logic from transfer-fraction-button.tsx

* change next build back to next export (#1202)

remove unnecessary logic from transfer-fraction-button.tsx

* Feature/transfer fraction button (#1203)

* add transfer fraction button inside split fraction button

* add confirmation dialog when transferring fraction

* use override chain id in hypercert fetcher within plasmic

* add reading of transfer restrictions to transfer fraction button

* add override chain id functionality for plasmic editing (#1204)

* Bugfix/add override chain id for plasmit editing (#1205)

* add override chain id functionality for plasmic editing

* add override chain id to effect dependencies

* remove transfer fraction button from split fraction button (#1206)

* Bugfix/only show transfer button for fraction owned (#1207)

* only show transfer button for fractions owned

* only show transfer button for fractions owned

* Feat/more robust split transfer logic with hc strategy (#1208)

* feat(hc): split NFT HC flow

* feat(hc): hypercert order routing and validation

* fix(e2e): disable faulty E2E tests

* Feat/docs tests cleanup (#1210)

* feat(checks): checkValidityHC, error code, 0.8.17

* feat(validator): overvalidator HC tests

* fix(clean): remove hyperboard references

* fix(lint): pragma protocol tests

* fix(pragma): restore FeeManagerRoy.. pragma

* feat(docs): updated version

* feat(build): docs 1.0.0-alpha

* Feat/docs tests cleanup (#1211)

* feat(checks): checkValidityHC, error code, 0.8.17

* feat(validator): overvalidator HC tests

* fix(clean): remove hyperboard references

* fix(lint): pragma protocol tests

* fix(pragma): restore FeeManagerRoy.. pragma

* feat(docs): updated version

* feat(build): docs 1.0.0-alpha

* chore(docs): natspec tweaks

* Feat/docs tests cleanup (#1212)

* feat(checks): checkValidityHC, error code, 0.8.17

* feat(validator): overvalidator HC tests

* fix(clean): remove hyperboard references

* fix(lint): pragma protocol tests

* fix(pragma): restore FeeManagerRoy.. pragma

* feat(docs): updated version

* feat(build): docs 1.0.0-alpha

* chore(docs): natspec tweaks

* feat(docs): docs sidebar

* Feat/add batch transfer method to client methods (#1215)

* feat(transfer): add method to client and type

* feat(err): simulation and tx error handlers

* feat(err): error handling test

* chore(pack): dep cleanup and updates

* merge fixes

---------

Co-authored-by: bitbeckers <[email protected]>

* chore(bump): released contracts 1.0.0

* chore(bump): update graph testnet deploy

* chore(bump): sdk version 1.0.0

* chore(bump): update deps in fe

* chore(bump): sdk 1.0.3 in fe

* fix(lint): test type lint

---------

Co-authored-by: Jip Stavenuiter <[email protected]>

* Faet/docs search function in documentation (#1236)

* feat(docsearch): add config

* feat(search): implement algolia search

* (feat): add initial version of delete on order fulfilled script

* chore(bump): web3 connectors fe

* (feature): Delete order on execute taker bid autotask

* (feat): fix setup and rollouts, update scripts

* (feat): remove redundancy from create-sentinel.ts config

* (chore): delete goerli from SDK

* (chore): delete goerli from defender config

* (chore): delete goerli from graph

* (chore): delete goerli from frontend

* (chore): update tests for goerli deprecation

* feat(apis): refactor to use hypercerts APIs

* fix(api): migrate to railway

* fix(build): update viem and fe client config

* chore(bump): sdk 1.1.0 release and bump fe

* (chore): update changelog

* fix(ci): linting

* chore(bump): fe sdk dep

---------

Co-authored-by: jipstavenuiter <[email protected]>
  • Loading branch information
bitbeckers and Jipperism authored Jan 8, 2024
1 parent 92d7267 commit b76176e
Show file tree
Hide file tree
Showing 57 changed files with 1,437 additions and 2,593 deletions.
1,500 changes: 0 additions & 1,500 deletions contracts/.openzeppelin/goerli.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const OPENZEPPELIN_SECRET_KEY = requireEnv(process.env.OPENZEPPELIN_SECRET_KEY,
const chainIds = {
hardhat: 31337,
// Ethereum: https://docs.infura.io/infura/networks/ethereum/how-to/choose-a-network
goerli: 5,
sepolia: 11155111,
mainnet: 1,
// Optimism: https://docs.infura.io/infura/networks/optimism/how-to/choose-a-network
Expand Down
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"deploy:marketplace:dryrun": "forge script scripts/deployment/Deployment.s.sol:Deployment --fork-url",
"docs": "pnpm hardhat dodoc",
"lint": "pnpm lint:sol && pnpm prettier:check",
"lint:sol": "forge fmt --check && solhint \"./{src,test/foundry/protocol,test/foundry/marketplace}/**/*.sol\"",
"lint:sol": "forge fmt && solhint \"./{src,test/foundry/protocol,test/foundry/marketplace}/**/*.sol\"",
"prepublish": "pnpm build",
"prettier": "prettier --config \"./.prettierrc.yml\" --write \"**/*.{json,md,ts,yml}\"",
"prettier:check": "prettier --config \"./.prettierrc.yml\" --check \"**/*.{json,md,ts,yml}\"",
Expand Down
1 change: 0 additions & 1 deletion contracts/src/marketplace/LooksRareProtocol.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ import {CollectionType} from "./enums/CollectionType.sol";
* ~~~~~~
* @author LooksRare protocol team (👀,💎); bitbeckers
*/

contract LooksRareProtocol is
ILooksRareProtocol,
TransferSelectorNFT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ contract LowLevelHypercertCaller {
* @param tokenId tokenId to transfer
* @param amounts split distribution
*/

function _executeHypercertSplitFraction(address collection, address to, uint256 tokenId, uint256[] memory amounts)
internal
{
Expand Down
1 change: 0 additions & 1 deletion contracts/src/marketplace/libraries/OrderStructs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ library OrderStructs {
/**
* 3. Merkle tree struct
*/

enum MerkleTreeNodePosition {
Left,
Right
Expand Down
2 changes: 0 additions & 2 deletions contracts/test/foundry/marketplace/TransferManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ contract TransferManagerTest is ITransferManager, TestHelpers, TestParameters {
/**
* 0. Internal helper functions
*/

function _grantApprovals(address user) private asPrankedUser(user) {
mockERC721.setApprovalForAll(address(transferManager), true);
mockERC1155.setApprovalForAll(address(transferManager), true);
Expand Down Expand Up @@ -93,7 +92,6 @@ contract TransferManagerTest is ITransferManager, TestHelpers, TestParameters {
/**
* 1. Happy cases
*/

function testTransferSingleItemERC721() public {
_allowOperator(_transferrer);
_grantApprovals(_sender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ contract HypercertFractionOffersTest is ProtocolBase {
/**
* A collection offer without merkle tree criteria
*/

function testTakerBidHypercertFractionOrderPartialFill() public {
_setUpUsers();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ contract MerkleWithPosition {
* PROOF GENERATION *
*
*/

function getRoot(OrderStructs.MerkleTreeNode[] memory data) public pure returns (bytes32) {
require(data.length > 1, "won't generate root for single leaf");
while (data.length > 1) {
Expand Down
2 changes: 1 addition & 1 deletion defender/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@graphql-mesh/cache-localforage": "^0.95.7",
"@hypercerts-org/contracts": "0.8.11",
"@hypercerts-org/contracts": "1.0.0",
"@openzeppelin/defender-autotask-client": "1.50.0",
"@openzeppelin/defender-autotask-utils": "1.50.0",
"@openzeppelin/defender-base-client": "1.49.0",
Expand Down
168 changes: 168 additions & 0 deletions defender/src/auto-tasks/execute-taker-bid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
import {
AutotaskEvent,
BlockTriggerEvent,
} from "@openzeppelin/defender-autotask-utils";
import { getNetworkConfigFromName } from "../networks";
import { createClient } from "@supabase/supabase-js";
import fetch from "node-fetch";
import { BigNumber, ethers } from "ethers";
import { MissingDataError, NotImplementedError } from "../errors";
import {
HypercertExchangeAbi,
HypercertMinterAbi,
} from "@hypercerts-org/contracts";

export async function handler(event: AutotaskEvent) {
console.log(
"Event: ",
JSON.stringify(
{ ...event, secrets: "HIDDEN", credentials: "HIDDEN" },
null,
2,
),
);
const network = getNetworkConfigFromName(event.autotaskName);
const { SUPABASE_URL, SUPABASE_SECRET_API_KEY } = event.secrets;
const ALCHEMY_KEY = event.secrets[network.alchemyKeyEnvName];

const client = createClient(SUPABASE_URL, SUPABASE_SECRET_API_KEY, {
global: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
fetch: (...args) => fetch(...args),
},
});

let provider;

if (ALCHEMY_KEY) {
provider = new ethers.providers.AlchemyProvider(
network.networkKey,
ALCHEMY_KEY,
);
} else if (network.rpc) {
provider = new ethers.providers.JsonRpcProvider(network.rpc);
} else {
throw new Error("No provider available");
}

// Check data availability
const body = event.request.body;
if (!("type" in body) || body.type !== "BLOCK") {
throw new NotImplementedError("Event body is not a BlockTriggerEvent");
}
const blockTriggerEvent = body as BlockTriggerEvent;
const contractAddress = blockTriggerEvent.matchedAddresses[0];
const fromAddress = blockTriggerEvent.transaction.from;
const txnLogs = blockTriggerEvent.transaction.logs;
const tx = await provider.getTransaction(blockTriggerEvent.hash);

if (!contractAddress) {
throw new MissingDataError(`body.matchedAddresses is missing`);
} else if (!fromAddress) {
throw new MissingDataError(`body.transaction.from is missing`);
} else if (!txnLogs) {
throw new MissingDataError(`body.transaction.logs is missing`);
} else if (!tx) {
throw new MissingDataError(`tx is missing`);
}

console.log("Contract address", contractAddress);
console.log("From address", fromAddress);

// TODO: Update contracts so we can use ABI from the @hypercerts-org/contracts package
const hypercertsMinterContractInterface = new ethers.utils.Interface(
HypercertMinterAbi,
);

// Parse TransferSingle events
const parsedLogs = txnLogs.map((l) => {
//Ignore unknown events
try {
return hypercertsMinterContractInterface.parseLog(l);
} catch (e) {
console.log("Failed to parse log", l);
return null;
}
});
console.log("Parsed logs: ", JSON.stringify(parsedLogs, null, 2));
const transferSingleEvents = parsedLogs.filter(
(e) => e !== null && e.name === "TransferSingle",
);

console.log(
"TransferSingle Events: ",
JSON.stringify(transferSingleEvents, null, 2),
);

if (transferSingleEvents.length !== 1) {
throw new MissingDataError(
`Unexpected saw ${transferSingleEvents.length} TransferSingle events`,
);
}

// Get claimID
const signerAddress = transferSingleEvents[0].args["from"] as string;
const itemId = BigNumber.from(transferSingleEvents[0].args["id"]).toString();

const hypercertExchangeContractInterface = new ethers.utils.Interface(
HypercertExchangeAbi,
);
// Parse TakerBid events
const takerBidEvents = txnLogs
.map((l) => {
//Ignore unknown events
try {
return hypercertExchangeContractInterface.parseLog(l);
} catch (e) {
console.log("Failed to parse log", l);
return null;
}
})
.filter((e) => e !== null && e.name === "TakerBid");

console.log("TakerBid Events: ", JSON.stringify(takerBidEvents, null, 2));

if (takerBidEvents.length !== 1) {
throw new MissingDataError(
`Unexpected saw ${takerBidEvents.length} TakerBid events`,
);
}

// Get claimID
const orderNonce = BigNumber.from(
takerBidEvents[0].args["nonceInvalidationParameters"][1],
).toString();
console.log(
"Signer Address: ",
signerAddress,
"Order nonce: ",
orderNonce,
"Fraction ID: ",
itemId,
"Chain ID: ",
network.chainId,
);

// Remove from DB
if (await tx.wait(5).then((receipt) => receipt.status === 1)) {
const deleteResult = await client
.from("marketplace-orders")
.delete()
.eq("signer", signerAddress)
.eq("chainId", network.chainId)
.eq("orderNonce", orderNonce)
.containedBy("itemIds", [itemId])
.select()
.throwOnError();
console.log("Deleted", deleteResult);

if (!deleteResult) {
throw new Error(
`Could not remove from database. Delete result: ${JSON.stringify(
deleteResult,
)}`,
);
}
}
}
11 changes: 7 additions & 4 deletions defender/src/create-sentinel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { abi } from "./HypercertMinterABI.js";
import config from "./config.js";
import { NetworkConfig } from "./networks";
import { SentinelClient } from "@openzeppelin/defender-sentinel-client";
Expand All @@ -13,12 +12,16 @@ export const createSentinel = async ({
autotaskID,
functionConditions = [],
eventConditions = [],
contractAddress,
abi,
}: {
name: string;
network: NetworkConfig;
autotaskID: string;
eventConditions?: EventCondition[];
functionConditions?: FunctionCondition[];
contractAddress: string;
abi: any;
}) => {
const client = new SentinelClient(config.credentials);
await client
Expand All @@ -27,8 +30,8 @@ export const createSentinel = async ({
network: network.networkKey,
confirmLevel: 1, // if not set, we pick the blockwatcher for the chosen network with the lowest offset
name,
addresses: [network.contractAddress],
abi: abi,
addresses: [contractAddress],
abi,
paused: false,
eventConditions,
functionConditions,
Expand All @@ -41,7 +44,7 @@ export const createSentinel = async ({
`Created sentinel`,
res.name,
"- monitoring address",
network.contractAddress,
contractAddress,
"- linked to autotask",
autotaskID,
);
Expand Down
23 changes: 11 additions & 12 deletions defender/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ export interface SupportedNetworks {

export const NETWORKS: SupportedNetworks = {
TEST: [
{
networkKey: "goerli",
contractAddress: "0x822F17A9A5EeCFd66dBAFf7946a8071C265D1d07",
alchemyKeyEnvName: "ALCHEMY_GOERLI_KEY",
chainId: 5,
},
{
networkKey: "sepolia",
contractAddress: "0xa16DFb32Eb140a6f3F2AC68f41dAd8c7e83C4941",
Expand Down Expand Up @@ -55,23 +49,28 @@ export const NETWORKS: SupportedNetworks = {
* We'll then subsequently use `getNetworkConfigFromName`
* to extract the network name from within the Autotask
* @param network
* @param contract
* @param name - name pre-encoding
* @returns
*/
export const encodeName = (network: NetworkConfig, name: string) =>
`[${network.networkKey}] ${name}`;
export const encodeName = (
network: NetworkConfig,
contract: "minter" | "exchange",
name: string,
) => `[${network.networkKey}][${contract}] ${name}`;

export const decodeName = (
encodedName: string,
): { networkKey: string; name: string } => {
const regex = /^\[(.+)\]\s(.+)$/;
): { networkKey: string; contract: string; name: string } => {
const regex = /^\[(.+)\]\[(.+)\]\s(.+)$/;
const match = encodedName.match(regex);
if (!match) {
throw new Error(`Invalid encoded name: ${encodedName}`);
}
const networkKey = match[1];
const name = match[2];
return { networkKey, name };
const contract = match[2];
const name = match[3];
return { networkKey, contract, name };
};

/**
Expand Down
Loading

0 comments on commit b76176e

Please sign in to comment.