For the visually inclined, view our video explainer HERE.
Example Code
Foundry Example
Within a foundry test file, you can call the SuperfluidFrameworkDeployer contract directly in your setUp() function.
import"forge-std/Test.sol";import"../../contracts/MoneyRouter.sol";import {ISuperfluid} from"@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";import {SuperfluidFrameworkDeployer,TestGovernance,Superfluid,ConstantFlowAgreementV1,CFAv1Library,SuperTokenFactory} from"@superfluid-finance/ethereum-contracts/contracts/utils/SuperfluidFrameworkDeployer.sol";contractStreamRebounderRandomTestisTest { StreamRebounder public streamRebounder;structFramework { TestGovernance governance; Superfluid host; ConstantFlowAgreementV1 cfa; CFAv1Library.InitData cfaLib; InstantDistributionAgreementV1 ida; IDAv1Library.InitData idaLib; SuperTokenFactory superTokenFactory; } SuperfluidFrameworkDeployer.Framework sf;functionsetUp() public {addresspublic owner;//DEPLOYING THE FRAMEWORK SuperfluidFrameworkDeployer sfDeployer =newSuperfluidFrameworkDeployer(); sf = sfDeployer.getFramework();// DEPLOYING DAI and DAI wrapper super token vm.prank(owner); ISuperToken daix = sfDeployer.deployWrapperToken("Fake DAI","DAI",18,10000000000000 ); MoneyRouter =newStreamRebounder( sf.host, owner ); }//add other functions and test contracts...}
When using foundry, you'll need to install superfluid-finance/ethereum-contracts. If you have issues when running forge install, try using the --no-commit flag.