Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

ApproveAndCall return values #527

Merged
merged 5 commits into from
Mar 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion implementation/contracts/system/TBTCDepositToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ contract TBTCDepositToken is ERC721Metadata, DepositFactoryAuthority {
/// @param _spender Address of contract authorized to spend.
/// @param _tdtId The TDT they can spend.
/// @param _extraData Extra information to send to the approved contract.
function approveAndCall(address _spender, uint256 _tdtId, bytes memory _extraData) public returns (bool success) {
function approveAndCall(address _spender, uint256 _tdtId, bytes memory _extraData) public returns (bool) {
tokenRecipient spender = tokenRecipient(_spender);
approve(_spender, _tdtId);
spender.receiveApproval(msg.sender, _tdtId, address(this), _extraData);
return true;
}
}

Expand Down
3 changes: 2 additions & 1 deletion implementation/contracts/system/TBTCToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ contract TBTCToken is ERC20Detailed, ERC20, VendingMachineAuthority {
/// @param _spender Address of contract authorized to spend.
/// @param _value The max amount they can spend.
/// @param _extraData Extra information to send to the approved contract.
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) {
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This structure seems different---do we need to introduce the same if (approve...) guard to the TDT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve() does not return bool for ERC721

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
}

Expand Down