-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* mapleSyrupAPR Adding syrupUSDC apr handler to backend. Pool: https://balancer.fi/pools/ethereum/v2/0xd7f6a3c844d431f083e576a9972e56192a6635f30000000000000000000006b4 Token: https://etherscan.io/token/0x80ac24aa929eaf5013f6436cda2a7ba190f5cc0b * stakewise APRs * syrup USDC APR * changeset --------- Co-authored-by: gmbronco <[email protected]>
- Loading branch information
Showing
7 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'backend': patch | ||
--- | ||
|
||
stakewise gnosis and maple syrup APRs |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
45 changes: 45 additions & 0 deletions
45
modules/pool/lib/apr-data-sources/yb-apr-handlers/sources/maple-apr-handler.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { YbAprConfig } from '../../../../../network/apr-config-types'; | ||
|
||
const query = `{ | ||
syrupGlobals { | ||
apy | ||
} | ||
}`; | ||
|
||
const requestQuery = { | ||
query, | ||
}; | ||
|
||
interface Response { | ||
data: { | ||
syrupGlobals: { | ||
apy: string; | ||
}; | ||
}; | ||
} | ||
|
||
export class Maple { | ||
constructor(private config: YbAprConfig['maple']) {} | ||
|
||
async getAprs() { | ||
const response = await fetch(this.config!.url, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(requestQuery), | ||
}); | ||
|
||
const { | ||
data: { | ||
syrupGlobals: { apy }, | ||
}, | ||
} = (await response.json()) as Response; | ||
|
||
const apr = parseFloat(apy) / 1e28; | ||
|
||
return { | ||
[this.config!.token]: { apr, isIbYield: true }, | ||
}; | ||
} | ||
} |
This file contains 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