Skip to content

Instantly share code, notes, and snippets.

View crazyrabbitLTC's full-sized avatar

Dennison Bertram crazyrabbitLTC

View GitHub Profile
// File: contracts/CompoundContracts/Comp.sol
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Comp {
/// @notice EIP-20 token name for this token
string public name;
// File: contracts/CompoundContracts/GovernorAlpha.sol
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public name;
@crazyrabbitLTC
crazyrabbitLTC / Mapping function
Created August 6, 2020 23:37
Subgraph Mapping function
export function handleDelegateChanged(event: DelegateChanged): void {
let delegator = event.params.delegator
let fromDelegate = event.params.fromDelegate
let toDelegate = event.params.toDelegate
let txHash = event.transaction.hash.toHex()
let timestamp = event.block.timestamp
let blockNumber = event.block.number
// Load Token Contract to get official votes (rather than computing from events)
let token = COMP.bind(event.address)
@crazyrabbitLTC
crazyrabbitLTC / Token.sol
Created June 17, 2020 14:48
A simple ERC20 Token in Solidity
pragma solidity ^0.5.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/ERC20Detailed.sol";
contract Token is ERC20, ERC20Detailed {
constructor (string memory name, string memory symbol, uint supply) public ERC20Detailed(name, symbol, 18) {
_mint(msg.sender, supply * (10 ** uint256(decimals())));
}
@crazyrabbitLTC
crazyrabbitLTC / BondingCurve
Created April 26, 2020 13:08
Bonding Curve
[
{
"inputs": [
{
"internalType": "address",
"name": "_DAO",
"type": "address"
}
],
"stateMutability": "nonpayable",
@crazyrabbitLTC
crazyrabbitLTC / ccDAO
Created April 26, 2020 13:07
CcDao ABI
[
{
"inputs": [
{
"internalType": "string",
"name": "_name",
"type": "string"
},
{
"internalType": "address",
@crazyrabbitLTC
crazyrabbitLTC / DappHeroTest.json
Created February 2, 2020 16:39
DappHero Solidity Test File v2 ABI
[{"constant":false,"inputs":[],"name":"sendMinimumTwoEthNoArgs","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"hello","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"makeTxNoArgs","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"simpleMessage","type":"bytes32"}],"name":"sendEthWithArgs","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"fromAddress","type":"address"},{"name":"amount","type":"uint256"}],"name":"viewMultipleArgsMultipleReturn","outputs":[{"name":"longInteger","type":"uint256"},{"name":"sayHello","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"myString","type":"string"}],"name":"makeTxWithArgs","outputs":[],"payable":false,"stateMutability":"nonpayabl
@crazyrabbitLTC
crazyrabbitLTC / DappHeroTest.sol
Created February 2, 2020 16:38
DappHero Solidity Test Contract V2
pragma solidity 0.5.0;
contract DappHeroTest {
uint public important = 777;
bytes32 public hello = "Howdy";
address public owner;
event EventTrigger(address indexed sender, uint value);
event ValueSent(address indexed sender);
@crazyrabbitLTC
crazyrabbitLTC / ExampleHTML.html
Created January 31, 2020 20:45
DpapHero Example Docs HTML
<!------------------------ Custom Contract -----------------------------------------
Notes: The contract used here as demonstration is availible at:
https://ropsten.etherscan.io/address/0x5d04f4635996dceaad4cda22799645af72633b7b#code
Here you will find the ABI and the Solidity Source code itself.
Contract Name is: DappHeroTest
Remember: To test this you need to have your admin "data-api" key match your project
in the DappHero admin. Currently the Data API below should resolve for Rinkeby.