Relative Content

Tag Archive for solidity

Dictionaries in Solidity

I’m new to Solidity and trying to understand how to work with dictionaries or mappings. In other programming languages, I often use dictionaries to store key-value pairs, but I’m not sure how to do this in Solidity.

How to ensure the winner of lottery smart contract doesn’t pay the gas fee?

I have a lottery smart contract, essentially a coinflip between two participants. Players can deposit into the contract and once we have two players, anyone can call the bet() function. This means that the gas fee relies on the person who called the method. How do I get the gas fee of that instance of running the function and refund the person who won if they were the one to pay the gas fee (and place this cost on the loser). This is the codes basic structure currently, is it possible for me to see how much gas the transaction cost/will cost?