-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a base of the tezos atomex protocol;
Add the kUSD config
- Loading branch information
1 parent
faa9f3c
commit a95f710
Showing
15 changed files
with
464 additions
and
7 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
52 changes: 52 additions & 0 deletions
52
src/tezos/atomexProtocol/fa12TezosTaquitoAtomexProtocolV1.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,52 @@ | ||
import type BigNumber from 'bignumber.js'; | ||
|
||
import type { | ||
AtomexProtocolV1, AtomexProtocolV1InitiateParameters, AtomexProtocolV1RedeemParameters, AtomexProtocolV1RefundParameters, | ||
Transaction | ||
} from '../../blockchain/index'; | ||
import type { AtomexNetwork, CurrenciesProvider } from '../../common/index'; | ||
import type { DeepReadonly } from '../../core'; | ||
import type { FA12TezosTaquitoAtomexProtocolV1Options } from '../models/atomexProtocolOptions'; | ||
|
||
export class FA12TezosTaquitoAtomexProtocolV1 implements AtomexProtocolV1 { | ||
readonly version = 1; | ||
|
||
constructor( | ||
readonly atomexNetwork: AtomexNetwork, | ||
protected readonly currenciesProvider: CurrenciesProvider, | ||
protected readonly atomexProtocolOptions: DeepReadonly<FA12TezosTaquitoAtomexProtocolV1Options> | ||
) { | ||
} | ||
|
||
get currencyId() { | ||
return this.atomexProtocolOptions.currencyId; | ||
} | ||
|
||
initiate(_params: AtomexProtocolV1InitiateParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedInitiateFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
redeem(_params: AtomexProtocolV1RedeemParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getRedeemReward(_nativeTokenPriceInUsd: number, _nativeTokenPriceInCurrency: number): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedRedeemFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
refund(_params: AtomexProtocolV1RefundParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedRefundFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/tezos/atomexProtocol/fa2TezosTaquitoAtomexProtocolV1.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,52 @@ | ||
import type BigNumber from 'bignumber.js'; | ||
|
||
import type { | ||
AtomexProtocolV1, AtomexProtocolV1InitiateParameters, AtomexProtocolV1RedeemParameters, AtomexProtocolV1RefundParameters, | ||
Transaction | ||
} from '../../blockchain/index'; | ||
import type { AtomexNetwork, CurrenciesProvider } from '../../common/index'; | ||
import type { DeepReadonly } from '../../core'; | ||
import type { FA2TezosTaquitoAtomexProtocolV1Options } from '../models/atomexProtocolOptions'; | ||
|
||
export class FA2TezosTaquitoAtomexProtocolV1 implements AtomexProtocolV1 { | ||
readonly version = 1; | ||
|
||
constructor( | ||
readonly atomexNetwork: AtomexNetwork, | ||
protected readonly currenciesProvider: CurrenciesProvider, | ||
protected readonly atomexProtocolOptions: DeepReadonly<FA2TezosTaquitoAtomexProtocolV1Options> | ||
) { | ||
} | ||
|
||
get currencyId() { | ||
return this.atomexProtocolOptions.currencyId; | ||
} | ||
|
||
initiate(_params: AtomexProtocolV1InitiateParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedInitiateFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
redeem(_params: AtomexProtocolV1RedeemParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getRedeemReward(_nativeTokenPriceInUsd: number, _nativeTokenPriceInCurrency: number): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedRedeemFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
refund(_params: AtomexProtocolV1RefundParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedRefundFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
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,3 @@ | ||
export { TezosTaquitoAtomexProtocolV1 } from './tezosTaquitoAtomexProtocolV1'; | ||
export { FA12TezosTaquitoAtomexProtocolV1 } from './fa12TezosTaquitoAtomexProtocolV1'; | ||
export { FA2TezosTaquitoAtomexProtocolV1 } from './fa2TezosTaquitoAtomexProtocolV1'; |
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,52 @@ | ||
import type BigNumber from 'bignumber.js'; | ||
|
||
import type { | ||
AtomexProtocolV1, AtomexProtocolV1InitiateParameters, AtomexProtocolV1RedeemParameters, AtomexProtocolV1RefundParameters, | ||
Transaction | ||
} from '../../blockchain/index'; | ||
import type { AtomexNetwork, CurrenciesProvider } from '../../common/index'; | ||
import type { DeepReadonly } from '../../core'; | ||
import type { TezosTaquitoAtomexProtocolV1Options } from '../models/atomexProtocolOptions'; | ||
|
||
export class TezosTaquitoAtomexProtocolV1 implements AtomexProtocolV1 { | ||
readonly version = 1; | ||
|
||
constructor( | ||
readonly atomexNetwork: AtomexNetwork, | ||
protected readonly currenciesProvider: CurrenciesProvider, | ||
protected readonly atomexProtocolOptions: DeepReadonly<TezosTaquitoAtomexProtocolV1Options> | ||
) { | ||
} | ||
|
||
get currencyId() { | ||
return this.atomexProtocolOptions.currencyId; | ||
} | ||
|
||
initiate(_params: AtomexProtocolV1InitiateParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedInitiateFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
redeem(_params: AtomexProtocolV1RedeemParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getRedeemReward(_nativeTokenPriceInUsd: number, _nativeTokenPriceInCurrency: number): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedRedeemFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
refund(_params: AtomexProtocolV1RefundParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedRefundFees(_params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
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,90 @@ | ||
|
||
import type { FA12TezosTaquitoAtomexProtocolV1Options, FA2TezosTaquitoAtomexProtocolV1Options } from '../../models/index'; | ||
|
||
export const mainnetFA12TezosTaquitoAtomexProtocolV1OptionsBase: Omit< | ||
FA12TezosTaquitoAtomexProtocolV1Options, | ||
'currencyId' | 'swapContractAddress' | 'swapContractBlockId' | ||
> = { | ||
atomexProtocolVersion: 1, | ||
initiateOperation: { | ||
fee: 11000, | ||
gasLimit: 110000, | ||
storageLimit: 350, | ||
}, | ||
redeemOperation: { | ||
fee: 11000, | ||
gasLimit: 15000, | ||
storageLimit: 257 | ||
}, | ||
refundOperation: { | ||
fee: 11000, | ||
gasLimit: 110000, | ||
storageLimit: 257, | ||
} | ||
}; | ||
|
||
export const mainnetFA2TezosTaquitoAtomexProtocolV1OptionsBase: Omit< | ||
FA2TezosTaquitoAtomexProtocolV1Options, | ||
'currencyId' | 'swapContractAddress' | 'swapContractBlockId' | ||
> = { | ||
atomexProtocolVersion: 1, | ||
initiateOperation: { | ||
fee: 350000, | ||
gasLimit: 400000, | ||
storageLimit: 250, | ||
}, | ||
redeemOperation: { | ||
fee: 120000, | ||
gasLimit: 400000, | ||
storageLimit: 257 | ||
}, | ||
refundOperation: { | ||
fee: 120000, | ||
gasLimit: 400000, | ||
storageLimit: 257, | ||
} | ||
}; | ||
|
||
export const testnetFA12TezosTaquitoAtomexProtocolV1OptionsBase: Omit< | ||
FA12TezosTaquitoAtomexProtocolV1Options, | ||
'currencyId' | 'swapContractAddress' | 'swapContractBlockId' | ||
> = { | ||
atomexProtocolVersion: 1, | ||
initiateOperation: { | ||
fee: 2000, | ||
gasLimit: 15000, | ||
storageLimit: 350, | ||
}, | ||
redeemOperation: { | ||
fee: 2500, | ||
gasLimit: 20000, | ||
storageLimit: 257 | ||
}, | ||
refundOperation: { | ||
fee: 2500, | ||
gasLimit: 15000, | ||
storageLimit: 257, | ||
} | ||
}; | ||
|
||
export const testnetFA2TezosTaquitoAtomexProtocolV1OptionsBase: Omit< | ||
FA2TezosTaquitoAtomexProtocolV1Options, | ||
'currencyId' | 'swapContractAddress' | 'swapContractBlockId' | ||
> = { | ||
atomexProtocolVersion: 1, | ||
initiateOperation: { | ||
fee: 350000, | ||
gasLimit: 400000, | ||
storageLimit: 250, | ||
}, | ||
redeemOperation: { | ||
fee: 120000, | ||
gasLimit: 400000, | ||
storageLimit: 257 | ||
}, | ||
refundOperation: { | ||
fee: 120000, | ||
gasLimit: 400000, | ||
storageLimit: 257, | ||
} | ||
}; |
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,2 @@ | ||
export { mainnetTezosTaquitoAtomexProtocolV1Options } from './mainnetV1Options'; | ||
export { testnetTezosTaquitoAtomexProtocolV1Options } from './testnetV1Options'; |
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,61 @@ | ||
import type { FA12TezosTaquitoAtomexProtocolV1Options, FA2TezosTaquitoAtomexProtocolV1Options, TezosTaquitoAtomexProtocolV1Options } from '../../models/index'; | ||
import { mainnetFA12TezosTaquitoAtomexProtocolV1OptionsBase, mainnetFA2TezosTaquitoAtomexProtocolV1OptionsBase } from './base'; | ||
|
||
const mainnetNativeTezosTaquitoAtomexProtocolV1Options: TezosTaquitoAtomexProtocolV1Options = { | ||
atomexProtocolVersion: 1, | ||
currencyId: 'XTZ', | ||
swapContractAddress: 'KT1VG2WtYdSWz5E7chTeAdDPZNy2MpP8pTfL', | ||
swapContractBlockId: '513046', | ||
initiateOperation: { | ||
fee: 2000, | ||
gasLimit: 11000, | ||
storageLimit: 257 | ||
}, | ||
redeemOperation: { | ||
fee: 2000, | ||
gasLimit: 15000, | ||
storageLimit: 257 | ||
}, | ||
refundOperation: { | ||
fee: 1600, | ||
gasLimit: 13000, | ||
storageLimit: 257, | ||
} | ||
}; | ||
|
||
const mainnetTZBTCTezosTaquitoAtomexProtocolV1Options: FA12TezosTaquitoAtomexProtocolV1Options = { | ||
...mainnetFA12TezosTaquitoAtomexProtocolV1OptionsBase, | ||
currencyId: 'TZBTC', | ||
swapContractAddress: 'KT1Ap287P1NzsnToSJdA4aqSNjPomRaHBZSr', | ||
swapContractBlockId: '900350', | ||
redeemOperation: { | ||
...mainnetFA12TezosTaquitoAtomexProtocolV1OptionsBase.redeemOperation, | ||
gasLimit: 180000 | ||
} | ||
}; | ||
|
||
const mainnetKUSDTezosTaquitoAtomexProtocolV1Options: FA12TezosTaquitoAtomexProtocolV1Options = { | ||
...mainnetFA12TezosTaquitoAtomexProtocolV1OptionsBase, | ||
currencyId: 'KUSD', | ||
swapContractAddress: 'KT1EpQVwqLGSH7vMCWKJnq6Uxi851sEDbhWL', | ||
swapContractBlockId: '1358868', | ||
redeemOperation: { | ||
...mainnetFA12TezosTaquitoAtomexProtocolV1OptionsBase.redeemOperation, | ||
gasLimit: 110000 | ||
} | ||
}; | ||
|
||
|
||
const mainnetUSDtTezosTaquitoAtomexProtocolV1Options: FA2TezosTaquitoAtomexProtocolV1Options = { | ||
...mainnetFA2TezosTaquitoAtomexProtocolV1OptionsBase, | ||
currencyId: 'USDT_XTZ', | ||
swapContractAddress: 'KT1Ays1Chwx3ArnHGoQXchUgDsvKe9JboUjj', | ||
swapContractBlockId: '2496680' | ||
}; | ||
|
||
export const mainnetTezosTaquitoAtomexProtocolV1Options = { | ||
XTZ: mainnetNativeTezosTaquitoAtomexProtocolV1Options, | ||
TZBTC: mainnetTZBTCTezosTaquitoAtomexProtocolV1Options, | ||
KUSD: mainnetKUSDTezosTaquitoAtomexProtocolV1Options, | ||
USDT_XTZ: mainnetUSDtTezosTaquitoAtomexProtocolV1Options | ||
} as const; |
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,37 @@ | ||
import type { FA2TezosTaquitoAtomexProtocolV1Options, TezosTaquitoAtomexProtocolV1Options } from '../../models/index'; | ||
import { testnetFA2TezosTaquitoAtomexProtocolV1OptionsBase } from './base'; | ||
|
||
const testnetNativeTezosTaquitoAtomexProtocolV1Options: TezosTaquitoAtomexProtocolV1Options = { | ||
atomexProtocolVersion: 1, | ||
currencyId: 'XTZ', | ||
swapContractAddress: 'KT1VG2WtYdSWz5E7chTeAdDPZNy2MpP8pTfL', | ||
swapContractBlockId: '513046', | ||
initiateOperation: { | ||
fee: 2000, | ||
gasLimit: 11000, | ||
storageLimit: 257 | ||
}, | ||
redeemOperation: { | ||
fee: 2000, | ||
gasLimit: 15000, | ||
storageLimit: 257 | ||
}, | ||
refundOperation: { | ||
fee: 1600, | ||
gasLimit: 13000, | ||
storageLimit: 257, | ||
} | ||
}; | ||
|
||
|
||
const testnetUSDtTezosTaquitoAtomexProtocolV1Options: FA2TezosTaquitoAtomexProtocolV1Options = { | ||
...testnetFA2TezosTaquitoAtomexProtocolV1OptionsBase, | ||
currencyId: 'USDT_XTZ', | ||
swapContractAddress: 'KT1BWvRQnVVowZZLGkct9A7sdj5YEe8CdUhR', | ||
swapContractBlockId: '665321' | ||
}; | ||
|
||
export const testnetTezosTaquitoAtomexProtocolV1Options = { | ||
XTZ: testnetNativeTezosTaquitoAtomexProtocolV1Options, | ||
USDT_XTZ: testnetUSDtTezosTaquitoAtomexProtocolV1Options | ||
} as const; |
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
Oops, something went wrong.