Skip to content

This is an ERC20 implementation that prevents sandwich attacks (MEV) by implementing a 3 minute cooldown on all buys/transfers. There is a whitelist for Uniswap etc., allowing important contracts to bypass the cooldown. The contract owner sets the whitelist as needed.

License

Notifications You must be signed in to change notification settings

Gregory100000/MEV-Resistant-ERC20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

** MEV Resistant ERC20 (Short Cooldown) **

Summary

Everyone hates sandwich attacks, except for those attacking. This ERC20 contract greatly discourages them by implementing a 3 minute cooldown on all buys and transfers. A person will be unable to sell their coins for 3 minutes after buying or transferring.

Description

Since sandwich attacks are greatly reliant on speedy execution, the 3 minute cooldown will likely discourage them altogether. By the time the attacker can sell, their profit may have completely disappeared.

The built-in whitelist should be used to ensure that Uniswap etc. bypasses the cooldown. This can be done by calling addCooldownWhitelist by the contract owner.

For details, see MEVResistantERC20.sol, specifically the _beforeTokenTransfer and _afterTokenTransfer functions.

Forked from $APE.

Original Smart Contract: https://etherscan.io/address/0x4d224452801aced8b2f0aebe155379bb5d594381#code#F5#L1

How to Use

  1. Fork the code.
  2. Alter the cooldown as you desire. 3 minutes seemed sufficient to me, but perhaps you are satisfied with 1 minute.
  3. Add appropriate whitelists (i.e. Uniswap etc.) via the addCooldownWhitelist function (only the contract owner can do this).

About

This is an ERC20 implementation that prevents sandwich attacks (MEV) by implementing a 3 minute cooldown on all buys/transfers. There is a whitelist for Uniswap etc., allowing important contracts to bypass the cooldown. The contract owner sets the whitelist as needed.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published