current position:Home>Solidity has a piece of code that I don't quite understand

Solidity has a piece of code that I don't quite understand

2022-02-03 23:37:21 Q & A of Denglian community

consult : I'm learning usdt Code time , Here's the code uint fee = (_value.mul(basisPointsRate)).div(10000); Of "." The dot symbol is a little unclear ,

If transfer Functional _value Parameters of the incoming 100,basisPointsRate This has a value assigned to 0, The code is not posted uint fee = (100.mul(0)).div(10000); . Now this (100.mul(0)).div(10000) I don't quite understand , Ask the boss for advice

    function transfer(address _to, uint _value) public onlyPayloadSize(2 * 32){        uint fee = (_value.mul(basisPointsRate)).div(10000);        if (fee > maximunFee) fee = maximunFee;        uint sendAmount = _value.sub(fee);        balances[msg.sender] = balances[msg.sender].sub(sendAmount);        balances[_to] = balances[_to].add(sendAmount);        if (fee > 0){            balances[owner] = balances[owner].add(fee);            emit Transfer(msg.sender, owner, fee);        }        emit Transfer(msg.sender, _to, sendAmount);    }



Take the answer 1:

Just like object-oriented programming : instance.MyFunc()

You can understand it as calling integer Multiplication and division function .




copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032337196328.html

Random recommended