Skip to content

Commit

Permalink
chore: pump forge-std to 1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 committed Jul 25, 2024
1 parent 46822c4 commit f9a3695
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 65 deletions.
6 changes: 3 additions & 3 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ ronin-testnet = "https://saigon-archive.roninchain.com/rpc"
localhost = "http://localhost:8545"

[dependencies]
forge-std = { version = "1.8.2" }
solady = { version = "0.0.206" }
"@openzeppelin-contracts" = { version = "4.9.3" }
"@solady-0.0.206" = { version = "0.0.206" }
"@openzeppelin-4.9.3" = { version = "4.9.3" }
"@forge-std-1.9.1" = { version = "1.9.1", url = "https://github.com/foundry-rs/forge-std/archive/refs/tags/v1.9.1.zip" }
4 changes: 2 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@fdk/=script/
@forge-std-1.8.2=dependencies/forge-std-1.8.2/src/
@solady-0.0.206=dependencies/solady-0.0.206
@openzeppelin-contracts-4.9.3=dependencies/@openzeppelin-contracts-4.9.3
@contract-libs-0.1.1=dependencies/contract-libs-0.1.1
@contract-libs-0.1.1=dependencies/contract-libs-0.1.1
@forge-std-1.9.1=dependencies/@forge-std-1.9.1/src/
6 changes: 3 additions & 3 deletions script/BaseGeneralConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { Vm, VmSafe } from "../dependencies/forge-std-1.8.2/src/Vm.sol";
import { StdStyle } from "../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { console } from "../dependencies/forge-std-1.8.2/src/console.sol";
import { Vm, VmSafe } from "../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { StdStyle } from "../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { console } from "../dependencies/@forge-std-1.9.1/src/console.sol";
import { WalletConfig } from "./configs/WalletConfig.sol";
import { RuntimeConfig } from "./configs/RuntimeConfig.sol";
import { MigrationConfig } from "./configs/MigrationConfig.sol";
Expand Down
17 changes: 15 additions & 2 deletions script/BaseMigration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { TransparentProxyV2 } from "../src/TransparentProxyV2.sol";
import { TransparentProxyOZv4_9_5 } from "../src/TransparentProxyOZv4_9_5.sol";
import { LibString } from "../dependencies/solady-0.0.206/src/utils/LibString.sol";
import { console } from "../dependencies/forge-std-1.8.2/src/console.sol";
import { StdStyle } from "../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { console } from "../dependencies/@forge-std-1.9.1/src/console.sol";
import { StdStyle } from "../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { ScriptExtended, IScriptExtended } from "./extensions/ScriptExtended.s.sol";
import { OnchainExecutor } from "./OnchainExecutor.s.sol"; // cheat to load artifact to parent `out` directory
import { IMigrationScript } from "./interfaces/IMigrationScript.sol";
Expand Down Expand Up @@ -284,4 +286,15 @@ abstract contract BaseMigration is ScriptExtended {
vm.makePersistent(deployScript);
vm.allowCheatcodes(deployScript);
}

