Skip to content

Commit

Permalink
docs: add docs to the new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
r0ohafza committed Jan 22, 2024
1 parent 9ca0c34 commit 96fc820
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/splits-v2/src/splitters/SplitWalletV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ contract SplitWalletV2 is Wallet {
/* PUBLIC/EXTERNAL FUNCTIONS */
/* -------------------------------------------------------------------------- */

/**
* @notice Distributes the split to the recipients. It distributes the amount of tokens present in Warehouse and the
* split wallet.
* @dev The split must be initialized and the split hash must match the split hash of the split wallet.
* @param _split the split struct containing the split data that gets distributed
* @param _token the token to distribute
* @param _distributor the distributor of the split
*/
function distribute(SplitV2Lib.Split calldata _split, address _token, address _distributor) external pausable {
if (splitHash != _split.getHash()) revert InvalidSplit();
(uint256 _splitBalance, uint256 _warehouseBalance) = _getSplitBalance(_token);
Expand All @@ -119,6 +127,16 @@ contract SplitWalletV2 is Wallet {
}
}

/**
* @notice Distributes the split to the recipients. It distributes the amount of tokens present in Warehouse and the
* split wallet.
* @dev The amount of tokens to distribute must be present in the split wallet or the warehouse depending on the
* distribution direction.
* @param _split the split struct containing the split data that gets distributed
* @param _token the token to distribute
* @param _amount the amount of tokens to distribute
* @param _distributor the distributor of the split
*/
function distribute(
SplitV2Lib.Split calldata _split,
address _token,
Expand All @@ -137,14 +155,29 @@ contract SplitWalletV2 is Wallet {
}
}

/**
* @notice Deposits tokens to the warehouse
* @param _token the token to deposit
* @param _amount the amount of tokens to deposit
*/
function depositToWarehouse(address _token, uint256 _amount) external {
_depositToWarehouse(_token, _amount);
}

/**
* @notice Withdraws tokens from the warehouse to the split wallet
* @param _token the token to withdraw
*/
function withdrawFromWarehouse(address _token, uint256 _amount) external {
_withdrawFromWarehouse(_token, _amount);
}

/**
* @notice Gets the total token balance of the split wallet and the warehouse
* @param _token the token to get the balance of
* @return _splitBalance the token balance in the split wallet
* @return _warehouseBalance the token balance in the warehouse of the split wallet
*/
function getSplitBalance(address _token) public view returns (uint256 _splitBalance, uint256 _warehouseBalance) {
return _getSplitBalance(_token);
}
Expand Down

0 comments on commit 96fc820

Please sign in to comment.