Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Uniswapについて調べてみた
Search
YutaSugimura
May 17, 2019
Programming
440
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Uniswapについて調べてみた
YutaSugimura
May 17, 2019
More Decks by YutaSugimura
See All by YutaSugimura
IOST ハンズオン
yutasugimura
0
370
Other Decks in Programming
See All in Programming
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
140
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
200
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.2k
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
260
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
18
17k
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
410
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
300
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
260
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
160
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
690
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
190
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
The Curious Case for Waylosing
cassininazir
1
540
Building Flexible Design Systems
yeseniaperezcruz
330
41k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
450
Marketing to machines
jonoalderson
1
5.8k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
58k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Leo the Paperboy
mayatellez
10
2.3k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
How STYLIGHT went responsive
nonsquared
100
6.3k
Transcript
Uniswapͷ͓ @YutaSugimura ੀଜɹ༏ଠ
Enbowl inc. DEXͱ ࢄܕऔҾॴʢDEXʣͱɺ தԝཧऀΛհͣ͞ ݸਓؒͰ Ծ௨՟ͷަ͕Ͱ͖ΔऔҾॴͷ͜ͱ ex. Uniswap, KyberSwap,
DDEX, … (Decentralized Exchange)
Enbowl inc. Uniswap DeFiͰ4ҐͷϘϦϡʔϜ https://defipulse.com/
Enbowl inc. ɾಛఆͷೋऀؒͷަ͢Δ൘τϨʔυͰͳ͘ɺ ɹݻఆϨʔτͰͷଈ࣌ަΛఏڙ͢Δϓϩτίϧ ɾͦͷଞDEXʹൺͯऔҾʹ͔͔ΔΨε͕͍ ɾऔҾखྉ͕0.3% ɾྲྀಈੑఏڙ͢Δ͜ͱͰऔҾखྉͷҰ෦Λ֫ಘͰ͖Δ Uniswapͷಛ
Enbowl inc. Ψείετ͕͍҆ whitePaper: https://hackmd.io/s/HJ9jLsfTz ग़య:
Enbowl inc. Uniswap Contract ɾUniswap_exchange.vy ɾUniswap_factory.vy UniswapʹަՄೳͳτʔΫϯΛՃ͢Δػೳ τʔΫϯͷަྲྀಈੑఏڙ͢Δػೳ https://etherscan.io/address/0xc0a47dfe034b400b47bdad5fecda2621de6c4d95 https://etherscan.io/address/0xc0a47dfe034b400b47bdad5fecda2621de6c4d95
Exchange Factory ίϯτϥΫτͷߏ
Enbowl inc. factory Contract createExchange() Ճ͍ͨ͠ERC20τʔΫϯͷίϯτϥΫτΞυϨε ΛೖΕ࣮ͯߦ͢Δ͜ͱͰτʔΫϯΛՃ͞ΕΔ https://etherscan.io/accounts/label/uniswap ओʹΘΕΔؔ
Enbowl inc. Uniswap Contract ɾSwap ɾSend ɾPool ETH·ͨτʔΫϯΛଞͷτʔΫϯʹަ ETH·ͨτʔΫϯΛผͷΞυϨεʹૹۚ UniswapʹྲྀಈੑͷఏڙΛ͢Δػೳ
Exchange contract ͷߏ
Enbowl inc. Exchange Contract Swap ަՄೳͳίΠϯ 40छྨҎ্ ex. REP, DAI,
MKR, TUSD, ZRX, … Alice Alice 5ETH DAIʹަ 4ETH ɾETH => ERC20 ɾERC20 => ETH ɾERC20 => ERC20 3ͭͷަํ๏ʹରԠ 0DAI 250DAI 1ETHΛ
Enbowl inc. Exchange Contract Swap ethToTokenSwapInput() ethToTokenSwapOutput() tokenToEthSwapInput() tokenToEthSwapOutput() tokenToTokenSwapInput()
tokenToEthSwapOutput() ͦͷଞ ɾETH => ERC20 ɾERC20 => ETH ɾERC20 => ERC20 https://github.com/Uniswap/contracts-vyper/blob/master/contracts/uniswap_exchange.vy Uniswap contract ͜ΕΒͷؔΛͬͯަ͍ͯ͠Δ
Enbowl inc. Exchange Contract Send ETH => ERC20 ERC20 =>
ETH ERC20 => ERC20 ૹۚͷࡍʹτʔΫϯΛมͯ͠ૹۚ͢Δ͜ͱ͕Ͱ͖Δ Alice Bob 5ETH DAIʹަͯ͠ૹۚ 250DAI swapಉ༷ʹ3ͭͷૹۚʹରԠ 0DAI 1ETHΛ ॴ͍࣋ͯ͠ͳ͍τʔΫϯͷૹ͕ۚεϜʔζ https://github.com/Uniswap/contracts-vyper/blob/master/contracts/uniswap_exchange.vy Uniswap contract
Enbowl inc. Exchange Contract Transfer ETH => ERC20 ERC20 =>
ETH ERC20 => ERC20 ethToTokenTransferInput() tokenToEthTransferInput() tokenToTokenTransferInput() ෦తͰSwapͷ͕࣮ؔߦ͞Ε͓ͯΓɺडऔਓ͕ૹۚ૬खͷΞυϨεʹͳ͍ͬͯΔ ethToTokenTransferOutput() tokenToEthTransferOutput() tokenToEthTransferOutput() ͦͷଞ
Enbowl inc. Exchange Contract ྲྀಈੑͷఏڙ ࠷ॳʹྲྀಈੑΛఏڙ͢Δਓ͕Ձ֨Λઃఆ 5PLFOͱ 5PLFOͱಉྔͷ&5)ΛϩοΫ͢Δ Alice 1ETH
250DAI uniswapʹྲྀಈੑΛఏڙ 1ETH 250DAI uniswap ΑͬͯՁ͕֨ઃఆ͞ΕΔ ͦΕҎ߱ʹఏڙ͢ΔਓͦͷՁ֨ͰϩοΫ͍ͯ͘͠ ఏڙ͢Δ͜ͱͰखྉͷҰ෦ΛΒ͑Δ (0.3%ͷखྉ͔Βఏڙൺ)
Enbowl inc. Exchange Contract ɾྲྀಈੑͷఏڙ ɾaddLiquidity() ɾremoveLiquidity() ྲྀಈੑͷఏڙ ఏڙͷఫୀ ྲྀಈੑఏڙͷઆ໌লུ
Enbowl inc. Exchange Contract (Swap) (input_amount * 997) * output_reserve
(input_reserve * 1000) + (input_amount * 997) Tokens_bought = output_reserve = self.token.balanceOf(self) input_reserve = self.balance -msg.value input_amount = msg.value (Pool͕͍࣋ͬͯΔτʔΫϯྔ) (͜ͷϓʔϧ͕͍࣋ͬͯΔETHྔ) (ߪೖʹ༻͢ΔETHͷྔ) inputͷ߹ (outputͷ߹ҟͳΔ) ethToTokenSwapͷ߹
Enbowl inc. whitePaper: https://hackmd.io/s/HJ9jLsfTz ग़య: Exchange Contract
Enbowl inc. 45.35OMGʹަ token_Pool: eth_Pool: 10 500 ϓʔϧྔ invariant 5000
Exchange Contract Alice 1ETHͰ Bob 1ETHͰߪೖ ड͚औΓྔ 37.8 OMG ಉֹۚ͡Ͱങ͑Δྔ͕ݮΔ AliceߪೖޙBob͕1ETHͰOMGߪೖ͢Δ token_Pool: eth_Pool: 11 454.65 ϓʔϧྔ New invariant 5001.15
Enbowl inc. Exchange Contract 1000ഒͷPoolͩͱ 1ETHͰ49.84OMG token_Pool: eth_Pool: 10000 500000
ϓʔϧྔ Alice ड͚औΔ͜ͱ͕Ͱ͖ͨ ΑͬͯPool͞Ε͍ͯΔτʔΫϯͷྔ͕ଟ͍ͱՁ͕֨҆ఆ͢Δ
Enbowl inc. ΈΜͳτϨʔυԼख͔ͩΒUniswapʹྲྀಈੑΛఏڙ͠Α͏
Enbowl inc. Link https://uniswap.io https://hackmd.io/C-DvwDSfSxuh-Gd4WKE_ig White Paper Official IUUQTVOJTXBQFYDIBOHFTXBQ Exchange
GitHub https://github.com/Uniswap