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/guild #2167

Merged
merged 24 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c9786f3
Guild Token Lock (#1908)
Mi-Lan Jul 1, 2021
01419ea
feature/1861 (#1907)
hexyls Jul 3, 2021
20ffd3a
feature: add airdrop card to guild modal
hexyls Jul 20, 2021
4bd1cc3
fix: style changes, testing airdrop
hexyls Jul 21, 2021
f35e307
style: Reduce margin from 32px to 24px for diver and button group
Jul 21, 2021
c1781d3
fix: refetch claimable balance
hexyls Jul 22, 2021
e16145c
Merge branch 'feature/airdrop-guild-modal' of github.com:protofire/om…
hexyls Jul 22, 2021
9338323
fix: reset check address claim amount
hexyls Jul 22, 2021
a85e345
fix: display omen account on tight integration
hexyls Jul 22, 2021
76d783e
fix: capitalize wallet balance
hexyls Jul 22, 2021
f087c0b
feature: add airdrop for dxd holders
hexyls Jul 23, 2021
2b7959a
Add airdrop card to guild modal (#2112)
hexyls Jul 26, 2021
6ce1eae
Merge branch 'feature/guild' into fix/2114
hexyls Jul 28, 2021
80cbe2c
Merge branch 'feature/guild' into feature/2093
hexyls Jul 28, 2021
b0ffd3c
feature: redeploy both airdrops
hexyls Jul 28, 2021
464c75d
Combined (relay+eoa) OMN balance in header (#2139)
hexyls Aug 9, 2021
1539a8c
Merge pull request #2121 from protofire/fix/2114
hexyls Aug 10, 2021
39dce76
Merge branch 'feature/guild' into feature/2093
hexyls Aug 10, 2021
38f40d1
fix: fetch claims from github
hexyls Aug 10, 2021
f395fee
Merge branch 'feature/2093' of github.com:protofire/omen-exchange int…
hexyls Aug 10, 2021
2ecb1fb
fix: add claim recipient field
hexyls Aug 10, 2021
e2af478
Merge pull request #2122 from protofire/feature/2093
hexyls Aug 10, 2021
91947dc
Merge branch 'master' into feature/guild
hexyls Aug 11, 2021
a7b0679
fix: attempt to resolve merge issues, move code to cpk pipes
hexyls Aug 11, 2021
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
Prev Previous commit
Next Next commit
fix: add claim recipient field
  • Loading branch information
hexyls committed Aug 10, 2021
commit 2ecb1fbaf55351ac8e4c26b08cec595072af4718
10,194 changes: 0 additions & 10,194 deletions app/src/services/airdrop/0x0669d354cDe9A92390b412742916bBC04f340856.json

This file was deleted.

24,806 changes: 0 additions & 24,806 deletions app/src/services/airdrop/0x62d06197d1342a02A0AF01e68Fb50aF70073316F.json

This file was deleted.

10,234 changes: 0 additions & 10,234 deletions app/src/services/airdrop/0x85951106cB2183aAB69c4De9536c6FACcBEccd74.json

This file was deleted.

10,234 changes: 0 additions & 10,234 deletions app/src/services/airdrop/0x9ed60F41C1732d5AEBF330f577138ca71B7f4ab2.json

This file was deleted.

40 changes: 6 additions & 34 deletions app/src/services/airdrop/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Contract, Wallet, ethers, utils } from 'ethers'
import { BigNumber, getAddress } from 'ethers/utils'
import { BigNumber } from 'ethers/utils'

import { Transaction, calcRelayProxyAddress } from '../../util/cpk'
import { getAirdrops, networkIds } from '../../util/networks'
import { isAddress } from '../../util/tools'
import { Transaction } from '../../util/cpk'
import { getAirdrops } from '../../util/networks'

import { airdropAbi } from './abi'

Expand All @@ -22,47 +21,20 @@ class AirdropService {
}
}

static getClaim = async (
airdrop: string,
address: Maybe<string>,
networkId: number,
provider: any,
relay: boolean,
) => {
// handle / format address
const lowerCaseAddress = address && address.toLowerCase()
const recipient = lowerCaseAddress && isAddress(lowerCaseAddress) && getAddress(lowerCaseAddress)
// eslint-disable-next-line
const proofs = require(`./${airdrop}.json`)
if (recipient) {
if (networkId === networkIds.XDAI) {
const proxyAddress = calcRelayProxyAddress(recipient, provider)
const proxyClaim = proxyAddress && proofs.claims[proxyAddress]
if (proxyClaim && relay) {
return { ...proxyClaim, recipient: proxyAddress }
}
}
const claim = proofs.claims[recipient]
if (claim) {
return { ...claim, recipient }
}
}
}

getClaims = async (address: Maybe<string>) => {
getClaims = async (recipient: Maybe<string>) => {
if (this.airdrops) {
const claims = await Promise.all(
this.airdrops.map(async (airdrop, index) => {
try {
const response = await fetch(
`https://raw.githubusercontent.com/hexyls/omen-airdrop/blob/master/${index + 1}/${address}.json`,
`https://raw.githubusercontent.com/hexyls/omen-airdrop/master/${index + 1}/${recipient}.json`,
)
const claim = await response.json()
if (claim && claim.amount) {
try {
const claimed = await airdrop.isClaimed(claim.index)
if (!claimed) {
return { ...claim, airdrop: airdrop.address }
return { ...claim, airdrop: airdrop.address, recipient }
}
// eslint-disable-next-line
} catch {}
Expand Down
20 changes: 11 additions & 9 deletions app/src/services/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,17 @@ class OmenGuildService {
network: number
provider: any
omenGuildAddress: string
contract: Contract
contract?: Contract

constructor(provider: Web3Provider, network: number) {
const signer = provider.getSigner()
this.user = signer
this.network = network
this.provider = provider
this.omenGuildAddress = getContractAddress(network, 'omenGuildProxy')
this.contract = new ethers.Contract(this.omenGuildAddress, GuildAbi, provider.getSigner()).connect(signer)
if (this.omenGuildAddress) {
this.contract = new ethers.Contract(this.omenGuildAddress, GuildAbi, provider.getSigner()).connect(signer)
}
}

get getOmenGuildAddress(): string {
Expand All @@ -90,31 +92,31 @@ class OmenGuildService {
}

lockTokens = async (amount: BigNumber) => {
return await this.contract.lockTokens(amount)
return await this.contract?.lockTokens(amount)
}

unlockTokens = async (amount: BigNumber) => {
return await this.contract.releaseTokens(amount)
return await this.contract?.releaseTokens(amount)
}

tokensLocked = async (address: string) => {
return this.contract.tokensLocked(address)
return this.contract?.tokensLocked(address)
}

totalLocked = async () => {
return this.contract.totalLocked()
return this.contract?.totalLocked()
}

omenTokenAddress = async () => {
return await this.contract.token()
return await this.contract?.token()
}

tokenVault = async () => {
return this.contract.tokenVault()
return this.contract?.tokenVault()
}

lockTime = async () => {
return this.contract.lockTime()
return this.contract?.lockTime()
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/util/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const networks: { [K in NetworkId]: Network } = {
defaultToken: 'dai',
blockExplorer: 'etherscan',
blockExplorerURL: 'https://rinkeby.etherscan.io',
airdropAddress: ['0x9ed60F41C1732d5AEBF330f577138ca71B7f4ab2', '0x62d06197d1342a02A0AF01e68Fb50aF70073316F'],
airdropAddress: [],
},
[networkIds.SOKOL]: {
label: 'Sokol',
Expand Down Expand Up @@ -290,7 +290,7 @@ const networks: { [K in NetworkId]: Network } = {
targetSafeImplementation: '0x9C75A217AEA76663a9A37687606f099945eb0742',
blockExplorer: 'blockscout',
blockExplorerURL: 'https://blockscout.com/poa/xdai',
airdropAddress: ['0xbC576232F6cb52ab908591Bc3b8FC292096DBb13'],
airdropAddress: ['0xbDf378FE53B89e2c3Cd638c66A9017E5b6822141', '0x868fc6343bfeDbED13935AFa7580Ba5BcC4b1409'],
},
}

Expand Down