Read this in other languages: English, 日本語.
It is under development.
The source code for this repository is currently in development.
This is an implementation of ÐApps' in which the user of “Internal distribution token” sends an ERC20 / 223 token, which is triggered by an Exchange event at the time of exchange from an internal distribution token to an ERC 20/223 token, to the owner.
- Internal distribution token- godappslab / internal-distribution-token: Implementation of Internal Distribution Token
The part that receives the event and the part that executes "TokenTransfer" Ð Apps based on the information in the event are executed by the web module using Web3.js.
Provides a mechanism to completely and securely exchange internal distribution tokens into ERC 20/223 tokens
- We can make sure payment
- It can be confirmed that the payment has been made without falsifying the record
- The action can be triggered by an event generated by the internal distribution token, enabling unmanned operation
TransferHistory interface
TransferHistory manages an address of a smart contract TokenTransfer ÐApps to perform recording. The history record from other than the decided address is not accepted.
The registration of the address can be set by the owner executing the updateTransferDappsAddress()
function.
pragma solidity ^0.5.0;
interface TransferHistoryInterface {
function isTokenTransferred(bytes calldata _signature) external view returns (bool);
function recordAsTokenTransferred(bytes calldata _signature) external returns (bool);
function updateTransferDappsAddress(address _newTransferDapps) external returns (bool);
}
Processing ERC 20/223 Token Payments
Sequence Diagram
flowchart
Check the operation with a test script using Truffle Suite .
$ truffle test
Using network 'test'.
Compiling ./contracts/token-transfer/TokenTransfer.sol...
Compiling ./test/DummyERCToken.sol...
Compiling ./test/DummyInternalCirculationToken.sol...
ownerAddress: 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
Contract: [TEST] TokenTransfer
[LOG] erc_token: 0x8f0483125FCb9aaAEFA9209D8E9d7b9C8B9Fb90F
[LOG] point_token: 0x9FBDa871d559710256a2502A2517b794B482Db40
[LOG] transfer_history: 0x2C2B9C9a4a25e24B174f26114e8926a9f2128FE4
[LOG] tokenTransfer: 0x30753E4A8aad7F8597332E813735Def5dD395028
✓ Deploying Smart Contract (288ms)
[LOG] Returned error: VM Exception while processing transaction: revert Mismatch with address obtained from signature -- Reason given: Mismatch with address obtained from signature.
✓ [Different nonces] Mismatch with address obtained from signature (177ms)
[LOG] Returned error: VM Exception while processing transaction: revert Mismatch with address obtained from signature -- Reason given: Mismatch with address obtained from signature.
✓ [Different token quantity] Mismatch with address obtained from signature (136ms)
[LOG] Returned error: VM Exception while processing transaction: revert Mismatch with address obtained from signature -- Reason given: Mismatch with address obtained from signature.
✓ [Different address] Mismatch with address obtained from signature (120ms)
[LOG] Returned error: VM Exception while processing transaction: revert transfer failed -- Reason given: transfer failed.
✓ ERC token transfer failure (151ms)
✓ [The first time] Success (129ms)
[LOG] Returned error: VM Exception while processing transaction: revert Already token remitted -- Reason given: Already token remitted.
✓ [Second time fail] Already token remitted (129ms)
7 passing (1s)
The implementation of ÐApps will be released on GitHub.