IDAv1Library
is to abstract the code required to call an agreement. Below is a comparative example of how an index might be created with and without the library.ISuperfluid.sol
, IInstantDistributionAgreementV1
, and IDAv1Library
into scope from the @superfluid-finance
package for Ethereum contracts.InitData
. This struct is defined in the library as follows.IDAv1Library
for the InitData
struct, then we create a local state variable called _idav1Lib
of type InitData
._idav1Lib
with the host
and ida
addresses passed into the constructor.createIndex
example.WithCtx
at the end of it. For example, instead of creating an index in a callback with createIndex
, you should use createIndexWithCtx
and return the result, newCtx
, of type bytes memory
.InitData
struct is named _idav1Lib
.WithCtx
function shown in the Callback Usage section above.WithCtx
function to include arbitrary user data.distribute
, except here you must specify the new total index value in the indexValue
parameter. This fails if it is not greater than the last index value.updateIndexValue
, but instead of having to specify the new indexValue
, you can pass an amount
by which the indexValue
should be incremented. This is simply another way to distribute tokens.