-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
260 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import "../../src/apps/KintoAppRegistry.sol"; | ||
import "../../src/paymasters/SponsorPaymaster.sol"; | ||
import "../../src/interfaces/IKintoWalletFactory.sol"; | ||
import {Create2Helper} from "../../test/helpers/Create2Helper.sol"; | ||
import {ArtifactsReader} from "../../test/helpers/ArtifactsReader.sol"; | ||
import {UUPSProxy} from "../../test/helpers/UUPSProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; | ||
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import "forge-std/console.sol"; | ||
|
||
contract KintoMigration7DeployScript is Create2Helper, ArtifactsReader { | ||
using ECDSAUpgradeable for bytes32; | ||
|
||
KintoAppRegistry _kintoApp; | ||
|
||
function setUp() public {} | ||
|
||
// solhint-disable code-complexity | ||
function run() public { | ||
console.log("RUNNING ON CHAIN WITH ID", vm.toString(block.chainid)); | ||
// Execute this script with the hot wallet, not with ledger | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address admin = vm.envAddress("LEGER_ADMIN"); | ||
if (admin == address(0)) { | ||
console.log("Admin key not set", admin); | ||
return; | ||
} | ||
vm.startBroadcast(deployerPrivateKey); | ||
console.log("Executing with address", msg.sender); | ||
vm.startBroadcast(); | ||
address appAddr = _getChainDeployment("KintoAppRegistry"); | ||
if (appAddr != address(0)) { | ||
console.log("KintoAppRegistry already deployed", appAddr); | ||
return; | ||
} | ||
address walletFactoryAddr = _getChainDeployment("KintoWalletFactory"); | ||
IKintoWalletFactory _walletFactory = IKintoWalletFactory(walletFactoryAddr); | ||
_kintoApp = KintoAppRegistry( | ||
_walletFactory.deployContract( | ||
msg.sender, 0, abi.encodePacked(type(KintoAppRegistry).creationCode), bytes32(0) | ||
) | ||
); | ||
// Give ownership to admin | ||
_kintoApp.transferOwnership(admin); | ||
address credits = _getChainDeployment("EngenCredits"); | ||
// Create Engen App | ||
_kintoApp.registerApp("Engen", credits, new address[](0), [uint256(0), uint256(0), uint256(0), uint256(0)]); | ||
// Fund in the paymaster | ||
SponsorPaymaster _paymaster = SponsorPaymaster(payable(_getChainDeployment("SponsorPaymaster"))); | ||
_paymaster.addDepositFor{value: 1e17}(credits); | ||
vm.stopBroadcast(); | ||
// Writes the addresses to a file | ||
console.log("Add these new addresses to the artifacts file"); | ||
console.log(string.concat('"KintoAppRegistry": "', vm.toString(address(_kintoApp)), '"')); | ||
} | ||
} |
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,60 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import "../../src/wallet/KintoWalletFactory.sol"; | ||
import {KintoWallet} from "../../src/wallet/KintoWallet.sol"; | ||
import {Create2Helper} from "../../test/helpers/Create2Helper.sol"; | ||
import {ArtifactsReader} from "../../test/helpers/ArtifactsReader.sol"; | ||
import {UUPSProxy} from "../../test/helpers/UUPSProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; | ||
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import "forge-std/console.sol"; | ||
|
||
contract KintoMigration8DeployScript is Create2Helper, ArtifactsReader { | ||
using ECDSAUpgradeable for bytes32; | ||
|
||
KintoWalletFactory _walletFactory; | ||
KintoWalletV3 _kintoWalletImpl; | ||
UUPSProxy _proxy; | ||
|
||
function setUp() public {} | ||
|
||
// solhint-disable code-complexity | ||
function run() public { | ||
console.log("RUNNING ON CHAIN WITH ID", vm.toString(block.chainid)); | ||
// Execute this script with the ledger admin | ||
console.log("Executing with address", msg.sender); | ||
vm.startBroadcast(); | ||
address walletFactoryAddr = _getChainDeployment("KintoWalletFactory"); | ||
if (walletFactoryAddr == address(0)) { | ||
console.log("Need to execute main deploy script first", walletFactoryAddr); | ||
return; | ||
} | ||
address kintoAppAddr = _getChainDeployment("KintoAppRegistry"); | ||
if (kintoAppAddr == address(0)) { | ||
console.log("Need to deploy kinto app registry first", kintoAppAddr); | ||
return; | ||
} | ||
_walletFactory = KintoWalletFactory(payable(walletFactoryAddr)); | ||
|
||
bytes memory bytecode = abi.encodePacked( | ||
abi.encodePacked(type(KintoWalletV3).creationCode), | ||
abi.encode( | ||
_getChainDeployment("EntryPoint"), | ||
IKintoID(_getChainDeployment("KintoID")), | ||
IKintoAppRegistry(_getChainDeployment("KintoAppRegistry")) | ||
) // Encoded constructor arguments | ||
); | ||
|
||
// Deploy new wallet implementation | ||
_kintoWalletImpl = KintoWalletV3(payable(_walletFactory.deployContract(msg.sender, 0, bytecode, bytes32(0)))); | ||
// Upgrade all implementations | ||
_walletFactory.upgradeAllWalletImplementations(_kintoWalletImpl); | ||
vm.stopBroadcast(); | ||
// Writes the addresses to a file | ||
console.log("Add these new addresses to the artifacts file"); | ||
console.log(string.concat('"KintoWalletV3-impl": "', vm.toString(address(_kintoWalletImpl)), '"')); | ||
} | ||
} |
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,54 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import "../../src/wallet/KintoWalletFactory.sol"; | ||
import "../../src/paymasters/SponsorPaymaster.sol"; | ||
import {KintoWallet} from "../../src/wallet/KintoWallet.sol"; | ||
import {Create2Helper} from "../../test/helpers/Create2Helper.sol"; | ||
import {ArtifactsReader} from "../../test/helpers/ArtifactsReader.sol"; | ||
import {UUPSProxy} from "../../test/helpers/UUPSProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; | ||
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import "forge-std/console.sol"; | ||
|
||
contract KintoMigration9DeployScript is Create2Helper, ArtifactsReader { | ||
using ECDSAUpgradeable for bytes32; | ||
|
||
SponsorPaymaster _paymaster; | ||
KintoWalletFactory _walletFactory; | ||
SponsorPaymasterV2 _paymasterImpl; | ||
UUPSProxy _proxy; | ||
|
||
function setUp() public {} | ||
|
||
// solhint-disable code-complexity | ||
function run() public { | ||
console.log("RUNNING ON CHAIN WITH ID", vm.toString(block.chainid)); | ||
// Execute this script with the ledger admin | ||
console.log("Executing with address", msg.sender); | ||
vm.startBroadcast(); | ||
address sponsorAddr = _getChainDeployment("SponsorPaymaster"); | ||
if (sponsorAddr == address(0)) { | ||
console.log("Need to execute main deploy script first", sponsorAddr); | ||
return; | ||
} | ||
_paymaster = SponsorPaymaster(payable(sponsorAddr)); | ||
|
||
_walletFactory = KintoWalletFactory(payable(_getChainDeployment("KintoWalletFactory"))); | ||
bytes memory bytecode = abi.encodePacked( | ||
abi.encodePacked(type(SponsorPaymasterV2).creationCode), | ||
abi.encode(_getChainDeployment("EntryPoint")) // Encoded constructor arguments | ||
); | ||
|
||
// Deploy new paymaster implementation | ||
_paymasterImpl = SponsorPaymasterV2(payable(_walletFactory.deployContract(msg.sender, 0, bytecode, bytes32(0)))); | ||
// Upgrade | ||
_paymaster.upgradeTo(address(_paymasterImpl)); | ||
vm.stopBroadcast(); | ||
// Writes the addresses to a file | ||
console.log("Add these new addresses to the artifacts file"); | ||
console.log(string.concat('"SponsorPaymasterV2-impl": "', vm.toString(address(_paymasterImpl)), '"')); | ||
} | ||
} |
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,56 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import "../../src/wallet/KintoWalletFactory.sol"; | ||
import {KintoWallet} from "../../src/wallet/KintoWallet.sol"; | ||
import {Create2Helper} from "../../test/helpers/Create2Helper.sol"; | ||
import {ArtifactsReader} from "../../test/helpers/ArtifactsReader.sol"; | ||
import {UUPSProxy} from "../../test/helpers/UUPSProxy.sol"; | ||
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; | ||
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; | ||
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import "forge-std/console.sol"; | ||
|
||
contract KintoMigration9DeployScript is Create2Helper, ArtifactsReader { | ||
using ECDSAUpgradeable for bytes32; | ||
|
||
KintoWalletFactory _walletFactory; | ||
KintoWalletFactoryV2 _factoryImpl; | ||
UUPSProxy _proxy; | ||
|
||
function setUp() public {} | ||
|
||
// solhint-disable code-complexity | ||
function run() public { | ||
console.log("RUNNING ON CHAIN WITH ID", vm.toString(block.chainid)); | ||
// Execute this script with the ledger admin | ||
console.log("Executing with address", msg.sender); | ||
vm.startBroadcast(); | ||
address factoryAddr = _getChainDeployment("KintoWalletFactory"); | ||
if (factoryAddr == address(0)) { | ||
console.log("Need to execute main deploy script first", factoryAddr); | ||
return; | ||
} | ||
_walletFactory = KintoWalletFactory(payable(_getChainDeployment("KintoWalletFactory"))); | ||
|
||
address newImpl = _getChainDeployment("KintoWalletV3-impl"); | ||
if (newImpl == address(0)) { | ||
console.log("Need to deploy the new wallet first", newImpl); | ||
return; | ||
} | ||
bytes memory bytecode = abi.encodePacked( | ||
abi.encodePacked(type(KintoWalletFactoryV2).creationCode), | ||
abi.encode(_getChainDeployment("KintoWalletV3-impl")) // Encoded constructor arguments | ||
); | ||
|
||
// Deploy new paymaster implementation | ||
_factoryImpl = KintoWalletFactoryV2(payable(_walletFactory.deployContract(msg.sender, 0, bytecode, bytes32(0)))); | ||
// Upgrade | ||
_walletFactory.upgradeTo(address(_factoryImpl)); | ||
vm.stopBroadcast(); | ||
// Writes the addresses to a file | ||
console.log("Add these new addresses to the artifacts file"); | ||
console.log(string.concat('"KintoWalletFactoryV2-impl": "', vm.toString(address(_factoryImpl)), '"')); | ||
} | ||
} |
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
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