diff --git a/contracts/starknet/SpaceAccount.cairo b/contracts/starknet/SpaceAccount.cairo index 0ae5356b..c12dced4 100644 --- a/contracts/starknet/SpaceAccount.cairo +++ b/contracts/starknet/SpaceAccount.cairo @@ -72,6 +72,10 @@ func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr // ----- OZ Account Functionality ----- +// +// Getters +// + @view func getPublicKey{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> ( publicKey: felt @@ -87,6 +91,10 @@ func supportsInterface{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_che return Account.supports_interface(interfaceId); } +// +// Setters +// + @external func setPublicKey{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}( newPublicKey: felt @@ -95,6 +103,10 @@ func setPublicKey{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_pt return (); } +// +// Business logic +// + @view func isValidSignature{ syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, ecdsa_ptr: SignatureBuiltin*, range_check_ptr @@ -121,6 +133,15 @@ func __validate_declare__{ return (); } +@external +func __validate_deploy__{ + syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, ecdsa_ptr: SignatureBuiltin*, range_check_ptr +}(class_hash: felt, salt: felt, publicKey: felt) { + let (tx_info) = get_tx_info(); + Account.is_valid_signature(tx_info.transaction_hash, tx_info.signature_len, tx_info.signature); + return (); +} + @external func __execute__{ syscall_ptr: felt*, diff --git a/package.json b/package.json index 5a3c7757..2f7aa27b 100644 --- a/package.json +++ b/package.json @@ -31,11 +31,9 @@ "@gnosis.pm/safe-contracts": "^1.3.0", "@gnosis.pm/zodiac": "^1.1.5", "@openzeppelin/contracts": "^4.7.3", - "@shardlabs/starknet-hardhat-plugin": "0.6.7", + "@shardlabs/starknet-hardhat-plugin": "0.6.8", "@snapshot-labs/sx": "0.1.0-beta.12", "concurrently": "^7.4.0", - "keccak256": "^1.0.6", - "merkletreejs": "^0.3.1", "starknet": "^4.4.2", "wait-on": "^6.0.1" }, diff --git a/requirements.txt b/requirements.txt index 0a344700..402e8272 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -https://github.com/starkware-libs/cairo-lang/releases/download/v0.10.0/cairo-lang-0.10.0.zip -openzeppelin-cairo-contracts==0.4.0b0 -starknet-devnet==0.3.3 +https://github.com/starkware-libs/cairo-lang/releases/download/v0.10.2/cairo-lang-0.10.2.zip +openzeppelin-cairo-contracts==0.5.1 +starknet-devnet==0.4.1 diff --git a/yarn.lock b/yarn.lock index 35a0d3a8..b2ce3740 100644 --- a/yarn.lock +++ b/yarn.lock @@ -995,17 +995,16 @@ "@sentry/types" "5.30.0" tslib "^1.9.3" -"@shardlabs/starknet-hardhat-plugin@0.6.7": - version "0.6.7" - resolved "https://registry.yarnpkg.com/@shardlabs/starknet-hardhat-plugin/-/starknet-hardhat-plugin-0.6.7.tgz#5e03843d30305718eabdc96a834344107066f718" - integrity sha512-GqCKJ69ns5fXHlQj6XV4HD4HE0srBWjnA/dVMO23fs92jnwdMz176dQ6aJxO9ZzpO2lFGnLbjHCGtnMcH8krhQ== +"@shardlabs/starknet-hardhat-plugin@0.6.8": + version "0.6.8" + resolved "https://registry.yarnpkg.com/@shardlabs/starknet-hardhat-plugin/-/starknet-hardhat-plugin-0.6.8.tgz#a2749119f7210785f771863b25066b3364a1b8cb" + integrity sha512-WXr0fie6Qh8why3ItMUkqXgsuENynX70LnxvPj6tuFEEkn+YakUA03g37fhKQiX6KxgG7vDg0xRQXqihNb9tcw== dependencies: "@nomiclabs/hardhat-docker" "^2.0.2" axios "^0.24.0" exit-hook "2.2.1" form-data "^4.0.0" glob "^7.2.0" - is-wsl "^2.2.0" starknet "^3.15.0" "@sideway/address@^4.1.3": @@ -2682,11 +2681,6 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer-reverse@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/buffer-reverse/-/buffer-reverse-1.0.1.tgz#49283c8efa6f901bc01fa3304d06027971ae2f60" - integrity sha512-M87YIUBsZ6N924W57vDwT/aOu8hw7ZgdByz6ijksLjmHJELBASmYTTlNHRgjE+pTsT9oJXGaDSgqqwfdHotDUg== - buffer-to-arraybuffer@^0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz#6064a40fa76eb43c723aba9ef8f6e1216d10511a" @@ -3389,11 +3383,6 @@ crypto-browserify@3.12.0: randombytes "^2.0.0" randomfill "^1.0.3" -crypto-js@^3.1.9-1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.3.0.tgz#846dd1cce2f68aacfa156c8578f926a609b7976b" - integrity sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q== - d@1, d@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" @@ -6262,7 +6251,7 @@ is-windows@^1.0.2: resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== -is-wsl@^2.1.1, is-wsl@^2.2.0: +is-wsl@^2.1.1: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== @@ -6527,15 +6516,6 @@ jsprim@^1.2.2: json-schema "0.4.0" verror "1.10.0" -keccak256@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/keccak256/-/keccak256-1.0.6.tgz#dd32fb771558fed51ce4e45a035ae7515573da58" - integrity sha512-8GLiM01PkdJVGUhR1e6M/AvWnSqYS0HaERI+K/QtStGDGlSTx2B1zTqZk4Zlqu5TxHJNTxWAdP9Y+WI50OApUw== - dependencies: - bn.js "^5.2.0" - buffer "^6.0.3" - keccak "^3.0.2" - keccak@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.1.tgz#ae30a0e94dbe43414f741375cff6d64c8bea0bff" @@ -7128,17 +7108,6 @@ merkle-patricia-tree@^4.2.4: readable-stream "^3.6.0" semaphore-async-await "^1.5.1" -merkletreejs@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/merkletreejs/-/merkletreejs-0.3.1.tgz#e320aa5cb259a1808b6ca6c721311ce3c0ee826c" - integrity sha512-x2cyxA6Ps07aXRIx8grKDvDcgTLnv3xgJddeAqPVdynAVmASZ1hqgAfY0r+Jt+1f7KP8dODGBdhtkspKyonQIQ== - dependencies: - bignumber.js "^9.0.1" - buffer-reverse "^1.0.1" - crypto-js "^3.1.9-1" - treeify "^1.1.0" - web3-utils "^1.3.4" - methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -9866,11 +9835,6 @@ tree-kill@^1.2.2: resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== -treeify@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/treeify/-/treeify-1.1.0.tgz#4e31c6a463accd0943879f30667c4fdaff411bb8" - integrity sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A== - trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" @@ -10612,19 +10576,6 @@ web3-utils@^1.0.0-beta.31, web3-utils@^1.3.6: randombytes "^2.1.0" utf8 "3.0.0" -web3-utils@^1.3.4: - version "1.8.1" - resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.8.1.tgz#f2f7ca7eb65e6feb9f3d61056d0de6bbd57125ff" - integrity sha512-LgnM9p6V7rHHUGfpMZod+NST8cRfGzJ1BTXAyNo7A9cJX9LczBfSRxJp+U/GInYe9mby40t3v22AJdlELibnsQ== - dependencies: - bn.js "^5.2.1" - ethereum-bloom-filters "^1.0.6" - ethereumjs-util "^7.1.0" - ethjs-unit "0.1.6" - number-to-bn "1.7.0" - randombytes "^2.1.0" - utf8 "3.0.0" - web3@1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.11.tgz#50f458b2e8b11aa37302071c170ed61cff332975"