projectawakening / builder-examples

examples of the kind of stuff builders can create on top of the current MUD infrastructure
MIT License
25 stars 15 forks source link

[Local] Hardcoded Value in Local Deployment of Smart Storage Unit #63

Closed ProtoDroidBot closed 3 days ago

ProtoDroidBot commented 1 week ago

Instructions followed as of 2024-11-22: https://docs.evefrontier.com/QuickstartGuide https://docs.evefrontier.com/SmartStorageUnit/deploy-smart-storage-unit-contracts https://docs.evefrontier.com/SmartStorageUnit/configure-smart-storage-unit

Applies to local Docker Chain deployments only:

Problem: There is a hardcoded quantity of 7 items when using the Execute.s.sol script to test the configured ratios of the Smart Storage Unit.

Solution: Configure hardcoded value listed in Execute.s.sol (https://github.com/projectawakening/builder-examples/blob/develop/smart-storage-unit/packages/contracts/script/Execute.s.sol#L45) to use ratio values from .env file.

As a result, this will throw off people testing custom ratios for their local deployments. Below example has the following ratios configured:

IN_RATIO=5 OUT_RATIO=1

image

The location of the hardcoded quantity:

https://github.com/projectawakening/builder-examples/blob/develop/smart-storage-unit/packages/contracts/script/Execute.s.sol#L45

The definition for the world.call command where it lists the SmartStorageUnitSystem.execute, (smartStorageUnitId, 7, itemIn)) is below:

https://github.com/projectawakening/builder-examples/blob/develop/smart-storage-unit/packages/contracts/src/systems/SmartStorageUnitSystem.sol#L76

ProtoDroidBot commented 1 week ago

Apparently while reviewing the fixes Red Dragon that are currently in review, I found another potential fault with the ratios, (that coincidentally was fixed in the same pull-request):

Ratios can be set to -0 or any other negative number which would break the configure-ratio script.

https://github.com/projectawakening/builder-examples/pull/64/commits/829af59448e33ff84855e0f6f36d70b7e5f3f44a#diff-31b91b07ebe33e1d0d19f43747cd24abb0b7fedcc111540e1a7a1d17fab5c539L120

CCP-Red-Dragon commented 1 week ago

Both of these issues should hopefully be solved with https://github.com/projectawakening/builder-examples/pull/64 : )

Thank you very much for reporting the issue!! We really appreciate it.

CCP-Red-Dragon commented 3 days ago

Have closed this issue due to the new PR hopefully solving the issue - please re-open if your still having the faults though :)

Thank you!