Skip to content

๐Ÿ“š์ง€์‹ ๊ณต์œ  ํ•™์Šต ํ”Œ๋žซํผ : ํ•˜๋ธŒ๋ฃจํƒ€ DAO

Notifications You must be signed in to change notification settings

thyoondev/HavrutaDAO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

์ง€์‹ ๊ณต์œ  ํ•™์Šต ํ”Œ๋žซํผ : ํ•˜๋ธŒ๋ฃจํƒ€ DAO

  • ๋ธ”๋ก์ฒด์ธ ๊ธฐ์ˆ  ๊ธฐ๋ฐ˜ ํ† ํฐ ์ด์ฝ”๋…ธ๋ฏธ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์ง€์†๊ฐ€๋Šฅํ•œ ์„ ์ˆœํ™˜ ์ง€์‹๊ณต์œ  ํ•™์Šต ํ”Œ๋žซํผ์„ ๊ตฌ์ถ•
  • ๋ฏผ์ฃผ์  ๋ฐฉ์‹์˜ ์ปค๋ฎค๋‹ˆํ‹ฐ ํ™œ๋™์„ ํ†ตํ•ด์„œ ํ”Œ๋žซํผ ์ฐธ์—ฌ์ž๋“ค์ด ๋‹น๋ฉดํ•œ ๊ต์œก๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ธ”๋ก์ฒด์ธ ๊ธฐ๋ฐ˜ ํƒˆ์ค‘์•™ ๊ต์œก ์ฝ˜ํ…์ธ  ํ”Œ๋žซํผ

MVC์˜ ๊ตฌ์ถ•

  • MVC๋Š” Minimum Viable Community์˜ ์•ฝ์ž๋กœ ์ปค๋ฎค๋‹ˆํ‹ฐ ์ƒ์„ฑ์„ ์œ„ํ•ด ํ•„์š”ํ•œ ์ตœ์†Œ ๊ทธ๋ฃน(์œ ์ €)
  • MVC์˜ ์ดˆ๊ธฐ ๊ตฌ์ถ•์„ ํ†ตํ•ด์„œ ์œ ์ €์˜ ๋‹ˆ์ฆˆ๋ฅผ ๋น ๋ฅด๊ฒŒ ํŒŒ์•…ํ•˜์—ฌ ๋น ๋ฅธ ํ™•์žฅ์„ ๋„๋ชจํ•จ.
  • MVC๋Š” ๋ฆฌ์†Œ์Šค๊ฐ€ ์ ๊ฒŒ๋“œ๋Š” ์žฅ์ ์ด ์žˆ์Œ.

๋ฐฑ์„œ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO ๋ฐฑ์„œ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋ฐฐํฌ ์ฃผ์†Œ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO ์›น์‚ฌ์ดํŠธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO ๋ฐœํ‘œ ์˜์ƒ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO ๋ฐœํ‘œ ์˜์ƒ

  • ์ด๋ฏธ์ง€ ํด๋ฆญ ์‹œ ์œ ํŠœ๋ธŒ๋กœ ์ด๋™

ํ•˜๋ธŒ๋ฃจํƒ€ DAO ์‹œ์—ฐ ์˜์ƒ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO ์‹œ์—ฐ ์˜์ƒ

  • ์ด๋ฏธ์ง€ ํด๋ฆญ ์‹œ ์œ ํŠœ๋ธŒ๋กœ ์ด๋™

ํ•˜๋ธŒ๋ฃจํƒ€ DAO์˜ ํ† ํฐ ์ด์ฝ”๋…ธ๋ฏธ

image <ํ•˜๋ธŒ๋ฃจํƒ€ DAO ํ† ํฐ ์ด์ฝ”๋…ธ๋ฏธ ๊ตฌ์กฐ>

