Skip to content

Commit

Permalink
Merge pull request #230 from rmrk-team/dev
Browse files Browse the repository at this point in the history
Merge after V2.1.0
  • Loading branch information
steven2308 authored Sep 22, 2023
2 parents de41370 + 58e4ac5 commit 2b2e893
Show file tree
Hide file tree
Showing 82 changed files with 3,081 additions and 2,860 deletions.
29 changes: 23 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
SEPOLIA_URL=
ETHEREUM_URL=
# Testing networks
MOONBASE_URL=https://moonbase-alpha.blastapi.io/<YOUR ALCHEMY KEY>
SEPOLIA_URL=https://eth-sepolia.g.alchemy.com/v2/<YOUR ALCHEMY KEY>
MUMBAI_URL=https://polygon-mumbai.g.alchemy.com/v2/<YOUR API KEY>
BASE_GOERLI_URL=https://base-goerli.g.alchemy.com/v2/<YOUR API KEY>

# Mainnet networks
MOONRIVER_URL=https://moonriver.blastapi.io/<YOUR ALCHEMY KEY>
MOONBEAM_URL=https://moonbeam.blastapi.io/<YOUR ALCHEMY KEY>
ETHEREUM_URL=https://eth-mainnet.g.alchemy.com/v2/<YOUR ALCHEMY KEY>
POLYGON_URL=https://polygon-mainnet.g.alchemy.com/v2/<YOUR API KEY>
BASE_URL=https://base-mainnet.g.alchemy.com/v2/<YOUR API KEY>

# To verify contracts
ETHERSCAN_API_KEY=ABC123
MOONSCAN_APIKEY=ABC123
POLYGONSCAN_API_KEY=ABC123
BASESCAN_API_KEY=ABC123

# To report gas
REPORT_GAS=
COIN_MARKET_CAP_KEY=

# To deploy contracts and interact with networks
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
MOONRIVER_MOONSCAN_APIKEY=ABC123
MOONBEAM_MOONSCAN_APIKEY=ABC123
POLYGONSCAN_API_KEY=ABC123
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.1] - 2023-09-21

### Changed

- Most asset and equipping related variables are changed from `private` to `internal` visibility, to allow for more flexibility on implementations.

## [2.1.0] - 2023-09-19

This release covers minor improvements and updates the numbers for Nestable and Emotable ERCs.

The original Nestable standard (ERC-6059) was missing parameter in the specification due to a method modified during the EIP process. The `interfaceId` of the specified interface was correct, so all the collections deployed using this package in the past were using the newly finalized ERC-7401 instead of ERC-6059.

The need to update the Emotes standard (ERC-6381) was noticed before it was released into production. The implementation was incompatible with the full set of Unicode emojis due to them having additional flags, and their codes extended well over the `bytes4` storage available. The updated standard (ERC-7409) uses `string` type values to store the emoji codes and is now compatible with all existing emojis as well as any of those that will be added in the future. Our emotes.app has used ERC-7409 since its release, so you don't need to worry that some reactions might be lost; they are all there.

To reiterate: you do not need to worry about upgrading or fixing previously deployed collections using these ERCs, since they are already built based on the latest specification ever since they have been released into the public domain.

### Changed

- `equip` and `unequip` methods are now gated to the owner or approved for assets, transfer permission no longer needs to be granted alongside equip/unequip permission.
- Renames ERC-6059 to ERC-7401.
- Renames emotes repository to ERC-7409.
- Adds Base test and mainnet networks
- Improves hardhat config and .env.example for network configuration.

### Fixed

- No longer restricts child catalog from being different than parent's catalog to consider the child equippable in RMRKEquipRenderUtils.
- Fixes soulbound detection on RenderUtils.getExtendedNFT.

## [2.0.0] - 2023-08-01

