From 5bf0cf69bfbdc21f31caabd9d64494cd0a6ff879 Mon Sep 17 00:00:00 2001 From: Alex Palmer <24211477+ThatAlexPalmer@users.noreply.github.com> Date: Sun, 11 Feb 2024 19:48:15 -0500 Subject: [PATCH] Add new factory-deployment page --- src/pages/development/_meta.json | 4 +- src/pages/development/factory-deployment.mdx | 51 ++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/pages/development/factory-deployment.mdx diff --git a/src/pages/development/_meta.json b/src/pages/development/_meta.json index a72af38..e426cb7 100644 --- a/src/pages/development/_meta.json +++ b/src/pages/development/_meta.json @@ -1,3 +1,5 @@ { - "install": "Install" + "install": "Install", + "setup": "Setup", + "factory-deployment": "Factory Deployment" } diff --git a/src/pages/development/factory-deployment.mdx b/src/pages/development/factory-deployment.mdx new file mode 100644 index 0000000..7bf0555 --- /dev/null +++ b/src/pages/development/factory-deployment.mdx @@ -0,0 +1,51 @@ +import { Steps } from 'nextra/components'; + +# Factory smart contract + +We use a factory pattern that's responsible for creating new cap tables and managing the cap table addresses. You can find the smart contract in our repo under [capTableFactory.sol](https://github.com/transfer-agent-protocol/tap-cap-table/blob/main/chain/src/CapTableFactory.sol). + +## Deploy the contract + + +### Run the script to deploy the contract + +With Anvil running, run our script: + +```bash +yarn deploy-factory +``` + +### Check the contract address in Anvil + +In your terminal, you should get the contract address after the script runs. You can also check the contract address in Anvil. + +```bash +./scripts/deployFactory.sh ++ cd chain ++ forge script script/CapTableFactory.s.sol --broadcast --fork-url http://127.0.0.1:8545 +[⠊] Compiling...No files changed, compilation skipped +[⠒] Compiling... +Script ran successfully. + +== Logs == + Upgrading CapTableFactory with CapTable implementation + Deploying CapTableFactory and CapTable implementation + CapTable implementation deployed at: 0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82 + CapTableFactory deployed at: 0x9A676e781A523b5d0C0e43731313A708CB607508 +``` +### Manually add CapTableFactory to MongoDB + +For this, you'll need to use Mongo Compass that you installed earlier. You can find the connection string in the `.env` file. + +Under databases collection, search for `factories` and add the contract address to the collection using add data -> insert document. + +```json +{ + "implementation_address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", + "factory_address": "0x9A676e781A523b5d0C0e43731313A708CB607508" + } + ``` + +Keep in mind that your contract address will be different from the one in the example. + + \ No newline at end of file