Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add marketplace service #810

Merged
merged 3 commits into from
Mar 19, 2019
Merged

Add marketplace service #810

merged 3 commits into from
Mar 19, 2019

Conversation

NicolasMahe
Copy link
Member

@NicolasMahe NicolasMahe commented Mar 13, 2019

If you get error like error while downloading manifest ipfs :: QmUoE4fsthoirJRWtqosNMQF79DYBWbgtGw37Sgg2eMdre RequestError: Error: ESOCKETTIMEDOUT it's because ipfs gateway remove the file from its cache. We need to host an IPFS node to guarantee availability. The first version's manifest file is not on ipfs anymore, but I upload the second recently, so it should work.

Start service

./dev-cli service dev ./systemservices/marketplace

List service

./dev-cli service execute marketplace --task listServices --json ./systemservices/marketplace/test-data/empty.json

Get service

./dev-cli service execute marketplace --task getService --json ./systemservices/marketplace/test-data/getService.json

Publish service version

./dev-cli service execute marketplace --task publishServiceVersion --json ./systemservices/marketplace/test-data/publishServiceVersion.json

Send sign transaction

./dev-cli service execute marketplace --task sendSignedTransaction --json ./systemservices/marketplace/test-data/sendSignedTransaction.json

Create service offer

./dev-cli service execute marketplace --task createServiceOffer --json ./systemservices/marketplace/test-data/createServiceOffer.json

Purchase

./dev-cli service execute marketplace --task purchase --json ./systemservices/marketplace/test-data/purchase.json

Is Authorized

with hash

./dev-cli service execute marketplace --task isAuthorized --json ./systemservices/marketplace/test-data/isAuthorized.json

with sid

./dev-cli service execute marketplace --task isAuthorized --json ./systemservices/marketplace/test-data/isAuthorized-sid.json

Note:

To send the transaction returned by some commands, execute:

./dev-cli service execute ethwallet --task sign --json sign.json

With sign.json file like (you need to replace the data):

{
  "address": "0xcAB79fA69c68CB4C65fa5C6E05BC4dBa5FB57D11",
  "passphrase": "1",
  "transaction": {
    "chainID": 3,
    "data": "0x095ea7b300000000000000000000000094f4cb92fe9f547574aec617b1594b13abd47ad300000000000000000000000000000000000000000000003635c9adc5dea00000",
    "gas": 1000000,
    "gasPrice": "1000000000",
    "nonce": 21,
    "to": "0x5861B3DC52339d4f976B7fa5d80dB6cd6f477F1B",
    "value": "0"
  }
}

Then, publish transaction, copy past after signedTransaction= the tx outputted:

./dev-cli service execute marketplace --task sendSignedTransaction --data signedTransaction=

Copy link
Contributor

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run some manual tests and seems ok, let's merge 👍

description: ""
inputs:
sid: *sid
price:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why price is in string ? what's the format ? why not number ?
Same for duration
It makes more sense to have number here, the contract definition accepts number and string and I think we will not use bignumber for duration or price.
Also could be good to add some details on the duration is it seconds / hours / months... maybe having duration + unit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every number that can be big or too many decimal are as String in the JSON and as BigNumber in the service.

I can add more comment and description for sure ;)

Copy link
Member

@antho1404 antho1404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work everything is working great.

Some stuff that could be improved:

  • Documentation
  • Error handling on the transactions for now it's a bit ugly
 ›   Error: Error: Transaction has been reverted by the EVM:
 ›   {
 ›      "blockHash": "0xdf6eee18dc677118d4923101c008b39c9430da5345fc268cb904c18732e11498",
 ›      "blockNumber": 5232953,
 ›      "contractAddress": null,
 ›      "cumulativeGasUsed": 1105990,
 ›      "from": "0xf46109df80c953dc747c44b0c18482e252ee59c9",
 ›      "gasUsed": 25806,
 ›      "logs": [],
 ›      "logsBloom":
 ›   "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 ›   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 ›   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 ›   0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 ›   0000000000000000000000000000000000000000000000000000000000000000000000000000000",
 ›      "status": false,
 ›      "to": "0x94f4cb92fe9f547574aec617b1594b13abd47ad3",
 ›      "transactionHash": "0xd841b618d4140cc5ab4aec1259d933e484f8b70dc87601a75c7b4ce1535db710",
 ›      "transactionIndex": 16
 ›   }

@ilgooz ilgooz merged commit 7bf06eb into dev Mar 19, 2019
@ilgooz ilgooz deleted the ss/marketplace branch March 19, 2019 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants