-
Notifications
You must be signed in to change notification settings - Fork 3
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 Collateral Swap Extension #29
base: main
Are you sure you want to change the base?
Conversation
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.
Really neat extension! I have a few comments regarding the extension UI:
- In the warning banner at the top, it would be good to explicitly call out that the contracts have not been audited yet.
The numbers are difficult to read, so I suggest adding comma separators or using abbreviations (K, M, B, etc.).
3. It's nice that the extension displays the expected amount of new collateral I'll receive as well as the position summary after the swap. I think it would be useful to also see the exchange rate I'm getting for the collateral. e.g. what's the MATIC / WETH price or the dollar price of MATIC that I am getting with this swap
4. The information toggle next to the fees is not working for me.
src/Extensions.ts
Outdated
sign: '*', | ||
}, | ||
source: { | ||
url: "https://wido-extension-template.vercel.app/embedded.html" |
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.
Could we use an ipfs link instead? See the comet_migrator
extension above for an example of how to configure it.
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.
Would it be acceptable to use our backend to serve the "Beta" version, and only deploy the final version to IPFS?
Please let us know if deploying to IPFS even for the Beta launch is necessary and we will do that.
Note: In this post, we proposed the Beta to run for 1 month, in which we would collect feedback. After incorporating the feedback we can launch the final version.
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.
Just spoke with the team about this and we think using IPFS links is necessary. Even though most third-party devs like yourself that are taking the time to build extensions are probably very trustworthy, we want to remove that layer of trust altogether and make sure that whatever is approved as an extension can't be changed without another set of approvals.
Hey @ajb413 @kevincheng96 @torreyatcitty thank you for your reviews. We will follow up soon @kevincheng96 regarding your point 4: information toggle next to the fees is not working. Try hovering for longer time, the info should popup. We currently use browser's native way to display that info and it only works with hover. Is there a UI component by Compound that we could reuse for this element, to avoid building custom one? |
Ah I see, I had to hover for a couple of seconds, but am able to see it now. Btw the cursor turns into the clickable icon when hovering over it, so may be another small fix that should be done. I don't think we currently have a custom toggle component, but will let @torreyatcitty confirm. |
We have a custom built tooltip component in our app that's probably a little too highly coupled with our architecture to just send over as is. Are you using React to build the front end? Another super easy way if it's nothing fancy is to just do it all in css like it's done here: https://www.w3schools.com/css/tryit.asp?filename=trycss_tooltip |
We resolved all the issues mentioned above, namely: Resolved issues (raised by @kevincheng96):Fix info toggle Resolved issues (raised by @torreyatcitty)Fix error when trying to swap Next steps: final review & deployment to IPFS@kevincheng96 mentioned to deploy the UI to IPFS. We propose to do that as the final step in this PR, right before it gets merged. @kevincheng96 @torreyatcitty Can we kindly ask you for another round of reviews and if everything is now good from your side (except for deploying to IPFS)? Once you confirm, we will deploy to IPFS and ask you to merge this PR. Note: Thank you @torreyatcitty for your hint on the CSS tooltip. We ended up using it. |
The fixes in the UI look good to me. |
Cool, confirmed the fixes look good to me also. |
@torreyatcitty @kevincheng96 thank you for your reviews, glad to hear it's all good! We will now proceed to deploying to IPFS so that this PR can be merged and the Collateral Swap Extension is launched as Will also plan some marketing around this to ensure people see it and try it out, hopefully with help from the Compound marketing team (@ajb413 for visibility) |
c406dfd
to
cfa074b
Compare
cfa074b
to
55d5413
Compare
trx: [ | ||
{ | ||
contract: '$operator', | ||
abi: 'swapCollateral((address,uint256),(address,uint256),((uint8,bytes32,bytes32),(uint8,bytes32,bytes32)),(address,address,bytes),address)', | ||
params: '*' | ||
} | ||
] |
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.
@kevincheng96 @hayesgm @mykelp I have added the required permission for the app to execute the transaction. Could you verify that it looks fine? I am most interested in the contract: '$operator'
line, since I'm not sure what the "$operator" placeholder is replaced with.
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.
the trx object does look ok to me. $operator
is meant to signal your smart contract and you do look to have it specified correctly. What error are you currently getting?
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.
@torreyatcitty thanks, with this changes it should work fine then.
Currently the issue is that the deployed version didn't include the trx
permissions, so it's failing at the time of actually executing the transaction.
On the embedded sandbox it works fine, with or without the permissions, but once deployed it gets blocked without them.
Being this correct, I think next step would be to re-deploy so it takes the right permissions on the prod app?
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.
ah i see, yes the current version on prod does not have the trx
permission. Will share an updated test build with the newer permission.
Context
The Wido team (https://www.joinwido.com/) is submitting this PR to add a Collateral Swap extension for Compound v3. This work was created as part of the CGP grants.
More context about this work has been posted on the Compound Forum.
Sandbox
You can play with the extension here: https://app.compound.finance/extensions/sandbox?market=usdc-mainnet&sandboxsource=https%3A%2F%2Ffleek.ipfs.io%2Fipfs%2FQmQjT6NRo4Hvj7ZGdfA5UMLzN9ZSveN2oxQykugKZoFhgV%2Fembedded.html
Curation and Safety
Our answers to the Curation and Safety Questions can be found in the Forum Post.
Links to accompanying code