Clone Factories

close button

Part II

ERC1167 Clones

Elaine employs a factory pattern, where a new contract is deployed each time summon() is called. Separating each escrow into separate contracts instead of managing all escrows in a single contract brings about the following benefit:

  1. Code in each contract is simplified.

  2. Each escrow is isolated from one another, making them more resilient to certain security vulnerabilities.

However, factories come with a huge cost: deploying a new contract into the blockchain is generally very gas expensive. This is worsened if the deployed contract’s bytecode is especially large.

Luckily, EIP-1167 offers a clever way of making deployment much more gas efficient.

Your Task

Using OpenZeppelin’s Clones library, have Elaine deploy ERC1167 minimal proxy SpiritCat contracts.

Run tests in Questplay

Submit work in Questplay

Summoning a spirit cat requires considerable mana. Perhaps, if you can show Elaine a way to reduce this, she’ll be able to complete the spell with less difficulty.