https://github.com/lackhole/nmt-project
https://github.com/lackhole/nmt-project
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lackhole/nmt-project
- Owner: lackhole
- Created: 2019-10-19T09:25:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T08:14:47.000Z (over 2 years ago)
- Last Synced: 2025-02-16T11:15:06.945Z (4 months ago)
- Language: JavaScript
- Size: 13 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NMT-Solidity v.0.8a
Server fee : 10.00 %\
Distribution ratio ( seller : verifier) = 3 : 7If you want information about functions of NMT and NMTT, please read the API document at link below.
https://docs.google.com/spreadsheets/d/1XWeqrEmtZKDN_0nu5KsmwYrZlxNPH1NSabP1kux0P-8/edit?usp=sharingLocal testing code updated at NMT-Solidity/serverLocalTest
*****Requires:
- Minter
- Server (includes listener)
- Buyer
- Seller
- Verifier
*****
Run sequences:# Web3 version 1.0x
, gas:, gasPrice:} all are optional
>
>>- Calling a method
>>
>> token.method.constMethodName(params).call({},(err,res)=>{res[index]}); //res is return value(s)
>> token.method.MethodName(params).send({},callback) // res is tx hash
>> // bracket is optional, but necessary if there is callback after it(even if it's empty bracket).
>> // {from:
>> For more information, check https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods
>
>1. Minter
>
> NMT.methods.addWhitelisted().send();
> NMT.methods.setServer().send();
> NMT.methods.transfer(, ).send(); // So that buyer can make a trade
>
> // Troubleshooting of current web3 version: digit number bigger than 1e16 cause error. Use hex instead
> // https://github.com/ethereum/web3.js/issues/2077
>
>2. Listener
>
> NMT.events.tradeMade({},(err, event)=>{
> // Save and pass to server
> });
>
>
>3. Buyer
>
> NMT.methods.newTrade(,,).send(); // with enough gas
>
>4. Server
>
> // Accuracy: 0 ~ 10000 int16, 0=0.00%, 10000=100.00%
> let NMTTIns = new web3.eth.Contract(, );
> NMTTIns.methods.emitSeller (, , , , ).send();// Emit seller
> NMTTIns.methods.emitVerifier (, , , ); // Emit verifier
>
> NMTTIns.methods.giveTokens (); // request giving tokens to seller or verifier
>
>
>5. Buyer
>
> .getData().call();
># Web3 version 0.2x
>
>1. Minter
>
> NMT.addWhitelisted();
> NMT.setServer();
> NMT.transfer(); // So that buyer can make a trade
>
>2. Listener
>
> event = NMT.tradeMade();
> event.watch(function(err,res){}); // Save and pass res.args.tradeAddress to Server
>
>3. Buyer
>
> NMT.newTrade(,,); // with enough gas
>
>4. Server
>
> // Accuracy: 0 ~ 10000 int16, 0=0.00%, 10000=100.00%
> .emitSeller (, , , , ); // Emit seller
> .emitVerifier (, , , ); // Emit verifier
>
> .giveTokens (); // request giving tokens to seller or verifier
>
>
>5. Buyer
>
> .getData();
>