From f05780c18c0d34a2e4d993ef38d9c8a98d62e0c8 Mon Sep 17 00:00:00 2001 From: oysheng <33340252+oysheng@users.noreply.github.com> Date: Tue, 11 Dec 2018 14:53:16 +0800 Subject: [PATCH] add contract LockPosition (#29) * deposit contract FixedLimitCollect and FixedLimitProfit * add contract LockPosition * optimise --- compiler/equitytest/LockPosition | 9 +++++++++ compiler/equitytest/equity_test.go | 4 ++++ 2 files changed, 13 insertions(+) create mode 100644 compiler/equitytest/LockPosition diff --git a/compiler/equitytest/LockPosition b/compiler/equitytest/LockPosition new file mode 100644 index 0000000..fb64ce3 --- /dev/null +++ b/compiler/equitytest/LockPosition @@ -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 + } +} diff --git a/compiler/equitytest/equity_test.go b/compiler/equitytest/equity_test.go index 36b4b65..b8f4edb 100644 --- a/compiler/equitytest/equity_test.go +++ b/compiler/equitytest/equity_test.go @@ -16,6 +16,10 @@ func TestCompileContract(t *testing.T) { want string }{ { + "./LockPosition", + "cd9f697b7bae7cac6900c3c251547ac1", + }, + { "./RepayCollateral", "557a641f0000007bcda069007b7b51547ac16951c3c251547ac1632a0000007bcd9f6900c3c251567ac1", }, -- 2.11.0