Package Exports
- erc-payable-token/test/introspection/SupportsInterface.behavior
- erc-payable-token/test/token/ERC1363/ERC1363BasicToken.behaviour
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (erc-payable-token) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ERC-1363 Payable Token
This is an implementation of the ERC-1363 Payable Token that defines a Payable Token and Receiver.
The ERC-1363 is an ERC-20 compatible token that can make a callback on the receiver contract to notify token transfers. It can be used to create a token payable crowdsale, selling services for tokens, paying invoices, making subscriptions, use them for a specific utility and many other purposes.
This proposal allows to implement an ERC-20 token that can be used for payments (like the payable keyword does for Ethereum).
Code
This repo contains:
Interface for a Payable Token contract as defined in ERC-1363 Payable Token.
Implementation of an ERC1363 interface.
Interface for any contract that wants to support transferAndCall or transferFromAndCall from ERC1363 token contracts.
Interface for any contract that wants to support approveAndCall from ERC1363 token contracts.
Implementation proposal of a contract that wants to accept ERC1363 payments. It intercepts what is the ERC1363 token desired for payments and throws is another is sent.
It emits a TokensReceived event to notify the transfer received by the contract.
It also implements a transferReceived function that can be overridden to make your stuffs within your contract after a onTransferReceived.
It emits a TokensApproved event to notify the approval received by the contract.
It also implements a approvalReceived function that can be overridden to make your stuffs within your contract after a onApprovalReceived.
As example: an Implementation of a classic token Crowdsale, but paid with ERC1363 tokens instead of ETH.
Install
npm install erc-payable-tokenUsage
pragma solidity ^0.4.24;
import "erc-payable-token/contracts/token/ERC1363/ERC1363BasicToken.sol";
contract MyToken is ERC1363BasicToken {
// your stuffs
}Development
Install Truffle
npm install -g truffle // Version 4.1.14+ required.Install dependencies
npm installLinter
Use Solium
npm run lint:solUse ESLint
npm run lint:jsUse both and fix
npm run lint:fixCompile and test the contracts
Open the Truffle console
truffle developCompile
compile Test
testLicense
Code released under the MIT License.