if you want to use functions from a deployed smart contract, you can make an interface of the deployed contract inside your contract and make an instance of it. here is the example code-
pragma solidity ^0.5.17;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
interface IWETH {
function deposit() external payable;
function withdraw(uint) external;
}
contract demo {
address weth=0xc778417E063141139Fce010982780140Aa0cD5Ab;
function getWETH() public payable {
//IWETH(weth).deposit{value: msg.value}();
IWETH(weth).deposit.value(msg.value)();
}
}
here I have made an interface of WETH contract deployed on testnet. Then in contract demo, I have made an instance of smart contract by it's contract address and called the smart contract function using its instance.