generated from defi-wonderland/solidity-foundry-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add counterfactual one time interaction with grateful contract
- Loading branch information
Showing
4 changed files
with
92 additions
and
29 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
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 |
---|---|---|
@@ -1,19 +1,9 @@ | ||
import {IERC20} from "forge-std/interfaces/IERC20.sol"; | ||
import {IGrateful} from "interfaces/IGrateful.sol"; | ||
|
||
contract OneTime { | ||
IERC20 public token; | ||
address public merchant; | ||
uint256 public amount; | ||
bool public paid; | ||
|
||
constructor(IERC20 _token, address _merchant, uint256 _amount) { | ||
token = _token; | ||
merchant = _merchant; | ||
amount = _amount; | ||
} | ||
|
||
function processPayment() public { | ||
paid = true; | ||
token.transfer(merchant, amount); | ||
constructor(IGrateful _grateful, IERC20 _token, address _merchant, uint256 _amount, uint256 _paymentId) { | ||
_token.approve(address(_grateful), _amount); | ||
_grateful.receiveOneTimePayment(_merchant, address(_token), _paymentId, _amount); | ||
} | ||
} |
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