Skip to content

Commit

Permalink
Feat(rabbithole): implement quest
Browse files Browse the repository at this point in the history
  • Loading branch information
Quazia committed Oct 31, 2023
1 parent 52f6d65 commit 24e7274
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packages/rabbithole/src/Rabbithole.ts
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

}

0 comments on commit 24e7274

Please sign in to comment.