-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add payment contract functions - deploy and show #91
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, other than allowing shares to be non integer strings. Not sure how much input validation do we need on these contracts
* @param {string} addresses : list of stakeholder addresses | ||
* @param {string} shares: list of stakeholder shares, in the order of addresses | ||
*/ | ||
async PaymentDeploy({ addresses, shares }){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the contract check for bad share values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the checks done in constructor:
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added validation for addresses and shares (integers)
As a tenant, create a payment contract for revenue splits.
At creation - specify the list of stakeholders: an array of addresses and a corresponding array of shares.
Shares are integers and represent proportions so they don't need to, for example, add up to 100 (but they can, for simplicity).
Examples:
Create a payment contract
Show status of payment contract and stakeholders
Follow up items (can be done as separate PRs)