forked from ourzora/zora-721-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate contracts and addresses in typescript file using wagmi + exp…
…ort them in bundled package (ourzora#116) * Use wagmi to generated bundled packages * remove merkletreejs * fix types node import and copy configs to the published package * bundling change configs into built package Defined formatting rules; Added better comments around chain config building
- Loading branch information
Showing
10 changed files
with
3,700 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ cache | |
.env.* | ||
dist/ | ||
.idea | ||
broadcast | ||
broadcast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { readdirSync, readFileSync, writeFileSync } from 'fs'; | ||
|
||
// Reads all the chain configs in ./chainConfigs folder, and bundles them into a typescript | ||
// definition that looks like: | ||
// export const chainConfigs = { | ||
// [chainId]: { | ||
// ...chainConfig | ||
// } | ||
//} | ||
function makeConfig() { | ||
// read all files in the chainConfigs folder | ||
const files = readdirSync('chainConfigs'); | ||
|
||
// combine them into a single mapping | ||
const chainConfigsInner = files | ||
.map((fileName) => { | ||
const chainId = fileName.split('.')[0]; | ||
|
||
const fileContents = JSON.parse(readFileSync(`chainConfigs/${fileName}`)); | ||
|
||
return `[${chainId}]: ${JSON.stringify(fileContents, null, 2)}`; | ||
}) | ||
.join(', '); | ||
|
||
return `export const chainConfigs = { | ||
${chainConfigsInner} | ||
};`; | ||
} | ||
|
||
async function bundleChainConfigs() { | ||
const configString = makeConfig(); | ||
|
||
writeFileSync('./package/chainConfigs.ts', configString); | ||
} | ||
|
||
await bundleChainConfigs(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
export const chainConfigs = { | ||
[1]: { | ||
FACTORY_OWNER: '0xd1d1D4e36117aB794ec5d4c78cBD3a8904E691D0', | ||
FACTORY_UPGRADE_GATE_OWNER: '0xd1d1D4e36117aB794ec5d4c78cBD3a8904E691D0', | ||
MINT_FEE_AMOUNT: 777000000000000, | ||
MINT_FEE_RECIPIENT: '0xd1d1D4e36117aB794ec5d4c78cBD3a8904E691D0', | ||
SUBSCRIPTION_MARKET_FILTER_ADDRESS: | ||
'0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6', | ||
SUBSCRIPTION_MARKET_FILTER_OWNER: | ||
'0x9AaC739c133074dB445183A95149880a2156541A', | ||
ZORA_ERC721_TRANSFER_HELPER: '0x909e9efE4D87d1a6018C2065aE642b6D0447bc91' | ||
}, | ||
[10]: { | ||
FACTORY_OWNER: '0x7A810DCd0f8d83B20212326813Db6EF7E9FD030c', | ||
FACTORY_UPGRADE_GATE_OWNER: '0x7A810DCd0f8d83B20212326813Db6EF7E9FD030c', | ||
MINT_FEE_AMOUNT: 777000000000000, | ||
MINT_FEE_RECIPIENT: '0x7A810DCd0f8d83B20212326813Db6EF7E9FD030c', | ||
SUBSCRIPTION_MARKET_FILTER_ADDRESS: | ||
'0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6', | ||
SUBSCRIPTION_MARKET_FILTER_OWNER: | ||
'0xe3A6CD067a1193b903143C36dA00557c9d95C41e', | ||
ZORA_ERC721_TRANSFER_HELPER: '0x0000000000000000000000000000000000000000' | ||
}, | ||
[11155111]: { | ||
FACTORY_OWNER: '0xE51051a204afb2fC071A2406914cdEA5638e5018', | ||
FACTORY_UPGRADE_GATE_OWNER: '0xE51051a204afb2fC071A2406914cdEA5638e5018', | ||
MINT_FEE_AMOUNT: 111000000000000, | ||
MINT_FEE_RECIPIENT: '0xE51051a204afb2fC071A2406914cdEA5638e5018', | ||
SUBSCRIPTION_MARKET_FILTER_ADDRESS: | ||
'0x9B414A3F7872bdd2E6513689214BD2Debbe48340', | ||
SUBSCRIPTION_MARKET_FILTER_OWNER: | ||
'0xE51051a204afb2fC071A2406914cdEA5638e5018', | ||
ZORA_ERC721_TRANSFER_HELPER: '0x0000000000000000000000000000000000000000' | ||
}, | ||
[420]: { | ||
FACTORY_OWNER: '0x11cf5F667dC6AD4dEE58CB07e4AAc6a3fc7E1DCb', | ||
FACTORY_UPGRADE_GATE_OWNER: '0x11cf5F667dC6AD4dEE58CB07e4AAc6a3fc7E1DCb', | ||
MINT_FEE_AMOUNT: 777000000000000, | ||
MINT_FEE_RECIPIENT: '0x11cf5F667dC6AD4dEE58CB07e4AAc6a3fc7E1DCb', | ||
SUBSCRIPTION_MARKET_FILTER_ADDRESS: | ||
'0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6', | ||
SUBSCRIPTION_MARKET_FILTER_OWNER: | ||
'0xe3A6CD067a1193b903143C36dA00557c9d95C41e', | ||
ZORA_ERC721_TRANSFER_HELPER: '0x0000000000000000000000000000000000000000' | ||
}, | ||
[5]: { | ||
FACTORY_OWNER: '0xDC498668B5e6CC518fD58A2ADBF614Fd3A13D3a0', | ||
FACTORY_UPGRADE_GATE_OWNER: '0xDC498668B5e6CC518fD58A2ADBF614Fd3A13D3a0', | ||
MINT_FEE_AMOUNT: 777000000000000, | ||
MINT_FEE_RECIPIENT: '0xDC498668B5e6CC518fD58A2ADBF614Fd3A13D3a0', | ||
SUBSCRIPTION_MARKET_FILTER_ADDRESS: | ||
'0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6', | ||
SUBSCRIPTION_MARKET_FILTER_OWNER: | ||
'0x9AaC739c133074dB445183A95149880a2156541A', | ||
ZORA_ERC721_TRANSFER_HELPER: '0xd1adAF05575295710dE1145c3c9427c364A70a7f' | ||
}, | ||
[84531]: { | ||
FACTORY_OWNER: '0x02539E813cA450C2c7334e885423f4A899a063Fe', | ||
FACTORY_UPGRADE_GATE_OWNER: '0x02539E813cA450C2c7334e885423f4A899a063Fe', | ||
MINT_FEE_AMOUNT: 111000000000000, | ||
MINT_FEE_RECIPIENT: '0x02539E813cA450C2c7334e885423f4A899a063Fe', | ||
SUBSCRIPTION_MARKET_FILTER_ADDRESS: | ||
'0x9B414A3F7872bdd2E6513689214BD2Debbe48340', | ||
SUBSCRIPTION_MARKET_FILTER_OWNER: | ||
'0x02539E813cA450C2c7334e885423f4A899a063Fe', | ||
ZORA_ERC721_TRANSFER_HELPER: '0xd1adAF05575295710dE1145c3c9427c364A70a7f' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './wagmiGenerated'; | ||
export { chainConfigs } from './chainConfigs'; |
Oops, something went wrong.