The contract communication stack shall have the following items pushed onto it (in this order) upon contract termination:
- Rest of stack (ie, the stack is not necessarily cleared and multiple items may be present)
- User defined contract exit data (optional. Only present if smart contract code does the push)
- Gas used, uint64_t (pushed by Qtum)
- Contract error code (pushed by Qtum)
SCCS ABI Proposal:
Before the termination of a contract, the stack should be cleared of any items that the contract does not wish to return to the calling contract. Each contract should specify their own protocol for what data shall be returned from their contract.