Created
November 9, 2021 15:58
-
-
Save wilsoncusack/f18bcf75ff4d9c06fb0ba5f534668997 to your computer and use it in GitHub Desktop.
nft-backed loans subgraph entities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Loan @entity { | |
id: ID! | |
closed: Boolean! | |
perSecondInterestRate: BigInt! | |
accumulatedInterest: BigInt! | |
lastAccumulatedTimestamp: BigInt! | |
durationSeconds: BigInt! | |
loanAmount: BigInt! | |
collateralTokenId: BigInt! | |
collateralContractAddress: Bytes! | |
loanAssetContractAddress: Bytes! | |
# not in contract | |
creator: Bytes! | |
borrowTickerHolder: Bytes | |
lendTicketHolder: Bytes | |
createdAt: Int! | |
loanAssetSymbol: String! | |
loanAssetDecimal: Int! | |
collateralAssetName: String! | |
# event references | |
lendEvents: [LendEvent!] @derivedFrom(field: "loan") | |
buyoutEvents: [BuyoutEvent!] @derivedFrom(field: "loan") | |
repaymentEvent: RepaymentEvent @derivedFrom(field: "loan") | |
collateralSeizureEvent: CollateralSeizureEvent @derivedFrom(field: "loan") | |
} | |
type LendEvent @entity { | |
id: ID! | |
loan: Loan! | |
lender: Bytes! | |
loanAmount: BigInt! | |
durationSeconds: BigInt! | |
perSecondInterestRate: BigInt! | |
timestamp: Int! | |
} | |
type BuyoutEvent @entity { | |
id: ID! | |
loan: Loan! | |
newLender: Bytes! | |
previousLender: Bytes! | |
loanAmount: BigInt! | |
interestEarned: BigInt! | |
timestamp: Int! | |
} | |
type RepaymentEvent @entity { | |
id: ID! | |
loan: Loan! | |
repayer: Bytes! | |
paidTo: Bytes! | |
loanAmount: BigInt! | |
interestEarned: BigInt! | |
timestamp: Int! | |
} | |
type CollateralSeizureEvent @entity { | |
id: ID! | |
loan: Loan! | |
timestamp: Int! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment