Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
neokry committed Sep 14, 2023
1 parent 81643b8 commit 91f73a4
Show file tree
Hide file tree
Showing 22 changed files with 308 additions and 200 deletions.
44 changes: 0 additions & 44 deletions script/DeployEscrow.s.sol

This file was deleted.

2 changes: 1 addition & 1 deletion src/VersionedContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ pragma solidity 0.8.16;

abstract contract VersionedContract {
function contractVersion() external pure returns (string memory) {
return "1.2.0";
return "2.0.0";
}
}
39 changes: 0 additions & 39 deletions src/escrow/Escrow.sol

This file was deleted.

11 changes: 11 additions & 0 deletions src/lib/token/ERC721Votes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ abstract contract ERC721Votes is IERC721Votes, EIP712, ERC721 {
}
}

/// @notice Gets the typed data hash for a delegation signature
/// @param _fromAddresses The accounts delegating votes from
/// @param _toAddress The account delegating votes to
/// @param _deadline The signature deadline
function getBatchDelegateBySigTypedDataHash(
address[] calldata _fromAddresses,
address _toAddress,
Expand Down Expand Up @@ -217,6 +221,11 @@ abstract contract ERC721Votes is IERC721Votes, EIP712, ERC721 {
_delegate(_from, _to);
}

/// @notice Batch delegates votes from multiple ERC1271 accounts to one account
/// @param _fromAddresses The addresses delegating votes from
/// @param _toAddress The address delegating votes to
/// @param _deadline The signature deadline
/// @param _signature The signature
function batchDelegateBySigERC1271(
address[] calldata _fromAddresses,
address _toAddress,
Expand Down Expand Up @@ -258,6 +267,7 @@ abstract contract ERC721Votes is IERC721Votes, EIP712, ERC721 {
)
);

// Set delegation for all from addresses
for (uint256 i = 0; i < length; ++i) {
address cachedFromAddress = _fromAddresses[i];

Expand All @@ -271,6 +281,7 @@ abstract contract ERC721Votes is IERC721Votes, EIP712, ERC721 {
// Update the delegate
_delegate(cachedFromAddress, _toAddress);
} else {
// Revert invalid signature
revert INVALID_SIGNATURE();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/manager/IManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ interface IManager is IUUPS, IOwnable {
/// @dev Reverts if an implementation type is not valid on registration
error INVALID_IMPLEMENTATION_TYPE();

/// @dev Reverts if caller is not the token owner
error ONLY_TOKEN_OWNER();

/// ///
Expand Down
4 changes: 4 additions & 0 deletions src/manager/Manager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ contract Manager is IManager, VersionedContract, UUPS, Ownable, ManagerStorageV1
}

/// @notice Safely get the contract version of a target contract.
/// @param target The ERC-721 token address
/// @dev Assume `target` is a contract
/// @return Contract version if found, empty string if not.
function _safeGetVersion(address target) internal pure returns (string memory) {
Expand All @@ -253,6 +254,9 @@ contract Manager is IManager, VersionedContract, UUPS, Ownable, ManagerStorageV1
}
}

/// @notice Safely get the contract version of all DAO contracts given a token address.
/// @param token The ERC-721 token address
/// @return Contract versions if found, empty string if not.
function getDAOVersions(address token) external view returns (DAOVersionInfo memory) {
(address metadata, address auction, address treasury, address governor) = getAddresses(token);
return
Expand Down
8 changes: 6 additions & 2 deletions src/metadata/media/MediaMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ contract MediaMetadata is IMediaMetadata, VersionedContract, Initializable, UUPS
/// PROPERTIES & ITEMS ///
/// ///

/// @notice The number of items in a property
/// @return items array length
/// @notice The number of total media items
function mediaItemsCount() external view returns (uint256) {
return mediaItems.length;
}
Expand Down Expand Up @@ -119,6 +118,7 @@ contract MediaMetadata is IMediaMetadata, VersionedContract, Initializable, UUPS
// Cache the number of new properties
uint256 numNewMediaItems = _items.length;

// Minimum of 1 media item required
if (numNewMediaItems == 0) {
revert ONE_MEDIA_ITEM_REQUIRED();
}
Expand Down Expand Up @@ -175,10 +175,12 @@ contract MediaMetadata is IMediaMetadata, VersionedContract, Initializable, UUPS
/// @notice The token URI
/// @param _tokenId The ERC-721 token id
function tokenURI(uint256 _tokenId) external view returns (string memory) {
// Pull the media item refrence by tokenId
MediaItem storage mediaItem = mediaItems[_tokenId];

MetadataBuilder.JSONItem[] memory items = new MetadataBuilder.JSONItem[](4);

// Set JSON properties
items[0] = MetadataBuilder.JSONItem({
key: MetadataJSONKeys.keyName,
value: string.concat(_name(), " #", Strings.toString(_tokenId)),
Expand Down Expand Up @@ -240,6 +242,8 @@ contract MediaMetadata is IMediaMetadata, VersionedContract, Initializable, UUPS
settings.description = _newDescription;
}

/// @notice Updates the project URI
/// @param _newProjectURI The new URI
function updateProjectURI(string memory _newProjectURI) external onlyOwner {
emit WebsiteURIUpdated(settings.projectURI, _newProjectURI);

Expand Down
5 changes: 4 additions & 1 deletion src/metadata/media/interfaces/IMediaMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.16;
import { MediaMetadataTypesV1 } from "../types/MediaMetadataTypesV1.sol";
import { IBaseMetadata } from "../../interfaces/IBaseMetadata.sol";

/// @title IMediaMetadataRenderer
/// @title IMediaMetadata
/// @author Neokry
/// @notice The external Metadata Renderer events, errors, and functions
interface IMediaMetadata is IBaseMetadata, MediaMetadataTypesV1 {
Expand Down Expand Up @@ -39,8 +39,11 @@ interface IMediaMetadata is IBaseMetadata, MediaMetadataTypesV1 {
/// ///

struct MediaMetadataParams {
/// @notice The collection description
string description;
/// @notice The contract image
string contractImage;
/// @notice The project URI
string projectURI;
}

Expand Down
2 changes: 1 addition & 1 deletion src/metadata/media/storage/MediaMetadataStorageV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.16;

import { MediaMetadataTypesV1 } from "../types/MediaMetadataTypesV1.sol";

/// @title MediaMetadataTypesV1
/// @title MediaMetadataStorageV1
/// @author Neokry
/// @notice The Metadata Renderer storage contract
contract MediaMetadataStorageV1 is MediaMetadataTypesV1 {
Expand Down
6 changes: 6 additions & 0 deletions src/metadata/media/types/MediaMetadataTypesV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ pragma solidity 0.8.16;
/// @notice The Metadata Renderer custom data types
interface MediaMetadataTypesV1 {
struct MediaItem {
/// @notice The image content URI
string imageURI;
/// @notice The animation content URI
string animationURI;
}

struct Settings {
/// @notice The token address
address token;
/// @notice The project URI
string projectURI;
/// @notice The project description
string description;
/// @notice The token contract image
string contractImage;
}

Expand Down
4 changes: 4 additions & 0 deletions src/metadata/property/interfaces/IPropertyMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ interface IPropertyMetadata is IBaseMetadata, PropertyMetadataTypesV1, PropertyM
/// ///

struct PropertyMetadataParams {
/// @notice The collection description
string description;
/// @notice The contract image
string contractImage;
/// @notice The project URI
string projectURI;
/// @notice The renderer base
string rendererBase;
}

Expand Down
Loading

0 comments on commit 91f73a4

Please sign in to comment.