Originally posted by **4NNNN** July 28, 2024
### Environment
Testnet
### zkSolc Version
latest
### zksync-ethers Version
^6.0.0
### Hardhat.config.ts
```javascript
const config: HardhatUserConfig = {
zksolc: {
version: 'latest',
settings: {
isSystem: true,
optimizer: {
fallbackToOptimizingForSize: false,
},
},
},
typechain: {
outDir: "typechain",
target: "ethers-v5",
},
defaultNetwork: 'zkSyncTestnet',
networks: {
hardhat: {
zksync: true,
},
zkSyncTestnet,
},
solidity: {
compilers: [{ version: '0.8.17' }]
}
```
### Deployment Script (WITHOUT PRIVATE KEY)
```javascript
const implementationArtifact = await deployer.loadArtifact("CharterWalletImplementation");
const implementation = await deployer.deploy(implementationArtifact, [], undefined, [])
const implementationaddr = await implementation.getAddress();
console.log(`DRIPImplementation: "${implementationaddr}",`);
//////////////////////////
// Deploy AccountFactory
const factoryArtifact = await deployer.loadArtifact("AccountFactory");
const proxyArtifact = await deployer.loadArtifact("CharterWalletImplementation");
*****************************************************
Why is it aritifact of CharterWallet Implementation and not the proxy artifact is because the implementation implements UUPSupgradble contract!
*****************************************************
const proxybytecodeHash = utils.hashBytecode(proxyArtifact.deployedBytecode);
const factory = await deployer.deploy(factoryArtifact, [implementationaddr, proxybytecodeHash, eoawallet.address], undefined, [
proxyArtifact.bytecode,
]);
const factoryaddr = await factory.getAddress();
console.log(`DRIPFactory: "${factoryaddr}",`);
```
### Package.json
```json
"zksync-ethers": "^6.0.0",
"@matterlabs/hardhat-zksync-upgradable": "^1.5.1",
"@matterlabs/hardhat-zksync-chai-matchers": "^1.3.0",
"@matterlabs/hardhat-zksync-deploy": "1.1.2",
"@matterlabs/hardhat-zksync-solc": "1.0.6",
"@matterlabs/hardhat-zksync-toolbox": "1.2.1",
"@matterlabs/hardhat-zksync-verify": "1.2.2",
"@matterlabs/zksync-contracts": "^0.6.1",
```
### Contract Code
```solidity
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
CharterWalletImplementation is UUPSUpgradeable,Initializable{}
```
### Does this work on other EVMs? (If yes, please list at least 1 of them)
NA
### Description of What Your Contract Does
1. I tried deploying a proxy to the wallet implemenation by not implementing a proxy import.
2. So it was just a normal wallet contract but the proxy gets deployed by using `hre.zkUpgrades.deployProxy`.
3. But while trying to populate a transaction and test it out for token transfers, errored up saying `Sender is not an account`.
4. Which means you're calling a contract which was not deployed using create2Account or createAccount, so in this case I might have to deploy the proxy for the implementation using a proxy factory.
5. I need reference on how to deploy a proxybytecodehash from the factory with the implementation address as a constructor parameter!
### Repo Link (Optional)
_No response_
### Additional Details
_No response_
Add to Community Code and update docs about using create2Account with proxies
Discussed in https://github.com/zkSync-Community-Hub/zksync-developers/discussions/639