Skip to content

Commit 33c2fcb

Browse files
authored
Deploy e-near proxy securely by setting an admin address to multisig (#298)
1 parent 81ed549 commit 33c2fcb

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

evm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ yarn hardhat check
1212

1313
**Deploy eNearProxy**
1414
```shell
15-
yarn hardhat deploy-e-near-proxy --enear "<eNear address>" --network=sepolia
15+
yarn hardhat deploy-e-near-proxy --enear "<eNear address>" --admin "<admin address>" --network=sepolia
1616
```
1717

1818
**Deploy ERC20 token implementation**

evm/src/eNear/contracts/ENearProxy.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ contract ENearProxy is UUPSUpgradeable, AccessControlUpgradeable, ICustomMinter
1919
_disableInitializers();
2020
}
2121

22-
function initialize(address _eNear, bytes memory _nearConnector, uint256 _currentReceiptId) public initializer {
22+
function initialize(address _eNear, bytes memory _nearConnector, uint256 _currentReceiptId, address _adminAddress) public initializer {
2323
__UUPSUpgradeable_init();
2424
__AccessControl_init();
2525
eNear = IENear(_eNear);
2626
nearConnector = _nearConnector;
2727
currentReceiptId = _currentReceiptId;
28-
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
28+
_grantRole(DEFAULT_ADMIN_ROLE, _adminAddress);
2929
}
3030

3131
function mint(address token, address to, uint128 amount) public onlyRole(MINTER_ROLE) {

evm/src/eNear/scripts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ task("deploy-e-near-proxy", "Deploys the ENearProxy contract")
1212
const eNearProxyContract = await ethers.getContractFactory("ENearProxy")
1313
const eNearProxy = await upgrades.deployProxy(
1414
eNearProxyContract,
15-
[taskArgs.enear, nearConnector, 0],
15+
[taskArgs.enear, nearConnector, 0, taskArgs.admin],
1616
{
1717
initializer: "initialize",
1818
timeout: 0,

evm/tests/eNearProxy.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ describe("eNearProxy contract", () => {
5252
const eNearProxyFactory = await ethers.getContractFactory("ENearProxy")
5353
eNearProxy = (await upgrades.deployProxy(
5454
eNearProxyFactory,
55-
[await eNear.getAddress(), Buffer.from("eNearBridge", "utf-8"), 0],
55+
[
56+
await eNear.getAddress(),
57+
Buffer.from("eNearBridge", "utf-8"),
58+
0,
59+
await deployer.getAddress(),
60+
],
5661
{ initializer: "initialize" },
5762
)) as unknown as ENearProxy
5863

0 commit comments

Comments
 (0)