LockupParams
Let's review each parameter in detail.
Broker
An optional parameter that can be set in order to charge a fee as a percentage of totalAmount
.
In the following example, we will leave this parameter uninitialized (i.e. set to zero), because it doesn't make sense to charge yourself a fee. In practice, this parameter will mostly be used by front-end applications.
params.broker = Broker(address(0), ud60x18(0));
Wondering what's up with that ud60x18
function? It's a casting function that wraps a basic integer to the UD60x18
value type. This type is part of the math library PRBMath, which is used in
Sablier for fixed-point calculations.
Cancelable
Boolean that indicates whether the stream will be cancelable or not.
params.cancelable = true;
Recipient
The address receiving the tokens:
params.recipient = address(0xCAFE);
Sender
The address streaming the tokens, with the ability to cancel the stream:
params.sender = msg.sender;
Token
The contract address of the ERC-20 token used for streaming. In this example, we will stream DAI:
params.token = DAI;
Total amount
The total amount of ERC-20 tokens to be paid, including the stream deposit and any potential fees, all denoted in units of the asset's decimals.
params.totalAmount = totalAmount;
Transferable
Boolean that indicates whether the stream will be transferable or not.
params.transferable = true;