Contract Overview
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Name:
SGAJtoTAKSHMigrator
Compiler Version
v0.8.0+commit.c7dfd78e
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: agpl-3.0 pragma solidity ^0.8.0; import {IERC20} from "./@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeMath} from "./@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title SGAJtoTAKSHMigrator * @notice This contract implements the migration from SGAJ to TAKSH token * @author Gajesh */ contract SGAJtoTAKSHMigrator { using SafeMath for uint256; IERC20 public immutable TAKSH = IERC20(0x80D6180F7AF1E86dfa1241AC363D4dbA82B9CaeC); IERC20 public immutable SGAJ = IERC20(0x94c7d657f1c8Be06A4Dc009D2d475Bb559d858cb); uint256 public immutable SGAJ_TAKSH_RATIO = 1; uint256 public _totalSgajMigrated; /** * @dev emitted on migration * @param sender the caller of the migration * @param amount the amount being migrated */ event SgajMigrated(address indexed sender, uint256 indexed amount); /** * @dev executes the migration from SGAJ to TAKSH. Users need to give allowance to this contract to transfer SGAJ before executing * this transaction. * @param amount the amount of SGAJ to be migrated */ function migrateFromSGAJ(uint256 amount) external { _totalSgajMigrated = _totalSgajMigrated.add(amount); SGAJ.transferFrom(msg.sender, address(this), amount); TAKSH.transfer(msg.sender, amount.div(SGAJ_TAKSH_RATIO)); emit SgajMigrated(msg.sender, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SgajMigrated","type":"event"},{"inputs":[],"name":"SGAJ","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SGAJ_TAKSH_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAKSH","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_totalSgajMigrated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"migrateFromSGAJ","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040527380d6180f7af1e86dfa1241ac363d4dba82b9caec73ffffffffffffffffffffffffffffffffffffffff1660809073ffffffffffffffffffffffffffffffffffffffff1660601b8152507394c7d657f1c8be06a4dc009d2d475bb559d858cb73ffffffffffffffffffffffffffffffffffffffff1660a09073ffffffffffffffffffffffffffffffffffffffff1660601b815250600160c0908152503480156100ac57600080fd5b5060805160601c60a05160601c60c0516106746100f66000396000818160f2015261026f01526000818161011c015261017f015260008181610140015261022f01526106746000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063348ca6a21461005c5780633fa991981461007a578063577c6de914610098578063905176f1146100b6578063f49803df146100d4575b600080fd5b6100646100f0565b60405161007191906104a4565b60405180910390f35b610082610114565b60405161008f91906104a4565b60405180910390f35b6100a061011a565b6040516100ad9190610489565b60405180910390f35b6100be61013e565b6040516100cb9190610489565b60405180910390f35b6100ee60048036038101906100e991906103d3565b610162565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b60005481565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6101778160005461035490919063ffffffff16565b6000819055507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016101da93929190610429565b602060405180830381600087803b1580156101f457600080fd5b505af1158015610208573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022c91906103aa565b507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb3361029d7f00000000000000000000000000000000000000000000000000000000000000008561036a90919063ffffffff16565b6040518363ffffffff1660e01b81526004016102ba929190610460565b602060405180830381600087803b1580156102d457600080fd5b505af11580156102e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030c91906103aa565b50803373ffffffffffffffffffffffffffffffffffffffff167f072b9ac098a4a2c70dbdd221a7f85cecfdd07b75d905c941a3f7b5783f7509fe60405160405180910390a350565b6000818361036291906104bf565b905092915050565b600081836103789190610515565b905092915050565b60008151905061038f81610610565b92915050565b6000813590506103a481610627565b92915050565b6000602082840312156103bc57600080fd5b60006103ca84828501610380565b91505092915050565b6000602082840312156103e557600080fd5b60006103f384828501610395565b91505092915050565b61040581610546565b82525050565b6104148161058e565b82525050565b61042381610584565b82525050565b600060608201905061043e60008301866103fc565b61044b60208301856103fc565b610458604083018461041a565b949350505050565b600060408201905061047560008301856103fc565b610482602083018461041a565b9392505050565b600060208201905061049e600083018461040b565b92915050565b60006020820190506104b9600083018461041a565b92915050565b60006104ca82610584565b91506104d583610584565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561050a576105096105b2565b5b828201905092915050565b600061052082610584565b915061052b83610584565b92508261053b5761053a6105e1565b5b828204905092915050565b600061055182610564565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610599826105a0565b9050919050565b60006105ab82610564565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b61061981610558565b811461062457600080fd5b50565b61063081610584565b811461063b57600080fd5b5056fea264697066735822122042b5e863d72b4e2a209cc382de51dd0ac5905182aeacfc64a8e2cc69254e388564736f6c63430008000033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.