Skip to main content
Version: 1.6.0

operation

let create_contract: <param, storage>(_: entrypoint<param, storage>) => (_: option<key_hash>) => (_: tez) => (_: storage) => [ operation, address ]

The call create_contract(e,d,a,s) returns a contract creation operation (origination) for the entrypoint e (as a function) with optional delegate d, initial amount a and initial storage s, together with the address of the created contract. Note that the created contract cannot be called immediately afterwards (that is, get_contract_opt on that address would return None()), as the origination must be performed successfully first, for example by calling a proxy contract or itself.

let set_delegate: (_: option<key_hash>) => operation

The call set_delegate(d) evaluates in an operation that sets the delegate of the current smart contract to be d, where d is an optional key hash. If None(), the delegation is withdrawn. If the contract has no delegation, then no change occurs. If d is Some(kh), where kh is the key hash of a registered delegate that is not the current delegate of the contract, then this operation sets the delegate of the contract to this registered delegate. A failure occurs if kh is the current delegate of the contract or if kh is not a registered delegate. However, the instruction in itself does not fail; it produces an operation that will fail when applied.

let transaction: <param>(_: param) => (_: tez) => (_: contract<param>) => operation

The call transaction(param, amount, contract_addr) evaluates in an operation that will send the amount amount in mutez to the contract at the valid address contract_addr, with parameter param. If the contract is an implicit account, the parameter must be unit.

let emit: <event_type>(_: string) => (_: event_type) => operation

The call emit event_tag(event_type) evaluates in an operation that will write an event into the transaction receipt after the successful execution of this contract. The event is annotated by the string event_tag if it is not empty. The argument event_type is used only to specify the type of data attachment.