From e31073b37264eb5765b9e9814c8b125cc6eef2a2 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Thu, 5 Oct 2023 17:48:22 +0200 Subject: [PATCH] fix(details): dynamic NFT details --- src/abis/cookieNft.ts | 378 +++++++----------------------------------- src/legos/forms.ts | 5 + src/legos/tx.ts | 9 + src/targetDao.ts | 8 +- 4 files changed, 75 insertions(+), 325 deletions(-) diff --git a/src/abis/cookieNft.ts b/src/abis/cookieNft.ts index 830cf88..7078c17 100644 --- a/src/abis/cookieNft.ts +++ b/src/abis/cookieNft.ts @@ -1,26 +1,10 @@ export const CookieNFT = [ { inputs: [ - { - internalType: "address", - name: "_erc6551Reg", - type: "address", - }, - { - internalType: "address", - name: "_erc6551Imp", - type: "address", - }, - { - internalType: "address", - name: "_cookieJarSummoner", - type: "address", - }, - { - internalType: "address", - name: "_cookieJarImp", - type: "address", - }, + { internalType: "address", name: "_erc6551Reg", type: "address" }, + { internalType: "address", name: "_erc6551Imp", type: "address" }, + { internalType: "address", name: "_cookieJarSummoner", type: "address" }, + { internalType: "address", name: "_cookieJarImp", type: "address" }, ], stateMutability: "nonpayable", type: "constructor", @@ -90,12 +74,7 @@ export const CookieNFT = [ name: "operator", type: "address", }, - { - indexed: false, - internalType: "bool", - name: "approved", - type: "bool", - }, + { indexed: false, internalType: "bool", name: "approved", type: "bool" }, ], name: "ApprovalForAll", type: "event", @@ -103,18 +82,8 @@ export const CookieNFT = [ { anonymous: false, inputs: [ - { - indexed: true, - internalType: "address", - name: "from", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "to", - type: "address", - }, + { indexed: true, internalType: "address", name: "from", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, { indexed: true, internalType: "uint256", @@ -127,16 +96,8 @@ export const CookieNFT = [ }, { inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, ], name: "approve", outputs: [], @@ -144,152 +105,61 @@ export const CookieNFT = [ type: "function", }, { - inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - ], + inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "cap", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "cookieJarImp", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], + outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [], name: "cookieJarSummoner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], + outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [ - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "periodLength", - type: "uint256", - }, - { - internalType: "uint256", - name: "cookieAmount", - type: "uint256", - }, - { - internalType: "address", - name: "cookieToken", - type: "address", - }, - { - internalType: "address", - name: "donationToken", - type: "address", - }, - { - internalType: "uint256", - name: "donationAmount", - type: "uint256", - }, - { - internalType: "address[]", - name: "allowList", - type: "address[]", - }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "periodLength", type: "uint256" }, + { internalType: "uint256", name: "cookieAmount", type: "uint256" }, + { internalType: "address", name: "cookieToken", type: "address" }, + { internalType: "address", name: "donationToken", type: "address" }, + { internalType: "uint256", name: "donationAmount", type: "uint256" }, + { internalType: "address[]", name: "allowList", type: "address[]" }, + { internalType: "string", name: "details", type: "string" }, ], name: "cookieMint", outputs: [ - { - internalType: "address", - name: "account", - type: "address", - }, - { - internalType: "address", - name: "cookieJar", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, + { internalType: "address", name: "account", type: "address" }, + { internalType: "address", name: "cookieJar", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, ], stateMutability: "payable", type: "function", }, { - inputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], + inputs: [{ internalType: "uint256", name: "", type: "uint256" }], name: "cookies", outputs: [ - { - internalType: "address", - name: "cookieJar", - type: "address", - }, - { - internalType: "uint256", - name: "periodLength", - type: "uint256", - }, - { - internalType: "uint256", - name: "cookieAmount", - type: "uint256", - }, - { - internalType: "address", - name: "cookieToken", - type: "address", - }, + { internalType: "address", name: "cookieJar", type: "address" }, + { internalType: "uint256", name: "periodLength", type: "uint256" }, + { internalType: "uint256", name: "cookieAmount", type: "uint256" }, + { internalType: "address", name: "cookieToken", type: "address" }, ], stateMutability: "view", type: "function", @@ -297,121 +167,53 @@ export const CookieNFT = [ { inputs: [], name: "erc6551Imp", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], + outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [], name: "erc6551Reg", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], + outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], + inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], name: "getApproved", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], + outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [ - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "operator", - type: "address", - }, + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "operator", type: "address" }, ], name: "isApprovedForAll", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], + outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [], name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], + outputs: [{ internalType: "string", name: "", type: "string" }], stateMutability: "view", type: "function", }, { - inputs: [ - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], + inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], name: "ownerOf", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], + outputs: [{ internalType: "address", name: "", type: "address" }], stateMutability: "view", type: "function", }, { inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, ], name: "safeTransferFrom", outputs: [], @@ -420,26 +222,10 @@ export const CookieNFT = [ }, { inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, + { internalType: "bytes", name: "data", type: "bytes" }, ], name: "safeTransferFrom", outputs: [], @@ -448,16 +234,8 @@ export const CookieNFT = [ }, { inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - { - internalType: "bool", - name: "approved", - type: "bool", - }, + { internalType: "address", name: "operator", type: "address" }, + { internalType: "bool", name: "approved", type: "bool" }, ], name: "setApprovalForAll", outputs: [], @@ -465,73 +243,31 @@ export const CookieNFT = [ type: "function", }, { - inputs: [ - { - internalType: "bytes4", - name: "interfaceId", - type: "bytes4", - }, - ], + inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }], name: "supportsInterface", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], + outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { inputs: [], name: "symbol", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], + outputs: [{ internalType: "string", name: "", type: "string" }], stateMutability: "view", type: "function", }, { - inputs: [ - { - internalType: "uint256", - name: "_tokenId", - type: "uint256", - }, - ], + inputs: [{ internalType: "uint256", name: "_tokenId", type: "uint256" }], name: "tokenURI", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], + outputs: [{ internalType: "string", name: "", type: "string" }], stateMutability: "view", type: "function", }, { inputs: [ - { - internalType: "address", - name: "from", - type: "address", - }, - { - internalType: "address", - name: "to", - type: "address", - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, + { internalType: "address", name: "from", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "tokenId", type: "uint256" }, ], name: "transferFrom", outputs: [], diff --git a/src/legos/forms.ts b/src/legos/forms.ts index 996fc7a..f5857fc 100644 --- a/src/legos/forms.ts +++ b/src/legos/forms.ts @@ -14,11 +14,16 @@ export const APP_FORM: Record = { cookiePeriod: true, cookieToken: true, cookieAmount: true, + title: true, + description: true, }, log: true, tx: APP_TX.CREATE_NFT_JAR as TXLego, fields: [ APP_FIELD.RECEIVER, + APP_FIELD.TITLE, + APP_FIELD.DESCRIPTION, + APP_FIELD.LINK, APP_FIELD.COOKIE_PERIOD, APP_FIELD.COOKIE_AMOUNT, APP_FIELD.COOKIE_TOKEN, diff --git a/src/legos/tx.ts b/src/legos/tx.ts index a34dc8e..f111818 100644 --- a/src/legos/tx.ts +++ b/src/legos/tx.ts @@ -34,6 +34,15 @@ export const APP_TX = { ".formValues.donationToken", ".formValues.proposalOffering", ".formValues.allowList", + { + type: "JSONDetails", + jsonSchema: { + type: { type: "static", value: "6551" }, + title: ".formValues.title", + description: ".formValues.description", + link: ".formValues.link", + }, + }, ], overrides: { value: ".formValues.proposalOffering", diff --git a/src/targetDao.ts b/src/targetDao.ts index 09229b8..b859e09 100644 --- a/src/targetDao.ts +++ b/src/targetDao.ts @@ -19,7 +19,7 @@ type Targets = { export const TARGET_GNOSIS: Targets = { COOKIEJAR_FACTORY_ADDRESS: "0xD8f6FE1E102a05Eae8ab70290Dc410f80FdA3a8D", - COOKIE_JAR_NFT_ADDRESS: "0xC4C494b9f505C528e798Ec8719c2ea588e210D2e", + COOKIE_JAR_NFT_ADDRESS: "0xF689C1F8475102EFdEE73ed359fC039e385F3786", BAAL_COOKIEJAR_ADDRESS: "0x7dd7E6AF7Ff624EF6caf2d977E339209D2A5503A", ERC20_COOKIEJAR_ADDRESS: "0xFCC2d698C614743FD17f628921874e8Eac3D538F", ERC721_COOKIEJAR_ADDRESS: "0x926542695E047463f25aa3Df7e78Ade57495808A", @@ -36,7 +36,7 @@ export const TARGET_GNOSIS: Targets = { // WIP To get it to build again export const TARGET_GOERLI: Targets = { COOKIEJAR_FACTORY_ADDRESS: "0x3D65060def34B7b09f3be8f1eDD826B278540201", - COOKIE_JAR_NFT_ADDRESS: "0x53cc3cCd8582Ff154aAeB918be63A9986b820468", + COOKIE_JAR_NFT_ADDRESS: "0xc4c494b9f505c528e798ec8719c2ea588e210d2e", BAAL_COOKIEJAR_ADDRESS: "0x11cf91a633b292e90afc1dd063dB9CE0b94a89aE", ERC20_COOKIEJAR_ADDRESS: "0x478b6d99EfA2689649762a4B4E2590872184078f", ERC721_COOKIEJAR_ADDRESS: "0x7dd7E6AF7Ff624EF6caf2d977E339209D2A5503A", @@ -53,7 +53,7 @@ export const TARGET_GOERLI: Targets = { export const TARGETS: { [key: string]: Targets } = { "0x64": TARGET_GNOSIS, "0x5": TARGET_GOERLI, - development: TARGET_GOERLI, + development: TARGET_GNOSIS, }; -export const DEFAULT_TARGET: Targets = TARGET_GOERLI; +export const DEFAULT_TARGET: Targets = TARGET_GNOSIS;