This Release has significant breaking changes in all ready-to-use implementations. The inheritance flow was highly simplified, by merging all extra utilities, which a marketplace would typically expect, into a single abstract contract: `RMRKImplementationBase`. This contract replaces `RMRKCollectionMetadata`, `RMRKMintingUtils` contracts and `name` and `symbol` of all core implementations.
Expand Down
2 changes: 1 addition & 1 deletion contracts/RMRK/core/RMRKCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ contract RMRKCore {
* @notice Version of the @rmrk-team/evm-contracts package
* @return Version identifier of the smart contract
*/
string public constant VERSION = "2.0.0";
string public constant VERSION = "2.1.1";
bytes4 public constant RMRK_INTERFACE = 0x524D524B; // "RMRK" in ASCII hex
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.21;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

interface IRMRKEmotesRepository is IERC165 {
interface IERC7409 is IERC165 {
/**
* @notice Used to notify listeners that the token with the specified ID has been emoted to or that the reaction has been revoked.
* @dev The event MUST only be emitted if the state of the emote is changed.
Expand Down
28 changes: 14 additions & 14 deletions contracts/RMRK/emotable/RMRKEmotesRepository.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.21;

import "./IRMRKEmotesRepository.sol";
import "./IERC7409.sol";

error BulkParametersOfUnequalLength();
error ExpiredPresignedEmote();
Expand All @@ -13,11 +13,11 @@ error InvalidSignature();
* @author RMRK team
* @notice Smart contract of the RMRK Emotes repository.
*/
contract RMRKEmotesRepository is IRMRKEmotesRepository {
contract RMRKEmotesRepository is IERC7409 {
bytes32 public immutable DOMAIN_SEPARATOR =
keccak256(
abi.encode(
"ERC-6381: Public Non-Fungible Token Emote Repository",
"ERC-7409: Public Non-Fungible Token Emote Repository",
"1",
block.chainid,
address(this)
Expand All @@ -31,7 +31,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
private _emotesPerToken;

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function emoteCountOf(
address collection,
Expand All @@ -42,7 +42,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function bulkEmoteCountOf(
address[] memory collections,
Expand All @@ -67,7 +67,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function hasEmoterUsedEmote(
address emoter,
Expand All @@ -79,7 +79,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function haveEmotersUsedEmotes(
address[] memory emoters,
Expand Down Expand Up @@ -110,7 +110,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function emote(
address collection,
Expand All @@ -135,7 +135,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function bulkEmote(
address[] memory collections,
Expand Down Expand Up @@ -186,7 +186,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function prepareMessageToPresignEmote(
address collection,
Expand All @@ -209,7 +209,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function bulkPrepareMessagesToPresignEmote(
address[] memory collections,
Expand Down Expand Up @@ -248,7 +248,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function presignedEmote(
address emoter,
Expand Down Expand Up @@ -301,7 +301,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
}

/**
* @inheritdoc IRMRKEmotesRepository
* @inheritdoc IERC7409
*/
function bulkPresignedEmote(
address[] memory emoters,
Expand Down Expand Up @@ -393,7 +393,7 @@ contract RMRKEmotesRepository is IRMRKEmotesRepository {
bytes4 interfaceId
) public view virtual returns (bool) {
return
interfaceId == type(IRMRKEmotesRepository).interfaceId ||
interfaceId == type(IERC7409).interfaceId ||
interfaceId == type(IERC165).interfaceId;
}
}
18 changes: 9 additions & 9 deletions contracts/RMRK/equippable/RMRKEquippable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ contract RMRKEquippable is

// ------------------- EQUIPPABLE --------------
/// Mapping of uint64 asset ID to corresponding catalog address.
mapping(uint64 => address) private _catalogAddresses;
mapping(uint64 => address) internal _catalogAddresses;
/// Mapping of uint64 ID to asset object.
mapping(uint64 => uint64) private _equippableGroupIds;
mapping(uint64 => uint64) internal _equippableGroupIds;
/// Mapping of assetId to catalog parts applicable to this asset, both fixed and slot
mapping(uint64 => uint64[]) private _partIds;
mapping(uint64 => uint64[]) internal _partIds;

/// Mapping of token ID to catalog address to slot part ID to equipment information. Used to compose an NFT.
mapping(uint256 => mapping(address => mapping(uint64 => Equipment)))
private _equipments;
internal _equipments;

/// Mapping of token ID to child (nestable) address to child ID to count of equipped items. Used to check if equipped.
mapping(uint256 => mapping(address => mapping(uint256 => uint256)))
private _equipCountPerChild;
internal _equipCountPerChild;

/// Mapping of `equippableGroupId` to parent contract address and valid `slotId`.
mapping(uint64 => mapping(address => uint64)) private _validParentSlots;
mapping(uint64 => mapping(address => uint64)) internal _validParentSlots;

/**
* @notice Used to verify that the caller is either the owner of the given token or approved to manage the token's assets
Expand Down Expand Up @@ -311,7 +311,7 @@ contract RMRKEquippable is
*/
function equip(
IntakeEquip memory data
) public virtual onlyApprovedOrOwner(data.tokenId) nonReentrant {
) public virtual onlyApprovedForAssetsOrOwner(data.tokenId) nonReentrant {
_equip(data);
}

Expand Down Expand Up @@ -342,7 +342,7 @@ contract RMRKEquippable is
// Check from parent's asset perspective:
_checkAssetAcceptsSlot(data.assetId, slotPartId);

IERC6059.Child memory child = childOf(data.tokenId, data.childIndex);
IERC7401.Child memory child = childOf(data.tokenId, data.childIndex);

// Check from child perspective intention to be used in part
// We add reentrancy guard because of this call, it happens before updating state
Expand Down Expand Up @@ -409,7 +409,7 @@ contract RMRKEquippable is
uint256 tokenId,
uint64 assetId,
uint64 slotPartId
) public virtual onlyApprovedOrOwner(tokenId) {
) public virtual onlyApprovedForAssetsOrOwner(tokenId) {
_unequip(tokenId, assetId, slotPartId);
}

Expand Down
Loading

0 comments on commit 2b2e893

Please sign in to comment.