2

I'm trying to understand why assembly for this sum is required?

// 1
        _structHash = keccak256(
            abi.encode(
                _blockhash,
                totalAddresses,
                gasLeft,
                _externalRandomNumber
            )
        );
        _randomNumber  = uint256(_structHash);
        assembly {_randomNumber := add(mod(_randomNumber, _maxNumber),1)}
        winningNumbers[0]=uint8(_randomNumber);

3
  • Which contract is that from? If they have a Github, please try asking there. And if you get an answer, please post back here :)
    – eth
    Apr 18, 2021 at 11:56
  • This comes from pancake swap lottery.
    – redigaffi
    Apr 18, 2021 at 16:43
  • OK. Usually it is better to include that information in the question. If they have a Github, that would be another place to try asking.
    – eth
    May 2, 2021 at 10:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.