Skip to content

Commit

Permalink
fix: up to date changes for qw
Browse files Browse the repository at this point in the history
  • Loading branch information
jakekidd committed Jul 1, 2024
1 parent 54fd46f commit 6ee91cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
33 changes: 21 additions & 12 deletions src/interfaces/IQWChild.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,37 @@ interface IQWChild {
/**
* @notice Executes a transaction on the child contract.
* @dev This function is called by the parent contract to execute a transaction on the child contract.
* @param _callData Encoded function call to be executed on the child contract.
* @param _tokenAmount Amount of tokens to be transferred to the child contract.
* @param _amount Amount of tokens to be transferred to the child contract.
* @return success boolean indicating whether the transaction was successful.
* @return shares Number of shares to be allocated to the user in return for investment created.
* @return assetAmountReceived The total amount of asset tokens received in return for the investment.
*/
function create(
bytes memory _callData,
uint256 _tokenAmount
) external returns (bool success, uint256 shares);
uint256 _amount
) external returns (bool success, uint256 assetAmountReceived);

/**
* @notice Closes a transaction on the child contract.
* @dev This function is called by the parent contract to close a transaction on the child contract.
* @param _callData Encoded function call to be executed on the child contract.
* @param _sharesAmount Amount of shares to be withdrawn, will determine tokens withdrawn.
* @param _ratio Percentage of holdings to be withdrawn, with 8 decimal places for precision.
* @return success boolean indicating whether the transaction was successfully closed.
* @return tokens Number of tokens to be returned to the user in exchange for shares withdrawn.
* @return tokenAmountReceived Number of tokens to be returned to the user in exchange for the withdrawn ratio.
*/
function close(
bytes memory _callData,
uint256 _sharesAmount
) external returns (bool success, uint256 tokens);
uint256 _ratio
) external returns (bool success, uint256 tokenAmountReceived);

/**
* @notice Gets the total amount of the asset currently held.
* @return uint256 The total amount of the asset currently held.
*/
function holdings() external view returns (uint256);

/**
* @notice Calculates the amount of tokens to be withdrawn for a given ratio.
* @param _ratio Percentage of holdings for which to calculate a withdraw, with 8 decimal places for precision.
* @return uint256 The amount of tokens that would be received for the given ratio.
*/
function calc(uint256 _ratio) external view returns (uint256);

/**
* @notice Gets the address of the Quant Wealth Manager contract.
Expand Down
16 changes: 4 additions & 12 deletions src/interfaces/IQWManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ interface IQWManager {
/**
* @notice Execute a series of investments in batches for multiple protocols.
* Transfers specified amounts of tokens and calls target contracts with provided calldata.
* @param batches Array of ExecuteBatch data containing protocol, users, contributions, token, and amount.
* @param batches Array of ExecuteBatch data containing protocol and amount.
*/
function execute(ExecuteBatch[] memory batches) external;

/**
* @notice Close a series of investments in batches for multiple protocols.
* Calls target contracts with provided calldata to close positions.
* @param batches Array of CloseBatch data containing protocol, users, contributions, token, and shares.
* @param batches Array of CloseBatch data containing protocol and ratio.
*/
function close(CloseBatch[] memory batches) external;

Expand Down Expand Up @@ -47,28 +47,20 @@ interface IQWManager {
/**
* @notice ExecuteBatch struct to hold batch data for executing investments.
* @param protocol The protocol into which we are investing funds.
* @param users The users investing.
* @param contributions Contribution fractions in basis points (e.g., 1% = 100, 100% = 10000).
* @param amount The total amount being invested in the given token by all users into this protocol.
*/
struct ExecuteBatch {
address protocol;
address[] users;
uint256[] contributions;
uint256 amount;
}

/**
* @notice CloseBatch struct to hold batch data for closing investments.
* @param protocol The protocol from which we are withdrawing funds.
* @param users The users withdrawing.
* @param contributions Contribution fractions in basis points (e.g., 1% = 100, 100% = 10000).
* @param shares The total shares being withdrawn from the given protocol by all users.
* @param ratio The percentage amount of holdings to withdraw from the given protocol.
*/
struct CloseBatch {
address protocol;
address[] users;
uint256[] contributions;
uint256 shares;
uint256 ratio;
}
}

0 comments on commit 6ee91cd

Please sign in to comment.