Browse Source

部署主网,添加分享

master
mac 4 months ago
parent
commit
129f7de536
  1. 1
      env.md
  2. 19
      public/index.html
  3. BIN
      public/qrcode.png
  4. 16
      src/contract/index.ts
  5. 2
      src/language/hk.json
  6. 19
      src/pages/invitation/index.tsx
  7. 5
      src/router/layout/index.tsx
  8. 64
      src/utils/share.ts

1
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'

19
public/index.html

@ -2,14 +2,30 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta name="x5-fullscreen" content="true">
<meta name="theme-color" content="#000000" />
<meta name="description" content="9527 description" />
<meta name="description" content="SOFIL description" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>SOFIL</title>
<meta property="og:title" content="SOFIL" />
<meta property="og:description" content="SOFIL description" />
<meta property="og:image" content="https://app.sofil.io/qrcode.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="600" />
<meta property="og:url" content="https://app.sofil.io" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="SOFIL" />
<meta name="twitter:description" content="SOFIL description" />
<meta name="twitter:image" content="https://app.sofil.io/qrcode.png" />
<style>
body {
margin: 0;
@ -69,7 +85,6 @@
}
</style>
<title>SOFIL</title>
</head>
<body>

BIN
public/qrcode.png

After

Width: 1200  |  Height: 600  |  Size: 18 KiB

16
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
}

2
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策略夥伴營運。",

19
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<HTMLDivElement>(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 (
<div className='tac mt-1 fz-15'>Up To <span className='fz-24 fz-wb-550'>7%</span> of Referees Staking Rewards</div>
)
}
if(i18n.language === 'hk'){
if (i18n.language === 'hk') {
return (
<div className='tac mt-1 fz-15'> <span className='fz-24 fz-wb-550'>7%</span> </div>
)
@ -207,9 +210,9 @@ const Invitation = () => {
<div className='iconfont icon-copy1 ml-2 fz-26' onClick={() => copyVal(walletAddress)} />
</div>
<div className='row-center menu mt-2'>
<img src={require('~/assets/share-1.png')} alt="" />
<img src={require('~/assets/share-2.png')} alt="" className='mlr-4' />
<img src={require('~/assets/share-3.png')} alt="" />
<img src={require('~/assets/share-1.png')} alt="" onClick={() => shareTG(i18n.language as LanguageType, walletAddress)} />
<img src={require('~/assets/share-2.png')} alt="" className='mlr-4' onClick={() => shareTW(i18n.language as LanguageType, walletAddress)} />
<img src={require('~/assets/share-3.png')} alt="" onClick={() => shareLK(i18n.language as LanguageType, walletAddress)} />
</div>
</div>
</Modal>
@ -261,7 +264,7 @@ const ContractRecord = (props: ContractRecordProps) => {
const { list, rate, currentTime } = props
const { t } = useTranslation()
const { push } = useRouter()
return (
<div className='plr-2'>
<div className='row tac mt-2 fz-wb-550'>

5
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)
}
}

64
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
Loading…
Cancel
Save