Skip to content

Commit

Permalink
More tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
rrecuero committed Jan 6, 2024
1 parent a735230 commit 7983d4d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
6 changes: 1 addition & 5 deletions src/wallet/KintoWalletFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,6 @@ contract KintoWalletFactory is Initializable, UUPSUpgradeable, OwnableUpgradeabl
} catch {}
return created;
}
}

contract KinwoWalletFactoryV2 is KintoWalletFactory {
constructor(KintoWallet _implAddressP) KintoWalletFactory(_implAddressP) {}

function setAddressesOnImplementation(
IKintoWallet newImplementationWallet,
Expand All @@ -277,4 +273,4 @@ contract KinwoWalletFactoryV2 is KintoWalletFactory {
) external onlyOwner {
newImplementationWallet.setAppRegistryAndWalletFactory(_appRegistry, _walletFactory);
}
}
}
12 changes: 0 additions & 12 deletions test/KintoApp.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ contract KintoAppTest is Create2Helper, UserOp, AATestScaffolding {

uint256 _chainID = 1;

UUPSProxy _proxyViewer;
KintoApp _implkintoApp;
KintoAppV2 _implkintoAppV2;
KintoApp _kintoApp;
KintoAppV2 _kintoApp2;

function setUp() public {
Expand All @@ -51,15 +48,6 @@ contract KintoAppTest is Create2Helper, UserOp, AATestScaffolding {
_owner.transfer(1e18);
vm.stopPrank();
deployAAScaffolding(_owner, 1, _kycProvider, _recoverer);
vm.startPrank(_owner);
_implkintoApp = new KintoApp{salt: 0}();
// deploy _proxy contract and point it to _implementation
_proxyViewer = new UUPSProxy{salt: 0}(address(_implkintoApp), "");
// wrap in ABI to support easier calls
_kintoApp = KintoApp(address(_proxyViewer));
// Initialize kyc viewer _proxy
_kintoApp.initialize();
vm.stopPrank();
}

function testUp() public {
Expand Down
29 changes: 29 additions & 0 deletions test/helpers/AATestScaffolding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {UUPSProxy} from "../helpers/UUPSProxy.sol";
import {KYCSignature} from "../helpers/KYCSignature.sol";

import "../../src/wallet/KintoWallet.sol";
import "../../src/apps/KintoApp.sol";
import "../../src/tokens/EngenCredits.sol";
import "../../src/wallet/KintoWalletFactory.sol";
import "../../src/paymasters/SponsorPaymaster.sol";
Expand All @@ -30,6 +31,7 @@ abstract contract AATestScaffolding is KYCSignature {
IKintoEntryPoint _entryPoint;
KintoWalletFactory _walletFactoryI;
KintoWalletFactory _walletFactory;
KintoApp _kintoApp;
KintoID _implementation;
KintoID _kintoIDv1;
SponsorPaymaster _paymaster;
Expand All @@ -40,6 +42,7 @@ abstract contract AATestScaffolding is KYCSignature {
UUPSProxy _proxyf;
UUPSProxy _proxys;
UUPSProxy _proxycredit;
UUPSProxy _proxyapp;
EngenCredits _engenCredits;

function deployAAScaffolding(address _owner, uint256 _ownerPk, address _kycProvider, address _recoverer) public {
Expand Down Expand Up @@ -67,6 +70,9 @@ abstract contract AATestScaffolding is KYCSignature {
// Deploy Engen Credits
deployEngenCredits(_owner);

// Deploy Kinto App
deployKintoApp(_owner);

// Give some eth
vm.deal(_owner, 1e20);
}
Expand Down Expand Up @@ -149,6 +155,29 @@ abstract contract AATestScaffolding is KYCSignature {
vm.stopPrank();
}

function deployKintoApp(address _owner) public {
vm.startPrank(_owner);

// deploy the Kinto App registry
_kintoApp = new KintoApp{salt: 0}();

// deploy _proxy contract and point it to _implementation
_proxyapp = new UUPSProxy{salt: 0}(address(_kintoApp), "");

// wrap in ABI to support easier calls
_kintoApp = KintoApp(address(_proxyapp));

// initialize proxy
_kintoApp.initialize();

// Upgrade to a new impl with the registry and wallet factory
_kintoWalletImpl = new KintoWallet{salt: 0}(_entryPoint, _kintoIDv1);
_walletFactory.setAddressesOnImplementation(_kintoWalletImpl, address(_kintoApp), address(_walletFactory));
_walletFactory.upgradeAllWalletImplementations(_kintoWalletImpl);

vm.stopPrank();
}

function approveKYC(address _kycProvider, address _account, uint256 _accountPk) public {
vm.startPrank(_kycProvider);

Expand Down

0 comments on commit 7983d4d

Please sign in to comment.