Skip to content

Instantly share code, notes, and snippets.

View Ro5s's full-sized avatar
💭
👨🏻‍🍲 Thinking lowkey pizza

Ross Campbell Ro5s

💭
👨🏻‍🍲 Thinking lowkey pizza
View GitHub Profile
@Ro5s
Ro5s / LexLockerV2.sol
Created September 25, 2021 04:20
Bilateral escrow for ETH and ERC-20/721 tokens.
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0 <0.9.0;
/// @notice Bilateral escrow for ETH and ERC-20/721 tokens.
/// @author LexDAO LLC.
contract LexLocker {
uint256 lockerCount;
mapping(uint256 => Locker) public lockers;
mapping(address => Resolver) public resolvers;
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0 <0.9.0;
/// @notice Bilateral escrow for ETH and ERC-20/721 tokens.
/// @author LexDAO LLC.
contract LexLocker {
uint256 lockerCount;
mapping(uint256 => Locker) public lockers;
mapping(address => Resolver) public resolvers;
@Ro5s
Ro5s / Mochi.sol
Created September 21, 2021 06:24
Moloch on BentoBox
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;
/*
███ ███ ██████ ██████ ██ ██ ██
████ ████ ██ ██ ██ ██ ██ ██
██ ████ ██ ██ ██ ██ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██████ ██ ██ ██
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.7;
/*
d888888b d888888b
d888 8888b d888888 888b
d88 88 898888b d8888 888 88b
d8P 88888888b d88888888888 b8b
88 8888888888 88888888888 88
88 88888888888 8888888888 88
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-27
*/
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
/**
* @title ERC721Mock
* This mock just provides a public safeMint, mint, and burn functions for testing purposes
*/
@Ro5s
Ro5s / RestrictedTokenFactory.sol
Created September 3, 2021 16:33
permissioned factory for erc20 tokens with an admin set on construction
/// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
/// @notice Basic ERC20 implementation.
contract Token {
string public name;
string public symbol;
uint8 constant public decimals = 18;
uint public totalSupply;
mapping(address => uint) public balanceOf;
@Ro5s
Ro5s / useCreamToBentoStrategy.ts
Created August 1, 2021 16:42
stake cToken xsushi into bento xsushi shares
import { t } from '@lingui/macro'
import { CRXSUSHI, XSUSHI } from '../../../constants'
import { ChainId, SUSHI_ADDRESS } from '@sushiswap/sdk'
import { tryParseAmount } from '../../../functions'
import { useBentoBalance } from '../../bentobox/hooks'
import { useActiveWeb3React } from '../../../hooks'
import { useTokenBalances } from '../../wallet/hooks'
import { StrategyGeneralInfo, StrategyHook, StrategyTokenDefinitions } from '../types'
import useBaseInariStrategy from './useBaseInariStrategy'
import { useEffect, useMemo } from 'react'
@Ro5s
Ro5s / useAaveToBentoStrategy.ts
Created August 1, 2021 16:41
stake xsushi atoken into xsushi bento shares
import { t } from '@lingui/macro'
import { AXSUSHI, XSUSHI } from '../../../constants'
import { ChainId, SUSHI_ADDRESS } from '@sushiswap/sdk'
import { tryParseAmount } from '../../../functions'
import { useBentoBalance } from '../../bentobox/hooks'
import { useActiveWeb3React } from '../../../hooks'
import { useTokenBalances } from '../../wallet/hooks'
import { StrategyGeneralInfo, StrategyHook, StrategyTokenDefinitions } from '../types'
import useBaseInariStrategy from './useBaseInariStrategy'
import { useEffect, useMemo } from 'react'
@Ro5s
Ro5s / BentoShareTest.sol
Created July 24, 2021 00:53
BentoShareTest.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.2;
interface IFlashBorrower {
/// @notice The flashloan callback. `amount` + `fee` needs to repayed to msg.sender before this call returns.
/// @param sender The address of the invoker of this flashloan.
/// @param token The address of the token that is loaned.
/// @param amount of the `token` that is loaned.
/// @param fee The fee that needs to be paid on top for this loan. Needs to be the same as `token`.