Splice.Util.FeaturedApp.DelegateProxy

Utility template for proxying token standard choices so that featured app markers are created when using extra parties for operating an app.

You can either use this template directly, or copy the code under a different package name and a different module name.

Note: we do not recommend using the DelegateProxy as a solution for wallet providers to create featured app markers on actions taken by their users. Code for that kind of proxy is referenced from the issue below:

TODO(hyperledger-labs/splice#2197): polish the PoC of the wallet integrator proxy and include it in the proxies package

Templates

template DelegateProxy

A proxy for a delegate to create featured app markers jointly with using token standard workflows. The delegate is given full control over the creation of the markers.

This is for example useful when using one or more parties for app operation purposes. Using this proxy allows the operational parties to properly attribute their activity to the featured app, which is represented by the app provider party.

Signatory: provider

Field

Type

Description

provider

Party

The app provider whose featured app right should be used

delegate

Party

The delegate interacting with the token standard workflow

Data Types

data ProxyArg arg

Generic argument to the proxy choices.

ProxyArg

Field

Type

Description

choiceArg

arg

The argument to the choice that the delegate is exercising.

featuredAppRightCid

ContractId FeaturedAppRight

The featured app right contract of the provider.

beneficiaries

[AppRewardBeneficiary]

The beneficiaries for the activity marker.

instance Eq arg => Eq (ProxyArg arg)

instance Show arg => Show (ProxyArg arg)

instance GetField "beneficiaries" (ProxyArg arg) [AppRewardBeneficiary]

instance GetField "choiceArg" (ProxyArg arg) arg

instance GetField "featuredAppRightCid" (ProxyArg arg) (ContractId FeaturedAppRight)

instance GetField "proxyArg" DelegateProxy_AllocationFactory_Allocate (ProxyArg AllocationFactory_Allocate)

instance GetField "proxyArg" DelegateProxy_Allocation_Withdraw (ProxyArg Allocation_Withdraw)

instance GetField "proxyArg" DelegateProxy_TransferFactory_Transfer (ProxyArg TransferFactory_Transfer)

instance GetField "proxyArg" DelegateProxy_TransferInstruction_Accept (ProxyArg TransferInstruction_Accept)

instance GetField "proxyArg" DelegateProxy_TransferInstruction_Reject (ProxyArg TransferInstruction_Reject)

instance GetField "proxyArg" DelegateProxy_TransferInstruction_Withdraw (ProxyArg TransferInstruction_Withdraw)

instance SetField "beneficiaries" (ProxyArg arg) [AppRewardBeneficiary]

instance SetField "choiceArg" (ProxyArg arg) arg

instance SetField "featuredAppRightCid" (ProxyArg arg) (ContractId FeaturedAppRight)

instance SetField "proxyArg" DelegateProxy_AllocationFactory_Allocate (ProxyArg AllocationFactory_Allocate)

instance SetField "proxyArg" DelegateProxy_Allocation_Withdraw (ProxyArg Allocation_Withdraw)

instance SetField "proxyArg" DelegateProxy_TransferFactory_Transfer (ProxyArg TransferFactory_Transfer)

instance SetField "proxyArg" DelegateProxy_TransferInstruction_Accept (ProxyArg TransferInstruction_Accept)

instance SetField "proxyArg" DelegateProxy_TransferInstruction_Reject (ProxyArg TransferInstruction_Reject)

instance SetField "proxyArg" DelegateProxy_TransferInstruction_Withdraw (ProxyArg TransferInstruction_Withdraw)

data ProxyResult r

Generic result of the proxy choices.

ProxyResult

Field

Type

Description

markerResult

FeaturedAppRight_CreateActivityMarkerResult

choiceResult

r

instance GetField "choiceResult" (ProxyResult r) r

instance GetField "markerResult" (ProxyResult r) FeaturedAppRight_CreateActivityMarkerResult

instance SetField "choiceResult" (ProxyResult r) r

instance SetField "markerResult" (ProxyResult r) FeaturedAppRight_CreateActivityMarkerResult

instance HasExercise DelegateProxy DelegateProxy_AllocationFactory_Allocate (ProxyResult AllocationInstructionResult)

instance HasExercise DelegateProxy DelegateProxy_Allocation_Withdraw (ProxyResult Allocation_WithdrawResult)

instance HasExercise DelegateProxy DelegateProxy_TransferFactory_Transfer (ProxyResult TransferInstructionResult)

instance HasExercise DelegateProxy DelegateProxy_TransferInstruction_Accept (ProxyResult TransferInstructionResult)

instance HasExercise DelegateProxy DelegateProxy_TransferInstruction_Reject (ProxyResult TransferInstructionResult)

instance HasExercise DelegateProxy DelegateProxy_TransferInstruction_Withdraw (ProxyResult TransferInstructionResult)

instance HasFromAnyChoice DelegateProxy DelegateProxy_AllocationFactory_Allocate (ProxyResult AllocationInstructionResult)

instance HasFromAnyChoice DelegateProxy DelegateProxy_Allocation_Withdraw (ProxyResult Allocation_WithdrawResult)

instance HasFromAnyChoice DelegateProxy DelegateProxy_TransferFactory_Transfer (ProxyResult TransferInstructionResult)

instance HasFromAnyChoice DelegateProxy DelegateProxy_TransferInstruction_Accept (ProxyResult TransferInstructionResult)

instance HasFromAnyChoice DelegateProxy DelegateProxy_TransferInstruction_Reject (ProxyResult TransferInstructionResult)

instance HasFromAnyChoice DelegateProxy DelegateProxy_TransferInstruction_Withdraw (ProxyResult TransferInstructionResult)

instance HasToAnyChoice DelegateProxy DelegateProxy_AllocationFactory_Allocate (ProxyResult AllocationInstructionResult)

instance HasToAnyChoice DelegateProxy DelegateProxy_Allocation_Withdraw (ProxyResult Allocation_WithdrawResult)

instance HasToAnyChoice DelegateProxy DelegateProxy_TransferFactory_Transfer (ProxyResult TransferInstructionResult)

instance HasToAnyChoice DelegateProxy DelegateProxy_TransferInstruction_Accept (ProxyResult TransferInstructionResult)

instance HasToAnyChoice DelegateProxy DelegateProxy_TransferInstruction_Reject (ProxyResult TransferInstructionResult)

instance HasToAnyChoice DelegateProxy DelegateProxy_TransferInstruction_Withdraw (ProxyResult TransferInstructionResult)

Functions

exerciseProxyChoice

: HasExercise t ch r => DelegateProxy -> ContractId t -> ProxyArg ch -> Update (ProxyResult r)

Shared code to execute the proxied choice.

require

: CanAssert m => Text -> Bool -> m ()

Check whether a required condition is true. If it’s not, abort the transaction with a message saying that the requirement was not met.

Comments