diff --git a/env.md b/env.md index ec2dd1a..9e7599d 100644 --- a/env.md +++ b/env.md @@ -2,3 +2,4 @@ SKIP_PREFLIGHT_CHECK=true GENERATE_SOURCEMAP=false REACT_APP_CHAINID=56 REACT_APP_DAY_TIME=86400 +REACT_APP_SHARE_URL='https://app.sofil.io/index.html' diff --git a/public/index.html b/public/index.html index eaa5061..856a17a 100644 --- a/public/index.html +++ b/public/index.html @@ -2,14 +2,30 @@ + - + + SOFIL + + + + + + + + + + + + + + - SOFIL diff --git a/public/qrcode.png b/public/qrcode.png new file mode 100644 index 0000000..0ef67c4 Binary files /dev/null and b/public/qrcode.png differ diff --git a/src/contract/index.ts b/src/contract/index.ts index 1aaf743..557f0ed 100644 --- a/src/contract/index.ts +++ b/src/contract/index.ts @@ -4,15 +4,15 @@ import { ethers } from 'ethers'; import store from '~/store'; import { ContractType } from '~/types/store'; // 0x7a89c2D92Bf53160ab58d7889966741cA8Eb5855 - const config = { +const config = { 56: { chainId: 56, rpc: "https://bsc-dataseed1.defibit.io", address: { FIL__factory: "0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153", - NFT__factory: "0x5fd156B6B47Bb0B363fa3D4e2E31a8394Ee7A630", - Pool__factory: "0xC31cEb39961076d8fAD3936D88489972c02b4D83", - Pledge__factory: "0x2F3d8761c8214627743F84F9890A8eEeD914ddf1", + NFT__factory: "0x16B73D32a3c26DaDb1E6823bB711cc1DCd49F3c7", + Pool__factory: "0xaF386022e8915642E1c0EC5DB1a973C683dfEaAD", + Pledge__factory: "0x2AdB2f2B95a518c3e71012ebaD4a4Cd778139Eb3", } }, 97: { @@ -37,9 +37,9 @@ import { ContractType } from '~/types/store'; }, } as any -if(process.env.REACT_APP_CHAINID === '56'){ +if (process.env.REACT_APP_CHAINID === '56') { delete config[97] -}else{ +} else { delete config[56] } @@ -124,6 +124,6 @@ const initContract = async () => { } -export{ - config,initContract +export { + config, initContract } \ No newline at end of file diff --git a/src/language/hk.json b/src/language/hk.json index 06d7b51..205072a 100644 --- a/src/language/hk.json +++ b/src/language/hk.json @@ -43,7 +43,7 @@ "Why should I stake Filecoin?":"問題一:為什麼我要質押 FIL?", "FAQ1":"透過質押FIL產生質押獎勵,讓你持有的 FIL 為您賺取,同時為 Filecoin 的安全性和效率做出貢獻。Filecoin已經從僅提供資料儲存驗證的區塊鏈發展到透過推出Filecoin虛擬機來實現去中心化應用,從而引發更大的市潛力和成長。", "What can I do with the NFT after receiving it?":"問題二:質押後獲得的NFT可以用來做什麼?", - "FAQ2":"NNFT是SOFIL平台上的鏈上質押通證。 持有NFT的人可以在質押期結束前提取每日收益,並在質押期結束後贖回質押金。你可以把NFT保存在錢包中,用於每日收益提取和質押金的兌現。 如果你在質押期結束前需要流動性,也可以將其出售或在公開市場上抵押借款。請注意,如果你把NFT轉讓給他人,儘管你是質押的發起者,但你把無法再提取收益或兌現質押金金額,提取和兌現的權歸於NFT持有人。", + "FAQ2":"NFT是SOFIL平台上的鏈上質押通證。 持有NFT的人可以在質押期結束前提取每日收益,並在質押期結束後贖回質押金。你可以把NFT保存在錢包中,用於每日收益提取和質押金的兌現。 如果你在質押期結束前需要流動性,也可以將其出售或在公開市場上抵押借款。請注意,如果你把NFT轉讓給他人,儘管你是質押的發起者,但你把無法再提取收益或兌現質押金金額,提取和兌現的權歸於NFT持有人。", "Where do my reward from staking come from?":"問題三:我的質押收益從哪裡來?", "FAQ3":"所有收益均來自Filecoin挖礦獎勵,而非其他外部平台,Filecoin挖礦由SOFIL策略夥伴營運。", diff --git a/src/pages/invitation/index.tsx b/src/pages/invitation/index.tsx index 5c4d906..74f9ec9 100644 --- a/src/pages/invitation/index.tsx +++ b/src/pages/invitation/index.tsx @@ -13,10 +13,11 @@ import { useRouter } from '~/hooks/useRouter' import ModalLoading from '~/components/ModalLoading' import UnLogin from '~/components/Unlogin' import { useTranslation } from 'react-i18next' +import { LanguageType, shareLK, shareTG, shareTW } from '~/utils/share' const Invitation = () => { - const { t,i18n } = useTranslation() + const { t, i18n } = useTranslation() const { walletAddress, contract } = store.state const { copyVal } = useCopyLink() const [tabIndex, setTabIndex] = useState(0) @@ -39,7 +40,9 @@ const Invitation = () => { const navbarRefs = useRef(document.querySelector('.layout .header')) const getData = async () => { + const res = await eth_invitation(walletAddress) + if (res) { setRecommendAmount(res.recommendAmount) setUnExpiredContract(res.unExpiredContract) @@ -94,13 +97,13 @@ const Invitation = () => { } }, []) - const renderTitle = ()=>{ - if(i18n.language === 'en'){ + const renderTitle = () => { + if (i18n.language === 'en') { return (
Up To 7% of Referees Staking Rewards
) } - if(i18n.language === 'hk'){ + if (i18n.language === 'hk') { return (
高達質押人賺取的 7%
) @@ -207,9 +210,9 @@ const Invitation = () => {
copyVal(walletAddress)} />
- - - + shareTG(i18n.language as LanguageType, walletAddress)} /> + shareTW(i18n.language as LanguageType, walletAddress)} /> + shareLK(i18n.language as LanguageType, walletAddress)} />
@@ -261,7 +264,7 @@ const ContractRecord = (props: ContractRecordProps) => { const { list, rate, currentTime } = props const { t } = useTranslation() const { push } = useRouter() - + return (
diff --git a/src/router/layout/index.tsx b/src/router/layout/index.tsx index f17ea19..93382cb 100644 --- a/src/router/layout/index.tsx +++ b/src/router/layout/index.tsx @@ -49,6 +49,11 @@ const LayoutRouter = () => { push('/', null, true) window.sessionStorage.setItem(SOFIL_LANGUAGE, pathname) } + console.log('----------------------'); + + if (location.pathname === '/') { + push('/', null, true) + } } diff --git a/src/utils/share.ts b/src/utils/share.ts new file mode 100644 index 0000000..3ce6e7a --- /dev/null +++ b/src/utils/share.ts @@ -0,0 +1,64 @@ +export type LanguageType = 'en' | 'zh' | 'hk' + +export const shareTG = async (language: LanguageType, address: string) => { + const text = shareText(language, address) + const url = process.env.REACT_APP_SHARE_URL as string + + const tg = `https://t.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}` + window.open(tg) +} + +export const shareTW = async (language: LanguageType, address: string) => { + const text = shareText(language, address) + const url = process.env.REACT_APP_SHARE_URL as string + const tw = `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}` + window.open(tw) +} + +export const shareLK = async (language: LanguageType, address: string) => { + const text = shareText(language, address) + const url = process.env.REACT_APP_SHARE_URL as string + const linkedinShareUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`; + window.open(linkedinShareUrl) +} + + +const shareText = (language: LanguageType, address: string) => { + const ts = { + 'en': ` + Join me to stake $FIL on SOFIL with my referral code to earn up to 16.23% APY ! + SOFIL is a DeFi platform offering stake-to-earn opportunities to crypto holders. + + My referral code: ${address} + You can insert my referral code before you stake. + + Come and explore more with me on SOFIL by scanning the following QR code or directly visit app.sofil.io on your MetaMask + + SOFIL Official Website: https://sofil.io + `, + + 'hk': + ` + 使用我的推薦碼在 SOFIL 上質押 $FIL,即可賺取高達 16.23% 年利率!\n + SOFIL 是一個去中心金融平台,為加密貨幣持有者提供質押賺取的機會。\n + 我的推薦碼:${address} \n + 您可以在質押前輸入我的推薦碼。\n + 掃描以下二維碼或直接在 MetaMask 上瀏覽 app.sofil.io,與我一起探索 SOFIL 的更多內容!\n + SOFIL官方網站:https://sofil.io + `, + + 'zh': ` + 使用我的推荐码在 SOFIL 上质押 $FIL,即可赚取高达 16.23% 年利率! + SOFIL 是一个去中心金融平台,为加密货币持有者提供质押赚取的机会。 + + 我的推荐码:${address} + 您可以在质押前输入我的推荐码。 + + 扫描以下二维码或直接在 MetaMask 上浏览 app.sofil.io,与我一起探索 SOFIL 的更多内容! + + SOFIL官方网站:https://sofil.io + ` + } as { [key: string]: string } + return ts[language] +} +// https://t.me/share/url?url=https://baidu.com&text=sdasdasdasdasd\nasdkahdkashdkajshd \ No newline at end of file