From e0f8553b57f0f90efcb20974a54cee7aed7c0c70 Mon Sep 17 00:00:00 2001 From: Moon Date: Sun, 13 Aug 2023 18:01:31 -0400 Subject: [PATCH] make bridge registration onlyOwner, add config for bridge info --- contracts/TenGransEthToken.sol | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contracts/TenGransEthToken.sol b/contracts/TenGransEthToken.sol index 389121b..9ce4e67 100644 --- a/contracts/TenGransEthToken.sol +++ b/contracts/TenGransEthToken.sol @@ -25,12 +25,14 @@ interface IGatewayRouter2 { } contract TenGransEthToken is AbstractGrans, ICustomToken { - address public gateway; - address public router; + address public immutable gateway; + address public immutable router; bool private shouldRegisterGateway; - constructor() AbstractGrans() { - _mint(msg.sender, 15000 * 10 ** decimals()); + constructor(address _gateway, address _router) AbstractGrans() { + gateway = _gateway; + router = _router; + _mint(msg.sender, 15_000 * 10 ** 18); } function balanceOf(address account) public view virtual override(AbstractGrans, ICustomToken) returns (uint256) { @@ -57,7 +59,7 @@ contract TenGransEthToken is AbstractGrans, ICustomToken { uint256 valueForGateway, uint256 valueForRouter, address creditBackAddress - ) public payable override { + ) public payable override onlyOwner { // we temporarily set `shouldRegisterGateway` to true for the callback in registerTokenToL2 to succeed bool prev = shouldRegisterGateway; shouldRegisterGateway = true;