Closed evgongora closed 1 week ago
The changes in the world_setup.cairo
file involve the removal of the IWorldSetup
trait and its setWorld
method, which accepted an IWorldDispatcher
reference. A new function, dojo_init
, is introduced to replace this functionality, directly initializing game entities such as Beast
, Player
, Potion
, and Mt
. This refactor simplifies the module by eliminating the trait and consolidating the initialization logic.
File | Change Summary |
---|---|
src/systems/world_setup.cairo | Removed IWorldSetup trait and setWorld method; added dojo_init function for world initialization. |
Objective | Addressed | Explanation |
---|---|---|
Create init so we create the world entities when the contracts are deployed (#13) | ✅ |
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@evgongora Hello Erick could you post the following testing
sozo build
sozo migrate appply
sozo test
Thanks!great job so far
@evgongora could you describe in a comment how did you fix the deploy thing? remember? It was like a versions problem with the rpc, thanks
Hello @RolandoDrRobot! Per my conversation with Glihm I was able to get the next information:
[!IMPORTANT] The init function wil keep being the same as
dojo_init
since we need permissions to be set first, hence the contract must be registered first. This so when you register a contract in dojo using thesozo migrate,
constructor is always empty. Then you use thedojo_init
, that can be called once.[!NOTE]
The error that is showing when using the newdojo_init
is because of sozo old versions.
This one is not gonna have any coed merged, I'll close It, thanks @evgongora for the findings and effort!
Pull Request Overview
📝 Summary
Changes to
setWorld
method todojo_init
function following example: https://github.com/dojoengine/dojo/blob/d039c6d46f819edc3f2161c0520b8c8fecec0092/examples/spawn-and-move/src/others.cairo#L18🔄 Changes Made
dojo_init
function inside the world contract module, this function directly initializes the world elementsIWorldSetup
and its implementationWorldSetupImpl
setWorld
function, which was part of the interface, has been removed.🔧 Tests Results
🔜 Next Steps
Summary by CodeRabbit
dojo_init
, for setting up game entities like Beast, Player, Potion, and Mt.IWorldSetup
trait, enhancing direct access to initialization logic and reducing complexity.