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: enable one time payments with single address (#1)
- Loading branch information
Showing
5 changed files
with
79 additions
and
40 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,20 +1,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.26; | ||
|
||
import {console} from "forge-std/console.sol"; | ||
Check warning on line 4 in src/contracts/OneTime.sol GitHub Actions / Lint Commit Messages
|
||
import {IERC20} from "forge-std/interfaces/IERC20.sol"; | ||
import {IGrateful} from "interfaces/IGrateful.sol"; | ||
|
||
contract OneTime { | ||
constructor( | ||
IGrateful _grateful, | ||
IERC20 _token, | ||
address[] memory _tokens, | ||
address _merchant, | ||
uint256 _amount, | ||
uint256 _paymentId, | ||
address[] memory _recipients, | ||
uint256[] memory _percentages | ||
) { | ||
_token.approve(address(_grateful), _amount); | ||
_grateful.receiveOneTimePayment(_merchant, address(_token), _paymentId, _amount, _recipients, _percentages); | ||
for (uint256 i = 0; i < _tokens.length; i++) { | ||
IERC20 token = IERC20(_tokens[i]); | ||
if (token.balanceOf(address(this)) >= _amount) { | ||
token.approve(address(_grateful), _amount); | ||
_grateful.receiveOneTimePayment(_merchant, address(token), _paymentId, _amount, _recipients, _percentages); | ||
} | ||
} | ||
} | ||
} |
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