Balance contract
/**
* @dev This function is used to add a stable coin to the supported stable coins.
* @param token The address of the stable coin to be added.
*/
function addStableCoin(address token) public onlyRole(DEFAULT_ADMIN_ROLE) {
}
/**
* @dev This function is used to remove a stable coin from the supported stable coins.
* @param token The address of the stable coin to be removed.
*/
function removeStableCoin(address token) public onlyRole(DEFAULT_ADMIN_ROLE) {
}
/**
* @dev This function is used to create a task to transfer stable coins from the source chain to the target chain.
* @param targetChainId The ID of the target chain where the stable coins will be transferred to.
* @param amount The amount of stable coins to be transferred.
* @param sourceStableCoin The address of the stable coin to be transferred.
* @param targetStableCoin The address of the stable coin to be transferred.
*/
function createTask(uint256 targetChainId, uint256 amount, address sourceStableCoin,address targetStableCoin) public onlyRole(TRANSFER_MANAGER_ROLE) {
}
/**
* @dev Revoke a stable coin withdrawal task if it has not been completed.
* @param sourceTaskId The ID of the task to be revoked.
* @param sourceChainId The ID of the source chain where the stable coins are transferred from.
*/
function revokeSourceTask(
uint256 sourceTaskId,
uint256 sourceChainId
) public onlyRole(TRANSFER_MANAGER_ROLE) {
}
/**
* @dev This function is used to accept a task to transfer stable coins from the source chain to the target chain.
* @param localTaskId The ID of the task to be accepted.
*/
function acceptTaskAndTransferFunds(uint256 localTaskId) public {
}
/**
* @dev This function is used to forcibly refund the funds to the user and cancel the task.
* @param localTaskId The ID of the task to be cancelled and refunded.
*/
function forceRefundAndCancelTask(uint256 localTaskId) public onlyRole(TRANSFER_MANAGER_ROLE) {
}
/**
* @dev This function is used to authorize a task to transfer stable coins from the source chain to the target chain.
* @param sourceTaskId The ID of the task to be authorized.
* @param sourceChainId The ID of the source chain where the stable coins are transferred from.
* @param targetChainId The ID of the target chain where the stable coins will be transferred to.
* @param amount The amount of stable coins to be transferred.
* @param targetStableCoin The address of the stable coin to be transferred.
* @param user The address of the user who is authorized to transfer the stable coins.
*/
function authorizeWithdrawal(
uint256 sourceTaskId,
uint256 sourceChainId,
uint256 targetChainId,
uint256 amount,
address targetStableCoin,
address user
) public onlyRole(TRANSFER_MANAGER_ROLE) {
}
/**
* @dev This function is used to withdraw stable coins from the source chain to the target chain.
* @param sourceTaskId The ID of the task to be authorized.
* @param sourceChainId The ID of the source chain where the stable coins are transferred from.
**/
function withdrawStableCoin(
uint256 sourceTaskId,
uint256 sourceChainId
) public {
}
/**
* @dev Sets the main contract address.
* @param _mainContractAddress The address of the main contract.
**/
function setMainContractAddress(address _mainContractAddress) public onlyRole(DEFAULT_ADMIN_ROLE) {
require(_mainContractAddress != address(0), "Invalid address");
mainContract = IMainContract(_mainContractAddress);
emit MainContractAddressUpdated(_mainContractAddress);
}
/**
* @dev Retrieves all tasks based on filters: user, completion status, and pagination.
* @param user The address of the user to filter tasks by. If address(0), no user filter is applied.
* @param isCompleted Filter for whether the task is completed.
* @param pageSize The number of tasks per page.
* @param page The page number to retrieve.
* @return tasks An array of BalanceTask structs that match the filters.
*/
function getFilteredSourceTasks(address user, bool isCompleted, uint256 pageSize, uint256 page) public view returns (BalanceTask[] memory) {
}
/**
* @dev Retrieves target chain tasks based on filters, supporting pagination
* @param user User address, if address(0) then no user filter is applied
* @param isCompleted Filter for whether the task is completed
* @param pageSize The number of tasks per page
* @param page The page number to retrieve
* @param sourceChainId The source chain ID of the tasks
* @return tasks An array of BalanceTask structs that match the filters
*/
function getFilteredTargetTasks(address user, bool isCompleted, uint256 pageSize, uint256 page, uint256 sourceChainId) public view returns (BalanceTask[] memory) {
}
/**
* @dev Retrieves a balance task by its ID and chain ID.
* @param taskId The ID of the task to retrieve.
* @param chainId The chain ID where the task is stored.
* @return task The BalanceTask struct corresponding to the taskId and chainId.
*/
function getTaskById(uint256 taskId, uint256 chainId) public view returns (BalanceTask memory task) {
}
/**
* @dev Retrieves the targetChainId of a balance task by its ID and chain ID.
* @param taskId The ID of the task to retrieve.
* @param chainId The chain ID where the task is stored.
* @return targetChainId The targetChainId of the task.
*/
function getTargetChainId(uint256 taskId, uint256 chainId) public view returns (uint256) {
}
/**
* @dev Retrieves the amount of a balance task by its ID and chain ID.
* @param taskId The ID of the task to retrieve.
* @param chainId The chain ID where the task is stored.
* @return amount The amount of the task.
*/
function getAmount(uint256 taskId, uint256 chainId) public view returns (uint256) {
}
/**
* @dev Retrieves the stableCoin address of a balance task by its ID and chain ID.
* @param taskId The ID of the task to retrieve.
* @param chainId The chain ID where the task is stored.
* @return sourceStableCoin The sourceStableCoin address of the task.
*/
function getSourceStableCoin(uint256 taskId, uint256 chainId) public view returns (address) {
}
/**
* @dev Retrieves the authorizedUser of a balance task by its ID and chain ID.
* @param taskId The ID of the task to retrieve.
* @param chainId The chain ID where the task is stored.
* @return authorizedUser The authorizedUser of the task.
*/
function getAuthorizedUser(uint256 taskId, uint256 chainId) public view returns (address) {
}
/**
* @dev Retrieves the completion status of a balance task by its ID and chain ID.
* @param taskId The ID of the task to retrieve.
* @param chainId The chain ID where the task is stored.
* @return completed The completion status of the task.
*/
function getCompleted(uint256 taskId, uint256 chainId) public view returns (bool) {
}
Last updated