Skip to content

Commit

Permalink
Raffle page fixes, add ETH XL, etc. (#186)
Browse files Browse the repository at this point in the history
* raffle page text fixes

* enable mobile actions

* raffle::select winners:: add debug logs

* raffle: add rt post link

* add raffle know more link

* Add dnmm reverse (#101)

* temp remove tnc signing validation

* add fetchWithRetry for external endpoints

* fix haiko api bug

* disable sithswap, 10kswap and starkdefi

* build fix

* re-add fee

* add dnmm2

* Add mainnet ETH Sensei XL contracts

* fix haiko api bug

* fix haiko api url

* Update og_nft_eligible_users.json

* update og nft list [full]

* Launch ETH XL (#102)

* Add dnmm reverse (#101)

* temp remove tnc signing validation

* add fetchWithRetry for external endpoints

* fix haiko api bug

* disable sithswap, 10kswap and starkdefi

* build fix

* re-add fee

* add dnmm2

* Add mainnet ETH Sensei XL contracts

* fix haiko api bug

* remove ETH XL

* build fix

* update eth xl address

* update audit info on XL pool
  • Loading branch information
akiraonstarknet authored Nov 14, 2024
1 parent 00028fa commit 9fd1614
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 42 deletions.
24 changes: 15 additions & 9 deletions public/og_nft_eligible_users.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"0x1ca34f742a91a588a3e770c8c8c8618a0713d7f64fda7935d42dcfcf4adffa0",
"0x571d4b6f5a34d7a43517d2eca4166804f753a643ec28bec0f51143bef50a9a6",
"0x6a98eef8b1ce965ec9f6daf4c896f5c21217f2365652c30d462b13a1858ed7c",
"0x5d3a8f378500497479d3a16cfcd54657246dc37da8270b52e49319fac139939",
"0x5105649f42252f79109356e1c8765b7dcdb9bf4a6a68534e7fc962421c7efd2",
"0x36177b6741a43c219602ce857c18e445920d5a6ea5f4ee3a0240e8ae319bbf5",
"0x47ccae4b7dccabd0689624812f7deeb3ed283dc3349b826974ff88107d71f4c",
Expand Down Expand Up @@ -80,17 +81,22 @@
"0x4a2e0d92a5fbe6cce8c946e73f3e9d598268da80009a8382d6c9528d60b7422",
"0x5e2ceca0361cc280ae6c67fcbc2bc8f1d052d81590ef730232f13d6ebf5fbd2",
"0x3d0925e3d88cec40c818b5388fca09094bca0f3b2ee71c5d8459c79f6ead07",
"0x1e68b3ea811eabafc98c143c94b7694950d70d7802658c1b849664e9b6cefc2",
"0x4e8c601e8f9542f2a66481ec03252d5ad75adaacf53a87075af3f7e51ccbf69",
"0x2768d87d73919754122d5a66923d3da58a98e9e06ef2ccf27c4d0ff3b4ec2a8",
"0x64fb7f85fd9dee10c313696b0aef1f4afc888ce8422edbc2f1695ec5ed152e9",
"0x17e5659a654067abdebb4123f4f729180de3b19e4a04b05bcceb862377fdf15",
"0x3bb0ee1ace26d86a9045872166f145dcb9ab4d37da9bdf76f6fe11ab129f0c8",
"0x6d1b40ae61ee3c2e794b9a5ff209d91c48e11618151260151b83813f3895faf",
"0x745fc3081d4e195e41c6c44fcb6a56d28d9d2fa683101cb2bc820bbeb7f91fd",
"0x58e058cc515404046b9a125531b92dfb9542b02829447381483520df7e7e39e",
"0x1f88cf149991c7768351fdf9c2bd80a56814a2b9a15e73e93c25d811b234f99",
"0x7c66aa1538776dde4329a24a92fb8ff668a43e64cb129bfda432902ea7450b1",
"0x7ec7d67d0e663c9ec4a45659b3db47f9ac594b40b9c91d24704dfe536277304",
"0x3a975ec9da67efdd15d2033a52108c328ce312cbb3ee8034420b24238715caa",
"0x53b36f0c83047272633c00db0f5db890dd4bec745446dc17dabbc6828e403a2",
"0xb1ddd66dfd43f359706730088685770a2dc23ba097d56837d06efe6004247e",
"0x33d81412229469eb75ad178fd5cfdf37a439a5757f0a48878912aa7204d644c",
"0x3072de7549420ea000fdea27f8d2882d6179fa6c1967d0fda54e76eeaed7fd2",
"0x46f969a97eb52b8757522cb78996fd9b1c7fab996e63e8c4d481da7e6fac332",
"0x5aed32c092b4d597e524160d749c4ac4bfe38960693b79f3c407e9fdf6ec7f4",
"0x9f60931cd5bb85b19ed67011a4d0bbed126976ec708b201f30fa94562f5633",
"0x73698c80cd58d145a9900eb43240a0f85e3a4f24025b4b56c3480075d133f6b",
"0x551533735edca74e90d4b055a4987c89fde8f65a497c02d621e306b0ab7567d",
"0x109b84c85aa005a6f5ee1789f746693e72732e0fa4d3c9a3cac2eccff2299de",
"0x12ef68c3dd74994ea548cbe29def0335602dc40a752f66beaf18d769e2ff8d0"
"0x7e5dab3252f7b6340c268fc9f9687252cc85aaffdb932308a08909229f14dba",
"0x169b8a26ae1343047d853e22908e3da86ee5210daf2292a33aecfc269f7c05c",
"0x4fa35d249be21384b7c67912d29ec95dd289230ed7dcfdcb08b215bc5b77bfd"
]
2 changes: 2 additions & 0 deletions src/app/api/raffle/luckyWinner/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export const dynamic = 'force-dynamic'; // static by default, unless reading the

export async function GET(request: Request) {
const authHeader = request.headers.get('authorization');
console.log('Authorization header:', authHeader);
if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
console.error('Unauthorized request');
return new Response('Unauthorized', {
status: 401,
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/raffle/_components/share-on-x.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const ShareOnX = () => {
</div>

<Link
href="https://hemant.lol"
href="https://x.com/strkfarm/status/1853367850922365025"
target="_blank"
className="border border-[#36E780] text-white group-hover:border-black group-hover:text-black px-4 py-1 text-sm font-bold rounded-[20px] transition-all active:scale-90 ml-16 lg:ml-0 -mt-3"
onClick={!isSharedOnX && !initialLoading ? handleShare : () => {}}
Expand Down
17 changes: 12 additions & 5 deletions src/app/raffle/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NextPage } from 'next';
import Image from 'next/image';
import React from 'react';
import { Button } from '@chakra-ui/react';

import ActiveDeposits from './_components/active-deposits';
import RaffleTimer from './_components/raffle-timer';
Expand All @@ -21,9 +22,14 @@ const Raffle: NextPage = () => {
during Starkspace (Devcon, Bangkok)
</p>

<button className="border-white border px-4 py-2.5 rounded-md text-white text-sm font-bold transition-all active:scale-90 mt-3">
<Button
as="a"
href="https://docs.strkfarm.xyz/p/community/raffle"
target="_blank"
className="border-white border px-4 py-2.5 rounded-md text-white text-sm font-bold transition-all active:scale-90 mt-3"
>
Know More
</button>
</Button>
</div>

<Image
Expand Down Expand Up @@ -87,17 +93,18 @@ const Raffle: NextPage = () => {
</p>
<p className="ml-2 text-white text-sm lg:text-base">
3. You have to register if you want to participate. This mean you or
anyone on your behalf will be available t to collect the merch.{' '}
anyone on your behalf will be available to collect the merch.{' '}
</p>
<p className="ml-2 text-white text-sm lg:text-base">
4. The rewards will be in the form of exclusive merch reserved for you
</p>
<p className="ml-2 text-white text-sm lg:text-base">
5. Selected winners can collect their merch on 13th Nov, from The Fig
lobby, Bangkok
Lobby, Bangkok
</p>
<p className="ml-2 text-white text-sm lg:text-base">
6. Winners will be announced on our socials everyday
6. Winners will be announced on our socials (i.e. X, TG, etc.)
everyday
</p>
</div>
</div>
Expand Down
8 changes: 1 addition & 7 deletions src/app/strategy/[strategyId]/_components/Strategy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ import {
import { StrategyParams } from '../page';
import MyNumber from '@/utils/MyNumber';
import { ExternalLinkIcon } from '@chakra-ui/icons';
import { isMobile } from 'react-device-detect';
import CONSTANTS from '@/constants';

const Strategy = ({ params }: StrategyParams) => {
const { address } = useAccount();
Expand Down Expand Up @@ -247,9 +245,7 @@ const Strategy = ({ params }: StrategyParams) => {
) == 0
? '-'
: `${balData.data.amount.toEtherToFixedDecimals(balData.data.tokenInfo?.displayDecimals || 2)} ${balData.data.tokenInfo?.name}`
: isMobile
? CONSTANTS.MOBILE_MSG
: 'Connect wallet'}
: 'Connect wallet'}
</Text>
</Box>
<Tooltip label="Life time earnings">
Expand All @@ -276,8 +272,6 @@ const Strategy = ({ params }: StrategyParams) => {
<b>Your Holdings: </b>
{address ? (
<Spinner size="sm" marginTop={'5px'} />
) : isMobile ? (
CONSTANTS.MOBILE_MSG
) : (
'Connect wallet'
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function Navbar(props: NavbarProps) {
top="0"
>
<TncModal />
<Center bg="bg" color="gray" padding={0}>
{/* <Center bg="bg" color="gray" padding={0}>
<Text
fontSize="12px"
textAlign={'center'}
Expand All @@ -233,7 +233,7 @@ export default function Navbar(props: NavbarProps) {
</Link>
</b>
</Text>
</Center>
</Center> */}
<Box
width={'100%'}
maxWidth="1400px"
Expand Down
2 changes: 0 additions & 2 deletions src/components/TxButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CONSTANTS from '@/constants';
import { referralCodeAtom } from '@/store/referral.store';
import { StrategyTxProps, monitorNewTxAtom } from '@/store/transactions.atom';
import { IStrategyProps, TokenInfo } from '@/strategies/IStrategy';
Expand Down Expand Up @@ -101,7 +100,6 @@ export default function TxButton(props: TxButtonProps) {
if (!address) return props.text;
return '';
}
if (isMobile) return CONSTANTS.MOBILE_MSG;
if (!address) return 'Wallet not connected';
return '';
}, [isMobile, address, props]);
Expand Down
23 changes: 22 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const CONSTANTS = {
BASE_API: '/ekubo',
},
HAIKO: {
BASE_APR_API: 'haiko/markets?network=mainnet',
BASE_APR_API: '/haiko/markets?network=mainnet',
},
STRKFarm: {
BASE_APR_API: '/api/strategies',
Expand All @@ -62,6 +62,8 @@ const CONSTANTS = {
'0x20d5fc4c9df4f943ebb36078e703369c04176ed00accf290e8295b659d2cea6',
DeltaNeutralMMETHUSDC:
'0x9d23d9b1fa0db8c9d75a1df924c3820e594fc4ab1475695889286f3f6df250',
DeltaNeutralMMETHUSDCXL:
'0x9140757f8fb5748379be582be39d6daf704cc3a0408882c0d57981a885eed9',
},
MOBILE_MSG: 'Desktop/Tablet only',
};
Expand Down Expand Up @@ -100,6 +102,17 @@ export const TOKENS: TokenInfo[] = [
stepAmount: MyNumber.fromEther('10', 18),
isERC4626: false,
},
{
token: '0x057146f6409deb4c9fa12866915dd952aa07c1eb2752e451d7f3b042086bdeb8',
name: 'iETH-c', // nostra eth collateral
decimals: 18,
displayDecimals: 2,
logo: CONSTANTS.LOGOS.ETH,
minAmount: MyNumber.fromEther('10', 18),
maxAmount: MyNumber.fromEther('10000', 18),
stepAmount: MyNumber.fromEther('10', 18),
isERC4626: false,
},
{
token: '0x1b5bd713e72fdc5d63ffd83762f81297f6175a5e0a4771cdadbc1dd5fe72cb1',
name: 'zETH',
Expand Down Expand Up @@ -193,6 +206,14 @@ export const NFTS: NFTInfo[] = [
mainTokenName: 'ETH',
},
},
{
name: 'frmDNMMETHUSDC2',
address: CONSTANTS.CONTRACTS.DeltaNeutralMMETHUSDCXL,
logo: CONSTANTS.LOGOS.ETH,
config: {
mainTokenName: 'ETH',
},
},
];

// ? When updating this, ensure there is redirect available for this route
Expand Down
2 changes: 1 addition & 1 deletion src/store/protocols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export function getPoolInfoFromStrategy(
additional: {
riskFactor: strat.riskFactor,
tags: [getLiveStatusEnum(strat.status.number)],
isAudited: true,
isAudited: strat.name.includes('XL') ? false : true,
leverage: strat.leverage,
},
};
Expand Down
17 changes: 16 additions & 1 deletion src/store/strategies.atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { DeltaNeutralMM } from '@/strategies/delta_neutral_mm';
import Mustache from 'mustache';
import { getTokenInfoFromName } from '@/utils';
import { allPoolsAtomUnSorted } from './protocols';
import { DeltaNeutralMM2 } from '@/strategies/delta_neutral_mm_2';

export interface StrategyInfo extends IStrategyProps {
name: string;
Expand Down Expand Up @@ -68,7 +69,7 @@ export function getStrategies() {
'USDC',
CONSTANTS.CONTRACTS.DeltaNeutralMMETHUSDC,
[1, 0.609886, 1, 0.920975, 0.510078], // precomputed factors based on strategy math
StrategyLiveStatus.NEW,
StrategyLiveStatus.ACTIVE,
{
maxTVL: 1000,
},
Expand All @@ -87,12 +88,26 @@ export function getStrategies() {
},
);

const deltaNeutralMMETHUSDCReverse = new DeltaNeutralMM2(
getTokenInfoFromName('ETH'),
'ETH Sensei XL',
Mustache.render(DNMMDescription, { token1: 'ETH', token2: 'USDC' }),
'USDC',
CONSTANTS.CONTRACTS.DeltaNeutralMMETHUSDCXL,
[1, 0.5846153846, 1, 0.920975, 0.552509], // precomputed factors based on strategy math
StrategyLiveStatus.NEW,
{
maxTVL: 2000,
},
);

const strategies: IStrategy[] = [
autoStrkStrategy,
autoUSDCStrategy,
deltaNeutralMMUSDCETH,
deltaNeutralMMETHUSDC,
deltaNeutralMMSTRKETH,
deltaNeutralMMETHUSDCReverse,
];

return strategies;
Expand Down
8 changes: 6 additions & 2 deletions src/strategies/IStrategy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IDapp } from '@/store/IDapp.store';
import { BalanceResult, getBalanceAtom } from '@/store/balance.atoms';
import { LendingSpace } from '@/store/lending.base';
import { Category, PoolInfo } from '@/store/pools';
import { zkLend } from '@/store/zklend.store';
import MyNumber from '@/utils/MyNumber';
Expand Down Expand Up @@ -254,14 +255,17 @@ export class IStrategy extends IStrategyProps {
return eligiblePools;
}

filterZkLend(tokenName: string) {
filterTokenByProtocol(
tokenName: string,
protocol: IDapp<LendingSpace.MyBaseAprDoc[]> = zkLend,
) {
return (
pools: PoolInfo[],
amount: string,
prevActions: StrategyAction[],
) => {
return pools.filter(
(p) => p.pool.name == tokenName && p.protocol.name == zkLend.name,
(p) => p.pool.name == tokenName && p.protocol.name == protocol.name,
);
};
}
Expand Down
5 changes: 3 additions & 2 deletions src/strategies/auto_strk.strat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getERC20BalanceAtom,
} from '@/store/balance.atoms';
import { getPrice, getTokenInfoFromName } from '@/utils';
import { zkLend } from '@/store/zklend.store';

interface Step {
name: string;
Expand Down Expand Up @@ -73,12 +74,12 @@ export class AutoTokenStrategy extends IStrategy {
{
name: `Supplies your ${token} to zkLend`,
optimizer: this.optimizer,
filter: [this.filterZkLend(this.token.name)],
filter: [this.filterTokenByProtocol(this.token.name, zkLend)],
},
{
name: `Re-invest your STRK Rewards every 7 days`,
optimizer: this.compounder,
filter: [this.filterZkLend('STRK')],
filter: [this.filterTokenByProtocol('STRK', zkLend)],
},
];
const _risks = [...this.risks];
Expand Down
Loading

0 comments on commit 9fd1614

Please sign in to comment.