Skip to content

Commit

Permalink
update lockproxy (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyinglyh1 authored Aug 28, 2020
1 parent 15d84b7 commit 38d8c2e
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions contracts/core/lock_proxy/LockProxy.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.5.0;

import "./../../libs/GSN/Context.sol";
import "./../../libs/ownership/Ownable.sol";
import "./../../libs/common/ZeroCopySource.sol";
import "./../../libs/common/ZeroCopySink.sol";
import "./../../libs/utils/Utils.sol";
Expand All @@ -15,15 +15,14 @@ interface ERC20Interface {
}


contract LockProxy is Context {
contract LockProxy is Ownable {
using SafeMath for uint;

struct TxArgs {
bytes toAssetHash;
bytes toAddress;
uint256 amount;
}
address public operator;
address public managerProxyContract;
mapping(uint64 => bytes) public proxyHashMap;
mapping(address => mapping(uint64 => bytes)) public assetHashMap;
Expand All @@ -34,31 +33,24 @@ contract LockProxy is Context {
event UnlockEvent(address toAssetHash, address toAddress, uint256 amount);
event LockEvent(address fromAssetHash, address fromAddress, uint64 toChainId, bytes toAssetHash, bytes toAddress, uint256 amount);

constructor () public {
operator = _msgSender();
}
modifier onlyOperator() {
require(_msgSender() == operator) ;
_;
}
modifier onlyManagerContract() {
IEthCrossChainManagerProxy ieccmp = IEthCrossChainManagerProxy(managerProxyContract);
require(_msgSender() == ieccmp.getEthCrossChainManager(), "msgSender is not EthCrossChainManagerContract");
_;
}

function setManagerProxy(address ethCCMProxyAddr) onlyOperator public {
function setManagerProxy(address ethCCMProxyAddr) onlyOwner public {
managerProxyContract = ethCCMProxyAddr;
emit SetManagerProxyEvent(managerProxyContract);
}

function bindProxyHash(uint64 toChainId, bytes memory targetProxyHash) onlyOperator public returns (bool) {
function bindProxyHash(uint64 toChainId, bytes memory targetProxyHash) onlyOwner public returns (bool) {
proxyHashMap[toChainId] = targetProxyHash;
emit BindProxyEvent(toChainId, targetProxyHash);
return true;
}

function bindAssetHash(address fromAssetHash, uint64 toChainId, bytes memory toAssetHash) onlyOperator public returns (bool) {
function bindAssetHash(address fromAssetHash, uint64 toChainId, bytes memory toAssetHash) onlyOwner public returns (bool) {
assetHashMap[fromAssetHash][toChainId] = toAssetHash;
emit BindAssetEvent(fromAssetHash, toChainId, toAssetHash, getBalanceFor(fromAssetHash));
return true;
Expand Down

0 comments on commit 38d8c2e

Please sign in to comment.