ํ† ํฐ์˜ ๋ณด์ƒ ์ฒด๊ณ„

  • ์œ ์ €๋“ค์—๊ฒŒ ๊ณตํ‰ํ•œ ํ† ํฐ ๋ณด์ƒ์„ ์œ„ํ•ด ํˆฌํ‘œ ํ”„๋กœ์„ธ์Šค๋ฅผ ํ†ตํ•ด ๊ณตํ‰ํ•œ ์ฐธ์—ฌ์˜ ๊ธฐํšŒ ๋ณด์žฅ
  • ์ฒซ๋ฒˆ์งธ ๋‹จ๊ณ„, ์‚ฌ์šฉ์ž๋“ค์˜ ์ฐธ์—ฌ๋„์— ๋”ฐ๋ผ ๋งค์ผ ๊ณ ์ •๋œ ํ™”ํ ๋ถ„๋ฐฐ ๊ธˆ์•ก์„ ๊ฒฐ์ •
  • ๋‘๋ฒˆ์งธ ๋‹จ๊ณ„, ์ง€์†๊ฐ€๋Šฅํ•œ ์ฐธ์—ฌ๋ฅผ ๋†’์ด๊ธฐ ์œ„ํ•ด ์ฝ˜ํ…์ธ  ์ƒ์„ฑ๊ณผ ํ‰๊ฐ€ ๋ณด์ƒ์˜ ์œ ๊ธฐ์ ์ธ ์ฒด๊ณ„๋ฅผ ๊ตฌ์„ฑ

์ง€์†๊ฐ€๋Šฅํ•œ ํ•˜๋ธŒ๋ฃจํƒ€ DAO์˜ ์ƒํƒœ๊ณ„

(1) ์ปค๋ฎค๋‹ˆํ‹ฐ ํ™œ๋™์— ์ฐธ์—ฌ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO์˜ ์‚ฌ์šฉ์ž๋Š” ์ปค๋ฎค๋‹ˆํ‹ฐ ํ™œ๋™์„ ํ†ตํ•ด์„œ ํ† ํฐ์„ ๋ณด์ƒ ๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค. ํ† ํฐ ๋ณด์ƒ์˜ ๋น„์œจ์€ ํ•˜๋ฃจ ๋™์•ˆ ์ฐธ์—ฌํ•œ ์ปค๋ฎค๋‹ˆํ‹ฐ ์ฐธ์—ฌ๋„์— ๋น„๋ก€ํ•˜๋ฉฐ ์•„๋ž˜ ๊ณต์‹๊ณผ ๊ฐ™๋‹ค.

image

  • Parameter a: ๊ธ€ ์ž‘์„ฑ ์ˆ˜
  • Parameter c: ๋Œ“๊ธ€ ์ž‘์„ฑ ์ˆ˜
  • Parameter l: ์ข‹์•„์š” ํ™œ๋™ ์ˆ˜

(2) ๊ฐ•์˜ ์ฝ˜ํ…์ธ  ์ œ์ž‘ ํ™œ๋™

๊ฐ•์˜ ์ฝ˜ํ…์ธ  ์ œ์ž‘์„ ์‹œ์ž‘ํ•˜๋ ค๋ฉด ๋จผ์ € ์ผ์ • ์ˆ˜๋Ÿ‰์˜ ํ† ํฐ์„ ์ง€๋ถˆํ•˜์—ฌ ์ฝ˜ํ…์ธ  ์ œ์ž‘์— ๋Œ€ํ•œ ๋น„์šฉ์„ ์†Œ๋น„ํ•˜๊ฒŒ๋œ๋‹ค. ์ด๋Š” ๋‚ฎ์€ ์งˆ์˜ ๊ฐ•์˜ ์ฝ˜ํ…์ธ ๊ฐ€ ๋ฌด๋ถ„๋ณ„ํ•˜๊ฒŒ ๊ฒŒ์‹œ๋˜๋Š” ํ–‰์œ„๋ฅผ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค. ์ดํ›„ ๊ฒŒ์‹œ๋œ ๊ฐ•์˜๋ฅผ ์†Œ๋น„ํ•˜๋Š” ์‚ฌ์šฉ์ž์˜ ์˜ํ•˜์—ฌ ์ฝ˜ํ…์ธ  ์ƒ์‚ฐ์ž๊ฐ€ ์ง€์ •ํ•œ ๋น„์šฉ์˜ ํ† ํฐ์„ ๋ณด์ƒ์œผ๋กœ ๋ฐ›์„ ์ˆ˜ ์žˆ๋‹ค.

ํ† ํฐ๋ณด์ƒ๋Ÿ‰์˜ ์ œํ•œ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO์˜ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ฐฐํฌ๋˜๋Š” ์ด ํ† ํฐ์˜ ์–‘์€ ์ œํ•œ์ด ์—†๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋ฌด์ œํ•œ์ ์ธ ํ† ํฐ ์–‘์˜ ์ฆ๊ฐ€๋Š” ์ธํ”Œ๋ ˆ์ด์…˜์„ ์ดˆ๋ž˜ํ•˜๋ฉฐ ์ด๋ฅผ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด ํ•˜๋ฃจ์— ๋ฐœํ–‰๋˜๋Š” ํ† ํฐ์˜ ์–‘์ด ์ œํ•œ ๋œ๋‹ค. ํ˜„์žฌ ์ดˆ๊ธฐ ํ•˜๋ฃจ ๋ฐœํ–‰๋Ÿ‰์€ 500๊ฐœ๋กœ ์ œํ•œ ๋˜๋ฉฐ, ํ•ด๋‹น ์ˆ˜๋Ÿ‰์€ ์ธํ”Œ๋ ˆ์ด์…˜์˜ ์ถ”์ด์— ๋”ฐ๋ผ ๋ณ€๋™์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

image

  • ฮผ = ํ•˜๋ฃจ ์ด ํ† ํฐ ๋ฐœํ–‰ ์ œํ•œ๋Ÿ‰
  • ฮฑ = ํ•˜๋ฃจ ์ด ํ† ํฐ ๋ฐœํ–‰๋Ÿ‰

ํ† ํฐ ์†Œ๋น„

(1) ๊ฐ•์˜ ์ฝ˜ํ…์ธ  ์ƒ์„ฑ ์‹œ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO์˜ ์‚ฌ์šฉ์ž๊ฐ€ ๊ฐ•์˜ ์ฝ˜ํ…์ธ ๋ฅผ ์ƒ์„ฑํ•  ๊ฒฝ์šฐ ์ผ์ •๋Ÿ‰์˜ ํ† ํฐ์ด ์†Œ์š”๋œ๋‹ค. ์ด ๊ฒฝ์šฐ ์‚ฌ์šฉ๋œ ํ† ํฐ์€ ๋‹ค์‹œ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ํ† ํฐ์ด ๋˜๋ฉฐ ์ด๋Š” ๊ฐ•์˜ ์ƒ์„ฑ ์‹œ ๋น„์šฉ์˜ ๊ฐœ๋…์œผ๋กœ ์ฒ˜๋ฆฌ๋œ๋‹ค. ์ง€์‹์„ ๊ณต์œ ํ•˜๋Š” ์ด๊ฐ€ ํ† ํฐ์„ ์†Œ๋น„ํ•จ์œผ๋กœ์จ ํ† ํฐ ํš๋“ ๋งŒ์„ ์œ„ํ•œ ๋ฌด๋ถ„๋ณ„ํ•œ ๊ฐ•์˜ ์ƒ์„ฑ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•จ์ด๋‹ค.

(2) ๊ฐ•์˜ ์ฝ˜ํ…์ธ  ์†Œ๋น„

ํ•˜๋ธŒ๋ฃจํƒ€ DAO์˜ ์‚ฌ์šฉ์ž๋Š” ์ž์‹ ์ด ๊ฐ–๊ณ  ์žˆ๋Š” ํ† ํฐ์„ ํ™œ์šฉํ•˜์—ฌ ๊ฐ•์˜ ์ฝ˜ํ…์ธ ๋ฅผ ์ˆ˜๊ฐ• ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๊ธฐํƒ€ ํ™œ๋™์„ ์˜์œ„ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋ชจ๋“  ํ† ํฐ ์†Œ์ง„ ์‹œ ๋ถ€์กฑํ•œ ํ† ํฐ์€ ์ปค๋ฎค๋‹ˆํ‹ฐ ํ™œ๋™์œผ๋กœ ๋ณด์ถฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

(3) HADA PASS NFT ๋ฐœํ–‰

์‚ฌ์šฉ์ž๋Š” ์ผ์ • ํ† ํฐ์„ ์†Œ๋น„ํ•˜์—ฌ HADA PASS๋ฅผ ๊ตฌ๋งคํ•  ์ˆ˜ ์žˆ๋‹ค. HADA PASS๋ฅผ ๋ณด์œ ํ•œ ์‚ฌ์šฉ์ž๋Š” ํ•˜๋ธŒ๋ฃจํƒ€ DAO ๋‚ด ๋ชจ๋“  ๊ฐ•์˜๋ฅผ ๋ฌด๋ฃŒ๋กœ ์ˆ˜๊ฐ•ํ•  ์ˆ˜ ์žˆ๋‹ค. HADA PASS์˜ ์œ ํšจ ๊ธฐ๊ฐ„์„ ์„ค์ •ํ•˜์—ฌ, HADA PASS์˜ ๊ฐ€์น˜๊ฐ€ ๋ฌดํ•œ์œผ๋กœ ๋†’์•„์ง€๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•œ๋‹ค. ์ผ์ • ์ฃผ๊ธฐ๋งˆ๋‹ค ์ƒˆ๋กœ์šด NFT๋ฅผ ๋ฐœํ–‰ํ•˜์—ฌ ์‚ฌ์šฉ์ž๋Š” HADA PASS๋ฅผ ๊ฐฑ์‹ ํ•ด์•ผ ํ•œ๋‹ค. HADA PASS๋ฅผ ๊ตฌ๋งคํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋œ ํ† ํฐ์€ ๋‹ค์‹œ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ํ† ํฐ์ด ๋œ๋‹ค.

DAO ํˆฌํ‘œ (Snapshot ์‚ฌ์šฉ)

  • ํ•˜๋ธŒ๋ฃจํƒ€ DAO ๋Š” ๊ฐ ์œ ์ €์—๊ฒŒ ํ† ํฐ์„ ๊ฐ€์ง„ ๊ตฌ์„ฑ์›๋“ค์—๊ฒŒ ์˜๊ฒฐ๊ถŒ์„ ๋ฐฐ๋ถ€ํ•˜๊ณ , 1์ธ 1ํ‘œ์ œ๋ฅผ ์ฑ„ํƒํ•œ๋‹ค. ๋ธ”๋ก์ฒด์ธ ๊ธฐ์ˆ ์— ๊ธฐ๋ฐ˜ํ•˜์—ฌ ํˆฌํ‘œ๋ฅผ ํ†ตํ•ด ๋‹ค์–‘ํ•œ ์•ˆ๊ฑด์— ๊ด€ํ•ด ์˜์‚ฌ๊ฒฐ์ •์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ํ•˜๋ธŒ๋ฃจํƒ€ DAO์˜ ์šด์˜ ๋ฐฉํ–ฅ๋„ ํˆฌํ‘œ๋ฅผ ํ†ตํ•ด ๊ฒฐ์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ธฐ์ˆ  ์Šคํƒ ๋ฐ ์•„ํ‚คํ…์ณ

image

ํ•œ ๋‹ฌ์ด๋ผ๋Š” ์‹œ๊ฐ„์•ˆ์— ๊ฐ€์žฅ ์ƒ์‚ฐ์„ฑ์„ ๋†’ํžˆ๊ธฐ ์œ„ํ•œ ๊ธฐ์ˆ ๋“ค์„ ์„ ๋ณ„, ์ฑ„ํƒํ•˜์˜€๊ณ , Team Vote์˜ ๊ตฌ์„ฑ์›๋“ค์ด ํ•˜๋ธŒ๋ฃจํƒ€ DAO ํ”„๋กœ์ ํŠธ๋ฅผ ํ†ตํ•ด ์„ฑ์žฅ์„ ํ•˜์—ฌ, ๊ฐœ๋ฐœ ์—…๊ณ„๋กœ ๋‚˜์•„๊ฐˆ ๊ฒƒ์„ ๊ณ ๋ คํ•˜์—ฌ ํ˜„์žฌ ๊ฐœ๋ฐœ ์—…๊ณ„์—์„œ ์„ ํ˜ธํ•˜๋Š” ๊ธฐ์ˆ  ์Šคํƒ๋“ค์„ ํ•™์Šตํ•˜๋„๋ก ํ•˜์˜€๋‹ค. ๋”ฐ๋ผ์„œ ํ•ด๋‹น ๊ธฐ์ˆ ์„ ์ตํžˆ๊ธฐ ์œ„ํ•ด Team Vote์˜ ๊ตฌ์„ฑ์›๋“ค์€ ๋ณธ๊ฒฉ์ ์ธ ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ ์‹œ์ž‘์— ์•ž์„œ ํ•™์Šต์„ ์ง„ํ–‰ํ•œ ๋’ค ๊ฐœ๋ฐœ์„ ์‹œ์ž‘ํ•˜์˜€๋‹ค. ํ•˜๋ธŒ๋ฃจํƒ€ DAO ํ”„๋กœ์ ํŠธ์— ์‚ฌ์šฉํ•œ ๊ธฐ์ˆ  ์Šคํƒ์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

๊ธฐ์ˆ ์Šคํƒ ๋ชฉ๋ก

image

๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์Šคํ‚ค๋งˆ

image

ํ”ผ๊ทธ๋งˆ ๋””์ž์ธ ๋ชฉ์—…

ํ”ผ๊ทธ๋งˆ ๋””์ž์ธ ๋ชฉ์—… ๋ฐ”๋กœ๊ฐ€๊ธฐ

์‹œ์ž‘ํ•˜๊ธฐ

git clone https://github.com/codestates/BEB-05-Team-Vote.git

๋นŒ๋“œ ๋ฐ ์‹คํ–‰

BEB-05-Team-Vote ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ๊ฐ๊ฐ์˜ Application์„ ๋นŒ๋“œํ•˜๊ณ  ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • client

์•„๋ž˜์˜ .env ํŒŒ์ผ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

NEXT_PUBLIC_GA_ID= ๊ตฌ๊ธ€ ์• ๋„๋ฆฌํ‹ฑ์Šค key
NEXT_PUBLIC_SENTRY_DSN= ์„ผํŠธ๋ฆฌ key
NEXT_PUBLIC_CHANNEL_IO_KEY= ์ฑ„๋„ํ†ก key
SECRET= salt๊ฐ’
NEXTAUTH_URL= ๋ฐฐํฌ ์ฃผ์†Œ
NEXT_PUBLIC_ENDPOINT= api ์„œ๋ฒ„ ์—”๋“œํฌ์ธํŠธ
NEXT_PUBLIC_HADATOKEN= ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ CA
NEXT_PUBLIC_HADAPASS_CA= NFT ์ปจํŠธ๋ž™ํŠธ CA
cd client/havruta_dao
yarn
yarn dev
  • server

์•„๋ž˜์˜ .env ํŒŒ์ผ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

PORT=์‹คํ–‰ ํฌํŠธ
DATABASE_URL= ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ฃผ์†Œ
TOKEN_CA= ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ CA
BATCH_CA= ํ† ํฐ ๋ฐฐ์น˜ ์ปจํŠธ๋ž™ํŠธ CA
PASS_CA= NFT ์ปจํŠธ๋ž™ํŠธ CA
DEPLOY_ADDRESS= ์ปจํŠธ๋ž™ํŠธ ๋ฐฐํฌ ๊ณ„์ • ๊ณต๊ฐœํ‚ค
DEPLOY_PRIVATEKEY= ์ปจํŠธ๋ž™ํŠธ ๋ฐฐํฌ ๊ณ„์ • ๋น„๋ฐ€ํ‚ค
cd server
yarn
yarn postinstall
yarn dev

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์›Œํฌํ”Œ๋กœ์šฐ

์ฃผ์š” ๊ธฐ๋Šฅ

  1. ๋กœ๊ทธ์ธ(์ง€๊ฐ‘์—ฐ๊ฒฐ)

  2. ์ปค๋ฎค๋‹ˆํ‹ฐ

    • ๊ฒŒ์‹œ๊ธ€ ์—…๋กœ๋“œ (์‹ค๊ธฐ๊ฐ„ ๊ธ€ ์—…๋ฐ์ดํŠธ ๊ธฐ๋Šฅ)
    • ๊ฒŒ์‹œ๊ธ€ ์ƒ์„ธ๋ณด๊ธฐ ํŽ˜์ด์ง€ ์ด๋™
    • ์ข‹์•„์š”
    • ๋Œ“๊ธ€
    • ์‚ญ์ œ
    • ์œ ์ € ํ”„๋กœํ•„ ๋ฐ”๋กœ๋ณด๊ธฐ
  3. ์ง€์‹ ๊ณต์œ (๊ฐ•์˜ ์—…๋กœ๋“œ)

    • ๊ฐ ํ•ญ๋ชฉ ์ž…๋ ฅ ํ›„ ์—…๋กœ๋“œ
    • ๊ฐ ํ•ญ๋ชฉ์˜ validation ์ฒดํฌ ๋“ฑ
  4. ๊ฐ•์˜ ํƒ์ƒ‰(๊ฐ•์˜ ์ˆ˜๊ฐ•ํ•˜๊ธฐ)

    • ๊ฐ•์˜ํƒ์ƒ‰ ํŽ˜์ด์ง€ ์ด๋™ ํ›„ ๊ฐ•์˜ ์„ ํƒ
    • ์ˆ˜๊ฐ•์‹ ์ฒญ์‹œ ํ† ํฐ ์†Œ๋น„
    • ๊ฐ•์˜์‹ค๋กœ ์ด๋™ํ•˜๊ธฐ
    • ๊ฐ•์˜ ์ˆ˜๊ฐ•
  5. ๋งˆ์ดํŽ˜์ด์ง€

    • ๋‚ด ์ •๋ณด ์ˆ˜์ •
    • ๋‚ด๊ฐ€ ์“ด ๊ธ€, ๋Œ“๊ธ€ ๋ชฉ๋ก ํ™•์ธ
    • ์ˆ˜๊ฐ• ์ค‘์ธ ๊ฐ•์˜, ์ƒ์„ฑํ•œ ๊ฐ•์˜ ํ™•์ธ
    • ํ•˜๋‹คํ† ํฐ ์ง€๊ฐ‘์— ์ถ”๊ฐ€
    • ํŒจ์Šค ๋ฐœํ–‰
  6. DAO ํˆฌํ‘œ(snapshot)

์ปจํŠธ๋ž™ํŠธ ์ƒ์„ฑ

ํ•˜๋ธŒ๋ฃจํƒ€ DAO์—์„œ๋Š” ์„ธ ์ข…๋ฅ˜์˜ ์ปจํŠธ๋ž™ํŠธ๊ฐ€ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ํ•˜๋‚˜๋Š” ERC-20 ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์ด๋ฉฐ, ํ•˜๋‚˜๋Š” ํ† ํฐ์„ ์—ฌ๋Ÿฌ ๊ณ„์ •์— ํ•œ ๋ฒˆ์— ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋Š” ๋ฐฐ์น˜ ์ปจํŠธ๋ž™ํŠธ, ๋งˆ์ง€๋ง‰์œผ๋กœ ERC-721 ์ปจํŠธ๋ž™๋“œ๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

ERC-20 ์ปจํŠธ๋ž™ํŠธ๋Š” ์ฒ˜์Œ์— ๋ฐฐ์น˜ ์ปจํŠธ๋ž™ํŠธ์˜ CA๋ฅผ ์„ค์ •ํ•˜์—ฌ ์œ ์ €๋“ค์˜ ํฌ์ธํŠธ๋“ค ํ•ฉ์‚ฐํ•œ ์ ์ˆ˜๋งŒํผ์˜ ํ† ํฐ์„ ๋ฐฐ์น˜ ์ปจํŠธ๋ž™ํŠธ์— ๋ฏผํŒ…ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ ERC-20 ์ปจํŠธ๋ž™ํŠธ์— ์žˆ๋Š” ํ† ํฐ์„ ์†Œ๊ฐํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

  • HadaToken.sol
... ์ค‘๋žต

function updateBatchContractAdress(address _adress) public onlyOwner  {
        batchContractAdress = _adress;
        emit NewBatchContractAdress(_adress);
    }

    function mint( uint256 _amount) public onlyOwner isBatchContract{
        _mint(batchContractAdress, _amount);
    }

    function burn(uint256 amount) public override onlyOwner{
        _burn(address(this), amount);
    }

๋ฐฐ์น˜ ์ปจํŠธ๋ž™ํŠธ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์ฒ˜์Œ์— ํ† ํฐ ์ปจํŠธ๋ž™ํŠธ์˜ CA๋ฅผ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋ฐฐ์น˜ ์ปจํŠธ๋ž™ํŠธ๋Š” ์œ ์ €๋“ค์˜ ์ฃผ์†Œ์™€ ๋ฐฐ๋ถ„ํ•  ํ† ํฐ์˜ ์–‘์„ ๋ฐ›์œผ๋ฉด API ์„œ๋ฒ„์— ์˜ํ•ด UTC ๊ธฐ์ค€ ๋งค์ผ 0์‹œ 0๋ถ„์— ์œ ์ €๋“ค์—๊ฒŒ ํ† ํฐ์„ ๋ถ„๋ฐฐํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

  • HADATokenBatch.sol
...์ค‘๋žต

 function updateTokenContractAdress(address _adress) public onlyOwner {

        tokenContractAdress = ERC20(_adress);
        _tokenContractAdress = _adress;

        emit NewTokenContractAdress(_adress);
    }

... ์ค‘๋žต

    function batchTransfer(address[] calldata _address, uint256[] calldata _amounts) external onlyOwner isTokenContract{
        require(_address.length == _amounts.length, "Invalid input parameters");

        for(uint256 i = 0; i < _address.length; i++) {
            require(tokenContractAdress.transfer(_address[i], _amounts[i]), "Unable to transfer token to the account");
        }
    }

ERC-721 ์ปจํŠธ๋ž™ํŠธ๋Š” ์•ž์„œ ๋ฐฐํฌํ•œ ERC-20 ์ปจํŠธ๋ž™ํŠธ์˜ ํ† ํฐ์œผ๋กœ NFT๋ฅผ ๋ฏผํŒ…ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์ด ์žˆ์Šต๋‹ˆ๋‹ค. NFT์˜ ๊ฐ€๊ฒฉ๋˜ํ•œ ํ•จ์ˆ˜๋กœ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • HADAPASS2022.sol
... ์ค‘๋žต

    function updateTokenContractAdress (address tokenAddress) public onlyOwner returns (bool) {
        require(tokenAddress != address(0x0));
        token = IERC20(tokenAddress);
        _tokenAdress = tokenAddress;
        return true;
    }

    function updateNFTPrice(uint256 _value) public onlyOwner  {
        nftPrice = _value;
        emit NewNFTPrice(_value);
    }

    function mintNFT(address recipient, string memory tokenURI) public returns (uint256) {
        require(nftPrice > 0, "you must set nft price!");
        require(token.balanceOf(recipient) > nftPrice);

        token.transferFrom(recipient, _tokenAdress, nftPrice);

        _tokenIds.increment();
        uint256 newItemId = _tokenIds.current();
        _mint(recipient, newItemId);
        _setTokenURI(newItemId, tokenURI);

        return newItemId;
    }

ํด๋ผ์ด์–ธํŠธ์—์„œ ํŠธ๋žœ์žญ์…˜ ์ƒ์„ฑ

ํด๋ผ์ด์–ธํŠธ์—์„œ๋„ ๋ฐฐํฌํ•œ ์ปจํŠธ๋ž™ํŠธ์˜ CA ์ฃผ์†Œ๋กœ ์ง์ ‘ ๋ฐœํ–‰ํ•œ ERC-20 ํ† ํฐ์„ ๊ฑฐ๋ž˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํ”„๋กœ์ ํŠธ์—์„œ๋Š” ํด๋ ˆ์ดํŠผ์„ ์‚ฌ์šฉํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์— ๋กœ์ง์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

const data = window.caver.klay.abi.encodeFunctionCall(
  {
    name: 'transfer',
    type: 'function',
    inputs: [
      {
        type: 'address',
        name: 'recipient',
      },
      {
        type: 'uint256',
        name: 'amount',
      },
    ],
  },
  [
    user_address,
    window.caver.utils
      .toBN(price)
      .mul(window.caver.utils.toBN(Number(`1e18`)))
      .toString(),
  ]
);

window.caver.klay
  .sendTransaction({
    type: 'SMART_CONTRACT_EXECUTION',
    from: window.klaytn?.selectedAddress,
    to: process.env.NEXT_PUBLIC_HADATOKEN,
    data,
    gas: '3000000',
  })
  .on('transactionHash', (transactionHash: any) => {
    console.log('txHash', transactionHash);
  })
  .on('receipt', (receipt: any) => {
    console.log('receipt', receipt);
  })
  .on('error', (error: any) => {
    console.log('error', error.message);
  });

ํŒ€์›

ํŒ€๋ช… : Team Vote

์ง์œ„ ์ง๋ฌด ์ด๋ฆ„ Github
ํŒ€์žฅ ํ”„๋ก ํŠธ์—”๋“œ, ์Šค๋งˆํŠธ ์ปจํŠธ๋ž™ํŠธ, ์ธํ”„๋ผ ์œคํƒœํฌ https://github.com/thyoondev
ํŒ€์› ๋ฐฑ์—”๋“œ, ์ธํ”„๋ผ ์œค์žฅ์› https://github.com/yjjjwww
ํŒ€์› ๋””์ž์ธ, ํ”„๋ก ํŠธ์—”๋“œ ์ด์„ฑ๋งŒ https://github.com/sungman5
ํŒ€์› ํ”„๋ก ํŠธ์—”๋“œ ๊น€์œค๋ฏธ https://github.com/yoonmi-cyber
ํŒ€์› ๋ฐฑ์—”๋“œ ์ด๋™ํ˜„ https://github.com/dhjefflee

About

๐Ÿ“š์ง€์‹ ๊ณต์œ  ํ•™์Šต ํ”Œ๋žซํผ : ํ•˜๋ธŒ๋ฃจํƒ€ DAO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published