Skip to content

Instantly share code, notes, and snippets.

View johnsoncarl's full-sized avatar
🎯
Focusing

AMAN PANDEY johnsoncarl

🎯
Focusing
View GitHub Profile
pragma solidity>=0.4.24;
contract vulnerable{
uint256 defaultAmount = 1 ether;
address payable public nominee ;
mapping (address => uint256) balance;
uint256 _amount;
function() external payable{
contract attacker{
bool public flag=false;
function change() public{
if(!flag) flag=true;
else flag=false;
}
function() external payable {
if(flag) revert();
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function safeSub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function safeMul(uint a, uint b) public pure returns (uint c) {
deployer: "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c"
sender: ["0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" , "0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB", "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C", "0x7dEeD780f2b458Df07136526EcA77417CB87aFEB", "0x79696a2ade1f4ecc12fd9e449e0b86b066629d27"]
psender: "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c"
balanceAddr: 42
balanceContract: 123
@johnsoncarl
johnsoncarl / dos_gas.sol
Last active March 27, 2020 17:37
Day14 blog of 20days blog series.
contract Test {
bool flag;
address[] listAddresses;
constructor() public{
flag = true;
}
function ifillArray() public {
@johnsoncarl
johnsoncarl / uncheckedSend()
Created March 27, 2020 17:38
For Day14 blog of 20 Days blog series.
contract attacker{
bool public flag=false;
function change() public{
if(!flag) flag=true;
else flag=false;
}
function() external payable {
if(flag) revert();
@johnsoncarl
johnsoncarl / reentrancy.sol
Last active March 29, 2020 13:19
Day 15 of 20 Days Blog series.
import "./SimpleDAO.sol";
contract attacker{
SimpleDAO DAO = new SimpleDAO(); // address of already deployed DAO contract
address a = address(DAO);
function() public payable{
if(flag) DAO.withdraw(DAO.retbalance());
@johnsoncarl
johnsoncarl / simpleContract.sol
Last active April 2, 2020 17:16
(01) of Day 15 blog of 20 days blog series
pragma solidity >=0.4.0 <0.7.0;
contract SimpleStorage {
uint storedData;
constructor() public{
storedData = 1;
}
function set(uint x) public {
<!doctype html>
<html lang="en">
<head prefix="og: http://ogp.me/ns#">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Open Graph protocol examples</title>
<meta name="description" content="Example HTML documents marked up with Open Graph protocol.">
<meta property="og:image" content="https://www.rd.com/wp-content/uploads/2020/01/GettyImages-454238885-scaled.jpg" />
</head>
<body itemscope itemtype="http://schema.org/WebPage">
@johnsoncarl
johnsoncarl / PostRequest.cs
Created February 21, 2022 17:51
Minting Gaming assets on Polygon using Onecdot APIs
//PostRequest.cs
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
using System.Collections.Generic;
[System.Serializable]
public class Metadata