From 73ca4df3dbaa4afa8eb5f85ea48f0e481039d061 Mon Sep 17 00:00:00 2001 From: "luk.lu" Date: Tue, 9 Apr 2019 09:06:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20ActTransfer=20?= =?UTF-8?q?=E4=B8=BA=20ActionTransfer;=20=E5=88=A0=E9=99=A4=20ling=20?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=EF=BC=8C=E6=8A=8A=20Action*.js=20=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E5=88=B0=E4=B8=8A=E7=BA=A7=E6=A0=B9=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ling/Action.js => Action.js | 0 ling/ActTransfer.js => ActionTransfer.js | 10 +++++----- index.js | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename ling/Action.js => Action.js (100%) rename ling/ActTransfer.js => ActionTransfer.js (69%) diff --git a/ling/Action.js b/Action.js similarity index 100% rename from ling/Action.js rename to Action.js diff --git a/ling/ActTransfer.js b/ActionTransfer.js similarity index 69% rename from ling/ActTransfer.js rename to ActionTransfer.js index 369d173..1be5793 100644 --- a/ling/ActTransfer.js +++ b/ActionTransfer.js @@ -1,9 +1,9 @@ const Action = require('./Action.js') -const DAD = module.exports = function ActTransfer (prop) { - this._class = 'ActTransfer' - this.setProp(prop) // 没有定义 ActTransfer.prototype._model,因此继承了上级Action.prototype._model,因此通过this.setProp,继承了上级Action定义的实例自有数据。另一个方案是,调用 Action.call(this, prop) - this.type = 'ActTransfer' +const DAD = module.exports = function ActionTransfer (prop) { + this._class = 'ActionTransfer' + this.setProp(prop) // 没有定义 ActionTransfer.prototype._model,因此继承了上级Action.prototype._model,因此通过this.setProp,继承了上级Action定义的实例自有数据。另一个方案是,调用 Action.call(this, prop) + this.type = 'ActionTransfer' } DAD.__proto__ = Action const MOM = DAD.prototype @@ -12,7 +12,7 @@ MOM.__proto__ = Action.prototype DAD.validate = async function (action) { // if (sender && sender.type !== 'multisig' && action.toAddress != action.actorAddress && sender.balance >= action.amount + action.fee){ let sender = await wo.Store.getBalance(action.actorAddress) - return action.actorAddress && action.toAddress && action.toAddress != action.actorAddress && action.amount && action.amount > 0 && sender >= action.amount + action.fee && action.fee >= wo.Config.MIN_FEE_ActTransfer + return action.actorAddress && action.toAddress && action.toAddress != action.actorAddress && action.amount && action.amount > 0 && sender >= action.amount + action.fee && action.fee >= wo.Config.MIN_FEE_ActionTransfer } DAD.execute = async function (action) { diff --git a/index.js b/index.js index bb4d7f0..62cdb2d 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ -const Action = require('./ling/Action.js') -const ActTransfer = require('./ling/ActTransfer.js') +const Action = require('./Action.js') +const ActionTransfer = require('./ActionTransfer.js') module.exports = { Action, - ActTransfer + ActionTransfer } \ No newline at end of file