Last active
April 5, 2022 12:00
-
-
Save ngmachado/7a27014cd3ac6e66d25984164e96242a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.13; | |
/* | |
Factory that can deploy any number of TradeableCashflow using registerAppByFactory from SF protocol | |
*/ | |
import "./TradeableCashflow.sol"; | |
import {ISuperfluid, ISuperToken, SuperAppDefinitions} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; | |
contract TCFFactory { | |
event NewTradeableCashflow(address indexed tcf); | |
uint256 immutable configWord = SuperAppDefinitions.APP_LEVEL_FINAL | | |
SuperAppDefinitions.BEFORE_AGREEMENT_CREATED_NOOP | | |
SuperAppDefinitions.BEFORE_AGREEMENT_UPDATED_NOOP | | |
SuperAppDefinitions.BEFORE_AGREEMENT_TERMINATED_NOOP; | |
address public owner; | |
constructor() { | |
owner = msg.sender; | |
} | |
function newTCF( | |
address lockAddress, | |
string memory _name, | |
string memory _symbol, | |
ISuperfluid host, | |
ISuperToken acceptedToken | |
) | |
external | |
onlyOwner | |
{ | |
TradeableCashflow newTCF = new TradeableCashflow(lockAddress, _name, _symbol, host, acceptedToken); | |
host.registerAppByFactory(newTCF, configWord); | |
emit NewTradeableCashflow(address(newTCF)); | |
} | |
modifier onlyOwner() { | |
require(owner == msg.sender, "not owner"); | |
_; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment