Skip to content

Commit

Permalink
Merge pull request #337 from P4-Games/feature/opBNB
Browse files Browse the repository at this point in the history
Feature/op bnb
  • Loading branch information
dappsar authored Feb 14, 2024
2 parents 9d9ecb7 + 915a39a commit bfcd848
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 20 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ ARG MONGODB
ARG GAMMA_SERVICE_URL
ARG GRAPH_URL
ARG WALLET_CONNECT_PROJECT_ID
ARG CHAIN_NODE_PROVIDER_URL
ARG NODE_PROVIDER_MUMBAI_URL
ARG NODE_PROVIDER_BSC_TESTNET_URL
ARG NODE_PROVIDER_OPBNB_TESTNET
ARG MAIL_CLIENT
ARG MAIL_FROM
ARG MAIL_TO
Expand All @@ -35,7 +37,9 @@ ENV MONGODB $MONGODB
ENV GAMMA_SERVICE_URL $GAMMA_SERVICE_URL
ENV GRAPH_URL $GRAPH_URL
ENV WALLET_CONNECT_PROJECT_ID $WALLET_CONNECT_PROJECT_ID
ENV CHAIN_NODE_PROVIDER_URL $CHAIN_NODE_PROVIDER_URL
ENV NODE_PROVIDER_MUMBAI_URL $NODE_PROVIDER_MUMBAI_URL
ENV NODE_PROVIDER_BSC_TESTNET_URL $NODE_PROVIDER_BSC_TESTNET_URL
ENV NODE_PROVIDER_OPBNB_TESTNET $NODE_PROVIDER_OPBNB_TESTNET
ENV MAIL_CLIENT $MAIL_CLIENT
ENV MAIL_FROM $MAIL_FROM
ENV MAIL_TO $MAIL_TO
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ NEXT_PUBLIC_CHAIN_CURRENCY='ETH'
NEXT_PUBLIC_CHAIN_RPC_URL='http://localhost:8545'
```

## Quick commands
# Quick commands

### Install dependencies
## Install dependencies

```sh
- yarn install # with yarn
Expand All @@ -89,19 +89,19 @@ yarn config delete proxy
yarn --network-timeout 100000
```

### Run App
## Run App

```sh
npm run dev / yarn dev
```

### Use App
## Use App

```sh
Open browser in http://localhost:3000/
```

### Mock Data
## Mock Data

You can load mock data from the alpha, gamma collections and have DAIs in your wallet in a local environment, with these commands:

Expand All @@ -113,9 +113,9 @@ yarn deploy-mock-data # run the mock data
# Then upload the hardhat addresses to your wallets
```

## Contribution
# Contribution

### Commit changes
## Commit changes

The application uses a linter for commit messages, requiring them to be specified in the following format:

Expand Down Expand Up @@ -154,3 +154,7 @@ git reset --soft HEAD~1
```

For more information, refer to: [commitlint](https://commitlint.js.org/#/).

# Links

- BNB & opBNB node provider: [nodereal.io](https://nodereal.io/)
8 changes: 6 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ steps:
- GAMMA_SERVICE_URL=${_GAMMA_SERVICE_URL}
- GRAPH_URL=${_GRAPH_URL}
- WALLET_CONNECT_PROJECT_ID=${_WALLET_CONNECT_PROJECT_ID}
- CHAIN_NODE_PROVIDER_URL=${_CHAIN_NODE_PROVIDER_URL}
- NODE_PROVIDER_MUMBAI_URL=${_CHAIN_NODE_PROVIDER_URL}
- NODE_PROVIDER_BSC_TESTNET_URL=${_NODE_PROVIDER_BSC_TESTNET_URL}
- NODE_PROVIDER_OPBNB_TESTNET=${_NODE_PROVIDER_OPBNB_TESTNET}
- MAIL_CLIENT=${_MAIL_CLIENT}
- MAIL_FROM=${_MAIL_FROM}
- MAIL_TO=${_MAIL_TO}
Expand Down Expand Up @@ -43,7 +45,9 @@ steps:
"--build-arg", "GAMMA_SERVICE_URL=${_GAMMA_SERVICE_URL}",
"--build-arg", "GRAPH_URL=${_GRAPH_URL}",
"--build-arg", "WALLET_CONNECT_PROJECT_ID=${_WALLET_CONNECT_PROJECT_ID}",
"--build-arg", "CHAIN_NODE_PROVIDER_URL=${_CHAIN_NODE_PROVIDER_URL}",
"--build-arg", "NODE_PROVIDER_MUMBAI_URL=${_NODE_PROVIDER_MUMBAI_URL}",
"--build-arg", "NODE_PROVIDER_BSC_TESTNET_URL=${_NODE_PROVIDER_BSC_TESTNET_URL}",
"--build-arg", "NODE_PROVIDER_OPBNB_TESTNET=${_NODE_PROVIDER_OPBNB_TESTNET}",
"--build-arg", "MAIL_CLIENT=${_MAIL_CLIENT}",
"--build-arg", "MAIL_FROM=${_MAIL_FROM}",
"--build-arg", "MAIL_TO=${_MAIL_TO}",
Expand Down
43 changes: 36 additions & 7 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ export const MAIL_CONFIG = {
export const walletConnectProjectId =
process.env.WALLET_CONNECT_PROJECT_ID || 'd66ff03f26d5a3ef19530ba69b815448'
// not exposed, included then in NETWORKS variable.
const NodeProviderUrl =
process.env.CHAIN_NODE_PROVIDER_URL || 'https://polygon-mumbai.g.alchemy.com/v2/'
const NodeProviderUrlMumbai =
process.env.NODE_PROVIDER_MUMBAI_URL || 'https://polygon-mumbai.g.alchemy.com/v2/'
const NodeProviderUrlbscTestnet = process.env.NODE_PROVIDER_BSC_TESTNET_URL
const NodeProviderUrlopBnbTestnet = process.env.NODE_PROVIDER_OPBNB_TESTNET

// ------------------------------------------------------------------
// client-side environment variables
Expand Down Expand Up @@ -80,7 +82,8 @@ export const NETWORKS = {
ChainRpcUrl: 'http://localhost:8545',
chainExplorerUrl: 'http://localhost:8545',
chainOpenSeaBaseUrl: 'https://testnets.opensea.io/assets/',
chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined)
chainNftUrl: '',
chainNodeProviderUrl: NodeProviderUrlMumbai // visible ONLY in server side code! (in cliente side will be undefined)
},
contracts: {
daiAddress: '0xfbC22278A96299D91d41C453234d97b4F5Eb9B2d',
Expand All @@ -101,7 +104,9 @@ export const NETWORKS = {
ChainRpcUrl: 'https://rpc-mumbai.maticvigil.com',
chainExplorerUrl: 'https://mumbai.polygonscan.com',
chainOpenSeaBaseUrl: 'https://testnets.opensea.io/assets/mumbai',
chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined)
chainNftUrl:
'https://mumbai.polygonscan.com/token/0x34658c07F05638E12793d0961595cBc72fA69452',
chainNodeProviderUrl: NodeProviderUrlMumbai // visible ONLY in server side code! (in cliente side will be undefined)
},
contracts: {
daiAddress: '0xEa4c35c858E15Cef77821278A88435dE57bc8707',
Expand All @@ -118,11 +123,12 @@ export const NETWORKS = {
environment: 'testing',
chainName: 'bsc-testnet',
chainId: '0x61',
chainCurrency: 'BNB',
chainCurrency: 'tBNB',
ChainRpcUrl: 'https://bsc-testnet-dataseed.bnbchain.org',
chainExplorerUrl: 'https://testnet.bscscan.com',
chainOpenSeaBaseUrl: 'https://testnets.opensea.io/assets/bsc-testnet',
chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined)
chainNftUrl: 'https://testnet.bscscan.com/token/0x25f85D878972f9506b4De49cEff480f627935521',
chainNodeProviderUrl: NodeProviderUrlbscTestnet // visible ONLY in server side code! (in cliente side will be undefined)
},
contracts: {
daiAddress: '0x83330b5803838604d85B7Cba393C930084F45A7d',
Expand All @@ -133,6 +139,28 @@ export const NETWORKS = {
gammaTicketsAddress: '0xA5c3Cd20AB6FF1e299D93ee268370BCC19a32E71'
}
},
'opbnb-testnet': {
config: {
enabled: 'true',
environment: 'testing',
chainName: 'opBNB-testnet',
chainId: '0x15eb',
chainCurrency: 'tBNB',
ChainRpcUrl: 'https://opbnb-testnet-rpc.bnbchain.org',
chainExplorerUrl: 'https://opbnb-testnet.bscscan.com',
chainOpenSeaBaseUrl: '',
chainNftUrl: 'https://testnet.opbnbscan.com/token/0x2842c8fd88f801018e53dddebbc944ae377d0f72',
chainNodeProviderUrl: NodeProviderUrlopBnbTestnet // visible ONLY in server side code! (in cliente side will be undefined)
},
contracts: {
daiAddress: '0x46480E0d10966Ea274831D9693a56f9c09D7339d',
alphaAddress: '0x36f19A5397DbE26b548b15C158f7a8e00979B408',
gammaCardsAddress: '0x2842c8FD88F801018E53dDDeBbC944aE377D0F72',
gammaPackAddress: '0x1116218412559628B67aa15F3c527D68F0A71b91',
gammaOffersAddress: '0xe810524F7C7C62A2201FdF1bCA20649Bd7D70844',
gammaTicketsAddress: '0xd9988C491805AE2573FA156b27CDE1a6f7B3E073'
}
},
matic: {
config: {
enabled: 'false',
Expand All @@ -143,7 +171,8 @@ export const NETWORKS = {
ChainRpcUrl: 'https://polygon-mainnet.infura.io',
chainExplorerUrl: 'https://polygonscan.com',
chainOpenSeaBaseUrl: 'https://opensea.io/assets/matic',
chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined)
chainNftUrl: '',
chainNodeProviderUrl: NodeProviderUrlMumbai // visible ONLY in server side code! (in cliente side will be undefined)
},
contracts: {
daiAddress: '',
Expand Down
7 changes: 6 additions & 1 deletion src/sections/Alpha/AlphaAlbums.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ const AlphaAlbums = ({ albums, clickFromAlbums, setSeasonName }) => {
useEffect(() => {
const ntwk = getCurrentNetwork()
if (ntwk && alphaContract) {
const openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${alphaContract.address}`
let openSeaUrlGamma = ''
if (ntwk.config.chainOpenSeaBaseUrl === '') {
openSeaUrlGamma = `${ntwk.config.chainNftUrl}`
} else {
openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${alphaContract.address}`
}
setOpenSeaUrl(openSeaUrlGamma)
}
}, [getCurrentNetwork, alphaContract])
Expand Down
7 changes: 6 additions & 1 deletion src/sections/Gamma/GammaCardInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ const GammaCardInfo = (props) => {
useEffect(() => {
const ntwk = getCurrentNetwork()
if (ntwk) {
const openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${gammaCardsContract.address}`
let openSeaUrlGamma = ''
if (ntwk.config.chainOpenSeaBaseUrl === '') {
openSeaUrlGamma = `${ntwk.config.chainNftUrl}`
} else {
openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${gammaCardsContract.address}`
}
setOpenSeaUrl(openSeaUrlGamma)
}
}, [getCurrentNetwork, gammaCardsContract])
Expand Down

0 comments on commit bfcd848

Please sign in to comment.