Code Monkey home page Code Monkey logo

payroll-app's Introduction

Payroll

Original code: aragon-apps/apps/payroll

The purpose of the Payroll app is to implement a Payroll system in base asset, equity asset or a mix of both.

๐Ÿฒ Project Stage: development

The Payroll app is still in development. If you are interested in contributing please see our open issues.

๐Ÿšจ Security Review Status: pre-audit

The code in this repository has not been audited.

How to run Payroll app locally

To use this Aragon application, set it up using a tokens and finance app using:

yarn install
yarn start

If everything is working correctly, your new DAO will be deployed and your browser will open http://localhost:3000/#/YOUR-DAO-ADDRESS.

Initialization

Initializing a Payroll app requires the following parameters:

  • Finance: A reference to Finance instance that Payroll app will use to pay salaries. Finance in turn will use Vault to access funds, but going through Finance will have everything properly accounted for.
  • Denomination token: Address of the denomination token used for salary accounting
  • Equity token manager: A reference to the installed Tokens app instance this Payroll app will rely on for equity payments.
  • Vesting length: The length of vestings in seconds, the time when vestings can be completely claimed. Set to 0 to disable vestings
  • Vesting cliff length: The vesting cliff in seconds, the time until which vestings cannot be claimed
  • Vesting revokable: Whether vestings can be revoked

Employees will be able to choose payment in denomination token, equity token or a mix of both. Equity payments are a multiple of the base currency amount which is defined by the equity multiplier. Equity payments can also be vested by enabling vestings.

Lifecycle

Add employee

Three options can be used:

payroll.addEmployee(address _accountAddress, uint256 _initialDenominationSalary,  uint64 _startDate, string _role)

Add employee to the organization. Start date is used as the initial payment day. It needs ADD_EMPLOYEE_ROLE.

Modify employee salary

payroll.setEmployeeSalary(uint256 _employeeId, uint256 _denominationSalary)

It needs SET_EMPLOYEE_SALARY_ROLE.

Terminate employee

payroll.terminateEmployee(uint256 _employeeId, uint64 _endDate)

Remove employee from organization. Owed salary will accrue until termination date. It needs TERMINATE_EMPLOYEE_ROLE.

Request payroll

payroll.payday(uint256 _denominationTokenAllocation, int256 _requestedAmount, string _metaData)

Employees can request payroll whenever they want and the proportional amount of their anual salary since the last request (or since the start date if it's the first one) will be transferred. Employees can choose to receive payment in base asset (denomination token), equity asset, or a mix of both. _denominationTokenAllocation determines the % of base asset payment from the total owed and the remaining will be paid in equity asset. The equity token payment is relative to the base asset payment and is defined by the equity multiplier. E.g If an employee has a salary of 1000 DAI and the multiplier is 4x then they can mint up to 4000 of the equity asset per period.

Change account address

payroll.changeAddressByEmployee(address _newAccountAddress)

Employees can change their own address.

Caveats

  • Requesting any salary under the total available will forfeit the remainder.
  • If there are not enough funds in the orgs vault for the denomination token, payday will fail.
  • For equity payments with vestings: If the tokens app holds less tokens than requested equity amount, payday will fail.

Contributing

We welcome community contributions!

Please check out our open Issues to get started.

If you discover something that could potentially impact security, please notify us immediately. The quickest way to reach us is via the #payroll channel in our team Keybase chat. Just say hi and that you discovered a potential security vulnerability and we'll DM you to discuss details.

payroll-app's People

Contributors

0xgabi avatar bingen avatar bpierre avatar crisog avatar danielcaballero avatar fabriziovigevani avatar facuspagnuolo avatar izqui avatar kernelwhisperer avatar kyrrui avatar lmcorbalan avatar rperez89 avatar sembrestels avatar sistemico avatar sohkai avatar willjgriff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

payroll-app's Issues

Request salary panel: Take into account the vesting counter

Screen Shot 2020-04-08 at 8.03.03 PM.png

Right now we have this beautiful design but if the payroll is configured to work with vestings we need to have a way to display to the user the remaining vestings that he will be able to do with the address provided.

Once the address reach to 50 vestings we need to disable the possibility to choose equity token for the payroll and let the user know that if he wants to be able to be paid with equity token again he needs to change their address.

Also we need to display here the max amount available to be requested and let the employee choose if he wants to request all the amount or less.

Thoughts on "equivalent compensation" through the lens of Payroll + Redemptions

Payroll Functionality

Payroll provides an intuitive way for an organization to bootstrap when capital and/or cashflow is limited. Members who are added to payroll are assigned a rate in terms of a base, cash-like asset such as dai and then are able to withdraw that amount of the cash-like asset or instead opt for deferred compensation in the form of an organization's native token or reputation (subject to vesting) per period.

The offered rate for deferred compensation is always a multiple of the base amount and it can be a fixed value updated by the organization periodically.

Redemptions

Redemptions allows for holders of an organization's native token or reputation, which has been fully vested to burn it in exchange for a proportional share of assets held by the organization.

Weird interactions and intuitions about multipliers

A member holding fully vested tokens or reputation may choose to redeem their tokens or reputation for a proportional share of the organizations current assets.

Then if they are currently on payroll they may opt to receive new tokens or reputation (subject to vesting) instead of cash. This is a weird interaction because it is both removing cash and or other assets from the organization, while at the same time deferring a cash payment in order to bet on the future value of the organization.

With both redemptions and payroll installed in an organization there becomes a clear relationship between how the organization's members value the expected future potential of the organization and that provides an interesting lens to evaluating deferred compensation and multiplier policies.

When an organization holds only the base payroll asset

If the base payroll asset is the only redeemable asset understanding it becomes fairly intuitive to think about deferred compensation and parameterizing the multiplier.

We can assume that current value of tokens or reputation must be equal to or greater than their current redemption value. The premium between the current redemption value will be due to speculation, and each individual may have a different valuation model and reach different valuations leading to different preferences for cash versus deferred compensation.

However, if the multiplier is set such that current redemption value is greater for the deferred compensation model than the multiplier should almost certainly be reduced, potentially even bellow 1.

When an organization holds other assets besides dai

If an organization is holding other assets besides dai, perhaps ETH, ANT, Chai, or cDAI. The intuition is the same, but it is important to consider the value of all redeemable assets relative to the payroll's base asset and multiplier.

Considering vesting restrictions

If vesting restrictions are applied to deferred compensation (they likely should be), the option to defer compensation clearly becomes more risky than if those assets could be sold or redeemed immediately.

If tokens can be redeemed for 100 dollars today, but cannot be redeemed or sold until they have vested, then by the time they are vested they could easily be worth 50 or even 0. So if you are offered a 100 dollars today, you might find it would take the equivalent of 200 dollars worth of tokens subject to vesting restrictions at present value to be considered equivalent compensation.

When should an organization offer deferred compensation

When an organization is bootstrapping it does not necessarily have much or potentially any cash on hand. In these cases in order to incentivize contributors it must be able to offer deferred compensation, and likely the multiplier between a hypothetical cash payment and and deferred compensation should be relatively high, as the success of the organization and future revenue potential is completely un-proven. Contributors are allocating their time to the project and potentially forgoing other opportunities to exchange that time for cash to do so, providing a high multiple during this phase makes sense.

After an organization has established a product and is producing stable revenue it is much less clear whether deferred compensation should be offered at all, let alone at a multiple greater than one. When an organization can pay market rates, and the members of the organization believe that the value of the organization will grow in the future then they may not want to allow themselves to be diluted at all.

However, in some cases even stable organizations that can afford to pay market rates to compensate workers would like to offer a deferred compensation option because workers who are also owners tend to be more effective and more aligned with the long term interests of the organization as a whole. In these cases it may make sense to offer deferred compensation (subject to vesting) at multiples close to one, and If the organization uses reputation and therefore not possible to simply use cash for to acquire a stake in the organization it may even make sense to use multiples less than one.

Background script: Handle terminated users

Currently the background script fetches employees data on every update event (e.g add employee accrued salary, change employee salary, etc). There is the problem where if users are terminated and do their last payday, the employee record is deleted from the contract.

This means we shouldn't rely on contract calls for fetching employees data but to use the logged data from events to perform state updates.

New design for team key stats

Since we are not using anymore the USD , we need to create a new component that displays the stats for the payment token and the equity

Specification: Support Minting Tokens

A more interesting case for wanting to give users an option between receiving their payroll in different assets is the distinction between "cash" and "equity", where a user may opt to receive a portion of their agreed upon salary as tokens/rep/equity.

Unlike receiving different capital assets this provides a relatively unique benefit for both the organization and the user. For early stage organization there may be relatively little cash on hand, but the organization can negotiate a market based compensation arrangement and the user can receive equity at a fixed (or dynamic) rate.

This helps organizations bootstrap, while being fair and equitable to contributors who are forgoing a fair market salary.

Unlike #1 this option would not require pricefeeds as token option can be priced relative to the base currency as it does not itself have a fair market value.

  • An organization should be able to adjust the multipliers or turn off the option via a role.
  • The rate offered for minting tokens is relative to the base currency amount, and would be a multiplier. eg if the user has a salary of 100DAI and the multiplier is 4x they can mint up to 400 of the equity asset per period.
  • The multiplier is fixed and can be updated with a role.

UI modernization

Continue modernization begun in #9:

  • Modernize tables (use DataView)
  • Modernize filters (use DateRangePicker and others)
  • Modernize Transaction label (use TransactionBadge)

UI suggestions.

Request Salary side panel

New Employee side panel

  • Change "Salary" to "Yearly Salary"

  • Again could the radspec definition be updated to calculate the amount of the yearly salary or is it not possible? It could read "salary of 10000 DAI per year" instead of "salary of 0.0123 DAI per second".

Edit Equity Option side panel

  • Edit Equity Option side panel could do with an info panel like title "Action" description "Update the equity options which are applied for each equity request. Including the multiplier which is against the base asset.

  • Also in the radspec, the % sign comes after the value not before (guess it's different in other languages though).

Elsewhere

  • In the My Payroll tab -> Previous Salary table could we include the amount of the equity token transferred too? I'm pretty sure it's in the event.

  • I see there's no way to terminate an employee, I don't know if this is necessary but imagine it should be available on the UI. Has it been discussed?

My Payroll - My salary chart

Use the new aragon ui chart component in order to represent the salary earned both: base token and equity token.

chart component

we need to use the same existing calculation on the base token for the equity token

Code Cleanup

Remove unnecessary code from the smart contract that is not going to be used like Price oracle and the multi currency payment support

Add new Employee/Entity

We need design for the new form (we are not going to ask for the name)

We also need to do a refactor for this screen since is using an old React version and as we touch components will be good to do a cleanup and stick to the 1hive-aragon new coding styles.

  • designs changes needed #30 and #31
  • add removed validations on #15

Specification: Remove multiple currency option

One of the biggest sources of complexity in the payroll app is enabling employees to choose which asset or mix of assets they want to accept each period. This requires relying on a price oracle for each asset and imposes an unnecessary treasury management / budgeting challenge on the organization.

Rather than allow users to select from eligible assets we should simply things by only supporting a single asset.

Payday: Reset to 0 the accrual balance if employee request a partial payout

When withdrawing salary, the employee need to be able to specify some fraction of the total balance that has accrued in base asset. (eg I've negotiated a rate of 50 dai an hour, I worked 10 hours since last time I request pay, I will request only 500 dai, even if if I technically have permission to withdraw more than that).

So basically we are going to trust on the employees that they are not requesting more than what they should do and if that behaviour is detected the org can take some action against the employee

So in order to allow the employee request less than the max amount accrued we are going to reset the accrued balance as if the employee had withdrawn the full amount.

If for some reason the employee by mistake select less than it should be that needs to be handled within the org members in another way (like a finance transfer)

Design: Small changes accross the app

  • My payroll: Dataview - remove trx and add it to the action buttons

  • My payroll: Dataview - remove status

  • Team payroll: Remove salary burn rate widget

  • Team payroll: Remove action buttons from dataview

Vesting configuration for equity assets

When someone opts to receive tokens or reputation instead of a cash payment, they are generally making a bet on the future value of those tokens or reputation. For the organization they are being diluted in exchange for avoiding an immediate cash payment.

In cases where tokens are liquid or even redeemable (eg via redemptions app) this option becomes extremely favorable for the person making the choice as opposed to the organization making the offer. In order to make the dynamic more interesting for the an organization, we should enable the organization to impose vesting restrictions that prevent the tokens/reputation from being sold or redeemed for some period of time after the grant.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.