Skip to content

Commit

Permalink
Merge pull request #112 from OriginProtocol/feat/soeth-redeem
Browse files Browse the repository at this point in the history
Feat/soeth redeem
  • Loading branch information
apexearth committed May 6, 2024
2 parents 9dccfde + 76d6991 commit c5be069
Show file tree
Hide file tree
Showing 25 changed files with 1,826 additions and 14 deletions.
12 changes: 6 additions & 6 deletions apps/oeth/src/components/Topnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export function Topnav(props: BoxProps) {
<>
<Box
sx={{
height: (theme) => ({
xs: '162px',
md: `105px`,
}),
height: {
xs: 162,
md: 105,
},
}}
/>
<Box
Expand All @@ -47,8 +47,8 @@ export function Topnav(props: BoxProps) {
width: 1,
zIndex: theme.zIndex.appBar,
height: {
xs: '162px',
md: `105px`,
xs: 162,
md: 105,
},
})}
>
Expand Down
54 changes: 54 additions & 0 deletions apps/oeth/src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@
"value": "Impossible to execute"
}
],
"2W3kP3": [
{
"type": 0,
"value": "~1min"
}
],
"3Lr8o5": [
{
"type": 0,
"value": "Larger redemptions coming soon"
}
],
"45EvZ3": [
{
"type": 0,
Expand Down Expand Up @@ -169,6 +181,12 @@
"value": "The selected network is not supported by the application."
}
],
"6Sj2lN": [
{
"type": 0,
"value": "Claim"
}
],
"6XFO/C": [
{
"type": 0,
Expand Down Expand Up @@ -279,6 +297,12 @@
"value": "lastPage"
}
],
"AtWUBa": [
{
"type": 0,
"value": "Redeem via OETH Vault"
}
],
"BB94QK": [
{
"type": 0,
Expand Down Expand Up @@ -647,6 +671,12 @@
"value": "Redeem"
}
],
"YnftYz": [
{
"type": 0,
"value": "Wait time:"
}
],
"ZmLuI/": [
{
"type": 0,
Expand Down Expand Up @@ -833,6 +863,12 @@
"value": "30-Day Trailing APY"
}
],
"lQmZjB": [
{
"type": 0,
"value": "Swap via Curve"
}
],
"lb8m6m": [
{
"type": 0,
Expand All @@ -857,6 +893,12 @@
"value": "Approving"
}
],
"n6nILs": [
{
"type": 0,
"value": "Receive amount"
}
],
"nc8QpJ": [
{
"type": 0,
Expand All @@ -869,6 +911,12 @@
"value": "No transactions matching filter"
}
],
"p1P+hQ": [
{
"type": 0,
"value": "Request"
}
],
"p556q3": [
{
"type": 0,
Expand Down Expand Up @@ -1011,6 +1059,12 @@
"value": "Restricted Access"
}
],
"yKbi98": [
{
"type": 0,
"value": "Unstake amount"
}
],
"yWb29t": [
{
"type": 0,
Expand Down
27 changes: 27 additions & 0 deletions apps/oeth/src/lang/extracts/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
"2NfxfO": {
"defaultMessage": "Impossible to execute"
},
"2W3kP3": {
"defaultMessage": "~1min"
},
"3Lr8o5": {
"defaultMessage": "Larger redemptions coming soon"
},
"45EvZ3": {
"defaultMessage": "Minimum received with {slippage} slippage:"
},
Expand Down Expand Up @@ -74,6 +80,9 @@
"6GZbSi": {
"defaultMessage": "The selected network is not supported by the application."
},
"6Sj2lN": {
"defaultMessage": "Claim"
},
"6XFO/C": {
"defaultMessage": "Approved"
},
Expand Down Expand Up @@ -125,6 +134,9 @@
"AdvVFR": {
"defaultMessage": "{page} of {lastPage}"
},
"AtWUBa": {
"defaultMessage": "Redeem via OETH Vault"
},
"BB94QK": {
"defaultMessage": "Bridging activity"
},
Expand Down Expand Up @@ -281,6 +293,9 @@
"XSdWHA": {
"defaultMessage": "Redeem"
},
"YnftYz": {
"defaultMessage": "Wait time:"
},
"ZmLuI/": {
"defaultMessage": "Rate:"
},
Expand Down Expand Up @@ -368,6 +383,9 @@
"kF1zxQ": {
"defaultMessage": "30-Day Trailing APY"
},
"lQmZjB": {
"defaultMessage": "Swap via Curve"
},
"lb8m6m": {
"defaultMessage": "Mins"
},
Expand All @@ -380,12 +398,18 @@
"m/L3sK": {
"defaultMessage": "Approving"
},
"n6nILs": {
"defaultMessage": "Receive amount"
},
"nc8QpJ": {
"defaultMessage": "Recent Activity"
},
"oh7sA8": {
"defaultMessage": "No transactions matching filter"
},
"p1P+hQ": {
"defaultMessage": "Request"
},
"p556q3": {
"defaultMessage": "Copied"
},
Expand Down Expand Up @@ -455,6 +479,9 @@
"xwfunk": {
"defaultMessage": "Restricted Access"
},
"yKbi98": {
"defaultMessage": "Unstake amount"
},
"yWb29t": {
"defaultMessage": "~{from} to {to} minutes"
},
Expand Down
8 changes: 2 additions & 6 deletions apps/oeth/src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { BridgeView } from '@origin/oeth/ccip';
import { historyRoute } from '@origin/oeth/history';
import { redeemRoute } from '@origin/oeth/redeem';
import { SwapView } from '@origin/oeth/swap';
import { NotFoundPage } from '@origin/shared/components';
import { defineMessage } from 'react-intl';

import { App } from './App';
import { RedeemView } from './views/RedeemView';

import type { RouteObject } from 'react-router-dom';

Expand All @@ -19,11 +19,7 @@ export const routes: RouteObject[] = [
Component: SwapView,
handle: { label: defineMessage({ defaultMessage: 'Swap' }) },
},
{
path: '/redeem',
Component: RedeemView,
handle: { label: defineMessage({ defaultMessage: 'Redeem' }) },
},
redeemRoute,
{
path: '/bridge',
Component: BridgeView,
Expand Down
12 changes: 12 additions & 0 deletions libs/oeth/redeem/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions libs/oeth/redeem/.eslintrc.json
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": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/oeth/redeem/README.md
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).
12 changes: 12 additions & 0 deletions libs/oeth/redeem/project.json
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"
}
}
}
69 changes: 69 additions & 0 deletions libs/oeth/redeem/src/actions/index.ts
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' }),
},
};

0 comments on commit c5be069

Please sign in to comment.