uint256是否足以满足weis中的数量?

时间:2019-09-18 11:34:26

标签: solidity

我已经存钱罐了,我希望能够支票。但是事实证明,我不能用超过15个零的数字进行付款。这是正常的吗?

这是我注册支票的功能:

 function setdebtor(address _address, uint _checkId, uint256  _amount) segurity public {
        check[_checkId] = _amount;
        debtor[_address] = true;

}

我的映射:

mapping(uint => uint256) check;
    mapping(address => bool) debtor;

和我的付款功能:

function paycheck(uint _check) public {
        require(debtor[msg.sender]);
        msg.sender.transfer(check[_check]);
        debtor[msg.sender] = false;

    }

但是,如果我用大于零的15个数字进行检查,则会出现以下错误:

transact to Hucha.setdebtor errored: Error encoding arguments: Error: invalid number value (arg="", coderType="uint256", value=30000000000000000, version=4.0.37) 
>

那是uint256类型的限制吗?

这没有多大意义,因为在此函数中,我引入了带有18个零的数量而没有问题...

 function enterFunds(uint amount) public payable {
        require(msg.value == amount);
        emit operations("Ingreso realizado de: ", amount);


    }

所有代码:

pragma solidity ^0.5.11;

contract Hucha {

    address owner;
    mapping(address => bool) debtor;
    mapping(uint => uint) check; 


    event operations(string msg, uint amount);



    modifier segurity {
        require(msg.sender == owner);
        _;
    }

    constructor() public {
        owner = msg.sender; 
    }


    function getbalance() view public returns(uint) {
        return address(this).balance;
    }

    function enterFunds(uint amount) public payable {
        require(msg.value == amount);
        emit operations("Ingreso realizado de: ", amount);


    }

     function extractFunds(uint amount) segurity public {
              msg.sender.transfer(amount);
              emit operations("Se han sacado: ", amount);

    }

    function kill() segurity public {
        selfdestruct(msg.sender);
    } 



function paycheck(uint _check) public {
        require(debtor[msg.sender]);
        require(check[_check] != 0); // si no existe el cheque devolvera cero. 
        msg.sender.transfer(check[_check]);
        debtor[msg.sender] = false;

    }

    function setdebtor(address _address, uint _checkId, uint256  _amount) segurity public {
        check[_checkId] = _amount;
        debtor[_address] = true;

    }





}

1 个答案:

答案 0 :(得分:2)

由于javascript中的数字很大,您可以在值中添加双引号Expression.OrElse