Skip to content
Verified contractExactUNLICENSED

GoFundMicah

Address0xbbf65d0e203a0c4853b0ae9a69e07b01a39e25cd
Balance

0 ETH

 

Transactions

40

 

Compiler

solc 0.8.30

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
Yes, 500 runs
Via IR
yes
License
UNLICENSED
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
23,080,955
Creation transaction
0x84d6980e47…5be76ae466

contracts/RepCrowdsourcer.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;

import './ERC20.sol';

contract GoFundMicah is ERC20('GoFundMicah', 'GFM') {
	IERC20 public constant repV2 = IERC20(0x221657776846890989a759BA2973e427DfF5C9bB);
	address public constant micahAddress = 0xed1e06B49C53293A1321Dd47Abf8D50F9Be77E11; // GoFundMicah SAFE
	uint256 public constant minBalanceToWithdraw = 200000 ether;

	bool public depositsEnabled = true;
	bool public withdrawsEnabled = true;

	event Deposit(address indexed depositor, uint256 amount);
	event Withdraw(address indexed withdrawer, uint256 amount);
	event DepositsDisabled();
	event WithdrawsEnabled();
	event WithdrawsDisabled();
	event MicahWithdraw(uint256 amount);
	event TokenRecovered(IERC20 tokenAddress, address recipient, uint256 amount);

	function deposit(uint256 amount) external {
		require(depositsEnabled, 'Deposits disabled');
		repV2.transferFrom(msg.sender, address(this), amount);
		_mint(msg.sender, amount);
		emit Deposit(msg.sender, amount);
	}

	function internalWithdraw(address recipient) private {
		require(withdrawsEnabled, 'Withdraws disabled');
		uint256 amount = _balances[recipient];
		uint256 proportionalBalance = repV2.balanceOf(address(this)) * amount / totalSupply();
		_burn(recipient, amount);
		repV2.transfer(recipient, proportionalBalance);
		emit Withdraw(recipient, proportionalBalance);
	}

	function withdraw() external {
		internalWithdraw(msg.sender);
	}

	function massWithdraw(address[] calldata recipients) external {
		require(!depositsEnabled, 'Deposits must be disabled');
		for (uint256 i = 0; i < recipients.length; ++i) {
			internalWithdraw(recipients[i]);
		}
	}

	function micahCloseContract() external {
		require(msg.sender == micahAddress, 'Caller is not Micah!');
		depositsEnabled = false;
		emit DepositsDisabled();
	}

	function micahWithdraw() external {
		require(msg.sender == micahAddress, 'Caller is not Micah!');
		uint256 balance = repV2.balanceOf(address(this));
		require(balance >= minBalanceToWithdraw, 'Not enough balance');
		repV2.transfer(micahAddress, balance);
		emit MicahWithdraw(balance);
		depositsEnabled = false;
		withdrawsEnabled = false;
		emit WithdrawsDisabled();
		emit DepositsDisabled();
	}

	function setWithdrawsEnabled() external {
		require(msg.sender == micahAddress, 'Caller is not Micah');
		withdrawsEnabled = true;
		emit WithdrawsEnabled();
	}

	function recoverERC20(IERC20 token, address recipient) external {
		require(msg.sender == micahAddress, 'Caller is not Micah!');
		require(token != repV2, 'Cannot recover REPv2 token');
		uint256 amount = token.balanceOf(address(this));
		token.transfer(recipient, amount);
		emit TokenRecovered(token, recipient, amount);
	}
}

contracts/ERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/ERC20.sol)

pragma solidity 0.8.30;

import {IERC20} from "./IERC20.sol";

