Undercollateral Borrow against Future Salaries

The problem solves

Salaried - Project for Polygon Fellowship'22, a brief overview : A Payment Streams Tooling for DAOs/Orgs to stream salaries in ERC20 tokens over a period of time and allowing recipients to borrow under-collateral loans against upcoming salary.
The ERC20 Token streaming is based on the EIP1620, the tokens don't really get transferred to wallet in realtime, rather locked in the contract and calculated the withdrawal amount calculating rate and time locked.

🔷 How Salaried is different from Sablier and Superfluid ?

  1. First and foremost distinction is that it does not use wrapped super tokens.
  2. Unlike both of the protocols, Salaried maintains an intermediary vault which stores the lump sum coming from DAOs/Orgs.
    Tokens are locked which ensures that the stream remains on inspite of sender's default. Unlocking can only occur is case of stopped streams or updation.
  3. Transfer tokens to others directly from the stream without transferring to wallet. Such tx are stored in Salaried Activity Log to detect the sender details.

🔷How borrowing against salary work ?
The Loan contract detects the stream amount left, depending on that user can lend tokens from the AMM for the time period <= stream period.Repayment is calculated in this way, Borrow amount + Interest should be less that Stream Amount left for the user. It prevents overflowing streams or full liquidation of the pool.

Once the lending is done, the stream is directed towards the pool to fill it up,within the repayment period. Lenders are at negligible risk since the Vault has locked tokens which can be liquidated at any situation, even if the recipient's stream is updated or stopped.The Interest earned id distributed among the liquidity providers, DAOs/Orgs and the protocol itself. DAOs/Orgs are incentivised so that crypto payments shift more towards streams and also test practicality of under-collateral lending .

Challenges I ran into

The biggest challenge as to now was to work on EIP1620 and create the ERC20 streaming contract.