Skip to content

Commit

Permalink
Merge pull request #474 from ArtBlocks/dev-engine-test-deploy-#2
Browse files Browse the repository at this point in the history
Second V3_Engine Dev Deployment
  • Loading branch information
ryley-o authored Jan 31, 2023
2 parents 34d79cd + 9bcfb22 commit a948349
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 21 deletions.
16 changes: 16 additions & 0 deletions deployments/engine/V3/internal-testing/DEPLOYMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ The following is intended to be indexed on Art Blocks Dev subgraph

### Upload 0

Using Engine Registry at: `0x2A39132E8d594d2c840D6656327fB26d900C05bA`, corresponding to deployer wallet `0x2246475beddf9333b6a6D9217194576E7617Afd1`

**AdminACLV1:** https://goerli.etherscan.io/address/0xCf54E0AD108Ec3b961190a402808FCc73dA7EbDf#code

**GenArt721CoreV3_Engine:** https://goerli.etherscan.io/address/0x849CfA68915f2a9adf34bD20dc62E6f56fad23Cc#code
Expand All @@ -19,3 +21,17 @@ The following is intended to be indexed on Art Blocks Dev subgraph
**MinterSetPriceV4:** https://goerli.etherscan.io/address/0xBF5F2541A34B406195dB6ae09C3d98979F1e5FC4#code

`0x2246475beddf9333b6a6D9217194576E7617Afd1` set as admin of everything

### Upload 1 (Called #2 in contract name)

Using Engine Registry at: `0x2A39132E8d594d2c840D6656327fB26d900C05bA`, corresponding to deployer wallet `0x2246475beddf9333b6a6D9217194576E7617Afd1`

**AdminACLV1:** https://goerli.etherscan.io/address/0x976b2Dee5De394Fe704B774166A16C68e02f197a#code

**GenArt721CoreV3_Engine:** https://goerli.etherscan.io/address/0xd47A017282E3a67D17421C6d98655eFb7D5ED1E6#code

**MinterFilterV1:** https://goerli.etherscan.io/address/0xBc86F31413AE950FC732A923284D5c74045878C3#code

**MinterSetPriceV4:** https://goerli.etherscan.io/address/0x6e8f18DAA4cec615d6997631118483179696225c#code

`0x2246475beddf9333b6a6D9217194576E7617Afd1` set as admin of everything
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

import { ethers } from "hardhat";
// engine registry
import { EngineRegistryV0__factory } from "../contracts/factories/EngineRegistryV0__factory";
import { EngineRegistryV0__factory } from "../../../contracts/factories/EngineRegistryV0__factory";
// engine
import { GenArt721CoreV3Engine__factory } from "../contracts/factories/GenArt721CoreV3Engine__factory";
import { AdminACLV1__factory } from "../contracts/factories/AdminACLV1__factory";
import { BasicRandomizerV2__factory } from "../contracts/factories/BasicRandomizerV2__factory";
import { GenArt721CoreV3Engine__factory } from "../../../contracts/factories/GenArt721CoreV3Engine__factory";
import { AdminACLV1__factory } from "../../../contracts/factories/AdminACLV1__factory";
import { BasicRandomizerV2__factory } from "../../../contracts/factories/BasicRandomizerV2__factory";
// minter suite
import { MinterFilterV1__factory } from "../contracts/factories/MinterFilterV1__factory";
import { MinterSetPriceV2__factory } from "../contracts/factories/MinterSetPriceV2__factory";
import { MinterFilterV1__factory } from "../../../contracts/factories/MinterFilterV1__factory";
import { MinterSetPriceV2__factory } from "../../../contracts/factories/MinterSetPriceV2__factory";

// delay to avoid issues with reorgs and tx failures
import { delay } from "../util/utils";
import { delay } from "../../../util/utils";
const EXTRA_DELAY_BETWEEN_TX = 1000; // ms
const MANUAL_GAS_LIMIT = 500000; // gas

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

import { ethers } from "hardhat";
// engine registry
import { EngineRegistryV0__factory } from "../contracts/factories/EngineRegistryV0__factory";
import { EngineRegistryV0__factory } from "../../../contracts/factories/EngineRegistryV0__factory";
// engine
import { GenArt721CoreV3Engine__factory } from "../contracts/factories/GenArt721CoreV3Engine__factory";
import { AdminACLV1__factory } from "../contracts/factories/AdminACLV1__factory";
import { BasicRandomizerV2__factory } from "../contracts/factories/BasicRandomizerV2__factory";
import { GenArt721CoreV3Engine__factory } from "../../../contracts/factories/GenArt721CoreV3Engine__factory";
import { AdminACLV1__factory } from "../../../contracts/factories/AdminACLV1__factory";
import { BasicRandomizerV2__factory } from "../../../contracts/factories/BasicRandomizerV2__factory";
// minter suite
import { MinterFilterV1__factory } from "../contracts/factories/MinterFilterV1__factory";
import { MinterSetPriceV2__factory } from "../contracts/factories/MinterSetPriceV2__factory";
import { MinterFilterV1__factory } from "../../../contracts/factories/MinterFilterV1__factory";
import { MinterSetPriceV2__factory } from "../../../contracts/factories/MinterSetPriceV2__factory";

// delay to avoid issues with reorgs and tx failures
import { delay } from "../util/utils";
import { delay } from "../../../util/utils";
const EXTRA_DELAY_BETWEEN_TX = 1000; // ms
const MANUAL_GAS_LIMIT = 500000; // gas

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@

import { ethers } from "hardhat";
// engine registry
import { EngineRegistryV0__factory } from "../contracts/factories/EngineRegistryV0__factory";
import { EngineRegistryV0__factory } from "../../../contracts/factories/EngineRegistryV0__factory";
// engine
import { GenArt721CoreV3Engine__factory } from "../contracts/factories/GenArt721CoreV3Engine__factory";
import { AdminACLV1__factory } from "../contracts/factories/AdminACLV1__factory";
import { BasicRandomizerV2__factory } from "../contracts/factories/BasicRandomizerV2__factory";
import { GenArt721CoreV3Engine__factory } from "../../../contracts/factories/GenArt721CoreV3Engine__factory";
import { AdminACLV1__factory } from "../../../contracts/factories/AdminACLV1__factory";
import { BasicRandomizerV2__factory } from "../../../contracts/factories/BasicRandomizerV2__factory";
// minter suite
import { MinterFilterV1__factory } from "../contracts/factories/MinterFilterV1__factory";
import { MinterSetPriceV4__factory } from "../contracts/factories/MinterSetPriceV4__factory";
import { MinterFilterV1__factory } from "../../../contracts/factories/MinterFilterV1__factory";
import { MinterSetPriceV4__factory } from "../../../contracts/factories/MinterSetPriceV4__factory";

// image bucket creation
import { createPBABBucket } from "../../../util/aws_s3";

