Skip to content

Commit

Permalink
TheGraph: update to the latest version, fix isFreezed
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzia551 committed Sep 1, 2020
1 parent 99c7e4e commit 8b97cc4
Show file tree
Hide file tree
Showing 10 changed files with 18,920 additions and 17,783 deletions.
36,427 changes: 18,678 additions & 17,749 deletions build/contracts/LendingPoolCore.json

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions thegraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ More information about TheGraph can be found on https://thegraph.com/docs/quick-
### raw
Data presented as in the smartcontracts in small units (wei, etc), deployed at:

https://thegraph.com/explorer/subgraph/aave/protocol-multy-raw - mainnet
https://thegraph.com/explorer/subgraph/aave/protocol-raw - mainnet

https://thegraph.com/explorer/subgraph/aave/protocol-multy-ropsten-raw - ropsten
https://thegraph.com/explorer/subgraph/aave/protocol-ropsten-raw - ropsten

https://thegraph.com/explorer/subgraph/aave/protocol-multy-kovan-raw - kovan

### formatted (DEPRECATED, available only for main Aave pool)
Data formatted to big units with floating point, deployed at:
### formatted
Data formatted to big units with floating point (deprecated), deployed at:

https://thegraph.com/explorer/subgraph/aave/protocol - mainnet

