Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ETH and multiple ERC20 payment support #56

Merged
merged 9 commits into from
Apr 20, 2021
Merged

Conversation

aaitor
Copy link
Member

@aaitor aaitor commented Apr 16, 2021

Description

Adding ETH and multiple ERC20 support for payment in Lock and Reward payment conditions

Is this PR related with an open issue?

Related to Issue #

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Follows the code style of this project.
  • Tests Cover Changes
  • Documentation

@aaitor aaitor changed the title Updating documentation Adding ETH and multiple ERC20 payment support Apr 16, 2021
@aaitor aaitor linked an issue Apr 16, 2021 that may be closed by this pull request
2 tasks
@aaitor aaitor marked this pull request as ready for review April 19, 2021 15:48
@aaitor aaitor requested review from a team as code owners April 19, 2021 15:48
@aaitor aaitor requested a review from mrsmkl April 19, 2021 15:48
)
internal
{
_rewardAddress.transfer(_amount);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the idea is that this contract (LockPaymentCondition) generally doesn't have any ETH, but when fulfill is called then it should have the necessary funds to transfer to rewardAddress (msg.value).

Copy link
Member Author

Choose a reason for hiding this comment

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

ya, LockPaymentCondition doesn't have funds and when the user execute the fulfill it locks the funds in the _rewardAddress, typically the EscrowPaymentCondition.address

);
(bool sent,) = _receivers[i].call{value: _amounts[i]}("");
require(sent, "Failed to send Ether");
// _receivers[i].transfer(_amounts[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably best to decide which one to use (for transferring ETH), and then use it here and LockPaymentCondition too.

Copy link
Member Author

Choose a reason for hiding this comment

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

The payment flow support distribute multiple rewards (_amounts) to multiple addresses (receivers). So the fulfill condition do the transfers using the previously locked funds by the user in the contract using the LockPaymentCondition.

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -21,6 +21,7 @@ import '../ConditionStoreLibrary.sol';
*/
contract EscrowReward is Reward {
Copy link
Member

@r-marques r-marques Apr 19, 2021

Choose a reason for hiding this comment

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

Any reason to still keep the EscrowReward condition since it was replaced by EscrowPayment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I agree we should remove some stuff. I think I will open an issue to deprecate this and some other stuff as part of a different PR.

Copy link
Member

@r-marques r-marques left a comment

Choose a reason for hiding this comment

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

lgtm

@aaitor aaitor merged commit 3c288e2 into master Apr 20, 2021
@aaitor aaitor deleted the feature/eth_payment branch April 20, 2021 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Makes more flexible to Service Agreements payment supporting ETH and multiple ERC20
3 participants