String Smart Contracts
If running MacOS with Brew, clone this repository and run:
scripts/install.shTest smart contracts using Forge and Slither
scripts/test.shbuild project
forge buildtest project
forge testrun slither (after slither is installed)
slither src/StringContract.sol --print human-summarydeploy a contract
forge create <deployedName> --rpc-url=<RPC_URL> --private-key=<PRIVATE_KEY> --constructor-args <args...> --verify
i.e.:
forge create StringNFT --rpc-url=$RPC_URL --private-key=$PRIVATE_KEY --constructor-args StringTestNFT STR721t https://stringtesturi.xyz/nft/ --verifyverify a contract deployed to fuji (instead of using a script for whatever reason)
forge verify-contract --chain-id <chainID> --num-of-optimizations <optimizations> -- constructor-args $(cast abi encode "constructor(<types...>)" <args...>) --compiler-version v0.<Major>.<minor>+commit.<8HexDigitsOfCommit> <contract addr> <contract file>:<contract name> <snowtrace api key>
i.e.:
forge verify-contract --chain-id 43113 --num-of-optimizations 1000 --constructor-args $(cast abi-encode "constructor(string,string,string)" "StringTestNFT" "STR721t" "https://stringtesturi.xyz/nft/") --compiler-version v0.8.13+commit.abaa5c0e 0x861af9ed4fee884e5c49e9ce444359fe3631418b src/StringNFT.sol:StringNFT $SNOWTRACE_API_KEYCreate temporary environment variables for passing into console commands
export ETHERSCAN_API_KEY=HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAUpdate all libraries
forge updateRun a custom solidity script (i.e. Withdraw.sol)
forge script Withdraw --rpc-url $FUJI_RPC_URL --private-key $PRIVATE_KEY --broadcast -vvvIf you would prefer to set up project dependencies manually, they should be done in this order:
run foundryUp
use pip3 to install solc-select
use solc-select to install solc 0.8.13
use solc-select to use solc 0.8.13
use pip3 to install slither-analyzer
Slither may think you are running a different version of solc than what solc-select has selected. If this is the case, use solc-select to uninstall and reinstall 0.8.13.