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

Improve schema #204

Merged
merged 8 commits into from
Dec 13, 2024
Merged
6 changes: 3 additions & 3 deletions subgraphs/isolated-pools/src/operations/create.ts
Original file line number Diff line number Diff line change
@@ -300,10 +300,10 @@ export const createMarketPositionBadDebt = (
marketPositionBadDebt.save();
};

export const createRewardDistributor = (
export function createRewardDistributor(
rewardsDistributorAddress: Address,
comptrollerAddress: Address,
): RewardsDistributor => {
): RewardsDistributor {
const rewardDistributorContract = RewardDistributorContract.bind(rewardsDistributorAddress);
const rewardToken = rewardDistributorContract.rewardToken();
const id = getRewardsDistributorId(rewardsDistributorAddress);
@@ -330,4 +330,4 @@ export const createRewardDistributor = (
}
}
return rewardsDistributor;
};
}
6 changes: 3 additions & 3 deletions subgraphs/isolated-pools/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
@@ -104,10 +104,10 @@ export const getOrCreateMarketPosition = (
return { entity: marketPosition, created };
};

export const getOrCreateRewardSpeed = (
export function getOrCreateRewardSpeed(
rewardsDistributorAddress: Address,
marketAddress: Address,
): RewardSpeed => {
): RewardSpeed {
const id = getRewardSpeedId(rewardsDistributorAddress, marketAddress);
let rewardSpeed = RewardSpeed.load(id);
if (!rewardSpeed) {
@@ -119,7 +119,7 @@ export const getOrCreateRewardSpeed = (
rewardSpeed.save();
}
return rewardSpeed as RewardSpeed;
};
}

export const getOrCreateRewardDistributor = (
rewardsDistributorAddress: Address,
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@ import exponentToBigInt from './exponentToBigInt';
import valueOrNotAvailableIntIfReverted from './valueOrNotAvailableIntIfReverted';

// Used for all vBEP20 contracts
const getTokenPriceInCents = (
function getTokenPriceInCents(
poolAddress: Address,
tokenAddress: Address,
underlyingDecimals: i32,
): BigInt => {
): BigInt {
const pool = getPool(poolAddress);
// will return NOT_AVAILABLE if the price cannot be fetched
let underlyingPrice = NOT_AVAILABLE_BIG_INT;
@@ -31,6 +31,6 @@ const getTokenPriceInCents = (
underlyingPrice;
}
return underlyingPrice;
};
}

export default getTokenPriceInCents;