-
Notifications
You must be signed in to change notification settings - Fork 0
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 #13 from mangrovedao/fix/maxence/price
feat: add addresses
- Loading branch information
Showing
13 changed files
with
188 additions
and
12 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 @@ | ||
--- | ||
"@mangrovedao/mgv": minor | ||
--- | ||
|
||
Added addresses book in /addresses |
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,19 @@ | ||
export type { | ||
Token, | ||
BuildTokenParms, | ||
} from './tokens/index.js' | ||
|
||
export { blastMarkets } from './markets/index.js' | ||
|
||
// --- tokens --- | ||
|
||
export { | ||
blastWETH, | ||
blastUSDB, | ||
blastMetaStreetWETHPUNKS20, | ||
blastMetaStreetWETHPUNKS40, | ||
} from './tokens/index.js' | ||
|
||
// --- mangrove --- | ||
|
||
export { blastMangrove } from './mangrove/index.js' |
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,7 @@ | ||
import type { MangroveActionsDefaultParams } from '../../types/index.js' | ||
|
||
export const blastMangrove = { | ||
mgv: '0xb1a49C54192Ea59B233200eA38aB56650Dfb448C', | ||
mgvOrder: '0x83251E7F36a51c5238C9aa0c6Bb7cc209b32d80e', | ||
mgvReader: '0x26fD9643Baf1f8A44b752B28f0D90AEBd04AB3F8', | ||
} as const satisfies MangroveActionsDefaultParams |
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 @@ | ||
export { blastMangrove } from './blast.js' |
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,25 @@ | ||
import type { MarketParams } from '../../types/index.js' | ||
import { | ||
blastMetaStreetWETHPUNKS20, | ||
blastMetaStreetWETHPUNKS40, | ||
blastUSDB, | ||
blastWETH, | ||
} from '../tokens/blast.js' | ||
|
||
export const blastMarkets = [ | ||
{ | ||
base: blastWETH, | ||
quote: blastUSDB, | ||
tickSpacing: 1n, | ||
}, | ||
{ | ||
base: blastMetaStreetWETHPUNKS20, | ||
quote: blastWETH, | ||
tickSpacing: 1n, | ||
}, | ||
{ | ||
base: blastMetaStreetWETHPUNKS40, | ||
quote: blastWETH, | ||
tickSpacing: 1n, | ||
}, | ||
] as const satisfies MarketParams[] |
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 @@ | ||
export { blastMarkets } from './blast.js' |
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,23 @@ | ||
import { buildToken } from './utils.js' | ||
|
||
export const blastWETH = buildToken({ | ||
address: '0x4300000000000000000000000000000000000004', | ||
symbol: 'WETH', | ||
}) | ||
|
||
export const blastUSDB = buildToken({ | ||
address: '0x4300000000000000000000000000000000000002', | ||
symbol: 'USDB', | ||
displayDecimals: 2, | ||
priceDisplayDecimals: 2, | ||
}) | ||
|
||
export const blastMetaStreetWETHPUNKS20 = buildToken({ | ||
address: '0x9a50953716ba58e3d6719ea5c437452ac578705f', | ||
symbol: 'mwstETH-WPUNKS:20', | ||
}) | ||
|
||
export const blastMetaStreetWETHPUNKS40 = buildToken({ | ||
address: '0x999f220296b5843b2909cc5f8b4204aaca5341d8', | ||
symbol: 'mwstETH-WPUNKS:40', | ||
}) |
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,13 @@ | ||
export { | ||
blastWETH, | ||
blastUSDB, | ||
blastMetaStreetWETHPUNKS20, | ||
blastMetaStreetWETHPUNKS40, | ||
} from './blast.js' | ||
|
||
export type { | ||
Token, | ||
BuildTokenParms, | ||
} from './utils.js' | ||
|
||
export { buildToken } from './utils.js' |
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,81 @@ | ||
import type { Address } from 'viem' | ||
|
||
export const DEFAULT_DISPLAY_DECIMALS = 3 as const | ||
export const DEFAULT_PRICE_DISPLAY_DECIMALS = 6 as const | ||
export const DEFAULT_DECIMALS = 18 as const | ||
|
||
export type Token< | ||
TAddress extends Address = Address, | ||
TSymbol extends string = string, | ||
TDecimals extends number = number, | ||
TDisplayDecimals extends number = number, | ||
TPriceDisplayDecimals extends number = number, | ||
> = { | ||
address: TAddress | ||
symbol: TSymbol | ||
decimals: TDecimals | ||
displayDecimals: TDisplayDecimals | ||
priceDisplayDecimals: TPriceDisplayDecimals | ||
} | ||
|
||
export type BuildTokenParms< | ||
TAddress extends Address = Address, | ||
TSymbol extends string = string, | ||
TDecimals extends number | undefined = number | undefined, | ||
TDisplayDecimals extends number | undefined = number | undefined, | ||
TPriceDisplayDecimals extends number | undefined = number | undefined, | ||
> = { | ||
address: TAddress | ||
symbol: TSymbol | ||
decimals?: TDecimals | ||
displayDecimals?: TDisplayDecimals | ||
priceDisplayDecimals?: TPriceDisplayDecimals | ||
} | ||
|
||
export function buildToken< | ||
TAddress extends Address = Address, | ||
TSymbol extends string = string, | ||
TDecimals extends number | undefined = undefined, | ||
TDisplayDecimals extends number | undefined = undefined, | ||
TPriceDisplayDecimals extends number | undefined = undefined, | ||
>({ | ||
address, | ||
symbol, | ||
decimals = DEFAULT_DECIMALS, | ||
displayDecimals = DEFAULT_DISPLAY_DECIMALS, | ||
priceDisplayDecimals = DEFAULT_PRICE_DISPLAY_DECIMALS, | ||
}: BuildTokenParms< | ||
TAddress, | ||
TSymbol, | ||
TDecimals, | ||
TDisplayDecimals, | ||
TPriceDisplayDecimals | ||
>): Token< | ||
TAddress, | ||
TSymbol, | ||
TDecimals extends number ? TDecimals : typeof DEFAULT_DECIMALS, | ||
TDisplayDecimals extends number | ||
? TDisplayDecimals | ||
: typeof DEFAULT_DISPLAY_DECIMALS, | ||
TPriceDisplayDecimals extends number | ||
? TPriceDisplayDecimals | ||
: typeof DEFAULT_PRICE_DISPLAY_DECIMALS | ||
> { | ||
return { | ||
address, | ||
symbol, | ||
decimals, | ||
displayDecimals, | ||
priceDisplayDecimals, | ||
} as Token< | ||
TAddress, | ||
TSymbol, | ||
TDecimals extends number ? TDecimals : typeof DEFAULT_DECIMALS, | ||
TDisplayDecimals extends number | ||
? TDisplayDecimals | ||
: typeof DEFAULT_DISPLAY_DECIMALS, | ||
TPriceDisplayDecimals extends number | ||
? TPriceDisplayDecimals | ||
: typeof DEFAULT_PRICE_DISPLAY_DECIMALS | ||
> | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
export type { | ||
MangroveActionsDefaultParams, | ||
Token, | ||
MarketParams, | ||
BuiltArgs, | ||
BuiltArgsWithValue, | ||
|