corda / net.corda.core.contracts / UpgradedContract

# UpgradedContract

`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.

### Parameters

`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.

### Properties

legacyContract | `abstract val legacyContract: Class<out Contract>`

### Inherited Properties

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).

### Functions

upgrade | `abstract fun upgrade(state: OldState): NewState` Upgrade contract's state object to a new state object.

### Inherited Functions

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.

### Inheritors

DummyContractV2 | `class DummyContractV2 : UpgradedContract<State, State>` Dummy contract state for testing of the upgrade process.