Skip to content

Instantly share code, notes, and snippets.

View madhavanmalolan's full-sized avatar

Madhavan Malolan madhavanmalolan

View GitHub Profile
require('dotenv').config()
const express = require('express')
const bodyParser = require('body-parser')
const http = require('http')
const Web3 = require('web3')
const HDWalletProvider = require('@truffle/hdwallet-provider')
const moment = require('moment-timezone')
const numeral = require('numeral')
const _ = require('lodash')
const axios = require('axios')
@madhavanmalolan
madhavanmalolan / contracts...subquest-8b.sol
Created August 10, 2021 09:50
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract SmartBankAccount {
uint totalContractBalance = 0;
function getContractBalance() public view returns(uint){
return totalContractBalance;
}
@madhavanmalolan
madhavanmalolan / contracts...subquest-8a.sol
Created August 10, 2021 09:49
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract SmartBankAccount {
uint totalContractBalance = 0;
function getContractBalance() public returns(uint){
return totalContractBalance;
}
@madhavanmalolan
madhavanmalolan / contracts...subquest-8a.sol
Created August 10, 2021 06:29
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract SmartBankAccount {
uint totalContractBalance = 0;
function getContractBalance() public returns(uint){
return totalContractBalance;
}
@madhavanmalolan
madhavanmalolan / contracts...subquest-8b.sol
Created August 10, 2021 06:27
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract SmartBankAccount {
uint totalContractBalance = 0;
function getContractBalance() public view returns(uint){
return totalContractBalance;
}
@madhavanmalolan
madhavanmalolan / contracts...subquest-add-compound-1.sol
Created August 10, 2021 06:24
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
interface cETH {
// define functions of COMPOUND we'll be using
function mint() external payable; // to deposit to compound
function redeem(uint redeemTokens) external returns (uint); // to withdraw from compound
@madhavanmalolan
madhavanmalolan / contracts...subquest-mining-erc20.sol
Created August 7, 2021 13:42
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract MyErc20 {
string NAME = "MyErc20TokensReallyLongName";
string SYMBOL = "M20";
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
@madhavanmalolan
madhavanmalolan / contracts...subquest-mining-erc20.sol
Created August 7, 2021 13:41
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract MyErc20 {
string NAME = "MyErc20TokensReallyLongName";
string SYMBOL = "M20";
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
@madhavanmalolan
madhavanmalolan / contracts...subquest-mining-erc20.sol
Created August 7, 2021 13:39
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract MyErc20 {
string NAME = "MyErc20TokensReallyLongName";
string SYMBOL = "M20";
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
@madhavanmalolan
madhavanmalolan / contracts...subquest-dealing-with-money.sol
Created August 7, 2021 13:31
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.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract MyErc20 {
string NAME = "MyErc20TokensReallyLongName";
string SYMBOL = "M20";
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);