Skip to content
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

[ETHEREUM-CONTRACTS] overhaul of SuperTokenV1Library & legacy lib deprecation #2032

Merged
merged 32 commits into from
Nov 22, 2024

Conversation

d10r
Copy link
Collaborator

@d10r d10r commented Oct 18, 2024

  • removed deprecated IDAv1Library
  • removed deprecated CFAv1Library
  • removed IDA functionality from SuperTokenV1Library
  • renamed GDA wrapper fn distributeToPool to distribute (name nomore occupied by IDA)
  • removed updateMemberUnits (and variants) because it doesn't belong to the token interface. (1)
  • added setCFAFlowRate and setCFAFlowRateFrom. Note that the naming differs from the setFlowrate in the CFA forwarder because of the changed context.
  • changed getFlowRate and getFlowInfo to be agreement independent
  • added agreement independent flowX and transferX, which abstract the receivers dimension (1:1 or 1:n) (2)
    image
  • refactored VestingSchedulerV2 and FlowScheduler to use SuperTokenV1Library instead of the deprecated CFAv1Library
  • removed deprecated VestingScheduler (v1)
  • bumped version of the scheduler package
  • added deprecation notice to IInstantDistributionAgreementV1
  • removed IDA tests from hotfuzz - removing IDA functionality from SuperTokenV1Library broke it and IDA is deprecated

Not done: renaming of SuperTokenV1Library to SuperTokenLib. Would cause too much breakage across repos and documentation to be worth it. Would be nice to have it as alias.

(1) it doesn't belong into the GDA interface either, probably is duplicated there in order to make it batchable when we didn't yet have batch call support for arbitrary call targets. See #2033
(2) naming flow and transfer was considered. Shadowing the pre-existing ERC20.transfer may be dangerous in this context, thus the suffix for clear distinction.

Copy link

github-actions bot commented Oct 18, 2024

Changelog Reminder

Reminder to update the CHANGELOG.md for any of the modified packages in this PR.

  • CHANGELOG.md modified
  • Double check before merge

@d10r d10r force-pushed the supertokenlib-iteration branch from bd182c5 to 2cb23d9 Compare October 21, 2024 10:53
@d10r
Copy link
Collaborator Author

d10r commented Oct 23, 2024

analysis of the lib interface:

CFA WRITE
createFlow(ISuperToken token, address receiver, int96 flowRate) (ud) (ctx)
createFlowFrom(ISuperToken token, address sender, address receiver, int96 flowRate) (ud) (ctx)
updateFlow(ISuperToken token, address receiver, int96 flowRate) (ud) (ctx)
updateFlowFrom(ISuperToken token, address sender, address receiver, int96 flowRate) (ud) (ctx)
deleteFlow(ISuperToken token, address sender, address receiver) (ud) (ctx)
deleteFlowFrom(ISuperToken token, address sender, address receiver) (ud) (ctx)
setFlowPermissions(ISuperToken token, address flowOperator, bool allowCreate, bool allowUpdate, bool allowDelete, int96 flowRateAllowance) (ctx)
setMaxFlowPermissions(ISuperToken token, address flowOperator) (ctx)
revokeFlowPermissions(ISuperToken token, address flowOperator) (ctx)
increaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 addedFlowRateAllowance) (ud)
decreaseFlowRateAllowance(ISuperToken token, address flowOperator, int96 subtractedFlowRateAllowance) (ud)
increaseFlowRateAllowanceWithPermissions(ISuperToken token, address flowOperator, uint8 permissionsToAdd, int96 addedFlowRateAllowance) (ud)
decreaseFlowRateAllowanceWithPermissions(ISuperToken token, address flowOperator, uint8 permissionsToRemove, int96 subtractedFlowRateAllowance) (ud)

CFA READ
// to be replaced by combined or renamed
getFlowRate(ISuperToken token, address sender, address receiver)
// to be replaced by combined or renamed
getFlowInfo(ISuperToken token, address sender, address receiver)
getCFANetFlowRate(ISuperToken token, address account)
getCFANetFlowInfo(ISuperToken token, address account)
getFlowPermissions(ISuperToken token, address sender, address flowOperator)


