Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed getUSDValue helper #145

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AllInteractions/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dataSources:
name: PoolFactory
network: chapel
source:
address: "0xc5A750E8e3361D186236D7f708Cb1C92b944Ce48"
address: "0x16A393C8D0cdF0E3D4be1A68610E90268b367283"
abi: PoolFactory
startBlock: 34202816
startBlock: 34950529
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -27,9 +27,9 @@ dataSources:
name: UserRegistry
network: chapel
source:
address: "0x7d090C1a5A5f8f1742F32C15BeB03980B3bfb1Dc"
address: "0xA3A20A05C3f69a77c0eca9c4f23840D3c3C8C917"
abi: UserRegistry
startBlock: 34202816
startBlock: 34950529
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down
2 changes: 1 addition & 1 deletion DaoPools/src/entities/global/globals.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BigInt } from "@graphprotocol/graph-ts";

export const PRICE_FEED_ADDRESS = "0x80852Edd95423C3BD37F94EF795e7Da8E1ED465e";
export const PRICE_FEED_ADDRESS = "0xc2E2ad8Bbf700C054951DD869750803B15d27A9F";
export const BNB_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
export const WBNB_ADDRESS = "0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd";
export const DAY = 86400;
Expand Down
6 changes: 5 additions & 1 deletion DaoPools/src/helpers/PriceFeedInteractions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import { PriceFeed } from "../../generated/templates/DaoPool/PriceFeed";
import { PRICE_FEED_ADDRESS } from "../entities/global/globals";

export function getUSDValue(token: Bytes, amount: BigInt): BigInt {
if (token.equals(Bytes.empty())) {
return BigInt.zero();
}

let pfPrototype = PriceFeed.bind(Address.fromString(PRICE_FEED_ADDRESS));

let resp = pfPrototype.try_getNormalizedPriceOutUSD(Address.fromString(token.toHexString()), amount);
let resp = pfPrototype.try_getNormalizedPriceOutUSD(Address.fromBytes(token), amount);
if (resp.reverted) {
log.warning("try_getNormalizedPriceOutUSD reverted. FromToken: {}, Amount:{}", [
token.toHexString(),
Expand Down
8 changes: 4 additions & 4 deletions DaoPools/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dataSources:
name: PoolFactory
network: chapel
source:
address: "0xc5A750E8e3361D186236D7f708Cb1C92b944Ce48"
address: "0x16A393C8D0cdF0E3D4be1A68610E90268b367283"
abi: PoolFactory
startBlock: 34202816
startBlock: 34950529
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -26,9 +26,9 @@ dataSources:
name: ERC721Expert
network: chapel
source:
address: "0x36841F49C19B08795f4d3CDd9AB722Be8A8843C9"
address: "0xc85a5D41217C6bf7500d2d115dAbA3B98d17cbe7"
abi: ERC721Expert
startBlock: 34202816
startBlock: 34950529
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down
4 changes: 2 additions & 2 deletions DaoValidators/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ dataSources:
name: PoolFactory
network: chapel
source:
address: "0xc5A750E8e3361D186236D7f708Cb1C92b944Ce48"
address: "0x16A393C8D0cdF0E3D4be1A68610E90268b367283"
abi: PoolFactory
startBlock: 34202816
startBlock: 34950529
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down