- Contract is 37kB... Need to split into diamond pattern.
- Make it cleaner.
- Exhaustive game mechanisms cleaned up, URI placeholders
- Tests (unit, fuzz, FV)
- Front-end
anvil --block-time 5
if you want to simulate mined blocks every 5 seconds, or justanvil
.forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast
. REMINDER - IF YOU ADD/REMOVE CONTRACTS THE ADDRESSES WILL CHANGE
- Local Interactions // Variables
export OWNER="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"; export FUNDING="0x5FbDB2315678afecb367f032d93F642f64180aa3"; export GAME="0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"; export CHAR_PRICE=5000000000000000000
// Tips
cast block
// gets current block, Also look back at the Anvil terminal.cast call $GAME "uri(uint256)" 5
// returns URI for token ID 5.
// Character Creation
cast send $GAME --unlocked --from $OWNER "mintCharacter(uint8,bool)" 1 false --value $CHAR_PRICE
// mints charactercast call $GAME "getCharacterInfo(address)" $OWNER
// All their info (NEED PUBLIC GETTER)cast call $GAME "ownsCharacter(address)" $OWNER
// 0x01 = true (NEED PUBLIC GETTER)cast balance $FUNDING
// funding contract received 5 MATIC payment.cast call $GAME "balanceOf(address,uint256)" $OWNER 1
// User owns 1 character.cast call $GAME "balanceOf(address,uint256)" $OWNER 5
// User owns 3 gold.
// Travel to shop, buy axe, equip it, chop some trees
cast send $GAME --unlocked --from $OWNER "walk(uint8)" 4
// walk from lumby (spawned there) to general store (4) (DBLE CHECK TIME & ORIG LOCATION)cast send $GAME --unlocked --from $OWNER "buyItem(uint8,uint8,uint256)" 4 9 1
// from store (4), buy iron hatchet (9) quantity (1) for 2gpcast call $GAME "balanceOf(address,uint256)" $OWNER 9
// owns iron hatchetcast call $GAME "balanceOf(address,uint256)" $OWNER 5
// owns less goldcast send $GAME --unlocked --from $OWNER "equipItem(uint8)" 9
// equip iron hatchetcast send $GAME --unlocked --from $OWNER "walk(uint8)" 33
// walk from general store to forest (33)cast send $GAME --unlocked --from $OWNER "chopTree(uint8)" 0
// chop a normal tree (0)cast call $GAME "balanceOf(address,uint256)" $OWNER 11
// gets 1 log (11)
forge script script/Deploy.s.sol --rpc-url $MUMBAI_RPC_URL --private-key $PRIVATE_KEY_A
Mumbai Interactions: