swarmcity / SwarmCityConcept

This is the high level description of what needs to be built
9 stars 1 forks source link

As a provider, I accept and fund the deal, so the seeker and I are engaged in a deal. #15

Open kikipluche opened 6 years ago

kikipluche commented 6 years ago

Abstract:

In the detail view of the item, the selected Provider can confirm by funding the deal. Only when both parties have funded the deal, it is valid and can be executed.

How it could work:

DealId is decrypted so the provider can fundDeal in the smart contract:

fundDeal(string _dealid, address _dealowner,string  _ipfsMetadata, address _provider){

The client creates the transaction, then signs it. The signed transaction is sent to the API.

Also, the API updates the dealitem with the Provider's public key.

How the API could work:

fundDeal The API creates a secret, that's encrypted with the Seeker and Provider's public keys. The secret is added to the hashtagItem.

"keys": {
   "0x1e3rf...": {                  // the seeker address is the key 
       "publicKey": "d31aef...",    // the seeker public key 
       "chatSecret": "12sdx3ead3d"    // the chatsecret, encrypted with seeker public key
    },
    "0xade1...": {                  // the provider address is the key 
       "publicKey": "e32aef...",    // the prover public key 
       "chatSecret": "12sdx3ead3d"    // the chatsecret, encrypted with provider public key
    }
}

parameters provider public key signedtx

returns 200 txhash

The API emits hashtagItemChanged event.

API documentation

n/a

Smart Contract:


What it looks like in front end:

Userflow: https://invis.io/ABGM89SX3V5#/293999030_-Hashtag--contractadress---dealhash-_YOURESELECTED ( > in Invision, hold shift to see clickable areas)


route: /hashtag/[contractadress]/[dealhash]

On the detail-page of an item, the user who is the selected provider sees a view containing:

By tapping the big white button witth blue V-mark, the user confirms that he wants to accept the deal. The view will change to confirm-funding-page (1).

The confirm-funding-page (1) contains:

When the user taps the black X-mark (cancel-button), the whole process is aborted and the view changes back to detail-view.

When the user taps the big white button with blue V-mark, he confirms the transaction, triggering the password-unlock (2) for signing this transaction.

The password-unlock (2) is an overlay on the page it is on.

When the user taps the black X-mark (cancel-button), the password-unlock dissappears, showing the page below as it was.

When the user taps the big white button with blue V-mark, he signs the transaction. The signed transaction is sent to the API. The page changes to funding-processing-page (3).

funding-processing-page (3) is a processing page (https://github.com/swarmcity/SwarmCityPM#26), in this case the copy on succes is ‘Funding is being processed.’

When the user taps the big white button with black next-icon, the page changes back to detail-view, showing that the item is now in deal.

On the detail-view of an item in deal, the Provider sees:


route:


Desktop view:


Invisionlinks with login (for inspect mode!): mobile: https://projects.invisionapp.com/d/main#/console/13838256/293999030/inspect desktop: https://projects.invisionapp.com/d/main#/console/14147648/294452126/inspect

Documentation / references

Decrypt a message for an Ethereum publicKey: https://github.com/pubkey/eth-crypto/blob/master/tutorials/encrypted-message.md

With ♡ from Swarm City

xardass commented 6 years ago

We might not need to listen to hashtagItemChanged event from the API, since we already have a subscription open on item detail for real-time updates anyway. To be discussed further...

kikipluche commented 6 years ago

@kingflurkel leave out the chat and make new epic specifically for chat

faffydee commented 6 years ago

TO DO FAFFY: add view other users (who are not Seeker/Provider)