Skip to content

Commit

Permalink
Add a couple more gnosis
Browse files Browse the repository at this point in the history
  • Loading branch information
MirthFutures committed Oct 25, 2023
1 parent 11ff398 commit 3cb457a
Show file tree
Hide file tree
Showing 7 changed files with 316 additions and 2 deletions.
24 changes: 24 additions & 0 deletions packages/address-book/address-book/gnosis/tokens/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,30 @@ const _tokens = {
documentation: 'https://www.circle.com/en/usdc-multichain/arbitrum',
bridge: 'gnosis-canonical',
},
EURe: {
name: 'Monerium EURe emoney',
symbol: 'EURe',
address: '0x18ec0A6E18E5bc3784fDd3a3634b31245ab704F6',
chainId: 100,
decimals: 18,
logoURI: 'https://assets.coingecko.com/coins/images/23354/small/eur.png?1643926562',
website: 'https://monerium.com/',
bridge: 'gnosis-canonical',
description:
'EURe is a Euro stable-coin from Monerium. Monerium is the first company authorized to issue money on blockchains under European financial regulation. They have issued EUR, USD, GBP, and ISK as e-money tokens on Ethereum and EUR on Algorand. Monerium also operates a gateway for instant transfers of EUR between bank accounts and blockchain wallets/smart contracts.',
},
GNO: {
chainId: 100,
address: '0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb',
decimals: 18,
name: 'Gnosis Token',
symbol: 'GNO',
website: 'https://www.gnosis.io/',
documentation: 'https://www.gnosis.io/developers',
bridge: 'gnosis-canonical',
logoURI:
'https://raw.githubusercontent.com/ava-labs/bridge-tokens/main/avalanche-tokens/0xBAA66822055AD37EC05638eC5AAfDC6Ef0e96445/logo.png',
},
} as const;

