Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
a1d6d356
Commit
a1d6d356
authored
Dec 09, 2021
by
QM
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bridgevmxgo_bsc_1201' of github.com:YingQm/plugin into bridgevmxgo_bsc_1201
parents
756e7aed
8137e316
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
414 additions
and
385 deletions
+414
-385
dockerRelayerBsc.sh
plugin/dapp/bridgevmxgo/cmd/build/dockerRelayerBsc.sh
+51
-52
dockerRelayerHt.sh
plugin/dapp/bridgevmxgo/cmd/build/dockerRelayerHt.sh
+3
-3
offlinePublic.sh
plugin/dapp/bridgevmxgo/cmd/build/public/offlinePublic.sh
+4
-4
ConfigplatformTokenSymbol.go
...2eth/boss4x/ethereum/offline/ConfigplatformTokenSymbol.go
+2
-1
Makefile
plugin/dapp/cross2eth/contracts/Makefile
+5
-0
ERC20.sol
plugin/dapp/cross2eth/contracts/erc20/ERC20.sol
+284
-282
erc20.go
plugin/dapp/cross2eth/contracts/erc20/generated/erc20.go
+4
-4
ethereumRelayerCmd.go
plugin/dapp/cross2eth/ebcli/ethereumRelayerCmd.go
+13
-4
relayer.proto
plugin/dapp/cross2eth/ebrelayer/proto/relayer.proto
+1
-0
ethereum.go
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
+2
-2
deploy.go
...app/cross2eth/ebrelayer/relayer/ethereum/ethtxs/deploy.go
+2
-2
manager.go
plugin/dapp/cross2eth/ebrelayer/relayer/manager.go
+1
-1
config.pb.go
plugin/dapp/cross2eth/ebrelayer/types/config.pb.go
+3
-2
relayer.pb.go
plugin/dapp/cross2eth/ebrelayer/types/relayer.pb.go
+39
-28
No files found.
plugin/dapp/bridgevmxgo/cmd/build/dockerRelayerBsc.sh
View file @
a1d6d356
...
...
@@ -243,7 +243,7 @@ function TestETH2Chain33Assets() {
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# is_equal "${result}" "2000000000000000"
# is_equal "${result}" "2000000000000000"
# 原来的数额
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethTestAddr2
}
"
)
...
...
@@ -256,7 +256,7 @@ function TestETH2Chain33Assets() {
echo
"check the balance on chain33"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# is_equal "${result}" "1700000000000000"
# is_equal "${result}" "1700000000000000"
# 查询 ETH 这端 bridgeBank 地址 0
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
...
...
@@ -441,11 +441,11 @@ function TestETH2Chain33BUSD() {
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33BUSDBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# 结果是 12 * le8
# is_equal "${result}" "3000000000000000000"
# is_equal "${result}" "3000000000000000000"
# 原来的数额 0
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethReceiverAddr1
}
"
-t
"
${
ethereumBUSDERC20TokenAddr
}
"
)
# cli_ret "${result}" "balance" ".balance" "0"
# cli_ret "${result}" "balance" ".balance" "0"
echo
'#5.burn YCC from Chain33 YCC(Chain33)-----> Ethereum'
result
=
$(${
CLIA
}
chain33 burn
-m
1
-k
"
${
chain33ReceiverAddrKey
}
"
-r
"
${
ethReceiverAddr1
}
"
-t
"
${
chain33BUSDBridgeTokenAddr
}
"
)
...
...
@@ -456,7 +456,7 @@ function TestETH2Chain33BUSD() {
echo
"check the balance on chain33"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33BUSDBridgeTokenAddr
}
"
-c
"
${
chain33TestAddr1
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# 结果是 12-5 * le8
# is_equal "${result}" "2000000000000000000"
# is_equal "${result}" "2000000000000000000"
# 查询 ETH 这端 bridgeBank 地址 7
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
-t
"
${
ethereumBUSDERC20TokenAddr
}
"
)
...
...
@@ -742,13 +742,13 @@ function up_relayer_toml() {
# 在第 line 行后面 新增合约地址
sed
-i
''
"
${
line
}
"
' a ChainName="user.p.para."'
"./relayer.toml"
# # shellcheck disable=SC2155
# local line=$(delete_line_show "./relayer.toml" "maturityDegree=10")
# sed -i ''"${line}"' a maturityDegree=1' "./relayer.toml"
#
# # shellcheck disable=SC2155
# local line=$(delete_line_show "./relayer.toml" "EthMaturityDegree=10")
# sed -i ''"${line}"' a EthMaturityDegree=1' "./relayer.toml"
# # shellcheck disable=SC2155
# local line=$(delete_line_show "./relayer.toml" "maturityDegree=10")
# sed -i ''"${line}"' a maturityDegree=1' "./relayer.toml"
#
# # shellcheck disable=SC2155
# local line=$(delete_line_show "./relayer.toml" "EthMaturityDegree=10")
# sed -i ''"${line}"' a EthMaturityDegree=1' "./relayer.toml"
}
function
StartDockerRelayerDeploy
()
{
...
...
@@ -792,17 +792,17 @@ function StartDockerRelayerDeploy() {
updata_toml_start_bcd
# 设置 token 地址
# offline_create_bridge_token_eth_BTY
# offline_deploy_erc20_eth_BYC
# offline_deploy_erc20_eth_USDT
# offline_create_bridge_token_eth_YCC
# offline_create_bridge_token_eth_ZBC
#
# offline_create_bridge_token_chain33_ETH "BNB"
# offline_create_bridge_token_chain33_BYC
# offline_deploy_erc20_chain33_YCC
# offline_deploy_erc20_chain33_ZBC
# offline_create_bridge_token_chain33_USDT
# offline_create_bridge_token_eth_BTY
# offline_deploy_erc20_eth_BYC
# offline_deploy_erc20_eth_USDT
# offline_create_bridge_token_eth_YCC
# offline_create_bridge_token_eth_ZBC
#
# offline_create_bridge_token_chain33_ETH "BNB"
# offline_create_bridge_token_chain33_BYC
# offline_deploy_erc20_chain33_YCC
# offline_deploy_erc20_chain33_ZBC
# offline_create_bridge_token_chain33_USDT
offline_create_bridge_token_chain33_BUSD
...
...
@@ -811,12 +811,12 @@ function StartDockerRelayerDeploy() {
# shellcheck disable=SC2086
{
# docker cp "${chain33EthBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33EthBridgeTokenAddr}.abi
# docker cp "${chain33BycBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33BycBridgeTokenAddr}.abi
# docker cp "${chain33USDTBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33USDTBridgeTokenAddr}.abi
# docker cp "${chain33EthBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33EthBridgeTokenAddr}.abi
# docker cp "${chain33BycBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33BycBridgeTokenAddr}.abi
# docker cp "${chain33USDTBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33USDTBridgeTokenAddr}.abi
docker
cp
"
${
chain33BUSDBridgeTokenAddr
}
.abi"
"
${
dockerNamePrefix
}
_ebrelayera_1"
:/root/
${
chain33BUSDBridgeTokenAddr
}
.abi
# docker cp "${chain33YccERC20TokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33YccERC20TokenAddr}.abi
# docker cp "${ethereumYccBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${ethereumYccBridgeTokenAddr}.abi
# docker cp "${chain33YccERC20TokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${chain33YccERC20TokenAddr}.abi
# docker cp "${ethereumYccBridgeTokenAddr}.abi" "${dockerNamePrefix}_ebrelayera_1":/root/${ethereumYccBridgeTokenAddr}.abi
}
# 重启,因为relayerA的验证人地址和部署人的地址是一样的,所以需要重新启动relayer,更新nonce
...
...
@@ -1059,30 +1059,30 @@ function Testethereum2EVMToChain33_usdt() {
}
function
test_all
()
{
# TestETH2Chain33Assets
# TestChain33ToEthAssets
# TestChain33ToEthZBCAssets
# TestETH2Chain33Byc
# TestETH2Chain33USDT
# TestETH2Chain33Assets
# TestChain33ToEthAssets
# TestChain33ToEthZBCAssets
# TestETH2Chain33Byc
# TestETH2Chain33USDT
TestETH2Chain33BUSD
# lockBty
# lockChain33Ycc
# lockEth
# lockEthByc
# lockEthUSDT
#
# # 离线多签地址转入阈值设大
# offline_set_offline_token_Bty 100000000000000 10
# offline_set_offline_token_Chain33Ycc 100000000000000 10
# offline_set_offline_token_Eth 100000000000000 10
# offline_set_offline_token_EthByc 100000000000000 10
# offline_set_offline_token_EthUSDT 100000000000000 10
# DeployEvmxgo
# TestETH2EVMToChain33
# Testethereum2EVMToChain33_byc
# Testethereum2EVMToChain33_usdt
# lockBty
# lockChain33Ycc
# lockEth
# lockEthByc
# lockEthUSDT
#
# # 离线多签地址转入阈值设大
# offline_set_offline_token_Bty 100000000000000 10
# offline_set_offline_token_Chain33Ycc 100000000000000 10
# offline_set_offline_token_Eth 100000000000000 10
# offline_set_offline_token_EthByc 100000000000000 10
# offline_set_offline_token_EthUSDT 100000000000000 10
# DeployEvmxgo
# TestETH2EVMToChain33
# Testethereum2EVMToChain33_byc
# Testethereum2EVMToChain33_usdt
}
function
get_cli
()
{
...
...
@@ -1098,7 +1098,7 @@ function get_cli() {
CLIC
=
"docker exec
${
dockerNamePrefix
}
_ebrelayerc_1 /root/ebcli_A"
CLID
=
"docker exec
${
dockerNamePrefix
}
_ebrelayerd_1 /root/ebcli_A"
# docker_ganachetest_ip=$(get_docker_addr "${dockerNamePrefix}_ganachetest_1")
# docker_ganachetest_ip=$(get_docker_addr "${dockerNamePrefix}_ganachetest_1")
Boss4xCLI
=
"docker exec
${
dockerNamePrefix
}
_ebrelayera_1 /root/boss4x --rpc_laddr http://
${
docker_chain33_ip
}
:8901 --rpc_laddr_ethereum
${
BscProviderUrl
}
--paraName user.p.para. --chainEthId 56"
echo
"
${
Boss4xCLI
}
"
...
...
@@ -1142,4 +1142,3 @@ function AllRelayerMainTest() {
echo_addrs
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
plugin/dapp/bridgevmxgo/cmd/build/dockerRelayerHt.sh
View file @
a1d6d356
...
...
@@ -288,7 +288,7 @@ function TestETH2Chain33Assets() {
# chain33 chain33EthBridgeTokenAddr(ETH合约中)查询 lock 金额
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# is_equal "${result}" "2000000000000000"
# is_equal "${result}" "2000000000000000"
# 原来的数额
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethTestAddr2
}
"
)
...
...
@@ -301,7 +301,7 @@ function TestETH2Chain33Assets() {
echo
"check the balance on chain33"
result
=
$(${
Chain33Cli
}
evm query
-a
"
${
chain33EthBridgeTokenAddr
}
"
-c
"
${
chain33DeployAddr
}
"
-b
"balanceOf(
${
chain33ReceiverAddr
}
)"
)
# is_equal "${result}" "1700000000000000"
# is_equal "${result}" "1700000000000000"
# 查询 ETH 这端 bridgeBank 地址 0
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
...
...
@@ -1075,7 +1075,7 @@ function AllRelayerMainTest() {
CLIC
=
"docker exec
${
dockerNamePrefix
}
_ebrelayerc_1 /root/ebcli_A"
CLID
=
"docker exec
${
dockerNamePrefix
}
_ebrelayerd_1 /root/ebcli_A"
# docker_ganachetest_ip=$(get_docker_addr "${dockerNamePrefix}_ganachetest_1")
# docker_ganachetest_ip=$(get_docker_addr "${dockerNamePrefix}_ganachetest_1")
Boss4xCLI
=
"docker exec
${
dockerNamePrefix
}
_ebrelayera_1 /root/boss4x --rpc_laddr http://
${
docker_chain33_ip
}
:8901 --rpc_laddr_ethereum
${
BscProviderUrl
}
--paraName user.p.para. --chainEthId 256"
echo
"
${
Boss4xCLI
}
"
...
...
plugin/dapp/bridgevmxgo/cmd/build/public/offlinePublic.sh
View file @
a1d6d356
...
...
@@ -308,9 +308,9 @@ function offline_transfer_multisign_Eth_test() {
sleep
10
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethBridgeBank
}
"
)
# cli_ret "${result}" "balance" ".balance" "16"
# cli_ret "${result}" "balance" ".balance" "16"
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
multisignEthAddr
}
"
)
# cli_ret "${result}" "balance" ".balance" "20"
# cli_ret "${result}" "balance" ".balance" "20"
# transfer
# shellcheck disable=SC2154
...
...
@@ -322,9 +322,9 @@ function offline_transfer_multisign_Eth_test() {
sleep
10
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
ethMultisignA
}
"
)
# cli_ret "${result}" "balance" ".balance" "1005"
# cli_ret "${result}" "balance" ".balance" "1005"
result
=
$(${
CLIA
}
ethereum balance
-o
"
${
multisignEthAddr
}
"
)
# cli_ret "${result}" "balance" ".balance" "15"
# cli_ret "${result}" "balance" ".balance" "15"
echo
-e
"
${
GRE
}
===========
$FUNCNAME
end ===========
${
NOC
}
"
}
...
...
plugin/dapp/cross2eth/boss4x/ethereum/offline/ConfigplatformTokenSymbol.go
View file @
a1d6d356
...
...
@@ -2,9 +2,10 @@ package offline
import
(
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/33cn/plugin/plugin/dapp/cross2eth/contracts/contracts4eth/generated"
"github.com/spf13/cobra"
)
...
...
plugin/dapp/cross2eth/contracts/Makefile
View file @
a1d6d356
...
...
@@ -2,6 +2,7 @@
##编译solidity,并产生bin文件,abi文件,和相应的go文件
SRC_BEP
:=
bep20
SRC_ERC20
:=
erc20
SRC_CONTRACT0
:=
contracts4chain33
SRC_CONTRACT1
:=
contracts4eth
SRC_MULTISIGN
:=
gnosis/safe-contracts/contracts
...
...
@@ -10,6 +11,7 @@ GO_OUT0 := ${SRC_CONTRACT0}/generated
GO_OUT1
:=
${
SRC_CONTRACT1
}
/generated
GO_OUT_MULTISIGN
:=
gnosis/generated
GO_OUT_BEP20
:=
bep20/generated
GO_OUT_ERC20
:=
erc20/generated
PACKAGE
:=
generated
proj
:=
"build"
...
...
@@ -30,6 +32,9 @@ multisign:
bep20Bin
:
@
abigen
--sol
$(SRC_BEP)
/BEP20.sol
--pkg
$(PACKAGE)
--out
$(GO_OUT_BEP20)
/bep20.go
erc20Bin
:
@
abigen
--sol
$(SRC_ERC20)
/ERC20.sol
--pkg
$(PACKAGE)
--out
$(GO_OUT_ERC20)
/erc20.go
clean
:
@
rm
-fr
$(GO_OUT)
/
*
...
...
plugin/dapp/cross2eth/contracts/erc20/ERC20.sol
View file @
a1d6d356
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "./IERC20.sol";
import "./Context.sol";
contract ERC20 is Context, IERC20 {
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 defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_,uint256 supply, address owner) {
_name = name_;
_symbol = symbol_;
_totalSupply=supply;
_balances[owner] = supply;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual 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
* overloaded;
*
* 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 returns (uint8) {
return 8;
}
/**
* @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");
_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");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is 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");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(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:
*
* - `to` 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);
}
/**
* @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");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(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 to 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 { }
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
import "./IERC20.sol";
import "./Context.sol";
contract ERC20 is Context, IERC20 {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All three of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_,uint256 supply, address owner, uint8 decimals_) {
_name = name_;
_symbol = symbol_;
_totalSupply=supply;
_decimals = decimals_;
_balances[owner] = supply;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual 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
* overloaded;
*
* 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 returns (uint8) {
return _decimals;
}
/**
* @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");
_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");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is 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");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(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:
*
* - `to` 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);
}
/**
* @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");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(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 to 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 { }
}
plugin/dapp/cross2eth/contracts/erc20/generated/
ERC
20.go
→
plugin/dapp/cross2eth/contracts/erc20/generated/
erc
20.go
View file @
a1d6d356
...
...
@@ -172,7 +172,7 @@ func (_Context *ContextTransactorRaw) Transact(opts *bind.TransactOpts, method s
}
// ERC20ABI is the input ABI used to generate the binding from.
const
ERC20ABI
=
"[{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"
name_
\"
,
\"
type
\"
:
\"
string
\"
},{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"
symbol_
\"
,
\"
type
\"
:
\"
string
\"
},{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
supply
\"
,
\"
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
\"
:
\"
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
\"
:[{
\"
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
\"
:[],
\"
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
\"
:
\"
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
\"
:[],
\"
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
\"
}]"
const
ERC20ABI
=
"[{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"
name_
\"
,
\"
type
\"
:
\"
string
\"
},{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"
symbol_
\"
,
\"
type
\"
:
\"
string
\"
},{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
supply
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
internalType
\"
:
\"
address
\"
,
\"
name
\"
:
\"
owner
\"
,
\"
type
\"
:
\"
address
\"
}
,{
\"
internalType
\"
:
\"
uint8
\"
,
\"
name
\"
:
\"
decimals_
\"
,
\"
type
\"
:
\"
uint8
\"
}
],
\"
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
\"
:
\"
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
\"
:[{
\"
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
\"
:[],
\"
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
\"
:
\"
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
\"
:[],
\"
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
\"
}]"
// ERC20FuncSigs maps the 4-byte function signature to its string representation.
var
ERC20FuncSigs
=
map
[
string
]
string
{
...
...
@@ -190,16 +190,16 @@ var ERC20FuncSigs = map[string]string{
}
// ERC20Bin is the compiled bytecode used for deploying new contracts.
var
ERC20Bin
=
"0x608060405234801561001057600080fd5b50604051610b
d1380380610bd18339818101604052608081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156100ff57600080fd5b90830190602082018581111561011457600080fd5b825164010000000081118282018810171561012e57600080fd5b82525081516020918201929091019080838360005b8381101561015b578181015183820152602001610143565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b5060409081526020828101519290910151865192945092506101af916003918701906101e9565b5082516101c39060049060208601906101e9565b5060028290556001600160a01b03166000908152602081905260409020555061027c9050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061022a57805160ff1916838001178555610257565b82800160010185558215610257579182015b8281111561025757825182559160200191906001019061023c565b50610263929150610267565b5090565b5b808211156102635760008155600101610268565b6109468061028b6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c3610421565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610426565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610471565b6100b661048c565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104ed565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610585565b610173600480360360408110156102a157600080fd5b506001600160a01b0381358116916020013516610599565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c6105c4565b84846105c8565b50600192915050565b60025490565b600061037f8484846106b4565b6001600160a01b0384166000908152600160205260408120816103a06105c4565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104025760405162461bcd60e51b815260040180806020018281038252602881526020018061087b6028913960400191505060405180910390fd5b6104168561040e6105c4565b8584036105c8565b506001949350505050565b600890565b60006103636104336105c4565b8484600160006104416105c4565b6001600160a01b03908116825260208083019390935260409182016000908120918b1681529252902054016105c8565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b600080600160006104fc6105c4565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156105675760405162461bcd60e51b81526004018080602001828103825260258152602001806108ec6025913960400191505060405180910390fd5b61057b6105726105c4565b858584036105c8565b5060019392505050565b60006103636105926105c4565b84846106b4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661060d5760405162461bcd60e51b81526004018080602001828103825260248152602001806108c86024913960400191505060405180910390fd5b6001600160a01b0382166106525760405162461bcd60e51b81526004018080602001828103825260228152602001806108336022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106f95760405162461bcd60e51b81526004018080602001828103825260258152602001806108a36025913960400191505060405180910390fd5b6001600160a01b03821661073e5760405162461bcd60e51b81526004018080602001828103825260238152602001806108106023913960400191505060405180910390fd5b61074983838361080a565b6001600160a01b038316600090815260208190526040902054818110156107a15760405162461bcd60e51b81526004018080602001828103825260268152602001806108556026913960400191505060405180910390fd5b6001600160a01b038085166000818152602081815260408083208787039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220bb703c9c726f60b54cd16fcdcf459351563c86ad2912372653cf90c5760d2a3c
64736f6c63430007030033"
var
ERC20Bin
=
"0x608060405234801561001057600080fd5b50604051610b
ef380380610bef833981810160405260a081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156100ff57600080fd5b90830190602082018581111561011457600080fd5b825164010000000081118282018810171561012e57600080fd5b82525081516020918201929091019080838360005b8381101561015b578181015183820152602001610143565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b5060409081526020828101519183015160609093015187519295509293506101b591600391880190610203565b5083516101c9906004906020870190610203565b5060028390556005805460ff191660ff929092169190911790556001600160a01b0316600090815260208190526040902055506102969050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061024457805160ff1916838001178555610271565b82800160010185558215610271579182015b82811115610271578251825591602001919060010190610256565b5061027d929150610281565b5090565b5b8082111561027d5760008155600101610282565b61094a806102a56000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c3610421565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b03813516906020013561042a565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610475565b6100b6610490565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104f1565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610589565b610173600480360360408110156102a157600080fd5b506001600160a01b038135811691602001351661059d565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c6105c8565b84846105cc565b50600192915050565b60025490565b600061037f8484846106b8565b6001600160a01b0384166000908152600160205260408120816103a06105c8565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104025760405162461bcd60e51b815260040180806020018281038252602881526020018061087f6028913960400191505060405180910390fd5b6104168561040e6105c8565b8584036105cc565b506001949350505050565b60055460ff1690565b60006103636104376105c8565b8484600160006104456105c8565b6001600160a01b03908116825260208083019390935260409182016000908120918b1681529252902054016105cc565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b600080600160006105006105c8565b6001600160a01b039081168252602080830193909352604091820160009081209188168152925290205490508281101561056b5760405162461bcd60e51b81526004018080602001828103825260258152602001806108f06025913960400191505060405180910390fd5b61057f6105766105c8565b858584036105cc565b5060019392505050565b60006103636105966105c8565b84846106b8565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166106115760405162461bcd60e51b81526004018080602001828103825260248152602001806108cc6024913960400191505060405180910390fd5b6001600160a01b0382166106565760405162461bcd60e51b81526004018080602001828103825260228152602001806108376022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106fd5760405162461bcd60e51b81526004018080602001828103825260258152602001806108a76025913960400191505060405180910390fd5b6001600160a01b0382166107425760405162461bcd60e51b81526004018080602001828103825260238152602001806108146023913960400191505060405180910390fd5b61074d83838361080e565b6001600160a01b038316600090815260208190526040902054818110156107a55760405162461bcd60e51b81526004018080602001828103825260268152602001806108596026913960400191505060405180910390fd5b6001600160a01b038085166000818152602081815260408083208787039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a76db73049f948a1731f127a763d671c623beb64c13e39a155f8ce564fe19c88
64736f6c63430007030033"
// DeployERC20 deploys a new Ethereum contract, binding an instance of ERC20 to it.
func
DeployERC20
(
auth
*
bind
.
TransactOpts
,
backend
bind
.
ContractBackend
,
name_
string
,
symbol_
string
,
supply
*
big
.
Int
,
owner
common
.
Address
)
(
common
.
Address
,
*
types
.
Transaction
,
*
ERC20
,
error
)
{
func
DeployERC20
(
auth
*
bind
.
TransactOpts
,
backend
bind
.
ContractBackend
,
name_
string
,
symbol_
string
,
supply
*
big
.
Int
,
owner
common
.
Address
,
decimals_
uint8
)
(
common
.
Address
,
*
types
.
Transaction
,
*
ERC20
,
error
)
{
parsed
,
err
:=
abi
.
JSON
(
strings
.
NewReader
(
ERC20ABI
))
if
err
!=
nil
{
return
common
.
Address
{},
nil
,
nil
,
err
}
address
,
tx
,
contract
,
err
:=
bind
.
DeployContract
(
auth
,
parsed
,
common
.
FromHex
(
ERC20Bin
),
backend
,
name_
,
symbol_
,
supply
,
owner
)
address
,
tx
,
contract
,
err
:=
bind
.
DeployContract
(
auth
,
parsed
,
common
.
FromHex
(
ERC20Bin
),
backend
,
name_
,
symbol_
,
supply
,
owner
,
decimals_
)
if
err
!=
nil
{
return
common
.
Address
{},
nil
,
nil
,
err
}
...
...
plugin/dapp/cross2eth/ebcli/ethereumRelayerCmd.go
View file @
a1d6d356
...
...
@@ -312,6 +312,8 @@ func DeployERC20Flags(cmd *cobra.Command) {
_
=
cmd
.
MarkFlagRequired
(
"symbol"
)
cmd
.
Flags
()
.
StringP
(
"amount"
,
"m"
,
"0"
,
"amount"
)
_
=
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
Uint8P
(
"decimals"
,
"d"
,
8
,
"default set to 8, and can't be greater than 18"
)
}
func
DeployERC20
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
...
@@ -320,12 +322,19 @@ func DeployERC20(cmd *cobra.Command, args []string) {
name
,
_
:=
cmd
.
Flags
()
.
GetString
(
"name"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetString
(
"amount"
)
decimals
,
_
:=
cmd
.
Flags
()
.
GetUint8
(
"decimals"
)
if
decimals
>
18
{
fmt
.
Println
(
"decimals can't be greater than 18"
)
return
}
para
:=
ebTypes
.
ERC20Token
{
Owner
:
owner
,
Name
:
name
,
Symbol
:
symbol
,
Amount
:
amount
,
Owner
:
owner
,
Name
:
name
,
Symbol
:
symbol
,
Amount
:
amount
,
Decimals
:
int32
(
decimals
),
}
var
res
rpctypes
.
Reply
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Manager.DeployERC20"
,
para
,
&
res
)
...
...
plugin/dapp/cross2eth/ebrelayer/proto/relayer.proto
View file @
a1d6d356
...
...
@@ -222,6 +222,7 @@ message ERC20Token {
string
name
=
2
;
string
symbol
=
3
;
string
amount
=
4
;
int32
decimals
=
5
;
}
message
ETHTokenLockAddress
{
...
...
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethereum.go
View file @
a1d6d356
...
...
@@ -332,12 +332,12 @@ func (ethRelayer *Relayer4Ethereum) AddToken2LockList(symbol, token string) (str
}
//DeployERC20 ...
func
(
ethRelayer
*
Relayer4Ethereum
)
DeployERC20
(
ownerAddr
,
name
,
symbol
,
amount
string
)
(
string
,
error
)
{
func
(
ethRelayer
*
Relayer4Ethereum
)
DeployERC20
(
ownerAddr
,
name
,
symbol
,
amount
string
,
decimals
uint8
)
(
string
,
error
)
{
bn
:=
big
.
NewInt
(
1
)
bn
,
_
=
bn
.
SetString
(
utils
.
TrimZeroAndDot
(
amount
),
10
)
ethRelayer
.
rwLock
.
RLock
()
defer
ethRelayer
.
rwLock
.
RUnlock
()
return
ethtxs
.
DeployERC20
(
ownerAddr
,
name
,
symbol
,
bn
,
ethRelayer
.
clientSpec
,
ethRelayer
.
operatorInfo
)
return
ethtxs
.
DeployERC20
(
ownerAddr
,
name
,
symbol
,
bn
,
decimals
,
ethRelayer
.
clientSpec
,
ethRelayer
.
operatorInfo
)
}
//ApproveAllowance ...
...
...
plugin/dapp/cross2eth/ebrelayer/relayer/ethereum/ethtxs/deploy.go
View file @
a1d6d356
...
...
@@ -499,7 +499,7 @@ finished:
return
x2EthContracts
,
deployInfo
,
nil
}
func
DeployERC20
(
ownerAddr
,
name
,
symbol
string
,
amount
*
big
.
Int
,
client
ethinterface
.
EthClientSpec
,
para
*
OperatorInfo
)
(
string
,
error
)
{
func
DeployERC20
(
ownerAddr
,
name
,
symbol
string
,
amount
*
big
.
Int
,
decimals
uint8
,
client
ethinterface
.
EthClientSpec
,
para
*
OperatorInfo
)
(
string
,
error
)
{
if
nil
==
para
{
return
""
,
errors
.
New
(
"no operator private key configured"
)
}
...
...
@@ -523,7 +523,7 @@ func DeployERC20(ownerAddr, name, symbol string, amount *big.Int, client ethinte
txslog
.
Info
(
"DeployERC20"
,
"ownerAddr"
,
ownerAddr
,
"name"
,
name
,
"symbol"
,
symbol
,
"amount"
,
amount
,
"client"
,
client
)
Erc20OwnerAddr
:=
common
.
HexToAddress
(
ownerAddr
)
Erc20Addr
,
deployTx
,
_
,
err
:=
erc20
.
DeployERC20
(
operatorAuth
,
client
,
name
,
symbol
,
amount
,
Erc20OwnerAddr
)
Erc20Addr
,
deployTx
,
_
,
err
:=
erc20
.
DeployERC20
(
operatorAuth
,
client
,
name
,
symbol
,
amount
,
Erc20OwnerAddr
,
decimals
)
if
nil
!=
err
{
txslog
.
Error
(
"DeployERC20"
,
"Failed to DeployErc20 with err:"
,
err
.
Error
())
return
""
,
err
...
...
plugin/dapp/cross2eth/ebrelayer/relayer/manager.go
View file @
a1d6d356
...
...
@@ -485,7 +485,7 @@ func (manager *Manager) DeployERC20(Erc20Token relayerTypes.ERC20Token, result *
return
err
}
Erc20Addr
,
err
:=
manager
.
ethRelayer
.
DeployERC20
(
Erc20Token
.
Owner
,
Erc20Token
.
Name
,
Erc20Token
.
Symbol
,
Erc20Token
.
Amount
)
Erc20Addr
,
err
:=
manager
.
ethRelayer
.
DeployERC20
(
Erc20Token
.
Owner
,
Erc20Token
.
Name
,
Erc20Token
.
Symbol
,
Erc20Token
.
Amount
,
uint8
(
Erc20Token
.
Decimals
)
)
if
nil
!=
err
{
return
err
}
...
...
plugin/dapp/cross2eth/ebrelayer/types/config.pb.go
View file @
a1d6d356
...
...
@@ -7,11 +7,12 @@
package
types
import
(
reflect
"reflect"
sync
"sync"
proto
"github.com/golang/protobuf/proto"
protoreflect
"google.golang.org/protobuf/reflect/protoreflect"
protoimpl
"google.golang.org/protobuf/runtime/protoimpl"
reflect
"reflect"
sync
"sync"
)
const
(
...
...
plugin/dapp/cross2eth/ebrelayer/types/relayer.pb.go
View file @
a1d6d356
...
...
@@ -7,11 +7,12 @@
package
types
import
(
reflect
"reflect"
sync
"sync"
proto
"github.com/golang/protobuf/proto"
protoreflect
"google.golang.org/protobuf/reflect/protoreflect"
protoimpl
"google.golang.org/protobuf/runtime/protoimpl"
reflect
"reflect"
sync
"sync"
)
const
(
...
...
@@ -2129,10 +2130,11 @@ type ERC20Token struct {
sizeCache
protoimpl
.
SizeCache
unknownFields
protoimpl
.
UnknownFields
Owner
string
`protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
Name
string
`protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Symbol
string
`protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"`
Amount
string
`protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"`
Owner
string
`protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
Name
string
`protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Symbol
string
`protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"`
Amount
string
`protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"`
Decimals
int32
`protobuf:"varint,5,opt,name=decimals,proto3" json:"decimals,omitempty"`
}
func
(
x
*
ERC20Token
)
Reset
()
{
...
...
@@ -2195,6 +2197,13 @@ func (x *ERC20Token) GetAmount() string {
return
""
}
func
(
x
*
ERC20Token
)
GetDecimals
()
int32
{
if
x
!=
nil
{
return
x
.
Decimals
}
return
0
}
type
ETHTokenLockAddress
struct
{
state
protoimpl
.
MessageState
sizeCache
protoimpl
.
SizeCache
...
...
@@ -2568,28 +2577,30 @@ var file_relayer_proto_rawDesc = []byte{
0x72
,
0x69
,
0x76
,
0x61
,
0x74
,
0x65
,
0x4b
,
0x65
,
0x79
,
0x12
,
0x2a
,
0x0a
,
0x10
,
0x6f
,
0x77
,
0x6e
,
0x65
,
0x72
,
0x50
,
0x72
,
0x69
,
0x76
,
0x61
,
0x74
,
0x65
,
0x4b
,
0x65
,
0x79
,
0x73
,
0x18
,
0x05
,
0x20
,
0x03
,
0x28
,
0x09
,
0x52
,
0x10
,
0x6f
,
0x77
,
0x6e
,
0x65
,
0x72
,
0x50
,
0x72
,
0x69
,
0x76
,
0x61
,
0x74
,
0x65
,
0x4b
,
0x65
,
0x79
,
0x73
,
0x22
,
0x66
,
0x0a
,
0x0a
,
0x45
,
0x52
,
0x43
,
0x32
,
0x30
,
0x54
,
0x6f
,
0x6b
,
0x65
,
0x6e
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x6f
,
0x77
,
0x6e
,
0x65
,
0x72
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x6f
,
0x77
,
0x6e
,
0x65
,
0x72
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x6e
,
0x61
,
0x6d
,
0x65
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x6e
,
0x61
,
0x6d
,
0x65
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x61
,
0x6d
,
0x6f
,
0x75
,
0x6e
,
0x74
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x61
,
0x6d
,
0x6f
,
0x75
,
0x6e
,
0x74
,
0x22
,
0x47
,
0x0a
,
0x13
,
0x45
,
0x54
,
0x48
,
0x54
,
0x6f
,
0x6b
,
0x65
,
0x6e
,
0x4c
,
0x6f
,
0x63
,
0x6b
,
0x41
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x22
,
0x89
,
0x01
,
0x0a
,
0x1b
,
0x45
,
0x54
,
0x48
,
0x43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x4c
,
0x6f
,
0x63
,
0x6b
,
0x65
,
0x64
,
0x54
,
0x6f
,
0x6b
,
0x65
,
0x6e
,
0x4f
,
0x66
,
0x66
,
0x6c
,
0x69
,
0x6e
,
0x65
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x12
,
0x1c
,
0x0a
,
0x09
,
0x74
,
0x68
,
0x72
,
0x65
,
0x73
,
0x68
,
0x6f
,
0x6c
,
0x64
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x09
,
0x74
,
0x68
,
0x72
,
0x65
,
0x73
,
0x68
,
0x6f
,
0x6c
,
0x64
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x70
,
0x65
,
0x72
,
0x63
,
0x65
,
0x6e
,
0x74
,
0x73
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x0d
,
0x52
,
0x08
,
0x70
,
0x65
,
0x72
,
0x63
,
0x65
,
0x6e
,
0x74
,
0x73
,
0x42
,
0x0a
,
0x5a
,
0x08
,
0x2e
,
0x2e
,
0x2f
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
0x65
,
0x4b
,
0x65
,
0x79
,
0x73
,
0x22
,
0x82
,
0x01
,
0x0a
,
0x0a
,
0x45
,
0x52
,
0x43
,
0x32
,
0x30
,
0x54
,
0x6f
,
0x6b
,
0x65
,
0x6e
,
0x12
,
0x14
,
0x0a
,
0x05
,
0x6f
,
0x77
,
0x6e
,
0x65
,
0x72
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x05
,
0x6f
,
0x77
,
0x6e
,
0x65
,
0x72
,
0x12
,
0x12
,
0x0a
,
0x04
,
0x6e
,
0x61
,
0x6d
,
0x65
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x04
,
0x6e
,
0x61
,
0x6d
,
0x65
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x61
,
0x6d
,
0x6f
,
0x75
,
0x6e
,
0x74
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x61
,
0x6d
,
0x6f
,
0x75
,
0x6e
,
0x74
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x64
,
0x65
,
0x63
,
0x69
,
0x6d
,
0x61
,
0x6c
,
0x73
,
0x18
,
0x05
,
0x20
,
0x01
,
0x28
,
0x05
,
0x52
,
0x08
,
0x64
,
0x65
,
0x63
,
0x69
,
0x6d
,
0x61
,
0x6c
,
0x73
,
0x22
,
0x47
,
0x0a
,
0x13
,
0x45
,
0x54
,
0x48
,
0x54
,
0x6f
,
0x6b
,
0x65
,
0x6e
,
0x4c
,
0x6f
,
0x63
,
0x6b
,
0x41
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x22
,
0x89
,
0x01
,
0x0a
,
0x1b
,
0x45
,
0x54
,
0x48
,
0x43
,
0x6f
,
0x6e
,
0x66
,
0x69
,
0x67
,
0x4c
,
0x6f
,
0x63
,
0x6b
,
0x65
,
0x64
,
0x54
,
0x6f
,
0x6b
,
0x65
,
0x6e
,
0x4f
,
0x66
,
0x66
,
0x6c
,
0x69
,
0x6e
,
0x65
,
0x12
,
0x18
,
0x0a
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x18
,
0x01
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x07
,
0x61
,
0x64
,
0x64
,
0x72
,
0x65
,
0x73
,
0x73
,
0x12
,
0x16
,
0x0a
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x18
,
0x02
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x06
,
0x73
,
0x79
,
0x6d
,
0x62
,
0x6f
,
0x6c
,
0x12
,
0x1c
,
0x0a
,
0x09
,
0x74
,
0x68
,
0x72
,
0x65
,
0x73
,
0x68
,
0x6f
,
0x6c
,
0x64
,
0x18
,
0x03
,
0x20
,
0x01
,
0x28
,
0x09
,
0x52
,
0x09
,
0x74
,
0x68
,
0x72
,
0x65
,
0x73
,
0x68
,
0x6f
,
0x6c
,
0x64
,
0x12
,
0x1a
,
0x0a
,
0x08
,
0x70
,
0x65
,
0x72
,
0x63
,
0x65
,
0x6e
,
0x74
,
0x73
,
0x18
,
0x04
,
0x20
,
0x01
,
0x28
,
0x0d
,
0x52
,
0x08
,
0x70
,
0x65
,
0x72
,
0x63
,
0x65
,
0x6e
,
0x74
,
0x73
,
0x42
,
0x0a
,
0x5a
,
0x08
,
0x2e
,
0x2e
,
0x2f
,
0x74
,
0x79
,
0x70
,
0x65
,
0x73
,
0x62
,
0x06
,
0x70
,
0x72
,
0x6f
,
0x74
,
0x6f
,
0x33
,
}
var
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment