Skip to content

Instantly share code, notes, and snippets.

View korrio's full-sized avatar
👽

kOrriO korrio

👽
  • Hal Finney Co.,Ltd.
  • mempool
  • X @korrio
View GitHub Profile
@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.
@korrio
korrio / SimpleBankWBNB.sol
Last active July 31, 2021 05:35
SimpleBankWBNB.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
@korrio
korrio / WBNB.sol
Created July 25, 2021 07:15
WBNB at Solidity 0.5.16
/**
*Submitted for verification at BscScan.com on 2020-09-03
*/
/**
*Submitted for verification at Bscscan.com on 2020-09-03
*/
pragma solidity ^0.5.16;
@korrio
korrio / truffle-config.js
Created July 25, 2021 04:12
truffle-config.js
const HDWalletProvider = require('@truffle/hdwallet-provider');
const infuraKey = "";
const etherApiKey = "";
//
const fs = require('fs');
const mnemonic = fs.readFileSync(".secret").toString().trim();
module.exports = {
/**
* Networks define how you connect to your ethereum client and let you set the
@korrio
korrio / DEX.sol
Created July 11, 2021 06:01
Simple Bank with ERC20
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
return msg.data;
@korrio
korrio / DAI.sol
Created July 3, 2021 04:10
DAI.sol
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/ERC20.sol";
contract DAI is ERC20 {
constructor () public ERC20("Mocked DAI Token", "DAI-T") {
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
}
}
@korrio
korrio / BulkSender.sol
Created June 30, 2021 08:00
BulkSender.sol
// File: contracts/EternalStorage.sol
// Initial code from Roman Storm Multi Sender
// To Use this Dapp: https://bulktokensending.github.io/bulktokensending
pragma solidity ^0.6.6;
import 'VonderToken.sol';
/**