Metamask – How to Connect Account to Smart Contract

metamasksolidityweb3js

I am learning Solidity. I have managed to create sample dapps with Truffle.

This sample apps are interacting with a smartcontract with web3js.

Each time my dapp calls a smartcontract's function, the metamask popup ask me a confirmation.
Everything works fine.

I have tried uniswap and there is something very strange for me: Uniswap ask me to "connect" my metamask wallet.

Then, i can see my Ethereum wallet's balance directly in uniswap webapp…

How can they do that ? I have looked uniswap soldity files on github and i do not understand where they connect the smartcontract to my metamask account.

Is it a good thing in term of privacy ? When i accept to connect my metamask wallet to uniswap, do i allow them to do what they want with my ether ?

Thanks

Best Answer

Connecting your MetaMask extension to Uniswap, does no provide access to Uniswap to manage your assets ( ETH or any other ERC20 token ). This is the so called Privacy mode of MetaMask which allow a user wallet address to be public only for connected websites. By doing it you're just letting know your MetaMask extension that you wanna use it on this particular website ( Uniswap ) and MetaMask is sharing your wallet address with the website. Everytime you're about to do blockchain action on Uniswap ( exchanging cryptocurrency for another, add or remove liquidity, etc ) then Uniswap is sending request to your MetaMask extension which is showing you the confirmation popup. Only after approving the confirmation request MetaMask is using your account private key to sign and submit transaction.

Related Topic