This hosts all contracts for CyberConnect's social graph protocol.
Some opinionated design decisions:
- Prefer
require
for semantic clarity. - No custom error until
require
supports custom error. - Try to be gas efficient :)
-
Upgrade your foundry
foundryup
-
To enable husky pre-commit
yarn && yarn prepare
-
To install contract dependencies
forge install
-
To build
forge build
-
To test
forge test -vvv
-
(optional) To run static analysis
slither src/
-
To see contract sizes
yarn size
(Replace rinkeby
with anvil
or other supported network) 0. Create .env.rinkeby
file with following env
# .env.pinata
PINATA_JWT=
# .env.rinkeby
RINKEBY_RPC_URL=
PRIVATE_KEY=
ETHERSCAN_KEY=
for local deployment in .env.anvil
# .env.anvil
PRIVATE_KEY=
PINATA_JWT=
- Deploy
Actions
first withnpx hardhat run --network goerli hardhat-scripts/deployActions.ts
- You need a
Create2Deployer
to start the deployment. If you don't have a contract address, runyarn deploy_deployer:goerli
or change deployerContract address inDeploy.s.sol
to 0 to let the script deploy. Take down the deployer contract address - Run
yarn deploy:goerli
oryarn deploy:anvil
for local deployment. If you run into any unconfirmed txs, runyarn deploy:rinkeby --resume
to continue. This also verifies contract on etherscan. Checkprofile proxy
address log to make sure it's the same as step 0. Otherwise, abort. (This manual step will be fixed) - Run
yarn post_deploy
to update ABI changes - Run
yarn upload_animation:goerli
to upload animation uri for link3 to ipfs. - Check
DeploySetting.sol
and make sure the deployer contract is correctly set as shown indocs/deploy/<network>/contract.md
. Runyarn set_animation_url:goerli
to deploy link3 nft descriptor with animation url. Then set to profile.
Because we use create2
for deployments, so we need to manually submit verification.
- Verify
CyberEngineImpl
forge verify-contract --chain-id 5 --num-of-optimizations 200 <address> src/core/CyberEngine.sol:CyberEngine $ETHERSCAN_KEY
- Verify
CyberEngineProxy
a. find the init_data
bytes memory data = abi.encodeWithSelector(
CyberEngine.initialize.selector,
address(0),
authority
);
console.logBytes(data);
b. verify
forge verify-contract --chain-id 5 --num-of-optimizations 200 <address> lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy --constructor-args $(cast abi-encode "constructor(address,bytes)" <impl_address> <init_data>) $ETHERSCAN_KEY
- Verify
Profile
GNU General Public License v3.0 or later
See COPYING to see the full text.