chapter20-code-1
Thu Mar 30 2023 11:30:53 GMT+0000 (Coordinated Universal Time)
Saved by
@RareSkills
function trade(uint256 amount) public {
// some code
// you can pass the address of the deployed SkillsCoin contract as a parameter to the constructor of the RareCoin contract as 'source'
(bool ok, bytes memory result) = source.call(abi.encodeWithSignature("transferFrom(address,address,uint256)", msg.sender, address(this), amount));
// this will fail if there is insufficient approval or balance
require(ok, "call failed");
// more code
}
content_copyCOPY
Comments