Skip to content

Commit

Permalink
refactor: improve map name
Browse files Browse the repository at this point in the history
  • Loading branch information
EresDev committed Feb 14, 2025
1 parent 7a63299 commit 602cc79
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cypress/scripts/funding.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable sonarjs/no-duplicate-string */
import { SpawnSyncOptionsWithStringEncoding, spawnSync } from "child_process";
import { networkToCardMintTokens } from "../../shared/constants";
import { networkToCardMinterToken } from "../../shared/constants";

/**
* Handles the async funding of the testing environment
Expand All @@ -17,7 +17,7 @@ class TestFunder {
fundingWallet = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8";
beneficiary = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
permit2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
rewardToken = networkToCardMintTokens[100];
rewardToken = networkToCardMinterToken[100];
whale = "0xefC0e701A824943b469a694aC564Aa1efF7Ab7dd";
expected = {
allowance: "999999999999999111119999999999999999",
Expand Down
6 changes: 3 additions & 3 deletions functions/post-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { verifyMessage } from "@ethersproject/wallet";
import { BigNumber } from "ethers";
import { PostOrderParams, postOrderParamsSchema } from "../shared/api-types";
import {
networkToCardMintTokens,
networkToCardMinterToken,
giftCardTreasuryAddress,
permit2Address,
permitAllowedChainIds,
Expand Down Expand Up @@ -319,12 +319,12 @@ function validatePermitTransaction(
return wrongContractErr;
}

if (txParsed.args.permit[0].token.toLowerCase() != networkToCardMintTokens[postOrderParams.chainId].toLowerCase()) {
if (txParsed.args.permit[0].token.toLowerCase() != networkToCardMinterToken[postOrderParams.chainId].toLowerCase()) {
console.error(
"Given transaction hash is not transferring the required ERC20 token.",
JSON.stringify({
transferredToken: txParsed.args.permit[0].token,
requiredToken: networkToCardMintTokens[postOrderParams.chainId],
requiredToken: networkToCardMinterToken[postOrderParams.chainId],
})
);
return wrongContractErr;
Expand Down
2 changes: 1 addition & 1 deletion shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const ubiquityDollarChainAddresses: Record<number, string> = {
31337: "0x0F644658510c95CB46955e55D7BA9DDa9E9fBEc6",
};

export const networkToCardMintTokens: Record<number, string> = {
export const networkToCardMinterToken: Record<number, string> = {
1: "0xb6919Ef2ee4aFC163BC954C5678e2BB570c2D103",
100: "0xC6ed4f520f6A4e4DC27273509239b7F8A68d2068",
31337: "0xC6ed4f520f6A4e4DC27273509239b7F8A68d2068",
Expand Down
4 changes: 2 additions & 2 deletions static/scripts/rewards/gift-cards/mint/mint-action.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from "ethers";
import { giftCardTreasuryAddress, permit2Address, networkToCardMintTokens } from "../../../../../shared/constants";
import { giftCardTreasuryAddress, permit2Address, networkToCardMinterToken } from "../../../../../shared/constants";
import { isClaimableForAmount } from "../../../../../shared/pricing";
import { GiftCard } from "../../../../../shared/types";
import { permit2Abi } from "../../abis";
Expand All @@ -25,7 +25,7 @@ export function attachMintAction(giftCard: GiftCard, app: AppState) {

if (!isErc20Permit(app.reward)) {
toaster.create("error", "Only ERC20 permits are allowed to claim a card.");
} else if (app.reward.tokenAddress.toLowerCase() !== networkToCardMintTokens[app.reward.networkId].toLowerCase()) {
} else if (app.reward.tokenAddress.toLowerCase() !== networkToCardMinterToken[app.reward.networkId].toLowerCase()) {
toaster.create("error", "Payment card can be minted only with a UUSD reward permit.");
} else if (!isClaimableForAmount(giftCard, app.reward.amount)) {
toaster.create("error", "Your reward amount is not equal to the price of available card.");
Expand Down

0 comments on commit 602cc79

Please sign in to comment.