Compare commits

..

No commits in common. "61df3f063aeeca61b00d6462047ad7a14db244d3" and "1a37fe29f246dedadd00f0521e479dc0be1d233e" have entirely different histories.

33 changed files with 791 additions and 1631 deletions

View File

@ -1,19 +1,12 @@
###
# @LastEditors: John
# @Date: 2024-07-02 11:31:07
# @LastEditTime: 2024-07-10 15:25:12
# @Author: John
###
###
# @LastEditors: John
# @Date: 2024-06-18 10:12:21
# @LastEditTime: 2024-07-02 16:46:51
# @LastEditTime: 2024-06-24 18:25:07
# @Author: John
###
VITE_BASE_URL=
VITE_BASE_URL=http://192.168.10.167:5173/
VITE_BASE_API_URL=/dev
VITE_PARTICIPATE_CHAIN_ID=97
VITE_PURCHASED_CONTRACT_ADDRESS=0xcA03e32ab7731cD721239A7AD24f3d185e4d63CD
VITE_RECEIVE_RAMB_CONTRACT_ADDRESS=0x944fBF12c9b77BFfFA223CE1568F28820d319c2F
VITE_NETWORK_USDT_ADDRESS=0x6d528B0a62f8cDdf4B3F6961D70F4f4a18a92A0D
VITE_PURCHASED_CONTRACT_ADDRESS=0xD70762bf8682b68bd0cbbBC0cdeC81db4f00AEc6
VITE_NETWORK_USDT_ADDRESS=0xf9A18B7FC8Eb118f8Ad59fBD6eb1A181eaCb4E63
VITE_CHECK_TRANSACTION_DETAILS_URL=https://testnet.bscscan.com/

View File

@ -1,13 +1,6 @@
###
# @LastEditors: John
# @Date: 2024-07-02 11:31:07
# @LastEditTime: 2024-07-19 14:39:15
# @Author: John
###
VITE_BASE_URL=/
VITE_BASE_API_URL=
VITE_BASE_API_URL=/dev
VITE_PARTICIPATE_CHAIN_ID=56
VITE_PURCHASED_CONTRACT_ADDRESS=0xb8D623B24b6A9B7044C078B80c90B292e5b2ee13
VITE_RECEIVE_RAMB_CONTRACT_ADDRESS=0x40b07C2944390f11bc14acF89710Bd7228Aca9bE
VITE_NETWORK_USDT_ADDRESS=0x55d398326f99059fF775485246999027B3197955
VITE_PURCHASED_CONTRACT_ADDRESS=
VITE_NETWORK_USDT_ADDRESS=
VITE_CHECK_TRANSACTION_DETAILS_URL=https://bscscan.com/

View File

@ -1,13 +0,0 @@
###
# @LastEditors: John
# @Date: 2024-06-24 18:38:45
# @LastEditTime: 2024-07-18 18:43:53
# @Author: John
###
VITE_BASE_URL=http://wwwtest.exgo.pro
VITE_BASE_API_URL=http://wwwtest.exgo.pro
VITE_PARTICIPATE_CHAIN_ID=97
VITE_PURCHASED_CONTRACT_ADDRESS=0xdccBd0FbFd51dA16AEDc8b1985f3eFDA3F380944
VITE_RECEIVE_RAMB_CONTRACT_ADDRESS=0x944fBF12c9b77BFfFA223CE1568F28820d319c2F
VITE_NETWORK_USDT_ADDRESS=0x6d528B0a62f8cDdf4B3F6961D70F4f4a18a92A0D
VITE_CHECK_TRANSACTION_DETAILS_URL=https://testnet.bscscan.com/

View File

