As usual, we kick off the chapter by writing the smart contract code. First, create a directory called FuturesWeb3j (in your home folder) and initiate an empty Truffle project using truffle init.
Afterward, in the contracts/ folder, create a Futures.sol file with the following code:
contract CFutures {
address user;
address hedger;
address speculator;
struct asset{
uint id;
uint Quantity;
uint price;
address seller;
address buyer;
uint date;
}
asset TradedAsset;
event DepositEv(uint amount, address sender);
function CFutures(
uint assetID,
uint Quantity,
uint price,
address buyer,
address seller,
uint date) public {
TradedAsset.id = assetID;
TradedAsset.Quantity = Quantity;
TradedAsset.price = price;
TradedAsset...