Skip to content

Commit

Permalink
feat(neuron-ui): rename interest to compensation
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Nov 14, 2019
1 parent 8e2d505 commit e6d6060
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions packages/neuron-ui/src/components/CustomRows/DAORecordRow.tsx
Expand Up @@ -64,13 +64,13 @@ const DAORecord = ({
})
}, [daoData, depositOutPoint, blockNumber])

const interest = BigInt(withdraw || capacity) - BigInt(capacity)
const compensation = BigInt(withdraw || capacity) - BigInt(capacity)

let ready = false
let metaInfo = 'Ready'
if (!depositOutPoint) {
const duration = BigInt(tipBlockNumber) - BigInt(blockNumber)
metaInfo = t('nervos-dao.interest-accumulated', {
metaInfo = t('nervos-dao.compensation-accumulated', {
blockNumber: localNumberFormatter(duration >= BigInt(0) ? duration : 0),
})
} else {
Expand Down Expand Up @@ -115,8 +115,8 @@ const DAORecord = ({
<div className={`${styles.daoRecord} ${depositOutPoint ? styles.isClaim : ''}`}>
<div className={styles.primaryInfo}>
<div>
{interest >= BigInt(0)
? `${depositOutPoint ? '' : '~'}${shannonToCKBFormatter(interest.toString()).toString()} CKB`
{compensation >= BigInt(0)
? `${depositOutPoint ? '' : '~'}${shannonToCKBFormatter(compensation.toString()).toString()} CKB`
: ''}
</div>
<div>{`${shannonToCKBFormatter(capacity)} CKB`}</div>
Expand All @@ -142,7 +142,7 @@ const DAORecord = ({
</div>
</div>
<div className={styles.secondaryInfo}>
<span>{`APY: ~${calculateAPY(interest.toString(), capacity, `${Date.now() - +timestamp}`)}%`}</span>
<span>{`APY: ~${calculateAPY(compensation.toString(), capacity, `${Date.now() - +timestamp}`)}%`}</span>
<span>{uniformTimeFormatter(+timestamp)}</span>
<span>{metaInfo}</span>
</div>
Expand Down
Expand Up @@ -92,7 +92,7 @@ const WithdrawDialog = ({
<span>{`${shannonToCKBFormatter(record.capacity)} CKB`}</span>
</Text>
<Text as="p" variant="large" block>
<span>{`${t('nervos-dao.interest')}: `}</span>
<span>{`${t('nervos-dao.compensation')}: `}</span>
<span>
{withdrawValue
? `${shannonToCKBFormatter((BigInt(withdrawValue) - BigInt(record.capacity)).toString())} CKB`
Expand Down
6 changes: 3 additions & 3 deletions packages/neuron-ui/src/locales/en.json
Expand Up @@ -325,13 +325,13 @@
"cancel": "Cancel",
"proceed": "Proceed",
"deposit-value": "Deposit",
"interest": "Interest",
"compensation": "Compensation",
"notice-wait-time": "Notice: You need to wait {{epochs}} epochs {{blocks}} blocks(~{{days}} days) to claim the saving.",
"deposit-terms": "Nervos DAO needs 102 CKB for receipt storage, which is not interest-bearing.\nNervos DAO is a system layer decentralized infrastructure. Your saving here is secure.\nAccording to the Nervos DAO protocol, you need at least 180 epochs to withdraw your deposit.",
"deposit-terms": "Nervos DAO needs 102 CKB for receipt storage, which is not compensation-bearing.\nNervos DAO is a system layer decentralized infrastructure. Your saving here is secure.\nAccording to the Nervos DAO protocol, you need at least 180 epochs to withdraw your deposit.",
"deposited-action-label": "Withdraw",
"withdrawing-action-label": "Claim",
"minimal-fee-required": "The minimum deposit capacity is {{minimal}} CKB",
"interest-accumulated": "{{blockNumber}} blocks interest accumulated",
"compensation-accumulated": "{{blockNumber}} blocks compensation accumulated",
"blocks-left": "{{epochs}} epochs {{blocks}} blocks left(~{{days}} days)",
"withdraw-alert": "Alert: these are only {{epochs}} epochs left before the next start withdrawing epoch number conforming to Nervos DAO, and it is possible that you have to do the withdraw after the next period(~{{days}}) due to the jam on CKB.",
"insufficient-period-alert-title": "Insufficient Period",
Expand Down
6 changes: 3 additions & 3 deletions packages/neuron-ui/src/locales/zh.json
Expand Up @@ -325,13 +325,13 @@
"cancel": "取消",
"proceed": "继续",
"deposit-value": "存款",
"interest": "利息",
"compensation": "锁定补贴",
"notice-wait-time": "注意: 您需要等待 {{epochs}} epochs {{blocks}} 区块(~{{days}}天)完成最终取款。",
"deposit-terms": "存入 NervosDAO 的资产中需要 102 CKB 作为存款凭证的存储,这部分 CKB 是无法产生利息的\nNervos DAO 是一个系统层面的去中心化底层设施。您在其中存款是十分安全的。\n根据 Nervos DAO 的协议, 您需要等待至少 180 个 epochs 才能取回您的存款。",
"deposit-terms": "存入 NervosDAO 的资产中需要 102 CKB 作为存款凭证的存储,这部分 CKB 是无法产生锁定补贴的\nNervos DAO 是一个系统层面的去中心化底层设施。您在其中存款是十分安全的。\n根据 Nervos DAO 的协议, 您需要等待至少 180 个 epochs 才能取回您的存款。",
"deposited-action-label": "结算",
"withdrawing-action-label": "取款",
"minimal-fee-required": "存入金额应不少于 {{minimal}} CKB",
"interest-accumulated": "已累计 {{blockNumber}} 个块的利息",
"compensation-accumulated": "已累计 {{blockNumber}} 个块的锁定补贴",
"blocks-left": " 还需等待 {{epochs}} epochs {{blocks}} 个块(~{{days}} 天)",
"withdraw-alert": "风险提示:距离 NervosDAO 规定的最近一个允许提现 epoch 仅剩下 {{epochs}} 个 epoch,存在提现交易拥堵无法上链从而导致只能在下一个提现周期(约 {{days}} 天)的风险",
"insufficient-period-alert-title": "未达到要求周期",
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/utils/calculateAPY.ts
@@ -1,7 +1,7 @@
const YEAR = 365 * 24 * 60 * 60 * 1000
const BASE = 10000000

export default (interest: string, amount: string, duration: string) => {
const v = (BigInt(interest) * BigInt(YEAR) * BigInt(BASE)) / (BigInt(amount) * BigInt(duration))
export default (compensation: string, amount: string, duration: string) => {
const v = (BigInt(compensation) * BigInt(YEAR) * BigInt(BASE)) / (BigInt(amount) * BigInt(duration))
return `${(Number(v) / (BASE / 100)).toFixed(2)}`
}

0 comments on commit e6d6060

Please sign in to comment.