Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(contract): update SpaceOwner token URI methods #586

Merged
merged 6 commits into from
Aug 1, 2024
Merged

Conversation

shuhuiluo
Copy link
Contributor

@shuhuiluo shuhuiluo commented Jul 30, 2024

Added new methods to manage default URI in SpaceOwner and SpaceOwnerUriBase. This includes setting and getting the default URI, updating the _render method to use the default URI, and adding relevant events and validation checks.

Simplify layout access in SpaceOwner with direct getter and setter methods. Add selectors for setDefaultUri and getDefaultUri in deployment script. Extend tests to cover new setDefaultUri functionality and improve tokenURI tests.

Streamline the logic for building URIs by prioritizing space URIs and falling back to the default URI. The test suite has been updated to reflect these changes, ensuring that URIs with and without trailing slashes are handled correctly.

Added Solady library to the project and updated remappings.txt and copyLibs.js accordingly. Replaced OpenZeppelin's Strings with Solady's LibString for string operations in SpaceOwnerUriBase.sol and corresponding test file. Updated package.json and yarn.lock to include Solady.

https://linear.app/hnt-labs/issue/HNT-10522/space-metadata-uri
https://linear.app/hnt-labs/issue/HNT-10623/spec-town-metadata-changes-to-support-public-town-image

Added new methods to manage default URI in `SpaceOwner` and `SpaceOwnerUriBase`. This includes setting and getting the default URI, updating the `_render` method to use the default URI, and adding relevant events and validation checks.
Simplify layout access in `SpaceOwner` with direct getter and setter methods. Add selectors for `setDefaultUri` and `getDefaultUri` in deployment script. Extend tests to cover new `setDefaultUri` functionality and improve `tokenURI` tests.
@shuhuiluo shuhuiluo marked this pull request as ready for review July 31, 2024 07:12
@shuhuiluo shuhuiluo requested a review from tak-hntlabs July 31, 2024 07:13
if (spaceAddress == address(0)) revert SpaceOwner__SpaceNotFound();

SpaceOwnerStorage.Space storage space = ds.spaceByAddress[spaceAddress];
string memory uri = bytes(space.uri).length == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe if the space sets the URI, we don't want to append the spaceAddress to it, we only want it when we're sending the default URI back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tak-hntlabs Could you confirm and update the Linear issue accordingly?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, Brian is right. If the caller sets it explicitly, we should respect that, and not add any thing else to the returned uri. I'll update the Linear.

Streamline the logic for building URIs by prioritizing space URIs and falling back to the default URI. The test suite has been updated to reflect these changes, ensuring that URIs with and without trailing slashes are handled correctly.
Added Solady library to the project and updated `remappings.txt` and `copyLibs.js` accordingly. Replaced OpenZeppelin's `Strings` with Solady's `LibString` for string operations in `SpaceOwnerUriBase.sol` and corresponding test file. Updated `package.json` and `yarn.lock` to include Solady.
@shuhuiluo shuhuiluo merged commit 1e84b59 into main Aug 1, 2024
8 checks passed
@shuhuiluo shuhuiluo deleted the shuhui/uri branch August 1, 2024 19:15
@giuseppecrj
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants