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
Fall 2026: A Guide & Workshop on Using AI for Academic Paper Writing
ks91
PRO
0
35
FinTech 5-6 : The World of Apps
ks91
PRO
0
54
終わらない幼年期とそのための下部構造・社会資本 / The Never-Ending Childhood and the Infrastructure and Social Capital Needed to Support It
ks91
PRO
0
29
FinTech 3-4 : Internet Technology and Governance
ks91
PRO
0
72
2026 秋 生成AI を活用した論文執筆ガイド/ワークショップ / Fall 2026: Guide and Workshop on Writing Papers Using Generative AI
ks91
PRO
0
140
AIとビジネス・メガトレンド 〜 サイバネティクス的経営観 / AI and Business Megatrends: A Cybernetic Perspective on Management
ks91
PRO
0
43
FinTech 1-2 : Overview of FinTech
ks91
PRO
0
160
アカデミーキャンプ 2026秋「位置ゲーに秀でよ!ウチらとヤツらのゲーム・デザイン」DAY 4 / Academy Camp 2026 Fall - Excel at Location-Based Games! Our and Their Game Design DAY 4
ks91
PRO
0
65
アカデミーキャンプ 2026秋「位置ゲーに秀でよ!ウチらとヤツらのゲーム・デザイン」DAY 3 / Academy Camp 2026 Fall - Excel at Location-Based Games! Our and Their Game Design DAY 3
ks91
PRO
0
75
Other Decks in Technology
See All in Technology
10年後、Engineering 行為を剥奪されるとして、わたしたちは、どう、何を創ればいいだろうか。 / If Engineering Is Taken Away in 10 Years, How and What Should We Create?
bitkey
PRO
1
190
JAWSUG TOHOKU 青森支部 「LoGoチャット」のAWS移行で 乗り越えたこと
taketakekaho
0
330
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
3
1.1k
しろおびから始める!ログ活用の第一歩
shumei_ito
0
950
大型犬好きによるPugの紹介
yamanoku
1
160
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
280
AI時代のPRレビューにどう向き合うか?
kairim0
1
240
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
150
今さら理解するウェブフォントver.2026
takanorip
3
820
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
460
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
520
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Writing Fast Ruby
sferik
630
63k
Building Adaptive Systems
keathley
44
3.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Amusing Abliteration
ianozsvald
1
350
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
460
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
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