{"id":16199413,"url":"https://github.com/bbenzikry/superfluid_foundry_template","last_synced_at":"2026-01-20T19:32:40.658Z","repository":{"id":95865147,"uuid":"511337307","full_name":"bbenzikry/superfluid_foundry_template","owner":"bbenzikry","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-15T16:25:31.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T17:47:23.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbenzikry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-07T00:53:28.000Z","updated_at":"2022-10-05T11:35:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"ddb25067-dff6-4bb8-94d7-f15978a6bab7","html_url":"https://github.com/bbenzikry/superfluid_foundry_template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/bbenzikry/superfluid_foundry_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbenzikry%2Fsuperfluid_foundry_template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbenzikry%2Fsuperfluid_foundry_template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbenzikry%2Fsuperfluid_foundry_template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbenzikry%2Fsuperfluid_foundry_template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbenzikry","download_url":"https://codeload.github.com/bbenzikry/superfluid_foundry_template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbenzikry%2Fsuperfluid_foundry_template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28610618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T18:56:40.769Z","status":"ssl_error","status_checked_at":"2026-01-20T18:54:26.653Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T09:25:19.687Z","updated_at":"2026-01-20T19:32:40.642Z","avatar_url":"https://github.com/bbenzikry.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Superfluid Foundry Starter Template\n\nThis is a foundry template for developing and testing Superfluid-related contracts such as Super\nTokens, Super Apps, and other contracts that call Superfluid agreements.\n\n## Set Up\n\nNOTE: You will need yarn (or npm) and foundry to use this project.\n\nTo get started, clone this repo:\n\n```bash\ngit clone https://github.com/Fluid-X/superfluid_foundry_template\n```\n\nNext, install dependencies. At the time of writing, Superfluid _MUST_ be installed as node modules.\n\n```bash\nyarn\n# Or `npm install` if you prefer npm\n```\n\nNext, try running the generic test:\n\n```bash\nforge test\n```\n\n## Project Layout\n\nThe majority of the project layout is as `forge init \u003cname\u003e` creates it. The main difference is the\nnode dependencies. For this, the `package.json` includes the Superfluid contracts. The\n`foundry.toml` file contains has `node_modules` in the `libs` array, which tells the compiler where\nto find dependencies. The `remappings.txt` file and the `.vscode` directory are for VSCode\ncompatibility on imports. You don't need this, but if you remove it, you'll get visual errors that\nwon't actually show up in tests.\n\n## Set Up Tests\n\nImport the `SuperfluidTester.sol` contract, then have your contract inherit it. In the constructor,\nadd `SuperfluidTester(admin)` where `admin` is the address you want to deploy with. For most tests,\nthis does not matter, so you can set it to `address(1)`.\n\n```solidity\n// omitting imports for brevity\n\ncontract YourTestContractNameHere is SuperfluidTester {\n\n    // admin address\n    address internal admin = address(1);\n\n    // This deploys everything as `admin`\n    constructor() SuperfluidTester(admin) {}\n\n    // from here on, you can use `sf` to access everything.\n    function setUp() public {\n        // set up ...\n    }\n\n    // tests ...\n}\n```\n\n## Using the `sf` Framework\n\nThe Superfluid Framework struct is defined as follows:\n\n```solidity\nstruct Framework {\n    TestGovernance governance;\n    Superfluid host;\n    ConstantFlowAgreementV1 cfa;\n    CFAv1Library.InitData cfaLib;\n    InstantDistributionAgreementV1 ida;\n    IDAv1Library.InitData idaLib;\n    SuperTokenFactory superTokenFactory;\n}\n\n// CFAv1Library\nstruct InitData {\n    ISuperfluid host;\n    IConstantFlowAgreementV1 cfa;\n}\n\n// IDAv1Library\nstruct InitData {\n    ISuperfluid host;\n    IInstantDistributionAgreementV1 ida;\n}\n```\n\n### TestGovernance governance\n\nThis is for all things governance. Code updates, parameter tweaking, etc.\n\n```solidity\n// access TestGovernance\nsf.goverance;\n\n// get reward address example\nsf.governance.getRewardAddress;\n```\n\n### Superfluid host\n\nThis is the monolithic Superfluid host contract. This handles agreements, apps, and callbacks.\n\n```solidity\n// access Superfluid\nsf.host\n\n// check if app is jailed example\nsf.host.isAppJailed(app);\n```\n\n### ConstantFlowAgreementV1 cfa\n\nThis is the streaming agreement contract. This handles creating, updating, and deleting flows, as\nwell as flow operator permission updates and delegated flow handling.\n\n```solidity\n// access ConstantFlowAgreementV1\nsf.cfa;\n\n// createFlow example\nsf.host.callAgreement(\n    sf.cfa,\n    abi.encodeCall(sf.cfa.createFlow, (token, receiver, flowRate, new bytes(0)),\n    new bytes(0)\n);\n```\n\n### CFAv1Library.InitData cfaLib\n\nThis is the CFA library. The `InitData` struct contains the Superfluid and ConstantFlowAgreementV1\ninterfaces. This is used for abstracting agreement calling. You can call CFA-related agreements\ndirectly with this struct.\n\n```solidity\n// access CFAv1Library\nsf.cfaLib;\n\n// createFlow example\nsf.cfaLib.createFlow(receiver, token, flowRate);\n```\n\n### InstantDistributionAgreementV1 ida\n\nThis is the distribution agreement contract. This handles creating indexes, distributing, and\nsubscriptions.\n\n```solidity\n// access InstantDistributionAgreementV1\nsf.ida;\n\n// createIndex example\nsf.host.callAgreement(\n    sf.ida,\n    abi.encodeCall(sf.ida.createIndex, (token, indexId, new bytes(0))),\n    new bytes(0)\n);\n```\n\n### IDAv1Library.InitData idaLib\n\nThis is the IDA library. The `InitData` struct contains the Superfluid and\nInstantDistributionAgreementV1 interfaces. This is used for abstracting agreement calling. You can\ncall IDA-related agreements directly with this struct.\n\n```solidity\n// access IDAv1Library\nsf.idaLib;\n\n// createIndex example\nsf.idaLib.createIndex(token, indexId);\n```\n\n### SuperTokenFactory superTokenFactory\n\nThis is the super token factory contract. This handles creating, deploying, and updating super token\nlogic.\n\n```solidity\n// access SuperTokenFactory\nsf.superTokenFactory;\n\n// create pure super token contract\nISuperToken token = ISuperToken(sf.superTokenFactory.createSuperTokenLogic(sf.host));\ntoken.initialize(underlyingERC20, underlyingDecimals, name, symbol);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbenzikry%2Fsuperfluid_foundry_template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbenzikry%2Fsuperfluid_foundry_template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbenzikry%2Fsuperfluid_foundry_template/lists"}