-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add superfluid connector #244
Conversation
|
* @param userData The user provided data | ||
* | ||
*/ | ||
event FlowUpdated( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every event should start with Log...
event FlowUpdated( | |
event LogFlowUpdated( | |
* | ||
*/ | ||
event FlowUpdated( | ||
ISuperfluidToken indexed token, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we emit it as address?
ISuperfluid host = ISuperfluid(0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192); | ||
IInstantDistributionAgreementV1 ida = | ||
IInstantDistributionAgreementV1( | ||
0x2319C7e07EB063340D2a0E36709B0D65fda75986 | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be an internal constant.
ISuperfluid host = ISuperfluid(0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192); | |
IInstantDistributionAgreementV1 ida = | |
IInstantDistributionAgreementV1( | |
0x2319C7e07EB063340D2a0E36709B0D65fda75986 | |
); | |
ISuperfluid internal constant host = ISuperfluid(0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192); | |
IInstantDistributionAgreementV1 internal constant ida = | |
IInstantDistributionAgreementV1( | |
0x2319C7e07EB063340D2a0E36709B0D65fda75986 | |
); | |
); | ||
|
||
//initialize InitData struct, and set equal to cfaV1 | ||
CFAv1Library.InitData public cfaV1 = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CFAv1Library.InitData public cfaV1 = | |
CFAv1Library.InitData internal constant cfaV1 = | |
payable | ||
returns (string memory _eventName, bytes memory _eventParam) | ||
{ | ||
IERC20(superToken.getUnderlyingToken()).approve( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get the amount using getId as well, and this amount should be passed to approve func
IERC20(superToken.getUnderlyingToken()).approve( | |
uint256 amt_ = getUint(getId, amount); | |
IERC20(superToken.getUnderlyingToken()).approve( | |
You can check aave v3 connector, for example - https://github.com/Instadapp/dsa-connectors/blob/main/contracts/polygon/connectors/aave/v3/main.sol |
@pradyuman-verma |
Yes we do, these events help us do to tracking related to DSAs |
@CoffeeFam84 setId and getId are used to communicate between simultaneous spells, that's why those are necessary |
|
CFAv1Library.InitData internal cfaV1 = | ||
CFAv1Library.InitData( | ||
host, | ||
//here, we are deriving the address of the CFA using the host contract | ||
IConstantFlowAgreementV1( | ||
address( | ||
host.getAgreementClass( | ||
keccak256( | ||
"org.superfluid-finance.agreements.ConstantFlowAgreement.v1" | ||
) | ||
) | ||
) | ||
) | ||
); | ||
|
||
// declare `_idaLib` of type InitData and assign it the host and ida addresses | ||
IDAv1Library.InitData internal _idav1Lib = IDAv1Library.InitData(host, ida); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be constant as well
* @param setId ID stores the amount of token. | ||
*/ | ||
function deleteFlow( | ||
address sender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need sender, the sender will be address(this)
payable | ||
returns (string memory _eventName, bytes memory _eventParam) | ||
{ | ||
CFAv1Library.deleteFlow(cfaV1, sender, receiver, superToken, userData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CFAv1Library.deleteFlow(cfaV1, sender, receiver, superToken, userData); | |
CFAv1Library.deleteFlow(cfaV1, address(this), receiver, superToken, userData); | |
*/ | ||
function createFlowByOperator( | ||
ISuperToken superToken, | ||
address sender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address sender, | |
{ | ||
CFAv1Library.createFlowByOperator( | ||
cfaV1, | ||
sender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sender, | |
addresss(this), | |
*/ | ||
function updateFlowByOperator( | ||
ISuperToken superToken, | ||
address sender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address sender, | |
{ | ||
CFAv1Library.updateFlowByOperator( | ||
cfaV1, | ||
sender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sender, | |
address(this), | |
*/ | ||
function deleteFlowByOperator( | ||
ISuperToken superToken, | ||
address sender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address sender, | |
{ | ||
CFAv1Library.deleteFlowByOperator( | ||
cfaV1, | ||
sender, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sender, | |
address(this), | |
returns (string memory _eventName, bytes memory _eventParam) | ||
{ | ||
IDAv1Library.distribute(_idav1Lib, superToken, id, amount, userData); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use getId here to exact amount.
Since no activity from the past 1 month from the contributor, closing this pr for now. Later it can be re-open suggested changes are made. Thank you |
Add superfluid connector to arbitrum, avalanche, optimism and polygon.