-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(script): implement
adapt-new-migration-script
(#184)
- Loading branch information
Showing
41 changed files
with
684 additions
and
604 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1 @@ | ||
# Source (or "dot") the .env file to load environment variables | ||
if [ -f .env ]; then | ||
source .debug.env | ||
else | ||
echo "Error: .debug.env file not found." | ||
fi | ||
|
||
verify_arg="" | ||
extra_argument="" | ||
op_command="" | ||
|
||
for arg in "$@"; do | ||
case $arg in | ||
--trezor) | ||
op_command="" | ||
extra_argument+=trezor@ | ||
;; | ||
--broadcast) | ||
op_command="op run --env-file="./.env" --" | ||
;; | ||
--log) | ||
set -- "${@/#--log/}" | ||
extra_argument+=log@ | ||
;; | ||
*) ;; | ||
esac | ||
done | ||
|
||
# Remove the @ character from the end of extra_argument | ||
extra_argument="${extra_argument%%@}" | ||
|
||
echo Debug Tx... | ||
echo From: ${FROM} | ||
echo To: ${TO} | ||
echo Value: ${VALUE} | ||
echo Calldata: | ||
cast pretty-calldata ${CALLDATA} | ||
calldata=$(cast calldata 'debug(uint256,address,address,uint256,bytes)' ${BLOCK} ${FROM} ${TO} ${VALUE} ${CALLDATA}) | ||
${op_command} forge script ${verify_arg} --legacy ${@} script/Debug.s.sol --sig 'run(bytes,string)' ${calldata} "${extra_argument}" | ||
source lib/foundry-deployment-kit/debug.sh |
Submodule contract-libs
added at
f177e3
Submodule foundry-deployment-kit
updated
73 files
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 |
---|---|---|
@@ -1,27 +1 @@ | ||
verify_arg="" | ||
extra_argument="" | ||
op_command="op run --env-file="./.env" --" | ||
|
||
for arg in "$@"; do | ||
case $arg in | ||
--trezor) | ||
op_command="" | ||
extra_argument+=trezor@ | ||
;; | ||
--broadcast) | ||
op_command="op run --env-file="./.env" --" | ||
# verify_arg="--verify --verifier sourcify --verifier-url https://sourcify.roninchain.com/server/" | ||
;; | ||
--log) | ||
set -- "${@/#--log/}" | ||
extra_argument+=log@ | ||
;; | ||
*) ;; | ||
esac | ||
done | ||
|
||
# Remove the @ character from the end of extra_argument | ||
extra_argument="${extra_argument%%@}" | ||
|
||
calldata=$(cast calldata 'run()') | ||
${op_command} forge script ${verify_arg} --legacy ${@} --sig 'run(bytes,string)' ${calldata} "${extra_argument}" | ||
source lib/foundry-deployment-kit/run.sh |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol"; | ||
import { RNSDeploy } from "script/RNSDeploy.s.sol"; | ||
import { Contract } from "script/utils/Contract.sol"; | ||
import { Migration } from "script/Migration.s.sol"; | ||
|
||
contract Migration__20231020_RNSUpgrade is RNSDeploy { | ||
function run() public trySetUp { | ||
_upgradeProxy(ContractKey.RNSUnified, EMPTY_ARGS); | ||
contract Migration__20231020_RNSUpgrade is Migration { | ||
function run() public { | ||
_upgradeProxy(Contract.RNSUnified.key()); | ||
} | ||
} |
12 changes: 6 additions & 6 deletions
12
script/20231021-upgrade-domain-price-and-auction/20231021_UpgradeDomainPriceAndAuction.s.sol
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol"; | ||
import { RNSDeploy } from "script/RNSDeploy.s.sol"; | ||
import { Contract } from "script/utils/Contract.sol"; | ||
import { Migration } from "script/Migration.s.sol"; | ||
|
||
contract Migration__20231021_UpgradeDomainPriceAndAuction is RNSDeploy { | ||
function run() public trySetUp { | ||
_upgradeProxy(ContractKey.RNSAuction, EMPTY_ARGS); | ||
_upgradeProxy(ContractKey.RNSDomainPrice, EMPTY_ARGS); | ||
contract Migration__20231021_UpgradeDomainPriceAndAuction is Migration { | ||
function run() public { | ||
_upgradeProxy(Contract.RNSAuction.key()); | ||
_upgradeProxy(Contract.RNSDomainPrice.key()); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
script/20231024-upgrade-auction/20231024_UpgradeAuction.s.sol
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol"; | ||
import { RNSDeploy } from "script/RNSDeploy.s.sol"; | ||
import { Contract } from "script/utils/Contract.sol"; | ||
import { Migration } from "script/Migration.s.sol"; | ||
|
||
contract Migration__20231024_UpgradeAuction is RNSDeploy { | ||
function run() public trySetUp { | ||
_upgradeProxy(ContractKey.RNSAuction, EMPTY_ARGS); | ||
contract Migration__20231024_UpgradeAuction is Migration { | ||
function run() public { | ||
_upgradeProxy(Contract.RNSAuction.key()); | ||
} | ||
} |
23 changes: 14 additions & 9 deletions
23
script/20231024-upgrade-domain-price/20231024_Config.s.sol
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 |
---|---|---|
@@ -1,17 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { Network, RNSDeploy } from "script/RNSDeploy.s.sol"; | ||
import { ISharedArgument, DefaultNetwork, Migration } from "script/Migration.s.sol"; | ||
|
||
abstract contract Config__20231024 is RNSDeploy { | ||
function _buildMigrationConfig() internal view virtual override returns (Config memory config) { | ||
config = super._buildMigrationConfig(); | ||
if (_network == Network.RoninTestnet) { | ||
config.overrider = config.operator; | ||
} else if (_network == Network.RoninMainnet) { | ||
revert("Missing config"); | ||
abstract contract Config__20231024 is Migration { | ||
function _sharedArguments() internal view virtual override returns (bytes memory rawArgs) { | ||
rawArgs = super._sharedArguments(); | ||
|
||
ISharedArgument.SharedParameter memory param = abi.decode(rawArgs, (ISharedArgument.SharedParameter)); | ||
|
||
if (network() == DefaultNetwork.RoninTestnet.key()) { | ||
param.rnsDomainPrice.overrider = param.rnsDomainPrice.domainPriceOperators[0]; | ||
} else if (network() == DefaultNetwork.RoninMainnet.key()) { | ||
revert("Missing param"); | ||
} else { | ||
revert("Missing config"); | ||
revert("Missing param"); | ||
} | ||
|
||
rawArgs = abi.encode(param); | ||
} | ||
} |
20 changes: 10 additions & 10 deletions
20
script/20231024-upgrade-domain-price/20231024_UpgradeDomainPrice.s.sol
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { console2 } from "forge-std/console2.sol"; | ||
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol"; | ||
import { console2 as console } from "forge-std/console2.sol"; | ||
import { Contract } from "script/utils/Contract.sol"; | ||
import { RNSDomainPrice } from "@rns-contracts/RNSDomainPrice.sol"; | ||
import { Config__20231024 } from "./20231024_Config.s.sol"; | ||
import { ISharedArgument, Config__20231024 } from "./20231024_Config.s.sol"; | ||
|
||
contract Migration__20231024_UpgradeDomainPrice is Config__20231024 { | ||
function run() public trySetUp { | ||
Config memory config = getConfig(); | ||
_upgradeProxy(ContractKey.RNSDomainPrice, EMPTY_ARGS); | ||
function run() public { | ||
ISharedArgument.RNSDomainPriceParam memory param = config.sharedArguments().rnsDomainPrice; | ||
_upgradeProxy(Contract.RNSDomainPrice.key()); | ||
|
||
console2.log("operator", config.operator); | ||
console2.log("overrider", config.overrider); | ||
console.log("operator", param.domainPriceOperators[0]); | ||
console.log("overrider", param.overrider); | ||
|
||
RNSDomainPrice domainPrice = RNSDomainPrice(_config.getAddressFromCurrentNetwork(ContractKey.RNSDomainPrice)); | ||
RNSDomainPrice domainPrice = RNSDomainPrice(loadContract(Contract.RNSDomainPrice.key())); | ||
address admin = domainPrice.getRoleMember(0x00, 0); | ||
bytes32 overriderRole = domainPrice.OVERRIDER_ROLE(); | ||
vm.broadcast(admin); | ||
domainPrice.grantRole(overriderRole, config.overrider); | ||
domainPrice.grantRole(overriderRole, param.overrider); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
script/20231024-upgrade-rns-unified/20231024_UpgradeRNSUnified.s.sol
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol"; | ||
import { RNSDeploy } from "script/RNSDeploy.s.sol"; | ||
import { Contract } from "script/utils/Contract.sol"; | ||
import { Migration } from "script/Migration.s.sol"; | ||
|
||
contract Migration__20231024_UpgradeRNSUnified is RNSDeploy { | ||
function run() public trySetUp { | ||
_upgradeProxy(ContractKey.RNSUnified, EMPTY_ARGS); | ||
contract Migration__20231024_UpgradeRNSUnified is Migration { | ||
function run() public { | ||
_upgradeProxy(Contract.RNSUnified.key()); | ||
} | ||
} |
Oops, something went wrong.