Skip to content

๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง Using a smart contract as a wallet we can secure assets by requiring multiple accounts to "vote" on transactions. The contract will keep track of transactions in an array of structs and owners will confirm or reject each one. Any transaction with enough confirmations can "execute".

Notifications You must be signed in to change notification settings

SpaceUY/se-challenge-7-multisig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 

Repository files navigation

๐Ÿ— scaffold-eth | ๐Ÿฐ BuidlGuidl

๐Ÿšฉ Challenge 7: ๐Ÿ‘› Multisig Wallet by SpaceDev

image

๐Ÿƒโ€โ™€๏ธ Quick Start

required: Node plus Yarn and Git

git clone https://github.com/SpaceUY/se-challenge-7-multisig.git

cd se-challenge-7-multisig
yarn install
yarn start

in a second terminal window:

cd se-challenge-7-multisig
yarn chain

๐Ÿ” Edit your smart contract MetaMultiSigWallet.sol in packages/hardhat-ts/contracts

๐Ÿ“ Edit your frontend App.tsx in packages/vite-app-ts/src/app

๐Ÿ’ผ Edit your deployment script 01_deploy_meta_multi_sig_wallet_contract.ts in packages/hardhat-ts/deploy

๐Ÿ“ฑ Open http://localhost:3000 to see the app

in a third terminal window:

yarn backend

๐Ÿ”ง Configure your deployment in packages/hardhat-ts/deploy/01_deploy_meta_multi_sig_wallet_contract.ts

Edit the chainid, your owner addresses, and the number of signatures required:

image

in a fourth terminal deploy with your frontend address as one of the owners:

yarn deploy

Use the faucet wallet to send your multi-sig contract some funds:

image

To add new owners, use the "Owners" tab:

image

This will take you to a populated transaction create page:

image

Create & sign the new transaction:

image

You will see the new transaction in the pool (this is all off-chain):

image

Click on the ellipsses button [...] to read the details of the transaction

image

Give your account some gas at the faucet and execute the transaction

The transction will appear as "executed" on the front page:

image

Create a transaction to send some funds to your frontend account:

image

This time we will need a second signature:

image

Sign the transacton with enough owners: image

(You'll notice you don't need โ›ฝ๏ธgas to sign transactions.)

Execute the transction to transfer the funds:

image

(You might need to trigger a new block by sending yourself some faucet funds or something. HartHat blocks only get mined when there is a transaction.)

๐Ÿ’ผ Edit your deployment script 01_deploy_meta_multi_sig_wallet_contract.ts in packages/hardhat-ts/deploy

๐Ÿ” Edit your contracts form, MetaMultiSigWallet.sol in packages/hardhat-ts/contracts

๐Ÿ“ Edit your frontend in packages/vite-app-ts/src/app/main

โš”๏ธ Side Quests

๐ŸŸ Create custom signer roles for your Wallet

You may not want every signer to create new transfers, only allow them to sign existing transactions or a mega-admin role who will be able to veto any transaction.

๐Ÿ˜Ž Integrate this MultiSig wallet into other branches like nifty-ink

Make a MultiSig wallet to store your precious doodle-NFTs!?


๐Ÿ“ก Deploy the wallet!

๐Ÿ›ฐ Ready to deploy to a testnet?

๐Ÿ“ก Edit the defaultNetwork to your choice of public EVM networks in packages/hardhat-ts/hardhat.config.ts

๐Ÿ”ถ Infura

๐Ÿš” Traffic to your url might break the Infura rate limit, edit your key: constants.ts in packages/vite-app-ts/src/models/constants

๐Ÿ‘ฉโ€๐Ÿš€ You will want to run yarn account to see if you have a deployer address

๐Ÿ” If you don't have one, run yarn generate to create a mnemonic and save it locally for deploying.

๐Ÿ›ฐ Use an instantwallet.io to fund your deployer address (run yarn account again to view balances)

๐Ÿ“ก Edit the export const targetNetworkInfo: TNetworkInfo = NETWORKS.localhost; to your choice of public EVM networks in packages/vite-app-ts/src/config/providersConfig.ts

๐Ÿš€ Run yarn deploy to deploy to your public network of choice (๐Ÿ˜… wherever you can get โ›ฝ๏ธ gas)

๐Ÿ”ฌ Inspect the block explorer for the network you deployed to... make sure your contract is there.

๐Ÿ‘ฎ Your contract source needs to be verified... (source code publicly available on the block explorer)


โ›ณ๏ธ Checkpoint 8: ๐Ÿ“œ Contract Verification

Update the api-key in packages/hardhat-ts/package.json file. You can get your key here.

Screen Shot 2021-11-30 at 10 21 01 AM

Now you are ready to run the yarn verify --network your_network command to verify your contracts on etherscan ๐Ÿ›ฐ


๐Ÿ›ณ Ship the app!

โš™๏ธ build and upload your frontend and share the url with your friends...

# build it:

yarn build

# upload it:

yarn surge

OR

yarn s3

OR

yarn ipfs

image

๐Ÿ‘ฉโ€โค๏ธโ€๐Ÿ‘จ Share your public url with friends, add signers and send some tasty ETH to a few lucky ones ๐Ÿ˜‰!!

About

๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง Using a smart contract as a wallet we can secure assets by requiring multiple accounts to "vote" on transactions. The contract will keep track of transactions in an array of structs and owners will confirm or reject each one. Any transaction with enough confirmations can "execute".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published