Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dapp-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhanglian
dapp-web
Commits
b72e2909
提交
b72e2909
authored
1月 22, 2022
作者:
zhanglian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
根据链 id 获取 合约地址
上级
4a3ec0c5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
76 行增加
和
46 行删除
+76
-46
App.vue
src/App.vue
+0
-0
tokenList.js
src/utils/data/tokenList.js
+47
-7
thinkiumBridge.vue
src/views/thinkiumBridge/thinkiumBridge.vue
+29
-39
没有找到文件。
src/App.vue
浏览文件 @
b72e2909
差异被折叠。
点击展开。
src/utils/data/tokenList.js
浏览文件 @
b72e2909
...
...
@@ -90,15 +90,54 @@ const tokenListDev = [{
const
tokenListPro
=
[
{
name
:
'TKM'
,
index
:
1
,
chainName
:
'thk'
,
chainId
:
70001
,
url
:
''
,
balance
:
'0'
,
type
:
'main'
,
contractAddress
:
''
,
},
{
name
:
'TUSDT'
,
index
:
2
,
chainName
:
'thk'
,
chainId
:
70001
,
url
:
'https://pancakeswap.finance/images/tokens/0xe9e7cea3dedca5984780bafc599bd69add087d56.png'
,
balance
:
'0'
,
type
:
'erc20'
,
contractAddress
:
'0x50F102b368968F1bf5B8Ce1354AF61FF3c6e89a1'
,
},
{
name
:
'BTKM'
,
index
:
1
,
chainName
:
'bsc'
,
chainId
:
56
,
url
:
''
,
balance
:
'0'
,
type
:
'erc20'
,
contractAddress
:
'0x0806c5b183F8a622fE62c7344B04e6e6A7C82c2e'
,
},
{
name
:
'BUSDT'
,
index
:
2
,
chainName
:
'bsc'
,
chainId
:
56
,
url
:
'https://pancakeswap.finance/images/tokens/0xe9e7cea3dedca5984780bafc599bd69add087d56.png'
,
balance
:
'0'
,
type
:
'erc20'
,
contractAddress
:
'0x337610d27c682e347c9cd60bd4b3b107c9d34ddd'
,
},
]
export
function
getTokenList
(
currentChainId
){
currentChainId
-=
0
;
// if([60001, 97, 1337].includes(currentChainId)){
// return tokenListDev;
// }else{
// return tokenListPro;
// }
return
tokenListDev
;
console
.
log
(
'---currentChainId'
,
currentChainId
);
if
([
60001
,
97
,
1337
].
includes
(
currentChainId
)){
return
tokenListDev
;
}
else
if
([
70001
,
56
].
includes
(
currentChainId
)){
return
tokenListPro
;
}
}
\ No newline at end of file
src/views/thinkiumBridge/thinkiumBridge.vue
浏览文件 @
b72e2909
...
...
@@ -74,9 +74,9 @@ const { mapState: mapStateWallet } = createNamespacedHelpers('wallet');
const
{
mapState
:
mapStateNetwork
}
=
createNamespacedHelpers
(
'network'
);
const
erc20Abi
=
require
(
'../../abi/ERC20.json'
);
const
bridgeAbi
=
require
(
'../../abi/bridge.json'
);
const
bridgeContractAddress
=
'0x35645227C22c47Fe26953F14C8210b8Eb347CCd2'
;
let
bridge
;
export
default
{
data
()
{
...
...
@@ -171,18 +171,7 @@ export default {
}
console
.
log
(
'----123'
,
token
);
this
.
changeSelect
(
0
,
token
)
if
(
!
this
.
walletConnected
)
{
return
;
}
let
overrides
=
{
gasLimit
:
300000
,
from
:
window
.
defaultAccount
,
// gasLimit: 1000000,
value
:
'0x0'
}
bridge
=
new
window
.
web3
.
eth
.
Contract
(
bridgeAbi
,
bridgeContractAddress
,
overrides
);
},
refreshBalance
()
{
this
.
rbalance
++
...
...
@@ -288,27 +277,27 @@ export default {
let
holdName
=
this
.
holdItem
.
coinData
.
name
let
isTKM
=
holdName
==
'TKM'
||
holdName
==
'BTKM'
||
holdName
==
'TKM3'
||
holdName
==
'BTKM3'
let
minNum
=
0
if
(
isTKM
&&
value
<
1000
)
{
minNum
=
1000
this
.
$dialog
.
alert
({
title
:
this
.
$t
(
'title'
),
message
:
this
.
$t
(
'placeholder3'
,
{
minNum
}),
confirmButtonText
:
this
.
$t
(
'confirm'
)
}).
then
(()
=>
{
// on close
});
return
;
}
else
if
(
!
isTKM
&&
value
<
200
)
{
minNum
=
200
this
.
$dialog
.
alert
({
title
:
this
.
$t
(
'title'
),
message
:
this
.
$t
(
'placeholder3'
,
{
minNum
}),
confirmButtonText
:
this
.
$t
(
'confirm'
)
}).
then
(()
=>
{
// on close
});
return
;
}
//
if (isTKM && value
<
1000
)
{
//
minNum = 1000
//
this.$dialog.alert({
//
title: this.$t('title'),
//
message: this.$t('placeholder3', { minNum }),
//
confirmButtonText: this.$t('confirm')
//
}).then(() => {
//
// on close
//
});
//
return;
//
} else if (!isTKM && value
<
200
)
{
//
minNum = 200
//
this.$dialog.alert({
//
title: this.$t('title'),
//
message: this.$t('placeholder3', { minNum }),
//
confirmButtonText: this.$t('confirm')
//
}).then(() => {
//
// on close
//
});
//
return;
//
}
this
.
pageLoading
=
true
;
try
{
if
(
holdItem
.
coinData
.
type
==
'main'
)
{
...
...
@@ -327,6 +316,7 @@ export default {
this
.
refreshBalance
();
}
catch
(
err
)
{
console
.
log
(
'--err-transfer'
,
err
);
this
.
$notify
({
type
:
'warning'
,
message
:
this
.
$t
(
'failedTransfer'
)
});
}
...
...
@@ -340,14 +330,14 @@ export default {
let
overrides
=
{
value
,
}
await
bridge
.
methods
.
depositNative
(...
params
).
send
(
overrides
)
await
window
.
_
bridge
.
methods
.
depositNative
(...
params
).
send
(
overrides
)
},
async
depositToken
({
value
,
tokenAddress
,
address
=
window
.
defaultAccount
,
chain
})
{
let
token
=
''
;
await
this
.
approve
({
value
,
contractAddress
:
tokenAddress
,
spender
:
bridgeContractAddress
,
spender
:
window
.
bridgeContractAddress
,
})
let
params
=
[
tokenAddress
,
...
...
@@ -355,7 +345,7 @@ export default {
address
,
chain
]
await
bridge
.
methods
.
depositToken
(...
params
).
send
();
await
window
.
_
bridge
.
methods
.
depositToken
(...
params
).
send
();
},
async
approve
({
value
,
contractAddress
,
owner
=
window
.
defaultAccount
,
spender
})
{
console
.
log
({
value
,
contractAddress
,
owner
,
spender
});
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论