Day 7 of Building an Equipment System with Smart Contracts (Solidity)
buildinginpublic·@therealwolf·
0.000 HBDDay 7 of Building an Equipment System with Smart Contracts (Solidity)
Day 7 of "Building an Equipment System with Smart Contracts" for @ethgardlegends. Imagine you find a cool sword and want to equip it to your hero to gain benefits in the game. That's what I'm building. In technical terms, the goal is to allow NFTs (ERC1155/ERC721) to be equippable on other NFTs (ERC721 => Heroes). --- ### Today's progress: Started the day by continuing work on the UI for the equipment system. While refining the flow, I realised that equipping and unequipping items aren't really two separate actions - they're optimally one single operation. So I refactored some of the smart contract by removing equipItems/unequipItems in favor of a single changeEquipment function, which takes both the items to equip and the slots to unequip. Once that was in, I hooked everything up, made some code-magic, and was finally able to equip items onchain for the first time. In the video below, I'm equipping a Rare ERC1155 Skin and an ERC721 Sword/Shield onto an ERC721 Hero. Items can be equipped/unequipped by dragging as well as right-clicking on them. https://x.com/thewolfonchain/status/1906460745379827885 Finally, I also added some simple tooltips when hovering over the items. With that, the full core flow is now working. Next up are further improvements, polishing, and getting things production-ready. Check out the demo video: --- ### Today's lesson: Slow and steady wins the race. When I first started working on this, the whole thing felt like a huge mountain. I remember thinking, “how the heck am I gonna get all this done?” Now, just a week later, I’m on that mountain, and while I see another one up ahead, I can also look back and appreciate the climb (work) so far. Just keep on coding. --- _PS: If you're having trouble understanding certain parts but want to learn more, try the AI feature on Peakd or ChatGPT/Grok to have it explained 👍._
👍 steemitcentral, alainite, cryptosharon, franciscopr, carbodexkim, svinsent, quochuy, smartvote, bilpcoinbot, successforall, duremarr, adedayoolumide, joeyarnoldvn, yacobh, photobook, mind.force, liaminit1, macmaniac77, gandhibaba, hive-127039, cst90, wolffeys, rivalzzz, snaqz, hooiyewlim, lays, dec.entralized, diggndeeper.com, mistia, driptorchpress, fandelkefir, loulou1987, daan, goingbonkers, smasssh, steddyman, jaybird, samrisso, pet.society, realgoodcontent, voxmortis, broxi, recoveryinc, z3ll, freddbrito, gmlrecordz, movement19, kgakakillerg, liz.writes, flamo, mindscapephotos, kgsupport, heyitshaas, steem-tube, orthodoxnudism, mrhoofman, kggymlife, olgadmitriewna, steemitcolombia, steemcleaners, tomiscurious, dying, eturnerx, votehero, voter002, solarwarrior, we-are, offoodandart, caribehub, voter003, steemituplife, samueluche07, gringo211985, farpetrad, espoem, rival, fatman, socialmediaseo, kibela, sharker, thepeakstudio, nikollettesunday, yestermorrow, hyborian-strain, pangoli, petertag, patlu, prometehum, arquiatra, soyrosa, nateaguila, craigahamilton, sunshinebear, pladozero, uruiamme, mytechtrail, happyphoenix, masterthematrix, cimmeron, uadigger, issymarie2, chrisparis, ynwa.andree, felixxx, jeffjagoe, morph, etblink, megstarbies, heteroclite, tebesc, visionarystudios, bellscoin, asgarth, lrekt01, spiritabsolute, davidlionfish, rynow, urun, fw206, woelfchen, aleister, themonetaryfew, oneshot, trostparadox, xyba, relf87,