abstract contract ERC20 is IERC20 {
	mapping(address account => uint256) internal _balances;

	mapping(address account => mapping(address spender => uint256)) internal _allowances;

	uint256 private _totalSupply;

	string internal _name;
	string internal _symbol;

	constructor(string memory name_, string memory symbol_) {
		_name = name_;
		_symbol = symbol_;
	}

	function name() public view virtual returns (string memory) {
		return _name;
	}

	function symbol() public view virtual returns (string memory) {
		return _symbol;
	}

	function decimals() public view virtual returns (uint8) {
		return 18;
	}

	function totalSupply() public view virtual returns (uint256) {
		return _totalSupply;
	}

	function balanceOf(address account) public view virtual returns (uint256) {
		return _balances[account];
	}

	function transfer(address to, uint256 value) public virtual returns (bool) {
		address owner = msg.sender;
		_transfer(owner, to, value);
		return true;
	}

	function allowance(address owner, address spender) public view virtual returns (uint256) {
		return _allowances[owner][spender];
	}

	function approve(address spender, uint256 value) public virtual returns (bool) {
		address owner = msg.sender;
		_approve(owner, spender, value);
		return true;
	}

	function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
		address spender = msg.sender;
		_spendAllowance(from, spender, value);
		_transfer(from, to, value);
		return true;
	}

	function _transfer(address from, address to, uint256 value) internal {
		if (from == address(0)) {
			revert ERC20InvalidSender(address(0));
		}
		if (to == address(0)) {
			revert ERC20InvalidReceiver(address(0));
		}
		_update(from, to, value);
	}

	function _update(address from, address to, uint256 value) internal virtual {
		if (from == address(0)) {
			// Overflow check required: The rest of the code assumes that totalSupply never overflows
			_totalSupply += value;
		} else {
			uint256 fromBalance = _balances[from];
			if (fromBalance < value) {
				revert ERC20InsufficientBalance(from, fromBalance, value);
			}
			unchecked {
				// Overflow not possible: value <= fromBalance <= totalSupply.
				_balances[from] = fromBalance - value;
			}
		}

		if (to == address(0)) {
			unchecked {
				// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
				_totalSupply -= value;
			}
		} else {
			unchecked {
				// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
				_balances[to] += value;
			}
		}

		emit Transfer(from, to, value);
	}

	function _mint(address account, uint256 value) internal {
		if (account == address(0)) {
			revert ERC20InvalidReceiver(address(0));
		}
		_update(address(0), account, value);
	}

	function _burn(address account, uint256 value) internal {
		if (account == address(0)) {
			revert ERC20InvalidSender(address(0));
		}
		_update(account, address(0), value);
	}

	function _approve(address owner, address spender, uint256 value) internal {
		_approve(owner, spender, value, true);
	}

	function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
		if (owner == address(0)) {
			revert ERC20InvalidApprover(address(0));
		}
		if (spender == address(0)) {
			revert ERC20InvalidSpender(address(0));
		}
		_allowances[owner][spender] = value;
		if (emitEvent) {
			emit Approval(owner, spender, value);
		}
	}

	function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
		uint256 currentAllowance = allowance(owner, spender);
		if (currentAllowance < type(uint256).max) {
			if (currentAllowance < value) {
				revert ERC20InsufficientAllowance(spender, currentAllowance, value);
			}
			unchecked {
				_approve(owner, spender, currentAllowance - value, false);
			}
		}
	}

	error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

	error ERC20InvalidSender(address sender);

	error ERC20InvalidReceiver(address receiver);

	error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

	error ERC20InvalidApprover(address approver);

	error ERC20InvalidSpender(address spender);
}

contracts/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity 0.8.30;

/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
	function name() external view returns (string memory);

	function symbol() external view returns (string memory);

	function decimals() external view returns (uint8);

	event Transfer(address indexed from, address indexed to, uint256 value);

	event Approval(address indexed owner, address indexed spender, uint256 value);

	function totalSupply() external view returns (uint256);

	function balanceOf(address account) external view returns (uint256);

	function transfer(address to, uint256 value) external returns (bool);

	function allowance(address owner, address spender) external view returns (uint256);

	function approve(address spender, uint256 value) external returns (bool);

	function transferFrom(address from, address to, uint256 value) external returns (bool);
}
Compiler settingsShow
{
  "viaIR": true,
  "optimizer": {
    "runs": 500,
    "details": {
      "inliner": true
    },
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.