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
feat(smart-contarcts): add support for swap and purchase when a discount hook is activated #13456
Conversation
Using `callData` !
Renaming for clarity!
@@ -77,6 +77,29 @@ contract UnlockSwapPurchaser { | |||
: IMintableERC20(token).balanceOf(address(this)); | |||
} | |||
|
|||
function getKeyPrice( |
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.
Let's add a comment that this does it only for the the first recipient.
console.log(srcToken); | ||
console.log(msg.sender); | ||
console.log(address(this)); | ||
console.log(amountInMax); | ||
TransferHelper.safeTransferFrom( |
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.
Right now, this fails. But I am not sure why :/
) | ||
|
||
// WHY DOES THIS FAIL? | ||
await tokenContract |
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.
This fails, even though the approval above is correct so I am really confused.
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.
Error: VM Exception while processing transaction: reverted with reason string 'ERC20: transfer amount exceeds allowance'
@@ -20,14 +20,14 @@ | |||
"@nomiclabs/hardhat-ethers": "2.2.3", | |||
"@nomiclabs/hardhat-waffle": "2.0.6", | |||
"@uniswap/permit2-sdk": "1.2.0", | |||
"@uniswap/sdk-core": "4.0.9", | |||
"@uniswap/smart-order-router": "3.19.2", | |||
"@uniswap/v3-sdk": "3.10.2", |
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.
Removed as this was not used. This seems to help remove errors!
"@unlock-protocol/contracts": "workspace:^", | ||
"@unlock-protocol/networks": "workspace:^", | ||
"@unlock-protocol/tsconfig": "workspace:^", | ||
"@unlock-protocol/types": "workspace:^", | ||
"ethers": "6.10.0", | ||
"ethersv5": "npm:ethers@^5.7.2", |
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.
Added because the alphe router needs it!
@@ -84,6 +84,7 @@ export const sepolia: NetworkConfig = { | |||
networkName: 'sepolia', | |||
studioName: 'unlock-protocol-sepolia', | |||
}, | |||
swapPurchaser: '0x580A4a5a9612371e3832c4559026B9Ee3b23Cc11', |
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.
Deplpyed on Sepolia but can't test because we're getting 404 on
failed to resolve /ipns/api.uniswap.org/v1/pools/v3/sepolia.json: no link named "sepolia.json" under QmaimGCW33MN3uCAZYQmckXLCFQCgt82bypYt4tWqpiU32
I think we can close that one unless there are things we need to keep? |
yes lets close it. Still annoys me to not know why that |
Description
NB: This is WIP
This can be tested with
Issues
Fixes #
Refs #
Checklist:
Release Note Draft Snippet