Skip to content

Commit

Permalink
additional deployment stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bvalosek committed Dec 22, 2021
1 parent fd1a6de commit 73fb5c0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
5 changes: 4 additions & 1 deletion contracts/IShellFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ interface IShellFactory is IOwnable {
event ImplementationRegistered(string name, IShellFramework implementation);

// new clone launched
event CollectionCreated(IShellFramework collection);
event CollectionCreated(
IShellFramework collection,
IShellFramework implememtation
);

// register a new collection implementation
function registerImplementation(
Expand Down
2 changes: 1 addition & 1 deletion contracts/ShellFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract ShellFactory is IShellFactory, Ownable {
Clones.clone(address(implementation))
);
clone.initialize(name, symbol, engine, owner);
emit CollectionCreated(clone);
emit CollectionCreated(clone, implementation);
return clone;
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"build": "hardhat compile",
"deploy": "hardhat deploy",
"deploy:implementation": "hardhat deploy:implementation",
"register": "hardhat register",
"verify": "hardhat verify"
},
"dependencies": {
Expand Down
25 changes: 23 additions & 2 deletions tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ task("deploy", "Deploy a contract")
return address;
});

task("register", "Register a shell implementation contract")
.addParam<string>("address", "Deployed contract address")
.addParam<string>(
"implementation",
"Name to use during implementation registration"
)
.setAction(async ({ address, implementation }, { ethers, run, network }) => {
const ShellFactory = await ethers.getContractFactory("ShellFactory");
const entry = (await readDeploymentsFile())[network.name];
if (!entry) {
throw new Error(`no deployment entry for network: ${network.name}`);
}
const factory = ShellFactory.attach(entry.address);

console.log("registering implementation with factory...");
const trx = await factory.registerImplementation(implementation, address);
await trx.wait();

console.log(`${implementation} registered with ShellFactory`);
});

task(
"deploy:implementation",
"Deploy and register a shell implementation contract"
Expand All @@ -74,10 +95,10 @@ task(
if (!entry) {
throw new Error(`no deployment entry for network: ${network.name}`);
}

console.log("registering implementation with factory...");
const ShellFactory = await ethers.getContractFactory("ShellFactory");
const factory = ShellFactory.attach(entry.address);

console.log("registering implementation with factory...");
const trx = await factory.registerImplementation(implementation, address);
await trx.wait();

Expand Down
4 changes: 2 additions & 2 deletions tasks/deployments.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"rinkeby": {
"address": "0xa94FD23B14a96cFd902cc240521BF22420e51B6e"
"address": "0x274347dF5C778163c6BD9262317Bb9f44723925B"
}
}
}

0 comments on commit 73fb5c0

Please sign in to comment.