提交 20c9cf0d authored 作者: zhanglian's avatar zhanglian

update

上级 3b778f2e
{
"plugins": [
[
"@babel/plugin-transform-runtime"
],
["import", {
"libraryName": "vant",
"libraryDirectory": "es",
"style": true
}]
]
}
\ No newline at end of file
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
npm run build npm run build
ssh stephen@43.247.184.53 -p 52919 "mkdir /var/www/mythverse ; cd /var/www/mythverse ; rm -rf *" ssh stephen@43.247.184.53 -p 52919 "mkdir /var/www/bridge ; cd /var/www/bridge ; rm -rf *"
scp -P 52919 -r ./dist/* stephen@43.247.184.53:/var/www/mythverse scp -P 52919 -r ./dist/* stephen@43.247.184.53:/var/www/bridge
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"serve": "vue-cli-service serve --open", "serve": "vue-cli-service serve --open",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"test": "mocha" "test": "mocha --require @babel/register test/*.js"
}, },
"dependencies": { "dependencies": {
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
...@@ -19,20 +19,30 @@ ...@@ -19,20 +19,30 @@
"moment": "^2.29.1", "moment": "^2.29.1",
"swiper": "^6.5.4", "swiper": "^6.5.4",
"thinkium-web3js": "^1.2.0", "thinkium-web3js": "^1.2.0",
"vant": "^2.12.37",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-async-computed": "^3.9.0",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
"vuedraggable": "^2.24.3", "vuedraggable": "^2.24.3",
"vuex": "^3.6.2", "vuex": "^3.6.2",
"web3": "^1.6.1" "web3": "^1.6.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.16.0",
"@babel/core": "^7.16.5",
"@babel/preset-env": "^7.16.5",
"@babel/register": "^7.16.5",
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1", "babel-plugin-component": "^1.1.1",
"babel-plugin-import": "^1.13.3",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"mocha": "^9.1.3", "mocha": "^9.1.3",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
......
...@@ -9,10 +9,15 @@ ...@@ -9,10 +9,15 @@
<script> <script>
import { createNamespacedHelpers } from 'vuex'; import { createNamespacedHelpers } from 'vuex';
import _storage from './utils/storage' import _storage from './utils/storage'
import * as metaMask from './api/demoMETAMASK'
import { connectWallet } from '@/service/loginService'
const { mapState: mapStateWallet, mapMutations: mapMutations, mapActions: mapActionsWallet } = createNamespacedHelpers('wallet') const { mapState: mapStateWallet, mapMutations: mapMutations, mapActions: mapActionsWallet } = createNamespacedHelpers('wallet')
const { mapState: mapStatesNetwork, mapActions: mapActionsNetwork } = createNamespacedHelpers('network') const { mapState: mapStatesNetwork, mapActions: mapActionsNetwork } = createNamespacedHelpers('network')
const abi = require('./abi/ERC20.json')
const byteCode = '0x60806040523480156200001157600080fd5b5060405162001a1a38038062001a1a83398101604081905262000034916200045e565b8351849084906200004d90600390602085019062000305565b5080516200006390600490602084019062000305565b506200007591506000905033620000b7565b620000a17f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000b7565b620000ad8183620000fa565b5050505062000567565b620000ce8282620001e360201b620007321760201c565b6000828152600660209081526040909120620000f591839062000740620001ef821b17901c565b505050565b6001600160a01b038216620001555760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b8060026000828254620001699190620004ef565b90915550506001600160a01b0382166000908152602081905260408120805483929062000198908490620004ef565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35b5050565b620001df82826200020f565b600062000206836001600160a01b038416620002b3565b90505b92915050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16620001df5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200026f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054620002fc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000209565b50600062000209565b828054620003139062000514565b90600052602060002090601f01602090048101928262000337576000855562000382565b82601f106200035257805160ff191683800117855562000382565b8280016001018555821562000382579182015b828111156200038257825182559160200191906001019062000365565b506200039092915062000394565b5090565b5b8082111562000390576000815560010162000395565b600082601f830112620003bc578081fd5b81516001600160401b0380821115620003d957620003d962000551565b604051601f8301601f19908116603f0116810190828211818310171562000404576200040462000551565b8160405283815260209250868385880101111562000420578485fd5b8491505b8382101562000443578582018301518183018401529082019062000424565b838211156200045457848385830101525b9695505050505050565b6000806000806080858703121562000474578384fd5b84516001600160401b03808211156200048b578586fd5b6200049988838901620003ab565b95506020870151915080821115620004af578485fd5b50620004be87828801620003ab565b60408701516060880151919550935090506001600160a01b0381168114620004e4578182fd5b939692955090935050565b600082198211156200050f57634e487b7160e01b81526011600452602481fd5b500190565b600181811c908216806200052957607f821691505b602082108114156200054b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6114a380620005776000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063a457c2d71161007c578063a457c2d7146102d1578063a9059cbb146102e4578063ca15c873146102f7578063d53913931461030a578063d547741f14610331578063dd62ed3e1461034457600080fd5b806370a082311461024757806379cc6790146102705780639010d07c1461028357806391d14854146102ae57806395d89b41146102c1578063a217fddf146102c957600080fd5b8063248a9ca311610115578063248a9ca3146101c75780632f2ff15d146101ea578063313ce567146101ff57806336568abe1461020e578063395093511461022157806342966c681461023457600080fd5b806301ffc9a71461015257806306fdde031461017a578063095ea7b31461018f57806318160ddd146101a257806323b872dd146101b4575b600080fd5b6101656101603660046112bb565b61037d565b60405190151581526020015b60405180910390f35b6101826103a8565b6040516101719190611358565b61016561019d366004611237565b61043a565b6002545b604051908152602001610171565b6101656101c23660046111fc565b610450565b6101a66101d5366004611260565b60009081526005602052604090206001015490565b6101fd6101f8366004611278565b6104ff565b005b60405160128152602001610171565b6101fd61021c366004611278565b610526565b61016561022f366004611237565b610548565b6101fd610242366004611260565b610584565b6101a66102553660046111b0565b6001600160a01b031660009081526020819052604090205490565b6101fd61027e366004611237565b610591565b61029661029136600461129a565b610612565b6040516001600160a01b039091168152602001610171565b6101656102bc366004611278565b610631565b61018261065c565b6101a6600081565b6101656102df366004611237565b61066b565b6101656102f2366004611237565b610704565b6101a6610305366004611260565b610711565b6101a67f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6101fd61033f366004611278565b610728565b6101a66103523660046111ca565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60006001600160e01b03198216635a05180f60e01b14806103a257506103a282610755565b92915050565b6060600380546103b79061141c565b80601f01602080910402602001604051908101604052809291908181526020018280546103e39061141c565b80156104305780601f1061040557610100808354040283529160200191610430565b820191906000526020600020905b81548152906001019060200180831161041357829003601f168201915b5050505050905090565b600061044733848461078a565b50600192915050565b600061045d8484846108ae565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156104e75760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6104f4853385840361078a565b506001949350505050565b6105098282610a7e565b60008281526006602052604090206105219082610740565b505050565b6105308282610aa4565b60008281526006602052604090206105219082610b1e565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161044791859061057f90869061138b565b61078a565b61058e3382610b33565b50565b600061059d8333610352565b9050818110156105fb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b60648201526084016104de565b610608833384840361078a565b6105218383610b33565b600082815260066020526040812061062a9083610c81565b9392505050565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600480546103b79061141c565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156106ed5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104de565b6106fa338585840361078a565b5060019392505050565b60006104473384846108ae565b60008181526006602052604081206103a290610c8d565b6105308282610c97565b61073c8282610cbd565b5050565b600061062a836001600160a01b038416610d43565b60006001600160e01b03198216637965db0b60e01b14806103a257506301ffc9a760e01b6001600160e01b03198316146103a2565b6001600160a01b0383166107ec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104de565b6001600160a01b03821661084d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104de565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166109125760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104de565b6001600160a01b0382166109745760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104de565b6001600160a01b038316600090815260208190526040902054818110156109ec5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104de565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610a2390849061138b565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a6f91815260200190565b60405180910390a35b50505050565b600082815260056020526040902060010154610a9a8133610d92565b6105218383610cbd565b6001600160a01b0381163314610b145760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104de565b61073c8282610df6565b600061062a836001600160a01b038416610e5d565b6001600160a01b038216610b935760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104de565b6001600160a01b03821660009081526020819052604090205481811015610c075760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104de565b6001600160a01b0383166000908152602081905260408120838303905560028054849290610c369084906113c2565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600061062a8383610f7a565b60006103a2825490565b600082815260056020526040902060010154610cb38133610d92565b6105218383610df6565b610cc78282610631565b61073c5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610cff3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054610d8a575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103a2565b5060006103a2565b610d9c8282610631565b61073c57610db4816001600160a01b03166014610fb2565b610dbf836020610fb2565b604051602001610dd09291906112e3565b60408051601f198184030181529082905262461bcd60e51b82526104de91600401611358565b610e008282610631565b1561073c5760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008181526001830160205260408120548015610f70576000610e816001836113c2565b8554909150600090610e95906001906113c2565b9050818114610f16576000866000018281548110610ec357634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110610ef457634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610f3557634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506103a2565b60009150506103a2565b6000826000018281548110610f9f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b60606000610fc18360026113a3565b610fcc90600261138b565b67ffffffffffffffff811115610ff257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561101c576020820181803683370190505b509050600360fc1b8160008151811061104557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061108257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006110a68460026113a3565b6110b190600161138b565b90505b6001811115611145576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106110f357634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061111757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361113e81611405565b90506110b4565b50831561062a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104de565b80356001600160a01b03811681146111ab57600080fd5b919050565b6000602082840312156111c1578081fd5b61062a82611194565b600080604083850312156111dc578081fd5b6111e583611194565b91506111f360208401611194565b90509250929050565b600080600060608486031215611210578081fd5b61121984611194565b925061122760208501611194565b9150604084013590509250925092565b60008060408385031215611249578182fd5b61125283611194565b946020939093013593505050565b600060208284031215611271578081fd5b5035919050565b6000806040838503121561128a578182fd5b823591506111f360208401611194565b600080604083850312156112ac578182fd5b50508035926020909101359150565b6000602082840312156112cc578081fd5b81356001600160e01b03198116811461062a578182fd5b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161131b8160178501602088016113d9565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161134c8160288401602088016113d9565b01602801949350505050565b60208152600082518060208401526113778160408501602087016113d9565b601f01601f19169190910160400192915050565b6000821982111561139e5761139e611457565b500190565b60008160001904831182151516156113bd576113bd611457565b500290565b6000828210156113d4576113d4611457565b500390565b60005b838110156113f45781810151838201526020016113dc565b83811115610a785750506000910152565b60008161141457611414611457565b506000190190565b600181811c9082168061143057607f821691505b6020821081141561145157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220d75f005bae7e995b9475e8b877fb63db395a69e782a9379027b0f497107ae6b464736f6c63430008040033'
export default { export default {
data() { data() {
return { return {
...@@ -23,9 +28,36 @@ export default { ...@@ -23,9 +28,36 @@ export default {
...mapStateWallet(['currentWalletAddress', 'interfaceSignature']), ...mapStateWallet(['currentWalletAddress', 'interfaceSignature']),
...mapStatesNetwork(['chainId']) ...mapStatesNetwork(['chainId'])
}, },
methods: { methods: {},
created() {
connectWallet();
metaMask.handleAccountsChanged(connectWallet);
metaMask.handleNetworkChanged(connectWallet);
setTimeout(() => {
// metaMask.deployContract({
// bytecode: byteCode,
// abi: abi,
// params: [
// '0x7746943934c724621d01bCF3621b84576B460e4c',
// ['0x7746943934c724621d01bCF3621b84576B460e4c'],
// '1',
// '0xc1ec694522bf577775c6e704f0ad479dba0ad436'
// ]
// })
// metaMask.deployContract({
// bytecode: byteCode,
// abi: abi,
// params: [
// 'TUSDT',
// 'TUSDT',
// '10000000000000000000000000',
// window.defaultAccount
// ]
// })
}, 3000)
}, },
created() {},
watch: { watch: {
interfaceSignature() { interfaceSignature() {
if (this.interfaceSignature) { if (this.interfaceSignature) {
...@@ -33,7 +65,7 @@ export default { ...@@ -33,7 +65,7 @@ export default {
if (interfaceSignature !== this.interfaceSignature) { if (interfaceSignature !== this.interfaceSignature) {
sessionStorage.setItem('interfaceSignature', this.interfaceSignature); sessionStorage.setItem('interfaceSignature', this.interfaceSignature);
} else { } else {
this.init(); // this.init();
} }
} }
......
[
{
"inputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "string",
"name": "symbol",
"type": "string"
},
{
"internalType": "uint256",
"name": "initialSupply",
"type": "uint256"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"name": "DEFAULT_ADMIN_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MINTER_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "burnFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "getRoleAdmin",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "getRoleMember",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "getRoleMemberCount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "grantRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "hasRole",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "renounceRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "revokeRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
\ No newline at end of file
[
{
"inputs": [
{
"internalType": "address[]",
"name": "_owners",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "_ownerRequired",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "TaskType",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "class",
"type": "string"
},
{
"indexed": false,
"internalType": "address",
"name": "oldAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAddress",
"type": "address"
}
],
"name": "AdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "TaskType",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "class",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "previousNum",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "requiredNum",
"type": "uint256"
}
],
"name": "AdminRequiredNumChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "AdminTaskDropped",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "targetAddress",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "chain",
"type": "string"
}
],
"name": "DepositNative",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "targetAddress",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "chain",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "nativeValue",
"type": "uint256"
}
],
"name": "DepositToken",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawDoneNative",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawDoneToken",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawingNative",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawingToken",
"type": "event"
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "address",
"name": "oneAddress",
"type": "address"
}
],
"name": "addAddress",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "depositSelector",
"outputs": [
{
"internalType": "string",
"name": "selector",
"type": "string"
},
{
"internalType": "bool",
"name": "isValueFirst",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "address",
"name": "oneAddress",
"type": "address"
}
],
"name": "dropAddress",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "dropTask",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
}
],
"name": "getAdminAddresses",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "getOperatorRequireNum",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "getOwnerRequireNum",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "uint256",
"name": "requiredNum",
"type": "uint256"
}
],
"name": "resetRequiredNum",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "withdrawSelector",
"outputs": [
{
"internalType": "string",
"name": "selector",
"type": "string"
},
{
"internalType": "bool",
"name": "isValueFirst",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{
"internalType": "string",
"name": "_targetAddress",
"type": "string"
},
{
"internalType": "string",
"name": "chain",
"type": "string"
}
],
"name": "depositNative",
"outputs": [],
"stateMutability": "payable",
"type": "function",
"payable": true
},
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "string",
"name": "_targetAddress",
"type": "string"
},
{
"internalType": "string",
"name": "chain",
"type": "string"
}
],
"name": "depositToken",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "payable",
"type": "function",
"payable": true
},
{
"inputs": [
{
"internalType": "address payable",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "string",
"name": "proof",
"type": "string"
},
{
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "withdrawNative",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "string",
"name": "proof",
"type": "string"
},
{
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "withdrawToken",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "address",
"name": "oldAddress",
"type": "address"
},
{
"internalType": "address",
"name": "newAddress",
"type": "address"
}
],
"name": "modifyAdminAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getLogicAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "getStoreAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "unpause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "string",
"name": "method",
"type": "string"
},
{
"internalType": "bool",
"name": "_isValueFirst",
"type": "bool"
}
],
"name": "setDepositSelector",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "string",
"name": "method",
"type": "string"
},
{
"internalType": "bool",
"name": "_isValueFirst",
"type": "bool"
}
],
"name": "setWithdrawSelector",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
\ No newline at end of file
[{
"constant": true,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "isPlayer",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "",
"type": "address"
}],
"name": "addressWithdraw",
"outputs": [{
"name": "amount",
"type": "uint256"
},
{
"name": "send",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "nodeId",
"type": "bytes"
},
{
"name": "destination",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"name": "adminWithdrawPart",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "_maxPlayer",
"type": "uint256"
}],
"name": "setMaxPlayer",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "depositsTotal",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "",
"type": "uint256"
},
{
"name": "",
"type": "address"
}
],
"name": "confirmations",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "miner",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "playerLength",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getWidthdrawPlayers",
"outputs": [{
"name": "",
"type": "address[]"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "doSplit",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "nodeId",
"type": "bytes"
},
{
"name": "nodeType",
"type": "uint8"
},
{
"name": "bindAddr",
"type": "address"
},
{
"name": "nonce",
"type": "uint64"
},
{
"name": "amount",
"type": "uint256"
},
{
"name": "nodeSig",
"type": "string"
}
],
"name": "deposit",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": true,
"stateMutability": "payable",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "index",
"type": "uint256"
}],
"name": "widthdrawPlayers",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "widthdrawPlayerLength",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "destination",
"type": "address"
},
{
"name": "rate",
"type": "uint256"
},
{
"name": "limit",
"type": "uint256"
}
],
"name": "setMinerAndRate",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "commissionRate",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "PosReal",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "",
"type": "uint256"
}],
"name": "commitees",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "curNodeId",
"outputs": [{
"name": "",
"type": "bytes"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "addr",
"type": "address"
}],
"name": "getAddressUseableTotal",
"outputs": [{
"name": "curAddressUseableTotal",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "",
"type": "address"
}],
"name": "isCommitee",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "value",
"type": "uint256"
}],
"name": "withdrawCash",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "_minAmount",
"type": "uint256"
}],
"name": "setMinAmount",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getPlayers",
"outputs": [{
"name": "",
"type": "address[]"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "assignedTotal",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "",
"type": "uint256"
}],
"name": "transactions",
"outputs": [{
"name": "allocatedType",
"type": "bytes32"
},
{
"name": "destination",
"type": "address"
},
{
"name": "nodeId",
"type": "bytes"
},
{
"name": "amount",
"type": "uint256"
},
{
"name": "executed",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "nodeId",
"type": "bytes"
},
{
"name": "destination",
"type": "address"
}
],
"name": "adminWithdraw",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "lastUser",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "transactionCount",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "bindAddr",
"type": "address"
}],
"name": "getDepositAmount",
"outputs": [{
"name": "amount",
"type": "int256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "required",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "account",
"type": "address"
}],
"name": "isWidthdrawPlayer",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "",
"type": "address"
}],
"name": "addressDepositTotal",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "MAX_COMMITEE_COUNT",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "index",
"type": "uint256"
}],
"name": "players",
"outputs": [{
"name": "",
"type": "address"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "addr",
"type": "address"
}],
"name": "ownerWithdraw",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "commissionLimit",
"outputs": [{
"name": "",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{
"name": "_PosReal",
"type": "address"
},
{
"name": "_commitees",
"type": "address[]"
},
{
"name": "_required",
"type": "uint256"
},
{
"name": "_owner",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"payable": true,
"stateMutability": "payable",
"type": "fallback"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "sender",
"type": "address"
},
{
"indexed": true,
"name": "transactionId",
"type": "uint256"
}
],
"name": "Confirmation",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "sender",
"type": "address"
},
{
"indexed": true,
"name": "transactionId",
"type": "uint256"
}
],
"name": "Revocation",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "transactionId",
"type": "uint256"
}],
"name": "Submission",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "transactionId",
"type": "uint256"
}],
"name": "Execution",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "transactionId",
"type": "uint256"
}],
"name": "ExecutionSuccess",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "transactionId",
"type": "uint256"
}],
"name": "ExecutionFailure",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "commitee",
"type": "address"
}],
"name": "CommiteeAddition",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "commitee",
"type": "address"
}],
"name": "CommiteeRemoval",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "required",
"type": "uint256"
}],
"name": "RequirementChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "allocatedType",
"type": "string"
},
{
"indexed": false,
"name": "nodeId",
"type": "bytes"
},
{
"indexed": false,
"name": "amount",
"type": "uint256"
}
],
"name": "SubmitTransaction",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "nodeId",
"type": "bytes"
},
{
"indexed": false,
"name": "nodeType",
"type": "uint8"
},
{
"indexed": false,
"name": "bindAddr",
"type": "address"
},
{
"indexed": false,
"name": "nonce",
"type": "uint64"
},
{
"indexed": false,
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"name": "nodeSig",
"type": "string"
}
],
"name": "Deposit",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "status",
"type": "bool"
}],
"name": "DepositResult",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "nodeId",
"type": "bytes"
},
{
"indexed": false,
"name": "bindAddr",
"type": "address"
},
{
"indexed": false,
"name": "amount",
"type": "uint256"
}
],
"name": "WithdrawPart",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "nodeId",
"type": "bytes"
},
{
"indexed": false,
"name": "bindAddr",
"type": "address"
}
],
"name": "Withdraw",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": false,
"name": "bindAddr",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "WithdrawCash",
"type": "event"
},
{
"anonymous": false,
"inputs": [{
"indexed": true,
"name": "payee",
"type": "address"
},
{
"indexed": false,
"name": "weiAmount",
"type": "uint256"
}
],
"name": "Receive",
"type": "event"
},
{
"constant": false,
"inputs": [{
"name": "allocatedType",
"type": "string"
},
{
"name": "nodeId",
"type": "bytes"
},
{
"name": "amount",
"type": "uint256"
}
],
"name": "submitTransaction",
"outputs": [{
"name": "transactionId",
"type": "uint256"
}],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "transactionId",
"type": "uint256"
}],
"name": "confirmTransaction",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "transactionId",
"type": "uint256"
}],
"name": "revokeConfirmation",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "transactionId",
"type": "uint256"
}],
"name": "isConfirmed",
"outputs": [{
"name": "",
"type": "bool"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "transactionId",
"type": "uint256"
}],
"name": "getConfirmationCount",
"outputs": [{
"name": "count",
"type": "uint256"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getCommitees",
"outputs": [{
"name": "",
"type": "address[]"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "transactionId",
"type": "uint256"
}],
"name": "getConfirmations",
"outputs": [{
"name": "_confirmations",
"type": "address[]"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "commitee",
"type": "address"
}],
"name": "addCommitee",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "commitee",
"type": "address"
}],
"name": "removeCommitee",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "commitee",
"type": "address"
},
{
"name": "newCommitee",
"type": "address"
}
],
"name": "replaceCommitee",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [{
"name": "_required",
"type": "uint256"
}],
"name": "changeRequirement",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [{
"name": "from",
"type": "uint256"
},
{
"name": "to",
"type": "uint256"
},
{
"name": "pending",
"type": "bool"
},
{
"name": "executed",
"type": "bool"
}
],
"name": "getTransactionIds",
"outputs": [{
"name": "_transactionIds",
"type": "uint256[]"
}],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
\ No newline at end of file
...@@ -91,8 +91,7 @@ export async function sendTransaction({ from = window.defaultAccount, to, value ...@@ -91,8 +91,7 @@ export async function sendTransaction({ from = window.defaultAccount, to, value
} }
export function deployContract({ bytecode, abi, params = [],from = window.defaultAccount, gas = '4700000' }) { export function deployContract({ bytecode, abi, params = [],from = window.defaultAccount, gas = '30000000' }) {
console.log('---abi', abi)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let myContract = new window.web3.eth.Contract(abi); let myContract = new window.web3.eth.Contract(abi);
let transactionHash; let transactionHash;
......
...@@ -12,7 +12,6 @@ import value from '@/utils/data/value'; ...@@ -12,7 +12,6 @@ import value from '@/utils/data/value';
// 全局方法 // 全局方法
Vue.prototype.$formateLength = (length) => { Vue.prototype.$formateLength = (length) => {
return (length - 0) * 0.0521 + 'vmax'; return (length - 0) * 0.0521 + 'vmax';
} }
...@@ -34,6 +33,7 @@ Vue.prototype.$AIsBiggerThanB = AIsBiggerThanB; ...@@ -34,6 +33,7 @@ Vue.prototype.$AIsBiggerThanB = AIsBiggerThanB;
// 全局属性 // 全局属性
Vue.prototype.$storageKeyConfig = storageKeyConfig; Vue.prototype.$storageKeyConfig = storageKeyConfig;
Vue.prototype.$value = value; Vue.prototype.$value = value;
......
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import router from './router/index.js' import router from './router/index.js'
import AsyncComputed from 'vue-async-computed'
import './plugin/vant'
import './filters/' import './filters/'
import '@/assets/styles/reset.css' import '@/assets/styles/reset.css'
import '@/assets/styles/common.css' import '@/assets/styles/common.css'
...@@ -11,19 +14,15 @@ import './global.js' ...@@ -11,19 +14,15 @@ import './global.js'
import store from '@/store/index.js' import store from '@/store/index.js'
import animated from 'animate.css' import animated from 'animate.css'
import i18n from './i18n'; import i18n from './i18n';
import 'swiper/swiper-bundle.css'
import 'swiper/swiper-bundle.css'
// Vue.prototype.$message = Message;
// Vue.use(Pagination);
// Vue.use(Dialog);
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(animated) Vue.use(animated)
// Vue.use(ElementUI); Vue.use(AsyncComputed)
new Vue({ new Vue({
router, router,
i18n, i18n,
......
import Vue from 'vue'
import { Dialog } from 'vant';
// 全局注册
Vue.use(Dialog);
\ No newline at end of file
...@@ -12,22 +12,24 @@ export async function connectWallet(){ ...@@ -12,22 +12,24 @@ export async function connectWallet(){
store.commit('network/SET_CHAIN_ID', '') store.commit('network/SET_CHAIN_ID', '')
const { address } = await init(); const { address } = await init();
const chainId = await getChainId(); const chainId = await getChainId();
console.log('----chainId-typeof' , typeof chainId);
if (chainId && address) { if (chainId && address) {
let signature,expireTime; // let signature,expireTime;
if (interfaceSignature.signatureHasExpired(chainId, address)) { // if (interfaceSignature.signatureHasExpired(chainId, address)) {
const SignatureInfo= await interfaceSignature.setSignatureInfo(chainId, address) || {}; // const SignatureInfo= await interfaceSignature.setSignatureInfo(chainId, address) || {};
signature = SignatureInfo.signature; // signature = SignatureInfo.signature;
expireTime = SignatureInfo.expireTime; // expireTime = SignatureInfo.expireTime;
} else { // } else {
const SignatureInfo = interfaceSignature.getSignatureInfo(chainId, address) || {}; // const SignatureInfo = interfaceSignature.getSignatureInfo(chainId, address) || {};
signature = SignatureInfo.signature; // signature = SignatureInfo.signature;
expireTime = SignatureInfo.expireTime; // expireTime = SignatureInfo.expireTime;
} // }
store.commit('wallet/SET_CURRENT_WALLET_ADDRESS', address) store.commit('wallet/SET_CURRENT_WALLET_ADDRESS', address)
store.commit('wallet/SET_INTERFACE_SIGNATURE', signature)
store.commit('wallet/SET_EXPIRE_TIME', expireTime)
store.commit('network/SET_CHAIN_ID', chainId) store.commit('network/SET_CHAIN_ID', chainId)
// store.commit('wallet/SET_INTERFACE_SIGNATURE', signature)
// store.commit('wallet/SET_EXPIRE_TIME', expireTime)
} }
} }
\ No newline at end of file
const getters = { const getters = {
walletConnected: state => !!(state.wallet.interfaceSignature), // 是否已连接钱包 walletConnected: state => !!(state.wallet.currentWalletAddress && state.network.chainId), // 是否已连接钱包
currentWalletAddress: state => state.wallet.currentWalletAddress, currentWalletAddress: state => state.wallet.currentWalletAddress,
}; };
......
...@@ -6,15 +6,15 @@ ...@@ -6,15 +6,15 @@
<div class="redemption-wrap"> <div class="redemption-wrap">
<div class="redemption-window hold"> <div class="redemption-window hold">
<div class="redemption-tit"> <div class="redemption-tit">
<div class="redemption-name">THINKIUM</div> <div class="redemption-name">{{holdItem.name}}</div>
<div class="redemption-over">余额:{{holdItem.over}}</div> <div class="redemption-over">余额:{{$toRegularNumber(balance)}}</div>
</div> </div>
<div class="redemption-money"> <div class="redemption-money">
<div class="token-name" @click="changeToken('THINKIUM')"> <div class="token-name" @click="changeToken('holdItem', holdItem.chainName)">
<img :src="holdItem.url || require(`@/assets/images/logo.png`)" alt=""> <img :src="holdItem.coinData.url || require(`@/assets/images/logo.png`)" alt="">
<span>{{holdItem.name}}</span> <span>{{holdItem.coinData.name}}</span>
</div> </div>
<input type="text" dir="rtl" placeholder="请输入兑换数量(需大于10)" v-positiveInt> <input type="text" placeholder="请输入兑换数量(需大于10)" v-positiveInt class="number-input">
</div> </div>
</div> </div>
<div class="change-img"> <div class="change-img">
...@@ -23,23 +23,23 @@ ...@@ -23,23 +23,23 @@
</div> </div>
<div class="redemption-window exchange"> <div class="redemption-window exchange">
<div class="redemption-tit"> <div class="redemption-tit">
<div class="redemption-name">BSC</div> <div class="redemption-name">{{exchangeItem.name}}</div>
<div class="redemption-over">预计获得</div> <div class="redemption-over">预计获得</div>
</div> </div>
<div class="redemption-money"> <div class="redemption-money">
<div class="token-name" @click="changeToken('BSC')"> <div class="token-name" @click="changeToken('exchangeItem', exchangeItem.chainName)">
<img :src="exchangeItem.url || require(`@/assets/images/logo.png`)" alt=""> <img :src="exchangeItem.coinData.url || require(`@/assets/images/logo.png`)" alt="">
<span>{{exchangeItem.name}}</span> <span>{{exchangeItem.coinData.name}}</span>
</div> </div>
<div class="number">{{45.34}}</div> <div class="number">{{obtain}}</div>
</div> </div>
</div> </div>
<div class="handling-fee">手续费<span>3%</span></div> <div class="handling-fee">手续费<span>3%</span></div>
</div> </div>
<div class="convert-btn">兑换</div> <div class="convert-btn" @click="transfer">兑换</div>
<Dialog :title="'选择Token'" :visible="dialogVisible" @close="dialogVisible = false" v-if="dialogVisible"> <EDialog :title="'选择Token'" :visible="dialogVisible" @close="dialogVisible = false" v-if="dialogVisible">
<ul class="select-list"> <ul class="select-list">
<li class="select-item" v-for="(item, index) in tokenList" @click="changeSelect(index,item)" :class="selectIndex === index ? 'active' : ''"> <li class="select-item" v-for="(item, index) in tokenList" :key="index" @click="changeSelect(index,item)" :class="selectIndex === index ? 'active' : ''">
<div class="item-left"> <div class="item-left">
<img :src="item.url || require(`@/assets/images/logo.png`)" alt=""> <img :src="item.url || require(`@/assets/images/logo.png`)" alt="">
<span class="item-name">{{item.name}}</span> <span class="item-name">{{item.name}}</span>
...@@ -47,97 +47,355 @@ ...@@ -47,97 +47,355 @@
<img v-if="selectIndex === index" src="../../assets/images/select.png" alt=""> <img v-if="selectIndex === index" src="../../assets/images/select.png" alt="">
</li> </li>
</ul> </ul>
</Dialog> </EDialog>
</div> </div>
</template> </template>
<script> <script>
import Dialog from '@/components/Dialog.vue' import {
desc,
MINTER_ROLE,
expandTo18Decimals,
BN,
getHash,
gasLeft,
} from "@/utils/constant";
import { BigNumber } from 'bignumber.js'
import * as metaMask from '@/api/demoMETAMASK';
import EDialog from '@/components/EDialog.vue';
import { createNamespacedHelpers } from 'vuex';
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 { export default {
data () { data() {
return { return {
dialogVisible: false, dialogVisible: false,
tokenList:[ tokenList: [],
tokenListOrigin: [{
name: 'TKM',
index: 1,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'main',
contractAddress: '',
},
{ {
name: 'TINK', name: 'TUSDT',
id: 1, index: 2,
chainName: 'tkm',
chainId: 60001,
url: '', url: '',
over: '1225' balance: '0',
type: 'erc20',
contractAddress: '0x630dDb5C384F4cB489E43d74a6722B26635b65bE',
}, },
{ {
name: 'LDX', name: 'TKM3',
id: 2, index: 3,
chainName: 'tkm',
chainId: 60001,
url: '', url: '',
over: '521' balance: '0',
type: 'main',
contractAddress: '',
}, },
{ {
name: 'YDC', name: 'TUSDT3',
id: 3, index: 4,
chainName: 'tkm',
chainId: 60001,
url: '', url: '',
over: '1314' balance: '0',
type: 'erc20',
contractAddress: '0x630dDb5C384F4cB489E43d74a6722B26635b65bE',
}, },
{ {
name: 'wyc', name: 'BTKM',
id: 4, index: 1,
chainName: 'bsc',
chainId: 97,
url: '', url: '',
over: '222' balance: '0',
} type: 'erc20',
contractAddress: '0x0806c5b183F8a622fE62c7344B04e6e6A7C82c2e',
},
{
name: 'BUSDT',
index: 2,
chainName: 'bsc',
chainId: 97,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x3b319043334f483a931ad6555b17fc4a55f3c64a',
},
{
name: 'BTKM3',
index: 3,
chainName: 'bsc',
chainId: 1337,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x0806c5b183F8a622fE62c7344B04e6e6A7C82c2e',
},
{
name: 'BUSDT3',
index: 4,
chainName: 'bsc',
chainId: 1337,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x3b319043334f483a931ad6555b17fc4a55f3c64a',
},
], ],
tokenListTKM: [],
tokenListBSC: [],
selectIndex: '', selectIndex: '',
holdItem: { holdItem: {
name: 'TKM', name: 'THINKIUM',
url: '', chainName: 'tkm',
over: '3242.32', coinData: {},
id: 6
}, },
exchangeItem: { exchangeItem: {
name: 'BSC', name: 'BSC',
url: '', chainName: 'bsc',
over: '3242', coinData: {},
id: 7
}, },
changeItem: '', changeItem: '',
inputValue: '' inputValue: '',
}
},
computed: {
...mapStateWallet(['currentWalletAddress']),
...mapStateNetwork(['chainId']),
walletConnected() {
return this.$store.getters.walletConnected;
},
obtain() {
return this.inputValue * 0.97;
},
currentWalletAddressAndChainId() {
return this.currentWalletAddress && this.chainId
},
},
asyncComputed: {
balance: {
get() {
console.log('--this.holdItem', this.holdItem);
const { coinData } = this.holdItem;
console.log(coinData.chainId, this.chainId);
if (!this.walletConnected) {
return 0;
}
if (coinData.chainId != this.chainId) {
this.networkAlert();
return 0;
}
if (coinData.type == 'main') {
return this.getAccountBalance().then(res => res);
} else if (coinData.type == 'erc20') {
return this.getTokenBalance({ contractAddress: coinData.contractAddress }).then(res => res);;
}
}
} }
}, },
components: { components: {
Dialog EDialog
}, },
methods: { methods: {
async init() {
if (!this.walletConnected) {
return;
}
let overrides = {
gasLimit: 30000000,
from: window.defaultAccount,
// gasLimit: 1000000,
value: '0x0'
}
bridge = new window.web3.eth.Contract(bridgeAbi, bridgeContractAddress, overrides);
this.tokenListTKM = this.getTokensByChainName('tkm') || [];
this.tokenListBSC = this.getTokensByChainName('bsc') || [];
let tkm = {
name: 'THINKIUM',
chainName: 'tkm',
coinData: {},
}
let bsc = {
name: 'BSC',
chainName: 'bsc',
coinData: {},
}
if (this.tokenListBSC.map(item => item.chainId).includes(this.chainId)) {
this.holdItem = bsc;
this.exchangeItem = tkm;
} else {
this.holdItem = tkm;
this.exchangeItem = bsc;
}
this.changeItem = 'holdItem';
let token = this.tokenListOrigin.find(item => item.chainId == this.chainId && item.chainName == this.holdItem.chainName);
if(!token){
token = this.getTokensByChainName(this.holdItem.chainName)[0]
}
this.changeSelect(0, token)
},
formateChainName(chainId) {
let tkmChainIds = this.tokenListTKM.map(item => item.chainId);
let bscChainIds = this.tokenListBSC.map(item => item.chainId);
if (tkmChainIds.includes(chainId - 0)) {
return `Thinkium ${chainId}#链`
} else if(bscChainIds.includes(chainId - 0)) {
return `BSC`
}else{
return chainId
}
},
networkAlert() {
let fromChainName = this.formateChainName(this.holdItem.coinData.chainId);
let toChainName = this.formateChainName(this.exchangeItem.coinData.chainId);
// let currentChainName = this.formateChainName(this.chainId);
this.$dialog.alert({
title: '标题',
message: `您已选择了从${fromChainName}${toChainName}的跨链访问,当前连接网络并非${fromChainName}网络,请切换${fromChainName}网络后完成跨链操作。`,
}).then(() => {
// on close
});
return 0;
},
async getAccountBalance() {
return metaMask.getBalance(window.defaultAccount);
},
async getTokenBalance({ address = window.defaultAccount, contractAddress }) {
let overrides = {
gasLimit: 6000000,
from: address,
value: '0x0'
}
const erc20 = new window.web3.eth.Contract(erc20Abi, contractAddress, overrides);
return await erc20.methods.balanceOf(address).call();
},
changeSelect(index, item) { changeSelect(index, item) {
this.selectIndex = index this.selectIndex = index;
this[this.changeItem] = item this[this.changeItem].coinData = item;
console.log(this[this.changeItem])
let chainName = this[this.changeItem].chainName;
let tokenList, anotherToken;
if (chainName == 'tkm') {
tokenList = this.tokenListBSC;
} else if (chainName == 'bsc') {
tokenList = this.tokenListTKM;
}
anotherToken = tokenList.find(token => token.index == item.index); // 寻找 index 相同的 token;
if (this.changeItem == 'holdItem') {
this['exchangeItem'].coinData = anotherToken;
} else {
this['holdItem'].coinData = anotherToken;
}
},
getTokensByChainName(chainName) {
return this.tokenListOrigin.filter(item => item.chainName == chainName);
}, },
exchange() { exchange() {
let temp = {...this.exchangeItem} let temp = { ...this.exchangeItem }
this.exchangeItem = this.holdItem this.exchangeItem = this.holdItem
this.holdItem = temp this.holdItem = temp;
}, },
changeToken (type) { changeToken(type, chainName) {
this.tokenList = this.getTokensByChainName(chainName);
this.dialogVisible = true this.dialogVisible = true
let obj = {} this.changeItem = type;
if (type == 'THINKIUM') { },
obj = this.holdItem transfer() {
this.changeItem = 'holdItem' const { inputValue, holdItem, exchangeItem } = this;
const value = (inputValue + '').trim() - 0;
if (!value) {
this.$dialog.alert({
title: '标题',
message: '请输入转账金额',
}).then(() => {
// on close
});
return;
}
if (holdItem.coinData.type == 'main') {
this.depositNative({
chain: exchangeItem.coinData.chainId + '',
value: this.$toBig(value)
});
} else { } else {
obj = this.exchangeItem this.depositToken({
this.changeItem = 'exchangeItem' chain: exchangeItem.coinData.chainId + '',
} value: this.$toBig(value),
this.selectIndex = '' tokenAddress: holdItem.coinData.contractAddress,
this.tokenList.forEach((item, index) => { });
if(item.id == obj.id) {
this.selectIndex = index
} }
},
depositNative({ address = window.defaultAccount, chain, value }) {
let params = [
address,
chain,
]
let overrides = {
value,
}
bridge.methods.depositNative(...params).send(overrides)
},
async depositToken({ value, tokenAddress, address = window.defaultAccount, chain }) {
let token = '';
await this.approve({
value,
contractAddress: tokenAddress,
spender: bridgeContractAddress,
}) })
} let params = [
tokenAddress,
value,
address,
chain
]
bridge.methods.depositToken(...params).send();
},
async approve({ value, contractAddress, owner = window.defaultAccount, spender }) {
console.log({ value, contractAddress, owner, spender });
let overrides = {
gasLimit: 6000000,
from: owner,
value: '0x0'
}
let erc20 = new window.web3.eth.Contract(erc20Abi, contractAddress, overrides);
// let allowance = await erc20.methods.allowance(owner, spender).call()
let approveResult = await erc20.methods.approve(spender, value).send({
value: '0x0',
});
},
}, },
directives: { directives: {
positiveInt: { positiveInt: {
bind: function(el) { bind: function(el, binding, vnode) {
el.handler = function() { el.handler = function() {
let that = vnode.context
el.value = Number(el.value.replace(/\D+/, '')) el.value = Number(el.value.replace(/\D+/, ''))
this.inputValue = el.value that.inputValue = el.value - 0 || '';
} }
el.addEventListener('input', el.handler) el.addEventListener('input', el.handler)
}, },
...@@ -146,13 +404,20 @@ export default { ...@@ -146,13 +404,20 @@ export default {
} }
} }
}, },
created(){ created() {
} this.init();
},
watch: {
currentWalletAddressAndChainId() {
this.init();
},
},
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.container{ .container {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
...@@ -167,8 +432,7 @@ export default { ...@@ -167,8 +432,7 @@ export default {
} }
.redemption-wrap { .redemption-wrap {
position: relative; position: relative;
margin-top: 0.2rem; margin-top: 0.2rem; // flex: 1;
// flex: 1;
.redemption-window { .redemption-window {
height: 2.2rem; height: 2.2rem;
background: #F7F7F7; background: #F7F7F7;
...@@ -214,12 +478,14 @@ export default { ...@@ -214,12 +478,14 @@ export default {
background-color: #F7F7F7; background-color: #F7F7F7;
min-width: 3.72rem; min-width: 3.72rem;
height: 0.46rem; height: 0.46rem;
} color: #333;
input[placeholder] {
color: #CCCCCC;
font-size: 0.3rem; font-size: 0.3rem;
text-align: right; text-align: right;
} } // input[placeholder] {
// color: #CCCCCC;
// font-size: 0.3rem;
// text-align: right;
// }
.number { .number {
color: #333333; color: #333333;
font-size: 0.3rem; font-size: 0.3rem;
...@@ -296,7 +562,7 @@ export default { ...@@ -296,7 +562,7 @@ export default {
height: 0.5rem; height: 0.5rem;
} }
} }
& >img { &>img {
width: 0.36rem; width: 0.36rem;
height: 0.36rem; height: 0.36rem;
margin-right: 0.31rem; margin-right: 0.31rem;
...@@ -306,6 +572,5 @@ export default { ...@@ -306,6 +572,5 @@ export default {
background-color: rgba($color: #FCBF19, $alpha: 0.1); background-color: rgba($color: #FCBF19, $alpha: 0.1);
} }
} }
} }
</style> </style>
[
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isOwner",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]
\ No newline at end of file
[
{
"inputs": [
{
"internalType": "address[]",
"name": "_owners",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "_ownerRequired",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "TaskType",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "class",
"type": "string"
},
{
"indexed": false,
"internalType": "address",
"name": "oldAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAddress",
"type": "address"
}
],
"name": "AdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "TaskType",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "class",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "previousNum",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "requiredNum",
"type": "uint256"
}
],
"name": "AdminRequiredNumChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "AdminTaskDropped",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "targetAddress",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "chain",
"type": "string"
}
],
"name": "DepositNative",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "targetAddress",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "chain",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "nativeValue",
"type": "uint256"
}
],
"name": "DepositToken",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawDoneNative",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawDoneToken",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawingNative",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "proof",
"type": "string"
}
],
"name": "WithdrawingToken",
"type": "event"
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "address",
"name": "oneAddress",
"type": "address"
}
],
"name": "addAddress",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "depositSelector",
"outputs": [
{
"internalType": "string",
"name": "selector",
"type": "string"
},
{
"internalType": "bool",
"name": "isValueFirst",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "address",
"name": "oneAddress",
"type": "address"
}
],
"name": "dropAddress",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "dropTask",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
}
],
"name": "getAdminAddresses",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "getOperatorRequireNum",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "getOwnerRequireNum",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "paused",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "uint256",
"name": "requiredNum",
"type": "uint256"
}
],
"name": "resetRequiredNum",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "withdrawSelector",
"outputs": [
{
"internalType": "string",
"name": "selector",
"type": "string"
},
{
"internalType": "bool",
"name": "isValueFirst",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{
"internalType": "string",
"name": "_targetAddress",
"type": "string"
},
{
"internalType": "string",
"name": "chain",
"type": "string"
}
],
"name": "depositNative",
"outputs": [],
"stateMutability": "payable",
"type": "function",
"payable": true
},
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "string",
"name": "_targetAddress",
"type": "string"
},
{
"internalType": "string",
"name": "chain",
"type": "string"
}
],
"name": "depositToken",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "payable",
"type": "function",
"payable": true
},
{
"inputs": [
{
"internalType": "address payable",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "string",
"name": "proof",
"type": "string"
},
{
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "withdrawNative",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_token",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "string",
"name": "proof",
"type": "string"
},
{
"internalType": "bytes32",
"name": "taskHash",
"type": "bytes32"
}
],
"name": "withdrawToken",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "class",
"type": "string"
},
{
"internalType": "address",
"name": "oldAddress",
"type": "address"
},
{
"internalType": "address",
"name": "newAddress",
"type": "address"
}
],
"name": "modifyAdminAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getLogicAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "getStoreAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "pause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "unpause",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "transferToken",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "string",
"name": "method",
"type": "string"
},
{
"internalType": "bool",
"name": "_isValueFirst",
"type": "bool"
}
],
"name": "setDepositSelector",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "string",
"name": "method",
"type": "string"
},
{
"internalType": "bool",
"name": "_isValueFirst",
"type": "bool"
}
],
"name": "setWithdrawSelector",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
\ No newline at end of file
import 'babel-polyfill';
// const expect = require('chai').expect;
import { ethers } from 'ethers';
import { init, getMyContract } from '../src/api/demoMETAMASK';
const bridgeAbi = require('./abi/bridge.json');
const erc20Abi = require('./abi/ERC20.json');
const bridgeContractAddress = '0x35645227C22c47Fe26953F14C8210b8Eb347CCd2';
let bridge;
describe('链接钱包', function () {
it('连接', async function () {
await init();
bridge = getMyContract(bridgeAbi, bridgeContractAddress);
})
})
describe('主币存款', function () {
it('存款', function () {
})
})
describe('token存款', function () {
it('approve', function () {
})
it('存款', function () {
})
})
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论