@ -1,5 +1,5 @@
{
"symbol_url": "//at.alicdn.com/t/c/font_4589567_u5yhe33hzt.js",
"symbol_url": "//at.alicdn.com/t/c/font_4589567_vzk80gocu8s.js",
"use_typescript": true,
"save_dir": "./src/components/iconfont",
"trim_icon_prefix": "icon",

View File

@ -6,7 +6,6 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build:test": "tsc && vite build --mode test",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"iconfont": "npx iconfont-h5"

View File

@ -19,7 +19,7 @@ import InvitationList from "./pages/InvitationList";
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import useUserStore from "./store/User";
import { getUrlParameterByName } from "./utils";
import { getUrlQueryParam } from "./utils";
import { UrlQueryParamsKey } from "./constants";
import { signAndLogin } from "./utils/wallet";
import { useAccount } from "wagmi";
@ -29,9 +29,7 @@ function App() {
const { address } = useAccount();
useEffect(() => {
i18n.changeLanguage(currantLang);
UpdateInviteCode(
getUrlParameterByName(UrlQueryParamsKey.INVITE_CODE) || ""
);
UpdateInviteCode(getUrlQueryParam(UrlQueryParamsKey.INVITE_CODE) || "");
return () => {};
}, []);

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-18 15:16:31
* @LastEditTime: 2024-06-26 14:49:22
* @LastEditTime: 2024-06-19 18:30:52
* @Author: John
*/
import Picker, {
@ -42,7 +42,7 @@ export default function () {
case "/levelup":
return t("级别提升");
case "/assetrecord":
return t("收益记录");
return t("资产记录");
case "/airdroprecord":
return t("RMOB记录");
case "/invitationlist":
@ -57,7 +57,7 @@ export default function () {
<div className={classes.header}>
<div className={classes.header_top}>
<img className={classes.header_logo} src={logo} alt="" />
<span className={classes.header_title}>{t("红魔股权NFT")}</span>
<span className={classes.header_title}>{t("红魔NFT")}</span>
<Popover.Menu
mode="dark"
actions={langColums}
@ -118,6 +118,48 @@ export default function () {
</div>
)}
</div>
{/*
<Picker
// title={t("选择语言")}
columns={langColums}
visible={langPickVisble}
onClose={() => {
setLangPickVisble(false);
}}
value={langPickValue}
onConfirm={(v) => {
setLangPickValue(v);
// console.log("Current lang:", v[0]);
switch (v[0]) {
case Lang.en:
i18n.changeLanguage(Lang.en);
UpdateLang(Lang.en);
break;
case Lang.cn:
i18n.changeLanguage(Lang.cn);
UpdateLang(Lang.cn);
break;
case Lang.tw:
i18n.changeLanguage(Lang.tw);
UpdateLang(Lang.tw);
break;
case Lang.jp:
i18n.changeLanguage(Lang.jp);
UpdateLang(Lang.jp);
break;
case Lang.de:
i18n.changeLanguage(Lang.de);
UpdateLang(Lang.de);
break;
default:
break;
}
// console.log("i18n lang:", i18n.language);
}}
confirmText={t("确定")}
cancelText={t("取消")}
/> */}
</>
);
}

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-17 18:01:43
* @LastEditTime: 2024-06-24 18:51:52
* @LastEditTime: 2024-06-17 18:16:57
* @Author: John
*/
/*
@ -39,10 +39,9 @@ const metadata = {
icons: [`${import.meta.env.BASE_URL}/favicon.svg`],
};
let chains =
import.meta.env.DEV || import.meta.env.MODE == "test"
? ([bnbTestNetwork] as const)
: ([bsc] as const);
let chains = import.meta.env.PROD
? ([bsc] as const)
: ([bnbTestNetwork] as const);
export const config = defaultWagmiConfig({
chains, // required

View File

@ -1,33 +0,0 @@
/* tslint:disable */
/* eslint-disable */
import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react';
import { getIconColor } from './helper';
interface Props extends Omit<SVGAttributes<SVGElement>, 'color'> {
size?: number;
color?: string | string[];
}
const DEFAULT_STYLE: CSSProperties = {
display: 'block',
};
const IconTransfer: FunctionComponent<Props> = ({ size = 18, color, style: _style, ...rest }) => {
const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE;
return (
<svg viewBox="0 0 1024 1024" width={size + 'px'} height={size + 'px'} style={style} {...rest}>
<path
d="M85.346462 170.653538c0-47.104 38.203077-85.307077 85.307076-85.307076H512c47.143385 0 85.346462 38.203077 85.346462 85.307076v170.692924c0 47.104-38.203077 85.307077-85.346462 85.307076H170.653538a85.346462 85.346462 0 0 1-85.307076-85.307076V170.653538zM426.653538 682.653538c0-47.104 38.203077-85.307077 85.346462-85.307076h341.346462c47.104 0 85.307077 38.203077 85.307076 85.307076v170.692924c0 47.104-38.203077 85.307077-85.307076 85.307076H512a85.346462 85.346462 0 0 1-85.346462-85.307076v-170.692924z"
fill={getIconColor(color, 0, '#666666')}
/>
<path
d="M879.064615 287.980308l-30.72 30.72a32.019692 32.019692 0 0 0 45.292308 45.292307l55.138462-55.177846c29.184-29.144615 29.184-76.445538 0-105.629538l-55.138462-55.138462a32.019692 32.019692 0 0 0-45.292308 45.252923l30.72 30.72h-196.411077a32.019692 32.019692 0 0 0 0 63.960616h196.450462zM144.935385 799.980308l30.72 30.72a32.019692 32.019692 0 0 1-45.292308 45.292307l-55.138462-55.177846c-29.184-29.144615-29.184-76.445538 0-105.629538l55.138462-55.138462a32.019692 32.019692 0 0 1 45.292308 45.252923l-30.72 30.72h196.411077a32.019692 32.019692 0 0 1 0 63.960616H144.896z"
fill={getIconColor(color, 1, '#FFFFFF')}
/>
</svg>
);
};
export default IconTransfer;

View File

@ -2,7 +2,6 @@
/* eslint-disable */
import React, { SVGAttributes, FunctionComponent } from 'react';
import IconTransfer from './IconTransfer';
import IconDiqiu from './IconDiqiu';
import IconTuichu from './IconTuichu';
import IconChevronsrightshuangyoujiantou from './IconChevronsrightshuangyoujiantou';
@ -12,7 +11,6 @@ import IconTongdun from './IconTongdun';
import IconJindun from './IconJindun';
import IconXingdun from './IconXingdun';
import IconGuanjun from './IconGuanjun';
export { default as IconTransfer } from './IconTransfer';
export { default as IconDiqiu } from './IconDiqiu';
export { default as IconTuichu } from './IconTuichu';
export { default as IconChevronsrightshuangyoujiantou } from './IconChevronsrightshuangyoujiantou';
@ -23,7 +21,7 @@ export { default as IconJindun } from './IconJindun';
export { default as IconXingdun } from './IconXingdun';
export { default as IconGuanjun } from './IconGuanjun';
export type IconNames = 'transfer' | 'diqiu' | 'tuichu' | 'chevronsrightshuangyoujiantou' | 'fuzhi' | 'icon_arrow_left' | 'tongdun' | 'jindun' | 'xingdun' | 'guanjun';
export type IconNames = 'diqiu' | 'tuichu' | 'chevronsrightshuangyoujiantou' | 'fuzhi' | 'icon_arrow_left' | 'tongdun' | 'jindun' | 'xingdun' | 'guanjun';
interface Props extends Omit<SVGAttributes<SVGElement>, 'color'> {
name: IconNames;
@ -33,8 +31,6 @@ interface Props extends Omit<SVGAttributes<SVGElement>, 'color'> {
const IconFont: FunctionComponent<Props> = ({ name, ...rest }) => {
switch (name) {
case 'transfer':
return <IconTransfer {...rest} />;
case 'diqiu':
return <IconDiqiu {...rest} />;
case 'tuichu':

View File

@ -1,43 +1,9 @@
[
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "paymentType",
"type": "uint256"
},
{
"internalType": "string",
"name": "NFTURI",
"type": "string"
}
],
"name": "buyEquityNFT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "EquityNFTAddr",
"name": "hongMoAddr",
"type": "address"
},
{
@ -49,6 +15,11 @@
"internalType": "address",
"name": "p1",
"type": "address"
},
{
"internalType": "address",
"name": "p2",
"type": "address"
}
],
"stateMutability": "nonpayable",
@ -102,12 +73,6 @@
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "paymentType",
"type": "uint256"
}
],
"name": "BuySuccess",
@ -132,6 +97,169 @@
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "buyAddr",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "RewardSuccess",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "buyAddr",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "UpgradeRange",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "paymentType",
"type": "uint256"
}
],
"name": "buyHMNFT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "getOrderStatus",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "hongMoNFT",
"outputs": [
{
"internalType": "contract HongMoNFT",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "payee1",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "payee2",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "price",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
@ -167,55 +295,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
},
{
"internalType": "string",
"name": "NFTURI",
"type": "string"
}
],
"name": "rewardNFT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "buyAddr",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "RewardSuccess",
"type": "event"
},
{
"inputs": [
{
@ -235,6 +314,11 @@
"internalType": "address",
"name": "a",
"type": "address"
},
{
"internalType": "address",
"name": "b",
"type": "address"
}
],
"name": "setPayeeAddress",
@ -255,6 +339,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
}
],
"name": "setTokenIndex",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
@ -268,6 +365,51 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "source",
"type": "string"
}
],
"name": "stringToBytes32",
"outputs": [
{
"internalType": "bytes32",
"name": "result",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "tokenIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
@ -299,135 +441,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "buyAddr",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "UpgradeRange",
"type": "event"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "EquityNFT",
"outputs": [
{
"internalType": "contract RedDevilEquityNFT",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "getOrderStatus",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "payee1",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "price",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "tokenIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "usdc",

View File

@ -1,101 +1,10 @@
[
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "_decimals",
"name": "name",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "_name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
@ -104,65 +13,21 @@
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "_symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "spender",
"name": "_spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
@ -173,17 +38,10 @@
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
@ -196,15 +54,21 @@
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "burn",
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
@ -219,7 +83,6 @@
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
@ -229,139 +92,30 @@
"type": "function"
},
{
"constant": false,
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "spender",
"name": "_owner",
"type": "address"
},
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "subtractedValue",
"name": "balance",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getOwner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "mint",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
@ -371,12 +125,43 @@
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
@ -386,75 +171,52 @@
"type": "function"
},
{
"constant": false,
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"internalType": "address",
"name": "recipient",
"indexed": true,
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
"name": "Approval",
"type": "event"
},
{
"constant": false,
"anonymous": false,
"inputs": [
{
"internalType": "address",
"name": "sender",
"indexed": true,
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"indexed": true,
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
"name": "Transfer",
"type": "event"
}
]

View File

@ -1,192 +0,0 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "payAddr",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "OwnableInvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "OwnableUnauthorizedAccount",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "buyAddr",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "RewardSuccess",
"type": "event"
},
{
"inputs": [],
"name": "R_MAB",
"outputs": [
{
"internalType": "contract IERC20",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
}
],
"name": "getOrderStatus",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "paymentTime",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "hashStr",
"type": "bytes32"
}
],
"name": "reward",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
}
],
"name": "setUSDCAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-19 15:48:57
* @LastEditTime: 2024-07-19 14:09:28
* @LastEditTime: 2024-06-24 18:25:44
* @Author: John
*/
import { config } from "@/components/WalletProvider";
@ -16,10 +16,8 @@ import { encodeFunctionData } from "viem/utils";
import erc20Abi from "@/contract/abi/erc20abi.json";
import usdtAbi from "@/contract/abi/USDT.json";
import RedDevilsAbi from "@/contract/abi/RedDevils.json";
import receiveAbi from "@/contract/abi/receive.json";
import i18next from "i18next";
import { BaseError } from "wagmi";
import { UserIncome } from "@/server/module";
/**
* @description
@ -167,15 +165,14 @@ export async function payByContract(
if (approvedU < amount) {
await authorizedU(amount);
}
const NFTURI =
"https://gateway.lighthouse.storage/ipfs/bafkreicjdund46333jhrj556kkdsi7bqupyt2qi3lmylmtxcfiw7f2afe4";
console.log("参数:", amount, orderID, payInduction, NFTURI);
console.log("参数:", amount, orderID, payInduction);
estimateGas(config, {
to: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS,
data: encodeFunctionData({
abi: RedDevilsAbi,
functionName: "buyEquityNFT",
args: [amount, orderID, payInduction, NFTURI],
functionName: "buyHMNFT",
args: [amount, orderID, payInduction],
}),
})
.then((gas) => {
@ -184,8 +181,8 @@ export async function payByContract(
writeContract(config, {
abi: RedDevilsAbi,
address: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS,
functionName: "buyEquityNFT",
args: [amount, orderID, payInduction, NFTURI],
functionName: "buyHMNFT",
args: [amount, orderID, payInduction],
gas: gasPrice,
})
.then((receipt) => {
@ -193,18 +190,17 @@ export async function payByContract(
reslove(receipt);
})
.catch((err: BaseError) => {
console.log("buyEquityNFT Transaction err", err);
console.log("buyHMNFT Transaction err", err);
reject(err);
});
})
.catch((err: BaseError) => {
console.log("buyEquityNFT estimateGas err", err);
console.log("buyHMNFT estimateGas err", err);
reject(err);
});
} catch (err) {
console.log("pay By Contract catch err", err);
if (typeof err == "string") return reject(new BaseError(`${err}`));
return reject(err);
reject(new BaseError(`${err}`));
}
});
}
@ -273,79 +269,35 @@ export async function upGradeByContract(amount: bigint, orderID: string) {
}
/**
* receiveRMABByContract
* receiveByContract
* @param amount
* @param paymentTime
* @param orderID
* @param hashStr
* @returns
*/
export async function receiveRMABByContract(
export async function receiveByContract(
amount: bigint,
paymentTime: number,
orderID: string,
hashStr: string
) {
console.log("pay buy contract params", { amount, orderID });
console.log("NETWORK_USDT:", import.meta.env.VITE_NETWORK_USDT_ADDRESS);
return new Promise<string>(async (reslove, reject) => {
try {
console.log("参数:", amount, paymentTime, orderID, hashStr);
estimateGas(config, {
to: import.meta.env.VITE_RECEIVE_RAMB_CONTRACT_ADDRESS,
data: encodeFunctionData({
abi: receiveAbi,
functionName: "reward",
args: [amount, paymentTime, orderID, hashStr],
}),
})
.then((gas) => {
const gasPrice = (gas * 12n) / 10n;
console.log("estimate gas:%d , my gas: %d", gas, gasPrice);
writeContract(config, {
abi: receiveAbi,
address: import.meta.env.VITE_RECEIVE_RAMB_CONTRACT_ADDRESS,
functionName: "reward",
args: [amount, paymentTime, orderID, hashStr],
gas: gasPrice,
})
.then((receipt) => {
console.log("write contract success!, receipt:", receipt);
reslove(receipt);
})
.catch((err: BaseError) => {
console.log("reward rmab Transaction err", err);
reject(err);
});
})
.catch((err: BaseError) => {
console.log("reward rmab estimateGas err", err);
reject(err);
});
} catch (err) {
reject(new BaseError(`${err}`));
}
});
const balance = await getBalance();
if (balance < amount) {
console.log("用户代币余额不足");
reject(new BaseError(i18next.t("余额不足")));
return;
}
/**
* receiveUSDTByContract
* @param amount
* @param paymentTime
* @param orderID
* @param hashStr
* @returns
*/
export async function receiveUSDTByContract(
amount: bigint,
paymentTime: number,
orderID: string,
hashStr: string
) {
console.log("pay buy contract params", { amount, orderID });
console.log("当前要授权的U:", amount);
let approvedU = await getApproveUsdt();
if (approvedU < amount) {
await authorizedU(amount);
}
return new Promise<string>(async (reslove, reject) => {
try {
console.log("参数:", amount, paymentTime, orderID, hashStr);
estimateGas(config, {
to: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS,
@ -383,26 +335,3 @@ export async function receiveUSDTByContract(
}
});
}
/**
* receiveByContract
* @param type
* @param amount
* @param paymentTime
* @param orderID
* @param hashStr
* @returns
*/
export async function receiveByContract(
type: UserIncome["coinId"],
amount: bigint,
paymentTime: number,
orderID: string,
hashStr: string
) {
if (type == 1) {
return receiveUSDTByContract(amount, paymentTime, orderID, hashStr);
} else if (type == 2) {
return receiveRMABByContract(amount, paymentTime, orderID, hashStr);
}
}

View File

@ -1,9 +1,9 @@
{
"AppName": "红魔",
"红魔股权NFT": "红魔股权NFT",
"红魔NFT": "红魔NFT",
"铸造 NFT": "铸造 NFT",
"级别提升": "级别提升",
"收益记录": "收益记录",
"资产记录": "资产记录",
"RMOB记录": "RMOB记录",
"直推列表": "直推列表",
"返回": "返回",
@ -16,10 +16,10 @@
"邀请铸造": "邀请铸造",
"团队社长": "团队社长",
"邀请空投": "邀请空投",
"收益": "收益",
"代币": "代币",
"Min结束后按照规则进行空投。": "Min结束后按照规则进行空投。",
"铸造 NFT 获得代币空投": "铸造 NFT 获得代币空投",
"总收益= 已领取 + 待领取": "总收益= 已领取 + 待领取",
"资产金额 = 已领取 + 待处理": "资产金额 = 已领取 + 待处理",
"邀请": "邀请",
"邀请链接": "邀请链接",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。",
@ -42,7 +42,7 @@
"提升级别": "提升级别",
"社长": "社长",
"当前升级价格:": "当前升级价格:",
"升级费用xxx USDT起50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "升级费用{{value1}} USDT起50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始,每升级一名社长所需铸造费用增加{{value2}},既第二位社长升级铸造费用为{{value1}}u+{{value1}}*{{value2}}={{value3}} USDT以此类推。",
"升级费用xxx USDT起其中gas费2USDT剩余部分50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "升级费用{{value1}} USDT起其中gas费2USDT剩余部分50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始,每升级一名社长所需铸造费用增加{{value2}},既第二位社长升级铸造费用为{{value1}}u+{{value1}}*{{value2}}={{value3}} USDT以此类推。",
"升级条件": "升级条件",
"普通会员": "普通会员",
"(限量xxx个)": "(限量 {{value}} 个)",
@ -101,13 +101,5 @@
"正在获取已授权金额": "正在获取已授权金额",
"升级成功,返回首页查看": "升级成功,返回首页查看",
"无级别提升": "无级别提升",
"没有更多数据了": "没有更多数据了",
"升级中": "升级中",
"无等级": "无等级",
"无效的邀请链接": "无效的邀请链接",
"交易红魔股权NFT": "交易红魔股权NFT",
"上级链接": "上级链接",
"邀请链接:": "邀请链接:",
"上级地址:": "上级地址:"
"没有更多数据了": "没有更多数据了"
}

View File

@ -1,9 +1,9 @@
{
"AppName": "Der Rote Teufel",
"红魔股权NFT": "Red Devils Equity NFT",
"红魔NFT": "Der Rote Teufel NFT",
"铸造 NFT": "NFT Prägen",
"级别提升": "Stufenaufstieg",
"收益记录": "Ergebnisrekord",
"资产记录": "Vermögensaufzeichnung",
"RMOB记录": "RMOB Aufzeichnung",
"直推列表": "Direktempfehlungsliste",
"返回": "Zurück",
@ -16,10 +16,10 @@
"邀请铸造": "Prägen einladen",
"团队社长": "Teamleiter",
"邀请空投": "Airdrop einladen",
"收益": "Einkommen",
"代币": "Token",
"Min结束后按照规则进行空投。": "Airdrop nach dem Ende des Min gemäß den Regeln.",
"铸造 NFT 获得代币空投": "Token-Airdrop durch NFT-Prägung erhalten",
"总收益= 已领取 + 待领取": "Gesamtumsatz = Empfang + Abzuholen",
"资产金额 = 已领取 + 待处理": "Vermögenswert = Empfang + Ausstehend",
"邀请": "Einladen",
"邀请链接": "Einladungslink",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "Normale Mitglieder erhalten für jede Einladung zur Prägung eines NFTs einen Airdrop-Bonus; 20 empfohlene Prägungen führen zum Aufstieg zum Vorsitzenden; 20 Vorsitzende im Team ermöglichen den Aufstieg zum Fundmanager; je mehr Einladungen, desto höher das Level und die Belohnungen.",
@ -42,7 +42,7 @@
"提升级别": "Levelaufstieg",
"社长": "Vorsitzender",
"当前升级价格:": "Aktueller Upgrade-Preis:",
"升级费用xxx USDT起50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "Upgrade-Kosten ab {{value1}} USDT, 50% des Restbetrags gehen in den Liquiditätspool und die anderen 50% werden auf alle erfolgreichen Vorsitzenden und Fundmanager aufgeteilt. Ab dem zweiten Vorsitzenden steigen die Prägekosten um {{value2}} pro Aufstieg, also {{value1}}u+{{value1}}*{{value2}}={{value3}} USDT für den zweiten, usw.",
"升级费用xxx USDT起其中gas费2USDT剩余部分50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "Upgrade-Kosten ab {{value1}} USDT, davon 2USDT Gas-Gebühren, 50% des Restbetrags gehen in den Liquiditätspool und die anderen 50% werden auf alle erfolgreichen Vorsitzenden und Fundmanager aufgeteilt. Ab dem zweiten Vorsitzenden steigen die Prägekosten um {{value2}} pro Aufstieg, also {{value1}}u+{{value1}}*{{value2}}={{value3}} USDT für den zweiten, usw.",
"升级条件": "Upgrade-Bedingungen",
"普通会员": "Normales Mitglied",
"(限量xxx个)": "(Begrenzt auf {{value}} Stück)",
@ -101,12 +101,5 @@
"正在获取已授权金额": "Aktuell wird der autorisierte Betrag abgerufen.",
"升级成功,返回首页查看": "Upgrade erfolgreich abgeschlossen, zurück zur Startseite zur Ansicht.",
"无级别提升": "Beförderung ohne Rang",
"没有更多数据了": "Keine weiteren Daten",
"升级中": "Wird aktualisiert",
"无等级": "Keine Bewertung",
"无效的邀请链接": "Ungültiger Einladungslink",
"交易红魔股权NFT": "Handel mit Red Devil Equity NFT",
"上级链接": "Link des Vorgesetzten",
"邀请链接:": "Einladungslink:",
"上级地址:": "Adresse des Vorgesetzten:"
"没有更多数据了": "Keine weiteren Daten"
}

View File

@ -1,9 +1,9 @@
{
"AppName": "Red Devils",
"红魔股权NFT": "Red Devil Equity NFT",
"红魔NFT": "Red Devils NFT",
"铸造 NFT": "Mint NFT",
"级别提升": "Level Up",
"收益记录": "Revenue Record",
"资产记录": "Asset Records",
"RMOB记录": "RMOB Records",
"直推列表": "Direct Referral List",
"返回": "Back",
@ -16,10 +16,10 @@
"邀请铸造": "Invite to Mint",
"团队社长": "Team Leader",
"邀请空投": "Invite Airdrop",
"收益": "Income",
"代币": "Token",
"Min结束后按照规则进行空投。": "Airdrop will follow the rules after Min ends.",
"铸造 NFT 获得代币空投": "Mint NFT for Token Airdrop",
"总收益= 已领取 + 待领取": "Total Revenue = Claimed + Pending",
"资产金额 = 已领取 + 待处理": "Asset Amount = Claimed + Pending",
"邀请": "Invite",
"邀请链接": "Invite Link",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "Regular members get an airdrop for each NFT minted through their invite; recommending 20 NFTs upgrades to Leader; having 20 Leaders in the team upgrades to Foundation Leader; more invites lead to higher levels and more benefits.",
@ -36,13 +36,13 @@
"当前MINT价格": "Current MINT Price:",
"价格说明:": "Price Explanation:",
"{{value1}} USDT起每增加 {{value2}} 名普通会员NFT价格上涨 {{value3}},既:前 {{value2}} 名价格为 {{value1}} USDT/枚value4 名价格为{{value1}}u+{{value1}}u*{{value3}}={{value5}} USDT/枚,以此类推。": "Starting at {{value1}} USDT, the NFT price increases by {{value3}} for every {{value2}} new members: first {{value2}} at {{value1}} USDT each, {{value4}} at {{value1}}u+{{value1}}u*{{value3}}={{value5}} USDT each, and so on.",
"授权USDT": "Approve USDT",
"授权USDT": "Authorize USDT",
"当前级别": "Current Level",
"普通活跃": "Active Member",
"提升级别": "Upgrade Level",
"社长": "Leader",
"当前升级价格:": "Current Upgrade Price:",
"升级费用xxx USDT起50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "Upgrade cost starts at {{value1}} USDT, 50% goes to the fund pool, and 50% is distributed among successful Leaders and Foundation Leaders. From the second Leader onwards, each upgrade cost increases by {{value2}}, i.e., second Leader upgrade costs {{value1}}u+{{value1}}*{{value2}}={{value3}} USDT, and so on.",
"升级费用xxx USDT起其中gas费2USDT剩余部分50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "Upgrade cost starts at {{value1}} USDT, including 2USDT gas fee; 50% goes to the fund pool, and 50% is distributed among successful Leaders and Foundation Leaders. From the second Leader onwards, each upgrade cost increases by {{value2}}, i.e., second Leader upgrade costs {{value1}}u+{{value1}}*{{value2}}={{value3}} USDT, and so on.",
"升级条件": "Upgrade Conditions",
"普通会员": "Regular Member",
"(限量xxx个)": "(Limited to {{value}})",
@ -96,17 +96,10 @@
"正在授权USDT": "Authorizing USDT",
"购买中": "Purchasing",
"领取中": "Processing",
"MINT Nft 获取邀请链接": "Mint NFT to get invitation link",
"MINT Nft 获取邀请链接": "MINT Nft invite link",
"链接钱包获取邀请链接": "Link your wallet to get the invitation link.",
"正在获取已授权金额": "Currently retrieving authorized amount.",
"升级成功,返回首页查看": "Upgrade successful, return to homepage to view.",
"无级别提升": "Promotion without rank",
"没有更多数据了": "No more data",
"升级中": "Upgrading",
"无等级": "No Grade",
"无效的邀请链接": "Invalid invitation link",
"交易红魔股权NFT": "Trade Red Devil Equity NFT",
"上级链接": "Superior's Link",
"邀请链接:": "Invitation Link:",
"上级地址:": "Superior's Address:"
"没有更多数据了": "No more data"
}

View File

@ -1,9 +1,9 @@
{
"AppName": "紅魔",
"红魔股权NFT": "レッドデビルズ株式NFT",
"红魔NFT": "紅魔NFT",
"铸造 NFT": "NFT 鋳造",
"级别提升": "レベルアップ",
"收益记录": "収益実績",
"资产记录": "資産記録",
"RMOB记录": "RMOB記録",
"直推列表": "ダイレクト推薦リスト",
"返回": "戻る",
@ -16,10 +16,10 @@
"邀请铸造": "鋳造を招待",
"团队社长": "チームリーダー",
"邀请空投": "エアドロップ招待",
"收益": "所得",
"代币": "トークン",
"Min结束后按照规则进行空投。": "Min終了後、ルールに従ってエアドロップを行います。",
"铸造 NFT 获得代币空投": "NFTを鋳造してトークンエアドロップを獲得",
"总收益= 已领取 + 待领取": "総収入 = 受領済み + 回収対象",
"资产金额 = 已领取 + 待处理": "資産額 = 受領済み + 処理中",
"邀请": "招待",
"邀请链接": "招待リンク",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "一般会員はNFT鋳造の招待ごとにエアドロップを獲得20個のNFTを鋳造することでリーダーに昇格チーム内に20人のリーダーがいるとファンドリーダーに昇格招待が多いほどレベルが上がり、特典が増える。",
@ -42,7 +42,7 @@
"提升级别": "レベルアップ",
"社长": "リーダー",
"当前升级价格:": "現在のアップグレード価格:",
"升级费用xxx USDT起50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "アップグレード費用は{{value1}} USDTから、残りの50%は資金プールに入り、もう50%はアップグレードに成功したリーダーとファンドリーダーに分配。2人目のリーダーからは、アップグレード費用が{{value2}}ずつ増加、つまり2人目は{{value1}}u+{{value1}}*{{value2}}={{value3}} USDT、以降も同様。",
"升级费用xxx USDT起其中gas费2USDT剩余部分50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "アップグレード費用は{{value1}} USDTから、うちガス代2USDT、残りの50%は資金プールに入り、もう50%はアップグレードに成功したリーダーとファンドリーダーに分配。2人目のリーダーからは、アップグレード費用が{{value2}}ずつ増加、つまり2人目は{{value1}}u+{{value1}}*{{value2}}={{value3}} USDT、以降も同様。",
"升级条件": "アップグレード条件",
"普通会员": "一般会員",
"(限量xxx个)": "(限定 {{value}} 個)",
@ -101,13 +101,5 @@
"正在获取已授权金额": "承認済み金額を取得中です",
"升级成功,返回首页查看": "アップグレードが成功しました。ホームページに戻って確認してください。",
"无级别提升": "階級なしの昇進",
"没有更多数据了": "これ以上のデータはありません",
"升级中": "アップグレード中",
"无等级": "グレードなし",
"无效的邀请链接": "無効な招待リンクです",
"交易红魔股权NFT": "レッドデビル株式NFTを取引する",
"上级链接": "上司のリンク",
"邀请链接:": "招待リンク:",
"上级地址:": "上司の住所:"
"没有更多数据了": "これ以上のデータはありません"
}

View File

@ -1,9 +1,9 @@
{
"AppName": "紅魔",
"红魔股权NFT": "紅魔鬼股權NFT",
"红魔NFT": "紅魔NFT",
"铸造 NFT": "鑄造 NFT",
"级别提升": "級別提升",
"收益记录": "收益記錄",
"资产记录": "資產記錄",
"RMOB记录": "RMOB記錄",
"直推列表": "直推列表",
"返回": "返回",
@ -16,10 +16,10 @@
"邀请铸造": "邀請鑄造",
"团队社长": "團隊社長",
"邀请空投": "邀請空投",
"收益": "收益",
"代币": "代幣",
"Min结束后按照规则进行空投。": "Min結束後按照規則進行空投。",
"铸造 NFT 获得代币空投": "鑄造 NFT 獲得代幣空投",
"总收益= 已领取 + 待领取": "總收益 = 已領取 + 待領取",
"资产金额 = 已领取 + 待处理": "資產金額 = 已領取 + 待處理",
"邀请": "邀請",
"邀请链接": "邀請鏈接",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "普通會員每邀請鑄造一個NFT可獲得一份空投福利推薦鑄造20個NFT的可升級為會長團隊中擁有20位會長可升級為基金會社長邀請越多級別越高福利越多。",
@ -42,7 +42,7 @@
"提升级别": "提升級別",
"社长": "社長",
"当前升级价格:": "當前升級價格:",
"升级费用xxx USDT起50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "升級費用{{value1}} USDT起50%進入資金池另外50%平均分給所有升級成功的社長和基金會社長。自第二個社長升級開始,每升級一名社長所需鑄造費用增加{{value2}},即第二位社長升級鑄造費用為{{value1}}u+{{value1}}*{{value2}}={{value3}} USDT以此類推。",
"升级费用xxx USDT起其中gas费2USDT剩余部分50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。": "升級費用{{value1}} USDT起其中gas費2USDT剩餘部分50%進入資金池另外50%平均分給所有升級成功的社長和基金會社長。自第二個社長升級開始,每升級一名社長所需鑄造費用增加{{value2}},即第二位社長升級鑄造費用為{{value1}}u+{{value1}}*{{value2}}={{value3}} USDT以此類推。",
"升级条件": "升級條件",
"普通会员": "普通會員",
"(限量xxx个)": "(限量 {{value}} 個)",
@ -101,13 +101,5 @@
"正在获取已授权金额": "正在取得已授權金額",
"升级成功,返回首页查看": "升級成功,返回首頁查看。",
"无级别提升": "無級別提升",
"没有更多数据了": "沒有更多數據了",
"升级中": "升級中",
"无等级": "無等級",
"无效的邀请链接": "無效的邀請連結",
"交易红魔股权NFT": "交易紅魔股權NFT",
"上级链接": "上級鏈接",
"邀请链接:": "邀請鏈接:",
"上级地址:": "上級地址:"
"没有更多数据了": "沒有更多數據了"
}

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-17 17:20:03
* @LastEditTime: 2024-07-02 11:38:25
* @LastEditTime: 2024-06-20 11:43:14
* @Author: John
*/
import "@/i18n/init.ts";
@ -15,9 +15,9 @@ import EventBusProvider from "./context/EventBusContext.tsx";
import { WalletProvider } from "./components/WalletProvider.tsx";
import flexible from "./utils/flexible.ts";
import VConsole from "vconsole";
import { getUrlParameterByName } from "./utils/index.ts";
import { getUrlQueryParam } from "./utils/index.ts";
if (getUrlParameterByName("vconsole") === "1") {
if (getUrlQueryParam("vconsole") === "1") {
new VConsole();
}
flexible(window, document);

View File

@ -1,12 +1,12 @@
/*
* @LastEditors: John
* @Date: 2024-06-18 17:57:13
* @LastEditTime: 2024-07-02 17:43:52
* @LastEditTime: 2024-06-24 10:44:10
* @Author: John
*/
import Tabs from "antd-mobile/es/components/tabs";
import classes from "./AssetRecord.module.css";
import { cn, getUrlParameterByName } from "@/utils";
import { cn, getUrlQueryParam } from "@/utils";
import CapsuleTabs from "antd-mobile/es/components/capsule-tabs";
import RecordsItem from "@/components/RecordsItem";
import { useTranslation } from "react-i18next";
@ -14,12 +14,13 @@ import { useEffect, useMemo, useRef, useState } from "react";
import { api_pagling_query_income_record } from "@/server/api";
import { IncomeRecord, IncomeRecordType } from "@/server/module";
import { Empty, InfiniteScroll } from "antd-mobile";
import { CoinName } from "@/constants";
export default function () {
const { t } = useTranslation();
const id = useMemo(() => getUrlParameterByName("id"), []);
const coinId = useMemo(() => getUrlParameterByName("coinId"), []);
const currentType = useRef<1 | 2>(2);
const coinId = useMemo(() => getUrlQueryParam("id"), []);
const coinName = useMemo(() => getUrlQueryParam("name"), []);
const currentType = useRef<1 | 2>(1);
const [issueRecords, setIssueRecords] = useState<IncomeRecord["records"]>([]);
const [receiveRecord, setReceiveRecord] = useState<IncomeRecord["records"]>(
[]
@ -30,11 +31,11 @@ export default function () {
const hasMore = useRef<boolean>(true);
useEffect(() => {
return () => {};
}, []);
}, [coinId]);
async function getRecord() {
return new Promise<void>(async (reslove) => {
if (!id) return;
if (!coinId) return;
if (!hasMore.current) return;
@ -42,11 +43,11 @@ export default function () {
pageNum.current++;
const { data } = await api_pagling_query_income_record().send({
queryParams: {
id,
id: coinId,
type: currentType.current,
pageNum: pageNum.current,
pageSize,
...(conditions.current && currentType.current == 2
...(conditions.current && currentType.current == 1
? { status: conditions.current }
: {}),
},
@ -56,7 +57,7 @@ export default function () {
if (data.data.records.length < pageSize) hasMore.current = false;
if (currentType.current == 2) {
if (currentType.current == 1) {
setIssueRecords([...issueRecords, ...data?.data.records]);
} else {
setReceiveRecord([...receiveRecord, ...data?.data.records]);
@ -66,9 +67,9 @@ export default function () {
}
function resetPaging() {
if (currentType.current == 2) {
if (currentType.current == 1) {
setIssueRecords([]);
} else if (currentType.current == 1) {
} else if (currentType.current == 2) {
setReceiveRecord([]);
}
pageNum.current = 0;
@ -81,16 +82,16 @@ export default function () {
className={cn(classes.AssetRecord)}
onChange={(key) => {
if (parseInt(key) == 1) {
currentType.current = 2;
currentType.current = 1;
resetPaging();
} else {
currentType.current = 1;
currentType.current = 2;
resetPaging();
}
}}
>
<Tabs.Tab className={classes.tab} title={t("发放记录")} key="1">
{coinId == "1" && (
{coinName == CoinName.USDT && (
<CapsuleTabs
onChange={(key) => {
switch (key) {
@ -116,7 +117,7 @@ export default function () {
</CapsuleTabs>
)}
{coinId == "2" && (
{coinName == CoinName.RMOB && (
<CapsuleTabs
onChange={(key) => {
switch (key) {

View File

@ -204,7 +204,7 @@
flex-direction: row;
align-items: center;
li {
min-width: 76px;
width: 76px;
height: 34px;
opacity: 1;
@ -220,7 +220,6 @@
color: #4d4d4d;
text-align: center;
line-height: 34px;
padding: 0 10px;
&.nftToken_tab_active {
border-radius: 10px;
opacity: 1;
@ -586,43 +585,6 @@
}
}
.equityNft {
display: flex;
flex-direction: row;
align-items: center;
gap: 16px;
padding: 10px 15px;
border-radius: 14px;
opacity: 1;
background: #171719;
margin-top: 26px;
> svg {
width: 26px;
height: 26px;
&:nth-of-type(2) {
margin-left: auto;
}
}
span {
opacity: 1;
font-family: DM Sans;
font-size: 14px;
font-weight: 500;
line-height: normal;
letter-spacing: 0em;
font-variation-settings: "opsz" auto;
font-feature-settings: "kern" on;
color: #ffffff;
z-index: 1;
}
}
.invite {
margin-top: 25px;
.invite_top {
@ -685,8 +647,7 @@
margin-top: 10px;
> span {
&:nth-of-type(1),
&:nth-of-type(3) {
&:nth-of-type(1) {
/* 自动布局子元素 */
opacity: 0.8;
@ -702,9 +663,6 @@
z-index: 0;
}
&:nth-of-type(3) {
margin-top: 20px;
}
&:nth-of-type(2) {
/* 自动布局子元素 */
@ -750,38 +708,11 @@
gap: 16px;
white-space: nowrap;
}
}
.superior_content_link {
display: flex;
align-items: center;
gap: 10px;
> span {
/* 自动布局子元素 */
opacity: 1;
font-family: DM Sans;
font-size: 14px;
font-weight: 500;
line-height: normal;
letter-spacing: 0em;
font-variation-settings: "opsz" auto;
font-feature-settings: "kern" on;
color: #ffffff;
z-index: 0;
display: flex;
align-items: center;
gap: 16px;
white-space: nowrap;
}
.invite_content_icon {
margin-left: auto;
width: 24px;
height: 24px;
}
}
}
}

View File

@ -1,6 +1,6 @@
import classes from "./Home.module.css";
import useUserStore from "@/store/User";
import { cn, copyText, padWithZero, shortenString } from "@/utils";
import { cn, copyText, shortenString } from "@/utils";
import { useWeb3Modal } from "@web3modal/wagmi/react";
import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
@ -10,20 +10,18 @@ import usdtBg from "@/assets/usdt_bg.svg";
import RMOB_logo from "@/assets/RMOB_logo.svg";
import IconFont from "@/components/iconfont";
import { BaseError, useAccount } from "wagmi";
import { disconnect } from "wagmi/actions";
import { config } from "@/components/WalletProvider";
import { useNavigate } from "react-router-dom";
import { Button, Dialog, Empty, PullToRefresh, Toast } from "antd-mobile";
import { Button, Dialog, Empty, Toast } from "antd-mobile";
import { loginOut } from "@/utils/wallet";
import {
api_claim_income,
api_get_homepage_user_data,
api_get_user_superiors,
} from "@/server/api";
import { UserHomeData, UserIncome } from "@/server/module";
import { api_claim_income, api_get_homepage_user_data } from "@/server/api";
import { UserHomeData } from "@/server/module";
import { UrlQueryParamsKey } from "@/constants";
import { receiveByContract } from "@/contract/utils";
import usePollingCheckBuyStatus from "@/hook/usePollingCheckBuyStatus";
import { ToastHandler } from "antd-mobile/es/components/toast";
import { PullStatus } from "antd-mobile/es/components/pull-to-refresh";
export default function () {
const { Token, UpdateToken } = useUserStore();
const { open } = useWeb3Modal();
@ -34,51 +32,26 @@ export default function () {
const navigate = useNavigate();
const [userData, setUserData] = useState<UserHomeData>();
const [superiorsAddress, setSuperiorsAddress] = useState<string>();
const [superiorsShareCode, setSuperiorsShareCode] = useState<string>();
const statusRecord: Record<PullStatus, string> = {
pulling: "Pull down to refresh",
canRelease: "Release to refresh immediately",
refreshing: "Loading...",
complete: "Refresh complete",
};
const userInviteLink = useMemo(
() =>
`${location.origin}/#/?${UrlQueryParamsKey.INVITE_CODE}=${
`${import.meta.env.VITE_BASE_URL}?${UrlQueryParamsKey.INVITE_CODE}=${
userData?.invitationCode || ""
}`,
[userData]
);
const superiorInvitationLink = useMemo(
() =>
`${location.origin}/#/?${UrlQueryParamsKey.INVITE_CODE}=${superiorsShareCode}`,
[superiorsShareCode]
);
const receiveLoadingToast = useRef<ToastHandler>();
const {
transcationStatus,
startPollingCheckBuyStatus,
stopPollingCheckBuyStatus,
} = usePollingCheckBuyStatus("NORMAL");
const { transcationStatus, startPollingCheckBuyStatus,stopPollingCheckBuyStatus } =
usePollingCheckBuyStatus("NORMAL");
useEffect(() => {
getHomeData();
if (Token) {
api_get_user_superiors()
.send({})
.then((res) => {
setSuperiorsAddress(res.data?.data.address);
setSuperiorsShareCode(res.data?.data.shareCode);
});
}
return () => {};
}, [Token]);
useEffect(() => {
if (transcationStatus == "success") {
receiveLoadingToast.current?.close();
stopPollingCheckBuyStatus();
stopPollingCheckBuyStatus()
Dialog.alert({
content: `${t("领取成功,前往钱包查看")}`,
confirmText: "OK",
@ -101,30 +74,18 @@ export default function () {
return (
<>
<PullToRefresh
onRefresh={async () => {
await getHomeData();
}}
renderText={(status) => {
return <div>{statusRecord[status]}</div>;
}}
disabled={!Token}
>
<div className={cn(classes.Home, classes.container)}>
<div className={classes.userinfo}>
<div className={classes.userinfo_top}>
<img
className={classes.userinfo_top_left}
src={userData?.userImg || logo}
alt=""
/>
<img className={classes.userinfo_top_left} src={logo} alt="" />
{address ? (
<div className={classes.userinfo_top_right}>
<div className={classes.userinfo_top_right_wallet}>
<span>{shortenString(address, 6, 4)}</span>
<IconFont
onClick={async () => {
onClick={() => {
disconnect(config);
loginOut();
}}
name="tuichu"
@ -142,7 +103,7 @@ export default function () {
name="tongdun"
className={classes.userinfo_top_right_btns_icon}
/>
<span>{t("无等级")}</span>
<span>{t("普通非活跃")}</span>
</>
)}
{userData.level == 1 && (
@ -151,12 +112,7 @@ export default function () {
name="jindun"
className={classes.userinfo_top_right_btns_icon}
/>
{userData.active === 0 && (
<span>{t("普通非活跃")}</span>
)}
{userData.active === 1 && (
<span>{t("普通活跃")}</span>
)}
</>
)}
{userData.level == 2 && (
@ -214,25 +170,19 @@ export default function () {
<span className={classes.userinfo_data_num}>
{userData?.mintNumber || 0}
</span>
<span className={classes.userinfo_data_des}>
{t("邀请铸造")}
</span>
<span className={classes.userinfo_data_des}>{t("邀请铸造")}</span>
</li>
<li>
<span className={classes.userinfo_data_num}>
{userData?.presidentNumber || 0}
</span>
<span className={classes.userinfo_data_des}>
{t("团队社长")}
</span>
<span className={classes.userinfo_data_des}>{t("团队社长")}</span>
</li>
<li>
<span className={classes.userinfo_data_num}>
{userData?.airdropNumber || 0}
</span>
<span className={classes.userinfo_data_des}>
{t("邀请空投")}
</span>
<span className={classes.userinfo_data_des}>{t("邀请空投")}</span>
</li>
</ul>
</div>
@ -249,7 +199,7 @@ export default function () {
className={tabIndex == 1 ? classes.nftToken_tab_active : ""}
onClick={() => setTabIndex(1)}
>
{t("收益")}
{t("代币")}
</li>
</ul>
@ -261,7 +211,7 @@ export default function () {
{userData?.nftId ? (
<div className={classes.nftToken_content_nft}>
<div className={classes.nftToken_content_nft_top}>
<span># {padWithZero(userData?.nftId)}</span>
<span># ${userData?.nftId}</span>
<span
onClick={() => {
navigate("/mint");
@ -316,21 +266,18 @@ export default function () {
{tabIndex == 1 && (
<div className={classes.nftToken_content_token}>
<div className={classes.nftToken_content_token_top}>
<span>{t("总收益= 已领取 + 待领取")}</span>
<span>{t("资产金额 = 已领取 + 待处理")}</span>
</div>
<ul className={classes.nftToken_content_token_list}>
{userData?.userIncomes.map((v, i) => (
<ReceiveCom
key={i}
coinId={v.coinId}
tokenName={v.coinName}
tokenNum={v.receive}
toReceive={v.collection}
onAssetRec={() => {
navigate(
`/assetrecord?id=${v.id}&coinId=${v.coinId}`
);
navigate(`/assetrecord?id=${v.id}&name=${v.coinName}`);
}}
onReceive={async () => {
receiveLoadingToast.current = Toast.show({
@ -347,16 +294,13 @@ export default function () {
const buyAmount = BigInt(
orderInfo?.claimQuantity || ""
);
receiveByContract(
v.coinId,
buyAmount,
orderInfo.time,
orderInfo?.orderNumber,
orderInfo.hash
)
.then((hash) => {
if (!hash) return;
console.log("领取成功hash:", hash);
getHomeData();
startPollingCheckBuyStatus(hash);
@ -380,15 +324,6 @@ export default function () {
</div>
</div>
<div
className={classes.equityNft}
onClick={() => window.open("https://element.market/account")}
>
<IconFont name="transfer" />
<span>{t("交易红魔股权NFT")}</span>
<IconFont name="chevronsrightshuangyoujiantou" color={"#FFFFFF"} />
</div>
<div className={classes.invite}>
<div className={classes.invite_top}>
<span>{t("邀请")}</span>
@ -442,33 +377,6 @@ export default function () {
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。"
)}
</span>
{superiorsAddress && (
<>
<span>{t("上级链接")}</span>
<div className={classes.superior_content_link}>
<>
<span>
{shortenString(superiorInvitationLink, 18, 18)}
</span>
<IconFont
onClick={() => {
copyText(superiorInvitationLink);
}}
className={classes.invite_content_icon}
name="fuzhi"
color={"#fff"}
/>{" "}
</>
</div>
<div className={classes.superior_content_link}>
<>
<span>{t("上级地址:")}</span>
<span>{shortenString(superiorsAddress, 15, 15)}</span>
</>
</div>
</>
)}
</div>
</div>
@ -490,7 +398,6 @@ export default function () {
</ul>
</div>
</div>
</PullToRefresh>
</>
);
}
@ -501,26 +408,24 @@ function ReceiveCom({
toReceive,
onAssetRec,
onReceive,
coinId,
}: {
tokenName: string;
tokenNum: number;
tokenNum: string;
toReceive: number;
onAssetRec: () => void;
onReceive: () => void;
coinId: UserIncome["coinId"];
}) {
const { t } = useTranslation();
return (
<li className={classes.nftToken_content_token_item}>
{coinId == 1 && <img src={usdtBg} alt="" />}
{coinId == 2 && <img src={RMOB_logo} alt="" />}
{tokenName.toUpperCase() == "USDT" && <img src={usdtBg} alt="" />}
{tokenName.toUpperCase() == "RMOB" && <img src={RMOB_logo} alt="" />}
<div>
<span className={classes.nftToken_content_token_item_tokenName}>
{tokenName}
</span>
<span className={classes.nftToken_content_token_item_tokenNum}>
{tokenNum + toReceive}
{tokenNum}
</span>
<span
className={classes.nftToken_content_token_item_AssetRecords}
@ -528,7 +433,7 @@ function ReceiveCom({
onAssetRec();
}}
>
{t("收益记录")}{" "}
{t("资产记录")}{" "}
<IconFont name="chevronsrightshuangyoujiantou" color={"#3680FF"} />
</span>
</div>

View File

@ -1,12 +1,11 @@
/*
* @LastEditors: John
* @Date: 2024-06-19 11:03:01
* @LastEditTime: 2024-06-26 15:21:27
* @LastEditTime: 2024-06-22 10:27:19
* @Author: John
*/
import { api_preprelion_list } from "@/server/api";
import { PreprelionListItem } from "@/server/module";
import { getLevelName } from "@/utils";
import { Empty } from "antd-mobile";
import { useEffect, useState } from "react";
import DataTable, { TableColumn } from "react-data-table-component";
@ -23,10 +22,8 @@ export default function () {
},
{
name: t("级别"),
selector: (row) => row.level,
grow: 4,
cell(row, rowIndex, column, id) {
return <div>{getLevelName(row.level, row.userType)}</div>;
},
},
{
name: t("直推NFT"),

View File

@ -84,7 +84,6 @@ export default function () {
async function updateUserUpgrdeInfo() {
const { data } = await api_get_user_upgrade_information().send({});
// setUserUpgradeInfo({ ...data!.data, ...{ status: 1 } });
setUserUpgradeInfo(data?.data);
}
@ -95,12 +94,7 @@ export default function () {
<div className={classes.content_box}>
<div className={classes.box_item}>
<span>{t("当前级别")}</span>
<span>
{getLevelName(
userUpgradeInfo?.level || 0,
userUpgradeInfo?.active
)}
</span>
<span>{getLevelName(userUpgradeInfo?.level || 0)}</span>
</div>
<IconFont
className={classes.box_arrow}
@ -122,7 +116,7 @@ export default function () {
<span>{t("价格说明:")}</span>
<span>
{t(
"升级费用xxx USDT起50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。",
"升级费用xxx USDT起其中gas费2USDT剩余部分50%进入资金池另外50%平均分给所有升级成功的社长和基金会社长。自第二个社长升级开始每升级一名社长所需铸造费用增加xxx既第二位社长升级铸造费用为xxxu+xxx*xxx=xxx USDT以此类推。",
{
value1: userUpgradeInfo?.upgradeFees || 0,
value2: userUpgradeInfo?.proportion || "0%",
@ -169,7 +163,7 @@ export default function () {
upgradeLoadingtoast.current = Toast.show({
icon: "loading",
duration: 0,
content: t("升级中"),
content: t("购买中"),
maskClickable: false,
});
const { data: orderRes } = await api_upgrade().send({});
@ -178,7 +172,7 @@ export default function () {
const buyAmount = BigInt(orderInfo.current?.buyAmount || "");
upGradeByContract(buyAmount, orderInfo.current?.orderNumber)
.then((hash) => {
console.log("升级成功hash:", hash);
console.log("购买成功hash:", hash);
updateUserUpgrdeInfo();
startPollingCheckBuyStatus(hash);
})
@ -195,7 +189,7 @@ export default function () {
<Space>
{userUpgradeInfo?.status == 1 ? (
<>
{approveUsdt > 0n && <span>{t("升级")}</span>}
{approveUsdt > 0n && <span>MINT</span>}
{approveUsdt === 0n && <span>{t("授权USDT")}</span>}
</>
) : (

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-18 10:28:21
* @LastEditTime: 2024-07-10 11:53:39
* @LastEditTime: 2024-06-22 11:43:04
* @Author: John
*/
import { GET, POST } from "./client";
@ -52,7 +52,7 @@ export function api_signUp() {
chainType: 2;
},
any
>({ url: "/api/account/signUp", requiresToken: false, catchErr: true });
>({ url: "/api/account/signUp", requiresToken: false });
}
// 获取钱包签名串
@ -131,24 +131,3 @@ export function api_claim_income() {
url: "/api/common/claimYourEarnings",
});
}
// 绑定邀请关系
export function api_binding_invitation_relationship() {
return POST<{ shareCode: string }, { result: boolean }>({
url: "/api/account/bindingRelationship",
});
}
// 查询用户是否绑定关系
export function api_query_whether_the_user_is_binding_relationship() {
return GET<any, { result: boolean }>({
url: "/api/account/bindOrNot",
});
}
// 获取用户上级
export function api_get_user_superiors() {
return GET<any, { address: string; shareCode: string }>({
url: "/api/user/getTheSuperior",
});
}

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-18 10:09:21
* @LastEditTime: 2024-07-02 11:36:28
* @LastEditTime: 2024-06-21 14:47:26
* @Author: John
*/
import { Client } from "@hyper-fetch/core";
@ -17,11 +17,9 @@ import i18next from "i18next";
function initClient({
requiresToken,
requiresAddress,
catchErr,
}: {
requiresToken: boolean;
requiresAddress: boolean;
catchErr: boolean;
}) {
return new Client({ url: import.meta.env.VITE_BASE_API_URL })
.onAuth(async (req) => {
@ -61,7 +59,6 @@ function initClient({
const resData: BASE_RESPONSE = res.data;
if (resData.code !== 200 && resData.code !== 0) {
if (resData.msg) Toast.show({ content: resData.msg, icon: "fail" });
if (catchErr) return res;
throw new Error(resData.msg || "client on response error");
}
return res;
@ -72,14 +69,12 @@ export const POST = <P = any, R = any, QueryParams = any>({
url,
requiresToken = true,
requiresAddress = true,
catchErr = false,
}: {
url: string;
requiresToken?: boolean;
requiresAddress?: boolean;
catchErr?: boolean;
}) => {
return initClient({ requiresToken, requiresAddress, catchErr }).createRequest<
return initClient({ requiresToken, requiresAddress }).createRequest<
BASE_RESPONSE<R>,
P,
any,
@ -94,14 +89,12 @@ export const GET = <P = any, R = any>({
url,
requiresToken = true,
requiresAddress = true,
catchErr = false,
}: {
url: string;
requiresToken?: boolean;
requiresAddress?: boolean;
catchErr?: boolean;
}) => {
return initClient({ requiresToken, requiresAddress, catchErr }).createRequest<
return initClient({ requiresToken, requiresAddress }).createRequest<
BASE_RESPONSE<R>,
any,
any,

View File

@ -19,16 +19,15 @@ export interface UserHomeData {
presidentNumber: number;
userImg: string;
userIncomes: UserIncome[];
active: 0 | 1; // "0=非活跃 1=活跃用户"
}
export interface UserIncome {
coinId: 1 | 2; // 1 USDT 2 ROMB
coinId: number;
coinName: string;
collection: number;
createTime: string;
flag: number;
id: number;
receive: number;
receive: string;
updateTime: string;
userId: number;
}
@ -43,7 +42,6 @@ export interface UserUpgradeInformation {
proportion: string;
status: 1 | 0; //1=可升级 0=不可升级
upgradeFees: string;
active: 0 | 1; // "0=非活跃 1=活跃用户"
}
export interface NftConfigurationData {
@ -109,9 +107,9 @@ export interface NftOrder {
export interface PreprelionListItem {
address: string;
level: 0 | 1 | 2 | 3; // 0=无等级 1=会员 2=社长 3=基金会
level: number;
mintNumber: number;
userType: 0 | 1; // 0=非活跃 1=活跃用户
userType: number;
}
export interface UpgradeOrder {

View File

@ -256,59 +256,3 @@
}
}
}
.adm-dialog {
.adm-center-popup-body {
box-sizing: border-box !important;
border: 1px solid #fc872b !important;
border-radius: 10px !important;
background-color: transparent !important;
backdrop-filter: blur(10px);
.adm-dialog-content {
.adm-auto-center-content {
opacity: 1;
font-family: Space Grotesk;
font-size: 14px;
font-weight: 500;
line-height: normal;
letter-spacing: 0px;
font-variation-settings: "opsz" auto;
color: #ffffff;
z-index: 0;
}
}
.adm-dialog-footer {
.adm-dialog-action-row {
border-top: 1px solid #fc872b !important;
.adm-dialog-button {
span {
color: #fc872b;
}
}
}
}
}
}
/* adm-pull-to-refresh */
.adm-pull-to-refresh {
.adm-pull-to-refresh-head-content {
/* 自动布局子元素 */
font-family: Space Grotesk;
font-size: 14px;
font-weight: 500;
line-height: normal;
letter-spacing: 0em;
font-variation-settings: "opsz" auto;
font-feature-settings: "kern" on;
color: #9e9e9e;
z-index: 0;
}
}

View File

@ -1,14 +1,14 @@
/*
* @LastEditors: John
* @Date: 2024-06-17 18:19:27
* @LastEditTime: 2024-06-25 15:29:51
* @LastEditTime: 2024-06-24 14:49:16
* @Author: John
*/
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import Toast from "antd-mobile/es/components/toast";
import i18next from "i18next";
import { Level, UserHomeData } from "@/server/module";
import { Level } from "@/server/module";
export const ua = navigator.userAgent;
export const isIOS = /iphone|ipad|ipod|ios/i.test(ua);
@ -31,7 +31,7 @@ export function shortenString(
}
// 定义一个函数,用于获取指定参数的值
export function getUrlQueryParam(key: string) {
export function getUrlQueryParam(key: string): string | undefined {
console.log(window.location);
const query: Map<string, string> = new Map();
const queryStr = window.location.href.split("?")[1];
@ -84,16 +84,12 @@ export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function getLevelName(level: Level, active?: UserHomeData["active"]) {
export function getLevelName(level: Level) {
switch (level) {
case 0:
return i18next.t("无等级");
case 1:
if (active == 1) {
return i18next.t("普通活跃");
} else {
return i18next.t("普通非活跃");
}
case 1:
return i18next.t("普通活跃");
case 2:
return i18next.t("社长");
case 3:
@ -102,19 +98,3 @@ export function getLevelName(level: Level, active?: UserHomeData["active"]) {
break;
}
}
export function getUrlParameterByName(name: string, url?: string) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
let regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return "";
console.log("url params:", results);
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
export function padWithZero(num: number) {
// 将数字转换为字符串并在前面补足零使总长度为5
return String(num).padStart(5, "0");
}

View File

@ -1,16 +1,14 @@
/*
* @LastEditors: John
* @Date: 2024-06-19 15:55:07
* @LastEditTime: 2024-07-02 11:38:59
* @LastEditTime: 2024-06-24 14:01:50
* @Author: John
*/
import { config } from "@/components/WalletProvider";
import {
api_binding_invitation_relationship,
api_check_account_registration,
api_get_wallet_signature_string,
api_login,
api_query_whether_the_user_is_binding_relationship,
api_signUp,
} from "@/server/api";
import useUserStore from "@/store/User";
@ -20,12 +18,9 @@ import {
switchChain,
getChainId,
disconnect,
getAccount,
} from "@wagmi/core";
import Toast from "antd-mobile/es/components/toast";
import i18next from "i18next";
import { getUrlParameterByName } from ".";
import { UrlQueryParamsKey } from "@/constants";
/**
* @description:
@ -106,6 +101,7 @@ export async function signAndLogin(address?: `0x${string}`): Promise<void> {
});
} catch (error) {
// 用户拒绝签名或者遇到错误,断开链接
disconnect(config);
loadingToast.close();
loginOut();
throw new Error("用户拒绝签名或者遇到错误,断开链接");
@ -125,38 +121,30 @@ export async function signAndLogin(address?: `0x${string}`): Promise<void> {
useUserStore.setState((state) => {
return { ...state, Token: loginInfoData.data?.token };
});
// TODO 判断用户是否绑定关系✔
// await checkUserBind(false);
reslove();
loadingToast.close();
}
} else {
const inviteCode = getUrlParameterByName(UrlQueryParamsKey.INVITE_CODE);
if (!inviteCode) {
Toast.show({ icon: "fail", content: i18next.t("无效的邀请链接") });
return loginOut();
}
// 注册
const { data } = await api_signUp().send({
await api_signUp().send({
data: {
account: address,
publicKey,
shareCode: inviteCode,
shareCode: "",
chainType: 2,
},
});
if (data?.code === 0) {
await signAndLogin(address);
} else {
return loginOut();
}
reslove();
loadingToast.close();
}
});
}
export async function loginOut() {
const { connector } = getAccount(config);
await disconnect(config, { connector });
export function loginOut() {
useUserStore.setState((state) => {
return { ...state, Address: "", Token: "" };
});

3
src/vite-env.d.ts vendored
View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-17 17:20:03
* @LastEditTime: 2024-07-02 16:53:48
* @LastEditTime: 2024-06-21 13:50:16
* @Author: John
*/
/// <reference types="vite/client" />
@ -12,7 +12,6 @@ interface ImportMetaEnv {
readonly VITE_PARTICIPATE_CHAIN_ID: number;
readonly VITE_NETWORK_USDT_ADDRESS: `0x${string}`;
readonly VITE_PURCHASED_CONTRACT_ADDRESS: `0x${string}`;
readonly VITE_RECEIVE_RAMB_CONTRACT_ADDRESS: `0x${string}`;
readonly VITE_CHECK_TRANSACTION_DETAILS_URL: string;
// 更多环境变量...
readonly MODE: "development" | "production" | "test";

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-17 17:20:03
* @LastEditTime: 2024-06-24 18:48:07
* @LastEditTime: 2024-06-17 17:41:09
* @Author: John
*/
{
@ -23,6 +23,9 @@
/* Linting */
"allowSyntheticDefaultImports": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"@/*": ["./src/*"]