Sparqet Profile picture
Co-Founder & CTO @zohal_starknet 🪐 | cairo - rust - solidity - @SatoruStarknet

Jun 4, 2023, 11 tweets

Today, I'm going to walk you through the functions of the MultiSig Wallet smart contract on #Starknet. Brace yourself for an exciting dive into the world of #Cairo1 and #SmartContracts.

1/11

The constructor function is the first function called when the contract is deployed. It takes an array of owners & a required number of confirmations as input. It adds each owner to the contract, & sets up the number of confirmations needed to approve a transaction.

2/11

The submitTransaction function allows only wallet owners to propose transactions. It accepts an address, a value. A new transaction with these details, marked as not yet executed, will be added to the transactions list.

3/11

The confirmTransaction function lets wallet owners confirm proposed transactions. It checks if the transaction exists, isn't executed yet, and hasn't been confirmed by the caller. It increments the transaction's confirmation count.

4/11

The executeTransaction function allows owners to execute confirmed transactions. It checks if the transaction exists, hasn't been executed, and has required confirmations. On execution, it sets the transaction status to executed.

5/11

The revokeConfirmation function lets owners withdraw their confirmation of a transaction. It verifies if the transaction exists, hasn't been executed, and was confirmed by the caller. It reduces the confirmation count and revokes the caller's confirmation

6/11

The getOwners function provides a way to access the list of wallet owners. It's a view function, meaning it doesn't alter any data on the blockchain, it just reads and returns the owners array.

7/11

The getTransactionCount function returns the total number of transactions that have been submitted to the wallet. As a view function, it simply reads the length of the transactions array and returns it, providing a count of transactions.

8/11

The getTransaction function retrieves the details of a specific transaction by its index. It returns the recipient's address, the value, whether it has been executed, and the number of confirmations it has received. Essential for tracking transaction status!

9/11

And, of course, the events that will be emitted in the various functions described above.

10/11

That's it for today's rundown of the MultiSigWallet contract! Over the next few days, we'll take a deeper dive into each function, examining how they interact & contribute to the contract's overall functionality.

11/11

#Starknet #Cairo1 #CairoLang

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling