Splice.TokenStandard.Utils.Internal.Transfers
Internal module of utilities to implement V2 transfer workflows
Import ‘Splice.TokenStandard.Utils’ to get access to the public ones.
Orphan Typeclass Instances
instance ForwardCompatible (ContractId TransferInstruction) (ContractId TransferInstruction)
instance BackwardCompatible (ContractId TransferInstruction) (ContractId TransferInstruction)
instance ForwardCompatible Transfer Transfer
instance BackwardCompatible Transfer Transfer
instance ForwardCompatible TransferInstructionView TransferInstructionView
instance ForwardCompatible TransferInstructionResult_Output TransferInstructionResult_Output
instance BackwardCompatible TransferInstructionResult_Output TransferInstructionResult_Output
instance ForwardCompatible TransferInstructionResult TransferInstructionResult
instance BackwardCompatible TransferInstructionResult TransferInstructionResult
instance ForwardCompatible TransferFactoryView TransferFactoryView
instance BackwardCompatible TransferFactoryView TransferFactoryView
instance ForwardCompatible (ContractId TransferFactory) (ContractId TransferFactory)
Functions
- isValidTransferV2
: Transfer -> Bool
Check basic invariants of a
V2.Transfer.
- transferInstructionV2_receiverActor_acceptDefaultImplUsingV1
: Party -> ContractId TransferInstruction -> TransferInstruction_Accept -> Update TransferInstructionResult
Accept implementation based on V1, which can and should be used whenever the receiver is the actor.
- transferInstructionV2_receiverActor_rejectDefaultImplUsingV1
: Party -> ContractId TransferInstruction -> TransferInstruction_Reject -> Update TransferInstructionResult
Reject implementation based on V1, which can and should be used whenever the receiver is the actor.
- transferInstructionV2_senderActor_withdrawDefaultImplUsingV1
: Party -> ContractId TransferInstruction -> TransferInstruction_Withdraw -> Update TransferInstructionResult
Withdraw implementation based on V1, which can and should be used whenever the sender is the actor.
- transferFactoryV2_transferDefaultImplUsingV1
: ([Party] -> TransferFactory_Transfer -> Update TransferInstructionResult) -> ContractId TransferFactory -> TransferFactory_Transfer -> Update TransferInstructionResult
Transfer factory implementation based on calling the V1 body.
- transferFactoryV2_publicAsset_transferExtraObserversDefaultImpl
: TransferFactory_Transfer -> [Party]
For public assets the receivers should be observers as well.
- transferFactoryV2_privateAsset_transferExtraObserversDefaultImpl
: TransferFactory_Transfer -> [Party]
Default for private assets, where the only observers are the account parties of the sender.
- transferInstructionV1_withdrawDefaultImplUsingV2
: TransferInstruction -> (ContractId TransferInstruction -> TransferInstruction_Withdraw -> Update TransferInstructionResult) -> ContractId TransferInstruction -> TransferInstruction_Withdraw -> Update TransferInstructionResult
Adapter to implement
V1.TransferInstruction_Withdrawusing the body of the V2 choice.Built as an adapter, as calling the V2 interface method directly is not possible, as that will archive the transfer instruction again.
- transferInstructionV1_acceptDefaultImplUsingV2
: TransferInstruction -> (ContractId TransferInstruction -> TransferInstruction_Accept -> Update TransferInstructionResult) -> ContractId TransferInstruction -> TransferInstruction_Accept -> Update TransferInstructionResult
Adapter to implement
V1.TransferInstruction_Acceptusing the body of the V2 choice.Built as an adapter, as calling the V2 interface method directly is not possible, as that will archive the transfer instruction again.
- transferInstructionV1_rejectDefaultImplUsingV2
: TransferInstruction -> (ContractId TransferInstruction -> TransferInstruction_Reject -> Update TransferInstructionResult) -> ContractId TransferInstruction -> TransferInstruction_Reject -> Update TransferInstructionResult
Adapter to implement
V1.TransferInstruction_Rejectusing the body of the V2 choice.Built as an adapter, as calling the V2 interface method directly is not possible, as that will archive the transfer instruction again.
- transferInstructionV1_updateDefaultImplUsingV2
: ContractId TransferInstruction -> TransferInstruction_Update -> Update TransferInstructionResult
Default implementation for
V1.TransferInstruction_Updatefor a V1 allocation instruction based on its V2 counterpart.Always aborts, as the update choice is not required to be called in this case.
- transferFactoryV1_transferDefaultImplUsingV2
: TransferFactory -> ContractId TransferFactory -> TransferFactory_Transfer -> Update TransferInstructionResult
Default method for
V1.TransferFactory_Transferthat uses the V2 transfer implementation under the hood.
- transferAcceptanceTxHistoryV1ToMeta
: Transfer -> Metadata -> Metadata
Add the metadata from a V1 transfer acceptance to the result metadata of the V2 accept choice.
Note that we only need to add metadata for the accept choice, as that’s the only one where an actual transfer happens.
Comments