Skip to content

Instantly share code, notes, and snippets.

View maymax777's full-sized avatar
😇
What's happening?

maymax maymax777

😇
What's happening?
View GitHub Profile
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "./IVestingFactory.sol";
contract VestingProxy is ERC1967Proxy {
/**
* @dev Storage slot with the factory of the contract.
* This is the keccak-256 hash of "co.example.factory" subtracted by 1, and is
* validated in the constructor.
pragma solidity ^0.8.0;
library DateTime {
uint256 constant SECONDS_PER_DAY = 24 * 60 * 60;
int256 constant OFFSET19700101 = 2440588;
function _daysFromDate(
uint256 year,
uint256 month,
uint256 day
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./DateTime.sol";
/**
pragma solidity ^0.8.10;
contract ReEntrancyGuard {
bool internal locked;
modifier noReentrant() {
require(!locked, "No re-entrancy");
locked = true;
_;
locked = false;
contract Multisend {
function multisendEther(address[] memory recipients, uint256[] memory values)
external
payable
{
for (uint256 i = 0; i < recipients.length; i++)
payable(recipients[i]).transfer(values[i]);
uint256 balance = address(this).balance;
if (balance > 0) payable(msg.sender).transfer(balance);
}
contract Staking {
function isContract(address _target) internal view returns (bool) {
if (_target == address(0)) {
return false;
}
uint256 size;
assembly {
size := extcodesize(_target)
}
pragma solidity ^0.4.19;
contract MaximumMultiple {
function maxMultiple(int d, int b) public pure returns (int) {
//
int max = d > b ? d : b;
int min = d < b ? d : b;
return max - max % min;
}
}
pragma solidity ^0.4.19;
contract Century {
function get(int year) public pure returns (int) {
return (year - 1) / 100 + 1;
}
}
pragma solidity ^0.4.19;
contract Problem {
function rowSumOddNumbers(int n) public pure returns (int) {
int end = (1 + n ) * n - 1;
int start = end - 2 * (n - 1);
int sum = (start + end) * n / 2;
return sum;
}
}
pragma solidity ^0.4.13;
contract Repeater {
function multiply(uint8 repeat, string pattern) returns (string) {
bytes memory bpattern = bytes(pattern);
uint resultLength = repeat * bpattern.length;
string memory result = new string(resultLength);
bytes memory bresult = bytes(result);
for (uint i = 0; i < resultLength; i++) {
bresult[i] = bpattern[i % bpattern.length];