superfluid-finance / custom-supertokens Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Please start to reuse the utils/SuperfluidFrameworkDeployer.sol
from the ethereum-contracts 1.2.1 release.
See test/foundry/FoundrySuperfluidTester.sol
for its example usage.
This project should take 4 weeks of development time to get to a functional MVP
https://whimsical.com/super-token-wizard-FxPFgUiRnQthXs6VHdXeaT
$1000 in USDC on Polygon
We want a canonical implementation of a Pure SuperToken which acts as a representation of an underlying ERC20 located on a different chain.
In order to have a common code base independent of the bridge, we add the xERC20 interface to the token contract.
Currently supported bridges
The principle was pioneered by the FRACTION token. In that case, the xERC20 interface was implemented in the logic contract, see https://polygonscan.com/address/0xfd5036ace91006ff84918e1884161999099950f0#code.
This pattern however adds maintenance overhead, as a fork of SuperToken with xERC20 added needs to be maintained. Also, SuperToken is already close to the contract size limit. The current FRACTION logic implements just a minimal version of xERC20 (as the interface was smaller at the time of its implementation).
Since targeting use cases of yet-to-be-deployed tokens, we can also implement the xERC20 logic in the proxy contract itself. This avoids the additional maintenance cost of a forked SuperToken logic.
There is a reference implementation at https://github.com/defi-wonderland/xERC20.
The plan is to port the xERC20 specific implementation to this repo, based on PureSuperToken.sol.
After supporting Toki with the creation of a custom Pure SuperToken, this are some observations of potential pitfalls / sources of confusion:
SuperTokenBase
is not a very descriptive name / the role of that contract isn't explained well enough. Users of it should understand it's a proxy and contains storage paddings. Also don't assume everybody is already familiar with proxy, link to a good explanation of the concept.SuperTokenBase
may be more confusing than helpful. If kept, it should be well documented what this is and how it works. Explain that with the proxy constructions, this external calls are kind of like super.x() calls into base contracts in "normal" contracts.Previous work: superfluid-finance/protocol-monorepo#494
Background: currently none of our custom super token examples show that you can make custom super token logic upgradable. This is the ticket to address that.
Take https://github.com/superfluid-finance/protocol-monorepo/blob/dev/packages/ethereum-contracts/contracts/tokens/MaticBridgedNativeSuperToken.sol away from ethereum-contracts repo.
This repo has JS code without semicolons and tab indentation, enforced by a commit hook.
Should be changed to reflect the code style in other SF repos.
Also, we may want a more conventional setup with eslint instead of this somewhat opaque setup with husky in a commit hook (or at least document it).
And remove scripts/utils/constants.js
closes #26
ethereum-contracts
validates examples to make sure we update examples as needed.hardhat-example/
hardhat full examples, and foundry-example/
minimum foundry example.I was able to easily deploy a supertoken using these scripts but unfortnuately verify the contracts is proving to be difficult. I'm creating this issue to report that and to ask if you know how to verify these contract @ngmachado. I think it stems from using web3tx. Without easy verification it makes working with the token on mumbai polygonscan difficult.
We need to fix the tests.
Also from the logs, i see a lot of compiler downloading attempts.
Upgrade project to use Hardhat
Vijay: seems like Etherscan have stopped supporting the automatic proxy verification, you might have to click "is this a proxy?" and letting it match the default one for super token wrappers for etherscan interactions for a while...
https://discord.com/channels/752490247643725875/752493319657095168/1089949208464867418
Could this be why I'm suddenly having an issue verifying supertokens on Goerli?
$ npx truffle run --network goerli verify BurnMintSuperToken@0xA862f128b3ffE9719948869cc1C7CBC21860Cd9a --custom-proxy BurnMintSuperToken
Verifying contracts on etherscan
Verifying BurnMintSuperToken@0xA862f128b3ffE9719948869cc1C7CBC21860Cd9a
Verifying custom proxy contract BurnMintSuperToken at 0xA862f128b3ffE9719948869cc1C7CBC21860Cd9a
Verifying proxy implementation BurnMintSuperToken at 0xdcde53f3b5e275109ff105f4dcab6925fc62791a
Invalid constructor arguments provided. Please verify that they are in ABI-encoded format
Failed to verify 1 contract(s): BurnMintSuperToken@0xA862f128b3ffE9719948869cc1C7CBC21860Cd9a
Or is this something related to how constructor args might have been done on token deployment. I think I might have done something wrong on deployment.
A 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.