forked from axieinfinity/ronin-dpos-contracts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from axieinfinity/implement-feature/migrate-ha…
…rdhat-test/write-integration-test feat(migrate-hardhat-test): implement `write-integration-test`
- Loading branch information
Showing
31 changed files
with
1,367 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
script/BaseMigrationV2.sol:BaseMigrationV2:stdstore (storage_slot: 0) (offset: 0) (type: struct StdStorage) (numberOfBytes: 224) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:stdChainsInitialized (storage_slot: 7) (offset: 0) (type: bool) (numberOfBytes: 1) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:chains (storage_slot: 8) (offset: 0) (type: mapping(string => struct StdChains.Chain)) (numberOfBytes: 32) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:defaultRpcUrls (storage_slot: 9) (offset: 0) (type: mapping(string => string)) (numberOfBytes: 32) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:idToAlias (storage_slot: 10) (offset: 0) (type: mapping(uint256 => string)) (numberOfBytes: 32) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:fallbackToDefaultRpcUrls (storage_slot: 11) (offset: 0) (type: bool) (numberOfBytes: 1) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:gasMeteringOff (storage_slot: 11) (offset: 1) (type: bool) (numberOfBytes: 1) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:IS_SCRIPT (storage_slot: 11) (offset: 2) (type: bool) (numberOfBytes: 1) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:IS_TEST (storage_slot: 11) (offset: 3) (type: bool) (numberOfBytes: 1) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:_failed (storage_slot: 11) (offset: 4) (type: bool) (numberOfBytes: 1) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:_overriddenArgs (storage_slot: 12) (offset: 0) (type: bytes) (numberOfBytes: 32) | ||
script/BaseMigrationV2.sol:BaseMigrationV2:_deployScript (storage_slot: 13) (offset: 0) (type: mapping(TContract => contract IMigrationScript)) (numberOfBytes: 32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.23; | ||
|
||
import "foundry-deployment-kit/BaseMigration.s.sol"; | ||
|
||
abstract contract BaseMigrationV2 is BaseMigration { | ||
using StdStyle for *; | ||
using LibString for bytes32; | ||
using LibProxy for address payable; | ||
|
||
function _deployProxy(TContract contractType, bytes memory args) | ||
internal | ||
virtual | ||
override | ||
logFn(string.concat("_deployProxy ", TContract.unwrap(contractType).unpackOne())) | ||
returns (address payable deployed) | ||
{ | ||
string memory contractName = CONFIG.getContractName(contractType); | ||
|
||
address logic = _deployLogic(contractType); | ||
string memory proxyAbsolutePath = "TransparentUpgradeableProxyV2.sol:TransparentUpgradeableProxyV2"; | ||
uint256 proxyNonce; | ||
address proxyAdmin = _getProxyAdmin(); | ||
assertTrue(proxyAdmin != address(0x0), "BaseMigration: Null ProxyAdmin"); | ||
|
||
(deployed, proxyNonce) = _deployRaw(proxyAbsolutePath, abi.encode(logic, proxyAdmin, args)); | ||
|
||
// validate proxy admin | ||
address actualProxyAdmin = deployed.getProxyAdmin(); | ||
assertEq( | ||
actualProxyAdmin, | ||
proxyAdmin, | ||
string.concat( | ||
"BaseMigration: Invalid proxy admin\n", | ||
"Actual: ", | ||
vm.toString(actualProxyAdmin), | ||
"\nExpected: ", | ||
vm.toString(proxyAdmin) | ||
) | ||
); | ||
|
||
CONFIG.setAddress(network(), contractType, deployed); | ||
ARTIFACT_FACTORY.generateArtifact( | ||
sender(), deployed, proxyAbsolutePath, string.concat(contractName, "Proxy"), args, proxyNonce | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { PauseEnforcer } from "@ronin/contracts/ronin/gateway/PauseEnforcer.sol"; | ||
import { Contract } from "../utils/Contract.sol"; | ||
import { ISharedArgument } from "../interfaces/ISharedArgument.sol"; | ||
import { Migration } from "../Migration.s.sol"; | ||
|
||
contract MainchainPauseEnforcerDeploy is Migration { | ||
function run() public virtual returns (PauseEnforcer) { | ||
return PauseEnforcer(_deployProxy(Contract.MainchainPauseEnforcer.key(), EMPTY_ARGS)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { PauseEnforcer } from "@ronin/contracts/ronin/gateway/PauseEnforcer.sol"; | ||
import { Contract } from "../utils/Contract.sol"; | ||
import { ISharedArgument } from "../interfaces/ISharedArgument.sol"; | ||
import { Migration } from "../Migration.s.sol"; | ||
|
||
contract RoninPauseEnforcerDeploy is Migration { | ||
function run() public virtual returns (PauseEnforcer) { | ||
return PauseEnforcer(_deployProxy(Contract.RoninPauseEnforcer.key(), EMPTY_ARGS)); | ||
} | ||
} |
Oops, something went wrong.