From 9bace0dab57716e6b73784fe4956cdc846e10ce3 Mon Sep 17 00:00:00 2001 From: bout3fiddy <11488427+bout3fiddy@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:34:33 +0100 Subject: [PATCH] add some natspec --- contracts/main/CurveStableSwapMetaNG.vy | 8 +++++++- contracts/main/CurveStableSwapNG.vy | 9 ++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/contracts/main/CurveStableSwapMetaNG.vy b/contracts/main/CurveStableSwapMetaNG.vy index c4166a38..5c1e567c 100644 --- a/contracts/main/CurveStableSwapMetaNG.vy +++ b/contracts/main/CurveStableSwapMetaNG.vy @@ -481,6 +481,9 @@ def _transfer_out( ): """ @notice Transfer a single token from the pool to receiver. + @dev This function is called by `remove_liquidity` and + `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and + `remove_liquidity_imbalance` methods. @param _coin_idx Index of the token to transfer out @param _amount Amount of token to transfer out @param receiver Address to send the tokens to @@ -585,6 +588,7 @@ def exchange( @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive + @param _receiver Address that receives `j` @return Actual amount of `j` received """ return self._exchange( @@ -619,6 +623,7 @@ def exchange_received( @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive + @param _receiver Address that receives `j` @return Actual amount of `j` received """ assert asset_type != 2 # dev: exchange_received not supported if pool contains rebasing tokens @@ -1858,7 +1863,8 @@ def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256): def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256): """ @notice Set the moving average window of the price oracles. - @param _ma_exp_time Moving average window. It is time_in_seconds / ln(2) + @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2). + @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2). """ assert msg.sender == factory.admin() # dev: only owner assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values diff --git a/contracts/main/CurveStableSwapNG.vy b/contracts/main/CurveStableSwapNG.vy index bd8581e4..b3ad05bd 100644 --- a/contracts/main/CurveStableSwapNG.vy +++ b/contracts/main/CurveStableSwapNG.vy @@ -361,7 +361,6 @@ def _transfer_in( @notice Contains all logic to handle ERC20 token transfers. @param coin_idx Index of the coin to transfer in. @param dx amount of `_coin` to transfer into the pool. - @param dy amount of `_coin` to transfer out of the pool. @param sender address to transfer `_coin` from. @param receiver address to transfer `_coin` to. @param expect_optimistic_transfer True if contract expects an optimistic coin transfer @@ -396,7 +395,8 @@ def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address): """ @notice Transfer a single token from the pool to receiver. @dev This function is called by `remove_liquidity` and - `remove_liquidity_one`, `_exchange` and `_withdraw_admin_fees` methods. + `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and + `remove_liquidity_imbalance` methods. @param _coin_idx Index of the token to transfer out @param _amount Amount of token to transfer out @param receiver Address to send the tokens to @@ -507,6 +507,7 @@ def exchange( @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive + @param _receiver Address that receives `j` @return Actual amount of `j` received """ return self._exchange( @@ -541,6 +542,7 @@ def exchange_received( @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive + @param _receiver Address that receives `j` @return Actual amount of `j` received """ assert not 2 in asset_types # dev: exchange_received not supported if pool contains rebasing tokens @@ -1868,7 +1870,8 @@ def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256): def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256): """ @notice Set the moving average window of the price oracles. - @param _ma_exp_time Moving average window. It is time_in_seconds / ln(2) + @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2). + @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2). """ assert msg.sender == factory.admin() # dev: only owner assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values