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

fix: sync issues #4

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions ponder.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const generateLMSeasonEnum = (numSeasons: number) => {
* - "liquid_mining_twelve_seasons": Indexes twelve seasons in Liquid Mining (1000 * 10^6 points)
* - ...generateLMSeasonEnum(120): Indexes first wallet in a Liquid Mining new season (500 * 10^6 points)
*/
const PointsSource = [
const pointsSource = [
"stratosphere_enrollment",
"dex_aggregator_swap",
"dex_aggregator_1k_swaps",
Expand All @@ -55,7 +55,7 @@ const PointsSource = [
];

export default createSchema((p) => ({
PointsSource: p.createEnum(PointsSource),
PointsSource: p.createEnum(pointsSource),
Points: p.createTable({
id: p.string(),
// Use enum for points source
Expand Down
2 changes: 1 addition & 1 deletion src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const deployedBlockTimestamps = {
*/
export const addresses: AddressMap = {
Stratosphere: {
[Chains.AVALANCHE]: "0x08e287adcf9bf6773a87e1a278aa9042bef44b60",
[Chains.AVALANCHE]: "0x08e287adCf9BF6773a87e1a278aa9042BEF44b60",
},

DexAggregator: {
Expand Down
22 changes: 16 additions & 6 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,23 @@ export async function getTokenId(
): Promise<bigint> {
const { client, network } = context;

const tokenId = await client.readContract({
abi: StratosphereAbi,
address: addresses.Stratosphere![network.name] as `0x${string}`,
functionName: "tokenIdOf",
args: [address],
});
let tokenId = 0n;
let revertedAddresses = [];

try {
tokenId = await client.readContract({
abi: StratosphereAbi,
address: addresses.Stratosphere![network.name] as `0x${string}`,
functionName: "tokenIdOf",
args: [address],
});
} catch (e) {
revertedAddresses.push(address);
}

if (revertedAddresses.length > 0) {
console.log(revertedAddresses);
}
return tokenId;
}

Expand Down
Loading