Skip to content

Instantly share code, notes, and snippets.

View finxter's full-sized avatar

Finxter finxter

View GitHub Profile
@finxter
finxter / isItContract.sol
Created January 1, 2022 12:51 — forked from yassesh/isItContract.sol
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.0;
contract isItContract{
// this function gets the address of a contract
function contractAddress() public view returns (address) {
address theAddress = address(this); //contract address
return theAddress;
}
// these functions check if the address is a smartcontract
@finxter
finxter / structArray2.sol
Created December 28, 2021 08:28 — forked from yassesh/structArray2.sol
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
contract SavingsAccount {
struct Member{
uint id;
string name;
uint balance;
}
mapping (uint => Member) public members;
event savingsEvent(uint indexed _memberId);