Skip to content

Instantly share code, notes, and snippets.

View madhavanmalolan's full-sized avatar

Madhavan Malolan madhavanmalolan

View GitHub Profile
@madhavanmalolan
madhavanmalolan / contracts...LearnChain.sol
Created September 5, 2021 18:26
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=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Owner
* @dev Set & change owner
*/
struct LearningPoint {
@madhavanmalolan
madhavanmalolan / contracts...ecm.sol
Created August 24, 2021 06:12
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=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
struct User {
address server;
string encryptedPushToken;
}
@madhavanmalolan
madhavanmalolan / contracts...quest-bonding-curve.sol
Created August 17, 2021 15:30
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);
const {
Connection,
TransactionInstruction,
Transaction,
sendAndConfirmTransaction,
PublicKey,
SystemProgram,
Keypair,
} = require('@solana/web3.js');
const fs = require('mz/fs');
const {
Connection,
Keypair,
} = require('@solana/web3.js');
const fs = require('mz/fs');
async function establishConnection() {
const rpcUrl = 'http://localhost:8899';
connection = new Connection(rpcUrl, 'confirmed');
const version = await connection.getVersion();
const {
Connection,
} = require('@solana/web3.js');
async function establishConnection() {
const rpcUrl = 'http://localhost:8899';
connection = new Connection(rpcUrl, 'confirmed');
const version = await connection.getVersion();
console.log('Connection to cluster established:', rpcUrl, version);
}
const {
Connection,
TransactionInstruction,
Transaction,
sendAndConfirmTransaction,
PublicKey,
SystemProgram,
} = require('@solana/web3.js');
const fs = require('mz/fs');
use borsh::{BorshDeserialize, BorshSerialize};
use std::collections::HashMap;
use std::convert::TryInto;
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint,
entrypoint::ProgramResult,
msg,
program_error::ProgramError,
[package]
name = "solana-bpf-crowdsource"
version = "0.0.1"
description = "Example template program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
use borsh::{BorshDeserialize, BorshSerialize};
use std::collections::HashMap;
use std::convert::TryInto;
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint,
entrypoint::ProgramResult,
msg,
program_error::ProgramError,