Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
set minimum fee for contract to 1 gas
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Zhang committed Jul 21, 2017
1 parent cb560f0 commit f1f8140
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion neo-gui/UI/InvokeContractDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void button5_Click(object sender, EventArgs e)
if (engine.Execute())
{
tx.Gas = engine.GasConsumed - Fixed8.FromDecimal(10);
if (tx.Gas < Fixed8.Zero) tx.Gas = Fixed8.Zero;
if (tx.Gas < Fixed8.One) tx.Gas = Fixed8.One;
tx.Gas = tx.Gas.Ceiling();
label7.Text = tx.Gas + " gas";
button3.Enabled = true;
Expand Down
9 changes: 8 additions & 1 deletion neo-gui/UI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,19 @@ private void viewContractToolStripMenuItem_Click(object sender, EventArgs e)

private void voteToolStripMenuItem_Click(object sender, EventArgs e)
{
InvocationTransaction tx;
Contract contract = (Contract)listView1.SelectedItems[0].Tag;
using (VotingDialog dialog = new VotingDialog(contract.ScriptHash))
{
if (dialog.ShowDialog() != DialogResult.OK) return;
Helper.SignAndShowInformation(dialog.GetTransaction());
tx = dialog.GetTransaction();
}
using (InvokeContractDialog dialog = new InvokeContractDialog(tx))
{
if (dialog.ShowDialog() != DialogResult.OK) return;
tx = dialog.GetTransaction();
}
Helper.SignAndShowInformation(tx);
}

private void 复制到剪贴板CToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
6 changes: 2 additions & 4 deletions neo-gui/UI/VotingDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ public InvocationTransaction GetTransaction()
sb.EmitPush(script_hash.ToArray());
sb.EmitSysCall("Neo.Blockchain.GetAccount");
sb.EmitSysCall("Neo.Account.SetVotes");
return Program.CurrentWallet.MakeTransaction(new InvocationTransaction
return new InvocationTransaction
{
Version = 1,
Script = sb.ToArray(),
Gas = Fixed8.Zero,
Attributes = new[]
{
new TransactionAttribute
Expand All @@ -34,7 +32,7 @@ public InvocationTransaction GetTransaction()
Data = script_hash.ToArray()
}
}
}, fee: Fixed8.One);
};
}
}

Expand Down

0 comments on commit f1f8140

Please sign in to comment.