-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
209e667
commit 5bf0cf6
Showing
2 changed files
with
54 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"install": "Install" | ||
"install": "Install", | ||
"setup": "Setup", | ||
"factory-deployment": "Factory Deployment" | ||
} |
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,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 | ||
<Steps> | ||
|
||
### 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. | ||
|
||
</Steps> |