Skip to content

Commit

Permalink
Merge pull request #80 from OriginProtocol/feat/OUSD
Browse files Browse the repository at this point in the history
Feat/ousd
  • Loading branch information
toniocodo authored Nov 7, 2023
2 parents f8643a8 + d3fe3ed commit d6c624f
Show file tree
Hide file tree
Showing 56 changed files with 7,435 additions and 1,764 deletions.
17 changes: 6 additions & 11 deletions apps/oeth/src/components/Topnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export function Topnav(props: BoxProps) {
xs: 'none',
md: `1px solid ${theme.palette.background.paper}`,
},
columnGap: { xs: 1, md: 10 },
rowGap: { xs: 0, md: 10 },
columnGap: { xs: 1, md: 6 },
rowGap: 0,
alignItems: 'center',
px: {
xs: 1.5,
Expand All @@ -86,15 +86,10 @@ export function Topnav(props: BoxProps) {
component={Link}
to="/"
sx={(theme) => ({
'& img': {
maxHeight: {
xs: '1rem',
md: '1.5rem',
},
maxWidth: {
xs: theme.typography.pxToRem(100),
sm: theme.typography.pxToRem(120),
md: theme.typography.pxToRem(180),
img: {
height: {
xs: 16,
md: 24,
},
},
})}
Expand Down
4 changes: 2 additions & 2 deletions apps/ousd/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<meta property="og:url" content="https://ousd.com" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Origin Dolar (OUSD)" />
<meta property="og:title" content="Origin Dollar (OUSD)" />
<meta
property="og:description"
content="A fully transparent stablecoin that earns a yield from DeFi"
Expand All @@ -47,7 +47,7 @@
/>
<meta
name="twitter:image"
content="https://cmsmediaproduction.s3.amazonaws.com/thumbnail_oeth_meta_ed53499f08.png"
content="https://cmsmediaproduction.s3.amazonaws.com/meta_9121c5630d.jpeg"
/>
<!-- end meta tags -->
</head>
Expand Down
18 changes: 7 additions & 11 deletions apps/ousd/src/components/Topnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export function Topnav(props: BoxProps) {
xs: 'none',
md: `1px solid ${theme.palette.background.paper}`,
},
columnGap: { xs: 1, md: 10 },
rowGap: { xs: 0, md: 10 },
columnGap: { xs: 1, md: 6 },
rowGap: 0,
alignItems: 'center',
px: {
xs: 1.5,
Expand All @@ -86,15 +86,10 @@ export function Topnav(props: BoxProps) {
component={Link}
to="/"
sx={(theme) => ({
'& img': {
maxHeight: {
xs: '1rem',
md: '1.5rem',
},
maxWidth: {
xs: theme.typography.pxToRem(100),
sm: theme.typography.pxToRem(120),
md: theme.typography.pxToRem(180),
img: {
height: {
xs: 16,
md: 24,
},
},
})}
Expand Down Expand Up @@ -211,6 +206,7 @@ export function Topnav(props: BoxProps) {
setAnchor={setAccountModalAnchor}
balanceTokens={[
tokens.mainnet.OUSD,
tokens.mainnet.wOUSD,
tokens.mainnet.USDT,
tokens.mainnet.DAI,
tokens.mainnet.USDC,
Expand Down
6 changes: 3 additions & 3 deletions apps/ousd/src/views/RedeemView.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Stack } from '@mui/material';
import { trackEvent, trackSentryError } from '@origin/ousd/shared';
import { ApyHeader, trackEvent, trackSentryError } from '@origin/ousd/shared';
import { ErrorBoundary, ErrorCard } from '@origin/shared/components';
import { contracts, tokens } from '@origin/shared/contracts';
import { Redeemer } from '@origin/shared/providers';

export const RedeemView = () => {
return (
<Stack spacing={3}>
{/* <ErrorBoundary ErrorComponent={<ErrorCard />} onError={trackSentryError}>
<ErrorBoundary ErrorComponent={<ErrorCard />} onError={trackSentryError}>
<ApyHeader />
</ErrorBoundary> */}
</ErrorBoundary>
<ErrorBoundary ErrorComponent={<ErrorCard />} onError={trackSentryError}>
<Redeemer
tokenIn={tokens.mainnet.OUSD}
Expand Down
3 changes: 2 additions & 1 deletion apps/ousd/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
},
"files": [
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nx/react/typings/image.d.ts"
"../../node_modules/@nx/react/typings/image.d.ts",
"../../libs/shared/theme/src/theme.d.ts"
],
"exclude": [
"src/**/*.spec.ts",
Expand Down
14 changes: 7 additions & 7 deletions libs/oeth/history/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contracts } from '@origin/shared/contracts';
import { contracts, tokens } from '@origin/shared/contracts';
import { useQuery } from '@tanstack/react-query';
import { readContracts } from '@wagmi/core';
import { formatEther } from 'viem';
Expand Down Expand Up @@ -40,8 +40,8 @@ export const usePendingYield = (
functionName: 'totalValue',
},
{
address: contracts.mainnet.OETH.address,
abi: contracts.mainnet.OETH.abi,
address: tokens.mainnet.OETH.address,
abi: tokens.mainnet.OETH.abi,
functionName: 'totalSupply',
},
{
Expand All @@ -50,13 +50,13 @@ export const usePendingYield = (
functionName: 'availableFunds',
},
{
address: contracts.mainnet.OETH.address,
abi: contracts.mainnet.OETH.abi,
address: tokens.mainnet.OETH.address,
abi: tokens.mainnet.OETH.abi,
functionName: 'nonRebasingSupply',
},
{
address: contracts.mainnet.OETH.address,
abi: contracts.mainnet.OETH.abi,
address: tokens.mainnet.OETH.address,
abi: tokens.mainnet.OETH.abi,
functionName: 'balanceOf',
args: [address],
},
Expand Down
3 changes: 3 additions & 0 deletions libs/oeth/shared/src/clients/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const providers = [
export const { chains, publicClient, webSocketPublicClient } = configureChains(
[mainnet],
providers as any,
{
stallTimeout: import.meta.env.DEV ? 60000 : 3000,
},
);

const connectors = connectorsForWallets([
Expand Down
7 changes: 6 additions & 1 deletion libs/oeth/shared/src/components/ApyHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ export const ApyHeader = (props: StackProps) => {
height: 20,
}}
>
<Box component="img" alt="dropdown" src="/images/dropdown.svg" />
<Box
component="img"
alt="dropdown"
src="/images/dropdown.svg"
sx={{ width: 20, height: 20 }}
/>
</Box>
</Button>
<Menu
Expand Down
18 changes: 9 additions & 9 deletions libs/oeth/swap/src/actions/unwrapWOETH.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contracts, whales } from '@origin/shared/contracts';
import { tokens, whales } from '@origin/shared/contracts';
import { isNilOrEmpty } from '@origin/shared/utils';
import {
getAccount,
Expand All @@ -25,8 +25,8 @@ const estimateAmount: EstimateAmount = async ({ amountIn }) => {
}

const data = await readContract({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'convertToAssets',
args: [amountIn],
});
Expand All @@ -48,8 +48,8 @@ const estimateGas: EstimateGas = async ({ amountIn }) => {
if (!isNilOrEmpty(address)) {
try {
gasEstimate = await publicClient.estimateContractGas({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'redeem',
args: [amountIn, address, address],
account: address,
Expand All @@ -61,8 +61,8 @@ const estimateGas: EstimateGas = async ({ amountIn }) => {

try {
gasEstimate = await publicClient.estimateContractGas({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'redeem',
args: [amountIn, whales.mainnet.wOETH, whales.mainnet.wOETH],
account: whales.mainnet.wOETH,
Expand Down Expand Up @@ -135,8 +135,8 @@ const swap: Swap = async ({ amountIn }) => {
}

const { request } = await prepareWriteContract({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'redeem',
args: [amountIn, address, address],
});
Expand Down
24 changes: 12 additions & 12 deletions libs/oeth/swap/src/actions/wrapOETH.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contracts, whales } from '@origin/shared/contracts';
import { tokens, whales } from '@origin/shared/contracts';
import { isNilOrEmpty } from '@origin/shared/utils';
import {
erc20ABI,
Expand Down Expand Up @@ -26,8 +26,8 @@ const estimateAmount: EstimateAmount = async ({ amountIn }) => {
}

const data = await readContract({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'convertToShares',
args: [amountIn],
});
Expand All @@ -49,8 +49,8 @@ const estimateGas: EstimateGas = async ({ amountIn }) => {
if (!isNilOrEmpty(address)) {
try {
gasEstimate = await publicClient.estimateContractGas({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'deposit',
args: [amountIn, address],
account: address,
Expand All @@ -62,8 +62,8 @@ const estimateGas: EstimateGas = async ({ amountIn }) => {

try {
gasEstimate = await publicClient.estimateContractGas({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'deposit',
args: [amountIn, whales.mainnet.OETH],
account: whales.mainnet.OETH,
Expand All @@ -86,7 +86,7 @@ const allowance: Allowance = async ({ tokenIn }) => {
address: tokenIn.address,
abi: erc20ABI,
functionName: 'allowance',
args: [address, contracts.mainnet.wOETH.address],
args: [address, tokens.mainnet.wOETH.address],
});

return allowance;
Expand All @@ -110,7 +110,7 @@ const estimateApprovalGas: EstimateApprovalGas = async ({
address: tokenIn.address,
abi: erc20ABI,
functionName: 'approve',
args: [contracts.mainnet.wOETH.address, amountIn],
args: [tokens.mainnet.wOETH.address, amountIn],
account: address,
});
} catch {
Expand Down Expand Up @@ -163,7 +163,7 @@ const approve: Approve = async ({ tokenIn, tokenOut, amountIn, curve }) => {
address: tokenIn.address,
abi: erc20ABI,
functionName: 'approve',
args: [contracts.mainnet.wOETH.address, amountIn],
args: [tokens.mainnet.wOETH.address, amountIn],
});
const { hash } = await writeContract(request);

Expand All @@ -184,8 +184,8 @@ const swap: Swap = async ({ tokenIn, tokenOut, amountIn }) => {
}

const { request } = await prepareWriteContract({
address: contracts.mainnet.wOETH.address,
abi: contracts.mainnet.wOETH.abi,
address: tokens.mainnet.wOETH.address,
abi: tokens.mainnet.wOETH.abi,
functionName: 'deposit',
args: [amountIn, address],
});
Expand Down
3 changes: 3 additions & 0 deletions libs/ousd/shared/src/clients/wagmi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const providers = [
export const { chains, publicClient, webSocketPublicClient } = configureChains(
[mainnet],
providers as any,
{
stallTimeout: import.meta.env.DEV ? 60000 : 3000,
},
);

const connectors = connectorsForWallets([
Expand Down
Loading

0 comments on commit d6c624f

Please sign in to comment.