CRYPTO NEWS

What is msg.value?

Can somebody explain what is the magic msg.value? I came across this code: https://learnxinyminutes.com/docs/solidity/

/// @return The balance of the user after the deposit is made function deposit() public payable returns (uint) {     // Use 'require' to test user inputs, 'assert' for internal invariants     // Here we are making sure that there isn't an overflow issue     require((balances[msg.sender] + msg.value) >= balances[msg.sender]);      balances[msg.sender] += msg.value;     // no "this." or "self." required with state variable     // all values set to data type's initial value by default      LogDepositMade(msg.sender, msg.value); // fire event      return balances[msg.sender]; } 

I do not see where the msg.value coming from, when a user deposit eth, does he or she needs to pass in the amount from the deposit function? Thanks and sorry for newbie question.

Edit:

From the following contract, I do not see anywhere passing in msg.value, so how this msg.value has been assigned? by the way you link of cryptozombie is very interesting, thanks.

pragma solidity ^0.4.0;  contract ClientReceipt {      event Deposit(         address indexed _from,         bytes32 indexed _id,         uint _value     );      function deposit(bytes32 _id) public payable {         // Events are emitted using `emit`, followed by         // the name of the event and the arguments         // (if any) in parentheses. Any such invocation         // (even deeply nested) can be detected from         // the JavaScript API by filtering for `Deposit`.         emit Deposit(msg.sender, _id, msg.value);     } } 

http://solidity.readthedocs.io/en/develop/contracts.html#function-modifiers

Bitcoin Whales And Investors Heavily ‘Buying The Dip’ At $19k Even As Miners Adopt Risk-Off Approach

Despite Bitcoin reeling from a massive deleveraging event and pulling back sharply to levels last seen in 2020, investors have found a small window of opportunity to add to their bags. Since tapping an all-time high of $69,000 in November 2021, bitcoin has been on a freefall, giving back over 70% of its entire gains::Listen

The Bitcoin Dip Is Here, But Who's Buying It?

Despite Bitcoin reeling from a massive deleveraging event and pulling back sharply to levels last seen in 2020, investors have found a small window of opportunity to add to their bags.

Since tapping an all-time high of $69,000 in November 2021, bitcoin has been on a freefall, giving back over 70% of its entire gains and placing most post-2020 FOMO buyers’ purchases into unrealized losses. However, thanks to the asset’s growing popularity and adoption, investors have been accumulating one Satoshi at a time at every discounted price to avoid missing the next leg up.

According to crypto on-chain data firm Glassnode, spot buying whales (wallets with over 1k BTC) have been stacking BTC at a remarkable pace. This group is considered to be the most hardened and can weather any market phase while purchasing more coins. Cumulatively, these entities have been buying up about 140k BTC per month from crypto exchanges and now own 8.69M BTC which is about 45.6% of the circulating supply.

C:UsersMt41Downloadswhales.jpg

However, although Sharks (1k to 10k BTC) have been increasing their wallet balances, it’s being done alarmingly slowly. According to Checkmate, lead on-chain analyst at Glassnode, “these are High net worth and likely institutional sized players.” Given the glitches that have rocked TradeFi and crypto lately, sharks have been likely affected by deleveraging and margin calls and prefer to lie low and not be too exposed. Crabs (0.1 to 10 BTC) seem to have also perceived $20k as the magnet of value, aggressively accumulating there at the greatest rate since 2017.

Elsewhere, shrimps (wallets with one or less than 1 BTC) have also been capitalizing on Bitcoin’s firesale, buying up the assets in bits as they seek to achieve the dream of owning at least one bitcoin. According to the firm, this lot has been adding to its balance at the most aggressive rate since March 2020. In the past two quarters, shrimps have added about 36.75k BTC per month which is about 0.2% of the aggregate circulating supply and now hold 1.12M BTC in total.

C:UsersMt41Downloadsshrimp.jpg

As ZyCrypto reported, BTC’s sell-off has partially been fired up by Miners dumping their bags as profitability slumps and energy prices shoot up. According to Glassnode, miners hold 65.2k BTC in aggregate and have been distributing about 3k-4k BTC per month. Furthermore, there is a general fear amongst miners that the Bitcoin price could drop more, further devaluing their hard-earned rewards.

What is msg.value?

Shopping cart
There are no products in the cart!
Continue shopping
0