syntax = "proto3"; package forge_abi; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; import "enum.proto"; import "type.proto"; import "tx.proto"; // State definition message AccountState { BigUint balance = 1; uint64 nonce = 2; uint64 num_txs = 3; string address = 4; bytes pk = 5; WalletType type = 6 [ deprecated = true ]; string moniker = 7; StateContext context = 8; string issuer = 9; BigUint gas_balance = 10; // the address that is being migrated. Once this is set this account state is // read only. No further tx can alter this account state. And tx with "from" // equal to the old address will be rejected by Forge repeated string migrated_to = 13; repeated string migrated_from = 14; uint64 num_assets = 15; StakeContext stake = 16; CircularQueue pinned_files = 17; PokeInfo poke = 18; // The current deposit this account has received. It cannot exceed the deposit // cap. BigUint deposit_received = 19; CircularQueue withdraw_items = 20; // 20-49 reserve for future google.protobuf.Any data = 50; } message AssetState { string address = 1; string owner = 2; string moniker = 3; bool readonly = 4; bool transferrable = 5; uint32 ttl = 6; // once it is consumed, it is untransferrable google.protobuf.Timestamp consumed_time = 7; // who issued the asset string issuer = 8; // parent address for the asset state, e.g. a ticket is inherited from an // event string parent = 9; // 10-12 is reserved StakeContext stake = 13; StateContext context = 14; // 13-49 reserve for future google.protobuf.Any data = 50; } message CoreProtocol { string name = 1; string address = 2; } message ForgeState { string address = 1; // consensus parameters, in future we shall be able to modify it ConsensusParams consensus = 2; map tasks = 3; map stake_summary = 4; string version = 5; // string data_version = 6; current data version deprecated // app state returned by forge app // bytes forge_app_hash = 7; deprecated ForgeToken token = 8; TransactionConfig tx_config = 9; // StakeConfig stake_config = 10; deprecated // PokeConfig poke_config = 11; deprecated repeated CoreProtocol protocols = 12; map gas = 13; UpgradeInfo upgrade_info = 14; // google.protobuf.Any data = 15; // deprecated map account_config = 16; TokenSwapConfig token_swap_config = 17; google.protobuf.Any data = 2047; // forge app can define their own app state } // keep a list of state root for different dbs (column families). // RootState will be stored in the default column family, and we return the // root hash for default column family, thus our app_state would contain all // hashes from different column families. message RootState { string address = 1; bytes account = 2; bytes asset = 3; bytes receipt = 4; bytes protocol = 5; bytes governance = 6; bytes custom = 7; } message StakeState { string address = 1; string from = 2; string to = 3; BigUint balance = 4; string message = 5; // state context, replace exiting fields StateContext context = 14; // forge app can extend this google.protobuf.Any data = 15; } message StatisticsState { string address = 1; uint64 num_blocks = 2; uint64 num_txs = 3; BigUint num_stakes = 4; uint32 num_validators = 5; TxStatistics tx_statistics = 6; } message BlacklistState { repeated string address = 1; } message ProtocolState { string address = 1; DeployProtocolTx itx = 2; // root hash of the MPT of this tx protocol bytes root_hash = 3; ProtocolStatus status = 4; repeated string migrated_to = 12; repeated string migrated_from = 13; StateContext context = 14; google.protobuf.Any data = 15; // forge app can define their own app state } // This is just for displaying purpose. message TetherState { string hash = 1; bool available = 2; string custodian = 3; string depositor = 4; string withdrawer = 5; BigUint value = 6; BigUint commission = 7; BigUint charge = 8; string target = 9; google.protobuf.Timestamp locktime = 10; string address = 11; } // This is the one stored in state DB. message TetherInfo { bool available = 1; string hash = 2; } // TODO: [peiling] We have already defined this state in core protocols repo. // The only reason we define this state here again is because the protobuf // definition ResponseGetSwapState needs to reference to this SwapState. message SwapState { string hash = 1; string address = 2; bytes hashkey = 3; string sender = 4; string receiver = 5; BigUint value = 6; repeated string assets = 7; uint32 locktime = 8; bytes hashlock = 9; StateContext context = 10; } // a rule can check against the statistics values, e.g. state.num_txs < 10000, // state.balance_delta < 50000, delta is calculated based on the // configuration for interval. message DelegateOpState { // all the individual rules in DelegateTx will be concat into one per type_url // by "AND" string rule = 1; uint64 num_txs = 2; uint64 num_txs_delta = 3; BigUint balance = 4; BigUint balance_delta = 5; } message DelegateState { string address = 1; map ops = 2; // state context, replace exiting fields StateContext context = 14; // forge app can extend this google.protobuf.Any data = 15; }