superfluid-finance / protocol-monorepo Goto Github PK
View Code? Open in Web Editor NEWSuperfluid Protocol Monorepo: the specification, implementations, peripherals and development kits.
Home Page: https://www.superfluid.finance
License: Other
Superfluid Protocol Monorepo: the specification, implementations, peripherals and development kits.
Home Page: https://www.superfluid.finance
License: Other
ACs:
Spec:
function realtimeBalanceOf(
address account,
uint256 timestamp
)
external
virtual
view
returns (int256 balance, int256 deposit);
We will start to use chi token for upfront fee collections.
We need to have minter code and we need saver code.
ACs:
P.S.:
Saver code could be copied from https://github.com/emilianobonassi/gas-saver/blob/master/ChiGasSaver.sol
Check if NatSpec integration is properly incorporated.
ACs:
FlowAgreement
can creates a new flow, with FLOW_PER_SECOND type of flowRate.FlowAgreement
can calculate realtime balance of a account.SuperToken
as ERC20 token, with realtime balance.state update functions:
view functions:
createFlow
function)
createFlow
function for multiple flows)
updateFlow
function)
deleteFlow
function for multiple flows)
ACs:
Spec:
FlowAgreement.deleteFlow
implementation:
(1) if not sender nor receiver,
(2) check if it allows liquidation: this will check ISuperToken.isAccountInsolvent(sender) or ISuperToken.isAccountInsolvent(receiver)
(3) if (2) is true, then allowing the msg.sender to close the agreement for sender or receiver
(4) distribute the margin as reward
SuperToken.isAccountInsolvent(account)
implementation:
To further save some gas, we may replace the current bytes based agreement storage with field based instead.
some of the files have too long lines, we will enable max line 100 or 120.
Follow the "one agreement one data" principle.
Why can't we simply query the current block.timestamp?
ACs:
Incorporate discussion from the protocol workshop: https://app.diagrams.net/?state=%7B%22folderId%22:%2218OZ-0C2khzIWkuSYnJWyxcqoqR2oQH4h%22,%22action%22:%22create%22,%22userId%22:%22104853936918337007700%22%7D#G1HtfzpS1sKgB5ggFG-mHjCKuYpLKKZlED
Synopsis: a non-upgradable simple contract that upgrades the token for the approving user and transfer all back to the user (for free).
Target Release: v0.2
TBD.
TBD.
Miao will take this on and organize a bit the test cases.
The spec is in the notion doc.
Multiple test tokens have been created and super token wrapper have also been created for them.
They can be resolved to :
And their wrapper could be fetched by using:
const registryAddress = await testResolver.get("SuperfluidRegistry.master");
const registry = await SuperfluidRegistry.at(registryAddress);
const tokenInfo = await TokenInfo.at(tokenAddress);
const superTokenWrapper = Superfluid.getERC20Wrapper(registry, tokenInfo);
const superToken = await SuperToken.at(superTokenWrapper.address)
Synopsis: Currently agreement data is stored as bytes[], and using solidity mapping for addressing, instead we could use fixed sized bytes32[] and direct addressing in assembly to not save the "length" field of the dynamic bytes array.
Target release: v0.1
Changes required in agreements:
The opposite of upgrading token to super token is downgrading, it is important that one can downgrade and see the underlying token again. Checks must be in place to assure the solvency, and one cannot downgrade more than he owns.
static balance + realtime balance
static balance + realtime balance
With typed signature specified in ERC-712, batch operations could be signed in a human readable way in supported wallet interface.
It provides a great UX improvement, as an alternative to the radspec approach.
Target release: v0.2
Synopsis: By enforcing ERC-777, a super token cannot be sent directly to a contract, instead the contract must implement the IERC777Recipient
interface. By doing so the contract could implement additional logic reacting on super token received event.
Target release: v0.1
ERC-777
TBD
if the activeAgreent Array is too big, DoS could be a security issue.
ACs:
In relation to #43, one solution is to always set super token decimals to 18 decimals.
As a consequence:
ACs:
Problem: low decimals of underlying tokens(for example using USDC at 6 decimals, ~2.5 USDC/mo granularity)
Synopsis: The agreement should be implemented in such way that when bond system is put in place, its code needs not to be updated.
Having two state variables for the balance is a waste. We could consider to eliminate ERC20Base all together to have an single version of SuperToken that does it efficiently.
ACs:
ACs:
A leading underscore should indicate it is a private/internal field of the contract, using it in other cases loses its purpose.
Add token upgrade/downgrade operation to Superfluid.batchCall.
Include agreementClass and version.
Tips for the agent:
Synopsis: Due to the use of call proxy, batch call, etc, it is not a simple web3 call to interact with the superfluid frameworks, a minimalistic js-sdk is shipped along with the project to simplify the usages. Framework class is the main class used for that purpose.
Deferring these to new tickets:
- [ ] sf.ida
- [ ] createIndex
- [ ] updateIndex/distribute
- [ ] approveSubcription
- [ ] updateSubscription
- [ ] listSubscription
- [ ] deleteSubscription
- [ ] sf.callAppAction
- [ ] sf.batchCall
Related to #43
Rationale:
--
Alright, we are not doing this. But I will write it down as a archived issue.
We are opting for 18 decimals super tokens.
Add TransferFrom operation to Superfluid.batchCall.
ContractName.v0
in resolversA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.