Skip to content
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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/Extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,34 @@ export const extensions: Extension[] = [
supportedMarkets: {
'1_USDC_0xc3d688B66703497DAA19211EEdff47f25384cdc3': null
}
},
{
id: 'collateral_swap',
name: 'Collateral Swap',
description: 'Enables swapping collateral on open loan positions without the need to repay the loan, in a single transaction',
developer: 'Wido Labs',
links: {
github: 'https://github.com/widolabs/compound-collateral-extension-ui',
website: 'https://www.joinwido.com/'
},
permissions: {
sign: '*',
trx: [
{
contract: '$operator',
abi: 'swapCollateral((address,uint256),(address,uint256),((uint8,bytes32,bytes32),(uint8,bytes32,bytes32)),(address,address,bytes),address)',
params: '*'
}
]
Comment on lines +70 to +76
Copy link
Author

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.

Copy link
Contributor

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?

Copy link
Author

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?

Copy link
Contributor

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.

},
source: {
url: "https://ipfs.fleek.co/ipfs/QmcEEQekV9Vz4oN519uBsPLqjXUs7YathsvGvjNtbC3Y88/embedded.html"
},
supportedMarkets: {
'1_USDC_0xc3d688B66703497DAA19211EEdff47f25384cdc3': null,
'1_WETH_0xA17581A9E3356d9A858b789D68B4d866e593aE94': null,
'137_USDC_0xF25212E676D1F7F89Cd72fFEe66158f541246445': null,
'42161_USDC_0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA': null
}
}
];