Skip to content

Commit

Permalink
new contract
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMeir committed Dec 6, 2021
1 parent 8377704 commit 16952f8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion Positions-Manager-Compound-Subgraph/build/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dataSources:
name: PositionsManagerForCompound
network: ropsten
source:
address: "0xdef2d58c17c340ad572e2c94549ba56e8c2e1c2f"
address: "0xc4fcdb90e76c84ead1f1bc2427866d0c8c3198fa"
abi: PositionsManagerForCompound
startBlock: 11506156
mapping:
Expand Down
40 changes: 20 additions & 20 deletions Positions-Manager-Compound-Subgraph/src/updatePositions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export function updatePositionsDailyDataBorrow(event: BorrowerPositionUpdated):

// multiply amounts by exchange rate
// from https://www.notion.so/morpho-labs/Compound-Protocol-cfc633dc14e845d1b18b65b1658f77e2
dayData.amountAddedOnPool = dayData.amountAddedOnPool.plus(event.params._amountAddedOnPool * event.params._p2pExchangeRate)
dayData.amountAddedInP2P = dayData.amountAddedInP2P.plus(event.params._amountAddedInP2P * event.params._p2pExchangeRate)
dayData.amountRemovedFromPool = dayData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool * event.params._p2pExchangeRate)
dayData.amountRemovedFromP2P = dayData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P * event.params._p2pExchangeRate)
dayData.amountAddedOnPool = dayData.amountAddedOnPool.plus(event.params._amountAddedOnPool)
dayData.amountAddedInP2P = dayData.amountAddedInP2P.plus(event.params._amountAddedInP2P)
dayData.amountRemovedFromPool = dayData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool)
dayData.amountRemovedFromP2P = dayData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P)

return dayData as DailyDataForMarket

Expand Down Expand Up @@ -64,10 +64,10 @@ export function updatePositionsDailyDataSupply(event: SupplierPositionUpdated):

// multiply amounts by exchange rate
// from https://www.notion.so/morpho-labs/Compound-Protocol-cfc633dc14e845d1b18b65b1658f77e2
dayData.amountAddedOnPool = dayData.amountAddedOnPool.plus(event.params._amountAddedOnPool * event.params._p2pExchangeRate)
dayData.amountAddedInP2P = dayData.amountAddedInP2P.plus(event.params._amountAddedInP2P * event.params._p2pExchangeRate)
dayData.amountRemovedFromPool = dayData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool * event.params._p2pExchangeRate)
dayData.amountRemovedFromP2P = dayData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P * event.params._p2pExchangeRate)
dayData.amountAddedOnPool = dayData.amountAddedOnPool.plus(event.params._amountAddedOnPool)
dayData.amountAddedInP2P = dayData.amountAddedInP2P.plus(event.params._amountAddedInP2P)
dayData.amountRemovedFromPool = dayData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool)
dayData.amountRemovedFromP2P = dayData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P)

return dayData as DailyDataForMarket

Expand All @@ -89,12 +89,12 @@ export function updatePositionsAllTimeDataBorrow(event: BorrowerPositionUpdated)

// multiply amounts by exchange rate
// from https://www.notion.so/morpho-labs/Compound-Protocol-cfc633dc14e845d1b18b65b1658f77e2
allData.amountAddedOnPool = allData.amountAddedOnPool.plus(event.params._amountAddedOnPool * event.params._p2pExchangeRate)
allData.amountAddedInP2P = allData.amountAddedInP2P.plus(event.params._amountAddedInP2P * event.params._p2pExchangeRate)
allData.amountRemovedFromPool = allData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool * event.params._p2pExchangeRate)
allData.amountRemovedFromP2P = allData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P * event.params._p2pExchangeRate)
allData.netAmountAddedOnPool = allData.netAmountAddedOnPool.plus(event.params._amountAddedOnPool * event.params._p2pExchangeRate).minus(event.params._amountRemovedFromPool * event.params._p2pExchangeRate)
allData.netAmountAddedInP2P = allData.netAmountAddedInP2P.plus(event.params._amountAddedInP2P * event.params._p2pExchangeRate).minus(event.params._amountRemovedFromP2P * event.params._p2pExchangeRate)
allData.amountAddedOnPool = allData.amountAddedOnPool.plus(event.params._amountAddedOnPool)
allData.amountAddedInP2P = allData.amountAddedInP2P.plus(event.params._amountAddedInP2P)
allData.amountRemovedFromPool = allData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool)
allData.amountRemovedFromP2P = allData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P)
allData.netAmountAddedOnPool = allData.netAmountAddedOnPool.plus(event.params._amountAddedOnPool).minus(event.params._amountRemovedFromPool)
allData.netAmountAddedInP2P = allData.netAmountAddedInP2P.plus(event.params._amountAddedInP2P).minus(event.params._amountRemovedFromP2P)

return allData as AllTimeDataForMarket

Expand All @@ -116,12 +116,12 @@ export function updatePositionsAllTimeDataSupply(event: SupplierPositionUpdated)

// multiply amounts by exchange rate
// from https://www.notion.so/morpho-labs/Compound-Protocol-cfc633dc14e845d1b18b65b1658f77e2
allData.amountAddedOnPool = allData.amountAddedOnPool.plus(event.params._amountAddedOnPool * event.params._p2pExchangeRate)
allData.amountAddedInP2P = allData.amountAddedInP2P.plus(event.params._amountAddedInP2P * event.params._p2pExchangeRate)
allData.amountRemovedFromPool = allData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool * event.params._p2pExchangeRate)
allData.amountRemovedFromP2P = allData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P * event.params._p2pExchangeRate)
allData.netAmountAddedOnPool = allData.netAmountAddedOnPool.plus(event.params._amountAddedOnPool * event.params._p2pExchangeRate).minus(event.params._amountRemovedFromPool * event.params._p2pExchangeRate)
allData.netAmountAddedInP2P = allData.netAmountAddedInP2P.plus(event.params._amountAddedInP2P * event.params._p2pExchangeRate).minus(event.params._amountRemovedFromP2P * event.params._p2pExchangeRate)
allData.amountAddedOnPool = allData.amountAddedOnPool.plus(event.params._amountAddedOnPool)
allData.amountAddedInP2P = allData.amountAddedInP2P.plus(event.params._amountAddedInP2P)
allData.amountRemovedFromPool = allData.amountRemovedFromPool.plus(event.params._amountRemovedFromPool)
allData.amountRemovedFromP2P = allData.amountRemovedFromP2P.plus(event.params._amountRemovedFromP2P)
allData.netAmountAddedOnPool = allData.netAmountAddedOnPool.plus(event.params._amountAddedOnPool).minus(event.params._amountRemovedFromPool)
allData.netAmountAddedInP2P = allData.netAmountAddedInP2P.plus(event.params._amountAddedInP2P).minus(event.params._amountRemovedFromP2P)

return allData as AllTimeDataForMarket

Expand Down
2 changes: 1 addition & 1 deletion Positions-Manager-Compound-Subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dataSources:
name: PositionsManagerForCompound
network: ropsten
source:
address: "0xdef2d58c17c340ad572e2c94549ba56e8c2e1c2f"
address: "0xc4fcdb90e76c84ead1f1bc2427866d0c8c3198fa"
abi: PositionsManagerForCompound
startBlock: 11506156
mapping:
Expand Down

0 comments on commit 16952f8

Please sign in to comment.