-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New
protocol-deployments
package - separate versioning of contracts…
… from publishing deployment updates (#305) Created new package `protocol-deployments` * deployment scripts for 1155 contracts have been moved from `1155-contracts` to this new package * deployed 1155 contract addresses have been moved from `1155-contracts` to this new package. Problem this solves: * every time we deployed a contract and want to to publish the changes in a package we had to bump the contract version, since we require the package version to match the contract version. With this change, we can version the contracts independently from the deployed addresses. You can see this in action in the upstream branch "Deploy zora sepolia" where we deployed the contracts to the new Zora Sepolia chain, and just bumped the `protocol-deployments` version without needing to bump the `1155-contracts` version. * The `1155-contracts` wagmi generator now just generates abis to bundle in the package json. * The `protocol-deployments` wagmi generator imports the abis from `1155-contracts` and bundles them with the deployed addresses. * `premint-sdk` imports from `protocol-deployments` to get contract abis and addresses from it
- Loading branch information
Showing
71 changed files
with
427 additions
and
319 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@zoralabs/protocol-deployments": patch | ||
"@zoralabs/premint-sdk": patch | ||
--- | ||
|
||
created new package `protocol-deployments` that includes the deployed contract addresses. | ||
|
||
* 1155-contracts js no longer exports deployed addresses, just the abis | ||
* premint-sdk imports deployed addresses from `protocol-deployments |
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,7 +9,7 @@ abis/ | |
# /broadcast/**/dry-run/ | ||
|
||
# Remove broadcast logs | ||
/broadcast/ | ||
**/*/broadcast | ||
|
||
# Docs | ||
docs/ | ||
|
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
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 was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
packages/1155-contracts/script/TestCreateDeterministic.sol
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,118 +1,24 @@ | ||
import { defineConfig } from "@wagmi/cli"; | ||
import { foundry } from "@wagmi/cli/plugins"; | ||
import { readdirSync, readFileSync } from "fs"; | ||
import { publishAbisJson } from "./publishAbisPlugin"; | ||
|
||
type ContractNames = | ||
| "ZoraCreator1155FactoryImpl" | ||
| "ZoraCreator1155Impl" | ||
| "ZoraCreatorFixedPriceSaleStrategy" | ||
| "ZoraCreatorMerkleMinterStrategy" | ||
| "ZoraCreatorRedeemMinterFactory" | ||
| "ZoraCreatorRedeemMinterStrategy" | ||
| "ZoraCreator1155PremintExecutorImpl" | ||
| "DeterministicProxyDeployer" | ||
| "IImmutableCreate2Factory"; | ||
|
||
type Address = `0x${string}`; | ||
|
||
const contractFilesToInclude: ContractNames[] = [ | ||
"ZoraCreator1155FactoryImpl", | ||
"ZoraCreator1155Impl", | ||
"ZoraCreatorFixedPriceSaleStrategy", | ||
"ZoraCreatorMerkleMinterStrategy", | ||
"ZoraCreatorRedeemMinterFactory", | ||
"ZoraCreatorRedeemMinterStrategy", | ||
"ZoraCreator1155PremintExecutorImpl", | ||
"DeterministicProxyDeployer", | ||
"IImmutableCreate2Factory", | ||
]; | ||
|
||
type Addresses = { | ||
[key in ContractNames]?: { | ||
[chainId: number]: Address; | ||
}; | ||
}; | ||
|
||
const getAddresses = () => { | ||
const addresses: Addresses = {}; | ||
|
||
const addressesFiles = readdirSync("./addresses"); | ||
|
||
const addAddress = ( | ||
contractName: ContractNames, | ||
chainId: number, | ||
address?: Address | ||
) => { | ||
if (!address) return; | ||
if (!addresses[contractName]) { | ||
addresses[contractName] = {}; | ||
} | ||
|
||
addresses[contractName]![chainId] = address; | ||
}; | ||
|
||
for (const addressesFile of addressesFiles) { | ||
const jsonAddress = JSON.parse( | ||
readFileSync(`./addresses/${addressesFile}`, "utf-8") | ||
) as { | ||
FIXED_PRICE_SALE_STRATEGY: Address; | ||
MERKLE_MINT_SALE_STRATEGY: Address; | ||
REDEEM_MINTER_FACTORY: Address; | ||
"1155_IMPL": Address; | ||
FACTORY_IMPL: Address; | ||
FACTORY_PROXY: Address; | ||
PREMINTER_PROXY?: Address; | ||
}; | ||
|
||
const chainId = parseInt(addressesFile.split(".")[0]); | ||
|
||
addAddress( | ||
"ZoraCreatorFixedPriceSaleStrategy", | ||
chainId, | ||
jsonAddress.FIXED_PRICE_SALE_STRATEGY | ||
); | ||
addAddress( | ||
"ZoraCreatorMerkleMinterStrategy", | ||
chainId, | ||
jsonAddress.MERKLE_MINT_SALE_STRATEGY | ||
); | ||
addAddress( | ||
"ZoraCreator1155FactoryImpl", | ||
chainId, | ||
jsonAddress.FACTORY_PROXY | ||
); | ||
addAddress( | ||
"ZoraCreatorRedeemMinterFactory", | ||
chainId, | ||
jsonAddress.REDEEM_MINTER_FACTORY | ||
); | ||
addAddress( | ||
"ZoraCreator1155PremintExecutorImpl", | ||
chainId, | ||
jsonAddress.PREMINTER_PROXY | ||
), | ||
addAddress( | ||
"IImmutableCreate2Factory", | ||
chainId, | ||
"0x0000000000FFe8B47B3e2130213B802212439497" | ||
); | ||
} | ||
|
||
return addresses; | ||
}; | ||
|
||
export default defineConfig({ | ||
out: "package/wagmiGenerated.ts", | ||
plugins: [ | ||
foundry({ | ||
deployments: getAddresses(), | ||
forge: { | ||
build: false, | ||
}, | ||
include: contractFilesToInclude.map( | ||
(contractName) => `${contractName}.json` | ||
), | ||
include: [ | ||
"ZoraCreator1155FactoryImpl", | ||
"ZoraCreator1155Impl", | ||
"ZoraCreatorFixedPriceSaleStrategy", | ||
"ZoraCreatorMerkleMinterStrategy", | ||
"ZoraCreatorRedeemMinterFactory", | ||
"ZoraCreatorRedeemMinterStrategy", | ||
"ZoraCreator1155PremintExecutorImpl", | ||
"DeterministicProxyDeployer", | ||
"IImmutableCreate2Factory", | ||
].map((contractName) => `${contractName}.json`), | ||
}), | ||
], | ||
}); |
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
Oops, something went wrong.