Skip to content

Instantly share code, notes, and snippets.

View korrio's full-sized avatar
👽

kOrriO korrio

👽
View GitHub Profile
@korrio
korrio / NICK.sol
Created August 29, 2021 08:01
NICK.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
@korrio
korrio / PostFlashloan.sol
Created August 29, 2021 07:08
PostFlashloan.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
@korrio
korrio / Arbitrage.sol
Created August 29, 2021 06:46
Arbitrage.sol
pragma solidity ^0.6.12;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
@korrio
korrio / Flashloan_swap.sol
Created August 29, 2021 05:42
Flashloan_swap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
@korrio
korrio / Flashloan_exercise.sol
Created August 29, 2021 03:02
Flashloan_exercise.sol
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
@korrio
korrio / farms.ts
Created August 28, 2021 07:14
farms.ts
import contracts from './contracts'
import { FarmConfig, QuoteToken } from './types'
const farms: FarmConfig[] = [
{
pid: 0,
risk: 5,
lpSymbol: 'WAD',
lpAddresses: {
97: '',
@korrio
korrio / MasterChef.sol
Created August 28, 2021 03:39
MasterChef.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
@korrio
korrio / mint.sol
Created August 18, 2021 02:25
mint.sol
function stake(uint256 amount) external nonReentrant {
require(amount <= maxStakeAmount, 'amount too high');
busd.safeTransferFrom(msg.sender, address(this), amount);
if(feePermille > 0) {
uint256 feeAmount = amount * feePermille / 1000;
busd.safeTransfer(treasury, feeAmount);
amount = amount - feeAmount;
}
uint256 xvonAmount = amount * xvonPermille / 1000;
xvon.safeTransferFrom(msg.sender, address(this), xvonAmount);
@korrio
korrio / redeem.sol
Last active August 18, 2021 02:22
redeem.sol
function redeem(uint256 amount) external nonReentrant {
uint256 busdTransferAmount = amount * (1000 - xvonPermille - treasuryPermille) / 1000;
uint256 busdTreasuryAmount = amount * treasuryPermille / 1000;
uint256 xvonTransferAmount = xvon.balanceOf(address(this)) * amount / vdp.totalSupply();
vdp.burn(msg.sender, amount);
busd.safeTransfer(treasury, busdTreasuryAmount);
busd.safeTransfer(msg.sender, busdTransferAmount);
xvon.safeTransferFrom(msg.sender, address(this), xvonTransferAmount);
emit Redeem(msg.sender, amount);
@korrio
korrio / trader_fix.sol
Created August 7, 2021 11:09
Trader_fix
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.