Function Call Options When calling functions of other contracts, you can specify the amount of a specific token to send, with the call options: {token: "tti_564954455820434f494e69b5", value: 1e18}
.
Copy
pragma soliditypp >= 0.8.0 ;
contract InfoFeed {
function getBalance ( vitetoken token) external view returns ( uint256 ) {
return balance ( token) ;
}
function info ( ) external payable returns ( uint ret) {
return 42 ;
}
}
contract Consumer {
InfoFeed feed;
constructor ( address payable addr) {
feed = InfoFeed ( addr) ;
}
function callFeed ( ) external {
feed. info{ token: "tti_564954455820434f494e69b5" , value: 1e18 } ( ) ;
}
}
If the token
call option is omitted, the VITE token is sent by default.
The following code:
Copy
feed. info{ value: 1e18 } ( ) ;
is equivalent to:
Copy
feed. info{ token: "tti_5649544520544f4b454e6e40" , value: 1e18 } ( ) ;
Notice
The gas
,salt
keys in a call option are not supported in Solidity++.