Developer Docs
Smart Contracts
Account Factory

DCAFactory

The DCA Factory allows users to deploy an Account contract from a safe soruce. Each Factory will be iteratable with each version of Account Contract, meaning that DCAFactoryV1 will persist. It will only be paused from generating new accounts if there is a security issue.

Methods

CreateAccount

function CreateAccount() external nonpayable

Will create a new DCAAccount with the sender as the initial owner.

Creates a new DCAAccount

SWAP_ROUTER

function SWAP_ROUTER() external view returns (address)

The swap router address

Returns

NameTypeDescription
_0addressThe swap router address

accountsCreated

function accountsCreated() external view returns (uint256)

The total deployed accounts

Returns

NameTypeDescription
_0uint256The total deployed accounts

getActiveExecutorAddress

function getActiveExecutorAddress() external view returns (address)

Gets the executor address

Returns

NameTypeDescription
_0addressThe executor address

getDCAAccountsOfUser

function getDCAAccountsOfUser(address _user) external view returns (address[])

Gets all DCAAccounts created by a user

Parameters

NameTypeDescription
_useraddressThe address of the user

Returns

NameTypeDescription
_0address[]The addresses of the DCAAccounts created by the user

getFactoryActiveState

function getFactoryActiveState() external view returns (bool)

Gets the active state of the factory

Returns

NameTypeDescription
_0boolThe active state of the factory

getTotalDeployedAccounts

function getTotalDeployedAccounts() external view returns (uint256)

Gets the total deployed accounts

Returns

NameTypeDescription
_0uint256The total deployed accounts

isActive

function isActive() external view returns (bool)

Returns the active state of the contract

Returns

NameTypeDescription
_0boolTrue if the contract is active, false otherwise

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription
_0addressundefined

reInvestLogicContract

function reInvestLogicContract() external view returns (address)

The reinvest logic contract address

Returns

NameTypeDescription
_0addressThe reinvest logic contract 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.

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

updateExecutorAddress

function updateExecutorAddress(address _newExecutorAddress) external nonpayable

Updates the executor address

Parameters

NameTypeDescription
_newExecutorAddressaddressThe address of the new executor

updateReinvestLibraryAddress

function updateReinvestLibraryAddress(address newAddress_) external nonpayable

Updates the reinvest library address

Parameters

NameTypeDescription
newAddress_addressThe address of the new reinvest library

userDCAAccounts

function userDCAAccounts(address, uint256) external view returns (address)

Parameters

NameTypeDescription
_0addressundefined
_1uint256undefined

Returns

NameTypeDescription
_0addressundefined

Events

AccountCreated

event AccountCreated(address indexed owner, address indexed dcaAccount)

Emitted when a new DCAAccount is created.

Parameters

NameTypeDescription
owner indexedaddressThe owner of the DCAAccount
dcaAccount indexedaddressThe address of the DCAAccount

ContractActiveStateChange

event ContractActiveStateChange(bool indexed active_)

Emitted when the active state of the contract is changed

Parameters

NameTypeDescription
active_ indexedboolThe new active state

ExecutorChanged

event ExecutorChanged(address indexed newAddress)

Emitted when the DCAExecutor address is changed.

Parameters

NameTypeDescription
newAddress indexedaddressThe new address of the DCAExecutor

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

ReinvestLibraryChanged

event ReinvestLibraryChanged(address indexed newLibraryAddress)

Emitted when the DCAReinvestContract address is changed.

Parameters

NameTypeDescription
newLibraryAddress indexedaddressThe new address of the DCAReinvestContract

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