-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from curvefi/market-template
feat: allow late initialization of OneWayMarketTemplate
- Loading branch information
Showing
5 changed files
with
10 additions
and
38 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
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 |
---|---|---|
@@ -1,33 +1,4 @@ | ||
import {IDict, ILlamma} from "../interfaces"; | ||
import {IDict} from "../interfaces"; | ||
|
||
export const lowerCaseLlammasAddresses = (llammas: IDict<ILlamma>): IDict<ILlamma> => { | ||
for (const llammaId in llammas) { | ||
if (!Object.prototype.hasOwnProperty.call(llammas, llammaId)) continue; | ||
const llamma = llammas[llammaId]; | ||
llamma.amm_address = llamma.amm_address.toLowerCase(); | ||
llamma.controller_address = llamma.controller_address.toLowerCase(); | ||
llamma.collateral_address = llamma.collateral_address.toLowerCase(); | ||
llamma.monetary_policy_address = llamma.monetary_policy_address.toLowerCase(); | ||
llamma.leverage_zap = llamma.leverage_zap.toLowerCase(); | ||
} | ||
|
||
return llammas | ||
} | ||
|
||
export const extractDecimals = (llammas: IDict<ILlamma>): IDict<number> => { | ||
const DECIMALS: IDict<number> = {}; | ||
for (const llammaId in llammas) { | ||
if (!Object.prototype.hasOwnProperty.call(llammas, llammaId)) continue; | ||
const llamma = llammas[llammaId]; | ||
|
||
// Collateral | ||
DECIMALS[llamma.collateral_address] = llamma.collateral_decimals; | ||
} | ||
|
||
return DECIMALS | ||
} | ||
|
||
export const lowerCaseValues = (dict: IDict<string>): IDict<string> => { | ||
// @ts-ignore | ||
return Object.fromEntries(Object.entries(dict).map((entry) => [entry[0], entry[1].toLowerCase()])) | ||
} | ||
export const lowerCaseValues = (dict: IDict<string>): IDict<string> => | ||
Object.fromEntries(Object.entries(dict).map((entry) => [entry[0], entry[1].toLowerCase()])) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { OneWayMarketTemplate} from "./OneWayMarketTemplate.js"; | ||
import {lending} from "../lending"; | ||
|
||
export const getOneWayMarket = (oneWayMarketId: string): OneWayMarketTemplate => { | ||
return new OneWayMarketTemplate(oneWayMarketId) | ||
const marketData = lending.constants.ONE_WAY_MARKETS[oneWayMarketId]; | ||
return new OneWayMarketTemplate(oneWayMarketId, marketData) | ||
} |
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