From ef13be04acb6196442f6678723fd3ef0e0facd20 Mon Sep 17 00:00:00 2001 From: didi Date: Thu, 21 Nov 2024 20:20:20 +0100 Subject: [PATCH] added getGDAFlowRate --- .../contracts/apps/SuperTokenV1Library.sol | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol b/packages/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol index e788f61b79..357b688792 100644 --- a/packages/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol +++ b/packages/ethereum-contracts/contracts/apps/SuperTokenV1Library.sol @@ -812,6 +812,20 @@ library SuperTokenV1Library { (, flowRate, , ) = cfa.getFlow(token, sender, receiver); } + /** + * @dev get flowrate between a distributor and pool for given token + * @param token The token used in flow + * @param distributor The ditributor of the flow + * @param pool The GDA pool + * @return flowRate The flow rate + */ + function getGDAFlowRate(ISuperToken token, address distributor, ISuperfluidPool pool) + internal view returns(int96 flowRate) + { + (, IGeneralDistributionAgreementV1 gda) = _getHostAndGDA(token); + return gda.getFlowRate(token, distributor, pool); + } + /** * @dev get CFA flow info between two accounts for given token * @param token The token used in flow @@ -833,7 +847,7 @@ library SuperTokenV1Library { /** * @dev get flow info of a distributor to a pool for given token * @param token The token used in flow - * @param distributor The sitributor of the flow + * @param distributor The ditributor of the flow * @param pool The GDA pool * @return lastUpdated Timestamp of flow creation or last flowrate change * @return flowRate The flow rate @@ -847,10 +861,6 @@ library SuperTokenV1Library { return gda.getFlow(token, distributor, pool); } - /* function getGDAFlowInfo(ISuperToken token, address distributor, ISuperfluidPool pool) */ - /* { */ - /* } */ - /** * @dev get net flow rate for given account for given token (CFA + GDA) * @param token Super token address