1
1
/**
2
2
* https://contributing.kleros.io/smart-contract-workflow
3
3
* @authors: [@fnanni-0]
4
- * @reviewers: [@unknownunknown1, @MerlinEgalite, @hbarcelos* , @shalzz]
4
+ * @reviewers: [@unknownunknown1, @MerlinEgalite, @hbarcelos, @shalzz]
5
5
* @auditors: []
6
6
* @bounties: []
7
7
* @deployments: []
@@ -119,7 +119,7 @@ contract WrappedPinakion is Initializable {
119
119
* someone invoking `relayTokensAndCall()` on the Foreign bridge contract.
120
120
* @param _token The token address the _amount belongs to.
121
121
* @param _amount The amount of wrapped PNK to mint.
122
- * @param _data Calldata containing the address of the recipient.
122
+ * @param _data Calldata containing the address of the recipient.
123
123
* Notice that the address has to be padded to the right 32 bytes.
124
124
*/
125
125
function onTokenBridged (
@@ -165,10 +165,14 @@ contract WrappedPinakion is Initializable {
165
165
* @notice Moves `_amount` tokens from the caller's account to `_recipient`.
166
166
* @param _recipient The entity receiving the funds.
167
167
* @param _amount The amount to tranfer in base units.
168
+ * @return True on success.
168
169
*/
169
170
function transfer (address _recipient , uint256 _amount ) public returns (bool ) {
170
171
if (isContract (controller)) {
171
- require (TokenController (controller).onTransfer (msg .sender , _recipient, _amount));
172
+ require (
173
+ TokenController (controller).onTransfer (msg .sender , _recipient, _amount),
174
+ "Token controller rejects transfer. "
175
+ );
172
176
}
173
177
balances[msg .sender ] = balances[msg .sender ].sub (_amount); // ERC20: transfer amount exceeds balance
174
178
balances[_recipient] = balances[_recipient].add (_amount);
@@ -182,14 +186,18 @@ contract WrappedPinakion is Initializable {
182
186
* @param _sender The entity to take the funds from.
183
187
* @param _recipient The entity receiving the funds.
184
188
* @param _amount The amount to tranfer in base units.
189
+ * @return True on success.
185
190
*/
186
191
function transferFrom (
187
192
address _sender ,
188
193
address _recipient ,
189
194
uint256 _amount
190
195
) public returns (bool ) {
191
196
if (isContract (controller)) {
192
- require (TokenController (controller).onTransfer (_sender, _recipient, _amount));
197
+ require (
198
+ TokenController (controller).onTransfer (_sender, _recipient, _amount),
199
+ "Token controller rejects transfer. "
200
+ );
193
201
}
194
202
195
203
/** The controller of this contract can move tokens around at will,
@@ -211,6 +219,7 @@ contract WrappedPinakion is Initializable {
211
219
* @notice Approves `_spender` to spend `_amount`.
212
220
* @param _spender The entity allowed to spend funds.
213
221
* @param _amount The amount of base units the entity will be allowed to spend.
222
+ * @return True on success.
214
223
*/
215
224
function approve (address _spender , uint256 _amount ) public returns (bool ) {
216
225
// Alerts the token controller of the approve function call
@@ -230,6 +239,7 @@ contract WrappedPinakion is Initializable {
230
239
* @notice Increases the `_spender` allowance by `_addedValue`.
231
240
* @param _spender The entity allowed to spend funds.
232
241
* @param _addedValue The amount of extra base units the entity will be allowed to spend.
242
+ * @return True on success.
233
243
*/
234
244
function increaseAllowance (address _spender , uint256 _addedValue ) public returns (bool ) {
235
245
uint256 newAllowance = allowance[msg .sender ][_spender].add (_addedValue);
@@ -250,6 +260,7 @@ contract WrappedPinakion is Initializable {
250
260
* @notice Decreases the `_spender` allowance by `_subtractedValue`.
251
261
* @param _spender The entity whose spending allocation will be reduced.
252
262
* @param _subtractedValue The reduction of spending allocation in base units.
263
+ * @return True on success.
253
264
*/
254
265
function decreaseAllowance (address _spender , uint256 _subtractedValue ) public returns (bool ) {
255
266
uint256 newAllowance = allowance[msg .sender ][_spender].sub (_subtractedValue); // ERC20: decreased allowance below zero
@@ -287,7 +298,10 @@ contract WrappedPinakion is Initializable {
287
298
*/
288
299
function _burn (uint256 _amount ) internal {
289
300
if (isContract (controller)) {
290
- require (TokenController (controller).onTransfer (msg .sender , address (0x0 ), _amount));
301
+ require (
302
+ TokenController (controller).onTransfer (msg .sender , address (0x0 ), _amount),
303
+ "Token controller rejects transfer. "
304
+ );
291
305
}
292
306
balances[msg .sender ] = balances[msg .sender ].sub (_amount); // ERC20: burn amount exceeds balance
293
307
totalSupply = totalSupply.sub (_amount);
0 commit comments