Skip to content

Commit

Permalink
fix: fetch offchain contract just if the FF is ON (#2267)
Browse files Browse the repository at this point in the history
* fix: fetch offchain contract just if the FF is ON

* feat: remove console.log
  • Loading branch information
juanmahidalgo authored Jul 11, 2024
1 parent 28863a3 commit e51db0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions webapp/src/components/BidPage/BidModal/BidModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const BidModal = (props: Props) => {
network: asset.network
})

const offchainBidsContract = getDecentralandContract(ContractName.OffChainMarketplace, asset.chainId)
const offchainBidsContract = isBidsOffchainEnabled ? getDecentralandContract(ContractName.OffChainMarketplace, asset.chainId) : null

if (!wallet || !mana || !bids) {
return null
Expand All @@ -67,10 +67,10 @@ const BidModal = (props: Props) => {
onClearBidError()
onAuthorizedAction({
targetContractName: ContractName.MANAToken,
authorizedAddress: isBidsOffchainEnabled ? offchainBidsContract.address : bids.address,
authorizedAddress: isBidsOffchainEnabled && !!offchainBidsContract ? offchainBidsContract.address : bids.address,
targetContract: mana as Contract,
authorizationType: AuthorizationType.ALLOWANCE,
authorizedContractLabel: isBidsOffchainEnabled ? offchainBidsContract.name : bids.label || bids.name,
authorizedContractLabel: isBidsOffchainEnabled && !!offchainBidsContract ? offchainBidsContract.name : bids.label || bids.name,
requiredAllowanceInWei: ethers.utils.parseEther(price).toString(),
onAuthorized: handlePlaceBid
})
Expand Down

0 comments on commit e51db0a

Please sign in to comment.