diff --git a/packages/subgraph-pool-v2/README.md b/packages/subgraph-pool-v2/README.md index 0dc4bf711..089685fc9 100644 --- a/packages/subgraph-pool-v2/README.md +++ b/packages/subgraph-pool-v2/README.md @@ -37,23 +37,27 @@ npm run generate mainnet -5. auth + + + ``` + +Deploy to THE GRAPH + graph auth + graph deploy teller-pools-v2-mainnet --version-label 0.4.21.4 -6. deploy ! - graph deploy teller-pools-mainnet --version-label 0.4.21-6 - + ``` - + ``` -Deploy to alchemy +## Deploy to alchemy graph deploy tellerv2-poolsv2-mainnet \ --version-label 0.4.21.4 \ @@ -66,6 +70,21 @@ graph deploy tellerv2-poolsv2-mainnet \ ``` +``` + +## Deploy to ormi labs + +npm run generate arbitrum + +npm run codegen && npm run build + + yarn deploy_ormi teller-pools-v2-mainnet + yarn deploy_ormi teller-pools-v2-base + + +``` + + diff --git a/packages/subgraph-pool-v2/generated/schema.ts b/packages/subgraph-pool-v2/generated/schema.ts index d1ea892a5..266afcfd5 100644 --- a/packages/subgraph-pool-v2/generated/schema.ts +++ b/packages/subgraph-pool-v2/generated/schema.ts @@ -582,17 +582,17 @@ export class group_borrower_accepted_funds extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get borrower(): Bytes { @@ -608,17 +608,17 @@ export class group_borrower_accepted_funds extends Entity { this.set("borrower", Value.fromBytes(value)); } - get collateral_amount(): BigDecimal { + get collateral_amount(): BigInt { let value = this.get("collateral_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set collateral_amount(value: BigDecimal) { - this.set("collateral_amount", Value.fromBigDecimal(value)); + set collateral_amount(value: BigInt) { + this.set("collateral_amount", Value.fromBigInt(value)); } get interest_rate(): BigInt { @@ -647,17 +647,17 @@ export class group_borrower_accepted_funds extends Entity { this.set("loan_duration", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } } @@ -772,17 +772,17 @@ export class group_lender_added_principal extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get amount(): BigDecimal { + get amount(): BigInt { let value = this.get("amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set amount(value: BigDecimal) { - this.set("amount", Value.fromBigDecimal(value)); + set amount(value: BigInt) { + this.set("amount", Value.fromBigInt(value)); } get lender(): Bytes { @@ -798,17 +798,17 @@ export class group_lender_added_principal extends Entity { this.set("lender", Value.fromBytes(value)); } - get shares_amount(): BigDecimal { + get shares_amount(): BigInt { let value = this.get("shares_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set shares_amount(value: BigDecimal) { - this.set("shares_amount", Value.fromBigDecimal(value)); + set shares_amount(value: BigInt) { + this.set("shares_amount", Value.fromBigInt(value)); } get shares_recipient(): Bytes { @@ -936,17 +936,17 @@ export class group_earnings_withdrawn extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get amount_pool_shares_tokens(): BigDecimal { + get amount_pool_shares_tokens(): BigInt { let value = this.get("amount_pool_shares_tokens"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set amount_pool_shares_tokens(value: BigDecimal) { - this.set("amount_pool_shares_tokens", Value.fromBigDecimal(value)); + set amount_pool_shares_tokens(value: BigInt) { + this.set("amount_pool_shares_tokens", Value.fromBigInt(value)); } get lender(): Bytes { @@ -962,17 +962,17 @@ export class group_earnings_withdrawn extends Entity { this.set("lender", Value.fromBytes(value)); } - get principal_tokens_withdrawn(): BigDecimal { + get principal_tokens_withdrawn(): BigInt { let value = this.get("principal_tokens_withdrawn"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_tokens_withdrawn(value: BigDecimal) { - this.set("principal_tokens_withdrawn", Value.fromBigDecimal(value)); + set principal_tokens_withdrawn(value: BigInt) { + this.set("principal_tokens_withdrawn", Value.fromBigInt(value)); } get recipient(): Bytes { @@ -1100,30 +1100,30 @@ export class group_defaulted_loan_liquidated extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get amount_due(): BigDecimal { + get amount_due(): BigInt { let value = this.get("amount_due"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set amount_due(value: BigDecimal) { - this.set("amount_due", Value.fromBigDecimal(value)); + set amount_due(value: BigInt) { + this.set("amount_due", Value.fromBigInt(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get liquidator(): Bytes { @@ -1139,17 +1139,17 @@ export class group_defaulted_loan_liquidated extends Entity { this.set("liquidator", Value.fromBytes(value)); } - get token_amount_difference(): BigDecimal { + get token_amount_difference(): BigInt { let value = this.get("token_amount_difference"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set token_amount_difference(value: BigDecimal) { - this.set("token_amount_difference", Value.fromBigDecimal(value)); + set token_amount_difference(value: BigInt) { + this.set("token_amount_difference", Value.fromBigInt(value)); } } @@ -1383,43 +1383,43 @@ export class group_loan_repaid extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } - get interest_amount(): BigDecimal { + get interest_amount(): BigInt { let value = this.get("interest_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set interest_amount(value: BigDecimal) { - this.set("interest_amount", Value.fromBigDecimal(value)); + set interest_amount(value: BigInt) { + this.set("interest_amount", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } get repayer(): Bytes { @@ -1435,30 +1435,30 @@ export class group_loan_repaid extends Entity { this.set("repayer", Value.fromBytes(value)); } - get total_interest_collected(): BigDecimal { + get total_interest_collected(): BigInt { let value = this.get("total_interest_collected"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set total_interest_collected(value: BigDecimal) { - this.set("total_interest_collected", Value.fromBigDecimal(value)); + set total_interest_collected(value: BigInt) { + this.set("total_interest_collected", Value.fromBigInt(value)); } - get total_principal_repaid(): BigDecimal { + get total_principal_repaid(): BigInt { let value = this.get("total_principal_repaid"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set total_principal_repaid(value: BigDecimal) { - this.set("total_principal_repaid", Value.fromBigDecimal(value)); + set total_principal_repaid(value: BigInt) { + this.set("total_principal_repaid", Value.fromBigInt(value)); } } @@ -2123,17 +2123,17 @@ export class group_pool_bid extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get borrower(): Bytes { @@ -2149,30 +2149,30 @@ export class group_pool_bid extends Entity { this.set("borrower", Value.fromBytes(value)); } - get collateral_amount(): BigDecimal { + get collateral_amount(): BigInt { let value = this.get("collateral_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set collateral_amount(value: BigDecimal) { - this.set("collateral_amount", Value.fromBigDecimal(value)); + set collateral_amount(value: BigInt) { + this.set("collateral_amount", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } } @@ -2228,17 +2228,17 @@ export class teller_bid extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get borrower(): Bytes { @@ -2254,30 +2254,30 @@ export class teller_bid extends Entity { this.set("borrower", Value.fromBytes(value)); } - get collateral_amount(): BigDecimal { + get collateral_amount(): BigInt { let value = this.get("collateral_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set collateral_amount(value: BigDecimal) { - this.set("collateral_amount", Value.fromBigDecimal(value)); + set collateral_amount(value: BigInt) { + this.set("collateral_amount", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } } diff --git a/packages/subgraph-pool-v2/package.json b/packages/subgraph-pool-v2/package.json index 8daf7a10e..a361105cc 100644 --- a/packages/subgraph-pool-v2/package.json +++ b/packages/subgraph-pool-v2/package.json @@ -12,6 +12,7 @@ "reset-local": "yarn remove-local && yarn create-local", "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 teller-v2", "test": "yarn graph test", + "deploy_ormi": "bash -c 'source .env && graph deploy \"$0\" --node https://api.subgraph.migration.ormilabs.com/deploy --ipfs https://api.subgraph.migration.ormilabs.com/ipfs --deploy-key \"$ORMI_LABS_DEPLOY_KEY\"'", "format": "eslint './src/**/*.ts' --fix", "ts-node": "ts-node --project ./scripts/tsconfig.json" }, diff --git a/packages/subgraph-pool-v2/src/mappings/core.ts b/packages/subgraph-pool-v2/src/mappings/core.ts index 83945ae03..e524d20de 100644 --- a/packages/subgraph-pool-v2/src/mappings/core.ts +++ b/packages/subgraph-pool-v2/src/mappings/core.ts @@ -19,7 +19,7 @@ import { group_pool_metric_data_point_daily, group_pool_metric_data_point_weekly } from "../../generated/schema" -import { BigInt, Address, BigDecimal } from "@graphprotocol/graph-ts" +import { BigInt, Address, Bytes } from "@graphprotocol/graph-ts" // Constants for time calculations const SECONDS_IN_DAY = BigInt.fromI32(86400) // 24 * 60 * 60 @@ -195,29 +195,29 @@ export function handleBorrowerAcceptedFunds(event: BorrowerAcceptedFunds): void eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.bid_id = bidId.toBigDecimal() + eventEntity.bid_id = bidId eventEntity.borrower = borrower - eventEntity.collateral_amount = collateralAmount.toBigDecimal() + eventEntity.collateral_amount = collateralAmount eventEntity.interest_rate = BigInt.fromI32(interestRate) eventEntity.loan_duration = loanDuration - eventEntity.principal_amount = principalAmount.toBigDecimal() + eventEntity.principal_amount = principalAmount eventEntity.save() // Create or update pool bid entity let bidEntity = new group_pool_bid(poolAddress.toHexString() + "-" + bidId.toString()) bidEntity.group_pool_address = poolAddress - bidEntity.bid_id = bidId.toBigDecimal() + bidEntity.bid_id = bidId bidEntity.borrower = borrower - bidEntity.collateral_amount = collateralAmount.toBigDecimal() - bidEntity.principal_amount = principalAmount.toBigDecimal() + bidEntity.collateral_amount = collateralAmount + bidEntity.principal_amount = principalAmount bidEntity.save() let tellerBidEntity = new teller_bid( bidId.toString() ) tellerBidEntity.group_pool_address = poolAddress - tellerBidEntity.bid_id = bidId.toBigDecimal() + tellerBidEntity.bid_id = bidId tellerBidEntity.borrower = borrower - tellerBidEntity.collateral_amount = collateralAmount.toBigDecimal() - tellerBidEntity.principal_amount = principalAmount.toBigDecimal() + tellerBidEntity.collateral_amount = collateralAmount + tellerBidEntity.principal_amount = principalAmount tellerBidEntity.save() @@ -264,9 +264,9 @@ export function handleWithdraw(event: Withdraw): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.amount_pool_shares_tokens = amountPoolSharesTokens.toBigDecimal() + eventEntity.amount_pool_shares_tokens = amountPoolSharesTokens eventEntity.lender = lender - eventEntity.principal_tokens_withdrawn = principalTokensWithdrawn.toBigDecimal() + eventEntity.principal_tokens_withdrawn = principalTokensWithdrawn eventEntity.recipient = recipient eventEntity.save() @@ -307,9 +307,9 @@ export function handleDeposit(event: Deposit): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.amount = amount.toBigDecimal() + eventEntity.amount = amount eventEntity.lender = lender - eventEntity.shares_amount = sharesAmount.toBigDecimal() + eventEntity.shares_amount = sharesAmount eventEntity.shares_recipient = sharesRecipient eventEntity.save() @@ -350,12 +350,12 @@ export function handleLoanRepaid(event: LoanRepaid): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.bid_id = bidId.toBigDecimal() - eventEntity.interest_amount = interestAmount.toBigDecimal() - eventEntity.principal_amount = principalAmount.toBigDecimal() + eventEntity.bid_id = bidId + eventEntity.interest_amount = interestAmount + eventEntity.principal_amount = principalAmount eventEntity.repayer = repayer - eventEntity.total_interest_collected = totalInterestCollected.toBigDecimal() - eventEntity.total_principal_repaid = totalPrincipalRepaid.toBigDecimal() + eventEntity.total_interest_collected = totalInterestCollected + eventEntity.total_principal_repaid = totalPrincipalRepaid eventEntity.save() // Update pool metrics @@ -389,10 +389,10 @@ export function handleLoanLiquidated(event: DefaultedLoanLiquidated): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.amount_due = amountDue.toBigDecimal() - eventEntity.bid_id = bidId.toBigDecimal() + eventEntity.amount_due = amountDue + eventEntity.bid_id = bidId eventEntity.liquidator = liquidator - eventEntity.token_amount_difference = tokenAmountDifference.toBigDecimal() + eventEntity.token_amount_difference = tokenAmountDifference eventEntity.save() // Update pool metrics diff --git a/packages/subgraph-pool-v2/src/schema.graphql b/packages/subgraph-pool-v2/src/schema.graphql index 6075af451..93bed88b5 100644 --- a/packages/subgraph-pool-v2/src/schema.graphql +++ b/packages/subgraph-pool-v2/src/schema.graphql @@ -42,12 +42,12 @@ type group_borrower_accepted_funds @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - bid_id: BigDecimal! + bid_id: BigInt! borrower: Bytes! - collateral_amount: BigDecimal! + collateral_amount: BigInt! interest_rate: BigInt! loan_duration: BigInt! - principal_amount: BigDecimal! + principal_amount: BigInt! } type group_lender_added_principal @entity(immutable: true) { @@ -57,9 +57,9 @@ type group_lender_added_principal @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - amount: BigDecimal! + amount: BigInt! lender: Bytes! - shares_amount: BigDecimal! + shares_amount: BigInt! shares_recipient: Bytes! } type group_earnings_withdrawn @entity(immutable: true) { @@ -69,9 +69,9 @@ type group_earnings_withdrawn @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - amount_pool_shares_tokens: BigDecimal! + amount_pool_shares_tokens: BigInt! lender: Bytes! - principal_tokens_withdrawn: BigDecimal! + principal_tokens_withdrawn: BigInt! recipient: Bytes! } type group_defaulted_loan_liquidated @entity(immutable: true) { @@ -81,10 +81,10 @@ type group_defaulted_loan_liquidated @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - amount_due: BigDecimal! - bid_id: BigDecimal! + amount_due: BigInt! + bid_id: BigInt! liquidator: Bytes! - token_amount_difference: BigDecimal! + token_amount_difference: BigInt! } type group_initialized @entity(immutable: true) { id: ID! @@ -103,12 +103,12 @@ type group_loan_repaid @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - bid_id: BigDecimal! - interest_amount: BigDecimal! - principal_amount: BigDecimal! + bid_id: BigInt! + interest_amount: BigInt! + principal_amount: BigInt! repayer: Bytes! - total_interest_collected: BigDecimal! - total_principal_repaid: BigDecimal! + total_interest_collected: BigInt! + total_principal_repaid: BigInt! } type group_ownership_transferred @entity(immutable: true) { id: ID! @@ -161,10 +161,10 @@ type group_unpaused @entity(immutable: true) { type group_pool_bid @entity(immutable: true) { id: ID! group_pool_address: Bytes! - bid_id: BigDecimal! + bid_id: BigInt! borrower: Bytes! - collateral_amount: BigDecimal! - principal_amount: BigDecimal! + collateral_amount: BigInt! + principal_amount: BigInt! } @@ -172,10 +172,10 @@ type group_pool_bid @entity(immutable: true) { type teller_bid @entity(immutable: true) { id: ID! group_pool_address: Bytes! - bid_id: BigDecimal! + bid_id: BigInt! borrower: Bytes! - collateral_amount: BigDecimal! - principal_amount: BigDecimal! + collateral_amount: BigInt! + principal_amount: BigInt! } diff --git a/packages/subgraph-pool-v2/subgraph.yaml b/packages/subgraph-pool-v2/subgraph.yaml index c9d14fa2e..b2c2d3cc2 100644 --- a/packages/subgraph-pool-v2/subgraph.yaml +++ b/packages/subgraph-pool-v2/subgraph.yaml @@ -9,11 +9,11 @@ features: dataSources: - kind: ethereum/contract name: Factory - network: hyperevm + network: matic source: abi: Factory - address: "0x5360af9B95701504F783d8654bA02B0AF5155f64" - startBlock: 13051385 + address: "0xA7faf9435810fB571f61e1e116b3F18DE0B3583A" + startBlock: 73129776 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -29,11 +29,11 @@ dataSources: handler: handleLenderGroupDeployed - kind: ethereum/contract name: CollateralManager - network: hyperevm + network: matic source: abi: CollateralManager - address: "0x9D55Cf23D26a8C17670bb8Ee25D58481ff7aD295" - startBlock: 13051385 + address: "0x76888a882a4fF57455B5e74B791DD19DF3ba51Bb" + startBlock: 73129776 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -51,7 +51,7 @@ dataSources: templates: - kind: ethereum/contract name: Pool - network: hyperevm + network: matic source: abi: Pool mapping: diff --git a/packages/subgraph-pool/README.md b/packages/subgraph-pool/README.md index 07fa27ed1..6e4480198 100644 --- a/packages/subgraph-pool/README.md +++ b/packages/subgraph-pool/README.md @@ -34,27 +34,29 @@ npm run generate mainnet ``` - -5. auth -graph auth + + ``` +Deploy to THE GRAPH -6. deploy ! +graph auth + graph deploy teller-pools-mainnet --version-label 0.4.21.4 - graph deploy teller-pools-mainnet --version-label 0.4.21.1 + + ``` ``` -Deploy to alchemy +# Deploy to alchemy graph deploy tellerv2-pools-mainnet \ --version-label 0.4.21.4 \ @@ -64,6 +66,14 @@ graph deploy tellerv2-pools-mainnet \ + # Deploy to ormi migrations + + + yarn deploy_ormi teller-pools-mainnet + + + + ``` diff --git a/packages/subgraph-pool/generated/CollateralManager/CollateralManager.ts b/packages/subgraph-pool/generated/CollateralManager/CollateralManager.ts index 1aea48445..bed4c4ba6 100644 --- a/packages/subgraph-pool/generated/CollateralManager/CollateralManager.ts +++ b/packages/subgraph-pool/generated/CollateralManager/CollateralManager.ts @@ -7,7 +7,7 @@ import { Entity, Bytes, Address, - BigInt, + BigInt } from "@graphprotocol/graph-ts"; export class CollateralClaimed extends ethereum.Event { @@ -300,7 +300,7 @@ export class CollateralManager extends ethereum.SmartContract { _escrows(param0: BigInt): Address { let result = super.call("_escrows", "_escrows(uint256):(address)", [ - ethereum.Value.fromUnsignedBigInt(param0), + ethereum.Value.fromUnsignedBigInt(param0) ]); return result[0].toAddress(); @@ -308,7 +308,7 @@ export class CollateralManager extends ethereum.SmartContract { try__escrows(param0: BigInt): ethereum.CallResult
{ let result = super.tryCall("_escrows", "_escrows(uint256):(address)", [ - ethereum.Value.fromUnsignedBigInt(param0), + ethereum.Value.fromUnsignedBigInt(param0) ]); if (result.reverted) { return new ethereum.CallResult(); @@ -319,34 +319,38 @@ export class CollateralManager extends ethereum.SmartContract { checkBalances( _borrowerAddress: Address, - _collateralInfo: Array, + _collateralInfo: Array< + CollateralManager__checkBalancesInput_collateralInfoStruct + > ): CollateralManager__checkBalancesResult { let result = super.call( "checkBalances", "checkBalances(address,(uint8,uint256,uint256,address)[]):(bool,bool[])", [ ethereum.Value.fromAddress(_borrowerAddress), - ethereum.Value.fromTupleArray(_collateralInfo), - ], + ethereum.Value.fromTupleArray(_collateralInfo) + ] ); return new CollateralManager__checkBalancesResult( result[0].toBoolean(), - result[1].toBooleanArray(), + result[1].toBooleanArray() ); } try_checkBalances( _borrowerAddress: Address, - _collateralInfo: Array, + _collateralInfo: Array< + CollateralManager__checkBalancesInput_collateralInfoStruct + > ): ethereum.CallResult { let result = super.tryCall( "checkBalances", "checkBalances(address,(uint8,uint256,uint256,address)[]):(bool,bool[])", [ ethereum.Value.fromAddress(_borrowerAddress), - ethereum.Value.fromTupleArray(_collateralInfo), - ], + ethereum.Value.fromTupleArray(_collateralInfo) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -355,22 +359,24 @@ export class CollateralManager extends ethereum.SmartContract { return ethereum.CallResult.fromValue( new CollateralManager__checkBalancesResult( value[0].toBoolean(), - value[1].toBooleanArray(), - ), + value[1].toBooleanArray() + ) ); } commitCollateral( _bidId: BigInt, - _collateralInfo: Array, + _collateralInfo: Array< + CollateralManager__commitCollateralInput_collateralInfoStruct + > ): boolean { let result = super.call( "commitCollateral", "commitCollateral(uint256,(uint8,uint256,uint256,address)[]):(bool)", [ ethereum.Value.fromUnsignedBigInt(_bidId), - ethereum.Value.fromTupleArray(_collateralInfo), - ], + ethereum.Value.fromTupleArray(_collateralInfo) + ] ); return result[0].toBoolean(); @@ -378,15 +384,17 @@ export class CollateralManager extends ethereum.SmartContract { try_commitCollateral( _bidId: BigInt, - _collateralInfo: Array, + _collateralInfo: Array< + CollateralManager__commitCollateralInput_collateralInfoStruct + > ): ethereum.CallResult { let result = super.tryCall( "commitCollateral", "commitCollateral(uint256,(uint8,uint256,uint256,address)[]):(bool)", [ ethereum.Value.fromUnsignedBigInt(_bidId), - ethereum.Value.fromTupleArray(_collateralInfo), - ], + ethereum.Value.fromTupleArray(_collateralInfo) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -397,15 +405,15 @@ export class CollateralManager extends ethereum.SmartContract { commitCollateral1( _bidId: BigInt, - _collateralInfo: CollateralManager__commitCollateral1Input_collateralInfoStruct, + _collateralInfo: CollateralManager__commitCollateral1Input_collateralInfoStruct ): boolean { let result = super.call( "commitCollateral", "commitCollateral(uint256,(uint8,uint256,uint256,address)):(bool)", [ ethereum.Value.fromUnsignedBigInt(_bidId), - ethereum.Value.fromTuple(_collateralInfo), - ], + ethereum.Value.fromTuple(_collateralInfo) + ] ); return result[0].toBoolean(); @@ -413,15 +421,15 @@ export class CollateralManager extends ethereum.SmartContract { try_commitCollateral1( _bidId: BigInt, - _collateralInfo: CollateralManager__commitCollateral1Input_collateralInfoStruct, + _collateralInfo: CollateralManager__commitCollateral1Input_collateralInfoStruct ): ethereum.CallResult { let result = super.tryCall( "commitCollateral", "commitCollateral(uint256,(uint8,uint256,uint256,address)):(bool)", [ ethereum.Value.fromUnsignedBigInt(_bidId), - ethereum.Value.fromTuple(_collateralInfo), - ], + ethereum.Value.fromTuple(_collateralInfo) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -436,8 +444,8 @@ export class CollateralManager extends ethereum.SmartContract { "getCollateralAmount(uint256,address):(uint256)", [ ethereum.Value.fromUnsignedBigInt(_bidId), - ethereum.Value.fromAddress(_collateralAddress), - ], + ethereum.Value.fromAddress(_collateralAddress) + ] ); return result[0].toBigInt(); @@ -445,15 +453,15 @@ export class CollateralManager extends ethereum.SmartContract { try_getCollateralAmount( _bidId: BigInt, - _collateralAddress: Address, + _collateralAddress: Address ): ethereum.CallResult { let result = super.tryCall( "getCollateralAmount", "getCollateralAmount(uint256,address):(uint256)", [ ethereum.Value.fromUnsignedBigInt(_bidId), - ethereum.Value.fromAddress(_collateralAddress), - ], + ethereum.Value.fromAddress(_collateralAddress) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -466,7 +474,7 @@ export class CollateralManager extends ethereum.SmartContract { let result = super.call( "getCollateralEscrowBeacon", "getCollateralEscrowBeacon():(address)", - [], + [] ); return result[0].toAddress(); @@ -476,7 +484,7 @@ export class CollateralManager extends ethereum.SmartContract { let result = super.tryCall( "getCollateralEscrowBeacon", "getCollateralEscrowBeacon():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -486,39 +494,43 @@ export class CollateralManager extends ethereum.SmartContract { } getCollateralInfo( - _bidId: BigInt, + _bidId: BigInt ): Array { let result = super.call( "getCollateralInfo", "getCollateralInfo(uint256):((uint8,uint256,uint256,address)[])", - [ethereum.Value.fromUnsignedBigInt(_bidId)], + [ethereum.Value.fromUnsignedBigInt(_bidId)] ); - return result[0].toTupleArray(); + return result[0].toTupleArray< + CollateralManager__getCollateralInfoResultInfos_Struct + >(); } try_getCollateralInfo( - _bidId: BigInt, + _bidId: BigInt ): ethereum.CallResult< Array > { let result = super.tryCall( "getCollateralInfo", "getCollateralInfo(uint256):((uint8,uint256,uint256,address)[])", - [ethereum.Value.fromUnsignedBigInt(_bidId)], + [ethereum.Value.fromUnsignedBigInt(_bidId)] ); if (result.reverted) { return new ethereum.CallResult(); } let value = result.value; return ethereum.CallResult.fromValue( - value[0].toTupleArray(), + value[0].toTupleArray< + CollateralManager__getCollateralInfoResultInfos_Struct + >() ); } getEscrow(_bidId: BigInt): Address { let result = super.call("getEscrow", "getEscrow(uint256):(address)", [ - ethereum.Value.fromUnsignedBigInt(_bidId), + ethereum.Value.fromUnsignedBigInt(_bidId) ]); return result[0].toAddress(); @@ -526,7 +538,7 @@ export class CollateralManager extends ethereum.SmartContract { try_getEscrow(_bidId: BigInt): ethereum.CallResult
{ let result = super.tryCall("getEscrow", "getEscrow(uint256):(address)", [ - ethereum.Value.fromUnsignedBigInt(_bidId), + ethereum.Value.fromUnsignedBigInt(_bidId) ]); if (result.reverted) { return new ethereum.CallResult(); @@ -539,7 +551,7 @@ export class CollateralManager extends ethereum.SmartContract { let result = super.call( "isBidCollateralBacked", "isBidCollateralBacked(uint256):(bool)", - [ethereum.Value.fromUnsignedBigInt(_bidId)], + [ethereum.Value.fromUnsignedBigInt(_bidId)] ); return result[0].toBoolean(); @@ -549,7 +561,7 @@ export class CollateralManager extends ethereum.SmartContract { let result = super.tryCall( "isBidCollateralBacked", "isBidCollateralBacked(uint256):(bool)", - [ethereum.Value.fromUnsignedBigInt(_bidId)], + [ethereum.Value.fromUnsignedBigInt(_bidId)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -563,7 +575,7 @@ export class CollateralManager extends ethereum.SmartContract { param1: Address, _ids: Array, _values: Array, - param4: Bytes, + param4: Bytes ): Bytes { let result = super.call( "onERC1155BatchReceived", @@ -573,8 +585,8 @@ export class CollateralManager extends ethereum.SmartContract { ethereum.Value.fromAddress(param1), ethereum.Value.fromUnsignedBigIntArray(_ids), ethereum.Value.fromUnsignedBigIntArray(_values), - ethereum.Value.fromBytes(param4), - ], + ethereum.Value.fromBytes(param4) + ] ); return result[0].toBytes(); @@ -585,7 +597,7 @@ export class CollateralManager extends ethereum.SmartContract { param1: Address, _ids: Array, _values: Array, - param4: Bytes, + param4: Bytes ): ethereum.CallResult { let result = super.tryCall( "onERC1155BatchReceived", @@ -595,8 +607,8 @@ export class CollateralManager extends ethereum.SmartContract { ethereum.Value.fromAddress(param1), ethereum.Value.fromUnsignedBigIntArray(_ids), ethereum.Value.fromUnsignedBigIntArray(_values), - ethereum.Value.fromBytes(param4), - ], + ethereum.Value.fromBytes(param4) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -610,7 +622,7 @@ export class CollateralManager extends ethereum.SmartContract { param1: Address, id: BigInt, value: BigInt, - param4: Bytes, + param4: Bytes ): Bytes { let result = super.call( "onERC1155Received", @@ -620,8 +632,8 @@ export class CollateralManager extends ethereum.SmartContract { ethereum.Value.fromAddress(param1), ethereum.Value.fromUnsignedBigInt(id), ethereum.Value.fromUnsignedBigInt(value), - ethereum.Value.fromBytes(param4), - ], + ethereum.Value.fromBytes(param4) + ] ); return result[0].toBytes(); @@ -632,7 +644,7 @@ export class CollateralManager extends ethereum.SmartContract { param1: Address, id: BigInt, value: BigInt, - param4: Bytes, + param4: Bytes ): ethereum.CallResult { let result = super.tryCall( "onERC1155Received", @@ -642,8 +654,8 @@ export class CollateralManager extends ethereum.SmartContract { ethereum.Value.fromAddress(param1), ethereum.Value.fromUnsignedBigInt(id), ethereum.Value.fromUnsignedBigInt(value), - ethereum.Value.fromBytes(param4), - ], + ethereum.Value.fromBytes(param4) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -656,7 +668,7 @@ export class CollateralManager extends ethereum.SmartContract { param0: Address, param1: Address, param2: BigInt, - param3: Bytes, + param3: Bytes ): Bytes { let result = super.call( "onERC721Received", @@ -665,8 +677,8 @@ export class CollateralManager extends ethereum.SmartContract { ethereum.Value.fromAddress(param0), ethereum.Value.fromAddress(param1), ethereum.Value.fromUnsignedBigInt(param2), - ethereum.Value.fromBytes(param3), - ], + ethereum.Value.fromBytes(param3) + ] ); return result[0].toBytes(); @@ -676,7 +688,7 @@ export class CollateralManager extends ethereum.SmartContract { param0: Address, param1: Address, param2: BigInt, - param3: Bytes, + param3: Bytes ): ethereum.CallResult { let result = super.tryCall( "onERC721Received", @@ -685,8 +697,8 @@ export class CollateralManager extends ethereum.SmartContract { ethereum.Value.fromAddress(param0), ethereum.Value.fromAddress(param1), ethereum.Value.fromUnsignedBigInt(param2), - ethereum.Value.fromBytes(param3), - ], + ethereum.Value.fromBytes(param3) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -714,7 +726,7 @@ export class CollateralManager extends ethereum.SmartContract { let result = super.call( "revalidateCollateral", "revalidateCollateral(uint256):(bool)", - [ethereum.Value.fromUnsignedBigInt(_bidId)], + [ethereum.Value.fromUnsignedBigInt(_bidId)] ); return result[0].toBoolean(); @@ -724,7 +736,7 @@ export class CollateralManager extends ethereum.SmartContract { let result = super.tryCall( "revalidateCollateral", "revalidateCollateral(uint256):(bool)", - [ethereum.Value.fromUnsignedBigInt(_bidId)], + [ethereum.Value.fromUnsignedBigInt(_bidId)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -771,7 +783,9 @@ export class CheckBalancesCall__Inputs { } get _collateralInfo(): Array { - return this._call.inputValues[1].value.toTupleArray(); + return this._call.inputValues[1].value.toTupleArray< + CheckBalancesCall_collateralInfoStruct + >(); } } @@ -831,7 +845,9 @@ export class CommitCollateralCall__Inputs { } get _collateralInfo(): Array { - return this._call.inputValues[1].value.toTupleArray(); + return this._call.inputValues[1].value.toTupleArray< + CommitCollateralCall_collateralInfoStruct + >(); } } @@ -888,7 +904,7 @@ export class CommitCollateral1Call__Inputs { get _collateralInfo(): CommitCollateral1Call_collateralInfoStruct { return changetype( - this._call.inputValues[1].value.toTuple(), + this._call.inputValues[1].value.toTuple() ); } } diff --git a/packages/subgraph-pool/generated/Factory/Factory.ts b/packages/subgraph-pool/generated/Factory/Factory.ts index 1baad0c12..19839d542 100644 --- a/packages/subgraph-pool/generated/Factory/Factory.ts +++ b/packages/subgraph-pool/generated/Factory/Factory.ts @@ -7,7 +7,7 @@ import { Entity, Bytes, Address, - BigInt, + BigInt } from "@graphprotocol/graph-ts"; export class DeployedLenderGroupContract extends ethereum.Event { @@ -132,7 +132,9 @@ export class Factory extends ethereum.SmartContract { deployLenderCommitmentGroupPool( _initialPrincipalAmount: BigInt, _commitmentGroupConfig: Factory__deployLenderCommitmentGroupPoolInput_commitmentGroupConfigStruct, - _poolOracleRoutes: Array, + _poolOracleRoutes: Array< + Factory__deployLenderCommitmentGroupPoolInput_poolOracleRoutesStruct + > ): Address { let result = super.call( "deployLenderCommitmentGroupPool", @@ -140,8 +142,8 @@ export class Factory extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_initialPrincipalAmount), ethereum.Value.fromTuple(_commitmentGroupConfig), - ethereum.Value.fromTupleArray(_poolOracleRoutes), - ], + ethereum.Value.fromTupleArray(_poolOracleRoutes) + ] ); return result[0].toAddress(); @@ -150,7 +152,9 @@ export class Factory extends ethereum.SmartContract { try_deployLenderCommitmentGroupPool( _initialPrincipalAmount: BigInt, _commitmentGroupConfig: Factory__deployLenderCommitmentGroupPoolInput_commitmentGroupConfigStruct, - _poolOracleRoutes: Array, + _poolOracleRoutes: Array< + Factory__deployLenderCommitmentGroupPoolInput_poolOracleRoutesStruct + > ): ethereum.CallResult
{ let result = super.tryCall( "deployLenderCommitmentGroupPool", @@ -158,8 +162,8 @@ export class Factory extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_initialPrincipalAmount), ethereum.Value.fromTuple(_commitmentGroupConfig), - ethereum.Value.fromTupleArray(_poolOracleRoutes), - ], + ethereum.Value.fromTupleArray(_poolOracleRoutes) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -172,19 +176,19 @@ export class Factory extends ethereum.SmartContract { let result = super.call( "deployedLenderGroupContracts", "deployedLenderGroupContracts(address):(uint256)", - [ethereum.Value.fromAddress(param0)], + [ethereum.Value.fromAddress(param0)] ); return result[0].toBigInt(); } try_deployedLenderGroupContracts( - param0: Address, + param0: Address ): ethereum.CallResult { let result = super.tryCall( "deployedLenderGroupContracts", "deployedLenderGroupContracts(address):(uint256)", - [ethereum.Value.fromAddress(param0)], + [ethereum.Value.fromAddress(param0)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -197,7 +201,7 @@ export class Factory extends ethereum.SmartContract { let result = super.call( "lenderGroupBeacon", "lenderGroupBeacon():(address)", - [], + [] ); return result[0].toAddress(); @@ -207,7 +211,7 @@ export class Factory extends ethereum.SmartContract { let result = super.tryCall( "lenderGroupBeacon", "lenderGroupBeacon():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -254,13 +258,17 @@ export class DeployLenderCommitmentGroupPoolCall__Inputs { } get _commitmentGroupConfig(): DeployLenderCommitmentGroupPoolCall_commitmentGroupConfigStruct { - return changetype( - this._call.inputValues[1].value.toTuple(), - ); + return changetype< + DeployLenderCommitmentGroupPoolCall_commitmentGroupConfigStruct + >(this._call.inputValues[1].value.toTuple()); } - get _poolOracleRoutes(): Array { - return this._call.inputValues[2].value.toTupleArray(); + get _poolOracleRoutes(): Array< + DeployLenderCommitmentGroupPoolCall_poolOracleRoutesStruct + > { + return this._call.inputValues[2].value.toTupleArray< + DeployLenderCommitmentGroupPoolCall_poolOracleRoutesStruct + >(); } } diff --git a/packages/subgraph-pool/generated/schema.ts b/packages/subgraph-pool/generated/schema.ts index 95b3a46cf..266afcfd5 100644 --- a/packages/subgraph-pool/generated/schema.ts +++ b/packages/subgraph-pool/generated/schema.ts @@ -8,8 +8,7 @@ import { store, Bytes, BigInt, - BigDecimal, - Int8, + BigDecimal } from "@graphprotocol/graph-ts"; export class factory_admin_changed extends Entity { @@ -22,12 +21,12 @@ export class factory_admin_changed extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save factory_admin_changed entity without an ID", + "Cannot save factory_admin_changed entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type factory_admin_changed must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type factory_admin_changed must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("factory_admin_changed", id.toString(), this); } @@ -35,13 +34,13 @@ export class factory_admin_changed extends Entity { static loadInBlock(id: string): factory_admin_changed | null { return changetype( - store.get_in_block("factory_admin_changed", id), + store.get_in_block("factory_admin_changed", id) ); } static load(id: string): factory_admin_changed | null { return changetype( - store.get("factory_admin_changed", id), + store.get("factory_admin_changed", id) ); } @@ -147,12 +146,12 @@ export class factory_beacon_upgraded extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save factory_beacon_upgraded entity without an ID", + "Cannot save factory_beacon_upgraded entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type factory_beacon_upgraded must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type factory_beacon_upgraded must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("factory_beacon_upgraded", id.toString(), this); } @@ -160,13 +159,13 @@ export class factory_beacon_upgraded extends Entity { static loadInBlock(id: string): factory_beacon_upgraded | null { return changetype( - store.get_in_block("factory_beacon_upgraded", id), + store.get_in_block("factory_beacon_upgraded", id) ); } static load(id: string): factory_beacon_upgraded | null { return changetype( - store.get("factory_beacon_upgraded", id), + store.get("factory_beacon_upgraded", id) ); } @@ -259,28 +258,28 @@ export class factory_deployed_lender_group_contract extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save factory_deployed_lender_group_contract entity without an ID", + "Cannot save factory_deployed_lender_group_contract entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type factory_deployed_lender_group_contract must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type factory_deployed_lender_group_contract must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("factory_deployed_lender_group_contract", id.toString(), this); } } static loadInBlock( - id: string, + id: string ): factory_deployed_lender_group_contract | null { return changetype( - store.get_in_block("factory_deployed_lender_group_contract", id), + store.get_in_block("factory_deployed_lender_group_contract", id) ); } static load(id: string): factory_deployed_lender_group_contract | null { return changetype( - store.get("factory_deployed_lender_group_contract", id), + store.get("factory_deployed_lender_group_contract", id) ); } @@ -375,7 +374,7 @@ export class factory_upgraded extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type factory_upgraded must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type factory_upgraded must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("factory_upgraded", id.toString(), this); } @@ -383,13 +382,13 @@ export class factory_upgraded extends Entity { static loadInBlock(id: string): factory_upgraded | null { return changetype( - store.get_in_block("factory_upgraded", id), + store.get_in_block("factory_upgraded", id) ); } static load(id: string): factory_upgraded | null { return changetype( - store.get("factory_upgraded", id), + store.get("factory_upgraded", id) ); } @@ -482,12 +481,12 @@ export class group_borrower_accepted_funds extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_borrower_accepted_funds entity without an ID", + "Cannot save group_borrower_accepted_funds entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_borrower_accepted_funds must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_borrower_accepted_funds must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_borrower_accepted_funds", id.toString(), this); } @@ -495,13 +494,13 @@ export class group_borrower_accepted_funds extends Entity { static loadInBlock(id: string): group_borrower_accepted_funds | null { return changetype( - store.get_in_block("group_borrower_accepted_funds", id), + store.get_in_block("group_borrower_accepted_funds", id) ); } static load(id: string): group_borrower_accepted_funds | null { return changetype( - store.get("group_borrower_accepted_funds", id), + store.get("group_borrower_accepted_funds", id) ); } @@ -583,17 +582,17 @@ export class group_borrower_accepted_funds extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get borrower(): Bytes { @@ -609,17 +608,17 @@ export class group_borrower_accepted_funds extends Entity { this.set("borrower", Value.fromBytes(value)); } - get collateral_amount(): BigDecimal { + get collateral_amount(): BigInt { let value = this.get("collateral_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set collateral_amount(value: BigDecimal) { - this.set("collateral_amount", Value.fromBigDecimal(value)); + set collateral_amount(value: BigInt) { + this.set("collateral_amount", Value.fromBigInt(value)); } get interest_rate(): BigInt { @@ -648,17 +647,17 @@ export class group_borrower_accepted_funds extends Entity { this.set("loan_duration", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } } @@ -672,12 +671,12 @@ export class group_lender_added_principal extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_lender_added_principal entity without an ID", + "Cannot save group_lender_added_principal entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_lender_added_principal must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_lender_added_principal must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_lender_added_principal", id.toString(), this); } @@ -685,13 +684,13 @@ export class group_lender_added_principal extends Entity { static loadInBlock(id: string): group_lender_added_principal | null { return changetype( - store.get_in_block("group_lender_added_principal", id), + store.get_in_block("group_lender_added_principal", id) ); } static load(id: string): group_lender_added_principal | null { return changetype( - store.get("group_lender_added_principal", id), + store.get("group_lender_added_principal", id) ); } @@ -773,17 +772,17 @@ export class group_lender_added_principal extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get amount(): BigDecimal { + get amount(): BigInt { let value = this.get("amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set amount(value: BigDecimal) { - this.set("amount", Value.fromBigDecimal(value)); + set amount(value: BigInt) { + this.set("amount", Value.fromBigInt(value)); } get lender(): Bytes { @@ -799,17 +798,17 @@ export class group_lender_added_principal extends Entity { this.set("lender", Value.fromBytes(value)); } - get shares_amount(): BigDecimal { + get shares_amount(): BigInt { let value = this.get("shares_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set shares_amount(value: BigDecimal) { - this.set("shares_amount", Value.fromBigDecimal(value)); + set shares_amount(value: BigInt) { + this.set("shares_amount", Value.fromBigInt(value)); } get shares_recipient(): Bytes { @@ -836,12 +835,12 @@ export class group_earnings_withdrawn extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_earnings_withdrawn entity without an ID", + "Cannot save group_earnings_withdrawn entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_earnings_withdrawn must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_earnings_withdrawn must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_earnings_withdrawn", id.toString(), this); } @@ -849,13 +848,13 @@ export class group_earnings_withdrawn extends Entity { static loadInBlock(id: string): group_earnings_withdrawn | null { return changetype( - store.get_in_block("group_earnings_withdrawn", id), + store.get_in_block("group_earnings_withdrawn", id) ); } static load(id: string): group_earnings_withdrawn | null { return changetype( - store.get("group_earnings_withdrawn", id), + store.get("group_earnings_withdrawn", id) ); } @@ -937,17 +936,17 @@ export class group_earnings_withdrawn extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get amount_pool_shares_tokens(): BigDecimal { + get amount_pool_shares_tokens(): BigInt { let value = this.get("amount_pool_shares_tokens"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set amount_pool_shares_tokens(value: BigDecimal) { - this.set("amount_pool_shares_tokens", Value.fromBigDecimal(value)); + set amount_pool_shares_tokens(value: BigInt) { + this.set("amount_pool_shares_tokens", Value.fromBigInt(value)); } get lender(): Bytes { @@ -963,17 +962,17 @@ export class group_earnings_withdrawn extends Entity { this.set("lender", Value.fromBytes(value)); } - get principal_tokens_withdrawn(): BigDecimal { + get principal_tokens_withdrawn(): BigInt { let value = this.get("principal_tokens_withdrawn"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_tokens_withdrawn(value: BigDecimal) { - this.set("principal_tokens_withdrawn", Value.fromBigDecimal(value)); + set principal_tokens_withdrawn(value: BigInt) { + this.set("principal_tokens_withdrawn", Value.fromBigInt(value)); } get recipient(): Bytes { @@ -1000,12 +999,12 @@ export class group_defaulted_loan_liquidated extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_defaulted_loan_liquidated entity without an ID", + "Cannot save group_defaulted_loan_liquidated entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_defaulted_loan_liquidated must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_defaulted_loan_liquidated must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_defaulted_loan_liquidated", id.toString(), this); } @@ -1013,13 +1012,13 @@ export class group_defaulted_loan_liquidated extends Entity { static loadInBlock(id: string): group_defaulted_loan_liquidated | null { return changetype( - store.get_in_block("group_defaulted_loan_liquidated", id), + store.get_in_block("group_defaulted_loan_liquidated", id) ); } static load(id: string): group_defaulted_loan_liquidated | null { return changetype( - store.get("group_defaulted_loan_liquidated", id), + store.get("group_defaulted_loan_liquidated", id) ); } @@ -1101,30 +1100,30 @@ export class group_defaulted_loan_liquidated extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get amount_due(): BigDecimal { + get amount_due(): BigInt { let value = this.get("amount_due"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set amount_due(value: BigDecimal) { - this.set("amount_due", Value.fromBigDecimal(value)); + set amount_due(value: BigInt) { + this.set("amount_due", Value.fromBigInt(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get liquidator(): Bytes { @@ -1140,17 +1139,17 @@ export class group_defaulted_loan_liquidated extends Entity { this.set("liquidator", Value.fromBytes(value)); } - get token_amount_difference(): BigDecimal { + get token_amount_difference(): BigInt { let value = this.get("token_amount_difference"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set token_amount_difference(value: BigDecimal) { - this.set("token_amount_difference", Value.fromBigDecimal(value)); + set token_amount_difference(value: BigInt) { + this.set("token_amount_difference", Value.fromBigInt(value)); } } @@ -1166,7 +1165,7 @@ export class group_initialized extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_initialized must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_initialized must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_initialized", id.toString(), this); } @@ -1174,13 +1173,13 @@ export class group_initialized extends Entity { static loadInBlock(id: string): group_initialized | null { return changetype( - store.get_in_block("group_initialized", id), + store.get_in_block("group_initialized", id) ); } static load(id: string): group_initialized | null { return changetype( - store.get("group_initialized", id), + store.get("group_initialized", id) ); } @@ -1288,7 +1287,7 @@ export class group_loan_repaid extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_loan_repaid must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_loan_repaid must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_loan_repaid", id.toString(), this); } @@ -1296,13 +1295,13 @@ export class group_loan_repaid extends Entity { static loadInBlock(id: string): group_loan_repaid | null { return changetype( - store.get_in_block("group_loan_repaid", id), + store.get_in_block("group_loan_repaid", id) ); } static load(id: string): group_loan_repaid | null { return changetype( - store.get("group_loan_repaid", id), + store.get("group_loan_repaid", id) ); } @@ -1384,43 +1383,43 @@ export class group_loan_repaid extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } - get interest_amount(): BigDecimal { + get interest_amount(): BigInt { let value = this.get("interest_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set interest_amount(value: BigDecimal) { - this.set("interest_amount", Value.fromBigDecimal(value)); + set interest_amount(value: BigInt) { + this.set("interest_amount", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } get repayer(): Bytes { @@ -1436,30 +1435,30 @@ export class group_loan_repaid extends Entity { this.set("repayer", Value.fromBytes(value)); } - get total_interest_collected(): BigDecimal { + get total_interest_collected(): BigInt { let value = this.get("total_interest_collected"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set total_interest_collected(value: BigDecimal) { - this.set("total_interest_collected", Value.fromBigDecimal(value)); + set total_interest_collected(value: BigInt) { + this.set("total_interest_collected", Value.fromBigInt(value)); } - get total_principal_repaid(): BigDecimal { + get total_principal_repaid(): BigInt { let value = this.get("total_principal_repaid"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set total_principal_repaid(value: BigDecimal) { - this.set("total_principal_repaid", Value.fromBigDecimal(value)); + set total_principal_repaid(value: BigInt) { + this.set("total_principal_repaid", Value.fromBigInt(value)); } } @@ -1473,12 +1472,12 @@ export class group_ownership_transferred extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_ownership_transferred entity without an ID", + "Cannot save group_ownership_transferred entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_ownership_transferred must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_ownership_transferred must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_ownership_transferred", id.toString(), this); } @@ -1486,13 +1485,13 @@ export class group_ownership_transferred extends Entity { static loadInBlock(id: string): group_ownership_transferred | null { return changetype( - store.get_in_block("group_ownership_transferred", id), + store.get_in_block("group_ownership_transferred", id) ); } static load(id: string): group_ownership_transferred | null { return changetype( - store.get("group_ownership_transferred", id), + store.get("group_ownership_transferred", id) ); } @@ -1613,7 +1612,7 @@ export class group_paused extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_paused must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_paused must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_paused", id.toString(), this); } @@ -1621,7 +1620,7 @@ export class group_paused extends Entity { static loadInBlock(id: string): group_paused | null { return changetype( - store.get_in_block("group_paused", id), + store.get_in_block("group_paused", id) ); } @@ -1731,12 +1730,12 @@ export class group_pool_initialized extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_pool_initialized entity without an ID", + "Cannot save group_pool_initialized entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_pool_initialized must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_pool_initialized must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_pool_initialized", id.toString(), this); } @@ -1744,13 +1743,13 @@ export class group_pool_initialized extends Entity { static loadInBlock(id: string): group_pool_initialized | null { return changetype( - store.get_in_block("group_pool_initialized", id), + store.get_in_block("group_pool_initialized", id) ); } static load(id: string): group_pool_initialized | null { return changetype( - store.get("group_pool_initialized", id), + store.get("group_pool_initialized", id) ); } @@ -1962,7 +1961,7 @@ export class group_unpaused extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_unpaused must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_unpaused must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_unpaused", id.toString(), this); } @@ -1970,7 +1969,7 @@ export class group_unpaused extends Entity { static loadInBlock(id: string): group_unpaused | null { return changetype( - store.get_in_block("group_unpaused", id), + store.get_in_block("group_unpaused", id) ); } @@ -2082,7 +2081,7 @@ export class group_pool_bid extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_pool_bid must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_pool_bid must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_pool_bid", id.toString(), this); } @@ -2090,7 +2089,7 @@ export class group_pool_bid extends Entity { static loadInBlock(id: string): group_pool_bid | null { return changetype( - store.get_in_block("group_pool_bid", id), + store.get_in_block("group_pool_bid", id) ); } @@ -2124,17 +2123,17 @@ export class group_pool_bid extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get borrower(): Bytes { @@ -2150,30 +2149,30 @@ export class group_pool_bid extends Entity { this.set("borrower", Value.fromBytes(value)); } - get collateral_amount(): BigDecimal { + get collateral_amount(): BigInt { let value = this.get("collateral_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set collateral_amount(value: BigDecimal) { - this.set("collateral_amount", Value.fromBigDecimal(value)); + set collateral_amount(value: BigInt) { + this.set("collateral_amount", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } } @@ -2189,7 +2188,7 @@ export class teller_bid extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type teller_bid must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type teller_bid must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("teller_bid", id.toString(), this); } @@ -2229,17 +2228,17 @@ export class teller_bid extends Entity { this.set("group_pool_address", Value.fromBytes(value)); } - get bid_id(): BigDecimal { + get bid_id(): BigInt { let value = this.get("bid_id"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set bid_id(value: BigDecimal) { - this.set("bid_id", Value.fromBigDecimal(value)); + set bid_id(value: BigInt) { + this.set("bid_id", Value.fromBigInt(value)); } get borrower(): Bytes { @@ -2255,30 +2254,30 @@ export class teller_bid extends Entity { this.set("borrower", Value.fromBytes(value)); } - get collateral_amount(): BigDecimal { + get collateral_amount(): BigInt { let value = this.get("collateral_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set collateral_amount(value: BigDecimal) { - this.set("collateral_amount", Value.fromBigDecimal(value)); + set collateral_amount(value: BigInt) { + this.set("collateral_amount", Value.fromBigInt(value)); } - get principal_amount(): BigDecimal { + get principal_amount(): BigInt { let value = this.get("principal_amount"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { - return value.toBigDecimal(); + return value.toBigInt(); } } - set principal_amount(value: BigDecimal) { - this.set("principal_amount", Value.fromBigDecimal(value)); + set principal_amount(value: BigInt) { + this.set("principal_amount", Value.fromBigInt(value)); } } @@ -2294,7 +2293,7 @@ export class group_pool_metric extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_pool_metric must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_pool_metric must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_pool_metric", id.toString(), this); } @@ -2302,13 +2301,13 @@ export class group_pool_metric extends Entity { static loadInBlock(id: string): group_pool_metric | null { return changetype( - store.get_in_block("group_pool_metric", id), + store.get_in_block("group_pool_metric", id) ); } static load(id: string): group_pool_metric | null { return changetype( - store.get("group_pool_metric", id), + store.get("group_pool_metric", id) ); } @@ -2587,7 +2586,7 @@ export class group_pool_metric extends Entity { get total_principal_tokens_repaid_by_liquidation_auction(): BigInt { let value = this.get( - "total_principal_tokens_repaid_by_liquidation_auction", + "total_principal_tokens_repaid_by_liquidation_auction" ); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); @@ -2599,7 +2598,7 @@ export class group_pool_metric extends Entity { set total_principal_tokens_repaid_by_liquidation_auction(value: BigInt) { this.set( "total_principal_tokens_repaid_by_liquidation_auction", - Value.fromBigInt(value), + Value.fromBigInt(value) ); } @@ -2640,12 +2639,12 @@ export class group_pool_metric_data_point extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_pool_metric_data_point entity without an ID", + "Cannot save group_pool_metric_data_point entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_pool_metric_data_point must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_pool_metric_data_point must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_pool_metric_data_point", id.toString(), this); } @@ -2653,13 +2652,13 @@ export class group_pool_metric_data_point extends Entity { static loadInBlock(id: string): group_pool_metric_data_point | null { return changetype( - store.get_in_block("group_pool_metric_data_point", id), + store.get_in_block("group_pool_metric_data_point", id) ); } static load(id: string): group_pool_metric_data_point | null { return changetype( - store.get("group_pool_metric_data_point", id), + store.get("group_pool_metric_data_point", id) ); } @@ -2834,12 +2833,12 @@ export class group_pool_metric_data_point_daily extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_pool_metric_data_point_daily entity without an ID", + "Cannot save group_pool_metric_data_point_daily entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_pool_metric_data_point_daily must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_pool_metric_data_point_daily must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_pool_metric_data_point_daily", id.toString(), this); } @@ -2847,13 +2846,13 @@ export class group_pool_metric_data_point_daily extends Entity { static loadInBlock(id: string): group_pool_metric_data_point_daily | null { return changetype( - store.get_in_block("group_pool_metric_data_point_daily", id), + store.get_in_block("group_pool_metric_data_point_daily", id) ); } static load(id: string): group_pool_metric_data_point_daily | null { return changetype( - store.get("group_pool_metric_data_point_daily", id), + store.get("group_pool_metric_data_point_daily", id) ); } @@ -3028,12 +3027,12 @@ export class group_pool_metric_data_point_weekly extends Entity { let id = this.get("id"); assert( id != null, - "Cannot save group_pool_metric_data_point_weekly entity without an ID", + "Cannot save group_pool_metric_data_point_weekly entity without an ID" ); if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_pool_metric_data_point_weekly must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_pool_metric_data_point_weekly must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_pool_metric_data_point_weekly", id.toString(), this); } @@ -3041,13 +3040,13 @@ export class group_pool_metric_data_point_weekly extends Entity { static loadInBlock(id: string): group_pool_metric_data_point_weekly | null { return changetype( - store.get_in_block("group_pool_metric_data_point_weekly", id), + store.get_in_block("group_pool_metric_data_point_weekly", id) ); } static load(id: string): group_pool_metric_data_point_weekly | null { return changetype( - store.get("group_pool_metric_data_point_weekly", id), + store.get("group_pool_metric_data_point_weekly", id) ); } @@ -3224,7 +3223,7 @@ export class group_user_metric extends Entity { if (id) { assert( id.kind == ValueKind.STRING, - `Entities of type group_user_metric must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`, + `Entities of type group_user_metric must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` ); store.set("group_user_metric", id.toString(), this); } @@ -3232,13 +3231,13 @@ export class group_user_metric extends Entity { static loadInBlock(id: string): group_user_metric | null { return changetype( - store.get_in_block("group_user_metric", id), + store.get_in_block("group_user_metric", id) ); } static load(id: string): group_user_metric | null { return changetype( - store.get("group_user_metric", id), + store.get("group_user_metric", id) ); } diff --git a/packages/subgraph-pool/generated/templates.ts b/packages/subgraph-pool/generated/templates.ts index 6c64a4b41..f4a6dff6d 100644 --- a/packages/subgraph-pool/generated/templates.ts +++ b/packages/subgraph-pool/generated/templates.ts @@ -3,7 +3,7 @@ import { Address, DataSourceTemplate, - DataSourceContext, + DataSourceContext } from "@graphprotocol/graph-ts"; export class Pool extends DataSourceTemplate { diff --git a/packages/subgraph-pool/generated/templates/Pool/Factory.ts b/packages/subgraph-pool/generated/templates/Pool/Factory.ts index 1baad0c12..19839d542 100644 --- a/packages/subgraph-pool/generated/templates/Pool/Factory.ts +++ b/packages/subgraph-pool/generated/templates/Pool/Factory.ts @@ -7,7 +7,7 @@ import { Entity, Bytes, Address, - BigInt, + BigInt } from "@graphprotocol/graph-ts"; export class DeployedLenderGroupContract extends ethereum.Event { @@ -132,7 +132,9 @@ export class Factory extends ethereum.SmartContract { deployLenderCommitmentGroupPool( _initialPrincipalAmount: BigInt, _commitmentGroupConfig: Factory__deployLenderCommitmentGroupPoolInput_commitmentGroupConfigStruct, - _poolOracleRoutes: Array, + _poolOracleRoutes: Array< + Factory__deployLenderCommitmentGroupPoolInput_poolOracleRoutesStruct + > ): Address { let result = super.call( "deployLenderCommitmentGroupPool", @@ -140,8 +142,8 @@ export class Factory extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_initialPrincipalAmount), ethereum.Value.fromTuple(_commitmentGroupConfig), - ethereum.Value.fromTupleArray(_poolOracleRoutes), - ], + ethereum.Value.fromTupleArray(_poolOracleRoutes) + ] ); return result[0].toAddress(); @@ -150,7 +152,9 @@ export class Factory extends ethereum.SmartContract { try_deployLenderCommitmentGroupPool( _initialPrincipalAmount: BigInt, _commitmentGroupConfig: Factory__deployLenderCommitmentGroupPoolInput_commitmentGroupConfigStruct, - _poolOracleRoutes: Array, + _poolOracleRoutes: Array< + Factory__deployLenderCommitmentGroupPoolInput_poolOracleRoutesStruct + > ): ethereum.CallResult
{ let result = super.tryCall( "deployLenderCommitmentGroupPool", @@ -158,8 +162,8 @@ export class Factory extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_initialPrincipalAmount), ethereum.Value.fromTuple(_commitmentGroupConfig), - ethereum.Value.fromTupleArray(_poolOracleRoutes), - ], + ethereum.Value.fromTupleArray(_poolOracleRoutes) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -172,19 +176,19 @@ export class Factory extends ethereum.SmartContract { let result = super.call( "deployedLenderGroupContracts", "deployedLenderGroupContracts(address):(uint256)", - [ethereum.Value.fromAddress(param0)], + [ethereum.Value.fromAddress(param0)] ); return result[0].toBigInt(); } try_deployedLenderGroupContracts( - param0: Address, + param0: Address ): ethereum.CallResult { let result = super.tryCall( "deployedLenderGroupContracts", "deployedLenderGroupContracts(address):(uint256)", - [ethereum.Value.fromAddress(param0)], + [ethereum.Value.fromAddress(param0)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -197,7 +201,7 @@ export class Factory extends ethereum.SmartContract { let result = super.call( "lenderGroupBeacon", "lenderGroupBeacon():(address)", - [], + [] ); return result[0].toAddress(); @@ -207,7 +211,7 @@ export class Factory extends ethereum.SmartContract { let result = super.tryCall( "lenderGroupBeacon", "lenderGroupBeacon():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -254,13 +258,17 @@ export class DeployLenderCommitmentGroupPoolCall__Inputs { } get _commitmentGroupConfig(): DeployLenderCommitmentGroupPoolCall_commitmentGroupConfigStruct { - return changetype( - this._call.inputValues[1].value.toTuple(), - ); + return changetype< + DeployLenderCommitmentGroupPoolCall_commitmentGroupConfigStruct + >(this._call.inputValues[1].value.toTuple()); } - get _poolOracleRoutes(): Array { - return this._call.inputValues[2].value.toTupleArray(); + get _poolOracleRoutes(): Array< + DeployLenderCommitmentGroupPoolCall_poolOracleRoutesStruct + > { + return this._call.inputValues[2].value.toTupleArray< + DeployLenderCommitmentGroupPoolCall_poolOracleRoutesStruct + >(); } } diff --git a/packages/subgraph-pool/generated/templates/Pool/Pool.ts b/packages/subgraph-pool/generated/templates/Pool/Pool.ts index 9adfcf4a3..e89307eb8 100644 --- a/packages/subgraph-pool/generated/templates/Pool/Pool.ts +++ b/packages/subgraph-pool/generated/templates/Pool/Pool.ts @@ -7,7 +7,7 @@ import { Entity, Bytes, Address, - BigInt, + BigInt } from "@graphprotocol/graph-ts"; export class BorrowerAcceptedFunds extends ethereum.Event { @@ -432,7 +432,7 @@ export class Pool__poolOracleRoutesResult { value1: boolean, value2: BigInt, value3: BigInt, - value4: BigInt, + value4: BigInt ) { this.value0 = value0; this.value1 = value1; @@ -481,7 +481,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "DEFAULT_WITHDRAW_DELAY_TIME_SECONDS", "DEFAULT_WITHDRAW_DELAY_TIME_SECONDS():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -491,7 +491,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "DEFAULT_WITHDRAW_DELAY_TIME_SECONDS", "DEFAULT_WITHDRAW_DELAY_TIME_SECONDS():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -504,7 +504,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "EXCHANGE_RATE_EXPANSION_FACTOR", "EXCHANGE_RATE_EXPANSION_FACTOR():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -514,7 +514,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "EXCHANGE_RATE_EXPANSION_FACTOR", "EXCHANGE_RATE_EXPANSION_FACTOR():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -527,7 +527,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "MAX_WITHDRAW_DELAY_TIME", "MAX_WITHDRAW_DELAY_TIME():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -537,7 +537,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "MAX_WITHDRAW_DELAY_TIME", "MAX_WITHDRAW_DELAY_TIME():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -550,7 +550,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "MIN_TWAP_INTERVAL", "MIN_TWAP_INTERVAL():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -560,7 +560,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "MIN_TWAP_INTERVAL", "MIN_TWAP_INTERVAL():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -579,7 +579,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "ORACLE_MANAGER", "ORACLE_MANAGER():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -592,7 +592,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "SMART_COMMITMENT_FORWARDER", "SMART_COMMITMENT_FORWARDER():(address)", - [], + [] ); return result[0].toAddress(); @@ -602,7 +602,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "SMART_COMMITMENT_FORWARDER", "SMART_COMMITMENT_FORWARDER():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -615,7 +615,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "STANDARD_EXPANSION_FACTOR", "STANDARD_EXPANSION_FACTOR():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -625,7 +625,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "STANDARD_EXPANSION_FACTOR", "STANDARD_EXPANSION_FACTOR():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -653,7 +653,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "UNISWAP_EXPANSION_FACTOR", "UNISWAP_EXPANSION_FACTOR():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -663,7 +663,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "UNISWAP_EXPANSION_FACTOR", "UNISWAP_EXPANSION_FACTOR():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -676,7 +676,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "UNISWAP_V3_FACTORY", "UNISWAP_V3_FACTORY():(address)", - [], + [] ); return result[0].toAddress(); @@ -686,7 +686,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "UNISWAP_V3_FACTORY", "UNISWAP_V3_FACTORY():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -697,7 +697,7 @@ export class Pool extends ethereum.SmartContract { activeBids(param0: BigInt): boolean { let result = super.call("activeBids", "activeBids(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(param0), + ethereum.Value.fromUnsignedBigInt(param0) ]); return result[0].toBoolean(); @@ -705,7 +705,7 @@ export class Pool extends ethereum.SmartContract { try_activeBids(param0: BigInt): ethereum.CallResult { let result = super.tryCall("activeBids", "activeBids(uint256):(bool)", [ - ethereum.Value.fromUnsignedBigInt(param0), + ethereum.Value.fromUnsignedBigInt(param0) ]); if (result.reverted) { return new ethereum.CallResult(); @@ -718,19 +718,19 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "activeBidsAmountDueRemaining", "activeBidsAmountDueRemaining(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(param0)], + [ethereum.Value.fromUnsignedBigInt(param0)] ); return result[0].toBigInt(); } try_activeBidsAmountDueRemaining( - param0: BigInt, + param0: BigInt ): ethereum.CallResult { let result = super.tryCall( "activeBidsAmountDueRemaining", "activeBidsAmountDueRemaining(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(param0)], + [ethereum.Value.fromUnsignedBigInt(param0)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -742,7 +742,7 @@ export class Pool extends ethereum.SmartContract { addPrincipalToCommitmentGroup( _amount: BigInt, _sharesRecipient: Address, - _minSharesAmountOut: BigInt, + _minSharesAmountOut: BigInt ): BigInt { let result = super.call( "addPrincipalToCommitmentGroup", @@ -750,8 +750,8 @@ export class Pool extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_amount), ethereum.Value.fromAddress(_sharesRecipient), - ethereum.Value.fromUnsignedBigInt(_minSharesAmountOut), - ], + ethereum.Value.fromUnsignedBigInt(_minSharesAmountOut) + ] ); return result[0].toBigInt(); @@ -760,7 +760,7 @@ export class Pool extends ethereum.SmartContract { try_addPrincipalToCommitmentGroup( _amount: BigInt, _sharesRecipient: Address, - _minSharesAmountOut: BigInt, + _minSharesAmountOut: BigInt ): ethereum.CallResult { let result = super.tryCall( "addPrincipalToCommitmentGroup", @@ -768,8 +768,8 @@ export class Pool extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_amount), ethereum.Value.fromAddress(_sharesRecipient), - ethereum.Value.fromUnsignedBigInt(_minSharesAmountOut), - ], + ethereum.Value.fromUnsignedBigInt(_minSharesAmountOut) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -781,7 +781,7 @@ export class Pool extends ethereum.SmartContract { burnSharesToWithdrawEarnings( _amountPoolSharesTokens: BigInt, _recipient: Address, - _minAmountOut: BigInt, + _minAmountOut: BigInt ): BigInt { let result = super.call( "burnSharesToWithdrawEarnings", @@ -789,8 +789,8 @@ export class Pool extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_amountPoolSharesTokens), ethereum.Value.fromAddress(_recipient), - ethereum.Value.fromUnsignedBigInt(_minAmountOut), - ], + ethereum.Value.fromUnsignedBigInt(_minAmountOut) + ] ); return result[0].toBigInt(); @@ -799,7 +799,7 @@ export class Pool extends ethereum.SmartContract { try_burnSharesToWithdrawEarnings( _amountPoolSharesTokens: BigInt, _recipient: Address, - _minAmountOut: BigInt, + _minAmountOut: BigInt ): ethereum.CallResult { let result = super.tryCall( "burnSharesToWithdrawEarnings", @@ -807,8 +807,8 @@ export class Pool extends ethereum.SmartContract { [ ethereum.Value.fromUnsignedBigInt(_amountPoolSharesTokens), ethereum.Value.fromAddress(_recipient), - ethereum.Value.fromUnsignedBigInt(_minAmountOut), - ], + ethereum.Value.fromUnsignedBigInt(_minAmountOut) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -818,24 +818,24 @@ export class Pool extends ethereum.SmartContract { } calculateCollateralRequiredToBorrowPrincipal( - _principalAmount: BigInt, + _principalAmount: BigInt ): BigInt { let result = super.call( "calculateCollateralRequiredToBorrowPrincipal", "calculateCollateralRequiredToBorrowPrincipal(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(_principalAmount)], + [ethereum.Value.fromUnsignedBigInt(_principalAmount)] ); return result[0].toBigInt(); } try_calculateCollateralRequiredToBorrowPrincipal( - _principalAmount: BigInt, + _principalAmount: BigInt ): ethereum.CallResult { let result = super.tryCall( "calculateCollateralRequiredToBorrowPrincipal", "calculateCollateralRequiredToBorrowPrincipal(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(_principalAmount)], + [ethereum.Value.fromUnsignedBigInt(_principalAmount)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -845,24 +845,24 @@ export class Pool extends ethereum.SmartContract { } calculateCollateralTokensAmountEquivalentToPrincipalTokens( - principalAmount: BigInt, + principalAmount: BigInt ): BigInt { let result = super.call( "calculateCollateralTokensAmountEquivalentToPrincipalTokens", "calculateCollateralTokensAmountEquivalentToPrincipalTokens(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(principalAmount)], + [ethereum.Value.fromUnsignedBigInt(principalAmount)] ); return result[0].toBigInt(); } try_calculateCollateralTokensAmountEquivalentToPrincipalTokens( - principalAmount: BigInt, + principalAmount: BigInt ): ethereum.CallResult { let result = super.tryCall( "calculateCollateralTokensAmountEquivalentToPrincipalTokens", "calculateCollateralTokensAmountEquivalentToPrincipalTokens(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(principalAmount)], + [ethereum.Value.fromUnsignedBigInt(principalAmount)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -875,7 +875,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "collateralRatio", "collateralRatio():(uint16)", - [], + [] ); return result[0].toI32(); @@ -885,7 +885,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "collateralRatio", "collateralRatio():(uint16)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -898,7 +898,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "collateralToken", "collateralToken():(address)", - [], + [] ); return result[0].toAddress(); @@ -908,7 +908,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "collateralToken", "collateralToken():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -921,7 +921,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "excessivePrincipalTokensRepaid", "excessivePrincipalTokensRepaid():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -931,7 +931,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "excessivePrincipalTokensRepaid", "excessivePrincipalTokensRepaid():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -944,7 +944,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "firstDepositMade", "firstDepositMade():(bool)", - [], + [] ); return result[0].toBoolean(); @@ -954,7 +954,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "firstDepositMade", "firstDepositMade():(bool)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -967,7 +967,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getCollateralTokenAddress", "getCollateralTokenAddress():(address)", - [], + [] ); return result[0].toAddress(); @@ -977,7 +977,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getCollateralTokenAddress", "getCollateralTokenAddress():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -990,7 +990,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getCollateralTokenId", "getCollateralTokenId():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1000,7 +1000,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getCollateralTokenId", "getCollateralTokenId():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1013,7 +1013,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getCollateralTokenType", "getCollateralTokenType():(uint8)", - [], + [] ); return result[0].toI32(); @@ -1023,7 +1023,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getCollateralTokenType", "getCollateralTokenType():(uint8)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1036,7 +1036,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getLastUnpausedAt", "getLastUnpausedAt():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1046,7 +1046,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getLastUnpausedAt", "getLastUnpausedAt():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1074,7 +1074,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getMaxLoanDuration", "getMaxLoanDuration():(uint32)", - [], + [] ); return result[0].toBigInt(); @@ -1084,7 +1084,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getMaxLoanDuration", "getMaxLoanDuration():(uint32)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1097,7 +1097,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getMinInterestRate", "getMinInterestRate(uint256):(uint16)", - [ethereum.Value.fromUnsignedBigInt(amountDelta)], + [ethereum.Value.fromUnsignedBigInt(amountDelta)] ); return result[0].toI32(); @@ -1107,7 +1107,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getMinInterestRate", "getMinInterestRate(uint256):(uint16)", - [ethereum.Value.fromUnsignedBigInt(amountDelta)], + [ethereum.Value.fromUnsignedBigInt(amountDelta)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1118,15 +1118,15 @@ export class Pool extends ethereum.SmartContract { getMinimumAmountDifferenceToCloseDefaultedLoan( _amountOwed: BigInt, - _loanDefaultedTimestamp: BigInt, + _loanDefaultedTimestamp: BigInt ): BigInt { let result = super.call( "getMinimumAmountDifferenceToCloseDefaultedLoan", "getMinimumAmountDifferenceToCloseDefaultedLoan(uint256,uint256):(int256)", [ ethereum.Value.fromUnsignedBigInt(_amountOwed), - ethereum.Value.fromUnsignedBigInt(_loanDefaultedTimestamp), - ], + ethereum.Value.fromUnsignedBigInt(_loanDefaultedTimestamp) + ] ); return result[0].toBigInt(); @@ -1134,15 +1134,15 @@ export class Pool extends ethereum.SmartContract { try_getMinimumAmountDifferenceToCloseDefaultedLoan( _amountOwed: BigInt, - _loanDefaultedTimestamp: BigInt, + _loanDefaultedTimestamp: BigInt ): ethereum.CallResult { let result = super.tryCall( "getMinimumAmountDifferenceToCloseDefaultedLoan", "getMinimumAmountDifferenceToCloseDefaultedLoan(uint256,uint256):(int256)", [ ethereum.Value.fromUnsignedBigInt(_amountOwed), - ethereum.Value.fromUnsignedBigInt(_loanDefaultedTimestamp), - ], + ethereum.Value.fromUnsignedBigInt(_loanDefaultedTimestamp) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1155,7 +1155,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getPoolTotalEstimatedValue", "getPoolTotalEstimatedValue():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1165,7 +1165,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getPoolTotalEstimatedValue", "getPoolTotalEstimatedValue():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1178,19 +1178,19 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getPoolUtilizationRatio", "getPoolUtilizationRatio(uint256):(uint16)", - [ethereum.Value.fromUnsignedBigInt(activeLoansAmountDelta)], + [ethereum.Value.fromUnsignedBigInt(activeLoansAmountDelta)] ); return result[0].toI32(); } try_getPoolUtilizationRatio( - activeLoansAmountDelta: BigInt, + activeLoansAmountDelta: BigInt ): ethereum.CallResult { let result = super.tryCall( "getPoolUtilizationRatio", "getPoolUtilizationRatio(uint256):(uint16)", - [ethereum.Value.fromUnsignedBigInt(activeLoansAmountDelta)], + [ethereum.Value.fromUnsignedBigInt(activeLoansAmountDelta)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1203,7 +1203,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getPrincipalAmountAvailableToBorrow", "getPrincipalAmountAvailableToBorrow():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1213,7 +1213,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getPrincipalAmountAvailableToBorrow", "getPrincipalAmountAvailableToBorrow():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1223,24 +1223,28 @@ export class Pool extends ethereum.SmartContract { } getPrincipalForCollateralForPoolRoutes( - poolOracleRoutes: Array, + poolOracleRoutes: Array< + Pool__getPrincipalForCollateralForPoolRoutesInputPoolOracleRoutesStruct + > ): BigInt { let result = super.call( "getPrincipalForCollateralForPoolRoutes", "getPrincipalForCollateralForPoolRoutes((address,bool,uint32,uint256,uint256)[]):(uint256)", - [ethereum.Value.fromTupleArray(poolOracleRoutes)], + [ethereum.Value.fromTupleArray(poolOracleRoutes)] ); return result[0].toBigInt(); } try_getPrincipalForCollateralForPoolRoutes( - poolOracleRoutes: Array, + poolOracleRoutes: Array< + Pool__getPrincipalForCollateralForPoolRoutesInputPoolOracleRoutesStruct + > ): ethereum.CallResult { let result = super.tryCall( "getPrincipalForCollateralForPoolRoutes", "getPrincipalForCollateralForPoolRoutes((address,bool,uint32,uint256,uint256)[]):(uint256)", - [ethereum.Value.fromTupleArray(poolOracleRoutes)], + [ethereum.Value.fromTupleArray(poolOracleRoutes)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1253,7 +1257,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getPrincipalTokenAddress", "getPrincipalTokenAddress():(address)", - [], + [] ); return result[0].toAddress(); @@ -1263,7 +1267,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getPrincipalTokenAddress", "getPrincipalTokenAddress():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1274,15 +1278,15 @@ export class Pool extends ethereum.SmartContract { getRequiredCollateral( _principalAmount: BigInt, - _maxPrincipalPerCollateralAmount: BigInt, + _maxPrincipalPerCollateralAmount: BigInt ): BigInt { let result = super.call( "getRequiredCollateral", "getRequiredCollateral(uint256,uint256):(uint256)", [ ethereum.Value.fromUnsignedBigInt(_principalAmount), - ethereum.Value.fromUnsignedBigInt(_maxPrincipalPerCollateralAmount), - ], + ethereum.Value.fromUnsignedBigInt(_maxPrincipalPerCollateralAmount) + ] ); return result[0].toBigInt(); @@ -1290,15 +1294,15 @@ export class Pool extends ethereum.SmartContract { try_getRequiredCollateral( _principalAmount: BigInt, - _maxPrincipalPerCollateralAmount: BigInt, + _maxPrincipalPerCollateralAmount: BigInt ): ethereum.CallResult { let result = super.tryCall( "getRequiredCollateral", "getRequiredCollateral(uint256,uint256):(uint256)", [ ethereum.Value.fromUnsignedBigInt(_principalAmount), - ethereum.Value.fromUnsignedBigInt(_maxPrincipalPerCollateralAmount), - ], + ethereum.Value.fromUnsignedBigInt(_maxPrincipalPerCollateralAmount) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1311,7 +1315,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getTokenDifferenceFromLiquidations", "getTokenDifferenceFromLiquidations():(int256)", - [], + [] ); return result[0].toBigInt(); @@ -1321,7 +1325,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "getTokenDifferenceFromLiquidations", "getTokenDifferenceFromLiquidations():(int256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1334,17 +1338,19 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "getTotalPrincipalTokensOutstandingInActiveLoans", "getTotalPrincipalTokensOutstandingInActiveLoans():(uint256)", - [], + [] ); return result[0].toBigInt(); } - try_getTotalPrincipalTokensOutstandingInActiveLoans(): ethereum.CallResult { + try_getTotalPrincipalTokensOutstandingInActiveLoans(): ethereum.CallResult< + BigInt + > { let result = super.tryCall( "getTotalPrincipalTokensOutstandingInActiveLoans", "getTotalPrincipalTokensOutstandingInActiveLoans():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1354,24 +1360,28 @@ export class Pool extends ethereum.SmartContract { } getUniswapPriceRatioForPoolRoutes( - poolOracleRoutes: Array, + poolOracleRoutes: Array< + Pool__getUniswapPriceRatioForPoolRoutesInputPoolOracleRoutesStruct + > ): BigInt { let result = super.call( "getUniswapPriceRatioForPoolRoutes", "getUniswapPriceRatioForPoolRoutes((address,bool,uint32,uint256,uint256)[]):(uint256)", - [ethereum.Value.fromTupleArray(poolOracleRoutes)], + [ethereum.Value.fromTupleArray(poolOracleRoutes)] ); return result[0].toBigInt(); } try_getUniswapPriceRatioForPoolRoutes( - poolOracleRoutes: Array, + poolOracleRoutes: Array< + Pool__getUniswapPriceRatioForPoolRoutesInputPoolOracleRoutesStruct + > ): ethereum.CallResult { let result = super.tryCall( "getUniswapPriceRatioForPoolRoutes", "getUniswapPriceRatioForPoolRoutes((address,bool,uint32,uint256,uint256)[]):(uint256)", - [ethereum.Value.fromTupleArray(poolOracleRoutes)], + [ethereum.Value.fromTupleArray(poolOracleRoutes)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1382,15 +1392,15 @@ export class Pool extends ethereum.SmartContract { initialize( _commitmentGroupConfig: Pool__initializeInput_commitmentGroupConfigStruct, - _poolOracleRoutes: Array, + _poolOracleRoutes: Array ): Address { let result = super.call( "initialize", "initialize((address,address,uint256,uint32,uint16,uint16,uint16,uint16),(address,bool,uint32,uint256,uint256)[]):(address)", [ ethereum.Value.fromTuple(_commitmentGroupConfig), - ethereum.Value.fromTupleArray(_poolOracleRoutes), - ], + ethereum.Value.fromTupleArray(_poolOracleRoutes) + ] ); return result[0].toAddress(); @@ -1398,15 +1408,15 @@ export class Pool extends ethereum.SmartContract { try_initialize( _commitmentGroupConfig: Pool__initializeInput_commitmentGroupConfigStruct, - _poolOracleRoutes: Array, + _poolOracleRoutes: Array ): ethereum.CallResult
{ let result = super.tryCall( "initialize", "initialize((address,address,uint256,uint32,uint16,uint16,uint16,uint16),(address,bool,uint32,uint256,uint256)[]):(address)", [ ethereum.Value.fromTuple(_commitmentGroupConfig), - ethereum.Value.fromTupleArray(_poolOracleRoutes), - ], + ethereum.Value.fromTupleArray(_poolOracleRoutes) + ] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1419,7 +1429,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "interestRateLowerBound", "interestRateLowerBound():(uint16)", - [], + [] ); return result[0].toI32(); @@ -1429,7 +1439,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "interestRateLowerBound", "interestRateLowerBound():(uint16)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1442,7 +1452,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "interestRateUpperBound", "interestRateUpperBound():(uint16)", - [], + [] ); return result[0].toI32(); @@ -1452,7 +1462,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "interestRateUpperBound", "interestRateUpperBound():(uint16)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1471,7 +1481,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "lastUnpausedAt", "lastUnpausedAt():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1484,7 +1494,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "liquidityThresholdPercent", "liquidityThresholdPercent():(uint16)", - [], + [] ); return result[0].toI32(); @@ -1494,7 +1504,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "liquidityThresholdPercent", "liquidityThresholdPercent():(uint16)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1507,7 +1517,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "maxLoanDuration", "maxLoanDuration():(uint32)", - [], + [] ); return result[0].toBigInt(); @@ -1517,7 +1527,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "maxLoanDuration", "maxLoanDuration():(uint32)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1530,7 +1540,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "maxPrincipalPerCollateralAmount", "maxPrincipalPerCollateralAmount():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1540,7 +1550,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "maxPrincipalPerCollateralAmount", "maxPrincipalPerCollateralAmount():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1583,7 +1593,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "poolOracleRoutes", "poolOracleRoutes(uint256):(address,bool,uint32,uint256,uint256)", - [ethereum.Value.fromUnsignedBigInt(param0)], + [ethereum.Value.fromUnsignedBigInt(param0)] ); return new Pool__poolOracleRoutesResult( @@ -1591,17 +1601,17 @@ export class Pool extends ethereum.SmartContract { result[1].toBoolean(), result[2].toBigInt(), result[3].toBigInt(), - result[4].toBigInt(), + result[4].toBigInt() ); } try_poolOracleRoutes( - param0: BigInt, + param0: BigInt ): ethereum.CallResult { let result = super.tryCall( "poolOracleRoutes", "poolOracleRoutes(uint256):(address,bool,uint32,uint256,uint256)", - [ethereum.Value.fromUnsignedBigInt(param0)], + [ethereum.Value.fromUnsignedBigInt(param0)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1613,8 +1623,8 @@ export class Pool extends ethereum.SmartContract { value[1].toBoolean(), value[2].toBigInt(), value[3].toBigInt(), - value[4].toBigInt(), - ), + value[4].toBigInt() + ) ); } @@ -1622,7 +1632,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "poolSharesToken", "poolSharesToken():(address)", - [], + [] ); return result[0].toAddress(); @@ -1632,7 +1642,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "poolSharesToken", "poolSharesToken():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1645,19 +1655,19 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "prepareSharesForBurn", "prepareSharesForBurn(uint256):(bool)", - [ethereum.Value.fromUnsignedBigInt(_amountPoolSharesTokens)], + [ethereum.Value.fromUnsignedBigInt(_amountPoolSharesTokens)] ); return result[0].toBoolean(); } try_prepareSharesForBurn( - _amountPoolSharesTokens: BigInt, + _amountPoolSharesTokens: BigInt ): ethereum.CallResult { let result = super.tryCall( "prepareSharesForBurn", "prepareSharesForBurn(uint256):(bool)", - [ethereum.Value.fromUnsignedBigInt(_amountPoolSharesTokens)], + [ethereum.Value.fromUnsignedBigInt(_amountPoolSharesTokens)] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1676,7 +1686,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "principalToken", "principalToken():(address)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1689,7 +1699,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "sharesExchangeRate", "sharesExchangeRate():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1699,7 +1709,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "sharesExchangeRate", "sharesExchangeRate():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1712,7 +1722,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "sharesExchangeRateInverse", "sharesExchangeRateInverse():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1722,7 +1732,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "sharesExchangeRateInverse", "sharesExchangeRateInverse():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1735,7 +1745,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "totalInterestCollected", "totalInterestCollected():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1745,7 +1755,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "totalInterestCollected", "totalInterestCollected():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1758,7 +1768,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "totalPrincipalTokensCommitted", "totalPrincipalTokensCommitted():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1768,7 +1778,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "totalPrincipalTokensCommitted", "totalPrincipalTokensCommitted():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1781,7 +1791,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "totalPrincipalTokensLended", "totalPrincipalTokensLended():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1791,7 +1801,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "totalPrincipalTokensLended", "totalPrincipalTokensLended():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1804,7 +1814,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "totalPrincipalTokensRepaid", "totalPrincipalTokensRepaid():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1814,7 +1824,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "totalPrincipalTokensRepaid", "totalPrincipalTokensRepaid():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1827,7 +1837,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "totalPrincipalTokensWithdrawn", "totalPrincipalTokensWithdrawn():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1837,7 +1847,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "totalPrincipalTokensWithdrawn", "totalPrincipalTokensWithdrawn():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -1850,7 +1860,7 @@ export class Pool extends ethereum.SmartContract { let result = super.call( "withdrawDelayTimeSeconds", "withdrawDelayTimeSeconds():(uint256)", - [], + [] ); return result[0].toBigInt(); @@ -1860,7 +1870,7 @@ export class Pool extends ethereum.SmartContract { let result = super.tryCall( "withdrawDelayTimeSeconds", "withdrawDelayTimeSeconds():(uint256)", - [], + [] ); if (result.reverted) { return new ethereum.CallResult(); @@ -2031,12 +2041,14 @@ export class InitializeCall__Inputs { get _commitmentGroupConfig(): InitializeCall_commitmentGroupConfigStruct { return changetype( - this._call.inputValues[0].value.toTuple(), + this._call.inputValues[0].value.toTuple() ); } get _poolOracleRoutes(): Array { - return this._call.inputValues[1].value.toTupleArray(); + return this._call.inputValues[1].value.toTupleArray< + InitializeCall_poolOracleRoutesStruct + >(); } } diff --git a/packages/subgraph-pool/package.json b/packages/subgraph-pool/package.json index 248ae277e..37c5510c2 100644 --- a/packages/subgraph-pool/package.json +++ b/packages/subgraph-pool/package.json @@ -5,12 +5,13 @@ "scripts": { "generate": "node scripts/generate-subgraph.js", "codegen": " graph codegen", - "build": " graph build", + "build": "graph codegen && graph build", "deploy:prompt": "ts-node scripts/thegraph", "create-local": "graph create --node http://localhost:8020/ teller-v2", "remove-local": "graph remove --node http://localhost:8020/ teller-v2", "reset-local": "yarn remove-local && yarn create-local", "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 teller-v2", + "deploy_ormi": "bash -c 'source .env && graph deploy \"$0\" --node https://api.subgraph.migration.ormilabs.com/deploy --ipfs https://api.subgraph.migration.ormilabs.com/ipfs --deploy-key \"$ORMI_LABS_DEPLOY_KEY\"'", "test": "yarn graph test", "format": "eslint './src/**/*.ts' --fix", "ts-node": "ts-node --project ./scripts/tsconfig.json" diff --git a/packages/subgraph-pool/src/mappings/core.ts b/packages/subgraph-pool/src/mappings/core.ts index 3ac9ee2fc..1030ff11e 100644 --- a/packages/subgraph-pool/src/mappings/core.ts +++ b/packages/subgraph-pool/src/mappings/core.ts @@ -19,7 +19,7 @@ import { group_pool_metric_data_point_daily, group_pool_metric_data_point_weekly } from "../../generated/schema" -import { BigInt, Address, BigDecimal } from "@graphprotocol/graph-ts" +import { BigInt, Address, Bytes } from "@graphprotocol/graph-ts" // Constants for time calculations const SECONDS_IN_DAY = BigInt.fromI32(86400) // 24 * 60 * 60 @@ -254,29 +254,29 @@ export function handleBorrowerAcceptedFunds(event: BorrowerAcceptedFunds): void eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.bid_id = bidId.toBigDecimal() + eventEntity.bid_id = bidId eventEntity.borrower = borrower - eventEntity.collateral_amount = collateralAmount.toBigDecimal() + eventEntity.collateral_amount = collateralAmount eventEntity.interest_rate = BigInt.fromI32(interestRate) eventEntity.loan_duration = loanDuration - eventEntity.principal_amount = principalAmount.toBigDecimal() + eventEntity.principal_amount = principalAmount eventEntity.save() // Create or update pool bid entity let bidEntity = new group_pool_bid(poolAddress.toHexString() + "-" + bidId.toString()) bidEntity.group_pool_address = poolAddress - bidEntity.bid_id = bidId.toBigDecimal() + bidEntity.bid_id = bidId bidEntity.borrower = borrower - bidEntity.collateral_amount = collateralAmount.toBigDecimal() - bidEntity.principal_amount = principalAmount.toBigDecimal() + bidEntity.collateral_amount = collateralAmount + bidEntity.principal_amount = principalAmount bidEntity.save() let tellerBidEntity = new teller_bid( bidId.toString() ) tellerBidEntity.group_pool_address = poolAddress - tellerBidEntity.bid_id = bidId.toBigDecimal() + tellerBidEntity.bid_id = bidId tellerBidEntity.borrower = borrower - tellerBidEntity.collateral_amount = collateralAmount.toBigDecimal() - tellerBidEntity.principal_amount = principalAmount.toBigDecimal() + tellerBidEntity.collateral_amount = collateralAmount + tellerBidEntity.principal_amount = principalAmount tellerBidEntity.save() @@ -319,9 +319,9 @@ export function handleEarningsWithdrawn(event: EarningsWithdrawn): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.amount_pool_shares_tokens = amountPoolSharesTokens.toBigDecimal() + eventEntity.amount_pool_shares_tokens = amountPoolSharesTokens eventEntity.lender = lender - eventEntity.principal_tokens_withdrawn = principalTokensWithdrawn.toBigDecimal() + eventEntity.principal_tokens_withdrawn = principalTokensWithdrawn eventEntity.recipient = recipient eventEntity.save() @@ -360,9 +360,9 @@ export function handleLenderAddedPrincipal(event: LenderAddedPrincipal): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.amount = amount.toBigDecimal() + eventEntity.amount = amount eventEntity.lender = lender - eventEntity.shares_amount = sharesAmount.toBigDecimal() + eventEntity.shares_amount = sharesAmount eventEntity.shares_recipient = sharesRecipient eventEntity.save() @@ -403,12 +403,12 @@ export function handleLoanRepaid(event: LoanRepaid): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.bid_id = bidId.toBigDecimal() - eventEntity.interest_amount = interestAmount.toBigDecimal() - eventEntity.principal_amount = principalAmount.toBigDecimal() + eventEntity.bid_id = bidId + eventEntity.interest_amount = interestAmount + eventEntity.principal_amount = principalAmount eventEntity.repayer = repayer - eventEntity.total_interest_collected = totalInterestCollected.toBigDecimal() - eventEntity.total_principal_repaid = totalPrincipalRepaid.toBigDecimal() + eventEntity.total_interest_collected = totalInterestCollected + eventEntity.total_principal_repaid = totalPrincipalRepaid eventEntity.save() // Update pool metrics @@ -442,10 +442,10 @@ export function handleLoanLiquidated(event: DefaultedLoanLiquidated): void { eventEntity.evt_block_time = event.block.timestamp eventEntity.evt_block_number = event.block.number eventEntity.group_pool_address = poolAddress - eventEntity.amount_due = amountDue.toBigDecimal() - eventEntity.bid_id = bidId.toBigDecimal() + eventEntity.amount_due = amountDue + eventEntity.bid_id = bidId eventEntity.liquidator = liquidator - eventEntity.token_amount_difference = tokenAmountDifference.toBigDecimal() + eventEntity.token_amount_difference = tokenAmountDifference eventEntity.save() // Update pool metrics diff --git a/packages/subgraph-pool/src/schema.graphql b/packages/subgraph-pool/src/schema.graphql index 6075af451..93bed88b5 100644 --- a/packages/subgraph-pool/src/schema.graphql +++ b/packages/subgraph-pool/src/schema.graphql @@ -42,12 +42,12 @@ type group_borrower_accepted_funds @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - bid_id: BigDecimal! + bid_id: BigInt! borrower: Bytes! - collateral_amount: BigDecimal! + collateral_amount: BigInt! interest_rate: BigInt! loan_duration: BigInt! - principal_amount: BigDecimal! + principal_amount: BigInt! } type group_lender_added_principal @entity(immutable: true) { @@ -57,9 +57,9 @@ type group_lender_added_principal @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - amount: BigDecimal! + amount: BigInt! lender: Bytes! - shares_amount: BigDecimal! + shares_amount: BigInt! shares_recipient: Bytes! } type group_earnings_withdrawn @entity(immutable: true) { @@ -69,9 +69,9 @@ type group_earnings_withdrawn @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - amount_pool_shares_tokens: BigDecimal! + amount_pool_shares_tokens: BigInt! lender: Bytes! - principal_tokens_withdrawn: BigDecimal! + principal_tokens_withdrawn: BigInt! recipient: Bytes! } type group_defaulted_loan_liquidated @entity(immutable: true) { @@ -81,10 +81,10 @@ type group_defaulted_loan_liquidated @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - amount_due: BigDecimal! - bid_id: BigDecimal! + amount_due: BigInt! + bid_id: BigInt! liquidator: Bytes! - token_amount_difference: BigDecimal! + token_amount_difference: BigInt! } type group_initialized @entity(immutable: true) { id: ID! @@ -103,12 +103,12 @@ type group_loan_repaid @entity(immutable: true) { evt_block_time: BigInt! evt_block_number: BigInt! group_pool_address: Bytes! - bid_id: BigDecimal! - interest_amount: BigDecimal! - principal_amount: BigDecimal! + bid_id: BigInt! + interest_amount: BigInt! + principal_amount: BigInt! repayer: Bytes! - total_interest_collected: BigDecimal! - total_principal_repaid: BigDecimal! + total_interest_collected: BigInt! + total_principal_repaid: BigInt! } type group_ownership_transferred @entity(immutable: true) { id: ID! @@ -161,10 +161,10 @@ type group_unpaused @entity(immutable: true) { type group_pool_bid @entity(immutable: true) { id: ID! group_pool_address: Bytes! - bid_id: BigDecimal! + bid_id: BigInt! borrower: Bytes! - collateral_amount: BigDecimal! - principal_amount: BigDecimal! + collateral_amount: BigInt! + principal_amount: BigInt! } @@ -172,10 +172,10 @@ type group_pool_bid @entity(immutable: true) { type teller_bid @entity(immutable: true) { id: ID! group_pool_address: Bytes! - bid_id: BigDecimal! + bid_id: BigInt! borrower: Bytes! - collateral_amount: BigDecimal! - principal_amount: BigDecimal! + collateral_amount: BigInt! + principal_amount: BigInt! } diff --git a/packages/subgraph-pool/subgraph.yaml b/packages/subgraph-pool/subgraph.yaml index 2abecd155..44ff27816 100644 --- a/packages/subgraph-pool/subgraph.yaml +++ b/packages/subgraph-pool/subgraph.yaml @@ -9,11 +9,11 @@ features: dataSources: - kind: ethereum/contract name: Factory - network: matic + network: mainnet source: abi: Factory - address: "0x2fF5ea5CF5061EB0fcfB7A2AafB8CCC79f3F73ea" - startBlock: 66265322 + address: "0x0848E884b2DBb63727aa3216b921C279f6DC9a91" + startBlock: 21616926 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -29,11 +29,11 @@ dataSources: handler: handleLenderGroupDeployed - kind: ethereum/contract name: CollateralManager - network: matic + network: mainnet source: abi: CollateralManager - address: "0x76888a882a4fF57455B5e74B791DD19DF3ba51Bb" - startBlock: 66265322 + address: "0x2551A099129ad9b0b1FEc16f34D9CB73c237be8b" + startBlock: 21616926 mapping: kind: ethereum/events apiVersion: 0.0.7 @@ -51,7 +51,7 @@ dataSources: templates: - kind: ethereum/contract name: Pool - network: matic + network: mainnet source: abi: Pool mapping: