Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Usualx #1689

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/adaptors/usual/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ const apy = async () => {

const ethData = await getChainData(CONFIG.ETHEREUM);
const arbData = await getChainData(CONFIG.ARBITRUM);
const usualxSupply = await getTokenSupply('Ethereum', '0x06B964d96f5dCF7Eae9d7C559B09EDCe244d4B8E');
const usualxPrice = await getTokenPrice('Ethereum', '0x06B964d96f5dCF7Eae9d7C559B09EDCe244d4B8E');
const { data: usualxRewardData } = await axios.get('https://app.usual.money/api/rewards/rates/USUALx');
const usualxReward = usualxRewardData.rewards.find(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should fetch the rate from contract

(e) => CONFIG.USUAL_TOKEN.toLowerCase() === e.rewardToken.toLowerCase()
);
const usualxApyReward = utils.aprToApy(usualxReward.apr, 52) * 100;

return [
createPoolData(
Expand All @@ -81,7 +88,18 @@ const apy = async () => {
arbData.supply * arbData.price,
apyReward,
CONFIG.ARBITRUM.USD0
)
),
{
pool: '0x06B964d96f5dCF7Eae9d7C559B09EDCe244d4B8E',
chain: "Ethereum",
project: 'usual',
symbol: "USUALx",
tvlUsd: usualxSupply * usualxPrice,
apyReward: usualxApyReward,
rewardTokens: [CONFIG.USUAL_TOKEN],
underlyingTokens: ['0xC4441c2BE5d8fA8126822B9929CA0b81Ea0DE38E'],
url: 'https://app.usual.money/swap?action=stake&from=USUAL&to=USUALx'
}
];
};

Expand Down
Loading