@@ -59,7 +59,7 @@ contract WAMPL is ERC20, ERC20Permit {
59
59
/// @notice Transfers AMPLs from {msg.sender} and mints wAMPLs.
60
60
///
61
61
/// @param amples The amount of AMPLs to deposit.
62
- /// @return The number of wAMPLs minted.
62
+ /// @return The amount of wAMPLs minted.
63
63
function deposit (uint256 amples ) external returns (uint256 ) {
64
64
uint256 wamples = _ampleToWample (amples, _queryAMPLSupply ());
65
65
@@ -75,7 +75,7 @@ contract WAMPL is ERC20, ERC20Permit {
75
75
///
76
76
/// @param to The beneficiary wallet.
77
77
/// @param amples The amount of AMPLs to deposit.
78
- /// @return The number of wAMPLs minted.
78
+ /// @return The amount of wAMPLs minted.
79
79
function depositFor (address to , uint256 amples ) external returns (uint256 ) {
80
80
uint256 wamples = _ampleToWample (amples, _queryAMPLSupply ());
81
81
@@ -89,7 +89,7 @@ contract WAMPL is ERC20, ERC20Permit {
89
89
/// @notice Burns wAMPLs from {msg.sender} and transfers AMPLs back.
90
90
///
91
91
/// @param amples The amount of AMPLs to withdraw.
92
- /// @return The number of burnt wAMPLs.
92
+ /// @return The amount of burnt wAMPLs.
93
93
function withdraw (uint256 amples ) external returns (uint256 ) {
94
94
uint256 wamples = _ampleToWample (amples, _queryAMPLSupply ());
95
95
@@ -105,7 +105,7 @@ contract WAMPL is ERC20, ERC20Permit {
105
105
///
106
106
/// @param to The beneficiary wallet.
107
107
/// @param amples The amount of AMPLs to withdraw.
108
- /// @return The number of burnt wAMPLs.
108
+ /// @return The amount of burnt wAMPLs.
109
109
function withdrawTo (address to , uint256 amples ) external returns (uint256 ) {
110
110
uint256 wamples = _ampleToWample (amples, _queryAMPLSupply ());
111
111
@@ -118,7 +118,7 @@ contract WAMPL is ERC20, ERC20Permit {
118
118
119
119
/// @notice Burns all wAMPLs from {msg.sender} and transfers AMPLs back.
120
120
///
121
- /// @return The number of burnt wAMPLs.
121
+ /// @return The amount of burnt wAMPLs.
122
122
function withdrawAll () external returns (uint256 ) {
123
123
uint256 wamples = balanceOf (_msgSender ());
124
124
@@ -135,7 +135,7 @@ contract WAMPL is ERC20, ERC20Permit {
135
135
/// to the specified beneficiary.
136
136
///
137
137
/// @param to The beneficiary wallet.
138
- /// @return The number of burnt wAMPLs.
138
+ /// @return The amount of burnt wAMPLs.
139
139
function withdrawAllTo (address to ) external returns (uint256 ) {
140
140
uint256 wamples = balanceOf (_msgSender ());
141
141
@@ -148,6 +148,66 @@ contract WAMPL is ERC20, ERC20Permit {
148
148
return wamples;
149
149
}
150
150
151
+ /// @notice Transfers AMPLs from {msg.sender} and mints wAMPLs.
152
+ ///
153
+ /// @param wamples The amount of wAMPLs to mint.
154
+ /// @return The amount of AMPLs deposited.
155
+ function mint (uint256 wamples ) external returns (uint256 ) {
156
+ uint256 amples = _wampleToAmple (wamples, _queryAMPLSupply ());
157
+
158
+ IERC20 (_ampl).safeTransferFrom (_msgSender (), address (this ), amples);
159
+
160
+ _mint (_msgSender (), wamples);
161
+
162
+ return amples;
163
+ }
164
+
165
+ /// @notice Transfers AMPLs from {msg.sender} and mints wAMPLs,
166
+ /// to the specified beneficiary.
167
+ ///
168
+ /// @param to The beneficiary wallet.
169
+ /// @param wamples The amount of wAMPLs to mint.
170
+ /// @return The amount of AMPLs deposited.
171
+ function mintTo (address to , uint256 wamples ) external returns (uint256 ) {
172
+ uint256 amples = _wampleToAmple (wamples, _queryAMPLSupply ());
173
+
174
+ IERC20 (_ampl).safeTransferFrom (_msgSender (), address (this ), amples);
175
+
176
+ _mint (to, wamples);
177
+
178
+ return amples;
179
+ }
180
+
181
+ /// @notice Burns wAMPLs from {msg.sender} and transfers AMPLs back.
182
+ ///
183
+ /// @param wamples The amount of wAMPLs to burn.
184
+ /// @return The amount of AMPLs withdrawn.
185
+ function burn (uint256 wamples ) external returns (uint256 ) {
186
+ uint256 amples = _wampleToAmple (wamples, _queryAMPLSupply ());
187
+
188
+ _burn (_msgSender (), wamples);
189
+
190
+ IERC20 (_ampl).safeTransfer (_msgSender (), amples);
191
+
192
+ return amples;
193
+ }
194
+
195
+ /// @notice Burns wAMPLs from {msg.sender} and transfers AMPLs back,
196
+ /// to the specified beneficiary.
197
+ ///
198
+ /// @param to The beneficiary wallet.
199
+ /// @param wamples The amount of wAMPLs to burn.
200
+ /// @return The amount of AMPLs withdrawn.
201
+ function burnTo (address to , uint256 wamples ) external returns (uint256 ) {
202
+ uint256 amples = _wampleToAmple (wamples, _queryAMPLSupply ());
203
+
204
+ _burn (_msgSender (), wamples);
205
+
206
+ IERC20 (_ampl).safeTransfer (to, amples);
207
+
208
+ return amples;
209
+ }
210
+
151
211
//--------------------------------------------------------------------------
152
212
// WAMPL view methods
153
213
0 commit comments