diff --git a/README.md b/README.md
index 4675903..e12d0d6 100644
--- a/README.md
+++ b/README.md
@@ -13,4 +13,8 @@
yarn deploy:prod or npm run deploy:prod
+
+ 本地域名:http://192.168.124.20:3002
+ 测试域名:https://test-sofil.hippoim.us
+ 生产域名:https://app.sofil.io
```
\ No newline at end of file
diff --git a/src/contract/index.ts b/src/contract/index.ts
index 9e51da0..f5a495f 100644
--- a/src/contract/index.ts
+++ b/src/contract/index.ts
@@ -19,30 +19,29 @@ import { ContractType } from '~/types/store';
chainId: 97,
rpc: "https://bsc-testnet.blockpi.network/v1/rpc/public",
address: {
- FIL__factory: "0xfa01Ef257b47578063741D3E4b60e16764FA6fa8",
- NFT__factory: "0x1eF6AAc9B468d7B310675409EFE5f954dFe59dDF",
- Pool__factory: "0xe861046E610B6f6A0E79eEf8Dd0aF5a42dC83293",
- Pledge__factory: "0xD8553004442098415734A9EFE49e13E29919BfF9",
+ FIL__factory: "0xfa01ef257b47578063741d3e4b60e16764fa6fa8",
+ NFT__factory: "0x3D4B3611912a58548BD925E1A1fA9DFA73061966",
+ Pool__factory: "0x2CEd9862567e0FD98EdB3Db3147c68841b311687",
+ Pledge__factory: "0xD1D827B8B5337C1c3c22ccFD47BCC16899b509e9",
}
},
31337: {
chainId: 31337,
rpc: "http://127.0.0.1:8545",
address: {
- FIL__factory: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
- NFT__factory: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
- Pool__factory: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
- Pledge__factory: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
+ FIL__factory: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853",
+ NFT__factory: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
+ Pool__factory: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
+ Pledge__factory: "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0",
}
},
} as any
-if(process.env.REACT_APP_CHAINID === '56'){
- delete config[97]
-}else{
- delete config[56]
-}
-console.log(config);
+// if(process.env.REACT_APP_CHAINID === '56'){
+// delete config[97]
+// }else{
+// delete config[56]
+// }
// 57.333333333333333332
const contractObj = {
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 421d2a3..3f7bc47 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -6,6 +6,7 @@ import { eth_pledgeProducts } from '~/contract/api'
import { useRouter } from '~/hooks/useRouter'
import '~/styles/home.scss'
import { openGitBook } from '~/utils'
+import { toString } from '~/utils/wei'
const Home = () => {
@@ -13,9 +14,9 @@ const Home = () => {
const { t } = useTranslation()
const [pledgeList, setPledgeList] = useState([
- { day: 180, rate: 14 },
- { day: 270, rate: 15 },
- { day: 360, rate: 16 },
+ { day: 180, rate: 1408 },
+ { day: 270, rate: 1521 },
+ { day: 360, rate: 1623 },
])
const [pledgeIndex, setPledgeIndex] = useState(0)
@@ -70,7 +71,7 @@ const Home = () => {
{t('Annualized Percentage Rate (APR)')}
-
{pledgeList[pledgeIndex].rate}%
+
{toString(pledgeList[pledgeIndex].rate,2)}%
diff --git a/src/pages/invitation-detail/index.tsx b/src/pages/invitation-detail/index.tsx
index 20d178c..055915f 100644
--- a/src/pages/invitation-detail/index.tsx
+++ b/src/pages/invitation-detail/index.tsx
@@ -11,6 +11,7 @@ import store from '~/store'
import '~/styles/pledge.scss'
import { PledgeInfoType } from '~/types/api.d'
import { calcExtractableAmount, calcReleasedIncome, calcWithdrawnAmount, getTime, splitAddress } from '~/utils'
+import { toString } from '~/utils/wei'
const InvitationDetail = () => {
@@ -22,7 +23,7 @@ const InvitationDetail = () => {
const _data = location.state.data as PledgeInfoType
const _currentTime = location.state.currentTime
const rate = location.state.rate
-
+
const [data, setData] = useState(_data as PledgeInfoType)
const [currentTime, setCurrentTime] = useState(_currentTime)
@@ -111,7 +112,7 @@ const InvitationDetail = () => {
{t('Status')}
-
{data.endTime > currentTime ? 'Active' : 'Matured'}
+
{data.endTime > currentTime ? t('Active') : t('Matured')}
{t('Staked Amount')}
@@ -119,7 +120,7 @@ const InvitationDetail = () => {
{t('Est. APR')}
-
{rate}%
+
{toString(rate, 2)}%
{t('Created Time')}
diff --git a/src/pages/invitation/index.tsx b/src/pages/invitation/index.tsx
index e6f4253..5c4d906 100644
--- a/src/pages/invitation/index.tsx
+++ b/src/pages/invitation/index.tsx
@@ -28,7 +28,7 @@ const Invitation = () => {
const [userRecord, setUserRecord] = useState([] as InvitationUserRecordType[])
const [contractRecord, setContractRecord] = useState([] as PledgeInfoType[])
const [withdrawtRecord, setWithdrawRecord] = useState([] as InvitationWithdrawRecordType[])
- const [rate, setRate] = useState(0);
+ const [rate, setRate] = useState(100);
const [currentTime, setCurrentTime] = useState(0)
const [loading, setLoading] = useState(false)
@@ -261,7 +261,7 @@ const ContractRecord = (props: ContractRecordProps) => {
const { list, rate, currentTime } = props
const { t } = useTranslation()
const { push } = useRouter()
-
+
return (
diff --git a/src/pages/nft-detail/index.tsx b/src/pages/nft-detail/index.tsx
index caa6ac8..773e889 100644
--- a/src/pages/nft-detail/index.tsx
+++ b/src/pages/nft-detail/index.tsx
@@ -12,11 +12,11 @@ import store from '~/store'
import '~/styles/pledge.scss'
import { PledgeInfoType } from '~/types/api.d'
import { calcExtractableAmount, calcIncome, calcReleasedIncome, calcWithdrawnAmount, getTime, splitAddress } from '~/utils'
-import { toBigInt } from '~/utils/wei'
+import { toBigInt, toString } from '~/utils/wei'
const NFTDetail = () => {
- const {t} = useTranslation()
+ const { t } = useTranslation()
const { contract, walletAddress } = store.state
const { copyVal } = useCopyLink()
const { push, location } = useRouter()
@@ -174,7 +174,7 @@ const NFTDetail = () => {
{t('Est. APR')}
-
{data.rate}%
+
{toString(data.rate, 2)}%
{t('Created Time')}
@@ -187,7 +187,7 @@ const NFTDetail = () => {
{/* */}
-
+
{t('Rewards & Withdrawals Details')}
diff --git a/src/pages/pledge/index.tsx b/src/pages/pledge/index.tsx
index 7042baf..e5f5a05 100644
--- a/src/pages/pledge/index.tsx
+++ b/src/pages/pledge/index.tsx
@@ -12,7 +12,7 @@ import store from '~/store';
import '~/styles/pledge.scss'
import { Contract_Factory } from '~/types/store';
import { toFixed2 } from '~/utils';
-import { toBigInt, toWei, wei } from '~/utils/wei';
+import { toBigInt, toString, toWei, wei } from '~/utils/wei';
//
const Pledge = () => {
@@ -23,9 +23,9 @@ const Pledge = () => {
const { Pledge__factory, FIL__factory, Pool__factory } = contract._contract ? contract._contract : {} as Contract_Factory
const [pledgeList, setPledgeList] = useState([
- { day: 180, rate: 14 },
- { day: 270, rate: 15 },
- { day: 360, rate: 16 },
+ { day: 180, rate: 1408 },
+ { day: 270, rate: 1521 },
+ { day: 360, rate: 1623 },
])
const [amount, setAmount] = useState('')
@@ -134,8 +134,8 @@ const Pledge = () => {
const rate = toBigInt(pledgeList[tabIndex].rate)
const year = toBigInt(365)
const total = pledgeAmount * rate / year * pledgeDay;
- const _profit = ethers.formatUnits(total, 20)
- const _totalProfit = ethers.formatUnits(toWei(toFixed2(_profit,18)) + pledgeAmount,18)
+ const _profit = ethers.formatUnits(total, 22)
+ const _totalProfit = ethers.formatUnits(toWei(toFixed2(_profit, 18)) + pledgeAmount, 18)
setProfit(_profit)
setTotalProfit(_totalProfit)
@@ -178,7 +178,7 @@ const Pledge = () => {
>
{item.day} {t('Days')}
-
{item.rate} %
+
{toString(item.rate, 2)} %
{t('Est.APR')}
diff --git a/src/utils/index.ts b/src/utils/index.ts
index 3feb748..0715501 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -116,7 +116,7 @@ const calcIncome = (data: PledgeInfoType) => {
const day = toBigInt(data.pledgeDay);
const income =
((toWei(data.pledgeAmount) * rate) / ethers.toBigInt(365)) * day;
- return toFixed2(ethers.formatUnits(income, 20), 4) || "0.00";
+ return toFixed2(ethers.formatUnits(income, 22), 4) || "0.00";
} catch (error) {
return "0.00";
}
@@ -138,7 +138,7 @@ const calcReleasedIncome = (data: PledgeInfoType, currentTime: number) => {
const pledgeAmount = toWei(data.pledgeAmount);
const year = toBigInt(365);
const income = ((pledgeAmount * rate) / year) * toBigInt(daysDifference);
- return toFixed2(ethers.formatUnits(income, 20), 4);
+ return toFixed2(ethers.formatUnits(income, 22), 4);
} catch (error) {
return "0.00";
}
@@ -157,7 +157,7 @@ const calcWithdrawnAmount = (data: PledgeInfoType) => {
const pledgeAmount = toWei(data.pledgeAmount);
const year = toBigInt(365);
const income = ((pledgeAmount * rate) / year) * toBigInt(daysDifference);
- return toFixed2(ethers.formatUnits(income, 20), 4);
+ return toFixed2(ethers.formatUnits(income, 22), 4);
} catch (error) {
return "0.00";
}
@@ -179,7 +179,7 @@ const calcExtractableAmount = (data: PledgeInfoType, currentTime: number) => {
const pledgeAmount = toWei(data.pledgeAmount);
const year = toBigInt(365);
const income = ((pledgeAmount * rate) / year) * toBigInt(daysDifference);
- return toFixed2(ethers.formatUnits(income, 20), 4);
+ return toFixed2(ethers.formatUnits(income, 22), 4);
} catch (error) {
return "0.00";
}