-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1bf00f
commit 36cb541
Showing
3 changed files
with
5,853 additions
and
4,115 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,100 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
pragma solidity ^0.8.0; | ||
|
||
contract FluidFunds {} | ||
import {ISuperToken} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; | ||
import {ISuperfluidPool} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/gdav1/ISuperfluidPool.sol"; | ||
import {SuperTokenV1Library} from "@superfluid-finance/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol"; | ||
import {ISuperfluidPool, PoolConfig} from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/gdav1/IGeneralDistributionAgreementV1.sol"; | ||
|
||
contract FluidFunds { | ||
using SuperTokenV1Library for ISuperToken; | ||
|
||
event PoolCreated(address indexed poolAdmin, address indexed poolAddress); | ||
event MemberUnitsUpdated( | ||
address indexed poolAddress, | ||
address indexed member, | ||
uint128 newUnits | ||
); | ||
event TokensClaimed(address indexed poolAddress, address indexed member); | ||
event PoolMemberConnected( | ||
address indexed poolAddress, | ||
address indexed member | ||
); | ||
event PoolMemberDisconnected( | ||
address indexed poolAddress, | ||
address indexed member | ||
); | ||
event TokensDistributedToPool( | ||
address indexed poolAddress, | ||
address indexed from, | ||
uint256 requestedAmount | ||
); | ||
event FlowDistributedToPool( | ||
address indexed poolAddress, | ||
address indexed from, | ||
int96 requestedFlowRate | ||
); | ||
|
||
function createPool( | ||
ISuperToken superToken, | ||
PoolConfig calldata poolConfig | ||
) public { | ||
ISuperfluidPool poolAddress = superToken.createPool( | ||
address(this), | ||
poolConfig | ||
); | ||
emit PoolCreated(address(this), address(poolAddress)); | ||
} | ||
|
||
function updateMemberUnits( | ||
ISuperToken superToken, | ||
ISuperfluidPool pool, | ||
address member, | ||
uint128 newUnits | ||
) public { | ||
superToken.updateMemberUnits(pool, member, newUnits); | ||
emit MemberUnitsUpdated(address(pool), member, newUnits); | ||
} | ||
|
||
function claimAll( | ||
ISuperToken superToken, | ||
ISuperfluidPool pool, | ||
address member | ||
) public { | ||
superToken.claimAll(pool, member); | ||
emit TokensClaimed(address(pool), member); | ||
} | ||
|
||
function connectPool(ISuperToken superToken, ISuperfluidPool pool) public { | ||
superToken.connectPool(pool); | ||
emit PoolMemberConnected(address(pool), msg.sender); | ||
} | ||
|
||
function disconnectPool( | ||
ISuperToken superToken, | ||
ISuperfluidPool pool | ||
) public { | ||
superToken.disconnectPool(pool); | ||
emit PoolMemberDisconnected(address(pool), msg.sender); | ||
} | ||
|
||
function distributeToPool( | ||
ISuperToken superToken, | ||
address from, | ||
ISuperfluidPool pool, | ||
uint256 requestedAmount | ||
) public { | ||
superToken.distributeToPool(from, pool, requestedAmount); | ||
emit TokensDistributedToPool(address(pool), from, requestedAmount); | ||
} | ||
|
||
function distributeFlow( | ||
ISuperToken superToken, | ||
address from, | ||
ISuperfluidPool pool, | ||
int96 requestedFlowRate | ||
) public { | ||
superToken.distributeFlow(from, pool, requestedFlowRate); | ||
emit FlowDistributedToPool(address(pool), from, requestedFlowRate); | ||
} | ||
} |
Oops, something went wrong.