Share
Embed
Transcript
23 slides
-
ERC20 Ethereum Request for Comments: Token Standard #20
Ethereumベースのトークンに対する 統一された仕様 *暗号資産の名前ではない トークンとは?ERC20とは? https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md -
contract ERC20Interface { function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance); function allowance(address tokenOwner, address spender) public constant returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } トークンとは?ERC20とは? https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md -
ERC20を作ってみよう 1. 開発ツール Rimix(https://remix.ethereum.org)を開く 2. 右上の「+」から、ファイルを作成。 3. 作成したファイルにコードをコピペする a. https://github.com/Yosuke-Aramaki/erc20_contract/blob/master/ERC20_Openzeppelin.
4. 右のタブからSOLIDITY COMPILERに移動 a. 一番上の「COMPILER」を、コードの「pragma solidity ^0.0.0;」のバージョンと合わ せる。今回は「0.6.2」を選択 b. 「Compile」を押してコードをコンパイルする 5. 右のタブから「DEPLOY & RUN TRANSACTIONS」に移動 a. 「ENVIRONMENT」を「Injected Web3」に変更 b. 「Contract」が、コードの「contract」の名前と一致してることを確認 c. 「Deploy」でERC20を作成 -
①みんなで取引できるトークンを供給 Pool Uniswapとは? Pool 10ETH 100DAI x = 1000
交換の元手となるトークンをいれる 掛け算が常に一定になるようにする https://uniswap.org/docs/v2/protocol-overview/how-uniswap-works/ -
②それらのトークンを誰でも交換できる Swap Uniswapとは? Swap 10DAI 100ETH x = 1000
11DAI 90ETH x ≒ 1000 ・ ・ ・ 10DAI/ETH 8.2DAI/ETH https://uniswap.org/docs/v2/protocol-overview/how-uniswap-works/ -
②それらのトークンを誰でも交換できる Swap Uniswapとは? Swap 1. 10DAIをETHで交換したい! 2. x *
y = K 3. x ETH * 90DAI = 1000 4. x * 90 = 1000 5. x = 11.111 6. 11 ETH * 90 DAI ≒ 1000 7. 1ETH(11-10)をPoolに入れる 8. 10DAIをGet * トークンを供給した人に取引量の0.3%の手数料 https://uniswap.org/docs/v2/protocol-overview/how-uniswap-works/