OSDN Git Service

add contract LockPosition (#29)
authoroysheng <33340252+oysheng@users.noreply.github.com>
Tue, 11 Dec 2018 06:53:16 +0000 (14:53 +0800)
committerPaladz <yzhu101@uottawa.ca>
Tue, 11 Dec 2018 06:53:16 +0000 (14:53 +0800)
* deposit contract FixedLimitCollect and FixedLimitProfit

* add contract LockPosition

* optimise

compiler/equitytest/LockPosition [new file with mode: 0644]
compiler/equitytest/equity_test.go

diff --git a/compiler/equitytest/LockPosition b/compiler/equitytest/LockPosition
new file mode 100644 (file)
index 0000000..fb64ce3
--- /dev/null
@@ -0,0 +1,9 @@
+contract LockPosition(expireBlockHeight: Integer,
+                      saver: Program,
+                      publicKey: PublicKey) locks lockAmount of lockAsset {
+  clause expire(sig: Signature) {
+    verify above(expireBlockHeight)
+    verify checkTxSig(publicKey, sig)
+    lock lockAmount of lockAsset with saver
+  }
+}
index 36b4b65..b8f4edb 100644 (file)
@@ -16,6 +16,10 @@ func TestCompileContract(t *testing.T) {
                want     string
        }{
                {
+                       "./LockPosition",
+                       "cd9f697b7bae7cac6900c3c251547ac1",
+               },
+               {
                        "./RepayCollateral",
                        "557a641f0000007bcda069007b7b51547ac16951c3c251547ac1632a0000007bcd9f6900c3c251567ac1",
                },