Skip to main content
added 4 characters in body; edited title
Source Link
Rohan Nero
  • 1.7k
  • 2
  • 8
  • 29

How to fix invalid BigNumber string error in soliditySolidity?

this is a simple contract. where iI want to develop a function( optimizer), optimizer, upon calling it will transfer an amount of eth to an address. but when iI deploy it on the testnet and, connect my metamaskMetamask and try to call the optimizer function with 0.5 eth(in remix) in Remix, its gives me this error:

transact to AB.Optimizer errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="0.5", code=INVALID_ARGUMENT)

where is fault in my code?

code

pragma solidity ^0.8.7;

// SPDX-License-Identifier: GPL-3.0


contract ABc {

   address payable  b= payable(xxx);

    uint amount= 0.4 ether;
  


     function Optimizer( uint256 _amount )public  payable{

        
     _amount=msg.value;
        
       require(amount >=0.4 ether,"transfer amount to low");

      

      b.transfer(msg.value);

      
       
    }
    
}
    pragma solidity ^0.8.7;
    
    // SPDX-License-Identifier: GPL-3.0
    
    
    contract ABc {
    
       address payable  b= payable(xxx);
    
        uint amount= 0.4 ether;
      
    
    
         function Optimizer( uint256 _amount )public  payable{
    
            
         _amount=msg.value;
            
           require(amount >=0.4 ether,"transfer amount to low");
    
          
    
          b.transfer(msg.value);
    
          
           
        }
        
    }

invalid BigNumber string error in solidity

this is a simple contract. where i want to develop a function( optimizer), upon calling it will transfer an amount of eth to an address. but when i deploy it on the testnet and connect my metamask and try to call the optimizer function with 0.5 eth(in remix), its gives me this error

transact to AB.Optimizer errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="0.5", code=INVALID_ARGUMENT)

where is fault in my code?

code

pragma solidity ^0.8.7;

// SPDX-License-Identifier: GPL-3.0


contract ABc {

   address payable  b= payable(xxx);

    uint amount= 0.4 ether;
  


     function Optimizer( uint256 _amount )public  payable{

        
     _amount=msg.value;
        
       require(amount >=0.4 ether,"transfer amount to low");

      

      b.transfer(msg.value);

      
       
    }
    
}

How to fix invalid BigNumber string error in Solidity?

this is a simple contract. where I want to develop a function, optimizer, upon calling it will transfer an amount of eth to an address. but when I deploy it on the testnet, connect my Metamask and try to call the optimizer function with 0.5 eth in Remix, its gives me this error:

transact to AB.Optimizer errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="0.5", code=INVALID_ARGUMENT)

where is fault in my code?

    pragma solidity ^0.8.7;
    
    // SPDX-License-Identifier: GPL-3.0
    
    
    contract ABc {
    
       address payable  b= payable(xxx);
    
        uint amount= 0.4 ether;
      
    
    
         function Optimizer( uint256 _amount )public  payable{
    
            
         _amount=msg.value;
            
           require(amount >=0.4 ether,"transfer amount to low");
    
          
    
          b.transfer(msg.value);
    
          
           
        }
        
    }
Source Link
stofu
  • 103
  • 1
  • 2
  • 13

invalid BigNumber string error in solidity

this is a simple contract. where i want to develop a function( optimizer), upon calling it will transfer an amount of eth to an address. but when i deploy it on the testnet and connect my metamask and try to call the optimizer function with 0.5 eth(in remix), its gives me this error

transact to AB.Optimizer errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="0.5", code=INVALID_ARGUMENT)

where is fault in my code?

code

pragma solidity ^0.8.7;

// SPDX-License-Identifier: GPL-3.0


contract ABc {

   address payable  b= payable(xxx);

    uint amount= 0.4 ether;
  


     function Optimizer( uint256 _amount )public  payable{

        
     _amount=msg.value;
        
       require(amount >=0.4 ether,"transfer amount to low");

      

      b.transfer(msg.value);

      
       
    }
    
}