0

Because i need to test smart contracts functions deployed in ropsten

function deposit(uint256 _amount) public {
        // Amount must be greater than zero
        require(_amount > 0, "amount cannot be 0");
    
        // Transfer MyToken to smart contract
        token.safeTransferFrom(msg.sender, address(this), _amount);
    
        // Mint FarmToken to msg sender
        _mint(msg.sender, _amount);
    }

2 Answers 2

0

For unit testing smart contracts have a look at Truffle:

https://www.trufflesuite.com/docs/truffle/testing/testing-your-contracts

0

You would use a framework that provide all the tools necessary for that. A year ago, I would've suggested to use Truffle for that. But now, I would suggest you should instead give Hardhat a try as it's doing things much better and is aiming to make smart contract development headache-free.

Those frameworks would provide you with everything you would need for your blockchain dev experience, and not just testing.

1
  • Ok! i go to use hardhat, thank you very much.
    – alejza
    Commented Jul 29, 2021 at 12:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.