/**
* @dev Cheat to force build artifact for customized TransparentProxy contract
*
* Can be disabled in child contract by overriding this function
*/
function _precompileProxyContracts() internal pure virtual {
bytes memory dummy;
dummy = type(TransparentProxyV2).creationCode;
dummy = type(TransparentProxyOZv4_9_5).creationCode;
}
}
4 changes: 2 additions & 2 deletions script/OnchainExecutor.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { StdStyle } from "../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { console } from "../dependencies/forge-std-1.8.2/src/console.sol";
import { StdStyle } from "../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { console } from "../dependencies/@forge-std-1.9.1/src/console.sol";
import { ScriptExtended } from "./extensions/ScriptExtended.s.sol";
import { BaseGeneralConfig } from "./BaseGeneralConfig.sol";
import { sendRawTransaction } from "./utils/Helpers.sol";
Expand Down
6 changes: 3 additions & 3 deletions script/configs/ContractConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { EnumerableSet } from "../../dependencies/@openzeppelin-contracts-4.9.3/utils/structs/EnumerableSet.sol";
import { Vm, VmSafe } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { console } from "../../dependencies/forge-std-1.8.2/src/console.sol";
import { StdStyle } from "../../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { Vm, VmSafe } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { console } from "../../dependencies/@forge-std-1.9.1/src/console.sol";
import { StdStyle } from "../../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { LibString } from "../../dependencies/solady-0.0.206/src/utils/LibString.sol";
import { IContractConfig } from "../interfaces/configs/IContractConfig.sol";
import { LibSharedAddress } from "../libraries/LibSharedAddress.sol";
Expand Down
12 changes: 7 additions & 5 deletions script/configs/NetworkConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { Vm } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { StdStyle } from "../../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { console } from "../../dependencies/forge-std-1.8.2/src/console.sol";
import { Vm } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { StdStyle } from "../../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { console } from "../../dependencies/@forge-std-1.9.1/src/console.sol";
import { INetworkConfig } from "../interfaces/configs/INetworkConfig.sol";
import { IGeneralConfig } from "../interfaces/IGeneralConfig.sol";
import { LibSharedAddress } from "../libraries/LibSharedAddress.sol";
Expand Down Expand Up @@ -212,10 +212,12 @@ abstract contract NetworkConfig is INetworkConfig {
vm.toString(vm.getBlockNumber()),
" - Timestamp ".blue(),
vm.toString(vm.getBlockTimestamp()),
" - Chain ID ".blue(),
vm.toString(block.chainid)
" - Period ".blue(),
vm.toString(vm.getBlockTimestamp() / 1 days)
);
string memory logB = string.concat(
" - Chain ID ".blue(),
vm.toString(block.chainid),
" - Gas Price ".blue(),
vm.toString(tx.gasprice / 1 gwei),
" GWEI",
Expand Down
6 changes: 3 additions & 3 deletions script/configs/RuntimeConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { Vm } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { StdStyle } from "../../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { console } from "../../dependencies/forge-std-1.8.2/src/console.sol";
import { Vm } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { StdStyle } from "../../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { console } from "../../dependencies/@forge-std-1.9.1/src/console.sol";
import { LibString } from "../../dependencies/solady-0.0.206/src/utils/LibString.sol";
import { LibSharedAddress } from "../libraries/LibSharedAddress.sol";
import { IRuntimeConfig } from "../interfaces/configs/IRuntimeConfig.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/configs/WalletConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { CommonBase } from "../../dependencies/forge-std-1.8.2/src/Base.sol";
import { CommonBase } from "../../dependencies/@forge-std-1.9.1/src/Base.sol";
import { LibString } from "../../dependencies/solady-0.0.206/src/utils/LibString.sol";
import { IWalletConfig } from "../interfaces/configs/IWalletConfig.sol";

Expand Down
8 changes: 4 additions & 4 deletions script/extensions/ScriptExtended.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { VmSafe } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { StdStyle } from "../../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { console, Script } from "../../dependencies/forge-std-1.8.2/src/Script.sol";
import { StdAssertions } from "../../dependencies/forge-std-1.8.2/src/StdAssertions.sol";
import { VmSafe } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { StdStyle } from "../../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { console, Script } from "../../dependencies/@forge-std-1.9.1/src/Script.sol";
import { StdAssertions } from "../../dependencies/@forge-std-1.9.1/src/StdAssertions.sol";
import { IVme } from "../interfaces/IVme.sol";
import { IRuntimeConfig } from "../interfaces/configs/IRuntimeConfig.sol";
import { IScriptExtended } from "../interfaces/IScriptExtended.sol";
Expand Down
8 changes: 8 additions & 0 deletions script/interfaces/IEIP173.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

interface IEIP173 {
function owner() external view returns (address);
function transferOwnership(address newOwner) external;
}
10 changes: 4 additions & 6 deletions script/libraries/LibArtifact.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { Vm } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { stdJson } from "../../dependencies/forge-std-1.8.2/src/StdJson.sol";
import { console } from "../../dependencies/forge-std-1.8.2/src/console.sol";
import { StdStyle } from "../../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { Vm } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { stdJson } from "../../dependencies/@forge-std-1.9.1/src/StdJson.sol";
import { console } from "../../dependencies/@forge-std-1.9.1/src/console.sol";
import { StdStyle } from "../../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { IGeneralConfig } from "../interfaces/IGeneralConfig.sol";
import { LibSharedAddress } from "./LibSharedAddress.sol";
import { LibString } from "../../dependencies/solady-0.0.206/src/utils/LibString.sol";
Expand Down Expand Up @@ -44,8 +44,6 @@ library LibArtifact {
}

console.log(string.concat("By: ", vm.getLabel(info.deployer), ", nonce: ", vm.toString(info.nonce), "\n"));
if (!vm.exists("logs")) vm.createDir("logs", true);
vm.writeLine("logs/deployed-contracts", info.artifactName);

string memory dirPath = vme.getDeploymentDirectory(vme.getCurrentNetwork());

Expand Down
30 changes: 10 additions & 20 deletions script/libraries/LibDeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { TransparentProxyV2 } from "../../src/TransparentProxyV2.sol";
import { TransparentProxyOZv4_9_5 } from "../../src/TransparentProxyOZv4_9_5.sol";
import { ITransparentUpgradeableProxy } from
"../../dependencies/@openzeppelin-contracts-4.9.3/proxy/transparent/TransparentUpgradeableProxy.sol";
import { ProxyAdmin } from "../../dependencies/@openzeppelin-contracts-4.9.3/proxy/transparent/ProxyAdmin.sol";
import { StdStyle } from "../../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { console } from "../../dependencies/forge-std-1.8.2/src/console.sol";
import { StdStyle } from "../../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { console } from "../../dependencies/@forge-std-1.9.1/src/console.sol";
import { vm, vme } from "../utils/Constants.sol";
import { IEIP173 } from "../interfaces/IEIP173.sol";
import { sendRawTransaction, cheatBroadcast, decodeData } from "../utils/Helpers.sol";
import { LibProxy } from "./LibProxy.sol";
import { LibSharedAddress } from "./LibSharedAddress.sol";
Expand Down Expand Up @@ -140,12 +136,12 @@ library LibDeploy {

if (isViaAuxiliary) {
callData = callData.length == 0
? abi.encodeCall(ProxyAdmin.upgrade, (ITransparentUpgradeableProxy(proxy), logic))
: abi.encodeCall(ProxyAdmin.upgradeAndCall, (ITransparentUpgradeableProxy(proxy), logic, callData));
? abi.encodeWithSignature("upgrade(address,address)", proxy, logic)
: abi.encodeWithSignature("upgradeAndCall(address,address,bytes)", proxy, logic, callData);
} else {
callData = callData.length == 0
? abi.encodeCall(ITransparentUpgradeableProxy.upgradeTo, (logic))
: abi.encodeCall(ITransparentUpgradeableProxy.upgradeToAndCall, (logic, callData));
? abi.encodeWithSignature("upgradeTo(address)", logic)
: abi.encodeWithSignature("upgradeToAndCall(address,bytes)", logic, callData);
}

bool shouldCheatCall = auth.code.length != 0;
Expand All @@ -172,7 +168,7 @@ library LibDeploy {
while (true) {
if (auth.code.length == 0) return (auth, interactTo);

try ProxyAdmin(auth).owner() returns (address owner) {
try IEIP173(auth).owner() returns (address owner) {
if (owner == address(0x0)) return (auth, interactTo);

interactTo = auth;
Expand Down Expand Up @@ -202,7 +198,7 @@ library LibDeploy {
DeployInfo memory proxyInfo;
proxyInfo.callValue = callValue;
proxyInfo.by = implInfo.by;
proxyInfo.contractName = type(TransparentProxyOZv4_9_5).name;
proxyInfo.contractName = "TransparentProxyOZv4_9_5";
proxyInfo.absolutePath = string.concat(proxyInfo.contractName, ".sol:", proxyInfo.contractName);
proxyInfo.artifactName = string.concat(vm.replace(implInfo.artifactName, "Logic", ""), "Proxy");
proxyInfo.constructorArgs = abi.encode(impl, proxyAdmin, callData);
Expand Down Expand Up @@ -234,7 +230,7 @@ library LibDeploy {
DeployInfo memory proxyInfo;
proxyInfo.callValue = callValue;
proxyInfo.by = implInfo.by;
proxyInfo.contractName = type(TransparentProxyV2).name;
proxyInfo.contractName = "TransparentProxyV2";
proxyInfo.absolutePath = string.concat(proxyInfo.contractName, ".sol:", proxyInfo.contractName);
proxyInfo.artifactName = string.concat(vm.replace(implInfo.artifactName, "Logic", ""), "Proxy");
proxyInfo.constructorArgs = abi.encode(impl, proxyAdmin, callData);
Expand Down Expand Up @@ -295,10 +291,4 @@ library LibDeploy {
deployed := create(callValue, add(bytecode, 0x20), mload(bytecode))
}
}

function _precompileProxyContracts() private pure {
bytes memory dummy;
dummy = type(TransparentProxyV2).creationCode;
dummy = type(TransparentProxyOZv4_9_5).creationCode;
}
}
2 changes: 1 addition & 1 deletion script/libraries/LibErrorHandler.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

library LibErrorHandler {
/// @dev Reserves error definition to upload to signature database.
Expand Down
2 changes: 1 addition & 1 deletion script/libraries/LibProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { Vm } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { Vm } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { LibSharedAddress } from "./LibSharedAddress.sol";

library LibProxy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { console } from "@forge-std-1.8.2/console.sol";
import { console } from "@forge-std-1.9.1/console.sol";
import { DefaultNetwork } from "@fdk/utils/DefaultNetwork.sol";
import { Contract } from "../../utils/Contract.sol";
import { ISharedArgument, SampleMigration } from "../../SampleMigration.s.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/types/TNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma experimental ABIEncoderV2;

import { LibString } from "../../dependencies/solady-0.0.206/src/utils/LibString.sol";
import { LibSharedAddress } from "../libraries/LibSharedAddress.sol";
import { Vm } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { Vm } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";

type TNetwork is bytes32;

Expand Down
2 changes: 1 addition & 1 deletion script/utils/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { Vm } from "../../dependencies/forge-std-1.8.2/src/Vm.sol";
import { Vm } from "../../dependencies/@forge-std-1.9.1/src/Vm.sol";
import { IGeneralConfig } from "../interfaces/IGeneralConfig.sol";
import { LibSharedAddress } from "../libraries/LibSharedAddress.sol";

Expand Down
10 changes: 5 additions & 5 deletions script/utils/Helpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
pragma solidity >=0.6.2 <0.9.0;
pragma experimental ABIEncoderV2;

import { StdStorage, stdStorage } from "../../dependencies/forge-std-1.8.2/src/StdStorage.sol";
import { stdJson } from "../../dependencies/forge-std-1.8.2/src/StdJson.sol";
import { console } from "../../dependencies/forge-std-1.8.2/src/console.sol";
import { StdStyle } from "../../dependencies/forge-std-1.8.2/src/StdStyle.sol";
import { StdStorage, stdStorage } from "../../dependencies/@forge-std-1.9.1/src/StdStorage.sol";
import { stdJson } from "../../dependencies/@forge-std-1.9.1/src/StdJson.sol";
import { console } from "../../dependencies/@forge-std-1.9.1/src/console.sol";
import { StdStyle } from "../../dependencies/@forge-std-1.9.1/src/StdStyle.sol";
import { LibSharedAddress } from "../libraries/LibSharedAddress.sol";
import { LibErrorHandler } from "../libraries/LibErrorHandler.sol";
import { LibString } from "../../dependencies/solady-0.0.206/src/utils/LibString.sol";
Expand Down Expand Up @@ -79,7 +79,7 @@ function sendRawTransaction(address from, address to, uint256 gas, uint256 callV
}
}

function logInnerCall(string memory fnName) view {
function logInnerCall(string memory fnName) pure {
console.log("> ", fnName.blue(), "...");
}

Expand Down
6 changes: 6 additions & 0 deletions soldeer.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ name = "solady"
version = "0.0.206"
source = "https://soldeer-revisions.s3.amazonaws.com/solady/0_0_206_06-06-2024_05:38:51_solady.zip"
checksum = "acba3f4e69840ebad8c7fcf01edbf66405015418de6fea119ee46944b9294d6d"

[[dependencies]]
name = "@forge-std"
version = "1.9.1"
source = "https://github.com/foundry-rs/forge-std/archive/refs/tags/v1.9.1.zip"
checksum = "67e3523bb8bf3b085c8f28257c7c57e4b0e36eab99272437f89b408653803bb6"
2 changes: 1 addition & 1 deletion src/TransparentProxyOZv4_9_5.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
pragma solidity ^0.8.0;

import {
ITransparentUpgradeableProxy,
Expand Down

0 comments on commit f9a3695

Please sign in to comment.