-
Notifications
You must be signed in to change notification settings - Fork 3
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 #112 from OriginProtocol/feat/soeth-redeem
Feat/soeth redeem
- Loading branch information
Showing
25 changed files
with
1,826 additions
and
14 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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@nx/react/babel", | ||
{ | ||
"runtime": "automatic", | ||
"useBuiltIns": "usage" | ||
} | ||
] | ||
], | ||
"plugins": [] | ||
} |
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,18 @@ | ||
{ | ||
"extends": ["plugin:@nx/react", "../../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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 @@ | ||
# oeth-redeem | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
|
||
Run `nx test oeth-redeem` to execute the unit tests via [Jest](https://jestjs.io). |
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,12 @@ | ||
{ | ||
"name": "oeth-redeem", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/oeth/redeem/src", | ||
"projectType": "library", | ||
"tags": [], | ||
"targets": { | ||
"lint": { | ||
"executor": "@nx/eslint:lint" | ||
} | ||
} | ||
} |
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,69 @@ | ||
import { defineMessage } from 'react-intl'; | ||
|
||
import redeemVault from './redeemVault'; | ||
import swapCurve from './swapCurve'; | ||
|
||
import type { SwapApi } from '@origin/shared/providers'; | ||
|
||
import type { RedeemAction } from '../types'; | ||
|
||
const defaultApi: SwapApi = { | ||
isRouteAvailable: async () => true, | ||
estimateAmount: async (config, { amountIn }) => { | ||
console.log('Amount estimation not implemented'); | ||
|
||
return amountIn; | ||
}, | ||
estimateGas: async () => { | ||
console.log('Gas estimation not implemented'); | ||
|
||
return 0n; | ||
}, | ||
estimateRoute: async (config, { amountIn, route }) => { | ||
console.log('Route estimation not implemented'); | ||
|
||
return { | ||
...route, | ||
estimatedAmount: amountIn, | ||
allowanceAmount: 0n, | ||
approvalGas: 0n, | ||
gas: 0n, | ||
rate: 0, | ||
}; | ||
}, | ||
allowance: async () => { | ||
console.log('Allowance not implemented'); | ||
|
||
return 0n; | ||
}, | ||
estimateApprovalGas: async () => { | ||
console.log('Gas approval estimation not implemented'); | ||
|
||
return 0n; | ||
}, | ||
approve: async () => { | ||
console.log('Approve operation not implemented'); | ||
return null; | ||
}, | ||
swap: async () => { | ||
console.log('Route swap operation not implemented'); | ||
return null; | ||
}, | ||
buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), | ||
routeLabel: defineMessage({ defaultMessage: 'Redeem' }), | ||
}; | ||
|
||
export const redeemActions: Record<RedeemAction, SwapApi> = { | ||
'swap-curve': { | ||
...defaultApi, | ||
...swapCurve, | ||
routeLabel: defineMessage({ defaultMessage: 'Swap via Curve' }), | ||
buttonLabel: defineMessage({ defaultMessage: 'Swap' }), | ||
}, | ||
'redeem-vault': { | ||
...defaultApi, | ||
...redeemVault, | ||
routeLabel: defineMessage({ defaultMessage: 'Redeem via OETH Vault' }), | ||
buttonLabel: defineMessage({ defaultMessage: 'Redeem' }), | ||
}, | ||
}; |
Oops, something went wrong.