All notable changes to the ethereum-contracts will be documented in this file.
This project adheres to Semantic Versioning.
SuperToken: the contract admin can enable/disable a Yield Backend in order to generate a yield on the underlying asset.SuperToken: addedVERSION()which returns the version string of the logic contract set for the SuperToken, and inline CHANGELOG.
- EVM target changed from shanghai to cancun.
- Update solhint to v6.
- Updated to "hardhat@2.27.2".
- GDA autoconnect feature: now any account can connect pool members using
tryConnectPoolFor()as long as they have less than 4 connection slots occupied for that Super Token. This allows for smoother onboarding of new users, allowing Apps to make sure tokens distributed via GDA immediately show up in user's wallets. Accounts can opt out of this by usingsetConnectPermission(), this is mainly supposed to be used by contracts.
- Refactored
GeneralDistributionAgreementV1: extracted functionality which reads/writes agreement data from/to the token contract into dedicated libraries:GDAv1StorageLibcontains data structures and related encoders/decoders.GDAv1StorageReadercontains getters reading agreement data from the token contract, allowing contracts to get this data without making a call to the GDA contract.GDAv1StorageWritercontains functions for writing agreement data to the token contract. This can only be used by the GDA contract itself.
- bump solc to "0.8.30".
- Changed EVM target from
paristoshanghaibecause now all networks with supported Superfluid deployment support it. - Don't emit ERC20
Approvalevents ontransferFromoperations. This is consistent with the OpenZeppelin ERC20 implementation from v5 onwards. Change effective only for SuperTokens using the latest logic.
ISuperfluidPool:getClaimableandgetClaimableNowcould previously return non-zero values for connected pools, which was inconsistent with whatclaimAllwould actually do in this situation (claim nothing).
- Updated OpenZeppelin library from v.4.9.6 to v5.4.0.
The import path now includes the major version, making it easier for contracts integrating with this protocol to use a different major version of OpenZeppelin.
Projects using Superfluid contracts as a dependency need to configure a mapping:
- Foundry: add this to remappings:
'@openzeppelin-v5/=lib/openzeppelin-contracts/', - Hardhat (>=v2.17.2): add
@openzeppelin/contractsas a project dependency and a subtask in your hardhat config:
- Foundry: add this to remappings:
import { TASK_COMPILE_GET_REMAPPINGS } from "hardhat/builtin-tasks/task-names";
subtask(TASK_COMPILE_GET_REMAPPINGS).setAction(
async (_, __, runSuper) => {
const remappings = await runSuper();
return {
...remappings,
"@openzeppelin-v5/contracts/": "@openzeppelin/contracts/",
};
}
);
CFASuperAppBase:onFlowDeletedis replaced byonInFlowDeletedandonOutFlowDeleted. This is safer because the latter hook handles a case (outgoing flow being deleted by its receiver) which is often not expected. In the past, apps creating outflows had to explicitly distinguish between the 2 possible triggers in order to avoid potentially invalid state changes or even jailing. Most apps will want to implement justonInFlowDeleted.CFASuperAppBase: addedflowRateargument toonFlowCreatedandonFlowUpdated.- PoolMemberNFT pruning:
IPoolMemberNFTandPoolMemberNFTremoved,POOL_MEMBER_NFT()removed fromISuperToken.
Defect release, don't use!
SuperTokennow implements EIP-2612 (permit extension for EIP-20 signed approvals).SuperfluidPoolnow has additional methodsincreaseMemberUnitsanddecreaseMemberUnitswhich allow the pool admin to change member units parameterized with delta amounts.
- Curation of the SuperApp registration allowlist can now be delegated by governance to a newly added
ACLcontract.
SuperfluidPooldoes no longer mint and burn EIP-721 tokens (NFTs) on member unit updates. The gas overhead of this operation caused friction for integrations with other protocols (e.g. Uniswap V4).
- Superfluid Pools now implement
IERC20Metadata, thus going forward have a name, symbol and decimals IGeneralDistributionAgreementV1.createPoolWithCustomERC20MetadataandSuperTokenV1Library.createPoolWithCustomERC20Metadatafor creating pools with custom ERC20 metadataSuperTokenV1Library- overloaded
claimAllfor the msg.sender to claim for themselves - added
flowWithCtxandflowFromWithCtx
- overloaded
- Fixed deployment of SimpleForwarder (solved an issue which caused batch operation
OPERATION_TYPE_SIMPLE_FORWARD_CALLto always revert) SuperTokenV1Library.getFlowRateandSuperTokenV1Library.getFlowInfonow also allow querying the flowrate between pools and pool members- Superfluid Pools now emit a Transfer event when changing units with
updateMemberUnits. - Dependency foundry updated to 1.0
SuperTokenV1Library.distributeFlow: returnactualFlowRateinstead of a boolSuperTokenV1Library.distribute: returnactualAmountinstead of a bool
SuperTokenV1Library- added agreement specific variants for
getFlowRate,getFlowInfo,getNetFlowRateandgetNetFlowInfo, e.g.getCFAFlowRate,getGDAFlowRate, ... - added
flowfor changing CFA flows, can be used instead of the CRUD methods - added
flowFromfor changing CFA flows using ACL permissions, can be used instead of the CRUD methods - added
distributeanddistributeFlowvariants (overloaded) withoutfromargument - added
transferXandflowXfor agreement abstracted instant or flow transfers/distributions - added
getTotalAmountReceivedFromPool(alias forgetTotalAmountReceivedByMember)
- added agreement specific variants for
- Host: added
ISuperfluid.getERC2771Forwarder: to be used by batch call targets who want to use ERC-2771 for msg sender preservation - Utility contracts for forwarding of calls in the context of batch operations:
SimpleForwarder: for forwarding arbitrary calls to arbitrary targetsERC2771Forwarder: for forwarding arbitrary calls to arbitrary targets with msg sender authenticated according to ERC-2771. Requires the target contract to recognize it as trusted forwarder.
- Removed
CFAv1Library, superseded bySuperTokenV1Library. - The IDA is now declared as deprecated, shouldn't be used anymore. The GDA covers all its functionality.
- Removed
IDAv1Library. SuperTokenV1Library- removed IDA specific functionality.
distributenow maps to the GDA. getFlowRateandgetFlowInfonow work return the GDA flowrate/info if the receiver is a pool (previously it would return 0). In order to specifically query the CFA flowrate, use the newly addedgetCFAFlowRateandgetCFAFlowInfo.- removed
updateMemberUnits(use ISuperfluidPool.updateMemberUnits instead)
- removed IDA specific functionality.
- Source file
SuperfluidFrameworkDeployer.solrenamed toSuperfluidFrameworkDeployer.t.sol - Source file
FoundrySuperfluidTester.solrenamed toFoundrySuperfluidTester.t.sol
MacroForwardermade payable.IUserDefinedMacro: added a methodpostCheck()which allows to verify state changes after running the macro.SuperfluidFrameworkDeployernow also deploys andMacroForwarderand enables it as trusted forwarder.deploy-test-environment.jsnow deploys fUSDC (the underlying) with 6 decimals (instead of 18) to better resemble the actual USDC.
- GDA Pools are not multi-tokens ready, added a permission check (#2010).
- FlowNFTs are being deprecated. The hooks aren't invoked anymore by CFA and GDA.
- ISuperfuidPool self-transfer is not allowed.
- FoundrySuperfluidTester is test with forge-std@v1.9.1, which may break with 1.7.x and prio forge-std lib.
- Removing SafeGasLibrary, in favor of CallbackUtils.
batchCallnow supports 4 additional operation types:OPERATION_TYPE_SUPERTOKEN_UPGRADE_TOOPERATION_TYPE_SUPERTOKEN_DOWNGRADE_TOOPERATION_TYPE_SIMPLE_FORWARD_CALLOPERATION_TYPE_ERC2771_FORWARD_CALLThe latter 2 allow to add arbitrary contract calls to batch call.
- Solidity library CallbackUtils for dealing with EIP-150 1/64-rule for callbacks.
- increase SuperApp callback gas limit on some chains, to be queried with
host.CALLBACK_GAS_LIMIT() - Remove try/catch in PoolNFT callbacks.
- upgrade flake locked foundry: 0.2.0 (20b3da1 2024-07-02T00:18:52.435480726Z).
- relax pragram solidity with "^0.8.23".
- bump solc to 0.8.26.
- Faster SuperAppMockAux._burnGas implementation.
- foundry test reorg:
- rename '.prop.sol' to '.prop.t.sol';
- mark mock-contract files with 't.sol' to be skipped by foundry build automatically;
- move some mock contracts to test/foundry if they are only used for foundry tests.
- Fix a few types and build warnings.
- Make testTokenURIIsExpected work with non via-ir pipeline.
- The abstract base contract
SuperAppBaseFlowwas renamed toCFASuperAppBaseand doesn't self-register in the constructor anymore. This allows the contract to be used with a SuperApp factory pattern and by logic contracts in the context of the proxy pattern. Note: this will NOT break any deployed contracts, only affects undeployed Super Apps in case the ethereum-contracts dependency is updated. UniversalIndexData,PoolMemberDataandFlowDistributionDatastructs moved fromIGeneralDistributionAgreementV1.soltoGeneralDistributionAgreementV1.solPoolIndexData,MemberDatastructs moved fromISuperfluidPool.soltoSuperfluidPool.sol
- New utility: MacroForwarder - a trusted forwarder extensible with permission-less macro contracts.
- New protocol contract view functions:
gdaV1.getFlowgdaV1.getAccountFlowInfopool.poolOperatorGetIndexpool.getTotalAmountReceivedByMember
- New SuperTokenV1Library functions:
getGDAFlowInfogetGDANetFlowInfogetPoolAdjustmentFlowRategetTotalAmountReceivedByMember
- bump solc to 0.8.23
superTokenV1Library.getNetFlowInfosums CFA and GDA net flow info
- FlowNFT hooks can't revert with outofgas anymore
TokenInfoandERC20WithTokenInfointerface/abstract contract are removed from the codebase, including the bundled ABI contracts- Migration: Use
IERC20Metadatainstead, as this replaces the previous contracts
- Migration: Use
build/typechain-ethers-v5is removed from the npm package- Migration: Consume the ABIs and utilize whatever tool you'd like to generate types from them
- New agreement:
GeneralDistributionAgreementadded which enables 1-to-N flowing distributions in addition to 1-to-N instant distributions via theSuperfluidPoolcontract - Added 'test-slither' yarn sub-task.
- Expose
SuperToken._underlyingDecimalswithSuperToken.getUnderlyingDecimals() - Expose
_toUnderlyingAmount(uint256 amount)withtoUnderlyingAmount(uint256 amount) batchCallsupports payableOPERATION_TYPE_SUPERFLUID_CALL_APP_ACTION: only the firstOPERATION_TYPE_SUPERFLUID_CALL_APP_ACTIONwill be payable- Added two new functions to
SuperfluidGovernanceBase.sol:changeSuperTokenAdminandbatchChangeSuperTokenAdmin Superfluid.changeSuperTokenAdmin()function added to be called via governance for tokens with no admin address- Added an overloaded
initializetoSuperToken.sol, which additionally takesaddress adminif you want to initialize the token with an admin address SuperToken.changeAdmin(address newAdmin)added which is only callable by the current admin, the "admin" of a SuperToken can change the admin and update the proxy contract's pointer to a logic contractNote that the default admin (when address(0)) is the host contract as is currently the case
- Note that the admin is stored in the EIP-1967 admin storage slot (
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103) SuperToken.getAdmin()added to retrieve the admin addressSuperTokenFactory.createERC20Wrapper()overloads added to create a SuperToken AND explicitly initialize a SuperToken with an admin- New explicit functions:
deployTestFrameworkWithEthersV5anddeployTestFrameworkWithEthersV6indeploy-test-framework.jsdeployTestFrameworkis still there, but it is considered deprecated now
- Reuse config keys from
SuperfluidGovernanceConfigsinstead of duplicating them inConstantFlowAgreementV1. - Deprecating
registerAppWithKeyandregisterAppByFactory: DO NOT USE for new deployments- Simplification of Super App registration: use
registerAppin all cases going forward. - Use
registerApp(uint256 configWord)to be called by the super app in the constructor orregisterApp(ISuperApp app, uint256 configWord)to be called by any address with a valid app registration config key
- Simplification of Super App registration: use
dev-scripts/deploy-test-framework.jscompatible with both ethers-v5 and ethers-v6 nowdistributeanddistributeWithCtxAPI made consistent
- Publish
build/hardhat/*/*again.
- Publish
build/bundled-abi.{js,json}in the npm package.
- Publish
build/truffle/*.jsontruffle contract artifacts in the npm package instead. - Publish
build/typechain-ethers-v5in the npm package instead. - Removed scripts from npm package, use dev-scripts instead.
- Ship ERC1820Registry.json with dev-scripts.
- Node dependency updates.
- Raise minimum solc development requirement for ethereum-contracts to 0.8.11.
increaseFlowRateAllowanceWithPermissionsanddecreaseFlowRateAllowanceWithPermissionsadded toConstantFlowAgreementV1.sol
SuperToken.solmade external and public methods virtual to facilitate creation of customized implementations.- Explicitly set EVM target to "paris" because EIP-3855 isn't yet supported on all chains with Superfluid deployment.
SuperAppBaseFlow.solusesregisterAppWithKeyinstead of deprecatedregisterAppSuperfluidGovernanceBase.soladd a method for updating SuperTokens to other than the canonical implementation.SuperToken.solinvoke mint/burn hooks only if userData is not empty
SuperfluidLoaderLibrary.soladded to easily get the canonical host contract address on different networksIDAv1Forwarder.soladded
- Dual licenses going forward: AGPLv3 for core contracts and MIT for external developers.
SuperfluidFrameworkDeployer.solrefactored, deployment no longer occurs in the constructor- Migration: Create the contract and then use
deployTestFrameworkfunction to execute the deployments
- Migration: Create the contract and then use
SuperTokenDeployer.solremoved- Migration: Remove usage of
SuperTokenDeployerand use theSuperfluidFrameworkDeployerto deploy tokens instead
- Migration: Remove usage of
FlowNFTBase.solno longer takesbaseURIin the constructor, it is now a constant value- Migration: Remove
baseURIfrom the constructor forConstantOutflowNFTandConstantInflowNFT
- Migration: Remove
SuperTokenDeployer.solremoved in favor of moving the token deployment functions toSuperfluidFrameworkDeployer.solSuperfluidFrameworkDeployer.solalso includes functions which allow you to deploy different parts of the protocol (core, agreements, super tokens, etc.) separately and provides helpful custom errors for debugging- Use custom error for out of gas condition in
Superfluid.sol
increaseFlowRateAllowanceanddecreaseFlowRateAllowanceadded toSuperTokenV1Library.sol- Testing speed benchmarks
SuperTokenFactory.solNFT upgrade logic fixedSuperTokenV1Library.solIDA keccak256 hash fixeddeploy-framework.jsscript sets CFAv1Forwarder as trusted forwarderdeploy-framework.jsscript fixed up for flow NFT contracts
- FlowNFT contracts:
ConstantOutflowNFT,ConstantInflowNFT,FlowNFTBaseto replace the OG flow NFTs SuperAppBaseCFAbase contract to simplify CFA SuperApp developmentSuperTokenDeployer.solfor deploying SuperTokens in local testing (split fromSuperfluidFrameworkDeployer.sol)
SuperTokenlogic contract takesConstantOutflowNFTandConstantInflowNFTproxy contract addressesSuperTokenFactorylogic contract takesConstantOutflowNFTandConstantInflowNFTand handles the upgrade logic for the NFTs- Utilize internal
_hostin CFA instead of external call to host on the token
- bump solc to 0.8.19
- New ACL functions:
increaseFlowRateAllowanceanddecreaseFlowRateAllowanceinConstantFlowAgreementV1.sol - Support for
superToken.increaseAllowanceandsuperToken.decreaseAllowanceinbatchCallinSuperfluid.sol
BatchLiquidator.deleteFlowsdoesn't take host and CFA address as argument anymore. This makes L2 solvency operations considerably cheaper.
- Added
BatchLiquidator.deleteFlowfor cheaper liquidation of singular flows on L2s.
- bump solc to 0.8.18
SuperTokenFactorycontract no longer takesSuperTokenHelpercontract in its constructor- Migration: Pass in a deployed
SuperToken(logic) contract address toSuperTokenFactoryconstructor instead
- Migration: Pass in a deployed
runDeployContractsAndToken.jsis renamed torun-deploy-contracts-and-token.js- Migration: Replace
runDeployContractsAndToken.jswithrun-deploy-contracts-and-token.jsinstead in imports
- Migration: Replace
deployContractsAndToken.jsis renamed todeploy-contracts-and-token.js- Migration: Replace
deployContractsAndToken.jswithdeploy-contracts-and-token.jsinstead in imports
- Migration: Replace
_superTokenLogicfield inSuperTokenFactorycontract is now a public immutable field and is no longer a storage variable:_superTokenLogicDeprecated
batchCallsupports newsendbatch operation- Added
downgradeTofunction inSuperToken.sol - Added
deployContractsAndToken.jsandrunDeployContractsAndToken.jstodev-scripts - Added
SuperTokenV1Librarywhich provides a token centric interface for Superfluid specific SuperToken functionality.
scripts/deploy-test-framework.jsno longer exists,deploy-test-framework.jshas been moved todev-scripts- Migration: Use
dev-scripts/deploy-test-framework.jsinstead
- Migration: Use
upgradeTologic changed to revert ifdatais not empty andtois a contract and is not a registered ERC777 recipientMAX_APP_CALLBACK_LEVELis public again
createCanonicalERC20Wrapperadded for creating ERC20 Wrapper Super tokens which will be added to a canonical wrapper super token list based on naming convention and semi-upgradeability. This will be the recommended way of creating ERC20 Wrapper moving forward.namenaming convention: Super Tokennamewill be"Super ${underlyingToken.name}"symbolnaming convention: Super Tokensymbolwill be"${underlyingToken.symbol}x"
- Hardhat
artifactsincluded in npm package - Include declaration files in
typesfolder for files inscriptsin npm package
- CFA Hooks added (#1099)
- typechain types are provided to all consumers (#1113)
SuperfluidFrameworkDeployer.solcreate Native Asset and Pure Super Tokens functionality added (#1104)TestResolveradded to allowSuperfluidFrameworkDeployercontract to grant admin permissions to its deployer (#1104)
- CFA Agreement forwarder delete flow fix to allow receivers to delete flow (#1094)
- CFA Agreement forwarder: deployed on all networks at 0xCfA1E187C9141B8bA90a436CB789017FA573d051
- [SECURITY] CFA: check flow sender instead of msg sender in order to cover ACL use
- CFA Agreement Forwarder (#982)
- Gov: Convenience method for app registration keys and some cleanup (#1049)
- App Credit Rule CFA-2 (#899)
- Custom Errors Support (#1043)
- yAcademy Gas Savings Applied (#1062)
- bump solc to 0.8.16 (#1065)
- Add gnosisscan support (#1050)
- BNB Chain Support (#925)
- Initialize logic contracts on deployment (using "castrate") (#841)
- add tokenDecimals option to deploy-test-token.js (#1025)
- [TOGA] Added missing awaits (#1044)
- New TestSuperApp: stream redirector wip, for testing when
appCallbackLevelstarting at 0 (#1008) - Prod deployment script fix (#971)
- Adds a missing closing parenthesis to example test (#967)
- Addresses several shortcomings in current workflows (mainly mainnet related) (#911)
- Queue up FAILED_VERIFICATIONS (#900)
- Deprecate support for
kovan,rinkeby,optimism-kovan, andoptimism-rinkeby(#1032) - Remove MaticBridgedToken from monorepo (#1060)
- Updating dependencies & dedup dev packages (#1064)
- Add resolver and loader to deployer, add tests (#1011)
- Automated generation and publishing of contract API docs with solidity-docgen (#880)
- Set newCtx whenever a function is modifying + using it (#854)
- CfAv1Library ACL support (#803)
- Avalanche Support Added (#819)
- Production deployment script fixes (#821)
- Increase Code Coverage (#891)
- SlotsBitmapLibrary Property Test Fuzzing (#790)
- IDA: Distribute no longer reverts when units is 0 (#853)
- Use
abi.encodeCall(#869) - Review safemath & safecast (#851)
- Solidity 0.8.14 (#896)
- SuperfluidFrameworkDeployer.getFramework to return a Framework struct. (#789)
- Fixed a natspec typo (#773)
- Reapply OpenEthereum provider hack (#771)
- ERC1820RegistryCompiled for testing frameworks: foundry, etc. (#789)
- Add few more CFA and IDA cases (#781)
- Test some CFA properties (#777)
- App registration keys with expiration date instead of one-time use.
- ACL authorize functions no longer take a redundant
senderparam
- Added HALBORN report (#759)
- MAJOR FEATURE: Access Control List (#720)
- ACL base API functions
- FlowOperatorDefinitions library
- new functions in IConstantFlowAgreementV1
- Other changes:
- emit FlowUpdatedExtension event
- ACL base API functions
- Fix ERC1820 artifact issue (#759)
- Fix an issue with output dir (#748)
- [SECURITY] InstantDistributionAgreement.claim should be guarded by ctx check.
- Interface renaming fix re patrician periods (#747)
- Remove Strings.sol again
- Disable zero address subscription for IDA (#751)
- Update dev dependencies (#694)
- Use hardhat for ethereum-contracts tests (#727)
- Update to solc 0.8.13 (#721)
- Reduce trust assumptions host <-> agreements (#749)
- Additional IDA test cases (#722)
- Add Strings.sol back to repository (#715)
- Use host.getNow to fully abstract time (#703)
- Use Solidity v0.8.0 (#687)
- Informative revertFromReturnedData (#693)
- IDAv1Library (#696)
- Added single-file Dapp for deploying SuperToken wrappers (#692)
- Print contract sizes (#690)
- Workflow Improvements (cloc and faster pre-commit) (#688)
- Info-show-protocol fix for PPP and cleanup (#684)
- Monogamous SETH, L2 config improvements (#707).
- All interface contracts are requiring you to use solc >= 0.8.0.
- Removed ERC777 callbacks from ERC20.transfer (#698).
- [SECURITY] isValidAppAction added, this prevents SuperApp callbacks being mistakenly called by callAppActions.
- Upgrade
truffle-plugin-verifyand use its proxy verification feature (#623)
- 3Ps (#558)
- Add SuperApp factory registration script (#657)
- CFALibraryV1: added flow() and flowWithCtx() functions (#595)
- Self approve transfer (#598)
- External set/clear config added to governance (#624)
- Add missing event emits (#656)
- CFALibraryV1: Change solidity pragma in cfa lib to support versions 0.8 & later (#642)
- Multiple scripts fixes re: do not engage with uninitialized super token proxies (#603)
- Call agreement calldata exploit (#628)
- Internal code audit iteration one (#646)
- Techdebt cleanups (#673)
- UUPS review (#632)