This hosts all contracts for CyberConnect's social graph protocol.
Some opinionated design decisions:
require
for semantic clarity.require
supports custom error.
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=
Actions
first with npx hardhat run --network goerli hardhat-scripts/deployActions.ts
Create2Deployer
to start the deployment. If you don't have a contract address, run yarn deploy_deployer:goerli
or change deployerContract address in Deploy.s.sol
to 0 to let the script deploy. Take down the deployer contract addressyarn deploy:goerli
or yarn deploy:anvil
for local deployment. If you run into any unconfirmed txs, run yarn deploy:rinkeby --resume
to continue. This also verifies contract on etherscan. Check profile proxy
address log to make sure it's the same as step 0. Otherwise, abort. (This manual step will be fixed)yarn post_deploy
to update ABI changesyarn upload_animation:goerli
to upload animation uri for link3 to ipfs.DeploySetting.sol
and make sure the deployer contract is correctly set as shown in docs/deploy/<network>/contract.md
. Run yarn 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.
CyberEngineImpl
forge verify-contract --chain-id 5 --num-of-optimizations 200 <address> src/core/CyberEngine.sol:CyberEngine $ETHERSCAN_KEY
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
Profile
GNU General Public License v3.0 or later
See COPYING to see the full text.