Skip to content

Commit eb7c3bf

Browse files
authored
Merge pull request #304 from darwinia-network/remove-plo-query
chore: remove plo subql query
2 parents adb882c + 9d6abff commit eb7c3bf

17 files changed

Lines changed: 208485 additions & 374 deletions

src/components/PageFooter/PageFooter.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,7 @@ class PageFooter extends Component {
175175
</p>
176176
)}
177177
<p>
178-
<a
179-
target="_blank"
180-
rel="noopener noreferrer"
181-
href={t("common:techpaper_url")}
182-
>
178+
<a target="_blank" rel="noopener noreferrer" href={t("common:techpaper_url")}>
183179
{t("footer:technology_title_5")}
184180
</a>
185181
</p>

src/graphql.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/index.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@ import App from "./App";
66
import * as serviceWorker from "./serviceWorker";
77
import { withTranslation } from "react-i18next";
88

9-
import { ApolloProvider } from "@apollo/client";
10-
import { graphqlClient } from "./graphql";
11-
129
const TransApp = withTranslation()(App);
1310
ReactDOM.render(
14-
<ApolloProvider client={graphqlClient}>
15-
<TransApp />
16-
</ApolloProvider>,
11+
<TransApp />,
1712
document.getElementById("root")
1813
);
1914

