DCAAccount
Methods
Execute
function Execute(uint256 strategyId_, uint16 feeAmount_) external nonpayable returns (bool)Executes the given strategy with the given fee amount. Can only be done by the executor.
Parameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | the id of the strategy to execute |
| feeAmount_ | uint16 | the amount of fee to pay to the executor |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
ExecutorDeactivate
function ExecutorDeactivate(uint256 strategyId_) external nonpayableused by the Executor to remove failing strategies/out of funds strategies.
Force unsubscribe the strategy from the executor
Parameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | Strategy Id of the strategy to unsubscribe |
FundAccount
function FundAccount(address token_, uint256 amount_) external nonpayableFund the account with a base currency
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address | {address} The ERC20 token address |
| amount_ | uint256 | {uint256} Amount of the token to deposit |
SWAP_ROUTER
function SWAP_ROUTER() external view returns (contract ISwapRouter)Returns
| Name | Type | Description |
|---|---|---|
| _0 | contract ISwapRouter | undefined |
SetupStrategy
function SetupStrategy(IDCADataStructures.Strategy newStrategy_, uint256 seedFunds_, bool subscribeToExecutor_) external nonpayableParameters
| Name | Type | Description |
|---|---|---|
| newStrategy_ | IDCADataStructures.Strategy | undefined |
| seedFunds_ | uint256 | undefined |
| subscribeToExecutor_ | bool | undefined |
SubscribeStrategy
function SubscribeStrategy(uint256 strategyId_) external nonpayableSubscribes an already created strategy to an executor
Parameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | {uint256} Id of the strategy to subscribe to an executor |
UnFundAccount
function UnFundAccount(address token_, uint256 amount_) external nonpayableUnfund account of a base token
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address | {address} The ERC20 token address |
| amount_ | uint256 | {uint256} Amount of the token to withdraw |
UnWindReinvest
function UnWindReinvest(uint256 strategyId_) external nonpayableUnwinds the reinvestment for the given strategy
Parameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | The id of the strategy to unwind |
UnsubscribeStrategy
function UnsubscribeStrategy(uint256 strategyId_) external nonpayableUnsubscribes the given strategy from its executor
Parameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | Strategy Id of the strategy to unsubscribe |
WithdrawSavings
function WithdrawSavings(address token_, uint256 amount_) external nonpayableWithdraws the given amount of the target token balance
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address | {address} The ERC20 token address |
| amount_ | uint256 | {uint256} Amount of the target token to withdraw |
changeExecutor
function changeExecutor(address executorAddress_) external nonpayableParameters
| Name | Type | Description |
|---|---|---|
| executorAddress_ | address | undefined |
changeReinvestLibrary
function changeReinvestLibrary(address newLibraryAddress_) external nonpayableUpdates the contract holding the reinvest logic
Parameters
| Name | Type | Description |
|---|---|---|
| newLibraryAddress_ | address | address of the library contract to use |
getAttachedReinvestLibraryAddress
function getAttachedReinvestLibraryAddress() external view returns (address)Returns the address of the attached reinvest library
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | The address of the attached reinvest library |
getAttachedReinvestLibraryVersion
function getAttachedReinvestLibraryVersion() external view returns (string)Returns the version of the attached reinvest library
Returns
| Name | Type | Description |
|---|---|---|
| _0 | string | The version of the attached reinvest library |
getBaseBalance
function getBaseBalance(address token_) external view returns (uint256)get account balance of base token
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address | {address} Base token address |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | {uint256} account balance of Base token |
getExecutorAddress
function getExecutorAddress() external view returns (address)Returns the executor address
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | The executor address |
getStrategyData
function getStrategyData(uint256 strategyId_) external view returns (struct IDCADataStructures.Strategy)Get the full data for the given strategy
Parameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | Strategy Id of the strategy data to get |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | IDCADataStructures.Strategy | {Strategy} the given strategy's full data struct |
getTargetBalance
function getTargetBalance(address token_) external view returns (uint256)get account balance of target token
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address | {address} Base token address |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | {uint256} account balance of Base token |
getTimeTillWindow
function getTimeTillWindow(uint256 strategyId_) external view returns (uint256 lastEx, uint256 secondsLeft, bool checkReturn)returns UI data for strategy interval timing
Parameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | Strategy Id of the strategy data to get |
Returns
| Name | Type | Description |
|---|---|---|
| lastEx | uint256 | {uint256} time of last execution (seconds) |
| secondsLeft | uint256 | {uint256} seconds left till strategy is in window |
| checkReturn | bool | {bool} if the strategy is in the window |
owner
function owner() external view returns (address)Returns the address of the current owner.
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |
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.
setStrategyReinvest
function setStrategyReinvest(uint256 strategyId_, IDCADataStructures.Reinvest reinvest_) external nonpayableParameters
| Name | Type | Description |
|---|---|---|
| strategyId_ | uint256 | undefined |
| reinvest_ | IDCADataStructures.Reinvest | undefined |
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 |
updateSwapAddress
function updateSwapAddress(address swapRouter_) external nonpayableUpdates the Uniswap SwapRouter Address
Parameters
| Name | Type | Description |
|---|---|---|
| swapRouter_ | address | New address for the Uniswap router |
Events
ExecutorAddressChange
event ExecutorAddressChange(address indexed newAddress_)Emitted when the executor address is changed
Parameters
| Name | Type | Description |
|---|---|---|
newAddress_ indexed | address | The new executor address |
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)Parameters
| Name | Type | Description |
|---|---|---|
previousOwner indexed | address | undefined |
newOwner indexed | address | undefined |
ReinvestExecuted
event ReinvestExecuted(uint256 indexed strategyId_, bool indexed success, uint256 amountReturned)Emits when a Reinvest modula has been executed
Parameters
| Name | Type | Description |
|---|---|---|
strategyId_ indexed | uint256 | the ID of the strategy executed |
success indexed | bool | Wether the reinvest was successful |
| amountReturned | uint256 | The amount returned by the Reinvest |
ReinvestLibraryChanged
event ReinvestLibraryChanged(address indexed newLibraryAddress)Emits when the reinvest address has been changed
Parameters
| Name | Type | Description |
|---|---|---|
newLibraryAddress indexed | address | The address for the Library contract |
ReinvestUnwound
event ReinvestUnwound(uint256 indexed strategyId, uint256 amount, bool indexed success)Emited when a Reinvest is unwound
Parameters
| Name | Type | Description |
|---|---|---|
strategyId indexed | uint256 | The ID of the strategy |
| amount | uint256 | The amount unwond and returned to the account |
success indexed | bool | If the unwind was successful |
StrategyCreated
event StrategyCreated(uint256 indexed strategyId_)Emitted when a new strategy has been created
Parameters
| Name | Type | Description |
|---|---|---|
strategyId_ indexed | uint256 | Id of the newly created strategy |
StrategyExecuted
event StrategyExecuted(uint256 indexed strategyId_, uint256 indexed amountIn_, bool reInvested_)Emitted when a strategy has been executed
Parameters
| Name | Type | Description |
|---|---|---|
strategyId_ indexed | uint256 | the id for the executed strategy |
amountIn_ indexed | uint256 | amount received from the swap |
| reInvested_ | bool | wether the strategy reinvested or not |
StrategySubscribed
event StrategySubscribed(uint256 indexed strategyId_, address indexed executor_)Emitted when the Strategy is confirmed to be subscribed to an Executor
Parameters
| Name | Type | Description |
|---|---|---|
strategyId_ indexed | uint256 | ID of the strategy that has been subscribed |
executor_ indexed | address | Address of the Executor contract subscribed to |
StrategyUnsubscribed
event StrategyUnsubscribed(uint256 indexed strategyId_)Emitted when a strategy has been unsubscribed from an Executor
Parameters
| Name | Type | Description |
|---|---|---|
strategyId_ indexed | uint256 | Id of the strategy being unsubscribed |
Errors
AddressEmptyCode
error AddressEmptyCode(address target)There's no code at target (it is not a contract).
Parameters
| Name | Type | Description |
|---|---|---|
| target | address | undefined |
AddressInsufficientBalance
error AddressInsufficientBalance(address account)The ETH balance of the account is not enough to perform the operation.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | undefined |
FailedInnerCall
error FailedInnerCall()A call to an address target failed. The target may have reverted.
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 |
SafeERC20FailedOperation
error SafeERC20FailedOperation(address token)An operation with an ERC20 token failed.
Parameters
| Name | Type | Description |
|---|---|---|
| token | address | undefined |