Skip to content

Instantly share code, notes, and snippets.

@avilsmeier
Last active July 2, 2022 01:35
Show Gist options
  • Save avilsmeier/15d0da4f5668c06a1b35ae2d59c6b385 to your computer and use it in GitHub Desktop.
Save avilsmeier/15d0da4f5668c06a1b35ae2d59c6b385 to your computer and use it in GitHub Desktop.
Staking Draft
{"valueParameterInfo":[["Interest",{"valueParameterFormat":{"contents":[6,"₳"],"tag":"DecimalFormat"},"valueParameterDescription":"The interest paid by the _**borrower**_."}],["Amount",{"valueParameterFormat":{"contents":[6,"₳"],"tag":"DecimalFormat"},"valueParameterDescription":"The amount borrowed by the _**borrower**_."}]],"timeParameterDescriptions":[["Loan deadline","The _**lender**_ needs to deposit the _amount_ by this time."],["Payback deadline","The _**borrower**_ needs to deposit the repayment (_amount_ plus _interest_) by this time."]],"roleDescriptions":[["Borrower","The party that borrows the _amount_."],["Lender","The party that lends the _amount_."]],"contractType":"ZeroCouponBond","contractShortDescription":"A simple loan: the _**borrower**_ borrows the _amount_ from the _**lender**_, and at the _payback deadline_ pays back the _amount_ plus _interest_.","contractName":"Loan","contractLongDescription":"This is a high risk/high reward contract. There is no guarantee that the _**borrower**_ will pay back the loan. However there is an opportunity for the _**lender**_ to set a high _interest_ rate at the cost of taking on this risk.","choiceInfo":[]}
When
[Case
(Deposit
(Role "Staker")
(Role "Staker")
(Token "656565" "NFT")
(ConstantParam "Amount")
)
(Let
"startStake"
TimeIntervalStart
(Let
"EndStake"
(AddValue
TimeIntervalStart
(Constant 30)
)
(When
[Case
(Choice
(ChoiceId
"unstakeEarly"
(Role "Staker")
)
[Bound 1 1]
)
(If
(ValueGE
(ChoiceValue
(ChoiceId
"unstakeEarly"
(Role "Staker")
))
(Constant 1)
)
(Pay
(Role "Staker")
(Party (Role "Staker"))
(Token "656565" "NFT")
(ConstantParam "Amount")
Close
)
Close
)]
(TimeParam "UnstakeTimeout")
(Pay
(Role "Staker")
(Party (Role "Staker"))
(Token "656565" "NFT")
(ConstantParam "Amount")
(Pay
(PK "1111000000000000000000000000000000000000000000000000000000000000")
(Party (Role "Staker"))
(Token "222222" "REWARDS")
(Constant 100)
Close
)
)
)
)
)]
(TimeParam "UnstakeTimeout")
Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment