Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move PrecomputeAddress function to 'contract' package #574

Merged
merged 6 commits into from
Jun 27, 2024

Conversation

thiagodeev
Copy link
Collaborator

@thiagodeev thiagodeev commented Jun 12, 2024

The PrecomputeAddress function precomputes the address of a contract instance thus it's not directly related to the 'account' package, but to the 'contract' package. The only use of this function in the 'account' package is to calculate the account contract address for deploying an account, and to satisfy that I created the PrecomputeAccountAddress function in the 'account' package that calls the PrecomputeAddress function passing the proper parameters.

This will prevent developers from generating wrong account addresses when deploying an account as this process requires the 'deployer_address' to be '0', but the previous function was not intuitive when asking for the 'deployerAddress' parameter without describing that it should be '0' in such case. The new account.PrecomputeAccountAddress function passes '0' as 'deployer_address' automatically to the contract.PrecomputeAccount without prompting the user.

https://docs.starknet.io/architecture-and-concepts/smart-contracts/contract-address/

The PrecomputeAddress function precompute the address of a contract
instance thus it's not directly related to the 'account' package,
but to the 'contract' package. The only use of this function to the
'account' package is to calculate the account contract address for
deploying an account, and to satisfy that I created the
PrecomputeAccountAddress function in the 'account' package that
calls the PrecomputeAddress function passing the proper parameters.
@thiagodeev thiagodeev force-pushed the thiagodeev/split-precomputeaddress-function branch from 2adf264 to c3e1569 Compare June 12, 2024 18:09
@thiagodeev thiagodeev marked this pull request as draft June 14, 2024 04:24
@thiagodeev thiagodeev force-pushed the thiagodeev/split-precomputeaddress-function branch from 72c6dad to deb512c Compare June 14, 2024 13:18
@thiagodeev thiagodeev marked this pull request as ready for review June 14, 2024 13:19
@thiagodeev thiagodeev force-pushed the thiagodeev/split-precomputeaddress-function branch 2 times, most recently from 50c604d to 5eec779 Compare June 14, 2024 13:22
@thiagodeev thiagodeev force-pushed the thiagodeev/split-precomputeaddress-function branch from 5eec779 to f9a1769 Compare June 14, 2024 13:23
@thiagodeev thiagodeev force-pushed the thiagodeev/split-precomputeaddress-function branch from 0777f49 to c0f732c Compare June 25, 2024 19:13
@rianhughes rianhughes merged commit 8e8eee2 into main Jun 27, 2024
4 checks passed
@rianhughes rianhughes deleted the thiagodeev/split-precomputeaddress-function branch June 27, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants