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
スマートコントラクトと分散ファイナンス / Smart Contracts and Decen...
Search
Kenji Saito
PRO
June 26, 2023
Technology
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
スマートコントラクトと分散ファイナンス / Smart Contracts and Decentralized Finance
早稲田大学大学院経営管理研究科「フィンテック ─ 金融革新とインターネット」2023 夏クォーターの第7-8回で使用したスライドです。
Kenji Saito
PRO
June 26, 2023
More Decks by Kenji Saito
See All by Kenji Saito
アカデミーキャンプ 2026秋「位置ゲーに秀でよ!ウチらとヤツらのゲーム・デザイン」DAY 4 / Academy Camp 2026 Fall - Excel at Location-Based Games! Our and Their Game Design DAY 4
ks91
PRO
0
24
アカデミーキャンプ 2026秋「位置ゲーに秀でよ!ウチらとヤツらのゲーム・デザイン」DAY 3 / Academy Camp 2026 Fall - Excel at Location-Based Games! Our and Their Game Design DAY 3
ks91
PRO
0
46
アカデミーキャンプ 2026秋「位置ゲーに秀でよ!ウチらとヤツらのゲーム・デザイン」DAY 2 / Academy Camp 2026 Fall - Excel at Location-Based Games! Our and Their Game Design DAY 2
ks91
PRO
0
92
アカデミーキャンプ 2026秋「位置ゲーに秀でよ!ウチらとヤツらのゲーム・デザイン」DAY 1 / Academy Camp 2026 Fall - Excel at Location-Based Games! Our and Their Game Design DAY 1
ks91
PRO
0
41
責任2.0/3.0 ∼ 知的創造過程の脱領土化 / Responsibility 2.0 and 3.0: The Deterritorialization of the Intellectual Creative Process
ks91
PRO
0
41
国と地域のマネジメントと AGI / National and Regional Management and AGI
ks91
PRO
0
27
2026 年度「AI による研究・教育サポート」ワークショップ (教員向け) / AY 2026 “AI-Based Research and Education Support” Workshop (For Faculty)
ks91
PRO
0
66
エージェント化するAI:現在地とその先に起きる変化 / AI as Agents: The Current State and the Changes Ahead
ks91
PRO
0
220
文化的ループ (推論, エージェント) と思考プロセスの検証可能性 / Cultural Loops (Inference, Agents) and the Verifiability of Thought Processes
ks91
PRO
0
51
Other Decks in Technology
See All in Technology
Genieを崇めよ
kameitomohiro
0
170
「今盗んで、後で解く」に備える ― AWSのポスト量子暗号入門
yama3133
1
200
AI時代、データエンジニアが一番おもろい
genshun9
0
690
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
2
20k
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
760
Antigravity SDK for the Java Developer
glaforge
0
190
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
180
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
140
What the customer really needed
kawaguti
PRO
3
220
時うどん〜Socket.getifaddrsで学ぶネットワーク編 / Tokiudon: The Socket.getifaddrs Edition
coe401_
4
260
C#未経験の僕がAIに読めるコードを書かせるまで
maguroalternative
0
260
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
570
Featured
See All Featured
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
260
Statistics for Hackers
jakevdp
799
230k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
670
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
410
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
A designer walks into a library…
pauljervisheath
211
25k
Music & Morning Musume
bryan
48
7.4k
Building Applications with DynamoDB
mza
96
7.2k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Accessibility Awareness
sabderemane
1
220
Transcript
Financial technology on the street. Generated by Stable Diffusion XL
Beta — 2023 7-8 (WBS) — 2023 7-8 — 2023-06-26 – p.1/78
https://speakerdeck.com/ks91 — 2023 7-8 — 2023-06-26 – p.2/78
( ) 1 6 5 (1) • 2 6 5
(2) • 3 6 12 Web3 (1) • 4 6 12 Web3 (2) • 5 6 19 (1) • 6 6 19 (2) • 7 6 26 (1) • 8 6 26 (2) • 9 7 3 (1) 10 7 3 (2) 11 7 10 (1) 12 7 10 (2) 13 7 24 (1) 14 7 24 (2) 12 — 2023 7-8 — 2023-06-26 – p.3/78
( 20 ) 1 2 3 4 (TCP/IP ) 5
6 7 8 9 10 World Wide Web 11 Web API 12 13 git GitHub 14 (6/19 ) / (2 ) OK / — 2023 7-8 — 2023-06-26 – p.4/78
( ) Web3 (1) — Web3 (2) — — 2023
7-8 — 2023-06-26 – p.5/78
( ) Ethereum Ethereum ← (DeFi) ( ) — 2023
7-8 — 2023-06-26 – p.6/78
— 2023 7-8 — 2023-06-26 – p.7/78
Bitcoin ϏοτίΠϯωοτϫʔΫ ɾ ճͷʮ࠾۷ʯྔ ຖʹݮ ɾ߹ܭ ສ
#5$ ·Ͱ औҾͷొ खྉ खྉ औҾͷঝೝ ϚΠχϯά࣌ ϚΠχϯά ࠾۷ ֬తաఔ ฏۉ ͓͖ʹޭ ૹۚࢦ֤͕ࣔࣗͭ ϓϥΠϕʔτΩʔͰ ແͨ͘͠Β࠶ൃߦෆՄ ϚΠφʔ ࠾۷ऀ ࢧ͍ɾ྆ସ ͳͲͷܦࡁ׆ಈ ར༻ऀ ϒϩοΫνΣʔϯ ݩா Πϯλʔωοτ্ͷԾωοτϫʔΫ ʜ ˞#5$ϏοτίΠϯͷ୯Ґ #5$ ରԠ ϒϩοΫ ϒϩοΫ ϒϩοΫ औҾ ૹۚ औҾͷه ΞυϨε Ѽઌ ϓϥΠϕʔτΩʔ ຊਓͷূ໌ — 2023 7-8 — 2023-06-26 – p.8/78
— 2023 7-8 — 2023-06-26 – p.9/78
(Bitcoin ) ϒϩοΫ൪߸O ϒϩοΫ൪߸O ϒϩοΫ൪߸O ϒϩοΫ൪߸O ϒϩοΫ൪߸O
ϒϩοΫ൪߸O ϒϩοΫ൪߸O ϒϩοΫ൪߸O ͍ͪΜهɾॻ͖͑ͷίετ͕ߴ͍ྺ࢙ ࠷վ͟Μ͠ʹ͍͘ྺ࢙ ͕༗ޮ ͻͱͭखલͷϒϩοΫͷ ʮμΠδΣετʯ σδλϧॺ໊͞Εͨ ʮτϥϯβΫγϣϯ औҾ ʯ ϒϩοΫΛ࡞ΔͨΊʹɺͦͷʮμΠδΣετʯ͕͋ΔҎԼͱ͍͏݅Λຬͨͨ͠Γ 1SPPGPG8PSL Ծ௨՟ͷ࣋ͪʹԠͨ͡ݖརΛͬͨථͰউͬͨΓ 1SPPGPG4UBLF ͢Δඞཁ͕͋Δ ίετ͕͔͔Δ ϒϩοΫΛ࡞ΔਓͦͷதʹࣗʹѼͯͨ Ծ௨՟ͰͷใुΛॻ͖ࠐΉ͜ͱ͕Ͱ͖ɺ ͦͷϒϩοΫ͕༗ޮͳྺ࢙ͷதʹ͋Δ߹ʹ ݶΓใु༗ޮͱͳΔ τϥϯβΫγϣϯͷଘࡏΛ֬ೝ͢Δ ͨΊͷޮతͳํ๏͕ఏڙ͞ΕΔ ਖ਼ੑ ଘࡏੑ །Ұੑ Proof of Work ( ) (Proof of Stake ) . . . → — 2023 7-8 — 2023-06-26 – p.10/78
∼ UTXO (= ) → UTXO : (= ); Unspent
TX(Transaction) Output — 2023 7-8 — 2023-06-26 – p.11/78
∼ ท൪߸O ท൪߸O ท൪߸O લทͷμΠδΣετ λʔήοτҎԼͰͳ͍ͱ͍͚ͳ͍ Έͩ͠ίʔφʔ μΠδΣετ͕λʔήοτҎԼʹͳΔΑ͏ʹೖΕΔదͳ༰
( ) → — 2023 7-8 — 2023-06-26 – p.12/78
∼ ϖʔδ൪߸O ϖʔδ൪߸O ϖʔδ൪߸O ϖʔδ൪߸O ϖʔδ൪߸O
ϖʔδ൪߸O ϖʔδ൪߸O ϖʔδ൪߸O ͬͪ͜ͷྺ࢙͕༗ޮ ( (= ) ) — 2023 7-8 — 2023-06-26 – p.13/78
0 and/or Bitcoin “The Times 03/Jan/2009 Chancellor on brink of
second bailout for banks” 2009 1 3 2 https://www.blockchain.com/explorer 0 BTC Block “Hex to ASCII Text Converter” — 2023 7-8 — 2023-06-26 – p.14/78
: ( ( ) ) ( ) — 2023 7-8
— 2023-06-26 – p.15/78
(Hyperledger (Linux Foundation) ) ( ) ( ) ( )
( ) IoT / / ( , ) — 2023 7-8 — 2023-06-26 – p.16/78
: Bitcoin . . . : Proof of Existence, Everledger,
. . . ( ) ( ) / × = ( ) NFT (Non Fungible Token) — 2023 7-8 — 2023-06-26 – p.17/78
( ) จ ॻ จ ॻ จ ॻ
จ ॻ จ ॻ O μΠδΣετ μΠδΣετ μΠδΣετ μΠδΣετ μΠδΣετ μΠδΣετ μΠδΣετ حͷ߹ ෳ͢Δ ɾจॻ ΛಘͨΫϥΠΞϯτɺಉ࣌ʹূ໌ཁૉͱͯ͠ɺϒϧʔͰࣔ͞ΕΔμΠδΣετͱ֤ʑ͕ࠨӈͷͲͪΒʹҐஔ͢Δ͔Λड͚औΔɻ ɾΫϥΠΞϯτจॻ ͷμΠδΣετ͔Β࢝Ίͯɺ࿈͖݁͢Ұ࿈ͷμΠδΣετΛΔ͜ͱʹͳΔͷͰɺϚʔΫϧϧʔτʹࢸΔ·Ͱͷ ɹܭࢉΛ࠶ݱͰ͖ɺಘΒΕͨϚʔΫϧϧʔτ͕ϒϩοΫνΣʔϯʹه͞Ε͍ͯΔͱҰக͢Δ͜ͱΛ֬ೝͰ͖Δɻ ɾͦͷܭࢉݪཧͷཧղͱඞཁͳใ͕͋Ε୭Ͱ࠶ݱͰ͖Δ จॻ ͷଘࡏͱͦͷ༰ূ໌͞ΕΔɻ ˞μΠδΣετݩͷσʔλ͕ ɹϏοτͰҟͳΔͱશ͘ҟͳΔ ɹͱͳΓɺ·ͨɺμΠδΣετ ɹ͔ΒݩͷσʔλΛਪଌ͢Δ͜ͱ ɹͰ͖ͳ͍ɻ ˞ઍɾສͷจॻΛϚʔΫϧʹͯ͠ ɹͦͷͷߴ͞ߴʑʙ ఔ ه͢Δ ಡΈग़ͤΔ ূ໌Λ ඞཁͱ͢Δऀʹ ։ࣔ͞ΕΔใ ެ։͞ΕΔใ ϚʔΫϧϧʔτ Ϛ ồ Ϋ ϧ γ ε ς Ϝ ͕ อ ͠ ֤ Ϣ ồ β ʹ ෦ త ʹ ͑ Δ ʜʜ ʜʜ ʜʜ ʜʜ ʜʜ μΠδΣετ μΠδΣετ μΠδΣετ μΠδΣετ μΠδΣετ μΠδΣετ ϒϩοΫνΣʔϯ ʜ ʜ — 2023 7-8 — 2023-06-26 – p.18/78
: ⇒ LINE → → ( ) ( ) ⇒
( ) → → → . . . — 2023 7-8 — 2023-06-26 – p.19/78
— 2023 7-8 — 2023-06-26 – p.20/78
(2009 1 ∼2023 6 ) 2 → 2 2 →
→ — 2023 7-8 — 2023-06-26 – p.21/78
10 ATM 1 ATM 1 : http://www.slideshare.net/yamaz2/ss-58813038 ⇒ ( (
) ) — 2023 7-8 — 2023-06-26 – p.22/78
— 2023 7-8 — 2023-06-26 – p.23/78
The DAO ( ) Ethereum The DAO Split ( )
360 ETH (50∼60 ) (2016/6/17) ( ) ( ; ) (2016/7/20 ) — 2023 7-8 — 2023-06-26 – p.24/78
( ) ( ) ( vs. ) ( ) (
) ( ) ⇒ ( : BBc-1, BBc-2) : : — 2023 7-8 — 2023-06-26 – p.25/78
: SF — 2023 7-8 — 2023-06-26 – p.26/78
3. SF Web3 2023 6 22 ( ) 23:59 JST
( ) Waseda Moodle — 2023 7-8 — 2023-06-26 – p.27/78
. . . . . . 37 30 (6/24( )
) ( ) SF ( ) (17) / (4) / (4) / ( ) (2) / (2) / (1) ( ) (19) / (5) / (3) / (1) / (1) / (1) — 2023 7-8 — 2023-06-26 – p.28/78
Y : EduContract 1 : EduContract Proof of Learning 2
: 3 3 : EduContract 4 : AI EduContract — 2023 7-8 — 2023-06-26 – p.29/78
Y — 5 : 6 : EduContract : : ⇒
= — 2023 7-8 — 2023-06-26 – p.30/78
N 20xx Gas Gas ⇒ — 2023 7-8 — 2023-06-26
– p.31/78
O ⇒ — 2023 7-8 — 2023-06-26 – p.32/78
F NFT ⇒ gas — 2023 7-8 — 2023-06-26 –
p.33/78
T 1 gas ID ⇒ gas ETH gas ( (
) + ( )) gas ETH ETH ETH — 2023 7-8 — 2023-06-26 – p.34/78
C ChatGPT ⇒ ( ) GPT-4 : OpenAI. 2023. “GPT-4
Technical Report”. Available at: https://doi.org/10.48550/arXiv.2303.08774. p.8 Figure 5 — 2023 7-8 — 2023-06-26 – p.35/78
C NFT Gas Price gwei JPY USD ⇒ https://www.cryps.info/ja/Gwei_ _JPY/
1 Gwei 0.00027071 JPY NFT 1,834,415 gas https://etherscan.io/gastracker gas 15 Gwei 1,834,415 (gas) × 15 (Gwei/gas) × 0.00027071 (JPY/Gwei) ≃ 7,449 JPY — 2023 7-8 — 2023-06-26 – p.36/78
N ⇒ . . . — 2023 7-8 — 2023-06-26
– p.37/78
K ⇒ ( ) ( ) ( ; ) —
2023 7-8 — 2023-06-26 – p.38/78
Ethereum Ethereum ( ) — 2023 7-8 — 2023-06-26 –
p.39/78
— 2023 7-8 — 2023-06-26 – p.40/78
Ethereum · → · → · → — 2023 7-8
— 2023-06-26 – p.41/78
↑ — 2023 7-8 — 2023-06-26 – p.42/78
(by ) 1. 2. ( ) ( ) . .
. cf. by McLuhan cf. by McLuhan → — 2023 7-8 — 2023-06-26 – p.43/78
by ⇒ ⇒ — 2023 7-8 — 2023-06-26 – p.44/78
by SNS AI AI ⇒ ( ) ⇒ — 2023
7-8 — 2023-06-26 – p.45/78
Ethereum EVM (Ethereum Virtual Machine) — 2023 7-8 — 2023-06-26
– p.46/78
Ethereum Vitalik Buterin, “Ethereum White Paper: A NEXT GENERATION SMART
CONTRACT & DECENTRALIZED APPLICATION PLATFORM” (Dec. 2013∼) 12 ( ) (= ) = = ( ) CPU ⇒ DApps DApps = / — 2023 7-8 — 2023-06-26 – p.47/78
= ( ) run = → — 2023 7-8 —
2023-06-26 – p.48/78
[Lamport 1984][Schneider 1990] ( ) (1) 0 ( ) (2)
(3) (4) ( ) ← — 2023 7-8 — 2023-06-26 – p.49/78
Ether (ETH) Ethereum EOA : Externally-Owned Account ( ) (
) ( ) ( ) ← Ether ( ) EVM EVM = Ethereum = — 2023 7-8 — 2023-06-26 – p.50/78
EVM : Ethereum Virtual Machine ঢ়ଶ ֎෦ΞΫλʔ ΞΧϯτ &7. ίʔυ
&UIFSˠ(BT ىಈ ίϯτϥΫτ ϝοηʔδ͔ɺ৽͍ࣗ͠ಈΦϒδΣΫτ ΞΧϯτؒͰΓऔΓ͞ΕΔσʔλ&UIFS ετϨʔδ ঢ়ଶ` τϥϯβΫγϣϯ ηοτ σδλϧॺ໊ &7. ਓؒͱ͔ ࣗಈ ΦϒδΣΫτ ( ) Gas ( EVM = ( burn)) — 2023 7-8 — 2023-06-26 – p.51/78
/ / (1) Ethereum Bitcoin ( OK) 1 — 2023
7-8 — 2023-06-26 – p.52/78
/ / (2) 3 ( ) · ( ) (
) 1 — 2023 7-8 — 2023-06-26 – p.53/78
/ / (3) ( ) ( ) 1 ( )
1,500 3,000 Ethereum 2022 9 — 2023 7-8 — 2023-06-26 – p.54/78
/ / (4) Gwei Gwei ETH 32 ETH ( )
ETH ETH · 32 ETH ( OK) · 16 ETH ( ) 12 ( ) ( ) 1 — 2023 7-8 — 2023-06-26 – p.55/78
/ / (5) 32 1 (384 ) ( ) (
) 2 3 ( ) 256 512 — 2023 7-8 — 2023-06-26 – p.56/78
/ / (6) ( ) 5 2 3 (36 )
— 2023 7-8 — 2023-06-26 – p.57/78
/ / (7) ( ) ( ) DAO (RANDAO) 1
— 2023 7-8 — 2023-06-26 – p.58/78
Ethereum ߹ҙ͞Εͨཤྺ ϩʔΧϧʹෳΛҡ࣋
ϒϩοΫ εϩοτ ඵִؒ εϩοτͰ ΤϙοΫ ҉߸ֶతμΠδΣετ ϒϩοΫνΣʔϯͷҡ࣋ࢀՃऀ͕ϩʔΧϧʹཧ͢Δσʔλۭؒ ࣌ؒ ΑΓ৽͍͠ه ΦϒδΣΫτ τʔΫϯγεςϜͷεϚʔτίϯτϥΫτ ֤Ϣʔβͷ ߴͷঢ়ଶ ঢ়ଶ` ঢ়ଶ`` τϥϯβΫγϣϯ ΦϒδΣΫτͷੜ ·ͨঢ়ଶભҠͷࢦࣔ ແޮͳཤྺ ω ỽ τ ϫ ồ Ϋ Λ ௨ ͠ ͯ ૹ ड ৴ ͞ Ε Δ ϩ ồ Χ ϧ ʹ ࣋ ͭ ܨ͙ͨΊʹ&5) Ͱͷσϙδοτͱ σϙδοτ૯ֹͷ ♤ ૬ͷϢʔβʹΑΔ ΤϙοΫͷূݴ͕ඞཁ શΦϒδΣΫτͷભҠޙͷঢ়ଶ ͕ϋογϡ˞ʹू͞Ε ͦͷ ϧʔτ͕ϒϩοΫʹॻ͔ΕΔ ঢ়ଶભҠ ˞ϋογϡσʔλ܈ͷ҉߸ֶతμΠδΣετ ϋογϡ ɹΛߏʹදݱͨ͠ͷͰ ෆ߹ͷݕग़ʹ༻͍ΒΕΔ ETH ( ) ⇒ ETH = Ethereum Virtual Machine (EVM) 2 3 ETH ⇒ ETH — 2023 7-8 — 2023-06-26 – p.59/78
Ethereum (ex. ) (ex. ) ⇒ → — 2023 7-8
— 2023-06-26 – p.60/78
— 2023 7-8 — 2023-06-26 – p.61/78
ERC-20 ERC (Ethereum Request for Comments) 20 https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md (EIP: Ethereum
Improvement Proposal) ← EIP ( ) contract ERC20 { function totalSupply() constant returns (uint totalSupply); function balanceOf(address _owner) constant returns (uint balance); function transfer(address _to, uint _value) returns (bool success); function transferFrom(address _from, address _to, uint _value) returns (bool success); function approve(address _spender, uint _value) returns (bool success); function allowance(address _owner, address _spender) constant returns (uint remaining); event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); } name/ , symbol/ , decimals/ approve allowance ERC-777 ( ) — 2023 7-8 — 2023-06-26 – p.62/78
ERC-20 ERC-20 ← ( ) ( ) ⇒ ERC-20 (
ERC-20 ) ERC-20 ⇒ — 2023 7-8 — 2023-06-26 – p.63/78
(fungible) ERC-20 → ERC-223 (draft) or ERC-777 ( )( )
(non-fungible) ERC-721 ( ) ( ) ERC-1155 ( ) ERC-3525 (SLOT ) — 2023 7-8 — 2023-06-26 – p.64/78
— τʔΫϯ ସ՟ฎ εϚʔτίϯτϥΫτ ݕূՄೳͳঢ়ଶϚγϯ ϓϩϏφϯε དྷྺূ໌ ସՄೳ ঈؐෆೳ
ସՄೳ ঈؐՄೳ ସෆೳ ঈؐՄೳ ସෆೳ ঈؐෆೳ ূ໌͢Δ ಉఆ͢Δ ࢧ͍ ࠷ॳͷԠ༻ *%Χʔυ ηΩϡϦςΟ τʔΫϯ ূ݊ ηϯαʔ ྲྀɾ Ҩݴॻ อݥਃ ͢Δ ײ͢Δ தԝۜߦ σδλϧ௨՟ ҭήʔϜ ൿີ伴Λ͑Δ͔Βຊਓʁ ෛ࠴ Ξηοτͷ දݱΛҠసͰ͖Δʁ ొ͞Εͨίʔυͱ ͦͷ࣮ߦϩάͱ݁Ռͷ ਅਖ਼ੑΛ୲อͰ͖Δʁ ݖҖ͕ Կ͔ͷ༰Λূ໌͢Δʁ ࣋ଓ͢Δଘࡏʹ͍ͭͯ هΛΞοϓσʔτՄʁ ओମ͕͍ͳ͘ͳͬͯ աڈͷσʔλ༗ޮʁ /'5 Ұൠతͳ ೝࣝ ػೳͷ ੳ݁Ռ — 2023 7-8 — 2023-06-26 – p.65/78
— 2023 7-8 — 2023-06-26 – p.66/78
transfer settle, retrieve asset, retrieve token 3 — 2023 7-8
— 2023-06-26 – p.67/78
( ( )) ( ) / / — 2023 7-8
— 2023-06-26 – p.68/78
— 1. ( ) 2. ( ) 3. ( )
— 2023 7-8 — 2023-06-26 – p.69/78
token (ERC-20 ) $ brownie bake token GitHub git clone
$ git clone https://github.com/ks91/sample-smart-contracts.git sample-smart-contracts contracts, scripts tests token Token — 2023 7-8 — 2023-06-26 – p.70/78
OneTimeEscrow settle() function settle() public returns (bool) { require(_token_.balanceOf(address(this)) >=
_price_); /* this */ require(_asset_.getOwner() == address(this)); _token_.transfer(_seller_ , _price_); _asset_.transfer(_buyer_); emit Settled(); /* */ return true; } settle() transfer $ brownie compile — 2023 7-8 — 2023-06-26 – p.71/78
(1) from brownie import * import pytest seller = accounts[0]
buyer = accounts[1] def test_deploy_and_settle(Token, IndivisibleAsset, OneTimeEscrow): asset = accounts[0].deploy(IndivisibleAsset, "5322 Endo", "mˆ2", 300) token = accounts[0].deploy(Token, "Test Token", "TEST", 18, "1000 ether") — 2023 7-8 — 2023-06-26 – p.72/78
(2) token.transfer(buyer, 300, {’from’: accounts[0]}) escrow = accounts[0].deploy(OneTimeEscrow, token, buyer,
asset, seller, 300) accounts[0]/seller accounts[1]/buyer 300 300 TX buyer seller 300 bake Token 300 ETH wei — 2023 7-8 — 2023-06-26 – p.73/78
(3) token.transfer(escrow, 300, {’from’: buyer}) asset.transfer(escrow, {’from’: seller}) assert token.balanceOf(seller)
== 999999999999999999700 assert token.balanceOf(buyer) == 0 assert token.balanceOf(escrow) == 300 assert asset.getOwner() == escrow buyer ( ) 300 seller ( ) — 2023 7-8 — 2023-06-26 – p.74/78
(4) escrow.settle({’from’: seller}) assert token.balanceOf(seller) == 1000000000000000000000 assert token.balanceOf(buyer) ==
0 assert token.balanceOf(escrow) == 0 assert asset.getOwner() == buyer settle() seller OK — 2023 7-8 — 2023-06-26 – p.75/78
— 2023 7-8 — 2023-06-26 – p.76/78
4. × OK Web3 2023 6 30 ( ) 23:59
JST ( ) Waseda Moodle — 2023 7-8 — 2023-06-26 – p.77/78
— 2023 7-8 — 2023-06-26 – p.78/78