social-dist0rtion-protocol / planet-a

The Tragedy of the CO₂mmons
MIT License
10 stars 3 forks source link

Feat/trade receipt #15

Closed TimDaub closed 5 years ago

TimDaub commented 5 years ago

Fixes #6

TODOs:

Documentation

It's very simple my dude. The property type on a receipt determines which receipt view is shown to the user. There's three types.

no type in the receipt object => It's a normal Ethereum value transaction (ETH, ERC20, ERC721)

Austin then always passes these parameters:

let receiptObj = {
  to:toAddress,
  from:result.from,
  amount:parseFloat(amount),
  message:this.state.message,
  result:result
}
this.setReceipt(receiptObj);
this.changeView("receipt");

I'm not totally familiar with what is absolutely required. Hence I recommend looking at components like SendToAddress.js to find out.

type === "trade" => It's a Planet A "trade" transaction

const testReceipt = {
  to: "0x901442E4dEeC484E9B2EFDb2bA20FCb19880D9A3",
  from: "0x51Ff1fab76079d20418d1c74DA65653FfE3fD0aa",
  type: "trade",
  profit: 20, // in USD/USG
  emission: 25 // in tons of CO2
}
this.setReceipt(testReceipt);
this.changeView("receipt");

type === "lock" => It's a Planet A "plant a tree" transaction

[TODO]

TimDaub commented 5 years ago

Done in #28 now