# Lease
Lease
is a structure that sets the lease parameters. The lease is performed only if the structure is included in the callable function result. More about lease
You can get the lease ID using the calculateLeaseId function.
# Constructor
Lease(recipient: Address|Alias, amount: Int, nonce: Int)
or
Lease(recipient: Address|Alias, amount: Int)
In the second case, nonce = 0
is inserted automatically.
# Fields
# | Name | Data type | Description |
---|---|---|---|
1 | recipient | Address|Alias | Lessee address or alias |
2 | amount | Int | Amount of WAVELETs to lease (that is, amount of WAVES multiplied by 108) |
7 | nonce | Int | Nonce that is used for lease ID generation. If the callable function creates several leases with the same parameters, you should use different nonces |
# Example
{-# STDLIB_VERSION 8 #-}
{-# CONTENT_TYPE DAPP #-}
{-# SCRIPT_TYPE ACCOUNT #-}
@Callable(i)
func foo() = {
let lease = Lease(Alias("merry"),100000000)
let id = calculateLeaseId(lease)
(
[
lease,
BinaryEntry("lease", id)
],
unit
)
}
Limitations on the total number of script actions are given in the Limitations article.