Skip to main content

Streaming Payments / Salaries (StreamingPayments)

This expenditure enables ongoing "streaming" payments, useful for implementing salaries. Users with the Administration and Funding permissions can create streaming payments, indicating the tokens and amounts to be transferred over a given interval of time. Users can then claim tokens continually, at whatever frequency they choose.

Interface Methods

addToken(uint256 _fundingPermissionDomainId, uint256 _fundingChildSkillIndex, uint256 _id, address _token, uint256 _amount)

Add a new token/amount pair

Parameters

NameTypeDescription
_fundingPermissionDomainIduint256The domain in which the caller holds the funding permission
_fundingChildSkillIndexuint256The index linking the fundingPermissionDomainId to the domainId
_iduint256The id of the streaming payment
_tokenaddressThe address of the token
_amountuint256The amount to pay out

cancel(uint256 _adminPermissionDomainId, uint256 _adminChildSkillIndex, uint256 _id)

Cancel the streaming payment, specifically by setting endTime to block.timestamp

Parameters

NameTypeDescription
_adminPermissionDomainIduint256The domain in which the caller holds the admin permission
_adminChildSkillIndexuint256The index linking the adminPermissionDomainId to the domainId
_iduint256The id of the streaming payment

cancelAndWaive(uint256 _id, address[] memory _tokens)

Cancel the streaming payment, specifically by setting endTime to block.timestamp, and waive claim to specified tokens already earned. Only callable by the recipient.

Parameters

NameTypeDescription
_iduint256The id of the streaming payment
_tokensaddress[]The tokens to waive any claims to.

claim(uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _fromChildSkillIndex, uint256 _toChildSkillIndex, uint256 _id, address[] memory _tokens)

Claim a streaming payment

Parameters

NameTypeDescription
_permissionDomainIduint256The domain in which the extension holds the funding & admin permissions
_childSkillIndexuint256The index linking the permissionDomainId to the domainId the payment is in
_fromChildSkillIndexuint256The linking the domainId to the fromPot domain
_toChildSkillIndexuint256The linking the domainId to the toPot domain
_iduint256The id of the streaming payment
_tokensaddress[]The tokens to be paid out

create(uint256 _fundingPermissionDomainId, uint256 _fundingChildSkillIndex, uint256 _adminPermissionDomainId, uint256 _adminChildSkillIndex, uint256 _domainId, uint256 _startTime, uint256 _endTime, uint256 _interval, address _recipient, address[] memory _tokens, uint256[] memory _amounts)

Creates a new streaming payment

Parameters

NameTypeDescription
_fundingPermissionDomainIduint256The domain in which the caller holds the funding permission
_fundingChildSkillIndexuint256The index linking the fundingPermissionDomainId to the domainId
_adminPermissionDomainIduint256The domain in which the caller holds the admin permission
_adminChildSkillIndexuint256The index linking the adminPermissionDomainId to the domainId
_domainIduint256The domain out of which the streaming payment will be paid
_startTimeuint256The time at which the payment begins paying out
_endTimeuint256The time at which the payment ends paying out
_intervaluint256The period of time over which _amounts are paid out
_recipientaddressThe recipient of the streaming payment
_tokensaddress[]The tokens to be paid out
_amountsuint256[]The amounts to be paid out (per _interval of time)

deprecate(bool _deprecated)

Called when deprecating (or undeprecating) the extension

Parameters

NameTypeDescription
_deprecatedboolIndicates whether the extension should be deprecated or undeprecated

finishUpgrade()

Called when upgrading the extension

getAmountEntitledFromStart(uint256 _id, address _token):uint256 amount

Get the amount entitled to claim from the start of the stream

Parameters

NameTypeDescription
_iduint256The id of the streaming payment
_tokenaddressThe address of the token

Return Parameters

NameTypeDescription
amountuint256The amount entitled

getNumStreamingPayments():uint256 numPayments

Get the total number of streaming payments

Return Parameters

NameTypeDescription
numPaymentsuint256The total number of streaming payments

getPaymentToken(uint256 _id, address _token):PaymentToken paymentToken

Get the payment token struct by Id and token

Parameters

NameTypeDescription
_iduint256The id of the streaming payment
_tokenaddressThe address of the token

Return Parameters

NameTypeDescription
paymentTokenPaymentTokenThe payment token struct

getStreamingPayment(uint256 _id):StreamingPayment streamingPayment

Get the streaming payment struct by Id

Parameters

NameTypeDescription
_iduint256The id of the streaming payment

Return Parameters

NameTypeDescription
streamingPaymentStreamingPaymentThe streaming payment struct

identifier():bytes32 _identifier

Returns the identifier of the extension

Return Parameters

NameTypeDescription
_identifierbytes32The extension's identifier

install(address _colony)

Configures the extension

Parameters

NameTypeDescription
_colonyaddressThe colony in which the extension holds permissions

setEndTime(uint256 _adminPermissionDomainId, uint256 _adminChildSkillIndex, uint256 _id, uint256 _endTime)

Update the endTime, only if the new endTime is in the future

Parameters

NameTypeDescription
_adminPermissionDomainIduint256The domain in which the caller holds the admin permission
_adminChildSkillIndexuint256The index linking the adminPermissionDomainId to the domainId
_iduint256The id of the streaming payment
_endTimeuint256The new endTime to set

setStartTime(uint256 _adminPermissionDomainId, uint256 _adminChildSkillIndex, uint256 _id, uint256 _startTime)

Update the startTime, only if the current startTime is in the future

Parameters

NameTypeDescription
_adminPermissionDomainIduint256The domain in which the caller holds the admin permission
_adminChildSkillIndexuint256The index linking the adminPermissionDomainId to the domainId
_iduint256The id of the streaming payment
_startTimeuint256The new startTime to set

setTokenAmount(uint256 _fundingPermissionDomainId, uint256 _fundingChildSkillIndex, uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _fromChildSkillIndex, uint256 _toChildSkillIndex, uint256 _id, address _token, uint256 _amount)

Update the token amount to be paid out. Claims existing payout prior to the change

Parameters

NameTypeDescription
_fundingPermissionDomainIduint256The domain in which the caller holds the funding permission
_fundingChildSkillIndexuint256The index linking the fundingPermissionDomainId to the domainId
_permissionDomainIduint256The domain in which the extension holds the funding & admin permissions
_childSkillIndexuint256The index linking the permissionDomainId to the domainId
_fromChildSkillIndexuint256The linking the domainId to the fromPot domain
_toChildSkillIndexuint256The linking the domainId to the toPot domain
_iduint256The id of the streaming payment
_tokenaddressThe address of the token
_amountuint256The new amount to pay out

uninstall()

Called when uninstalling the extension

version():uint256 _version

Returns the version of the extension

Return Parameters

NameTypeDescription
_versionuint256The extension's version number