Skip to content

Commit 4d5a93b

Browse files
committed
docs: fix natspec syntax with minimal changes to docstrings
1 parent b9ab9e8 commit 4d5a93b

File tree

1 file changed

+51
-49
lines changed

1 file changed

+51
-49
lines changed

contracts/OffsetHelper.sol

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ contract OffsetHelper is OffsetHelperStorage {
3434
uint256[] amounts
3535
);
3636

37-
// @description this is the autoOffset method for when the user wants to input tokens like USDC, WETH, WMATIC
38-
// @param _depositedToken the address of the token that the user sends (could be USDC, WETH, WMATIC)
39-
// @param _poolToken the pool that the user wants to use (could be NCT or BCT)
40-
// @param _amountToOffset the amount of TCO2 to offset
41-
// @returns 2 arrays, one containing the tco2s that were redeemed and another the amounts
37+
/// @notice this is the autoOffset method for when the user wants to input tokens like USDC, WETH, WMATIC
38+
/// @param _depositedToken the address of the token that the user sends (could be USDC, WETH, WMATIC)
39+
/// @param _poolToken the pool that the user wants to use (could be NCT or BCT)
40+
/// @param _amountToOffset the amount of TCO2 to offset
41+
/// @return tco2s an array of the tco2 addresses that were redeemed
42+
/// @return amounts an array of the amounts of each tco2s that were redeemed
4243
function autoOffsetUsingToken(
4344
address _depositedToken,
4445
address _poolToken,
@@ -54,9 +55,9 @@ contract OffsetHelper is OffsetHelperStorage {
5455
autoRetire(tco2s, amounts);
5556
}
5657

57-
// @description this is the autoOffset method for when the user wants to input MATIC
58-
// @param _poolToken the pool that the user wants to use (could be NCT or BCT)
59-
// @param _amountToOffset the amount of TCO2 to offset
58+
/// @notice this is the autoOffset method for when the user wants to input MATIC
59+
/// @param _poolToken the pool that the user wants to use (could be NCT or BCT)
60+
/// @param _amountToOffset the amount of TCO2 to offset
6061
function autoOffsetUsingETH(address _poolToken, uint256 _amountToOffset)
6162
public
6263
payable
@@ -72,9 +73,9 @@ contract OffsetHelper is OffsetHelperStorage {
7273
autoRetire(tco2s, amounts);
7374
}
7475

75-
// @description this is the autoOffset method for when the user already has and wants to input BCT / NCT
76-
// @param _poolToken the pool token that the user wants to use (could be NCT or BCT)
77-
// @param _amountToOffset the amount of TCO2 to offset
76+
/// @notice this is the autoOffset method for when the user already has and wants to input BCT / NCT
77+
/// @param _poolToken the pool token that the user wants to use (could be NCT or BCT)
78+
/// @param _amountToOffset the amount of TCO2 to offset
7879
function autoOffsetUsingPoolToken(
7980
address _poolToken,
8081
uint256 _amountToOffset
@@ -90,7 +91,7 @@ contract OffsetHelper is OffsetHelperStorage {
9091
}
9192

9293
// checks address and returns if can be used at all by the contract
93-
// @param _erc20Address address of token to be checked
94+
/// @param _erc20Address address of token to be checked
9495
function isEligible(address _erc20Address) private view returns (bool) {
9596
bool isToucanContract = IToucanContractRegistry(contractRegistryAddress)
9697
.checkERC20(_erc20Address);
@@ -104,7 +105,7 @@ contract OffsetHelper is OffsetHelperStorage {
104105
}
105106

106107
// checks address and returns if it can be used in a swap
107-
// @param _erc20Address address of token to be checked
108+
/// @param _erc20Address address of token to be checked
108109
function isSwapable(address _erc20Address) private view returns (bool) {
109110
if (_erc20Address == eligibleTokenAddresses["USDC"]) return true;
110111
if (_erc20Address == eligibleTokenAddresses["WETH"]) return true;
@@ -113,18 +114,18 @@ contract OffsetHelper is OffsetHelperStorage {
113114
}
114115

115116
// checks address and returns if can it's a pool token and can be redeemed
116-
// @param _erc20Address address of token to be checked
117+
/// @param _erc20Address address of token to be checked
117118
function isRedeemable(address _erc20Address) private view returns (bool) {
118119
if (_erc20Address == eligibleTokenAddresses["BCT"]) return true;
119120
if (_erc20Address == eligibleTokenAddresses["NCT"]) return true;
120121
return false;
121122
}
122123

123-
// @description tells user how much of _fromToken is required to swap for an amount of pool tokens
124-
// @param _fromToken the token the user wants to swap for pool token
125-
// @param _toToken token to swap for (should be NCT or BCT)
126-
// @param _amount amount of NCT / BCT wanted
127-
// @returns uint256 representing the required ETH / MATIC to get the amount of NCT / BCT
124+
/// @notice tells user how much of _fromToken is required to swap for an amount of pool tokens
125+
/// @param _fromToken the token the user wants to swap for pool token
126+
/// @param _toToken token to swap for (should be NCT or BCT)
127+
/// @param _amount amount of NCT / BCT wanted
128+
/// @return amountsIn the amount required ETH / MATIC to get the amount of NCT / BCT
128129
function calculateNeededTokenAmount(
129130
address _fromToken,
130131
address _toToken,
@@ -150,11 +151,11 @@ contract OffsetHelper is OffsetHelperStorage {
150151
return amountsIn[0];
151152
}
152153

153-
// @description uses SushiSwap to exchange eligible tokens for BCT / NCT
154-
// @param _fromToken token to deposit and swap
155-
// @param _toToken token to swap for (will be held within contract)
156-
// @param _amount amount of NCT / BCT wanted
157-
// @notice needs to be approved on the client side
154+
/// @notice uses SushiSwap to exchange eligible tokens for BCT / NCT
155+
/// @param _fromToken token to deposit and swap
156+
/// @param _toToken token to swap for (will be held within contract)
157+
/// @param _amount amount of NCT / BCT wanted
158+
/// @notice needs to be approved on the client side
158159
function swap(
159160
address _fromToken,
160161
address _toToken,
@@ -210,10 +211,10 @@ contract OffsetHelper is OffsetHelperStorage {
210211

211212
receive() external payable {}
212213

213-
// @description tells user how much ETH/MATIC is required to swap for an amount of pool tokens
214-
// @param _toToken token to swap for (should be NCT or BCT)
215-
// @param _amount amount of NCT / BCT wanted
216-
// @returns uint256 representing the required ETH / MATIC to get the amount of NCT / BCT
214+
/// @notice tells user how much ETH/MATIC is required to swap for an amount of pool tokens
215+
/// @param _toToken token to swap for (should be NCT or BCT)
216+
/// @param _amount amount of NCT / BCT wanted
217+
/// @return amountsIn the amount required ETH / MATIC to get the amount of NCT / BCT
217218
function calculateNeededETHAmount(address _toToken, uint256 _amount)
218219
public
219220
view
@@ -236,10 +237,10 @@ contract OffsetHelper is OffsetHelperStorage {
236237
return amounts[0];
237238
}
238239

239-
// @description uses SushiSwap to exchange MATIC for BCT / NCT
240-
// @param _toToken token to swap for (will be held within contract)
241-
// @param _amount amount of NCT / BCT wanted
242-
// @notice needs to be provided a message value on client side
240+
/// @notice uses SushiSwap to exchange MATIC for BCT / NCT
241+
/// @param _toToken token to swap for (will be held within contract)
242+
/// @param _amount amount of NCT / BCT wanted
243+
/// @notice needs to be provided a message value on client side
243244
function swap(address _toToken, uint256 _amount) public payable {
244245
// check tokens
245246
require(isRedeemable(_toToken), "Token not eligible");
@@ -281,7 +282,7 @@ contract OffsetHelper is OffsetHelperStorage {
281282
balances[msg.sender][path[2]] += _amount;
282283
}
283284

284-
// @description allow users to withdraw tokens they have deposited
285+
/// @notice allow users to withdraw tokens they have deposited
285286
function withdraw(address _erc20Addr, uint256 _amount) public {
286287
require(
287288
balances[msg.sender][_erc20Addr] >= _amount,
@@ -292,20 +293,21 @@ contract OffsetHelper is OffsetHelperStorage {
292293
balances[msg.sender][_erc20Addr] -= _amount;
293294
}
294295

295-
// @description allow people to deposit BCT / NCT
296-
// @notice needs to be approved
296+
/// @notice allow people to deposit BCT / NCT
297+
/// @notice needs to be approved
297298
function deposit(address _erc20Addr, uint256 _amount) public {
298299
require(isRedeemable(_erc20Addr), "Token not eligible");
299300

300301
IERC20(_erc20Addr).safeTransferFrom(msg.sender, address(this), _amount);
301302
balances[msg.sender][_erc20Addr] += _amount;
302303
}
303304

304-
// @description redeems an amount of NCT / BCT for TCO2
305-
// @param _fromToken could be the address of NCT or BCT
306-
// @param _amount amount to redeem
307-
// @notice needs to be approved on the client side
308-
// @returns 2 arrays, one containing the tco2s that were redeemed and another the amounts
305+
/// @notice redeems an amount of NCT / BCT for TCO2
306+
/// @param _fromToken could be the address of NCT or BCT
307+
/// @param _amount amount to redeem
308+
/// @notice needs to be approved on the client side
309+
/// @return tco2s an array of the tco2 addresses that were redeemed
310+
/// @return amounts an array of the amounts of each tco2s that were redeemed
309311
function autoRedeem(address _fromToken, uint256 _amount)
310312
public
311313
returns (address[] memory tco2s, uint256[] memory amounts)
@@ -333,8 +335,8 @@ contract OffsetHelper is OffsetHelperStorage {
333335
emit Redeemed(msg.sender, _fromToken, tco2s, amounts);
334336
}
335337

336-
// @param _tco2s the addresses of the TCO2s to retire
337-
// @param _amounts the amounts to retire from the matching TCO2
338+
/// @param _tco2s the addresses of the TCO2s to retire
339+
/// @param _amounts the amounts to retire from the matching TCO2
338340
function autoRetire(address[] memory _tco2s, uint256[] memory _amounts)
339341
public
340342
{
@@ -364,18 +366,18 @@ contract OffsetHelper is OffsetHelperStorage {
364366
// Admin methods
365367
// ----------------------------------------
366368

367-
// @description you can use this to change or add eligible tokens and their addresses if needed
368-
// @param _tokenSymbol symbol of the token to add
369-
// @param _address the address of the token to add
369+
/// @notice you can use this to change or add eligible tokens and their addresses if needed
370+
/// @param _tokenSymbol symbol of the token to add
371+
/// @param _address the address of the token to add
370372
function setEligibleTokenAddress(
371373
string memory _tokenSymbol,
372374
address _address
373375
) public virtual onlyOwner {
374376
eligibleTokenAddresses[_tokenSymbol] = _address;
375377
}
376378

377-
// @description you can use this to delete eligible tokens if needed
378-
// @param _tokenSymbol symbol of the token to add
379+
/// @notice you can use this to delete eligible tokens if needed
380+
/// @param _tokenSymbol symbol of the token to add
379381
function deleteEligibleTokenAddress(string memory _tokenSymbol)
380382
public
381383
virtual
@@ -384,8 +386,8 @@ contract OffsetHelper is OffsetHelperStorage {
384386
delete eligibleTokenAddresses[_tokenSymbol];
385387
}
386388

387-
// @description you can use this to change the TCO2 contracts registry if needed
388-
// @param _address the contract registry to use
389+
/// @notice you can use this to change the TCO2 contracts registry if needed
390+
/// @param _address the contract registry to use
389391
function setToucanContractRegistry(address _address)
390392
public
391393
virtual

0 commit comments

Comments
 (0)