Skip to content

Commit 6228822

Browse files
authored
Add CJPY (#301)
* Add CJPY * add CJPY * add CJPY
1 parent 28089a4 commit 6228822

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const sdk = require("@defillama/sdk");
2+
import { sumSingleBalance } from "../helper/generalUtil";
3+
import {
4+
ChainBlocks,
5+
PeggedIssuanceAdapter,
6+
Balances,
7+
} from "../peggedAsset.type";
8+
9+
type ChainContracts = {
10+
[chain: string]: {
11+
[contract: string]: string[];
12+
};
13+
};
14+
15+
const chainContracts: ChainContracts = {
16+
ethereum: {
17+
issued: ["0x1cfa5641c01406ab8ac350ded7d735ec41298372"],
18+
},
19+
};
20+
21+
async function chainMinted(chain: string, decimals: number) {
22+
return async function (
23+
_timestamp: number,
24+
_ethBlock: number,
25+
_chainBlocks: ChainBlocks
26+
) {
27+
let balances = {} as Balances;
28+
for (let issued of chainContracts[chain].issued) {
29+
const totalSupply = (
30+
await sdk.api.abi.call({
31+
abi: "erc20:totalSupply",
32+
target: issued,
33+
block: _chainBlocks?.[chain],
34+
chain: chain,
35+
})
36+
).output;
37+
sumSingleBalance(
38+
balances,
39+
"peggedJPY",
40+
totalSupply / 10 ** decimals,
41+
"issued",
42+
false
43+
);
44+
}
45+
return balances;
46+
};
47+
}
48+
49+
const adapter: PeggedIssuanceAdapter = {
50+
ethereum: {
51+
minted: chainMinted("ethereum", 18),
52+
unreleased: async () => ({}),
53+
},
54+
};
55+
56+
export default adapter;

src/adapters/peggedAssets/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ import fxrusd from "./fx-rusd";
176176
import pxdc from "./powercity-pxdc";
177177
import fdx from "./fathom-dollar"
178178
import uno from "./nostra-uno";
179+
import cjpy from "./convertible-jpy-token";
179180

180181
export default {
181182
tether,
@@ -356,4 +357,5 @@ export default {
356357
"powercity-pxdc": pxdc,
357358
"fathom-dollar": fdx,
358359
"nostra-uno": uno,
360+
"convertible-jpy-token": cjpy,
359361
};

src/peggedData/peggedData.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3585,5 +3585,25 @@ export default [
35853585
auditLinks: null,
35863586
twitter: "https://twitter.com/USD_3",
35873587
wiki: "https://app.reserve.org/ethereum/token/0x0d86883faf4ffd7aeb116390af37746f45b6f378/overview",
3588-
}
3588+
},
3589+
{
3590+
id: "179",
3591+
name: "CJPY",
3592+
address: "0x1cfa5641c01406ab8ac350ded7d735ec41298372",
3593+
symbol: "CJPY",
3594+
url: "https://app.yamato.fi/#/",
3595+
description:
3596+
"Yamato Protocol is a crypto-asset overcollateralized stable coin issuance protocol. V1 allows the issuance of CJPY (“Convertible JPY”, a Japanese Yen equivalent coin) using ETH as collateral.",
3597+
mintRedeemDescription:
3598+
"Users deposit ETH as collateral to generate the debt token CJPY.",
3599+
onCoinGecko: "true",
3600+
gecko_id: "convertible-jpy-token",
3601+
cmcId: null,
3602+
pegType: "peggedJPY",
3603+
pegMechanism: "crypto-backed",
3604+
priceSource: "coingecko",
3605+
auditLinks: "https://docs.yamato.fi/v/en/audit",
3606+
twitter: "https://twitter.com/DeFiGeekJapanEN",
3607+
wiki: "https://docs.yamato.fi/v/en",
3608+
}
35893609
] as PeggedAsset[];

0 commit comments

Comments
 (0)