Expand Down
2 changes: 1 addition & 1 deletion thegraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"deploy-multy-ropsten-raw": "NETWORK=ropsten TYPE=raw NAME=protocol-multy-ropsten-raw npm run deploy-remote",
"deploy-multy-kovan-raw": "NETWORK=kovan TYPE=raw NAME=protocol-multy-kovan-raw npm run deploy-remote",
"deploy-multy-main-raw": "NETWORK=mainnet TYPE=raw NAME=protocol-multy-raw npm run deploy-remote",
"deploy-all-multy-remote": "deploy-multy-ropsten-raw && npm run deploy-multy-kovan-raw"
"deploy-all-multy-remote": "npm run deploy-multy-main-raw && npm run deploy-multy-ropsten-raw && npm run deploy-multy-kovan-raw"
},
"repository": {
"type": "git",
Expand Down
18 changes: 18 additions & 0 deletions thegraph/raw/generated/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,15 @@ export class ReserveConfigurationHistoryItem extends Entity {
this.set("isActive", Value.fromBoolean(value));
}

get isFreezed(): boolean {
let value = this.get("isFreezed");
return value.toBoolean();
}

set isFreezed(value: boolean) {
this.set("isFreezed", Value.fromBoolean(value));
}

get reserveInterestRateStrategy(): Bytes {
let value = this.get("reserveInterestRateStrategy");
return value.toBytes();
Expand Down Expand Up @@ -2650,6 +2659,15 @@ export class Reserve extends Entity {
this.set("isActive", Value.fromBoolean(value));
}

get isFreezed(): boolean {
let value = this.get("isFreezed");
return value.toBoolean();
}

set isFreezed(value: boolean) {
this.set("isFreezed", Value.fromBoolean(value));
}

get price(): string {
let value = this.get("price");
return value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ export class DefaultReserveInterestRateStrategy extends ethereum.SmartContract {
);
}

EXCESS_UTILIZATION_RATE(): BigInt {
let result = super.call(
"EXCESS_UTILIZATION_RATE",
"EXCESS_UTILIZATION_RATE():(uint256)",
[]
);

return result[0].toBigInt();
}

try_EXCESS_UTILIZATION_RATE(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"EXCESS_UTILIZATION_RATE",
"EXCESS_UTILIZATION_RATE():(uint256)",
[]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

OPTIMAL_UTILIZATION_RATE(): BigInt {
let result = super.call(
"OPTIMAL_UTILIZATION_RATE",
Expand Down Expand Up @@ -84,20 +107,20 @@ export class DefaultReserveInterestRateStrategy extends ethereum.SmartContract {
return ethereum.CallResult.fromValue(value[0].toAddress());
}

getBaseVariableBorrowRate(): BigInt {
baseVariableBorrowRate(): BigInt {
let result = super.call(
"getBaseVariableBorrowRate",
"getBaseVariableBorrowRate():(uint256)",
"baseVariableBorrowRate",
"baseVariableBorrowRate():(uint256)",
[]
);

return result[0].toBigInt();
}

try_getBaseVariableBorrowRate(): ethereum.CallResult<BigInt> {
try_baseVariableBorrowRate(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"getBaseVariableBorrowRate",
"getBaseVariableBorrowRate():(uint256)",
"baseVariableBorrowRate",
"baseVariableBorrowRate():(uint256)",
[]
);
if (result.reverted) {
Expand All @@ -107,20 +130,35 @@ export class DefaultReserveInterestRateStrategy extends ethereum.SmartContract {
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

getStableRateSlope1(): BigInt {
reserve(): Address {
let result = super.call("reserve", "reserve():(address)", []);

return result[0].toAddress();
}

try_reserve(): ethereum.CallResult<Address> {
let result = super.tryCall("reserve", "reserve():(address)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}

stableRateSlope1(): BigInt {
let result = super.call(
"getStableRateSlope1",
"getStableRateSlope1():(uint256)",
"stableRateSlope1",
"stableRateSlope1():(uint256)",
[]
);

return result[0].toBigInt();
}

try_getStableRateSlope1(): ethereum.CallResult<BigInt> {
try_stableRateSlope1(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"getStableRateSlope1",
"getStableRateSlope1():(uint256)",
"stableRateSlope1",
"stableRateSlope1():(uint256)",
[]
);
if (result.reverted) {
Expand All @@ -130,20 +168,89 @@ export class DefaultReserveInterestRateStrategy extends ethereum.SmartContract {
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

getStableRateSlope2(): BigInt {
stableRateSlope2(): BigInt {
let result = super.call(
"getStableRateSlope2",
"getStableRateSlope2():(uint256)",
"stableRateSlope2",
"stableRateSlope2():(uint256)",
[]
);

return result[0].toBigInt();
}

try_getStableRateSlope2(): ethereum.CallResult<BigInt> {
try_stableRateSlope2(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"getStableRateSlope2",
"getStableRateSlope2():(uint256)",
"stableRateSlope2",
"stableRateSlope2():(uint256)",
[]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

variableRateSlope1(): BigInt {
let result = super.call(
"variableRateSlope1",
"variableRateSlope1():(uint256)",
[]
);

return result[0].toBigInt();
}

try_variableRateSlope1(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"variableRateSlope1",
"variableRateSlope1():(uint256)",
[]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

variableRateSlope2(): BigInt {
let result = super.call(
"variableRateSlope2",
"variableRateSlope2():(uint256)",
[]
);

return result[0].toBigInt();
}

try_variableRateSlope2(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"variableRateSlope2",
"variableRateSlope2():(uint256)",
[]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

getBaseVariableBorrowRate(): BigInt {
let result = super.call(
"getBaseVariableBorrowRate",
"getBaseVariableBorrowRate():(uint256)",
[]
);

return result[0].toBigInt();
}

try_getBaseVariableBorrowRate(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"getBaseVariableBorrowRate",
"getBaseVariableBorrowRate():(uint256)",
[]
);
if (result.reverted) {
Expand Down Expand Up @@ -199,6 +306,52 @@ export class DefaultReserveInterestRateStrategy extends ethereum.SmartContract {
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

getStableRateSlope1(): BigInt {
let result = super.call(
"getStableRateSlope1",
"getStableRateSlope1():(uint256)",
[]
);

return result[0].toBigInt();
}

try_getStableRateSlope1(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"getStableRateSlope1",
"getStableRateSlope1():(uint256)",
[]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

getStableRateSlope2(): BigInt {
let result = super.call(
"getStableRateSlope2",
"getStableRateSlope2():(uint256)",
[]
);

return result[0].toBigInt();
}

try_getStableRateSlope2(): ethereum.CallResult<BigInt> {
let result = super.tryCall(
"getStableRateSlope2",
"getStableRateSlope2():(uint256)",
[]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}

calculateInterestRates(
_reserve: Address,
_availableLiquidity: BigInt,
Expand Down Expand Up @@ -276,28 +429,32 @@ export class ConstructorCall__Inputs {
this._call = call;
}

get _provider(): Address {
get _reserve(): Address {
return this._call.inputValues[0].value.toAddress();
}

get _provider(): Address {
return this._call.inputValues[1].value.toAddress();
}

get _baseVariableBorrowRate(): BigInt {
return this._call.inputValues[1].value.toBigInt();
return this._call.inputValues[2].value.toBigInt();
}

get _variableRateSlope1(): BigInt {
return this._call.inputValues[2].value.toBigInt();
return this._call.inputValues[3].value.toBigInt();
}

get _variableRateSlope2(): BigInt {
return this._call.inputValues[3].value.toBigInt();
return this._call.inputValues[4].value.toBigInt();
}

get _stableRateSlope1(): BigInt {
return this._call.inputValues[4].value.toBigInt();
return this._call.inputValues[5].value.toBigInt();
}

get _stableRateSlope2(): BigInt {
return this._call.inputValues[5].value.toBigInt();
return this._call.inputValues[6].value.toBigInt();
}
}

Expand Down
1 change: 1 addition & 0 deletions thegraph/raw/initializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export function getOrInitReserve(underlyingAsset: Address, event: ethereum.Event
reserve.borrowingEnabled = false;
reserve.stableBorrowRateEnabled = false;
reserve.isActive = false;
reserve.isFreezed = false;
reserve.baseLTVasCollateral = zeroBI();
reserve.reserveLiquidationThreshold = zeroBI();
reserve.reserveLiquidationBonus = zeroBI();
Expand Down
14 changes: 14 additions & 0 deletions thegraph/raw/mapping/lending-pool-configurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function saveReserve(reserve: Reserve, event: ethereum.Event): void {
configurationHistoryItem.borrowingEnabled = reserve.borrowingEnabled;
configurationHistoryItem.stableBorrowRateEnabled = reserve.stableBorrowRateEnabled;
configurationHistoryItem.isActive = reserve.isActive;
configurationHistoryItem.isFreezed = reserve.isFreezed;
configurationHistoryItem.reserveInterestRateStrategy = reserve.reserveInterestRateStrategy;
configurationHistoryItem.baseLTVasCollateral = reserve.baseLTVasCollateral;
configurationHistoryItem.reserveLiquidationThreshold = reserve.reserveLiquidationThreshold;
Expand Down Expand Up @@ -183,6 +184,7 @@ export function handleStableRateEnabledOnReserve(event: StableRateEnabledOnReser
reserve.stableBorrowRateEnabled = true;
saveReserve(reserve, event);
}

export function handleReserveActivated(event: ReserveActivated): void {
let reserve = getOrInitReserve(event.params._reserve, event);
reserve.isActive = true;
Expand All @@ -193,6 +195,18 @@ export function handleReserveDeactivated(event: ReserveDeactivated): void {
reserve.isActive = false;
saveReserve(reserve, event);
}

export function handleReserveFreezed(event: ReserveActivated): void {
let reserve = getOrInitReserve(event.params._reserve, event);
reserve.isFreezed = true;
saveReserve(reserve, event);
}
export function handleReserveUnfreezed(event: ReserveDeactivated): void {
let reserve = getOrInitReserve(event.params._reserve, event);
reserve.isFreezed = false;
saveReserve(reserve, event);
}

export function handleReserveDisabledAsCollateral(event: ReserveDisabledAsCollateral): void {
let reserve = getOrInitReserve(event.params._reserve, event);
reserve.usageAsCollateralEnabled = false;
Expand Down
Loading

0 comments on commit 8b97cc4

Please sign in to comment.