-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,44 @@ | ||
|
||
import { type TransactionFilter, type QuestActionParams, compressJson } from '@rabbitholegg/questdk' | ||
import { type Address } from 'viem' | ||
|
||
import { RABBITHOLE_ABI } from './abi' | ||
import {DEFAULT_SWAP_TOKEN_LIST, RABBITHOLE_QUEST_FACTORY} from './contract-addresses' | ||
import { CHAIN_ID_ARRAY } from './chain-ids' | ||
export const quest = async (quest: QuestActionParams): Promise<TransactionFilter> => { | ||
// This is the information we'll use to compose the Transaction object | ||
const { | ||
chainId, | ||
contractAddress, | ||
rewardTokenId, | ||
rewardAmount, | ||
startTime, | ||
endTime, | ||
totalParticipants, | ||
actionSpec, | ||
actionSpec, // Currently unused | ||
} = quest | ||
|
||
// We always want to return a compressed JSON object which we'll transform into a TransactionFilter | ||
return compressJson({ | ||
chainId: 0, // The chainId of the source chain | ||
to: 0x0, // The contract address of the bridge | ||
input: {}, // The input object is where we'll put the ABI and the parameters | ||
chainId: chainId, // The chainId of the source chain | ||
to: contractAddress || RABBITHOLE_QUEST_FACTORY, // The contract address of the bridge | ||
input: { | ||
$abi: RABBITHOLE_ABI, | ||
rewardTokenAddress_: rewardTokenId, | ||
endTime_: endTime, | ||
startTime_: startTime, | ||
totalParticipants_: totalParticipants, | ||
rewardAmount_: rewardAmount, | ||
}, // The input object is where we'll put the ABI and the parameters | ||
}) | ||
} | ||
|
||
export const getSupportedTokenAddresses = async (_chainId: number) => { | ||
// Given a specific chain we would expect this function to return a list of supported token addresses | ||
return DEFAULT_SWAP_TOKEN_LIST[_chainId] | ||
} | ||
|
||
|
||
export const getSupportedChainIds = async () => { | ||
// This should return all of the ChainIds that are supported by the Project we're integrating | ||
return CHAIN_ID_ARRAY | ||
|
||
} |