src/page/Blog/data.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ export const dataBlogs = [
77
"Referenda #46 is now up for vote: the remark proposal, by @ taonft.com | From the community, in order to…",
88
time: "May 9, 2022",
99
link: "https://darwinianetwork.medium.com/crab-network-referenda-46-is-now-up-for-vote-b34a36af2406",
10-
}, {
10+
},
11+
{
1112
picture: "/static/blogImg/blog/blog_022.webp",
12-
title: "Darwinia will offer 1,000,000 xRING and 7,000,000 CRAB for USDT/xRING and USDC/CRAB incentives for Liquidity Providers on SnowSwap",
13+
title:
14+
"Darwinia will offer 1,000,000 xRING and 7,000,000 CRAB for USDT/xRING and USDC/CRAB incentives for Liquidity Providers on SnowSwap",
1315
tags: ["Announcements"],
1416
abstract:
1517
"We’re excited to announce that 1,000,000 xRING and 7,000,000 CRAB sponsored by Darwinia will be distributed to USDT/xRING and USDC/CRAB liquidity…",
@@ -90,7 +92,8 @@ export const dataBlogs = [
9092
},
9193
{
9294
picture: "/static/blogImg/blog/blog_013.png",
93-
title: "Grants Program: Subview Receives Darwinia Grant, Bringing a Blockchain Explorer For Crab Smart Chain Data Support",
95+
title:
96+
"Grants Program: Subview Receives Darwinia Grant, Bringing a Blockchain Explorer For Crab Smart Chain Data Support",
9497
tags: ["Announcements", "Grants"],
9598
abstract:
9699
"Crab, the Ethereum-compatible smart contract platform on Kusama, accepted the Subview project into our grants program. Subview is a blockchain explorer for Crab Smart Chain data support and provides a comprehensive…",
@@ -210,17 +213,15 @@ export const dataNewsletters = [
210213
picture: "/static/blogImg/newsletters/newsletters_004.png",
211214
title: "Darwinia Monthly Dispatch: April 2022",
212215
tags: ["Newsletters"],
213-
abstract:
214-
"Updates: More accurate precompile gas calculations on Crab Smart Chain…",
216+
abstract: "Updates: More accurate precompile gas calculations on Crab Smart Chain…",
215217
time: "May 9, 2022",
216218
link: "https://darwinianetwork.medium.com/darwinia-highlight-april-monthly-recap-8367e40022d2",
217219
},
218220
{
219221
picture: "/static/blogImg/newsletters/newsletters_003.png",
220222
title: "Darwinia Monthly Dispatch: March 2022",
221223
tags: ["Newsletters"],
222-
abstract:
223-
"Updates: Darwinia new release version of v0.12.0, an upgrade to support Substrate metadata v14…",
224+
abstract: "Updates: Darwinia new release version of v0.12.0, an upgrade to support Substrate metadata v14…",
224225
time: "April 2, 2022",
225226
link: "https://darwinianetwork.medium.com/darwinia-highlight-april-monthly-recap-8367e40022d2",
226227
},
@@ -312,7 +313,8 @@ export const dataTutorials = [
312313
picture: "/static/blogImg/tutorials/tutorials_024.png",
313314
title: "Using Darwinia Tools 3–10: Darwinia Apps Guide Part III: Frequently Asked Questions (FAQs)",
314315
tags: ["Tutorials", "Tools"],
315-
abstract: "This FAQ focuses on common questions for users interested in Darwinia Apps. It has four main sections: General (about Apps), Accounts, Staking, and Tokens…",
316+
abstract:
317+
"This FAQ focuses on common questions for users interested in Darwinia Apps. It has four main sections: General (about Apps), Accounts, Staking, and Tokens…",
316318
time: "April 7, 2022",
317319
link: "https://darwinianetwork.medium.com/darwinia-apps-guide-part-iii-frequently-asked-questions-faqs-a9f0a3ff6855",
318320
subtype: "tools",
@@ -321,7 +323,8 @@ export const dataTutorials = [
321323
picture: "/static/blogImg/tutorials/tutorials_023.png",
322324
title: "Using Darwinia Tools 3–9: Darwinia Apps Guide Part II: Staking and Earning",
323325
tags: ["Tutorials", "Tools"],
324-
abstract: "This tutorial will walk you through the process of staking your tokens (RING/KTON) on Darwinia Apps built by the Darwinia Dev team. The Apps work on Substrate-based Pangolin/Pangoro Test Network, Darwinia Chain, and Crab Chain…",
326+
abstract:
327+
"This tutorial will walk you through the process of staking your tokens (RING/KTON) on Darwinia Apps built by the Darwinia Dev team. The Apps work on Substrate-based Pangolin/Pangoro Test Network, Darwinia Chain, and Crab Chain…",
325328
time: "March 16, 2022",
326329
link: "https://darwinianetwork.medium.com/using-darwinia-tools-3-9-darwinia-apps-guide-part-%E2%85%B1-staking-and-earning-7cd586315f76",
327330
subtype: "tools",

src/page/PloContribute/components/global-contribution-activity.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import Fade from "react-reveal/Fade";
22
import { Table } from "antd";
3-
import React, { useState } from "react";
3+
import React from "react";
44
import classNames from "classnames/bind";
55
import styles from "../styles.module.scss";
66
import { formatBalanceFromOrigToDOT, KTON_REWARD, RING_REWARD, shortAddress } from "../utils";
77
import Big from "big.js";
8-
import { useQuery } from "@apollo/client";
9-
import { gqlWhocrowdloanByOffset } from "../gql";
108
import btcTop5 from "../top5.json";
119

10+
import crowdloanWhoStatistics from "../data/crowdloanWhoStatistics.json";
11+
1212
const cx = classNames.bind(styles);
1313

1414
const GlobalContributionActivity = ({ allReferContributeData, globalTotalPower, top5contribute }) => {
15-
const [offset, setOffset] = useState(0);
16-
const allWhoCrowdloan = useQuery(gqlWhocrowdloanByOffset(offset));
15+
const allWhoCrowdloan = crowdloanWhoStatistics;
1716

1817
const globalContributeColumns = [
1918
{
@@ -108,8 +107,8 @@ const GlobalContributionActivity = ({ allReferContributeData, globalTotalPower,
108107
myDot: formatBalanceFromOrigToDOT(nodeWho.totalBalance),
109108
referrals: nodeRefer ? nodeRefer.contributorsCount : 0,
110109
referralDot: nodeRefer ? formatBalanceFromOrigToDOT(nodeRefer.totalBalance) : 0,
111-
curRingRewards: '0' || contributePer.times(RING_REWARD).toFixed(8),
112-
curKtonRewards: '0' || contributePer.times(KTON_REWARD).toFixed(8),
110+
curRingRewards: "0" || contributePer.times(RING_REWARD).toFixed(3),
111+
curKtonRewards: "0" || contributePer.times(KTON_REWARD).toFixed(3),
113112
curBtcRewards: target ? target.reward : "0",
114113
curNft: "No Status",
115114
});
@@ -127,9 +126,6 @@ const GlobalContributionActivity = ({ allReferContributeData, globalTotalPower,
127126
total: allWhoCrowdloan.data ? allWhoCrowdloan.data.crowdloanWhoStatistics.totalCount : 0,
128127
size: "small",
129128
showSizeChanger: false,
130-
onChange: (page, pageSize) => {
131-
setOffset((page - 1) * pageSize);
132-
},
133129
}}
134130
/>
135131
</Fade>

src/page/PloContribute/components/metaverse-nft.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import infoIcon from "../img/info-icon.png";
1010
import modalCloseIcon from "../img/modal-close.png";
1111

1212
import { useApi } from "../hooks";
13-
import { DOT_TO_ORIG } from "../utils";
13+
import { DOT_PRECISION } from "../utils";
1414
import styles from "../styles.module.scss";
1515

1616
import { ApolloClient, InMemoryCache, ApolloProvider, useQuery, gql } from "@apollo/client";
@@ -148,7 +148,7 @@ const MetaverseNFT = ({ myTotalContribute, currentAccount }) => {
148148
<span>Current</span>
149149
</div>
150150
<span className={cx("contribute-info-item-value")}>
151-
{myTotalContribute.gte(DOT_TO_ORIG.muln(10)) && !isExcluded ? "1" : "0"}
151+
{myTotalContribute.gte(DOT_PRECISION.muln(10)) && !isExcluded ? "1" : "0"}
152152
</span>
153153
{isRemarked || myRemarked ? (
154154
<Tooltip
@@ -189,7 +189,7 @@ const MetaverseNFT = ({ myTotalContribute, currentAccount }) => {
189189
) : (
190190
<button
191191
className={cx("claim-reward-btn")}
192-
disabled={myTotalContribute.lt(DOT_TO_ORIG.muln(10)) || loading || !currentAccount || isExcluded}
192+
disabled={myTotalContribute.lt(DOT_PRECISION.muln(10)) || loading || !currentAccount || isExcluded}
193193
onClick={() => setVisibleModalClaimNFT(true)}
194194
>
195195
<Spin wrapperClassName={cx("metaverse-nft-modal-ok-btn-spin")} spinning={loading}>
@@ -300,7 +300,7 @@ const MetaverseNFT = ({ myTotalContribute, currentAccount }) => {
300300
};
301301

302302
const client = new ApolloClient({
303-
uri: "https://api.subquery.network/sq/darwinia-network/darwinia-nft-polkadot",
303+
uri: "https://api.subquery.network/sq/JayJay1024/darwinia-nft-polkadot",
304304
cache: new InMemoryCache(),
305305
});
306306

src/page/PloContribute/components/referral-leaderboard.js

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,29 @@ import classNames from "classnames/bind";
1111
import styles from "../styles.module.scss";
1212
import BN from "bn.js";
1313
import Big from "big.js";
14-
import { useQuery } from "@apollo/client";
15-
import { LIMITED_REFER_CROWDLOAN } from "../gql";
14+
15+
import crowdloanReferStatistics from "../data/crowdloanReferStatistics.json";
1616

1717
const cx = classNames.bind(styles);
1818

1919
const ReferralLeaderboard = ({ globalTotalPower }) => {
20-
const allReferCrowdloan = useQuery(LIMITED_REFER_CROWDLOAN);
20+
const allReferCrowdloan = crowdloanReferStatistics.data.crowdloanReferStatistics.nodes.slice(0, 20);
2121

2222
const referralLeaderboardData = [];
23-
if (!allReferCrowdloan.loading && !allReferCrowdloan.error) {
24-
if (
25-
allReferCrowdloan.data &&
26-
allReferCrowdloan.data.crowdloanReferStatistics &&
27-
allReferCrowdloan.data.crowdloanReferStatistics.nodes &&
28-
allReferCrowdloan.data.crowdloanReferStatistics.nodes.length
29-
) {
30-
allReferCrowdloan.data.crowdloanReferStatistics.nodes.forEach((node) => {
31-
const nodeTotalPowerBN = new BN(node.totalPower);
32-
const contributePer = Big(nodeTotalPowerBN.toString()).div(globalTotalPower.toString());
23+
allReferCrowdloan.forEach((node) => {
24+
const nodeTotalPowerBN = new BN(node.totalPower);
25+
const contributePer = Big(nodeTotalPowerBN.toString()).div(globalTotalPower.toString());
3326

34-
referralLeaderboardData.push({
35-
address: referralCodeToPolkadotAddress(node.user),
36-
referrals: node.contributors.nodes.length,
37-
accumulatedContribution: node.totalBalance,
38-
referralRewards: {
39-
ring: contributePer.mul(RING_REWARD),
40-
kton: contributePer.mul(KTON_REWARD),
41-
},
42-
});
43-
});
44-
}
45-
}
27+
referralLeaderboardData.push({
28+
address: referralCodeToPolkadotAddress(node.user),
29+
referrals: node.contributors.nodes.length,
30+
accumulatedContribution: node.totalBalance,
31+
referralRewards: {
32+
ring: contributePer.mul(RING_REWARD),
33+
kton: contributePer.mul(KTON_REWARD),
34+
},
35+
});
36+
});
4637

4738
return (
4839
<Fade bottom fraction={0.1} duration={1000} distance={"50px"}>
@@ -79,8 +70,8 @@ const ReferralLeaderboard = ({ globalTotalPower }) => {
7970
{formatBalanceFromOrigToDOT(data.accumulatedContribution)} DOT
8071
</span>
8172
<div className={cx("referral-leaderboard-item-rewards")}>
82-
<span>{'0' || data.referralRewards.ring.toFixed(2)} RING</span>
83-
<span>{'0' || data.referralRewards.kton.toFixed(2)} KTON</span>
73+
<span>{"0" || data.referralRewards.ring.toFixed(2)} RING</span>
74+
<span>{"0" || data.referralRewards.kton.toFixed(2)} KTON</span>
8475
</div>
8576
</div>
8677
))
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Query
2+
3+
https://explorer.subquery.network/subquery/darwinia-network/home-plo-kusama
4+
5+
> crowdloanContributeds.json
6+
7+
```
8+
query {
9+
crowdloanContributeds (filter: { paraId: { equalTo: 2003 } }) {
10+
totalCount
11+
nodes {
12+
id
13+
timestamp
14+
balance
15+
extrinsicId
16+
who
17+
}
18+
}
19+
}
20+
```
21+
22+
> crowdloanMemos.json
23+
24+
```
25+
query {
26+
crowdloanMemos (filter: { paraId: {equalTo: 2003} }) {
27+
totalCount
28+
nodes {
29+
who
30+
memo
31+
}
32+
}
33+
}
34+
```
35+
36+
> crowdloanWhoStatistics.json
37+
38+
```
39+
query {
40+
crowdloanWhoStatistics (orderBy: TOTAL_BALANCE_DESC) {
41+
totalCount
42+
nodes {
43+
user
44+
totalPower
45+
totalBalance
46+
contributors (orderBy: TIMESTAMP_DESC) {
47+
nodes {
48+
balance
49+
}
50+
}
51+
}
52+
}
53+
}
54+
```
55+
56+
> crowdloanReferStatistics.json
57+
58+
```
59+
query {
60+
crowdloanReferStatistics (orderBy: TOTAL_BALANCE_DESC) {
61+
totalCount
62+
nodes {
63+
user
64+
totalPower
65+
totalBalance
66+
contributors (orderBy: TIMESTAMP_DESC) {
67+
nodes {
68+
id
69+
extrinsicId
70+
timestamp
71+
block
72+
balance
73+
}
74+
}
75+
}
76+
}
77+
}
78+
```
79+
80+
> accounts.json
81+
82+
```
83+
query {
84+
accounts(orderBy: CONTRIBUTED_TOTAL_DESC) {
85+
totalCount
86+
nodes {
87+
id
88+
contributedTotalCount
89+
contributedTotal
90+
}
91+
}
92+
}
93+
```

0 commit comments

Comments
 (0)