Closed auryn-macmillan closed 3 years ago
Will definitely explore this possibility. This is a great idea @auryn-macmillan !
That sounds pretty awesome @auryn-macmillan, we would be glad to help you integrate Superfluid. @santisiri join our Discord so we can talk about it.
Working my way through the documentation to test superTokens
.. stuck here for time being: https://github.com/superfluid-finance/protocol-monorepo/issues/230
I see on Discord that you and our champion @pi0neerpat are on it, shout if you have any issues.
Been testing this out and looking at the contracts. Since we know that our ubi
contract can mint tokens throughout time to valid identities, been thinking we could simply implement the functionality related to realtimeBalanceOf
:
function balanceOf(
address account
)
public
view
override
returns(uint256 balance)
{
// solhint-disable-next-line not-rely-on-time
(int256 availableBalance, , ) = super.realtimeBalanceOf(account, block.timestamp);
return availableBalance < 0 ? 0 : uint256(availableBalance);
}
Though for this I'd like to have a clearer picture for security precautions we need to consider. Probably making this optional on a first version makes sense cc @epiqueras.
Implemented a very simple version that directly displays accrued value on balanceOf
— pull available here: https://github.com/DemocracyEarth/ubi/pull/73
eppur si muove: https://twitter.com/santisiri/status/1363503509145079811
thanks for pushing me in this direction @auryn-macmillan !
This is awesome!
Feature implemented, audited and tested. Closing.
The current token design requires humans to call
mintAccrued(address human)
any time they want to claim their outstanding UBI balance. With the current gas price swings, that transaction is likely to cost tens to hundreds of dollars.An alternate option is to have the ERC20
balanceOf()
be a computed variable, based on incoming and outgoing streams to the address. Superfluid has built out this functionality already, so implementing this would be really simple.