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

Feature/farming page 15 #26

Merged
merged 44 commits into from Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c0df81b
base layout
Mi-Lan Sep 22, 2021
786259d
fix: Added farming to mobile nav
Mi-Lan Sep 22, 2021
5e2e40d
style: Added farming icon
Mi-Lan Sep 22, 2021
e079f9f
analyzing staking subgraph data
Mi-Lan Sep 22, 2021
03a13e3
debug
Mi-Lan Sep 23, 2021
5cf2e4c
feature: Added staked amount and appropriate sorting
Mi-Lan Sep 24, 2021
2626e90
debug
Mi-Lan Sep 24, 2021
e24545b
feature: Implemeting data for farming table
Mi-Lan Sep 27, 2021
b9bc409
Delete Project_Default.xml
Mi-Lan Sep 27, 2021
d596470
Delete yarn.lock~6392ee34904d87efb7d697b41c3aa7abcbae9535
Mi-Lan Sep 27, 2021
8d3e066
Delete misc.xml
Mi-Lan Sep 27, 2021
d5326e8
Delete modules.xml
Mi-Lan Sep 27, 2021
955408f
Delete vcs.xml
Mi-Lan Sep 27, 2021
32595f7
Delete swapr-info.iml
Mi-Lan Sep 27, 2021
f4ae1e6
feature: Added dependencies
Mi-Lan Sep 29, 2021
066f361
feature: Added new data fetching for mining campaigns and integrated …
Mi-Lan Sep 29, 2021
0027004
feature: Apy calcualtion in progress
Mi-Lan Sep 29, 2021
0460fd8
feature: Finished campaign object for fetchibg apy
Mi-Lan Sep 30, 2021
9309591
feature: Added correct apy
Mi-Lan Sep 30, 2021
627d532
fix: Bunch of small style and formatting fixes
Mi-Lan Sep 30, 2021
7369b6d
feature: Added yield per 1000 field
Mi-Lan Sep 30, 2021
1250f99
fix: Changed old area names
Mi-Lan Sep 30, 2021
4287821
fix: Deleted unused old qury
Mi-Lan Sep 30, 2021
fe7282f
Delete workspace.xml
Mi-Lan Sep 30, 2021
e477653
Delete Project_Default.xml
Mi-Lan Sep 30, 2021
e79c3c9
Delete misc.xml
Mi-Lan Sep 30, 2021
324b358
Delete vcs.xml
Mi-Lan Sep 30, 2021
d9aa683
Delete swapr-info.iml
Mi-Lan Sep 30, 2021
070f7d2
Delete modules.xml
Mi-Lan Sep 30, 2021
aa0e491
fix: Deleted promiseAll since its not asynchronous
Mi-Lan Sep 30, 2021
63d4044
feature: Added evalution for just active campaigns and formatting fixes
Mi-Lan Oct 4, 2021
ef97e93
fix: Added cleaner solution for fetching active proposals over subgraph
Mi-Lan Oct 4, 2021
fb897de
fix: Improved sorting and deleted unused data passed in Farming page …
Mi-Lan Oct 4, 2021
cb14e9f
fix: Improved sorting and deleted unused data passed in Farming page …
Mi-Lan Oct 4, 2021
017e7e1
feature: Implemented stake in dollars and bunch of small modifications
Mi-Lan Oct 4, 2021
63ff5e6
farming page enhancements
natonnelier Nov 12, 2021
dc4fc11
comments removed
natonnelier Nov 12, 2021
fc44389
filter campaigns moved to PairData and inline styling removed
natonnelier Nov 17, 2021
e03e1a6
miningData hooks joined
Nov 25, 2021
7756132
line break added
Dec 1, 2021
d0b0b6f
Merge branch 'develop' into feature/farming-page-15
natonnelier Dec 1, 2021
64ae9a5
line readded
Dec 1, 2021
52d7b1d
Merge branch 'feature/farming-page-15' of https://github.com/natonnel…
natonnelier Dec 1, 2021
e06177a
utilization param re-added
natonnelier Dec 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
110 changes: 57 additions & 53 deletions src/apollo/queries.js
Expand Up @@ -484,15 +484,13 @@ export const GLOBAL_CHART = gql`
export const GLOBAL_DATA = (factoryAddress, block) => {
const queryString = ` query swaprFactories {
swaprFactories(
${
block
? `block: { number: ${
block > FACTORY_STARTING_BLOCK[factoryAddress]
? block
: FACTORY_STARTING_BLOCK[factoryAddress]
}}`
: ``
}
${block
? `block: { number: ${block > FACTORY_STARTING_BLOCK[factoryAddress]
? block
: FACTORY_STARTING_BLOCK[factoryAddress]
}}`
: ``
}
where: { id: "${factoryAddress}" }) {
id
totalVolumeUSD
Expand Down Expand Up @@ -722,51 +720,59 @@ const PairFields = `
createdAtTimestamp
}
`;
export const liquidityMiningCampaignsQuery = gql`
query liquidityMiningCampaigns($currentTime: Int!) {
liquidityMiningCampaigns(where: { endsAt_gt: $currentTime }) {
id
rewardTokens {
address: id
name
symbol
decimals
derivedNativeCurrency
}
rewardAmounts
stakedAmount
startsAt
endsAt
locked
stakingCap
stakablePair {
token0 {
id
derivedNativeCurrency
totalSupply
untrackedVolumeUSD
decimals

// returns active campaigns by default
// if status "expired" is passed it will return expired campaigns
export const liquidityMiningCampaignsQuery = (status = "active", currentTime) => {
const endsAtP = status === "active" ? "endsAt_gt" : "endsAt_lte";
const queryString = `
query liquidityMiningCampaigns {
liquidityMiningCampaigns(where: { ${endsAtP}: ${currentTime} }) {
id
rewardTokens {
address: id
name
symbol
}
token1 {
id
decimals
derivedNativeCurrency
}
rewardAmounts
stakedAmount
startsAt
endsAt
locked
stakingCap
stakablePair {
token0 {
id
derivedNativeCurrency
totalSupply
untrackedVolumeUSD
decimals
name
symbol
}
token1 {
id
derivedNativeCurrency
totalSupply
untrackedVolumeUSD
decimals
name
symbol
}
totalSupply
untrackedVolumeUSD
decimals
name
symbol
reserveUSD
reserveNativeCurrency
reserve1
reserve0
}
totalSupply
reserveUSD
reserveNativeCurrency
reserve1
reserve0
}
}
}
`;
`;
return gql(queryString);
};

export const PAIRS_CURRENT = gql`
query pairs {
pairs(
Expand All @@ -783,9 +789,8 @@ export const PAIR_DATA = (pairAddress, block) => {
const queryString = `
${PairFields}
query pairs {
pairs(${
block ? `block: {number: ${block}}` : ``
} where: { id: "${pairAddress}"} ) {
pairs(${block ? `block: {number: ${block}}` : ``
} where: { id: "${pairAddress}"} ) {
...PairFields
}
}`;
Expand Down Expand Up @@ -910,9 +915,8 @@ export const TOKEN_DATA = (tokenAddress, block) => {
const queryString = `
${TokenFields}
query tokens {
tokens(${
block ? `block : {number: ${block}}` : ``
} where: {id:"${tokenAddress}"}) {
tokens(${block ? `block : {number: ${block}}` : ``
} where: {id:"${tokenAddress}"}) {
...TokenFields
}
pairs0: pairs(where: {token0: "${tokenAddress}"}, first: 50, orderBy: reserveUSD, orderDirection: desc){
Expand Down
6 changes: 3 additions & 3 deletions src/components/DropdownSelect/index.js
Expand Up @@ -13,7 +13,7 @@ const Wrapper = styled.div`
position: relative;
background-color: ${({ theme }) => theme.panelColor};
border: 1px solid ${({ color, theme }) => color || theme.primary4};
width: 100px;
width: ${({ width }) => (width ? width : "100px")};
padding: 4px 10px;
padding-right: 6px;
border-radius: 8px;
Expand Down Expand Up @@ -50,7 +50,7 @@ const ArrowStyled = styled(Arrow)`
margin-left: 6px;
`;

const DropdownSelect = ({ options, active, setActive, color }) => {
const DropdownSelect = ({ options, active, setActive, color, width = null }) => {
const [showDropdown, toggleDropdown] = useState(false);
const dropdownRef = useRef(null);
const containerRef = useRef(null);
Expand All @@ -60,7 +60,7 @@ const DropdownSelect = ({ options, active, setActive, color }) => {
});

return (
<Wrapper open={showDropdown} color={color} ref={containerRef}>
<Wrapper open={showDropdown} color={color} ref={containerRef} width={width}>
<RowBetween
onClick={() => toggleDropdown(!showDropdown)}
justify="center"
Expand Down