Skip to content

Commit

Permalink
add referrer
Browse files Browse the repository at this point in the history
  • Loading branch information
finnian0826 committed Dec 19, 2024
1 parent 89abd96 commit 6b1436e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/abis/IWalletJumpstart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,25 @@ const jumpstart = {
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: '',
type: 'address',
},
],
name: 'referrer',
outputs: [
{
internalType: 'address',
name: '',
type: 'address',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
Expand Down
10 changes: 9 additions & 1 deletion src/swap/useSwapQuote.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BigNumber from 'bignumber.js'
import { useAsyncCallback } from 'react-async-hook'
import walletJumpstart from 'src/abis/IWalletJumpstart'
import { useSelector } from 'src/redux/hooks'
import {
FetchQuoteResponse,
Expand Down Expand Up @@ -193,7 +194,14 @@ function useSwapQuote({
return null
}

const referrer = '' // TODO: Add logic to get referrer from https://github.com/valora-labs/peer2peer-funding-layer/blob/main/contracts/WalletJumpstartHack.sol#L33 using walletAddress
const client = publicClient[networkIdToNetwork[networkId]]

const referrer = await client.readContract({
address: '' as Address, // Add the new WalletJumpstartHack address here
abi: walletJumpstart.abi,
functionName: 'referrer',
args: [walletAddress as Address],
})

const swapAmountParam = updatedField === Field.FROM ? 'sellAmount' : 'buyAmount'
const params = {
Expand Down

0 comments on commit 6b1436e

Please sign in to comment.