Commit a517c50d authored by hezhengjun's avatar hezhengjun

support decimal set for erc20

parent 51797b6c
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
##编译solidity,并产生bin文件,abi文件,和相应的go文件 ##编译solidity,并产生bin文件,abi文件,和相应的go文件
SRC_BEP := bep20 SRC_BEP := bep20
SRC_ERC20 := erc20
SRC_CONTRACT0 := contracts4chain33 SRC_CONTRACT0 := contracts4chain33
SRC_CONTRACT1 := contracts4eth SRC_CONTRACT1 := contracts4eth
SRC_MULTISIGN := gnosis/safe-contracts/contracts SRC_MULTISIGN := gnosis/safe-contracts/contracts
...@@ -10,6 +11,7 @@ GO_OUT0 := ${SRC_CONTRACT0}/generated ...@@ -10,6 +11,7 @@ GO_OUT0 := ${SRC_CONTRACT0}/generated
GO_OUT1 := ${SRC_CONTRACT1}/generated GO_OUT1 := ${SRC_CONTRACT1}/generated
GO_OUT_MULTISIGN := gnosis/generated GO_OUT_MULTISIGN := gnosis/generated
GO_OUT_BEP20 := bep20/generated GO_OUT_BEP20 := bep20/generated
GO_OUT_ERC20 := erc20/generated
PACKAGE := generated PACKAGE := generated
proj := "build" proj := "build"
...@@ -30,6 +32,9 @@ multisign: ...@@ -30,6 +32,9 @@ multisign:
bep20Bin: bep20Bin:
@abigen --sol $(SRC_BEP)/BEP20.sol --pkg $(PACKAGE) --out $(GO_OUT_BEP20)/bep20.go @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: clean:
@rm -fr $(GO_OUT)/* @rm -fr $(GO_OUT)/*
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.7.3; pragma solidity ^0.7.3;
import "./IERC20.sol"; import "./IERC20.sol";
import "./Context.sol"; import "./Context.sol";
contract ERC20 is Context, IERC20 { contract ERC20 is Context, IERC20 {
mapping (address => uint256) private _balances; mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances; mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply; uint256 private _totalSupply;
string private _name; string private _name;
string private _symbol; string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {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. * 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. * 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_; constructor (string memory name_, string memory symbol_,uint256 supply, address owner, uint8 decimals_) {
_symbol = symbol_; _name = name_;
_totalSupply=supply; _symbol = symbol_;
_balances[owner] = supply; _totalSupply=supply;
} _decimals = decimals_;
_balances[owner] = supply;
/** }
* @dev Returns the name of the token.
*/ /**
function name() public view virtual returns (string memory) { * @dev Returns the name of the token.
return _name; */
} function name() public view virtual returns (string memory) {
return _name;
/** }
* @dev Returns the symbol of the token, usually a shorter version of the
* name. /**
*/ * @dev Returns the symbol of the token, usually a shorter version of the
function symbol() public view virtual returns (string memory) { * name.
return _symbol; */
} 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`). * @dev Returns the number of decimals used to get its user representation.
* * For example, if `decimals` equals `2`, a balance of `505` tokens should
* Tokens usually opt for a value of 18, imitating the relationship between * be displayed to a user as `5,05` (`505 / 10 ** 2`).
* Ether and Wei. This is the value {ERC20} uses, unless this function is *
* overloaded; * 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
* NOTE: This information is only used for _display_ purposes: it in * overloaded;
* no way affects any of the arithmetic of the contract, including *
* {IERC20-balanceOf} and {IERC20-transfer}. * NOTE: This information is only used for _display_ purposes: it in
*/ * no way affects any of the arithmetic of the contract, including
function decimals() public view virtual returns (uint8) { * {IERC20-balanceOf} and {IERC20-transfer}.
return 8; */
} function decimals() public view virtual returns (uint8) {
return _decimals;
/** }
* @dev See {IERC20-totalSupply}.
*/ /**
function totalSupply() public view virtual override returns (uint256) { * @dev See {IERC20-totalSupply}.
return _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) { * @dev See {IERC20-balanceOf}.
return _balances[account]; */
} function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
/** }
* @dev See {IERC20-transfer}.
* /**
* Requirements: * @dev See {IERC20-transfer}.
* *
* - `recipient` cannot be the zero address. * Requirements:
* - the caller must have a balance of at least `amount`. *
*/ * - `recipient` cannot be the zero address.
function transfer(address recipient, uint256 amount) public virtual override returns (bool) { * - the caller must have a balance of at least `amount`.
_transfer(_msgSender(), recipient, amount); */
return true; 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) { * @dev See {IERC20-allowance}.
return _allowances[owner][spender]; */
} function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
/** }
* @dev See {IERC20-approve}.
* /**
* Requirements: * @dev See {IERC20-approve}.
* *
* - `spender` cannot be the zero address. * Requirements:
*/ *
function approve(address spender, uint256 amount) public virtual override returns (bool) { * - `spender` cannot be the zero address.
_approve(_msgSender(), spender, amount); */
return true; 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 * @dev See {IERC20-transferFrom}.
* required by the EIP. See the note at the beginning of {ERC20}. *
* * Emits an {Approval} event indicating the updated allowance. This is not
* Requirements: * required by the EIP. See the note at the beginning of {ERC20}.
* *
* - `sender` and `recipient` cannot be the zero address. * Requirements:
* - `sender` must have a balance of at least `amount`. *
* - the caller must have allowance for ``sender``'s tokens of at least * - `sender` and `recipient` cannot be the zero address.
* `amount`. * - `sender` must have a balance of at least `amount`.
*/ * - the caller must have allowance for ``sender``'s tokens of at least
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { * `amount`.
_transfer(sender, recipient, amount); */
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
uint256 currentAllowance = _allowances[sender][_msgSender()]; _transfer(sender, recipient, amount);
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount); uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
return true; _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 * @dev Atomically increases the allowance granted to `spender` by the caller.
* problems described in {IERC20-approve}. *
* * This is an alternative to {approve} that can be used as a mitigation for
* Emits an {Approval} event indicating the updated allowance. * problems described in {IERC20-approve}.
* *
* Requirements: * Emits an {Approval} event indicating the updated allowance.
* *
* - `spender` cannot be the zero address. * Requirements:
*/ *
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { * - `spender` cannot be the zero address.
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); */
return true; 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 * @dev Atomically decreases the allowance granted to `spender` by the caller.
* problems described in {IERC20-approve}. *
* * This is an alternative to {approve} that can be used as a mitigation for
* Emits an {Approval} event indicating the updated allowance. * problems described in {IERC20-approve}.
* *
* Requirements: * Emits an {Approval} event indicating the updated allowance.
* *
* - `spender` cannot be the zero address. * Requirements:
* - `spender` must have allowance for the caller of at least *
* `subtractedValue`. * - `spender` cannot be the zero address.
*/ * - `spender` must have allowance for the caller of at least
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { * `subtractedValue`.
uint256 currentAllowance = _allowances[_msgSender()][spender]; */
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, currentAllowance - subtractedValue); uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
return true; _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 * @dev Moves tokens `amount` from `sender` to `recipient`.
* e.g. implement automatic token fees, slashing mechanisms, etc. *
* * This is internal function is equivalent to {transfer}, and can be used to
* Emits a {Transfer} event. * e.g. implement automatic token fees, slashing mechanisms, etc.
* *
* Requirements: * Emits a {Transfer} event.
* *
* - `sender` cannot be the zero address. * Requirements:
* - `recipient` cannot be the zero address. *
* - `sender` must have a balance of at least `amount`. * - `sender` cannot be the zero address.
*/ * - `recipient` cannot be the zero address.
function _transfer(address sender, address recipient, uint256 amount) internal virtual { * - `sender` must have a balance of at least `amount`.
require(sender != address(0), "ERC20: transfer from the zero address"); */
require(recipient != address(0), "ERC20: transfer to the zero address"); function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount); require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = _balances[sender]; _beforeTokenTransfer(sender, recipient, amount);
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount; uint256 senderBalance = _balances[sender];
_balances[recipient] += amount; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
emit Transfer(sender, recipient, amount); _balances[recipient] += amount;
}
emit Transfer(sender, recipient, amount);
/** @dev Creates `amount` tokens and assigns them to `account`, increasing }
* the total supply.
* /** @dev Creates `amount` tokens and assigns them to `account`, increasing
* Emits a {Transfer} event with `from` set to the zero address. * the total supply.
* *
* Requirements: * Emits a {Transfer} event with `from` set to the zero address.
* *
* - `to` cannot be the zero address. * Requirements:
*/ *
function _mint(address account, uint256 amount) internal virtual { * - `to` cannot be the zero address.
require(account != address(0), "ERC20: mint to the zero address"); */
function _mint(address account, uint256 amount) internal virtual {
_beforeTokenTransfer(address(0), account, amount); require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount; _beforeTokenTransfer(address(0), account, amount);
_balances[account] += amount;
emit Transfer(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. /**
* * @dev Destroys `amount` tokens from `account`, reducing the
* Emits a {Transfer} event with `to` set to the zero address. * total supply.
* *
* Requirements: * Emits a {Transfer} event with `to` set to the zero address.
* *
* - `account` cannot be the zero address. * Requirements:
* - `account` must have at least `amount` tokens. *
*/ * - `account` cannot be the zero address.
function _burn(address account, uint256 amount) internal virtual { * - `account` must have at least `amount` tokens.
require(account != address(0), "ERC20: burn from the zero address"); */
function _burn(address account, uint256 amount) internal virtual {
_beforeTokenTransfer(account, address(0), amount); require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account]; _beforeTokenTransfer(account, address(0), amount);
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount; uint256 accountBalance = _balances[account];
_totalSupply -= amount; require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
emit Transfer(account, address(0), 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 * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
* e.g. set automatic allowances for certain subsystems, etc. *
* * This internal function is equivalent to `approve`, and can be used to
* Emits an {Approval} event. * e.g. set automatic allowances for certain subsystems, etc.
* *
* Requirements: * Emits an {Approval} event.
* *
* - `owner` cannot be the zero address. * Requirements:
* - `spender` cannot be the zero address. *
*/ * - `owner` cannot be the zero address.
function _approve(address owner, address spender, uint256 amount) internal virtual { * - `spender` cannot be the zero address.
require(owner != address(0), "ERC20: approve from the zero address"); */
require(spender != address(0), "ERC20: approve to the zero address"); function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
_allowances[owner][spender] = amount; require(spender != address(0), "ERC20: approve to the zero address");
emit Approval(owner, spender, amount);
} _allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
/** }
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning. /**
* * @dev Hook that is called before any transfer of tokens. This includes
* Calling conditions: * minting and burning.
* *
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * Calling conditions:
* will be to transferred to `to`. *
* - when `from` is zero, `amount` tokens will be minted for `to`. * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* - when `to` is zero, `amount` of ``from``'s tokens will be burned. * will be to transferred to `to`.
* - `from` and `to` are never both zero. * - when `from` is zero, `amount` tokens will be minted for `to`.
* * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. * - `from` and `to` are never both zero.
*/ *
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } * 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 { }
}
...@@ -172,7 +172,7 @@ func (_Context *ContextTransactorRaw) Transact(opts *bind.TransactOpts, method s ...@@ -172,7 +172,7 @@ func (_Context *ContextTransactorRaw) Transact(opts *bind.TransactOpts, method s
} }
// ERC20ABI is the input ABI used to generate the binding from. // 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. // ERC20FuncSigs maps the 4-byte function signature to its string representation.
var ERC20FuncSigs = map[string]string{ var ERC20FuncSigs = map[string]string{
...@@ -190,16 +190,16 @@ var ERC20FuncSigs = map[string]string{ ...@@ -190,16 +190,16 @@ var ERC20FuncSigs = map[string]string{
} }
// ERC20Bin is the compiled bytecode used for deploying new contracts. // ERC20Bin is the compiled bytecode used for deploying new contracts.
var ERC20Bin = "0x608060405234801561001057600080fd5b50604051610bd1380380610bd18339818101604052608081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156100ff57600080fd5b90830190602082018581111561011457600080fd5b825164010000000081118282018810171561012e57600080fd5b82525081516020918201929091019080838360005b8381101561015b578181015183820152602001610143565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b5060409081526020828101519290910151865192945092506101af916003918701906101e9565b5082516101c39060049060208601906101e9565b5060028290556001600160a01b03166000908152602081905260409020555061027c9050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061022a57805160ff1916838001178555610257565b82800160010185558215610257579182015b8281111561025757825182559160200191906001019061023c565b50610263929150610267565b5090565b5b808211156102635760008155600101610268565b6109468061028b6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c3610421565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610426565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610471565b6100b661048c565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104ed565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610585565b610173600480360360408110156102a157600080fd5b506001600160a01b0381358116916020013516610599565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c6105c4565b84846105c8565b50600192915050565b60025490565b600061037f8484846106b4565b6001600160a01b0384166000908152600160205260408120816103a06105c4565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104025760405162461bcd60e51b815260040180806020018281038252602881526020018061087b6028913960400191505060405180910390fd5b6104168561040e6105c4565b8584036105c8565b506001949350505050565b600890565b60006103636104336105c4565b8484600160006104416105c4565b6001600160a01b03908116825260208083019390935260409182016000908120918b1681529252902054016105c8565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b600080600160006104fc6105c4565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156105675760405162461bcd60e51b81526004018080602001828103825260258152602001806108ec6025913960400191505060405180910390fd5b61057b6105726105c4565b858584036105c8565b5060019392505050565b60006103636105926105c4565b84846106b4565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661060d5760405162461bcd60e51b81526004018080602001828103825260248152602001806108c86024913960400191505060405180910390fd5b6001600160a01b0382166106525760405162461bcd60e51b81526004018080602001828103825260228152602001806108336022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106f95760405162461bcd60e51b81526004018080602001828103825260258152602001806108a36025913960400191505060405180910390fd5b6001600160a01b03821661073e5760405162461bcd60e51b81526004018080602001828103825260238152602001806108106023913960400191505060405180910390fd5b61074983838361080a565b6001600160a01b038316600090815260208190526040902054818110156107a15760405162461bcd60e51b81526004018080602001828103825260268152602001806108556026913960400191505060405180910390fd5b6001600160a01b038085166000818152602081815260408083208787039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220bb703c9c726f60b54cd16fcdcf459351563c86ad2912372653cf90c5760d2a3c64736f6c63430007030033" var ERC20Bin = "0x608060405234801561001057600080fd5b50604051610bef380380610bef833981810160405260a081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156100ff57600080fd5b90830190602082018581111561011457600080fd5b825164010000000081118282018810171561012e57600080fd5b82525081516020918201929091019080838360005b8381101561015b578181015183820152602001610143565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b5060409081526020828101519183015160609093015187519295509293506101b591600391880190610203565b5083516101c9906004906020870190610203565b5060028390556005805460ff191660ff929092169190911790556001600160a01b0316600090815260208190526040902055506102969050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061024457805160ff1916838001178555610271565b82800160010185558215610271579182015b82811115610271578251825591602001919060010190610256565b5061027d929150610281565b5090565b5b8082111561027d5760008155600101610282565b61094a806102a56000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c3610421565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b03813516906020013561042a565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610475565b6100b6610490565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104f1565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610589565b610173600480360360408110156102a157600080fd5b506001600160a01b038135811691602001351661059d565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c6105c8565b84846105cc565b50600192915050565b60025490565b600061037f8484846106b8565b6001600160a01b0384166000908152600160205260408120816103a06105c8565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104025760405162461bcd60e51b815260040180806020018281038252602881526020018061087f6028913960400191505060405180910390fd5b6104168561040e6105c8565b8584036105cc565b506001949350505050565b60055460ff1690565b60006103636104376105c8565b8484600160006104456105c8565b6001600160a01b03908116825260208083019390935260409182016000908120918b1681529252902054016105cc565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b600080600160006105006105c8565b6001600160a01b039081168252602080830193909352604091820160009081209188168152925290205490508281101561056b5760405162461bcd60e51b81526004018080602001828103825260258152602001806108f06025913960400191505060405180910390fd5b61057f6105766105c8565b858584036105cc565b5060019392505050565b60006103636105966105c8565b84846106b8565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166106115760405162461bcd60e51b81526004018080602001828103825260248152602001806108cc6024913960400191505060405180910390fd5b6001600160a01b0382166106565760405162461bcd60e51b81526004018080602001828103825260228152602001806108376022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106fd5760405162461bcd60e51b81526004018080602001828103825260258152602001806108a76025913960400191505060405180910390fd5b6001600160a01b0382166107425760405162461bcd60e51b81526004018080602001828103825260238152602001806108146023913960400191505060405180910390fd5b61074d83838361080e565b6001600160a01b038316600090815260208190526040902054818110156107a55760405162461bcd60e51b81526004018080602001828103825260268152602001806108596026913960400191505060405180910390fd5b6001600160a01b038085166000818152602081815260408083208787039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220a76db73049f948a1731f127a763d671c623beb64c13e39a155f8ce564fe19c8864736f6c63430007030033"
// DeployERC20 deploys a new Ethereum contract, binding an instance of ERC20 to it. // 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)) parsed, err := abi.JSON(strings.NewReader(ERC20ABI))
if err != nil { if err != nil {
return common.Address{}, nil, nil, err 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 { if err != nil {
return common.Address{}, nil, nil, err return common.Address{}, nil, nil, err
} }
......
...@@ -312,6 +312,8 @@ func DeployERC20Flags(cmd *cobra.Command) { ...@@ -312,6 +312,8 @@ func DeployERC20Flags(cmd *cobra.Command) {
_ = cmd.MarkFlagRequired("symbol") _ = cmd.MarkFlagRequired("symbol")
cmd.Flags().StringP("amount", "m", "0", "amount") cmd.Flags().StringP("amount", "m", "0", "amount")
_ = cmd.MarkFlagRequired("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) { func DeployERC20(cmd *cobra.Command, args []string) {
...@@ -320,12 +322,19 @@ func DeployERC20(cmd *cobra.Command, args []string) { ...@@ -320,12 +322,19 @@ func DeployERC20(cmd *cobra.Command, args []string) {
name, _ := cmd.Flags().GetString("name") name, _ := cmd.Flags().GetString("name")
symbol, _ := cmd.Flags().GetString("symbol") symbol, _ := cmd.Flags().GetString("symbol")
amount, _ := cmd.Flags().GetString("amount") 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{ para := ebTypes.ERC20Token{
Owner: owner, Owner: owner,
Name: name, Name: name,
Symbol: symbol, Symbol: symbol,
Amount: amount, Amount: amount,
Decimals: int32(decimals),
} }
var res rpctypes.Reply var res rpctypes.Reply
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.DeployERC20", para, &res) ctx := jsonclient.NewRPCCtx(rpcLaddr, "Manager.DeployERC20", para, &res)
......
...@@ -222,6 +222,7 @@ message ERC20Token { ...@@ -222,6 +222,7 @@ message ERC20Token {
string name = 2; string name = 2;
string symbol = 3; string symbol = 3;
string amount = 4; string amount = 4;
int32 decimals = 5;
} }
message ETHTokenLockAddress { message ETHTokenLockAddress {
......
...@@ -332,12 +332,12 @@ func (ethRelayer *Relayer4Ethereum) AddToken2LockList(symbol, token string) (str ...@@ -332,12 +332,12 @@ func (ethRelayer *Relayer4Ethereum) AddToken2LockList(symbol, token string) (str
} }
//DeployERC20 ... //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 := big.NewInt(1)
bn, _ = bn.SetString(utils.TrimZeroAndDot(amount), 10) bn, _ = bn.SetString(utils.TrimZeroAndDot(amount), 10)
ethRelayer.rwLock.RLock() ethRelayer.rwLock.RLock()
defer ethRelayer.rwLock.RUnlock() 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 ... //ApproveAllowance ...
......
...@@ -499,7 +499,7 @@ finished: ...@@ -499,7 +499,7 @@ finished:
return x2EthContracts, deployInfo, nil 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 { if nil == para {
return "", errors.New("no operator private key configured") return "", errors.New("no operator private key configured")
} }
...@@ -523,7 +523,7 @@ func DeployERC20(ownerAddr, name, symbol string, amount *big.Int, client ethinte ...@@ -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) txslog.Info("DeployERC20", "ownerAddr", ownerAddr, "name", name, "symbol", symbol, "amount", amount, "client", client)
Erc20OwnerAddr := common.HexToAddress(ownerAddr) 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 { if nil != err {
txslog.Error("DeployERC20", "Failed to DeployErc20 with err:", err.Error()) txslog.Error("DeployERC20", "Failed to DeployErc20 with err:", err.Error())
return "", err return "", err
......
...@@ -485,7 +485,7 @@ func (manager *Manager) DeployERC20(Erc20Token relayerTypes.ERC20Token, result * ...@@ -485,7 +485,7 @@ func (manager *Manager) DeployERC20(Erc20Token relayerTypes.ERC20Token, result *
return err 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 { if nil != err {
return err return err
} }
......
...@@ -2129,10 +2129,11 @@ type ERC20Token struct { ...@@ -2129,10 +2129,11 @@ type ERC20Token struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,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"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,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"` 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() { func (x *ERC20Token) Reset() {
...@@ -2195,6 +2196,13 @@ func (x *ERC20Token) GetAmount() string { ...@@ -2195,6 +2196,13 @@ func (x *ERC20Token) GetAmount() string {
return "" return ""
} }
func (x *ERC20Token) GetDecimals() int32 {
if x != nil {
return x.Decimals
}
return 0
}
type ETHTokenLockAddress struct { type ETHTokenLockAddress struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -2568,28 +2576,30 @@ var file_relayer_proto_rawDesc = []byte{ ...@@ -2568,28 +2576,30 @@ var file_relayer_proto_rawDesc = []byte{
0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x6f, 0x77, 0x6e, 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, 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, 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, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x0a, 0x45, 0x52, 0x43, 0x32, 0x30, 0x54,
0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20,
0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16,
0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x47, 0x0a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a,
0x13, 0x45, 0x54, 0x48, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x64, 0x0a, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05,
0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x52, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x22, 0x47, 0x0a, 0x13, 0x45, 0x54,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x48, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73,
0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01,
0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x45, 0x54, 0x48, 0x43, 0x6f, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73,
0x6e, 0x66, 0x69, 0x67, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d,
0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x62, 0x6f, 0x6c, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x45, 0x54, 0x48, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x67, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x66, 0x66, 0x6c,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01,
0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a,
0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x68, 0x72, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f,
0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68,
0x74, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x6f, 0x6c, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x73, 0x18,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment