DCAExecutor
Functions
DistributeFees
function DistributeFees(address tokenAddress_) external nonpayableDistributes the fees for the given token
Parameters
| Name | Type | Description |
|---|---|---|
| tokenAddress_ | address | The address of the token to distribute fees for |
Execute
function Execute(address DCAAccount_, uint256 strategyId_) external nonpayableExecutes a single strategy
Parameters
| Name | Type | Description |
|---|---|---|
| DCAAccount_ | address | The address of the DCAAccount |
| strategyId_ | uint256 | The id of the strategy to execute |
ForceUnsubscribe
function ForceUnsubscribe(address DCAAccount_, uint256 strategyId_) external nonpayableForces the unsubscription of a strategy
Parameters
| Name | Type | Description |
|---|---|---|
| DCAAccount_ | address | The address of the DCAAccount |
| strategyId_ | uint256 | The id of the strategy to unsubscribe |
Subscribe
function Subscribe(IDCADataStructures.Strategy strategy_) external nonpayableParameters
| Name | Type | Description |
|---|---|---|
| strategy_ | IDCADataStructures.Strategy | undefined |
Unsubscribe
function Unsubscribe(address DCAAccountAddress_, uint256 strategyId_) external nonpayableUnsubscribes a strategy from the DCAExecutor
Parameters
| Name | Type | Description |
|---|---|---|
| DCAAccountAddress_ | address | The address of the DCAAccount |
| strategyId_ | uint256 | The id of the strategy to unsubscribe |
addAdmin
function addAdmin(address newAdmin_) external nonpayableAdds an admin to the contract
Parameters
| Name | Type | Description |
|---|---|---|
| newAdmin_ | address | The address to add as an admin |
changeExecutor
function changeExecutor(address executorAddress_) external nonpayableParameters
| Name | Type | Description |
|---|---|---|
| executorAddress_ | address | undefined |
checkIfAdmin
function checkIfAdmin(address addressToCheck_) external view returns (bool)Checks if an address is an admin
Parameters
| Name | Type | Description |
|---|---|---|
| addressToCheck_ | address | The address to check |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | True if the address is an admin, false otherwise |
getActiveExecutorAddress
function getActiveExecutorAddress() external view returns (address)Returns the active executor address
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | The active executor address |
getExecutorAddress
function getExecutorAddress() external view returns (address)Returns the executor address
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | The executor address |
getFeeData
function getFeeData() external view returns (struct IDCADataStructures.FeeDistribution)Returns the fee data for the DCAExecutor
Returns
| Name | Type | Description |
|---|---|---|
| _0 | IDCADataStructures.FeeDistribution | The 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
| Name | Type | Description |
|---|---|---|
| interval_ | enum IDCADataStructures.Interval | The interval to get the total number of active strategies for |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| dcaAccountAddress_ | address | The address of the DCAAccount |
| accountStrategyId_ | uint256 | The id of the strategy |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | IDCADataStructures.Strategy | The 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
| Name | Type | Description |
|---|---|---|
| account_ | address | The address of the DCAAccount |
| strategyId_ | uint256 | The id of the strategy |
Returns
| Name | Type | Description |
|---|---|---|
| lastEx | uint256 | The last execution block number |
| secondsLeft | uint256 | The seconds left till window |
| checkReturn | bool | The check return |
getTotalActiveStrategys
function getTotalActiveStrategys() external view returns (uint256)Returns the total number of active strategies
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | The total number of active strategies |
getTotalExecutions
function getTotalExecutions() external view returns (uint256)Returns the total number of executions
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | The total number of executions |
isActive
function isActive() external view returns (bool)Returns the active state of the contract
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | True 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
| Name | Type | Description |
|---|---|---|
| interval_ | enum IDCADataStructures.Interval | The interval to get the active state for |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | The active state of the given interval |
owner
function owner() external view returns (address)Returns the address of the current owner.
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |
removeAdmin
function removeAdmin(address oldAdmin_) external nonpayableRemoves an admin from the contract
Parameters
| Name | Type | Description |
|---|---|---|
| oldAdmin_ | address | The address to remove as an admin |
removeExecutor
function removeExecutor() external nonpayableRemoves the executor address
renounceOwnership
function renounceOwnership() external nonpayableLeaves 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 nonpayableSets the active state of the DCAExecutor
Parameters
| Name | Type | Description |
|---|---|---|
| newFlag_ | bool | The new active state |
setFeeData
function setFeeData(IDCADataStructures.FeeDistribution fee_) external nonpayableParameters
| Name | Type | Description |
|---|---|---|
| fee_ | IDCADataStructures.FeeDistribution | undefined |
setIntervalActive
function setIntervalActive(enum IDCADataStructures.Interval interval_, bool status_) external nonpayableSets the active state of the given interval
Parameters
| Name | Type | Description |
|---|---|---|
| interval_ | enum IDCADataStructures.Interval | The interval to set the active state for |
| status_ | bool | The new active state |
transferOwnership
function transferOwnership(address newOwner) external nonpayableTransfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.
Parameters
| Name | Type | Description |
|---|---|---|
| newOwner | address | undefined |
Events
ContractActiveStateChange
event ContractActiveStateChange(bool indexed active_)Emitted when the active state of the contract is changed
Parameters
| Name | Type | Description |
|---|---|---|
active_ indexed | bool | The new active state |
ExecutedStrategy
event ExecutedStrategy(address indexed account_, uint256 indexed strategyId_)Emitted once a strategy has finished executing successfully
Parameters
| Name | Type | Description |
|---|---|---|
account_ indexed | address | Address of the DCAAccount |
strategyId_ indexed | uint256 | ID of the strategy executed |
ExecutorAddressChange
event ExecutorAddressChange(address indexed newAddress_)Emitted when the executor address is changed
Parameters
| Name | Type | Description |
|---|---|---|
newAddress_ indexed | address | The new executor address |
FeeDataChanged
event FeeDataChanged()FeesDistributed
event FeesDistributed(address indexed token_, uint256 indexed amount_)Emitted each time the protocol fees are distributed
Parameters
| Name | Type | Description |
|---|---|---|
token_ indexed | address | address of the token being distributed |
amount_ indexed | uint256 | amount of the total token distributed |
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)Parameters
| Name | Type | Description |
|---|---|---|
previousOwner indexed | address | undefined |
newOwner indexed | address | undefined |
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
| Name | Type | Description |
|---|---|---|
DCAAccountAddress_ indexed | address | address of the DCAAccount subscribing |
strategyId_ indexed | uint256 | ID of the strategy to (un-)subscribe |
| strategyInterval_ | enum IDCADataStructures.Interval | Interval state of how ofter to be executed |
active_ indexed | bool | wether 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
| Name | Type | Description |
|---|---|---|
| owner | address | undefined |
OwnableUnauthorizedAccount
error OwnableUnauthorizedAccount(address account)The caller account is not authorized to perform an operation.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | undefined |