PinkAntiBot Contract Address:
- MAINNET: 0xf4f071EB637b64fC78C9eA87DaCE4445D119CA35
- BSC: 0x8EFDb3b642eb2a20607ffe0A56CFefF6a95Df002
- BSC_TESTNET: 0xbb06F5C7689eA93d9DeACCf4aF8546C4Fe0Bf1E5
- MATIC: 0x56a79881b65B03F27b088B753B6c128485642FC3
- KCC_MAINNET: 0x2A7F08C820f3382D38B855ba59ad26444938a2b5
- AVAX: 0x18F349aD12d7d7f029B3b22e0B01c6D88a0D2066
- FTM: 0xcA461AcF6A9E68FA6D53410eba43cefde7dF5466
- CRONOS: 0x785A195F7b6a0dDaf7E41EBcBddE7a98F4Cb24A9
PinkAntiBot integration guide
- Add this interface to your codebase:
IPinkAntiBot.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface IPinkAntiBot {
function setTokenOwner(address owner) external;
function onPreTransferCheck(
address from,
address to,
uint256 amount
) external;
}
- Update your token contract:
+import "path/to/IPinkAntiBot.sol";
contract MyToken {
+ IPinkAntiBot public pinkAntiBot;
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 totalSupply_,
+ address pinkAntiBot_
) {
... omitted for clarity
// Create an instance of the PinkAntiBot variable from the provided address
+ pinkAntiBot = IPinkAntiBot(pinkAntiBot_);
// Register the deployer to be the token owner with PinkAntiBot. You can
// later change the token owner in the PinkAntiBot contract
+ pinkAntiBot.setTokenOwner(msg.sender);
}
// Inside ERC20's _transfer function:
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
+ pinkAntiBot.onPreTransferCheck(sender, recipient, amount);
}
}
- Visit https://www.pinksale.finance/#/antibot, update your settings. After that please enable Pink Anti-Bot (Pay 1 BNB fee at first time)
- (Optional): If you want more control over how
PinkAntiBot
is enabled or disabled, you can do it inside your contract instead of relying onPinkAntiBot
contract's configuration:
import "path/to/IPinkAntiBot.sol";
contract MyToken {
IPinkAntiBot public pinkAntiBot;
+ bool public antiBotEnabled;
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 totalSupply_,
address pinkAntiBot_
) {
... omitted for clarity
// Create an instance of the PinkAntiBot variable from the provided address
pinkAntiBot = IPinkAntiBot(pinkAntiBot_);
// Register the deployer to be the token owner with PinkAntiBot. You can
// later change the token owner in the PinkAntiBot contract
pinkAntiBot.setTokenOwner(msg.sender);
+ antiBotEnabled = true;
}
// Use this function to control whether to use PinkAntiBot or not instead
// of managing this in the PinkAntiBot contract
+ function setEnableAntiBot(bool _enable) external onlyOwner {
+ antiBotEnabled = _enable;
+ }
// Inside ERC20's _transfer function:
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
// Only use PinkAntiBot if this state is true
+ if (antiBotEnabled) {
pinkAntiBot.onPreTransferCheck(sender, recipient, amount);
+ }
}
}