Check this page here
- Install the following libraries
npm install --save-dev @openzeppelin/contracts npm install truffle npm install dotenv npm install @truffle/hdwallet-provider
- create a .env file in the root folder with these values
API_URL_dev = "YOURALCHEMYAPIURL" MNEMONIC_dev = "YOURWALLETMNEMONICS"
** DO NOT COMMIT THAT FILE**
- Compile
npx truffle compile
- Deploy
truffle deploy --network rinkeby --reset
- Interact with the smart contract
truffle console --network rinkeby
ipfs hash -> QmNQNLZW5d3EgJnNsHDjVLB9Yjai8sTaXSUn3LS1uV2baJ
- Smart contract with the following functions
- isOwner → returns address
- changeOwner(new address) : onlyOwner → returns true on success (so we can change the owner to a gnosis safe address - only they should be able to change the IPFS link)
- updateConstitution(ipfs_hash) : onlyOwner → returns true on success (only the owner can make changes)
- (if we want to store who accepted the constitution) acceptConstitution(self.address) : isNFTOwner → returns true on success
- OpenZeppelin (Ownable to handle ownership) - maybe because it is an easy case, we don't really need it
address constitutionIPFS; //holds the ipfs hash
Pinata (free tier) to pin the IPFS link