本合约实现商品的物流溯源;
源码:
pragma solidity ^0.4.20;
contract Trace {
enum State { Origin, Factory, QA, Shipping, Received, Pending }
string name; // 名称
uint price; // 价格
uint weight; // 重量
bool lock = false; // 合约锁
bool close = false; // 合约状态
uint number = 1;
uint attr_number = 1;
mapping (address => string) guestbook; //客户留言本
struct Attribute {
address owner; // 供应商
string name; // 属性的名字
string date; // 生产日期
string desc; // 描述信息
}
mapping (uint => Attribute) attribute;
struct Logistics {
address owner; // 中转站
string date;