Developer Docs
Smart Contracts
Executor

DCAExecutor

Functions

DistributeFees

function DistributeFees(address tokenAddress_) external nonpayable

Distributes the fees for the given token

Parameters

NameTypeDescription
tokenAddress_addressThe address of the token to distribute fees for

Execute

function Execute(address DCAAccount_, uint256 strategyId_) external nonpayable

Executes a single strategy

Parameters

NameTypeDescription
DCAAccount_addressThe address of the DCAAccount
strategyId_uint256The id of the strategy to execute

ForceUnsubscribe

function ForceUnsubscribe(address DCAAccount_, uint256 strategyId_) external nonpayable

Forces the unsubscription of a strategy

Parameters

NameTypeDescription
DCAAccount_addressThe address of the DCAAccount
strategyId_uint256The id of the strategy to unsubscribe

Subscribe

function Subscribe(IDCADataStructures.Strategy strategy_) external nonpayable

Parameters

NameTypeDescription
strategy_IDCADataStructures.Strategyundefined

Unsubscribe

function Unsubscribe(address DCAAccountAddress_, uint256 strategyId_) external nonpayable

Unsubscribes a strategy from the DCAExecutor

Parameters

NameTypeDescription
DCAAccountAddress_addressThe address of the DCAAccount
strategyId_uint256The id of the strategy to unsubscribe

addAdmin

function addAdmin(address newAdmin_) external nonpayable

Adds an admin to the contract

Parameters

NameTypeDescription
newAdmin_addressThe address to add as an admin

changeExecutor

function changeExecutor(address executorAddress_) external nonpayable

Parameters

NameTypeDescription
executorAddress_addressundefined

checkIfAdmin

function checkIfAdmin(address addressToCheck_) external view returns (bool)

Checks if an address is an admin

Parameters

NameTypeDescription
addressToCheck_addressThe address to check

Returns

NameTypeDescription
_0boolTrue if the address is an admin, false otherwise

getActiveExecutorAddress

function getActiveExecutorAddress() external view returns (address)

Returns the active executor address

Returns

NameTypeDescription
_0addressThe active executor address

getExecutorAddress

function getExecutorAddress() external view returns (address)

Returns the executor address

Returns

NameTypeDescription
_0addressThe executor address

getFeeData

function getFeeData() external view returns (struct IDCADataStructures.FeeDistribution)

Returns the fee data for the DCAExecutor

Returns

NameTypeDescription
_0IDCADataStructures.FeeDistributionThe fee data

getIntervalTotalActiveStrategys

function getIntervalTotalActiveStrategys(enum IDCADataStructures.Interval interval_) external view returns (uint256)

Returns the total number of active strategies for the given interval

Parameters

NameTypeDescription
interval_enum IDCADataStructures.IntervalThe interval to get the total number of active strategies for

Returns

NameTypeDescription
_0uint256The total number of active strategies for the given interval

getSpecificStrategy

function getSpecificStrategy(address dcaAccountAddress_, uint256 accountStrategyId_) external view returns (struct IDCADataStructures.Strategy)

Returns the specific strategy for the given DCAAccount and strategy id

Parameters

NameTypeDescription
dcaAccountAddress_addressThe address of the DCAAccount
accountStrategyId_uint256The id of the strategy

Returns

NameTypeDescription
_0IDCADataStructures.StrategyThe strategy data

getTimeTillWindow

function getTimeTillWindow(address account_, uint256 strategyId_) external view returns (uint256 lastEx, uint256 secondsLeft, bool checkReturn)

Returns the time till window for the given DCAAccount and strategy id

Parameters

NameTypeDescription
account_addressThe address of the DCAAccount
strategyId_uint256The id of the strategy

Returns

NameTypeDescription
lastExuint256The last execution block number
secondsLeftuint256The seconds left till window
checkReturnboolThe check return

getTotalActiveStrategys

function getTotalActiveStrategys() external view returns (uint256)

Returns the total number of active strategies

Returns

NameTypeDescription
_0uint256The total number of active strategies

getTotalExecutions

function getTotalExecutions() external view returns (uint256)

Returns the total number of executions

Returns

NameTypeDescription
_0uint256The total number of executions

isActive

function isActive() external view returns (bool)

Returns the active state of the contract

Returns

NameTypeDescription
_0boolTrue if the contract is active, false otherwise

isIntervalActive

function isIntervalActive(enum IDCADataStructures.Interval interval_) external view returns (bool)

Returns the active state of the given interval

Parameters

NameTypeDescription
interval_enum IDCADataStructures.IntervalThe interval to get the active state for

Returns

NameTypeDescription
_0boolThe active state of the given interval

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription
_0addressundefined

removeAdmin

function removeAdmin(address oldAdmin_) external nonpayable

Removes an admin from the contract

Parameters

NameTypeDescription
oldAdmin_addressThe address to remove as an admin

removeExecutor

function removeExecutor() external nonpayable

Removes the executor address

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.

setActiveState

function setActiveState(bool newFlag_) external nonpayable

Sets the active state of the DCAExecutor

Parameters

NameTypeDescription
newFlag_boolThe new active state

setFeeData

function setFeeData(IDCADataStructures.FeeDistribution fee_) external nonpayable

Parameters

NameTypeDescription
fee_IDCADataStructures.FeeDistributionundefined

setIntervalActive

function setIntervalActive(enum IDCADataStructures.Interval interval_, bool status_) external nonpayable

Sets the active state of the given interval

Parameters

NameTypeDescription
interval_enum IDCADataStructures.IntervalThe interval to set the active state for
status_boolThe new active state

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddressundefined

Events

ContractActiveStateChange

event ContractActiveStateChange(bool indexed active_)

Emitted when the active state of the contract is changed

Parameters

NameTypeDescription
active_ indexedboolThe new active state

ExecutedStrategy

event ExecutedStrategy(address indexed account_, uint256 indexed strategyId_)

Emitted once a strategy has finished executing successfully

Parameters

NameTypeDescription
account_ indexedaddressAddress of the DCAAccount
strategyId_ indexeduint256ID of the strategy executed

ExecutorAddressChange

event ExecutorAddressChange(address indexed newAddress_)

Emitted when the executor address is changed

Parameters

NameTypeDescription
newAddress_ indexedaddressThe new executor address

FeeDataChanged

event FeeDataChanged()

FeesDistributed

event FeesDistributed(address indexed token_, uint256 indexed amount_)

Emitted each time the protocol fees are distributed

Parameters

NameTypeDescription
token_ indexedaddressaddress of the token being distributed
amount_ indexeduint256amount of the total token distributed

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

StrategySubscription

event StrategySubscription(address indexed DCAAccountAddress_, uint256 indexed strategyId_, enum IDCADataStructures.Interval strategyInterval_, bool indexed active_)

Emitted when a new strategy subscribes or unsubscribes to the executor

Parameters

NameTypeDescription
DCAAccountAddress_ indexedaddressaddress of the DCAAccount subscribing
strategyId_ indexeduint256ID of the strategy to (un-)subscribe
strategyInterval_enum IDCADataStructures.IntervalInterval state of how ofter to be executed
active_ indexedboolwether the strategy is being subscribed (true) or unsubscribed (false)

Errors

ContractIsPaused

error ContractIsPaused()

Error thrown when the contract is paused

OwnableInvalidOwner

error OwnableInvalidOwner(address owner)

The owner is not a valid owner account. (eg. address(0))

Parameters

NameTypeDescription
owneraddressundefined

OwnableUnauthorizedAccount

error OwnableUnauthorizedAccount(address account)

The caller account is not authorized to perform an operation.

Parameters

NameTypeDescription
accountaddressundefined