GDA WRITE
createPool(ISuperToken token [, address admin, PoolConfig memory poolConfig])
// TODO: should imo be removed, belongs to pool iface (why is it also in gda iface?). Probably for ctx variant - but do we really need that?
updateMemberUnits[WithCtx](ISuperToken token, ISuperfluidPool pool, address memberAddress, uint128 newUnits) (ud)
// those exist both in pool and gda iface. Belong into TCI
claimAll[WithCtx](ISuperToken token, ISuperfluidPool pool, address memberAddress) (ud)
connectPool[WithCtx](ISuperToken token, ISuperfluidPool pool) (ud)
disconnectPool[WithCtx](ISuperToken token, ISuperfluidPool pool) (ud)
distribute[WithCtx](ISuperToken token, address from, ISuperfluidPool pool, uint256 requestedAmount) (ud)
distributeFlow[WithCtx](ISuperToken token, address from, ISuperfluidPool pool, int96 requestedFlowRate) (ud)

GDA READ
getGDAFlowInfo(ISuperToken token, address distributor, ISuperfluidPool pool)
getGDANetFlowRate(ISuperToken token, address account)
getGDANetFlowInfo(ISuperToken token, address account)
// rename to getGDAFlowRate
getFlowDistributionFlowRate(ISuperToken token, address from, ISuperfluidPool to)
// TODO: find better name
estimateFlowDistributionActualFlowRate(ISuperToken token, address from, ISuperfluidPool to, int96 requestedFlowRate)
// TODO: find better name
estimateDistributionActualAmount(ISuperToken token, address from, ISuperfluidPool to, uint256 requestedAmount)
isMemberConnected(ISuperToken token, address pool, address member)
// TODO: check token matches pool. Name good?
getPoolAdjustmentFlowRate(ISuperToken token, ISuperfluidPool pool)
// TODO: rename to "getTotalAmountReceivedFromPool"
getTotalAmountReceivedByMember(ISuperfluidPool pool, address memberAddr)


COMBINED WRITE (NEW)
// replicated from cfa forwarder: TODO: remove
setFlowrate(ISuperToken token, address receiver, int96 flowrate)
// replicated from cfa forwarder. TODO: remove
setFlowrateFrom(ISuperToken token, address sender, address receiver, int96 flowrate)
flowX(ISuperToken token, address receiverOrPool, int96 flowRate)
transferX(ISuperToken token, address receiverOrPool, uint256 amount)

COMBINED READ
getNetFlowRate(ISuperToken token, address account)
getNetFlowInfo(ISuperToken token, address account)
getBufferAmountByFlowRate(ISuperToken token, int96 flowRate)

COMBINED READ (TODO)
// replaces current CFA getFlowRate
getFlowRate(ISuperToken token, address sender, address receiverOrPool)
getFlowInfo(ISuperToken token, address sender, address receiverOrPool)

@d10r d10r marked this pull request as ready for review October 28, 2024 12:22
@d10r d10r requested review from hellwolf, kasparkallas and a team as code owners October 28, 2024 12:22
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 79.48718% with 32 lines in your changes missing coverage. Please review.

Project coverage is 88.09%. Comparing base (5b5c548) to head (a1fcf6b).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...m-contracts/contracts/apps/SuperTokenV1Library.sol 79.48% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2032      +/-   ##
==========================================
- Coverage   88.35%   88.09%   -0.27%     
==========================================
  Files         112      109       -3     
  Lines        7009     6793     -216     
  Branches      965      978      +13     
==========================================
- Hits         6193     5984     -209     
+ Misses        814      807       -7     
  Partials        2        2              
Flag Coverage Δ
ethereum-contracts 94.32% <79.48%> (-0.15%) ⬇️
sdk-core 88.09% <79.48%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@d10r d10r changed the title [ETHEREUM-CONTRACTS] overhaul of SuperTokenV1Library [ETHEREUM-CONTRACTS] overhaul of SuperTokenV1Library & legacy lib deprecation Oct 30, 2024
@d10r d10r merged commit ec92f23 into dev Nov 22, 2024
22 of 24 checks passed
@d10r d10r deleted the supertokenlib-iteration branch November 22, 2024 20:09
Copy link

XKCD Comic Relif

Link: https://xkcd.com/2032
https://xkcd.com/2032

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants