-
Notifications
You must be signed in to change notification settings - Fork 212
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
Payroll: Support employee's min acceptable exchange rates #904
Payroll: Support employee's min acceptable exchange rates #904
Conversation
21e067e
to
b4895d3
Compare
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.
Ahh, I think we may have miscommunicated a bit here.
What do you think about just adding the ability to specify a min rate in the payday()
function (and detecting if it's an empty array to signal there's no floor)?
I don't like the approach of including this at the token distribution level because it sets the min rate at the wrong time. In my mind, the purpose of this floor is to guarantee that you won't get screwed by an adverse change in the pricefeed when attempting to cash out. If you think the current exchange rate of a token is too high, you simply choose to not invoke payday()
:).
42ef977
to
4336506
Compare
b4895d3
to
408158a
Compare
@sohkai as discussed offline, I move forward with the idea of keeping a list of the tokens picked for payments per employee |
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 really like this approach for keeping the tokens per-employee rather than globally!
c8dee4d
to
f887e6d
Compare
…other internal view functions
* payroll: support min acceptable exchange rates * payroll: allow employees to specify acceptable rates * Payroll: revert bytecode-saving measures * Payroll: comment grammar * Payroll: rename employee variables to be more consistent * Payroll: add tests for returning allocation tokens for employees * payroll: organize some test scenarios * Payroll: reorganize ensureEmployeeTokenAllocationsIsValid to be with other internal view functions * chore: forward parameters in tests scripts * payroll: split CI tests task
Fixing finding 6.2 of the audit report
6.2 Employee should be able limit exchange rate
Description
An employee has no control over the exchange rate feed and there is (almost) no way to ensure that the payroll will not be transferred using very unfair rate.
Example
Just like when you trade on the exchange, you usually submit a maximum price for which you are willing to buy the tokens, any employee should also be able to limit losses from untrusted exchange rate feeds.
Remediation
Add the ability for an employee to submit minimal exchange rates that are acceptable for the payroll. This can be done by passing an array with minimal rates to
payday
function. If an employee does not want to pass the limit, it's possible to just send an empty array or array of zeros.