-
Notifications
You must be signed in to change notification settings - Fork 381
Conversation
|
||
export const LYRA_AVALON_DEFINITION = appDefinition({ | ||
id: 'lyra-avalon', | ||
name: 'Lyra', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: 'Lyra', | |
name: 'Lyra Avalon', |
if (!market?.strikes) return []; | ||
|
||
// Extract information from contract position | ||
const [, optionType, , strikeId] = (contractPosition.displayProps.secondaryLabel as string).split(' '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use dataProps
in src/apps/lyra-avalon/optimism/lyra-avalon.options.contract-position-fetcher.ts
to supplement the token with any additional information (like the strike, option type, etc). Type it as well as LyraAvalonOptionContractPositionDataProps
.
Then you'll have access to the typed data proper if you do the following:
return this.appToolkit.helpers.contractPositionBalanceHelper.getContractPositionBalances<LyraAvalonOptionContractPositionDataProps>({
// ...
resolveBalances: async({ contractPosition }) => {
const { strike, optionType } = contractPosition.dataProps; // This will be typed to LyraAvalonOptionContractPositionDataProps
}
});
// Determine price of the contract position strike | ||
const strike = market.strikes.find(strike => Number(strike.strikeId) === strikeId); | ||
if (!strike) return []; | ||
const price = (OPTION_TYPES[optionType].includes('Call') ? strike.callOption : strike.putOption) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can put the option price on the data props as well. Try to put as much relevant information in the data props as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want this in a separate pr? i see this one is merged already
edit: I took a look, the main issue seems to be that the market addresses are not set, so we either have to make a query anyways to get the market addresses first, or we have to call the markets to get the user positions as we find them in the contract positions, which could be a little messy. I'm fine with either method, but im not sure if its worth the effort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Add new lyra avalon options markets
Note: not affiliated with the project. I did submit a grant request with them for this though
Checklist
How to test?
curl -X 'GET'
'http://localhost:5001/apps/lyra-avalon/balances?network=optimism&addresses%5B%5D=0x4E190B3D31d96e0cD11a1520185a77b57A0182f2'
-H 'accept: /'
https://thegraph.com/hosted-service/subgraph/lyra-finance/mainnet
registry contract: https://optimistic.etherscan.io/address/0x7c7abddbcb6c731237f7546d3e4c5165531fb0c1#readContract