Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added credit offer and liquidity operation history analysis. #3463

Merged
merged 1 commit into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions app/assets/locales/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,18 @@
"witness_pay": "Withdrew witness pay to account",
"witness_receive": "Received witness from witness",
"witness_update": "{account} update its witness info",
"worker_create": "{account} created a worker proposal with daily pay of {pay}"
"worker_create": "{account} created a worker proposal with daily pay of {pay}",
"credit_offer_delete": "{account} deleted credit offer #{id}.",
"credit_deal_repay": "{account} repays {amount} to credit offer,fee: {fee}.",
"credit_offer_accept": "{account} borrows {amount} from credit offer.",
"credit_offer_update": "{account} update a credit offer #{id}.",
"credit_offer_create": "{account} create a credit offer of {amount},fee rate: {fee}.",
"credit_deal_expired": "{account} credit deal has expired.",
"liquidity_pool_create": "{account} create a liquidity pool: {asset_a}-{asset_b}.",
"liquidity_pool_delete": "{account} deleted a liquidity pool #{id}.",
"liquidity_pool_deposit": "{account} add liquidity #{id}. paid {amount_a} and {amount_b}. received {received}.",
"liquidity_pool_withdraw": "{account} remove liquidity #{id}. paid {amount_c}. received {amount_a} and {amount_b}.",
"liquidity_pool_exchange": "{account} seal the deal, paid {amount_a}, received {amount_b}."
},
"page404": {
"asset_not_found_subtitle": "That asset does not exist",
Expand Down Expand Up @@ -2602,7 +2613,13 @@
"credit_offer_delete": "Delete credit offer",
"credit_offer_update": "Update credit offer",
"credit_offer_accept": "Accept credit offer",
"credit_deal_repay": "Repay credit deal"
"credit_deal_repay": "Repay credit deal",
"credit_deal_expired": "Credit deal expired",
"liquidity_pool_create": "Create liquidity pool",
"liquidity_pool_delete": "Delete liquidity pool",
"liquidity_pool_deposit": "Add liquidity",
"liquidity_pool_withdraw": "Remove liquidity",
"liquidity_pool_exchange": "Exchange liquidity"
},
"vesting_balance_create": "created vesting balance of",
"view_json": "Show raw json",
Expand Down
21 changes: 19 additions & 2 deletions app/assets/locales/locale-zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,18 @@
"witness_pay": "将见证人收入提取到账户",
"witness_receive": "已从见证人处获取见证",
"witness_update": "{account} 更新了见证人信息",
"worker_create": "{account} 创建了工人预算提案,请求日付工资 {pay}"
"worker_create": "{account} 创建了工人预算提案,请求日付工资 {pay}",
"credit_offer_delete": "{account} 删除P2P抵押贷 #{id}。",
"credit_deal_repay": "{account} 归还 {amount} P2P抵押贷借款,手续费:{fee}。",
"credit_offer_accept": "{account} 从P2P抵押贷借款 {amount}。",
"credit_offer_update": "{account} 更新P2P抵押贷 #{id}。",
"credit_offer_create": "{account} 创建 {amount} 的P2P抵押贷,手续费率:{fee}。",
"credit_deal_expired": "{account} P2P抵押贷逾期。",
"liquidity_pool_create": "{account} 创建流动池:{asset_a}-{asset_b}。",
"liquidity_pool_delete": "{account} 删除流动池 #{id}。",
"liquidity_pool_deposit": "{account} 增加流动性 #{id}。实际支出 {amount_a}和 {amount_b}。获得 {received}流动性代币。",
"liquidity_pool_withdraw": "{account} 减少流动性 #{id}。实际支出 {amount_c}流动性代币。获得 {amount_a}和 {amount_b}。",
"liquidity_pool_exchange": "{account} 完成交易,支出 {amount_a},获得 {amount_b}。"
},
"page404": {
"asset_not_found_subtitle": "此资产不存在",
Expand Down Expand Up @@ -2599,7 +2610,13 @@
"credit_offer_delete": "P2P抵押贷 删除",
"credit_offer_update": "P2P抵押贷 更新",
"credit_offer_accept": "P2P抵押贷 借款",
"credit_deal_repay": "P2P抵押贷 还款"
"credit_deal_repay": "P2P抵押贷 还款",
"credit_deal_expired": "P2P抵押贷 逾期",
"liquidity_pool_create": "创建流动池",
"liquidity_pool_delete": "删除流动池",
"liquidity_pool_deposit": "增加流动性",
"liquidity_pool_withdraw": "减少流动性",
"liquidity_pool_exchange": "流动性交易"
},
"vesting_balance_create": "创建待解冻余额",
"view_json": "显示原始 json",
Expand Down
269 changes: 269 additions & 0 deletions app/components/Blockchain/OperationAnt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,275 @@ class Operation {
</span>
);