export const tokens: ConstRecord<typeof _tokens, Token> = _tokens;
180 changes: 180 additions & 0 deletions src/abis/IPot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
const IPot = [
{
inputs: [{ internalType: 'address', name: 'vat_', type: 'address' }],
payable: false,
stateMutability: 'nonpayable',
type: 'constructor',
},
{
anonymous: true,
inputs: [
{ indexed: true, internalType: 'bytes4', name: 'sig', type: 'bytes4' },
{ indexed: true, internalType: 'address', name: 'usr', type: 'address' },
{ indexed: true, internalType: 'bytes32', name: 'arg1', type: 'bytes32' },
{ indexed: true, internalType: 'bytes32', name: 'arg2', type: 'bytes32' },
{ indexed: false, internalType: 'bytes', name: 'data', type: 'bytes' },
],
name: 'LogNote',
type: 'event',
},
{
constant: true,
inputs: [],
name: 'Pie',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: false,
inputs: [],
name: 'cage',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: true,
inputs: [],
name: 'chi',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: false,
inputs: [{ internalType: 'address', name: 'guy', type: 'address' }],
name: 'deny',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: false,
inputs: [],
name: 'drip',
outputs: [{ internalType: 'uint256', name: 'tmp', type: 'uint256' }],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: true,
inputs: [],
name: 'dsr',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: false,
inputs: [{ internalType: 'uint256', name: 'wad', type: 'uint256' }],
name: 'exit',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: false,
inputs: [
{ internalType: 'bytes32', name: 'what', type: 'bytes32' },
{ internalType: 'uint256', name: 'data', type: 'uint256' },
],
name: 'file',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: false,
inputs: [
{ internalType: 'bytes32', name: 'what', type: 'bytes32' },
{ internalType: 'address', name: 'addr', type: 'address' },
],
name: 'file',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: false,
inputs: [{ internalType: 'uint256', name: 'wad', type: 'uint256' }],
name: 'join',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: true,
inputs: [],
name: 'live',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: true,
inputs: [{ internalType: 'address', name: '', type: 'address' }],
name: 'pie',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: false,
inputs: [{ internalType: 'address', name: 'guy', type: 'address' }],
name: 'rely',
outputs: [],
payable: false,
stateMutability: 'nonpayable',
type: 'function',
},
{
constant: true,
inputs: [],
name: 'rho',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: true,
inputs: [],
name: 'vat',
outputs: [{ internalType: 'contract VatLike', name: '', type: 'address' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: true,
inputs: [],
name: 'vow',
outputs: [{ internalType: 'address', name: '', type: 'address' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
{
constant: true,
inputs: [{ internalType: 'address', name: '', type: 'address' }],
name: 'wards',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
payable: false,
stateMutability: 'view',
type: 'function',
},
] as const;
export default IPot;
8 changes: 7 additions & 1 deletion src/api/stats/common/balancer/getAuraApys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import IAuraMinter from '../../../../abis/IAuraMinter';
import { default as IAuraGauge } from '../../../../abis/ethereum/AuraGauge';
import IBalancerVault from '../../../../abis/IBalancerVault';
import { fetchContract } from '../../../rpc/client';
import { fetchDaiSavingsRate } from '../../../../utils/fetchDaiSavingsRate';

interface Token {
newGauge?: boolean;
Expand Down Expand Up @@ -174,12 +175,17 @@ const getPoolApy = async (
let lsApr: number = 0;
try {
const lsResponses: JSON[] = await Promise.all(
lsUrls.map(url => fetch(url).then(res => res.json()))
lsUrls.map(url =>
url === 'DSR'
? fetchDaiSavingsRate().then(res => res)
: fetch(url).then(res => res.json())
)
);
const lsAprs: number[] = lsResponses
.map((res, i) => jp.query(res, dataPaths[i]))
.map((apr, i) => apr * lsAprFactors[i]);
lsApr = lsAprs.reduce((acum, cur) => acum + cur, 0);
//console.log(pool.name, lsResponses, lsAprs, lsApr)
lsAprs.forEach((apr, i) => {
aprFixed +=
(apr * qty[lsIndexes[i]].dividedBy(totalQty).toNumber()) /
Expand Down
2 changes: 1 addition & 1 deletion src/api/stats/ethereum/getUniswapGammaApys.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const getGammaApys = () => {
pools,
quickGamma: 'https://wire2.gamma.xyz/hypervisors/allData',
chainId: chainId,
log: true,
//log: true,
});
};

Expand Down
66 changes: 66 additions & 0 deletions src/data/gnosis/auraPools.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,70 @@
[
{
"name": "aura-gnosis-wsteth-gno",
"address": "0x4683e340a8049261057D5aB1b29C8d840E75695e",
"vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
"gauge": "0x14A81C9283CC16897DaA3f466847Baa260b770eB",
"vaultPoolId": "0x4683e340a8049261057d5ab1b29c8d840e75695e00020000000000000000005a",
"decimals": "1e18",
"lsUrl": "https://eth-api.lido.fi/v1/protocol/steth/apr/sma",
"dataPath": "$.data.smaApr",
"lsIndex": 0,
"balancerChargesFee": true,
"rewards": [
{
"rewardGauge": "0xF27a401d66fbc85a113c384Da7848D31AC1B6a9c",
"oracleId": "AURA",
"decimals": "1e18"
}
],
"tokens": [
{
"oracle": "tokens",
"oracleId": "wstETH",
"decimals": "1e18"
},
{
"oracle": "tokens",
"oracleId": "GNO",
"decimals": "1e18"
}
]
},
{
"name": "aura-gnosis-sdai-eure",
"address": "0xDd439304A77f54B1F7854751Ac1169b279591Ef7",
"vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
"gauge": "0xDE151980d461696543aa07A19BbE2603B20ECbAE",
"vaultPoolId": "0xdd439304a77f54b1f7854751ac1169b279591ef7000000000000000000000064",
"decimals": "1e18",
"lsUrl": "DSR",
"dataPath": "$.savingsRate",
"lsIndex": 0,
"composable": true,
"bptIndex": 2,
"rewards": [
{
"rewardGauge": "0x3b7f151E0654e309A5327C5AEe98D62914F1bCA6",
"oracleId": "USDC",
"decimals": "1e6"
}
],
"tokens": [
{
"oracle": "tokens",
"oracleId": "sDAI",
"decimals": "1e18"
},
{
"oracle": "tokens",
"oracleId": "EURe",
"decimals": "1e18"
},
{
"oracleId": "BPTToken"
}
]
},
{
"name": "aura-gnosis-wsteth-bal-aura",
"address": "0x00dF7f58e1Cf932eBe5f54De5970Fb2Bdf0ef06D",
Expand Down
8 changes: 8 additions & 0 deletions src/utils/fetchConcentratedLiquidityTokenPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ const tokens: Partial<Record<keyof typeof ChainId, ConcentratedLiquidityToken[]>
firstToken: 'RPL',
secondToken: 'WETH',
},
{
type: 'UniV3',
oracleId: 'GNO',
decimalDelta: 1,
pool: '0xf56D08221B5942C428Acc5De8f78489A97fC5599',
firstToken: 'WETH',
secondToken: 'GNO',
},
],
polygon: [
{
Expand Down
30 changes: 30 additions & 0 deletions src/utils/fetchDaiSavingsRate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import BigNumber from 'bignumber.js';
import { ETH_CHAIN_ID } from '../constants';
import IPot from '../abis/IPot';
import { fetchNoMulticallContract } from '../api/rpc/client';

const pot = '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7';

const fetchDaiSavingsRate = async () => {
let rate = new BigNumber(0);
try {
const potContract = fetchNoMulticallContract(pot, IPot, ETH_CHAIN_ID);

rate = await potContract.read.dsr();
rate = new BigNumber(rate)
.dividedBy(1e27)
.minus(1)
.times(365)
.times(86400)
.times(100)
.toNumber();

// console.log(`DaiSavingsRate: ${rate}`);
} catch (e) {
console.error(`Error Fetching DaiSavingsRate price`);
}

return { savingsRate: rate };
};

export { fetchDaiSavingsRate };

0 comments on commit 3cb457a

Please sign in to comment.