@@ -34,11 +34,12 @@ contract OffsetHelper is OffsetHelperStorage {
34
34
uint256 [] amounts
35
35
);
36
36
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
42
43
function autoOffsetUsingToken (
43
44
address _depositedToken ,
44
45
address _poolToken ,
@@ -54,9 +55,9 @@ contract OffsetHelper is OffsetHelperStorage {
54
55
autoRetire (tco2s, amounts);
55
56
}
56
57
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
60
61
function autoOffsetUsingETH (address _poolToken , uint256 _amountToOffset )
61
62
public
62
63
payable
@@ -72,9 +73,9 @@ contract OffsetHelper is OffsetHelperStorage {
72
73
autoRetire (tco2s, amounts);
73
74
}
74
75
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
78
79
function autoOffsetUsingPoolToken (
79
80
address _poolToken ,
80
81
uint256 _amountToOffset
@@ -90,7 +91,7 @@ contract OffsetHelper is OffsetHelperStorage {
90
91
}
91
92
92
93
// 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
94
95
function isEligible (address _erc20Address ) private view returns (bool ) {
95
96
bool isToucanContract = IToucanContractRegistry (contractRegistryAddress)
96
97
.checkERC20 (_erc20Address);
@@ -104,7 +105,7 @@ contract OffsetHelper is OffsetHelperStorage {
104
105
}
105
106
106
107
// 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
108
109
function isSwapable (address _erc20Address ) private view returns (bool ) {
109
110
if (_erc20Address == eligibleTokenAddresses["USDC " ]) return true ;
110
111
if (_erc20Address == eligibleTokenAddresses["WETH " ]) return true ;
@@ -113,18 +114,18 @@ contract OffsetHelper is OffsetHelperStorage {
113
114
}
114
115
115
116
// 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
117
118
function isRedeemable (address _erc20Address ) private view returns (bool ) {
118
119
if (_erc20Address == eligibleTokenAddresses["BCT " ]) return true ;
119
120
if (_erc20Address == eligibleTokenAddresses["NCT " ]) return true ;
120
121
return false ;
121
122
}
122
123
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
128
129
function calculateNeededTokenAmount (
129
130
address _fromToken ,
130
131
address _toToken ,
@@ -150,11 +151,11 @@ contract OffsetHelper is OffsetHelperStorage {
150
151
return amountsIn[0 ];
151
152
}
152
153
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
158
159
function swap (
159
160
address _fromToken ,
160
161
address _toToken ,
@@ -210,10 +211,10 @@ contract OffsetHelper is OffsetHelperStorage {
210
211
211
212
receive () external payable {}
212
213
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
217
218
function calculateNeededETHAmount (address _toToken , uint256 _amount )
218
219
public
219
220
view
@@ -236,10 +237,10 @@ contract OffsetHelper is OffsetHelperStorage {
236
237
return amounts[0 ];
237
238
}
238
239
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
243
244
function swap (address _toToken , uint256 _amount ) public payable {
244
245
// check tokens
245
246
require (isRedeemable (_toToken), "Token not eligible " );
@@ -281,7 +282,7 @@ contract OffsetHelper is OffsetHelperStorage {
281
282
balances[msg .sender ][path[2 ]] += _amount;
282
283
}
283
284
284
- // @description allow users to withdraw tokens they have deposited
285
+ /// @notice allow users to withdraw tokens they have deposited
285
286
function withdraw (address _erc20Addr , uint256 _amount ) public {
286
287
require (
287
288
balances[msg .sender ][_erc20Addr] >= _amount,
@@ -292,20 +293,21 @@ contract OffsetHelper is OffsetHelperStorage {
292
293
balances[msg .sender ][_erc20Addr] -= _amount;
293
294
}
294
295
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
297
298
function deposit (address _erc20Addr , uint256 _amount ) public {
298
299
require (isRedeemable (_erc20Addr), "Token not eligible " );
299
300
300
301
IERC20 (_erc20Addr).safeTransferFrom (msg .sender , address (this ), _amount);
301
302
balances[msg .sender ][_erc20Addr] += _amount;
302
303
}
303
304
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
309
311
function autoRedeem (address _fromToken , uint256 _amount )
310
312
public
311
313
returns (address [] memory tco2s , uint256 [] memory amounts )
@@ -333,8 +335,8 @@ contract OffsetHelper is OffsetHelperStorage {
333
335
emit Redeemed (msg .sender , _fromToken, tco2s, amounts);
334
336
}
335
337
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
338
340
function autoRetire (address [] memory _tco2s , uint256 [] memory _amounts )
339
341
public
340
342
{
@@ -364,18 +366,18 @@ contract OffsetHelper is OffsetHelperStorage {
364
366
// Admin methods
365
367
// ----------------------------------------
366
368
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
370
372
function setEligibleTokenAddress (
371
373
string memory _tokenSymbol ,
372
374
address _address
373
375
) public virtual onlyOwner {
374
376
eligibleTokenAddresses[_tokenSymbol] = _address;
375
377
}
376
378
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
379
381
function deleteEligibleTokenAddress (string memory _tokenSymbol )
380
382
public
381
383
virtual
@@ -384,8 +386,8 @@ contract OffsetHelper is OffsetHelperStorage {
384
386
delete eligibleTokenAddresses[_tokenSymbol];
385
387
}
386
388
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
389
391
function setToucanContractRegistry (address _address )
390
392
public
391
393
virtual
0 commit comments