Skip to content

Commit

Permalink
Add EIP-5773: Multi-Resource Token standard (#5773)
Browse files Browse the repository at this point in the history
* Propose Multi-Resource Token standard

RMRK team has developed a next step in NFTs where one NFT can be tied to
multiple resources.

* Address issues reported by EIP repository's CI

* Fix styling discrepancies in section titles

* Address CI's issues in the preabmle

* Add discussion URL

* Fix discussion URL formatting

* Add the EIP number

* Fix getResourceMeta specification

* Apply changes based on PR comments

* Replace "primitive" with a clearer explanation

Co-authored-by: Pandapip1 <[email protected]>

* Apply changes based on ECH call #5

Applied the changes based on feedback received on the EIP Editing Office
Hour Meeting #5.

This commit includes changes to the proposal as well as adds an exaple
implementation to assets/ directory.

* Address the stylistic issues reported by the CI

* Fix a reference to EIP-712

* Minor typo fixes

* Updates `getResourceMetadata` description

Co-authored-by: Sam Wilson <[email protected]>

* Rename MultiResource -> MultiAsset and relicense

The proposal was renamed to Context-Dependent Multi-Asset Tokens to
better illustrate its function.

Another example was added to represent the possible IoT usecase and the
explanation on the naming decision was added to the rationale.

The examples were relicensed to CC0, to conform to the requirements of
EIP repository.

* Fix license identifier & Specification contract title

* Fix indexes of Rationale questions

* Minor polishing of the rationale

* Update references to assets to use an istead of a in Rationale

* Final polishes

Co-authored-by: Pandapip1 <[email protected]>
Co-authored-by: Steven Pineda <[email protected]>
Co-authored-by: Sam Wilson <[email protected]>
  • Loading branch information
4 people committed Nov 25, 2022
1 parent 14c0678 commit a3bcb50
Show file tree
Hide file tree
Showing 12 changed files with 2,407 additions and 0 deletions.
510 changes: 510 additions & 0 deletions EIPS/eip-5773.md

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions assets/eip-5773/contracts/IMultiAsset.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.0;

interface IMultiAsset {
event AssetSet(uint64 assetId);

event AssetAddedToToken(
uint256 indexed tokenId,
uint64 indexed assetId,
uint64 indexed replacesId
);

event AssetAccepted(
uint256 indexed tokenId,
uint64 indexed assetId,
uint64 indexed replacesId
);

event AssetRejected(uint256 indexed tokenId, uint64 indexed assetId);

event AssetPrioritySet(uint256 indexed tokenId);

event ApprovalForAssets(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);

event ApprovalForAllForAssets(
address indexed owner,
address indexed operator,
bool approved
);

function acceptAsset(
uint256 tokenId,
uint256 index,
uint64 assetId
) external;

function rejectAsset(
uint256 tokenId,
uint256 index,
uint64 assetId
) external;

function rejectAllAssets(uint256 tokenId, uint256 maxRejections) external;

function setPriority(uint256 tokenId, uint16[] calldata priorities)
external;

function getActiveAssets(uint256 tokenId)
external
view
returns (uint64[] memory);

function getPendingAssets(uint256 tokenId)
external
view
returns (uint64[] memory);

function getActiveAssetPriorities(uint256 tokenId)
external
view
returns (uint16[] memory);

function getAssetReplacements(uint256 tokenId, uint64 newAssetId)
external
view
returns (uint64);

function getAssetMetadata(uint256 tokenId, uint64 assetId)
external
view
returns (string memory);

function approveForAssets(address to, uint256 tokenId) external;

function getApprovedForAssets(uint256 tokenId)
external
view
returns (address);

function setApprovalForAllForAssets(address operator, bool approved)
external;

function isApprovedForAllForAssets(address owner, address operator)
external
view
returns (bool);
}
Loading

0 comments on commit a3bcb50

Please sign in to comment.