-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4171f9
commit 30d224a
Showing
5 changed files
with
123 additions
and
18 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
Libplanet.SDK.Action.Tests/Sample/Actions/InvalidAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Bencodex.Types; | ||
using Libplanet.Crypto; | ||
using Libplanet.SDK.Action.Attributes; | ||
|
||
namespace Libplanet.SDK.Action.Tests.Sample.Actions | ||
{ | ||
public class InvalidAction : ActionBase | ||
{ | ||
public override Address StorageAddress => | ||
new Address("0x1000000000000000000000000000000000000000"); | ||
|
||
[Executable] | ||
public void Add(IValue args) | ||
{ | ||
Integer operand = (Integer)args; | ||
Integer stored = GetState(Signer) is IValue value | ||
? (Integer)value | ||
: new Integer(0); | ||
SetState(Signer, new Integer(stored.Value + operand.Value)); | ||
} | ||
|
||
public void Subtract(IValue args) | ||
{ | ||
Integer operand = (Integer)args; | ||
Integer stored = GetState(Signer) is IValue value | ||
? (Integer)value | ||
: new Integer(0); | ||
SetState(Signer, new Integer(stored.Value - operand.Value)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters