Skip to content

Commit

Permalink
feat: new NFTs for 2nd anniversary and top contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
wrap-that-potassium committed Jun 5, 2023
1 parent 67c9709 commit 11184e7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 30 deletions.
6 changes: 1 addition & 5 deletions frontend/src/components/farms/Farm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,7 @@ export default class Farm extends Vue {
if (permitEnabled) {
this.lpTokenAllowance = true
} else {
const allowance: BigNumber = await this.bep20.allowance(
this.account,
lpTokenAddress,
this.signer
)
const allowance: BigNumber = await this.bep20.allowance(this.account, lpTokenAddress, this.signer)
this.lpTokenAllowance = allowance.gt(BigNumber.from('0'))
}
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ import BlockchainChooser from '@/components/BlockchainChooser.vue'
import { blockchainAddressFilter } from '@/utils/filters'
import QRCode from 'qrcode'
import { openURL } from 'quasar'
import { Network, POLYGON_MAINNET } from '@/utils/Networks'
import { Network, POLYGON_MAINNET, ETHEREUM_TESTNET } from '@/utils/Networks'
import Dialogs from '@/utils/Dialogs'
const accountsStore = namespace('accounts')
Expand Down Expand Up @@ -274,7 +274,11 @@ export default class MainLayout extends Vue {
}
openNftPage() {
if (this.isUserConnected && this.currentBlockchain.chainIdNumber === POLYGON_MAINNET.chainIdNumber) {
if (
this.isUserConnected &&
(this.currentBlockchain.chainIdNumber === POLYGON_MAINNET.chainIdNumber ||
this.currentBlockchain.chainIdNumber === ETHEREUM_TESTNET.chainIdNumber)
) {
router.push('/nft')
} else {
openURL('https://opensea.io/collection/wban')
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/pages/NftRewards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ import { asyncFilter } from '@/utils/AsyncUtils'
import { ethers } from 'ethers'
import axios, { AxiosResponse } from 'axios'
import { openURL } from 'quasar'
import { Network, POLYGON_MAINNET } from '@/utils/Networks'
import { Network, POLYGON_MAINNET, ETHEREUM_TESTNET } from '@/utils/Networks'
const nftStore = namespace('nft')
const accountsStore = namespace('accounts')
Expand Down Expand Up @@ -323,7 +323,10 @@ export default class NftRewardsPage extends Vue {
}
async onProviderChange() {
if (this.activeAccount && this.network.chainId === POLYGON_MAINNET.chainId) {
if (
this.activeAccount &&
(this.network.chainId === POLYGON_MAINNET.chainId || this.network.chainId === ETHEREUM_TESTNET.chainId)
) {
this.wrongNetwork = false
await nft.initContract(this.provider)
await this.reload()
Expand Down
23 changes: 2 additions & 21 deletions frontend/src/store/modules/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class NftModule extends VuexModule {
private _uri = ''
private _nfts: Map<string, NftData> = new Map()

static NFT_IDS = [902, 900, 901, 0, 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102]
static NFT_IDS = [999, 903, 902, 900, 901, 0, 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102]
static NFT_REWARDS_CONTRACT: string = process.env.VUE_APP_NFT_REWARDS_CONTRACT || ''
static NFT_OPENSEA_URL: string = process.env.VUE_APP_NFT_OPENSEA_URL || ''

Expand Down Expand Up @@ -85,26 +85,7 @@ class NftModule extends VuexModule {
const { contract, account } = request
console.debug(`in loadNFTs for ${account}`)
// load NFT balances
const balances = await contract.balanceOfBatch(
[
account,
account,
account,
account,
account,
account,
account,
account,
account,
account,
account,
account,
account,
account,
account,
],
NftModule.NFT_IDS
)
const balances = await contract.balanceOfBatch(Array(NftModule.NFT_IDS.length).fill(account), NftModule.NFT_IDS)
console.debug(`Balances of ${account} are ${balances}`)
// load NFT data
const uriTemplate = this._uri.replace('ipfs://', NftModule.IPFS_GATEWAY)
Expand Down

0 comments on commit 11184e7

Please sign in to comment.