PandExchange
Technical documentation of the PandExchange V1 contract
Contract name: PandExchange
Code source: Public soon
Data structure
UserDCAData
The data structure holding all the information for a single DCAO of a user. The user address is not present in the structure as each UserDCAData object is linked to the user address by a mapping in the MapDCA public variable.
Public variables
MapDCA
The mapping responsible for stocking all the DCAO of every users. Each user address is mapped to another mapping which link an ID to the corresponding UserDCAData object. To get the DCAO of user, you need his address and the ID of the specific DCAO you are looking for. The ID is the block.timestamp of the time the DCAO has been created. It ensures unicity for the IDs for each user.
Read functions
GetOwner
This function return the address of the contract's owner. The owner address is used to send the fee taken at each DCAO creation on the contract
Write functions
addNewDCAToUser
This function allows an user to create a new DCAO for himself. It cannot be called if the contract is paused.
Event: Emits AddedNewDCA
Parameters:
Return value(s):
Note: As the first occurrence is executed at the creation of a DCAO, the executeSingleUserDCA function is also called. Find its description below.
executeSingleUserDCA
This function execute an occurrence of a DCAO for any user. This does two things: Updating the state of the concerned DCAO in the contract, and performing the swap. It cannot be used while the contract is paused.
Events: Emit OccurrenceExecuted
Parameters:
deleteUserDCA
This function delete the DCAO of an user. Doing so transfer back to the user all unused input token. This function can be used even if the contract is paused, so that it is not possible to block any users' funds
Events: Emit DeletedDCA
Parameters:
modifyDCAFee
This function allows an user to modify the executor's fee for one of its DCAO. This function cannot be used when the contract is paused.
Events: Emit FeeUpdated
Parameters:
modifySlippageTolerance
This function allows an user to update the slippage tolerance for each swap of a specific DCAO. This function cannot be used when the contract is paused.
Event: Emit SlippageToleranceUpdated
Parameters:
setOwner
This function allow the current contract's owner to change the owner address
Event: Emit NewOwner
Parameters:
pause
This function pause the contract preventing certain functions to be executed, such as addNewDCAToUser or executeSingleUserDCA. Only the owner can pause the contract
Event: None
Parameters: None
unPause
This function unpause the contract allowing certain functions to be executed, such as addNewDCAToUser or executeSingleUserDCA. Only the owner can unpause the contract
Event: None
Parameters: None
Events
AddedNewDCA
Emitted when a DCAO is created on the contract. It exposes the key information for this DCAO for anyone to keep track of it.
OccurrenceExecuted
Emitted when an occurrence of a DCAO is executed.
DeletedDCA
Emitted when a DCA is deleted
FeeUpdated
Emitted when the executor's fee of a DCAO is updated
SlippageToleranceUpdated
Emitted when the slippage tolerance of a DCAO is updated
NewOwner
Emitted when the contract's owner is changed
Last updated