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 个修改的文件
包含
103 行增加
和
56 行删除
+103
-56
App.vue
src/App.vue
+28
-11
tokenList.js
src/utils/data/tokenList.js
+47
-7
thinkiumBridge.vue
src/views/thinkiumBridge/thinkiumBridge.vue
+28
-38
没有找到文件。
src/App.vue
浏览文件 @
b72e2909
...
...
@@ -16,6 +16,7 @@ import { connectWallet } from '@/service/loginService'
const
{
mapState
:
mapStateWallet
,
mapMutations
:
mapMutations
,
mapActions
:
mapActionsWallet
}
=
createNamespacedHelpers
(
'wallet'
)
const
{
mapState
:
mapStatesNetwork
,
mapActions
:
mapActionsNetwork
}
=
createNamespacedHelpers
(
'network'
)
const
bridgeAbi
=
require
(
'./abi/bridge.json'
);
const
abi
=
require
(
'./abi/ERC20.json'
)
const
byteCode
=
'0x60806040523480156200001157600080fd5b5060405162001a1a38038062001a1a83398101604081905262000034916200045e565b8351849084906200004d90600390602085019062000305565b5080516200006390600490602084019062000305565b506200007591506000905033620000b7565b620000a17f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000b7565b620000ad8183620000fa565b5050505062000567565b620000ce8282620001e360201b620007321760201c565b6000828152600660209081526040909120620000f591839062000740620001ef821b17901c565b505050565b6001600160a01b038216620001555760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620001699190620004ef565b90915550506001600160a01b0382166000908152602081905260408120805483929062000198908490620004ef565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35b5050565b620001df82826200020f565b600062000206836001600160a01b038416620002b3565b90505b92915050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16620001df5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200026f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054620002fc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000209565b50600062000209565b828054620003139062000514565b90600052602060002090601f01602090048101928262000337576000855562000382565b82601f106200035257805160ff191683800117855562000382565b8280016001018555821562000382579182015b828111156200038257825182559160200191906001019062000365565b506200039092915062000394565b5090565b5b8082111562000390576000815560010162000395565b600082601f830112620003bc578081fd5b81516001600160401b0380821115620003d957620003d962000551565b604051601f8301601f19908116603f0116810190828211818310171562000404576200040462000551565b8160405283815260209250868385880101111562000420578485fd5b8491505b8382101562000443578582018301518183018401529082019062000424565b838211156200045457848385830101525b9695505050505050565b6000806000806080858703121562000474578384fd5b84516001600160401b03808211156200048b578586fd5b6200049988838901620003ab565b95506020870151915080821115620004af578485fd5b50620004be87828801620003ab565b60408701516060880151919550935090506001600160a01b0381168114620004e4578182fd5b939692955090935050565b600082198211156200050f57634e487b7160e01b81526011600452602481fd5b500190565b600181811c908216806200052957607f821691505b602082108114156200054b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6114a380620005776000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063a457c2d71161007c578063a457c2d7146102d1578063a9059cbb146102e4578063ca15c873146102f7578063d53913931461030a578063d547741f14610331578063dd62ed3e1461034457600080fd5b806370a082311461024757806379cc6790146102705780639010d07c1461028357806391d14854146102ae57806395d89b41146102c1578063a217fddf146102c957600080fd5b8063248a9ca311610115578063248a9ca3146101c75780632f2ff15d146101ea578063313ce567146101ff57806336568abe1461020e578063395093511461022157806342966c681461023457600080fd5b806301ffc9a71461015257806306fdde031461017a578063095ea7b31461018f57806318160ddd146101a257806323b872dd146101b4575b600080fd5b6101656101603660046112bb565b61037d565b60405190151581526020015b60405180910390f35b6101826103a8565b6040516101719190611358565b61016561019d366004611237565b61043a565b6002545b604051908152602001610171565b6101656101c23660046111fc565b610450565b6101a66101d5366004611260565b60009081526005602052604090206001015490565b6101fd6101f8366004611278565b6104ff565b005b60405160128152602001610171565b6101fd61021c366004611278565b610526565b61016561022f366004611237565b610548565b6101fd610242366004611260565b610584565b6101a66102553660046111b0565b6001600160a01b031660009081526020819052604090205490565b6101fd61027e366004611237565b610591565b61029661029136600461129a565b610612565b6040516001600160a01b039091168152602001610171565b6101656102bc366004611278565b610631565b61018261065c565b6101a6600081565b6101656102df366004611237565b61066b565b6101656102f2366004611237565b610704565b6101a6610305366004611260565b610711565b6101a67f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6101fd61033f366004611278565b610728565b6101a66103523660046111ca565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60006001600160e01b03198216635a05180f60e01b14806103a257506103a282610755565b92915050565b6060600380546103b79061141c565b80601f01602080910402602001604051908101604052809291908181526020018280546103e39061141c565b80156104305780601f1061040557610100808354040283529160200191610430565b820191906000526020600020905b81548152906001019060200180831161041357829003601f168201915b5050505050905090565b600061044733848461078a565b50600192915050565b600061045d8484846108ae565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156104e75760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6104f4853385840361078a565b506001949350505050565b6105098282610a7e565b60008281526006602052604090206105219082610740565b505050565b6105308282610aa4565b60008281526006602052604090206105219082610b1e565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161044791859061057f90869061138b565b61078a565b61058e3382610b33565b50565b600061059d8333610352565b9050818110156105fb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b60648201526084016104de565b610608833384840361078a565b6105218383610b33565b600082815260066020526040812061062a9083610c81565b9392505050565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600480546103b79061141c565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156106ed5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104de565b6106fa338585840361078a565b5060019392505050565b60006104473384846108ae565b60008181526006602052604081206103a290610c8d565b6105308282610c97565b61073c8282610cbd565b5050565b600061062a836001600160a01b038416610d43565b60006001600160e01b03198216637965db0b60e01b14806103a257506301ffc9a760e01b6001600160e01b03198316146103a2565b6001600160a01b0383166107ec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104de565b6001600160a01b03821661084d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104de565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166109125760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104de565b6001600160a01b0382166109745760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104de565b6001600160a01b038316600090815260208190526040902054818110156109ec5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104de565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610a2390849061138b565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a6f91815260200190565b60405180910390a35b50505050565b600082815260056020526040902060010154610a9a8133610d92565b6105218383610cbd565b6001600160a01b0381163314610b145760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104de565b61073c8282610df6565b600061062a836001600160a01b038416610e5d565b6001600160a01b038216610b935760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104de565b6001600160a01b03821660009081526020819052604090205481811015610c075760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104de565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610c369084906113c2565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600061062a8383610f7a565b60006103a2825490565b600082815260056020526040902060010154610cb38133610d92565b6105218383610df6565b610cc78282610631565b61073c5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610cff3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054610d8a575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103a2565b5060006103a2565b610d9c8282610631565b61073c57610db4816001600160a01b03166014610fb2565b610dbf836020610fb2565b604051602001610dd09291906112e3565b60408051601f198184030181529082905262461bcd60e51b82526104de91600401611358565b610e008282610631565b1561073c5760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008181526001830160205260408120548015610f70576000610e816001836113c2565b8554909150600090610e95906001906113c2565b9050818114610f16576000866000018281548110610ec357634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110610ef457634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610f3557634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103a2565b60009150506103a2565b6000826000018281548110610f9f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60606000610fc18360026113a3565b610fcc90600261138b565b67ffffffffffffffff811115610ff257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561101c576020820181803683370190505b509050600360fc1b8160008151811061104557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061108257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006110a68460026113a3565b6110b190600161138b565b90505b6001811115611145576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110f357634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061111757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361113e81611405565b90506110b4565b50831561062a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104de565b80356001600160a01b03811681146111ab57600080fd5b919050565b6000602082840312156111c1578081fd5b61062a82611194565b600080604083850312156111dc578081fd5b6111e583611194565b91506111f360208401611194565b90509250929050565b600080600060608486031215611210578081fd5b61121984611194565b925061122760208501611194565b9150604084013590509250925092565b60008060408385031215611249578182fd5b61125283611194565b946020939093013593505050565b600060208284031215611271578081fd5b5035919050565b6000806040838503121561128a578182fd5b823591506111f360208401611194565b600080604083850312156112ac578182fd5b50508035926020909101359150565b6000602082840312156112cc578081fd5b81356001600160e01b03198116811461062a578182fd5b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161131b8160178501602088016113d9565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161134c8160288401602088016113d9565b01602801949350505050565b60208152600082518060208401526113778160408501602087016113d9565b601f01601f19169190910160400192915050565b6000821982111561139e5761139e611457565b500190565b60008160001904831182151516156113bd576113bd611457565b500290565b6000828210156113d4576113d4611457565b500390565b60005b838110156113f45781810151838201526020016113dc565b83811115610a785750506000910152565b60008161141457611414611457565b506000190190565b600181811c9082168061143057607f821691505b6020821081141561145157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220d75f005bae7e995b9475e8b877fb63db395a69e782a9379027b0f497107ae6b464736f6c63430008040033'
export
default
{
...
...
@@ -26,9 +27,31 @@ export default {
},
computed
:
{
...
mapStateWallet
([
'currentWalletAddress'
,
'interfaceSignature'
]),
...
mapStatesNetwork
([
'chainId'
])
...
mapStatesNetwork
([
'chainId'
]),
walletConnected
()
{
return
this
.
$store
.
getters
.
walletConnected
;
},
},
methods
:
{
init
()
{
let
bridgeContractAddress
=
'0x35645227C22c47Fe26953F14C8210b8Eb347CCd2'
;
if
([
60001
,
97
,
1337
].
includes
(
this
.
chainId
))
{
bridgeContractAddress
=
'0x35645227C22c47Fe26953F14C8210b8Eb347CCd2'
;
}
else
if
([
70001
,
56
].
includes
(
this
.
chainId
))
{
bridgeContractAddress
=
''
;
}
let
overrides
=
{
gasLimit
:
300000
,
from
:
window
.
defaultAccount
,
// gasLimit: 1000000,
value
:
'0x0'
}
window
.
bridgeContractAddress
=
bridgeContractAddress
;
window
.
_bridge
=
new
window
.
web3
.
eth
.
Contract
(
bridgeAbi
,
bridgeContractAddress
,
overrides
);
},
},
methods
:
{},
created
()
{
connectWallet
();
metaMask
.
handleAccountsChanged
(
connectWallet
);
...
...
@@ -59,15 +82,9 @@ export default {
},
watch
:
{
interfaceSignature
()
{
if
(
this
.
interfaceSignature
)
{
let
interfaceSignature
=
sessionStorage
.
getItem
(
'interfaceSignature'
);
if
(
interfaceSignature
!==
this
.
interfaceSignature
)
{
sessionStorage
.
setItem
(
'interfaceSignature'
,
this
.
interfaceSignature
);
}
else
{
// this.init();
}
walletConnected
()
{
if
(
this
.
walletConnected
)
{
this
.
init
();
}
}
}
...
...
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
()
{
...
...
@@ -172,17 +172,6 @@ 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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论