Skip to content

Instantly share code, notes, and snippets.

@Zeegaths
Last active January 28, 2024 22:40
Show Gist options
  • Save Zeegaths/40c8d634cfe27e15d5099c8b19e37d12 to your computer and use it in GitHub Desktop.
Save Zeegaths/40c8d634cfe27e15d5099c8b19e37d12 to your computer and use it in GitHub Desktop.
A smart contract that uses view, pure, and payable functions.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract Function {
uint public a = 5;
// View function
function multiplyNumbers(uint b) public view returns (uint) {
return a * b;
}
// Pure function
function multiply(uint x, uint y) public pure returns (uint) {
return x * y;
}
// Payable function
function deposit () public payable {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment