智能合约ERC20项目DAPP系统开发方案解析理念
2023-06-13 09:14:05 时间
DAPP的研制还处于起步阶段。今天简单介绍一下市场上应用分发的现状,只是初级水平。后面的文章会逐一介绍它的发展历史和数据解读。
基于区块链的智能合约构建及执行分为如下几步:
1、多方用户共同参与制定一份智能合约;
2、合约通过P2P网络扩散并存入区块链;
3、区块链构建的智能合约自动执行。
parameter_types! {
pub const CouncilMotionDuration: BlockNumber = 5 * DAYS;
pub const CouncilMaxProposals: u32 = 100;
pub const CouncilMaxMembers: u32 = 100;
}
type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const CandidacyBond: Balance = 10 * DOLLARS;
// 1 storage item created, key size is 32 bytes, value size is 16+16.
pub const VotingBondBase: Balance = deposit(1, 64);
// additional data per vote is 32 bytes (account id).
pub const VotingBondFactor: Balance = deposit(0, 32);
pub const TermDuration: BlockNumber = 7 * DAYS;
pub const DesiredMembers: u32 = 13;
pub const DesiredRunnersUp: u32 = 7;
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
}
// Make sure that there are no more than `MaxMembers` members elected via elections-phragmen.
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
impl pallet_elections_phragmen::Config for Runtime {
type Event = Event;
type PalletId = ElectionsPhragmenPalletId;
type Currency = Balances;
type ChangeMembers = Council;
// NOTE: this implies that council's genesis members cannot be set directly and must come from
// this module.
type InitializeMembers = Council;
type CurrencyToVote = U128CurrencyToVote;
type CandidacyBond = CandidacyBond;
type VotingBondBase = VotingBondBase;
type VotingBondFactor = VotingBondFactor;
type LoserCandidate = ();
type KickedMember = ();
type DesiredMembers = DesiredMembers;
type DesiredRunnersUp = DesiredRunnersUp;
type TermDuration = TermDuration;
type WeightInfo = pallet_elections_phragmen::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const TechnicalMotionDuration: BlockNumber = 5 * DAYS;
pub const TechnicalMaxProposals: u32 = 100;
pub const TechnicalMaxMembers: u32 = 100;
}
type TechnicalCollective = pallet_collective::Instance2;
impl pallet_collective::Config<TechnicalCollective> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type MotionDuration = TechnicalMotionDuration;
type MaxProposals = TechnicalMaxProposals;
type MaxMembers = TechnicalMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
}
type EnsureRootOrHalfCouncil = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
>;
impl pallet_membership::Config<pallet_membership::Instance1> for Runtime {
type Event = Event;
type AddOrigin = EnsureRootOrHalfCouncil;
type RemoveOrigin = EnsureRootOrHalfCouncil;
type SwapOrigin = EnsureRootOrHalfCouncil;
type ResetOrigin = EnsureRootOrHalfCouncil;
type PrimeOrigin = EnsureRootOrHalfCouncil;
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = TechnicalMaxMembers;
type WeightInfo = pallet_membership::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 1 * DOLLARS;
pub const SpendPeriod: BlockNumber = 1 * DAYS;
pub const Burn: Permill = Permill::from_percent(50);
pub const TipCountdown: BlockNumber = 1 * DAYS;
pub const TipFindersFee: Percent = Percent::from_percent(20);
pub const TipReportDepositBase: Balance = 1 * DOLLARS;
pub const DataDepositPerByte: Balance = 1 * CENTS;
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const MaximumReasonLength: u32 = 300;
pub const MaxApprovals: u32 = 100;
}
impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = Balances;
type ApproveOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilCollective, 3, 5>,
>;
type RejectOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>,
>;
type Event = Event;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ();
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = ();
type SpendFunds = Bounties;
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
type MaxApprovals = MaxApprovals;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<u128>;
}
相关文章
- Github项目Mobile-Detect-检测移动设备的php类
- 获取项目程序集,排除所有的系统程序集(Microsoft.***、System.***等)、Nuget下载包
- 三年项目升级Vue3的踩坑经历
- 【愚公系列】2022年10月 微信小程序-电商项目-商品详情页面的标题及价格功能实现
- web3.0卡牌链游项目系统开发源码解决方案(成熟技术)
- 马蹄链合约DAPP项目系统开发分析方案(成熟理念)
- H5/公众号小程序小游戏项目系统开发部署搭建理解
- gin博客项目复盘--02数据库的搭建
- idea maven创建springboot项目_springboot项目
- SAP ERP实施项目,到底是公司适应系统还是系统适应公司?
- 『深度学习项目四』基于ResNet101人脸特征点检测
- 【好玩儿的Docker项目】Pingvin Share——一个专注于文件分享的高颜值轻量小工具!
- vue.js客服系统实时聊天项目开发(八)使用axios post请求访客初始化接口
- vue.js客服系统实时聊天项目开发(十三)日期缩短展示,同一天只展示时秒,同一年展示月日小时秒
- vue.js客服系统实时聊天项目开发(十七)解决url get传参后进行base64解密问题
- 微软推出VS扩展,可快速升级.NET项目
- Maven项目中配置Log4j
- 某地园区视频监控系统项目施工组织方案,值得视频监控类项目参考,文末附下载!
- IntelliJ IDEA 构建maven多模块项目详解程序员
- MyEclipse项目名有红叉,但文件中没有红叉的解决方法详解编程语言
- Java项目实战之在线考试系统(带源码和解析)
- Java项目实战之简易博客系统开发(带源码和解析)
- Linux系统下QT项目打包实战(linuxqt打包)
- 部署项目至Linux系统:一种新模式(项目发布到linux)
- [开源项目] 系统或软件找不到特定的dll文件?试试批量安装VC运行库
- Exploring the Source Code of MongoDB Project: A Comprehensive Guide(mongodb项目源码)
- 最近项目写了一些js,水平有待提高
- 用nodejs写的一个简单项目打包工具