We will start off by using cast to interact with our contract that's deployed locally on Anvil. This time instead of calling
increment we will call
decrement. This will teach us how to interact with our smart contract whenever it expects the user to supply some data.
Instructor: [0:00] Now we can try what it looks like to call the decrement function. That would be relatively the same thing. Instead of increment, we're going to want to decrement this. The difference here is that while increment doesn't take any arguments, decrement does. [0:22] Here we can do decrement. Then here, we can pass in 2. You can see that doesn't look quite right. You can see that that didn't work. We can't just pass in directly here. What actually cast wants us to do is it wants us to put in the data type that we're expecting here. We're going to pass in uint256. Then, right after that, it will take all of your arguments.
[0:53] If you had multiple arguments, you would then space them out appropriately. Since we just have the one, we'll say, "Hey, we want to decrement this." You can see, cool, that works. Our block number increased. Now we would expect our getNum to return 9.
[1:10] We'll double-check that. You can see that, cool, we are now getting 9 back on our getNum. That's what it looks like to interact with your smart contract on your local testnet.