-
Since this project uses Chainlink oracles testing the project requires an infura/alchemy/geth node
-
To set your node add the
GETH_NODE
env variable in.env
-
Provided node will be used to spawn a local mainnet fork using ganache-core
npm install -g truffle
npm install
truffle test
-
_addToken(address tokenAddress, address oracleAddress)
-
adds the corresponding ChainLink oracle address
-
delegatePausable(uint streamId, address delegate) onlyPayerOrDelegated(streamId)
-
Delegates pausable capability to
address delegate
-
claimable (uint streamId)
-
returns accrued amount in USD (18 decimals) for
streamId
-
claimableToken (uint streamId)
-
returns accrued amount in
token
value using Chainlink' oracle -
getStreamsCount()
-
return total no. of streams: useful for looping through
streams
usinggetStream(id)
event newStream(uint id, address payer, address payee, uint usdAmount)
- Emitted after successful
createStream
, useful for indexing purposes
- Emitted after successful
event tokenAdded(address tokenAddress, address oracleAddress)
- Emitted when the owner adds support for a new token
event claimed(uint id, uint usdAmount, uint tokenAmount);
Emitted when a user claims his accrued amount, tracks both the value in USD and intoken
-
A payment stream is a per-Ethereum-block drip stream of abstract USD to a payee address.
-
A payer may create, start, or stop payment streams to a payee address.
-
Each payment stream is associated with a token , and has received an ERC20 approval from the funding address.
-
Payees may Claim the unlocked, unclaimed USD balance of the payment stream.
-
A Claim will consult an on-chain price oracle USDC/XYZ, calculate the amount of XYZ coins to be paid, and transfer that amount of XYZ to the payee.
Create a new payment stream from payer to payee. Funds may be from any account; funding account must approve this contract debiting this amount.
Stop the drip.
Restart the drip.
Change stream payee address.
Change stream funding rate.
Change stream funding address.
Payee receives nnnn.nn XYZ tokens, derived from a calculation of accumulated-but-not-claimed USD balance. The amount of XYZ tokens is calculated from an on-chain XYZ/USDC price oracle at claim time.