-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move some metadata logic over to MetadataRenderer
- Loading branch information
Showing
2 changed files
with
15 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.27; | ||
|
||
import { EfficiencyLib } from "./EfficiencyLib.sol"; | ||
import { MetadataLib } from "./MetadataLib.sol"; | ||
import { Lock } from "../types/Lock.sol"; | ||
|
||
contract MetadataRenderer { | ||
using EfficiencyLib for uint256; | ||
using MetadataLib for Lock; | ||
using MetadataLib for address; | ||
|
||
function uri(Lock memory lock, uint256 id) external view returns (string memory) { | ||
return lock.toURI(id); | ||
} | ||
|
||
/// @dev Returns the symbol for token `id`. | ||
function name(uint256 id) public view returns (string memory) { | ||
return string.concat("Compact ", id.asSanitizedAddress().readNameWithDefaultValue()); | ||
} | ||
|
||
/// @dev Returns the symbol for token `id`. | ||
function symbol(uint256 id) public view returns (string memory) { | ||
return string.concat(unicode"🤝-", id.asSanitizedAddress().readSymbolWithDefaultValue()); | ||
} | ||
} |