From: wz Date: Mon, 15 Jul 2019 08:08:57 +0000 (+0800) Subject: Voter reward (#286) X-Git-Tag: v1.0.5~137 X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=commitdiff_plain;h=5f9994ca49618c1336d4490e9a4410c6b8784be1 Voter reward (#286) * rename dir * add database * fix * fix --- diff --git a/cmd/reward/main.go b/cmd/reward/main.go new file mode 100644 index 00000000..79058077 --- /dev/null +++ b/cmd/reward/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + +} diff --git a/toolbar/reward/config/config.go b/toolbar/reward/config/config.go new file mode 100644 index 00000000..d912156b --- /dev/null +++ b/toolbar/reward/config/config.go @@ -0,0 +1 @@ +package config diff --git a/toolbar/reward/database/dump_reward.sql b/toolbar/reward/database/dump_reward.sql new file mode 100644 index 00000000..807c67d5 --- /dev/null +++ b/toolbar/reward/database/dump_reward.sql @@ -0,0 +1,29 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for block_state +-- ---------------------------- +DROP TABLE IF EXISTS `block_state`; +CREATE TABLE `block_state` ( + `height` int(11) NOT NULL, + `block_hash` varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL +) ENGINE = InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Table structure for vote +-- ---------------------------- +DROP TABLE IF EXISTS `vote`; +CREATE TABLE `vote` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `xpub` varchar(128) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, + `voter_address` varchar(62) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, + `vote_height` int(11) NOT NULL, + `vote_num` int(11) NOT NULL, + `veto_height` int(11) NOT NULL, + `output_id` varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `xpub`(`xpub`, `vote_height`, `output_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 6 DEFAULT CHARSET=utf8; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/toolbar/reward/database/orm/block_state.go b/toolbar/reward/database/orm/block_state.go new file mode 100644 index 00000000..6fdd1550 --- /dev/null +++ b/toolbar/reward/database/orm/block_state.go @@ -0,0 +1,6 @@ +package orm + +type BlockState struct { + Height uint64 + BlockHash string +} diff --git a/toolbar/reward/database/orm/vote_utxo.go b/toolbar/reward/database/orm/vote_utxo.go new file mode 100644 index 00000000..43951817 --- /dev/null +++ b/toolbar/reward/database/orm/vote_utxo.go @@ -0,0 +1,11 @@ +package orm + +type Utxo struct { + ID uint64 `gorm:"primary_key"` + Xpub string + VoterAddress string + VoteHeight uint64 + VoteNum uint64 + VetoHeight uint64 + OutputID string +}