// delay to avoid issues with reorgs and tx failures
import { delay } from "../util/utils";
import { delay } from "../../../util/utils";
const EXTRA_DELAY_BETWEEN_TX = 1000; // ms
const MANUAL_GAS_LIMIT = 500000; // gas
const AUTO_APPROVE_ARTIST_SPLIT_PROPOSALS = true;
Expand Down Expand Up @@ -233,6 +236,12 @@ async function main() {
console.log(
`${standardVerify} --network ${networkName} ${minterSetPrice.address} ${genArt721Core.address} ${minterFilter.address}`
);
// create image bucket
const payload = await createPBABBucket(tokenName, networkName);
console.log(`Set image bucket for this core contract to ${payload["url"]}`);
// reminder to set core contract type in db
const coreType = await genArt721Core.coreType();
console.log(`Set core contract type to ${coreType}`);

//////////////////////////////////////////////////////////////////////////////
// SETUP ENDS HERE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
// SPDX-License-Identifier: LGPL-3.0-only
// Created By: Art Blocks Inc.

import { ethers } from "hardhat";
// engine registry
import { EngineRegistryV0__factory } from "../../../contracts/factories/EngineRegistryV0__factory";
// engine
import { GenArt721CoreV3Engine__factory } from "../../../contracts/factories/GenArt721CoreV3Engine__factory";
import { AdminACLV1__factory } from "../../../contracts/factories/AdminACLV1__factory";
import { BasicRandomizerV2__factory } from "../../../contracts/factories/BasicRandomizerV2__factory";
// minter suite
import { MinterFilterV1__factory } from "../../../contracts/factories/MinterFilterV1__factory";
import { MinterSetPriceV4__factory } from "../../../contracts/factories/MinterSetPriceV4__factory";

// image bucket creation
import { createPBABBucket } from "../../../util/aws_s3";
// delay to avoid issues with reorgs and tx failures
import { delay } from "../../../util/utils";
const EXTRA_DELAY_BETWEEN_TX = 1000; // ms
const MANUAL_GAS_LIMIT = 500000; // gas
const AUTO_APPROVE_ARTIST_SPLIT_PROPOSALS = true;

/**
* This script was created to deploy the V3 core Engine contracts,
* including the associated minter suite, to the Ethereum goerli testnet.
* It is intended to document the deployment process and provide a
* reference for the steps required to deploy the V3 core contract suite.
* IMPORTANT: This deploys a basic randomizer, which may be changed after
* deployment by the configured superAdmin.
*/
//////////////////////////////////////////////////////////////////////////////
// CONFIG BEGINS HERE
//////////////////////////////////////////////////////////////////////////////
const contractDeployDetailsArray = [
{
tokenName: "Art Blocks V3 Engine Testnet Dev #2",
tokenTicker: "ABV3ENGDEV_2",
startingProjectId: 0,
},
];
// the following engine registry address must be used by admin dev deployer wallet
// 0x2246475beddf9333b6a6D9217194576E7617Afd1
const engineRegistryAddress = "0x2A39132E8d594d2c840D6656327fB26d900C05bA";
//////////////////////////////////////////////////////////////////////////////
// CONFIG ENDS HERE
//////////////////////////////////////////////////////////////////////////////
async function main() {
const [deployer] = await ethers.getSigners();
const network = await ethers.provider.getNetwork();
const networkName = network.name == "homestead" ? "mainnet" : network.name;
if (networkName != "goerli") {
throw new Error("This script is intended to be run on goerli only");
}
//////////////////////////////////////////////////////////////////////////////
// DEPLOYMENT (SHARED) BEGINS HERE
//////////////////////////////////////////////////////////////////////////////

// Deploy AdminACL contract
// @dev - comment out deployment if using existing ACL contract
const adminACLFactory = new AdminACLV1__factory(deployer);
const adminACL = await adminACLFactory.deploy();
await adminACL.deployed();
const adminACLAddress = adminACL.address;
console.log(`Admin ACL deployed at ${adminACLAddress}`);

// Deploy engine registry contract
// @dev - comment out deployment if using existing engine registry
console.log(`Engine Registry being used at ${engineRegistryAddress}`);

//////////////////////////////////////////////////////////////////////////////
// DEPLOYMENT (SHARED) ENDS HERE
//////////////////////////////////////////////////////////////////////////////

// Perform the following deploy steps for each to-be-deployed contract:
for (let index = 0; index < contractDeployDetailsArray.length; index++) {
const contractDeployDetails = contractDeployDetailsArray[index];

//////////////////////////////////////////////////////////////////////////////
// DEPLOYMENT (PER-CONTRACT) BEGINS HERE
//////////////////////////////////////////////////////////////////////////////

// Deploy randomizer contract
const randomizerFactory = new BasicRandomizerV2__factory(deployer);
const randomizer = await randomizerFactory.deploy();
await randomizer.deployed();
const randomizerAddress = randomizer.address;
console.log(`Randomizer deployed at ${randomizerAddress}`);

// Deploy Core contract
const genArt721CoreFactory = new GenArt721CoreV3Engine__factory(deployer);
const tokenName = contractDeployDetails.tokenName;
const tokenTicker = contractDeployDetails.tokenTicker;
const renderProviderAddress = deployer.address;
const platformProviderAddress = deployer.address;
const startingProjectId = contractDeployDetails.startingProjectId;
const genArt721Core = await genArt721CoreFactory.deploy(
tokenName,
tokenTicker,
renderProviderAddress,
platformProviderAddress,
randomizerAddress,
adminACLAddress,
startingProjectId,
AUTO_APPROVE_ARTIST_SPLIT_PROPOSALS,
engineRegistryAddress
);

await genArt721Core.deployed();
console.log(`GenArt721CoreV3_Engine deployed at ${genArt721Core.address}`);

// Deploy Minter Filter contract.
const minterFilterFactory = new MinterFilterV1__factory(deployer);
const minterFilter = await minterFilterFactory.deploy(
genArt721Core.address
);
await minterFilter.deployed();
console.log(`Minter Filter deployed at ${minterFilter.address}`);

// Deploy Minter Suite contracts.
// set price V2
const minterSetPriceFactory = new MinterSetPriceV4__factory(deployer);
const minterSetPrice = await minterSetPriceFactory.deploy(
genArt721Core.address,
minterFilter.address
);
await minterSetPrice.deployed();
console.log(`MinterSetPrice V4 deployed at ${minterSetPrice.address}`);

//////////////////////////////////////////////////////////////////////////////
// DEPLOYMENT (PER-CONTRACT) ENDS HERE
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
// SETUP BEGINS HERE
//////////////////////////////////////////////////////////////////////////////

// Assign randomizer to core and renounce ownership on randomizer
await randomizer.assignCoreAndRenounce(genArt721Core.address);
console.log(
`Assigned randomizer to core and renounced ownership of randomizer`
);
await delay(EXTRA_DELAY_BETWEEN_TX);

// Set the Minter on the Core contract.
await genArt721Core
.connect(deployer)
.updateMinterContract(minterFilter.address);
console.log(`Updated the Minter Filter on the Core contract.`);
await delay(EXTRA_DELAY_BETWEEN_TX);

// Allowlist new Minters on MinterFilter.
await minterFilter
.connect(deployer)
.addApprovedMinter(minterSetPrice.address);
console.log(
`Allowlisted minter ${minterSetPrice.address} on minter filter.`
);
await delay(EXTRA_DELAY_BETWEEN_TX);

// Create a project 0, and a token 0, on that empty project.
await genArt721Core.connect(deployer).addProject(
tokenName, // Use `tokenName` as placeholder for project 0 name
deployer.address // Use `deployer.address` as placeholder for project 0 owner
);
console.log(
`Added ${tokenName} project ${startingProjectId} placeholder on ${tokenName} contract.`
);
await delay(EXTRA_DELAY_BETWEEN_TX);
await minterFilter
.connect(deployer)
.setMinterForProject(startingProjectId, minterSetPrice.address, {
gasLimit: MANUAL_GAS_LIMIT,
}); // provide manual gas limit
console.log(
`Configured set price minter (${minterSetPrice.address}) for project ${startingProjectId}.`
);
await delay(EXTRA_DELAY_BETWEEN_TX);
await minterSetPrice
.connect(deployer)
.updatePricePerTokenInWei(startingProjectId, 0, {
gasLimit: MANUAL_GAS_LIMIT,
}); // provide manual gas limit
console.log(`Configured minter price project ${startingProjectId}.`);
await delay(EXTRA_DELAY_BETWEEN_TX);
await minterSetPrice
.connect(deployer)
.purchase(startingProjectId, { gasLimit: MANUAL_GAS_LIMIT }); // provide manual gas limit
console.log(`Minted token 0 for project ${startingProjectId}.`);
await delay(EXTRA_DELAY_BETWEEN_TX);

// Note reminders about config addresses that have been left as the deployer for now.
console.log(
`provider primary and secondary sales payment addresses remain as deployer addresses: ${deployer.address}.`
);
console.log(
`AdminACL's superAdmin address remains as deployer address: ${deployer.address}.`
);
console.log(`Don't forget to update these later as needed!.`);

// Output instructions for manual Etherscan verification.
const standardVerify = "yarn hardhat verify";
console.log(
`Save the following constructor args config file to a constructor-args.js file, then verify core contract deployment with:`
);
console.log(
`module.exports = [
"${tokenName}", // name
"${tokenTicker}", // ticker
"${renderProviderAddress}", // render provider
"${platformProviderAddress}", // platform provider
"${randomizerAddress}", // randomizer
"${adminACLAddress}", // admin acl
${startingProjectId}, // starting project id
${AUTO_APPROVE_ARTIST_SPLIT_PROPOSALS}, // auto approve artist split proposals
"${engineRegistryAddress}" // engine registry
];`
);
console.log(
`${standardVerify} --network ${networkName} --constructor-args constructor-args.js ${genArt721Core.address}`
);
console.log(`Verify Admin ACL contract deployment with:`);
console.log(
`${standardVerify} --network ${networkName} ${adminACL.address}`
);
console.log(`Verify MinterFilter deployment with:`);
console.log(
`${standardVerify} --network ${networkName} ${minterFilter.address} ${genArt721Core.address}`
);
console.log(`Verify MinterSetPrice deployment with:`);
console.log(
`${standardVerify} --network ${networkName} ${minterSetPrice.address} ${genArt721Core.address} ${minterFilter.address}`
);
// create image bucket
const payload = await createPBABBucket(tokenName, networkName);
console.log(`Set image bucket for this core contract to ${payload["url"]}`);
// reminder to set core contract type in db
const coreType = await genArt721Core.coreType();
console.log(`Set core contract type to ${coreType}`);

//////////////////////////////////////////////////////////////////////////////
// SETUP ENDS HERE
//////////////////////////////////////////////////////////////////////////////
}
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

0 comments on commit a948349

Please sign in to comment.