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

[0.11] Add mlnk and chex and some optimization. #94

Merged
merged 3 commits into from
Jan 26, 2024
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evm-bridge-frontend",
"version": "0.11.0",
"version": "0.11.1",
"private": true,
"scripts": {
"dev": "vite",
Expand Down
Binary file added public/images/chex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/mlnk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 49 additions & 11 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
<template #button-content>
<div class="my_dropdown-toggle">
<img :src="tokenList[selectedToken].logo"
style="margin-right:5px; height:25px; width:25px;object-fit:contain;">
class="dropdown-symbol">
{{ tokenList[selectedToken].name }}
</div>

</template>
<b-dropdown-item v-for="(item, index) in tokenList" @click="onSelectToken(index)">
<img :src="item.logo" style="margin-right:5px; height:25px; width:25px;object-fit:contain;">
<b-dropdown-item v-for="(item, index) in tokenList" @click="onSelectToken(index)" :disabled="!item.enabled">
<img :style="{opacity:item.enabled?1:0.5}" :src="item.logo" class="dropdown-symbol">
{{ item.name }}
</b-dropdown-item>
</b-dropdown>
Expand Down Expand Up @@ -167,7 +167,8 @@
<tbody>
<tr v-for="(item, index) in tokenList">
<td>{{item.name}}</td>
<td>{{item.ingressFee}} {{item.name}}</td>
<td v-if="item.enabled">{{item.ingressFee}} {{item.name}}</td>
<td v-else>-</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -291,6 +292,18 @@ export default {
warningList: ['gateiowallet'],
ingressFee: 0
},
{
name: 'MLNK', addr: '0x47c727d53ebe90317144917f66a588dd45d4b114', logo: 'images/mlnk.png',
blockList: ['gateiowallet', 'eosbndeposit', 'bybitdeposit', 'bitgeteosdep', 'kucoindoteos', 'binancecleos', 'coinbasebase', 'krakenkraken', 'huobideposit', 'okbtothemoon'],
warningList: [],
ingressFee: 0
},
{
name: 'CHEX', addr: '0xde90b6ad3b8c81f38af250d56dfd4bf256b87512', logo: 'images/chex.png',
blockList: ['gateiowallet', 'eosbndeposit', 'bybitdeposit', 'bitgeteosdep', 'kucoindoteos', 'binancecleos', 'coinbasebase', 'krakenkraken', 'huobideposit', 'okbtothemoon'],
warningList: [],
ingressFee: 0
},
{
name: 'ZEOS', addr: '0x477F09A0bDb273C8933429109fEBd3c3b0388B8A', logo: 'images/zeos.png',
blockList: ['gateiowallet', 'eosbndeposit', 'bybitdeposit', 'bitgeteosdep', 'kucoindoteos', 'binancecleos', 'coinbasebase', 'krakenkraken', 'huobideposit', 'okbtothemoon'],
Expand Down Expand Up @@ -335,7 +348,7 @@ export default {
this.rpc = (this.env === "TESTNET" ? new JsonRpc('https://jungle4.api.eosnation.io:443', { fetch }) : new JsonRpc('https://eos.api.eosnation.io:443', { fetch }));
// this.wallet.connect = this.connectWallet

this.tokenList = await this.refreshIngressFee(this.env === "TESTNET" ? this.tokenListTestnet : this.tokenListMainnet);
this.tokenList = await this.prepareList(this.env === "TESTNET" ? this.tokenListTestnet : this.tokenListMainnet);
console.log(this.tokenList)

this.selectedToken = 0;
Expand Down Expand Up @@ -425,24 +438,41 @@ export default {
blockList() { return this.tokenList[this.selectedToken].blockList; },
warningList() { return this.tokenList[this.selectedToken].warningList; },

async refreshIngressFee(tokenList) {
async prepareList(tokenListTemplate) {
// Make a deep clone
let tokenList = JSON.parse(JSON.stringify(tokenListTemplate))
console.log(tokenListTemplate)
console.log(tokenList)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really want to keep both console logs?

const erclist = (await this.rpc.fetch('/v1/chain/get_table_rows', { "table": "tokens", "scope": "eosio.erc2o", "code": "eosio.erc2o", "json": true })).rows
for(let erc of erclist) {
let fee = erc.ingress_fee.split(' ')

erc.ingressFee = Number(fee[0])
erc.symbol = fee[1]
erc.checksumAddr = Web3.utils.toChecksumAddress("0x"+erc.address.toLowerCase())
}

await tokenList.forEach(async e=>{
for (let index = 0; index < tokenList.length; index++) {
let e = tokenList[index]
if (e.name === "EOS") {
const r = await this.rpc.fetch('/v1/chain/get_table_rows', { "table": "config", "scope": "eosio.evm", "code": "eosio.evm", "json": true })
e.ingressFee = Number(r.rows[0].ingress_bridge_fee.split(' ')[0])
e.enabled = true
}
else {
const addr = e.addr.substr(2).toLowerCase()
e.enabled = false
for(const erc of erclist) {
if (erc.address.toLowerCase() === addr) {
e.ingressFee = Number(erc.ingress_fee.split(' ')[0])
if (erc.symbol.toLowerCase() === e.name.toLowerCase()) {
e.ingressFee = erc.ingressFee
e.addr = erc.checksumAddr
e.enabled = true
break
}
}
}
})
}

tokenList.sort((a,b)=> b.enabled - a.enabled)
return tokenList
},

Expand Down Expand Up @@ -772,6 +802,14 @@ export default {
</script>

<style scoped lang="scss">

.dropdown-symbol {
margin-right:5px;
height:25px;
width:25px;
object-fit:contain;
}

.transfer-btn {
margin: auto;
width: 170px;
Expand Down