diff --git a/EIPS/eip-1178.md b/EIPS/eip-1178.md index b609cc12..017feeba 100644 --- a/EIPS/eip-1178.md +++ b/EIPS/eip-1178.md @@ -110,6 +110,22 @@ This method MUST transfer ownership to `_to` or `throw`, no other outcomes can b A conforming contract MUST allow the current owner to "transfer" a token to themselves, as a way of affirming ownership in the event stream. (i.e. it is valid for `_to == msg.sender` if `balanceOf(msg.sender, _classId) >= balance`.) This "no-op transfer" MUST be considered a successful transfer, and therefore MUST fire a `Transfer` event (with the same address for `_from` and `_to`). +## Advanced Ownership and Exchange +```solidity +function approveForToken(uint256 classIdHeld, uint256 quantityHeld, uint256 classIdWanted, uint256 quantityWanted) +``` +Allows holder of one token to allow another individual (or the smart contract itself) to approve the exchange of their tokens of one class for tokens of another class at their specified exchange rate (see sample implementation for more details). This is equivalent to posting a bid in a marketplace. + +```solidity +function exchange(address to, uint256 classIdPosted, uint256 quantityPosted, uint256 classIdWanted, uint256 quantityWanted) +``` +Allows an individual to fill an existing bid (see above function) and complete the exchange of their tokens of one class for another. In the sample implementation, this function call should fail unless the callee has already approved the contract to transfer their tokens. Of course, it is possible to create an implementation where calling this function implicitly assumes approval and the transfer is completed in one step. + +```solidity +transferFrom(address from, address to, uint256 classId) +``` +Allows a third party to initiate a transfer of tokens from `from` to `to` assuming the approvals have been granted. + ## Events **Transfer** @@ -141,7 +157,7 @@ Adoption of the MCFT standard proposal would not pose backwards compatibility is ## Implementation -Coming soon. +A sample implementation can be found [here](https://github.com/achon22/ERC-1178/blob/master/erc1178-sample.sol) ## Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).