Skip to main content

Proxy_ticket

Note: This module/namespace exists inside the Test module/namespace, to use functions from this module prefix it with Test. e.g. Test.Proxy_ticket.init_transfer

Helper functions for working with tickets in the LIGO Testing framework.

cameligo

type 'a proxy_address = (('a * nat) * address , unit) typed_address

jsligo

type proxy_address<T> = typed_address<[[T, nat], address], unit>

Typed address of the proxy contract.

cameligo

val init_transfer : ('a ticket -> 'param) -> 'a proxy_address

jsligo

let init_transfer : <T, P>(mk_param: (t: ticket<T>) => P) => proxy_address<T>

Takes a function that given a ticket creates the parameter for calling/transferring to a contract (param creator) and returns a typed address (proxy_address) of the proxy contract.

This function originates a proxy contract, the actual transfer of the ticket needs to go through this proxy contract (done via the transfer function below).

cameligo

val transfer : 'a proxy_address -> (('a * nat) * address) -> test_exec_result

jsligo

let transfer : <T>(p: proxy_address<T>, ti: [[T, nat], address]) => test_exec_result

Takes the proxy_address (typed address of the proxy contract), and the ticket information along with the destination address (The contract to which the ticket needs to be transferred).

This function makes the actual transfer of the ticket to the destination contract/address.

cameligo

val originate : ('a * nat) -> ('a ticket -> 'storage) -> ('param -> 'storage -> operation list * 'storage) -> address

jsligo

let originate : <T, P, S>(ti: [T, nat], mk_storage: (t: ticket<T>) => S, c: (p: P, s: S) => [list<operation>, S]) => address

Takes ticket information along with a function that when takes a ticket and returns the storage of the contract to be originated and the actual contract to be originated and returns the address of the originated contract.

This function internally originated the contract via a proxy contract.

cameligo

val originate_uncurried : ('a * nat) -> ('a ticket -> 'storage) -> ('param * 'storage -> operation list * 'storage) -> address

jsligo

let originate_uncurried : <T, P, S>(ti: [T, nat], mk_storage: (t: ticket<T>) => S, c: (ps: [P, S]) => [list<operation>, S]) => address

Same as originate described above, but works with un-curried contracts.