a few specs : running on goerli alpha, starknet js 0.4.9
I am trying to deploy a prefunded 0.5.0 openzeppelin account.
I found the class hash to be : ACC_CLASS_HASH=0x750cd490a7cd1572411169eaa8be292325990d33c5d4733655fe6b926985062
I have then pre-calculated the address, using this function
export function calcAddress(mnemonic?: string): string {
const wallet = ethers.Wallet.createRandom();
let currentMnemonic = mnemonic ? mnemonic : wallet.mnemonic.phrase;
console.log(`calculating address for seed : ${currentMnemonic}`);
const starkKeyPair = getStarkPair(currentMnemonic, 0);
let starkKeyPub = ec.getStarkKey(starkKeyPair);
return hash.calculateContractAddressFromHash(starkKeyPub, ACC_CLASS_HASH, [starkKeyPub], 0);
}
and then I deploy it with
export async function deployAcc(mnemonic: string, address: string) {
console.log(`generating keypair from mnemonic`);
const starkKeyPair = getStarkPair(mnemonic, 0);
console.log(`generation succesful`);
const starkKeyPub = ec.getStarkKey(starkKeyPair);
let futureAcc = new Account(provider, address, starkKeyPair);
const accountResponse = await futureAcc?.deployAccount({
classHash: ACC_CLASS_HASH,
constructorCalldata: [starkKeyPub],
addressSalt: starkKeyPub,
contractAddress: address
});
console.log(`tx hash : ${accountResponse?.transaction_hash}`);
await provider.waitForTransaction(accountResponse?.transaction_hash);
}
when I try to deploy the account I'd keep getting
Entry point 0x36fcbf06cd96843058359e1a75928beacfac10727dab22a3972f0af8aa92895 not found in contract with class hash 0x750cd490a7cd1572411169eaa8be292325990d33c5d4733655fe6b926985062.
further googling for entry point 0x36fcbf06cd96843058359e1a75928beacfac10727dab22a3972f0af8aa92895 led me to assume that the entry point is for validate invocation?
as indicated here https://starknet.io/docs/hello_starknet/cli.html
thanks in advance for the help
I assume you are asking about this code: https://github.com/amanusk/starknet-cli-wallet/blob/develop/scripts/deploy-prefunded.ts
As you correctly stated, the missing entry point which is missing from the contract is
__validate_deploy__
. (You can calculate it:)The entry point was introduced in version
0.10.1
, and its purpose is to check the validity of an account deployment when a new account is first initialized.The current version of the repo above is using OZ contracts version
0.5.0
. This version does not yet implement the entry point__validate_deploy__
, and you are thus getting this error when trying to deploy a pre-funded account.This should be supported in the next version currently in PR: https://github.com/OpenZeppelin/cairo-contracts/pull/503
The contracts in the repo will be updated once the official release is published.
You can get a sneak peek in this branch: https://github.com/amanusk/starknet-cli-wallet/tree/validate-deploy