-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for `approveAndCall`/`receiveApproval` pattern. The tBTC token contract that will be a staking token supports this pattern. To be able to stake in one transaction (instead of 2: approve + stake) we must implement the `RecieveApproval` interface. The token staking contract receives approval to spend tokens and create a stake for a given account.
- Loading branch information
1 parent
ad7fd74
commit 037bd19
Showing
4 changed files
with
104 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
/// @notice An interface that should be implemented by contracts supporting | ||
/// `approveAndCall`/`receiveApproval` pattern. | ||
interface IReceiveApproval { | ||
/// @notice Receives approval to spend tokens. Called as a result of | ||
/// `approveAndCall` call on the token. | ||
function receiveApproval( | ||
address from, | ||
uint256 amount, | ||
address token, | ||
bytes calldata extraData | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters