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
5cc71170
Commit
5cc71170
authored
Nov 03, 2021
by
hezhengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only bridge token could be locked and tranfer to contract:evmxgo
parent
adff0614
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
28 deletions
+23
-28
BridgeBank.sol
plugin/dapp/bridgevmxgo/contracts/BridgeBank/BridgeBank.sol
+23
-28
BridgeBank.go
plugin/dapp/bridgevmxgo/contracts/generated/BridgeBank.go
+0
-0
No files found.
plugin/dapp/bridgevmxgo/contracts/BridgeBank/BridgeBank.sol
View file @
5cc71170
...
...
@@ -17,7 +17,7 @@ import "../GoAssetBridge.sol";
contract BridgeBank is GoAssetBank, EvmAssetBank {
using SafeMath for uint256;
address public operator;
Oracle public oracle;
GoAssetBridge public goAssetBridge;
...
...
@@ -82,8 +82,19 @@ contract BridgeBank is GoAssetBank, EvmAssetBank {
);
_;
}
/*
* @dev: Modifier to make sure this symbol not created now
*/
modifier onlyBridgeToken(address _token)
{
require(
(address(0) == _token) && (msg.value == 0),
"Only bridge token could be locked and tranfer to contract:evmxgo"
);
_;
}
/*
/*
* @dev: Fallback function allows operator to send funds to the bank directly
* This feature is used for testing and is available at the operator's own risk.
*/
...
...
@@ -219,36 +230,20 @@ contract BridgeBank is GoAssetBank, EvmAssetBank {
)
public
availableNonce()
onlyBridgeToken(_token)
payable
{
string memory symbol;
// Chain33 deposit
if (msg.value > 0) {
require(
_token == address(0),
"BTY deposits require the 'token' address to be the null address"
);
require(
msg.value == _amount,
"The transactions value must be equal the specified amount(BTY decimal is 8)"
);
// Set the the symbol to BTY
symbol = "BTY";
// ERC20 deposit
} else {
require(
BridgeToken(_token).transferFrom(msg.sender, address(this), _amount),
"Contract token allowances insufficient to complete this lock request"
);
// Set symbol to the ERC20 token's symbol
symbol = BridgeToken(_token).symbol();
require(
tokenAllow2Lock[keccak256(abi.encodePacked(symbol))] == _token,
require(
BridgeToken(_token).transferFrom(msg.sender, address(this), _amount),
"Contract token allowances insufficient to complete this lock request"
);
// Set symbol to the ERC20 token's symbol
symbol = BridgeToken(_token).symbol();
require(
tokenAllow2Lock[keccak256(abi.encodePacked(symbol))] == _token,
'The token is not allowed to be locked from Chain33.'
);
}
);
lockFunds(
msg.sender,
...
...
plugin/dapp/bridgevmxgo/contracts/generated/BridgeBank.go
View file @
5cc71170
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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