Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/play3rzer0/callcalculator
A contract interaction example
https://github.com/play3rzer0/callcalculator
blockchain contract-interaction inheritance smartcontracts solidity web3
Last synced: about 4 hours ago
JSON representation
A contract interaction example
- Host: GitHub
- URL: https://github.com/play3rzer0/callcalculator
- Owner: Play3rZer0
- License: mit
- Created: 2024-07-11T15:02:27.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-15T17:50:33.000Z (4 months ago)
- Last Synced: 2024-07-15T21:53:36.154Z (4 months ago)
- Topics: blockchain, contract-interaction, inheritance, smartcontracts, solidity, web3
- Language: Solidity
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CallCalculator
A contract interaction example.
This consists of two smart contracts:
1- Calculator.sol
2- Caller.solThe calculator contract contains the main functions. The caller contract will call a function from the calculator contract to process data.
The data are passed as arguments to a parameter in the function on the calculator contract.
The caller will pass these parameters to the calculator:
function x(uint a, uint b) public view returns(uint) { .. }The calculator upon invocation, will take the parameters as arguments and run the function:
function add(uint x, uint y) public pure returns(uint) { .. }Since the data is not being stored onchain, to change the state, there is no gas cost. The function called is a "pure returns" type.
Updated(7/16/24):
Added an interface to the contract for function abstraction - CalculatorInterface.sol