interface UpgradedContract<in OldState : ContractState, out NewState : ContractState> : Contract
Interface which can upgrade state objects issued by a contract to a new state object issued by a different contract.
OldState
- the old contract state (can be ContractState or other common supertype if this supports upgrading
more than one state).
NewState
- the upgraded contract state.
legacyContract |
abstract val legacyContract: Class<out Contract> |
legalContractReference |
abstract val legalContractReference: SecureHash
Unparsed reference to the natural language contract that this code is supposed to express (usually a hash of the contract's contents). |
upgrade |
abstract fun upgrade(state: OldState): NewState
Upgrade contract's state object to a new state object. |
verify |
abstract fun verify(tx: TransactionForContract): Unit
Takes an object that represents a state transition, and ensures the inputs/outputs/commands make sense. Must throw an exception if there's a problem that should prevent state transition. Takes a single object rather than an argument so that additional data can be added without breaking binary compatibility with existing contract code. |
DummyContractV2 |
class DummyContractV2 : UpgradedContract<State, State>
Dummy contract state for testing of the upgrade process. |