Skip to content

Implement _drawFunds #18

@EGreg

Description

@EGreg

if pay() or claim() is called, passes the checks, and IncomeContract doesnt have enough funds in the balance to honor it, then it should try calling _drawFunds(amount).

That function will call TradedToken(token).claim(amount) to transfer the ITR token from a liquidity pool like USDC-ITR to the IncomeContract itself. This may cause a gradual lock to be placed on IncomeContract to maintain a minimum, but let’s assume that the lockup period is 0. I looked up TradedToken and I see now that it already adds a gradual minimum to any manager who calls claim(). So a recipient wouldn’t be able to transfer any tokens right after claim, unless the lockup period was 0.

If lockup prevents a token transfer, the call to transfer tokens would fail and you should revert with that exception message !

Also if claim() fails then the pay() or claim() should revert as we have now, with error InsufficientBalance().

It might call _drawFunds for every call to pay() or claim() of UBI. The situation may change later when someone transfers a lot more ITR to the IncomeContract.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions