Skip to content

add vaults tvl to bluefin pro #15696

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

Merged
Show file tree
Hide file tree
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
19 changes: 18 additions & 1 deletion projects/bluefin-pro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,35 @@ const sui = require("../helper/chain/sui");
const DATA_STORE_ID =
"0x740d972ea066fe3302ee655163373cda2e9529bfa93d2266e1355cf56899da57";

const BLUE_VAULT_ID = "0xe567f041b313134fdd241c57cb10cfc5b54ca36cc91643308c34bbbafefd960a";
Copy link
Collaborator

Choose a reason for hiding this comment

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

how come this vault is moving between products? Same with staking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're transitioning our Vaults products from the old version of the exchange (Bluefin Legacy) to the new version (Bluefin Pro) as we finish sunsetting the legacy exchange.

const BLUE_COIN = "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE";

const USDC_VAULT_ID = "0x10d48e112b92c8af207c1850225284a7ca46bac1d935c4af4cf87ce29b121694";


async function suiTvl(api) {
const object = await sui.getObject(DATA_STORE_ID);
const usdc_vault_object = await sui.getObject(USDC_VAULT_ID);
const vaultAmount = usdc_vault_object.fields.total_locked_amount;
const bankID = object.fields.asset_bank.fields.id.id;
const assetBank = await sui.getDynamicFieldObject(bankID ,"USDC", {idType: "0x1::string::String"});

const tvl = assetBank.fields.value;
api.add(ADDRESSES.sui.USDC, tvl);
api.add(ADDRESSES.sui.USDC, vaultAmount);
return api.getBalances()
}

const staking = async (api) => {
const vaultObject = await sui.getObject(BLUE_VAULT_ID);
const blueCoinAmount = vaultObject.fields.total_locked_amount;
// div by 1e9 as blue coin has 9 precision
api.add(BLUE_COIN, blueCoinAmount);
}

module.exports = {
sui: {
tvl: suiTvl
tvl: suiTvl,
staking
}
}
17 changes: 5 additions & 12 deletions projects/bluefin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,19 @@ const sui = require("../helper/chain/sui");
const SUI_BANK_ID =
"0x39c65abefaee0a18ffa0e059a0074fcc9910216fa1a3550aa32c2e0ec1c03043";

const BLUE_VAULT_ID = "0xe567f041b313134fdd241c57cb10cfc5b54ca36cc91643308c34bbbafefd960a";
const BLUE_COIN = "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE";
const USDC_VAULT_ID = "0x10d48e112b92c8af207c1850225284a7ca46bac1d935c4af4cf87ce29b121694";

const Arbitrum_Config = {
"endpoint": "0x52b5471d04487fb85B39e3Ae47307f115fe8733F",
}

async function suiTvl(api) {
const object = await sui.getObject(SUI_BANK_ID);
const usdc_vault_object = await sui.getObject(USDC_VAULT_ID);
const usdcAmount = object.fields.coinBalance;
const vaultAmount = usdc_vault_object.fields.total_locked_amount;
// div by 1e6 as usdc coin has 6 precision
api.add(ADDRESSES.sui.USDC, usdcAmount);
}

const staking = async (api) => {
const vaultObject = await sui.getObject(BLUE_VAULT_ID);
const blueCoinAmount = vaultObject.fields.total_locked_amount;
// div by 1e9 as blue coin has 9 precision
api.add(BLUE_COIN, blueCoinAmount);
api.add(ADDRESSES.sui.USDC, usdcAmount-vaultAmount);
}

module.exports = {
Expand All @@ -34,8 +28,7 @@ module.exports = {
})
},
sui: {
tvl: suiTvl,
staking
tvl: suiTvl
},
hallmarks: [
['2023-12-22', 'Decomission Arbitrum support'],
Expand Down
Loading