Skip to content

Commit

Permalink
Merge pull request #105 from axieinfinity/feature/deploy-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 authored Mar 1, 2024
2 parents 4f4d6f6 + ab15b37 commit 86cbf0c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions script/BaseMigration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,44 @@ abstract contract BaseMigration is ScriptExtended {
virtual
logFn(string.concat("_deployLogic ", TContract.unwrap(contractType).unpackOne()))
returns (address payable logic)
{
logic = _deployLogic(contractType, EMPTY_ARGS);
}

function _deployLogic(TContract contractType, bytes memory args)
internal
virtual
logFn(string.concat("_deployLogic ", TContract.unwrap(contractType).unpackOne()))
returns (address payable logic)
{
string memory contractName = CONFIG.getContractName(contractType);
string memory contractAbsolutePath = CONFIG.getContractAbsolutePath(contractType);

uint256 logicNonce;
(logic, logicNonce) = _deployRaw(contractAbsolutePath, EMPTY_ARGS);
(logic, logicNonce) = _deployRaw(contractAbsolutePath, args);
CONFIG.label(block.chainid, logic, string.concat(contractName, "::Logic"));
ARTIFACT_FACTORY.generateArtifact(
sender(), logic, contractAbsolutePath, string.concat(contractName, "Logic"), EMPTY_ARGS, logicNonce
sender(), logic, contractAbsolutePath, string.concat(contractName, "Logic"), args, logicNonce
);
}

function _deployProxy(TContract contractType) internal virtual returns (address payable deployed) {
deployed = _deployProxy(contractType, arguments());
}

function _deployProxy(TContract contractType, bytes memory args)
function _deployProxy(TContract contractType, bytes memory args) internal virtual returns (address payable deployed) {
deployed = _deployProxy(contractType, args, EMPTY_ARGS);
}

function _deployProxy(TContract contractType, bytes memory args, bytes memory argsLogicConstructor)
internal
virtual
logFn(string.concat("_deployProxy ", TContract.unwrap(contractType).unpackOne()))
returns (address payable deployed)
{
string memory contractName = CONFIG.getContractName(contractType);

address logic = _deployLogic(contractType);
address logic = _deployLogic(contractType, argsLogicConstructor);
string memory proxyAbsolutePath = "TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy";
uint256 proxyNonce = vm.getNonce(sender());
address proxyAdmin = _getProxyAdmin();
Expand Down

0 comments on commit 86cbf0c

Please sign in to comment.