break;
case "credit_offer_delete":
color = "cancel";
column = (
<TranslateWithLinks
string="operation.credit_offer_delete"
keys={[
{
type: "account",
value: op[1].owner_account,
arg: "account"
},
{
value: op[1].offer_id,
arg: "id"
}
]}
/>
);
break;
case "credit_deal_repay":
color = "success";
column = (
<TranslateWithLinks
string="operation.credit_deal_repay"
keys={[
{
type: "account",
value: op[1].account,
arg: "account"
},
{
type: "amount",
value: op[1].repay_amount,
arg: "amount"
},
{
type: "amount",
value: op[1].credit_fee,
arg: "fee"
}
]}
/>
);
break;
case "credit_offer_accept":
color = "success";
column = (
<TranslateWithLinks
string="operation.credit_offer_accept"
keys={[
{
type: "account",
value: op[1].borrower,
arg: "account"
},
{
type: "amount",
value: op[1].borrow_amount,
arg: "amount"
}
]}
/>
);
break;
case "credit_offer_update":
color = "warning";
column = (
<TranslateWithLinks
string="operation.credit_offer_update"
keys={[
{
type: "account",
value: op[1].owner_account,
arg: "account"
},
{
value: op[1].offer_id,
arg: "id"
}
]}
/>
);
break;
case "credit_offer_create":
color = "warning";
let amount = {
asset_id: op[1].asset_type,
amount: op[1].balance
};
column = (
<TranslateWithLinks
string="operation.credit_offer_create"
keys={[
{
type: "account",
value: op[1].owner_account,
arg: "account"
},
{
type: "amount",
value: amount,
arg: "amount"
},
{
value: `${(parseFloat(op[1].fee_rate) /
1000000) *
100}%`,
arg: "fee"
}
]}
/>
);
break;
case "credit_deal_expired":
color = "cancel";
column = (
<TranslateWithLinks
string="operation.credit_deal_expired"
keys={[
{
type: "account",
value: op[1].borrower,
arg: "account"
}
]}
/>
);
break;
case "liquidity_pool_create":
color = "warning";
column = (
<TranslateWithLinks
string="operation.liquidity_pool_create"
keys={[
{
type: "account",
value: op[1].account,
arg: "account"
},
{
type: "asset",
value: op[1].asset_a,
arg: "asset_a"
},
{
type: "asset",
value: op[1].asset_b,
arg: "asset_b"
}
]}
/>
);
break;
case "liquidity_pool_delete":
color = "cancel";
column = (
<TranslateWithLinks
string="operation.liquidity_pool_delete"
keys={[
{
type: "account",
value: op[1].account,
arg: "account"
},
{
value: op[1].pool,
arg: "id"
}
]}
/>
);
break;
case "liquidity_pool_deposit":
color = "warning";
column = (
<TranslateWithLinks
string="operation.liquidity_pool_deposit"
keys={[
{
type: "account",
value: op[1].account,
arg: "account"
},
{
value: op[1].pool,
arg: "id"
},
{
type: "amount",
value: result[1].paid[0],
arg: "amount_a"
},
{
type: "amount",
value: result[1].paid[1],
arg: "amount_b"
},
{
type: "amount",
value: result[1].received[0],
arg: "received"
}
]}
/>
);
break;
case "liquidity_pool_withdraw":
color = "warning";
column = (
<TranslateWithLinks
string="operation.liquidity_pool_withdraw"
keys={[
{
type: "account",
value: op[1].account,
arg: "account"
},
{
value: op[1].pool,
arg: "id"
},
{
type: "amount",
value: result[1].received[0],
arg: "amount_a"
},
{
type: "amount",
value: result[1].received[1],
arg: "amount_b"
},
{
type: "amount",
value: result[1].paid[0],
arg: "amount_c"
}
]}
/>
);
break;
case "liquidity_pool_exchange":
color = "success";
column = (
<TranslateWithLinks
string="operation.liquidity_pool_exchange"
keys={[
{
type: "account",
value: op[1].account,
arg: "account"
},
{
value: op[1].pool,
arg: "id"
},
{
type: "amount",
value: result[1].paid[0],
arg: "amount_a"
},
{
type: "amount",
value: result[1].received[1],
arg: "amount_b"
}
]}
/>
);
break;
default:
console.log("unimplemented op '" + ops[op[0]] + "':", op);
Expand Down