Skip to content

Commit

Permalink
refactor: remove max assets
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Jan 15, 2025
1 parent e337e57 commit 2ba2e7a
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 16 deletions.
2 changes: 0 additions & 2 deletions subgraphs/venus/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ type Comptroller @entity {
closeFactorMantissa: BigInt!
"The percent bonus liquidators get for liquidating"
liquidationIncentive: BigInt!
"Max assets a single user can enter (not used in comptroller logic)"
maxAssets: BigInt!
}

"""
Expand Down
2 changes: 0 additions & 2 deletions subgraphs/venus/src/mappings/comptroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ import { updateXvsSupplyState } from '../operations/updateXvsSupplyState';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function handleInitialization(block: ethereum.Block): void {
const comptroller = new Comptroller(comptrollerAddress);
const comptrollerContract = ComptrollerContract.bind(comptrollerAddress);
comptroller.address = comptrollerAddress;
comptroller.priceOracle = nullAddress;
comptroller.closeFactorMantissa = zeroBigInt32;
comptroller.liquidationIncentive = zeroBigInt32;
comptroller.maxAssets = comptrollerContract.maxAssets();
comptroller.save();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ query Comptrollers {
priceOracle
closeFactorMantissa
liquidationIncentive
maxAssets
}
}
8 changes: 0 additions & 8 deletions subgraphs/venus/tests/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ export const createComptrollerMock = (vTokens: Address[]): void => {
'liquidationIncentiveMantissa():(uint256)',
).returns([ethereum.Value.fromI32(1)]);

createMockedFunction(comptrollerAddress, 'maxAssets', 'maxAssets():(uint256)').returns([
ethereum.Value.fromI32(10),
]);

createMockedFunction(comptrollerAddress, 'oracle', 'oracle():(address)').returns([
ethereum.Value.fromAddress(priceOracleAddress),
]);
Expand All @@ -221,10 +217,6 @@ export const createComptrollerMock = (vTokens: Address[]): void => {
'liquidationIncentiveMantissa():(uint256)',
).returns([ethereum.Value.fromUnsignedBigInt(BigInt.fromString('1000000000000000'))]);

createMockedFunction(comptrollerAddress, 'maxAssets', 'maxAssets():(uint256)').returns([
ethereum.Value.fromUnsignedBigInt(BigInt.fromString('999')),
]);

vTokens.forEach(vToken => {
createMockedFunction(comptrollerAddress, 'supplyCaps', 'supplyCaps(address):(uint256)')
.withArgs([ethereum.Value.fromAddress(vToken)])
Expand Down
4 changes: 1 addition & 3 deletions subgraphs/venus/tests/scripts/checkComptroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@ const checkComptroller = async (
) => {
const { comptroller } = await subgraphClient.getComptroller();
const comptrollerContract = new ethers.Contract(comptroller.id, ComptrollerAbi, provider);
const [priceOracle, closeFactorMantissa, liquidationIncentive, maxAssets] = await Promise.all([
const [priceOracle, closeFactorMantissa, liquidationIncentive] = await Promise.all([
comptrollerContract.oracle(),
comptrollerContract.closeFactorMantissa(),
comptrollerContract.liquidationIncentiveMantissa(),
comptrollerContract.maxAssets(),
]);
try {
assertEqual(comptroller, priceOracle, 'priceOracle', getAddress);
assertEqual(comptroller, closeFactorMantissa, 'closeFactorMantissa');
assertEqual(comptroller, liquidationIncentive, 'liquidationIncentive');
assertEqual(comptroller, maxAssets, 'maxAssets');
console.log(`correct values on comptroller entity - ${comptroller.id}`);
} catch (e) {
console.log(e.message);
Expand Down

0 comments on commit 2ba2e7a

Please sign in to comment.