Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8ae6f81
cip-82: add DevelopmentFundCoupon template
jose-velasco-ieu Nov 4, 2025
59ebaa5
cip-82: add DevelopmentFundConfig to AmuletConfig
jose-velasco-ieu Nov 4, 2025
33acab3
cip-82: add InputDevelopmentFundCoupon to TransferInput
jose-velasco-ieu Nov 4, 2025
c9eab5e
cip-82: update comment
jose-velasco-ieu Nov 4, 2025
e259389
cip-82: remove round from DevelopmentFundCoupon
jose-velasco-ieu Nov 4, 2025
adf3d4d
cip-82: add AmuletRules_MergeDevelopmentFundCoupons
jose-velasco-ieu Nov 4, 2025
a8f2c02
cip-82: add DsoRules_MergeDevelopmentFundCoupons
jose-velasco-ieu Nov 4, 2025
634cfd1
cip-82: change issuance computation to deduct the fund issuance + cre…
jose-velasco-ieu Nov 5, 2025
85008e8
cip-82: add note
jose-velasco-ieu Nov 5, 2025
50350b4
cip-82: naming
jose-velasco-ieu Nov 5, 2025
7cea94f
Update daml/splice-amulet/daml/Splice/AmuletConfig.daml
jose-velasco-ieu Nov 6, 2025
6d53cff
Update daml/splice-amulet/daml/Splice/AmuletRules.daml
jose-velasco-ieu Nov 6, 2025
c123209
Update daml/splice-amulet/daml/Splice/Issuance.daml
jose-velasco-ieu Nov 6, 2025
1a2f55c
Update daml/splice-amulet/daml/Splice/Issuance.daml
jose-velasco-ieu Nov 6, 2025
a7fd0f0
Update daml/splice-amulet/daml/Splice/Issuance.daml
jose-velasco-ieu Nov 6, 2025
0cde44e
Update daml/splice-dso-governance/daml/Splice/DsoRules.daml
jose-velasco-ieu Nov 6, 2025
38e2d1e
Update daml/splice-dso-governance/daml/Splice/DsoRules.daml
jose-velasco-ieu Nov 6, 2025
dcf118e
Update daml/splice-dso-governance/daml/Splice/DsoRules.daml
jose-velasco-ieu Nov 6, 2025
d9998bb
Update daml/splice-amulet/daml/Splice/Amulet.daml
jose-velasco-ieu Nov 6, 2025
7792e40
cip-82: fix daml build (DsoRules_MergeDevelopmentFundCoupons)
jose-velasco-ieu Nov 6, 2025
a5c8c67
cip-82: refine documentation to remove references to config fields
jose-velasco-ieu Nov 6, 2025
f5d9b43
cip-82: make beneficiary optional to decouple fund issuance activatio…
jose-velasco-ieu Nov 6, 2025
d3561be
cip-82: replace DevelomentFundConfig with IssuanceConfig.optDevelopme…
jose-velasco-ieu Nov 6, 2025
91dbe44
cip-82: add unit test for issuance with 5% development fund
jose-velasco-ieu Nov 10, 2025
9c083e6
cip-82: add optDevelopmentFundPercentage value to testAmuletRulesConf…
jose-velasco-ieu Nov 10, 2025
ba38837
cip-82: add optDevelopmentFundBeneficiary value to testAmuletRulesCon…
jose-velasco-ieu Nov 10, 2025
9d683eb
cip-82: add initDevNetWithAmuletConfig test helper
jose-velasco-ieu Nov 10, 2025
ecad0f3
cip-82: test merging of Development Fund coupons
jose-velasco-ieu Nov 10, 2025
c7ca25b
cip-82 - minor fix in comments/error message
jose-velasco-ieu Nov 11, 2025
3995ea6
cip-82: add test for InputDevelopmentFundCoupon
jose-velasco-ieu Nov 11, 2025
86c3028
Update daml/splice-amulet/daml/Splice/Issuance.daml
jose-velasco-ieu Nov 13, 2025
c851d5e
Update daml/splice-dso-governance/daml/Splice/DsoRules.daml
jose-velasco-ieu Nov 13, 2025
a40f4c8
cip-82: fix daml build
jose-velasco-ieu Nov 13, 2025
512ab53
cip-82: remove unneeded comment
jose-velasco-ieu Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

module Splice.Scripts.TestAmuletRulesTransfer where

import DA.Action (replicateA_)
import DA.Assert
import DA.Foldable (forA_)
import DA.List
Expand Down Expand Up @@ -110,6 +111,7 @@ testUsageFees = do
inputUnclaimedActivityRecordAmount = Some 0.0
inputValidatorFaucetAmount = Some 0.0
inputSvRewardAmount = 0.0
inputDevelopmentFundAmount = Some 0.0
inputAmuletAmount = 100.0
balanceChanges = Map.empty
holdingFees = 0.0 -- no holding fees charged on transfer
Expand Down Expand Up @@ -576,3 +578,58 @@ testUnclaimedActivityRecordTransferInput = do
transferResult.summary.senderChangeAmount === amountToMint - createFee

pure ()

testInputDevelopmentFundCoupon : Script ()
testInputDevelopmentFundCoupon = do
defaultAppWithUsers@DefaultAppWithUsers{..} <- setupDefaultAppWithUsers
baseConfig <- getAmuletConfig app
-- Replace the default AmuletConfig with a 0.05% allocation for the development fund
-- and Alice as the beneficiary. This configuration applies to the next open round.
setAmuletConfig app baseConfig baseConfig with
issuanceCurve = baseConfig.issuanceCurve with
initialValue = baseConfig.issuanceCurve.initialValue with
optDevelopmentFundPercentage = Some 0.05
transferConfig = baseConfig.transferConfig with
optDevelopmentFundBeneficiary = Some alice.primaryParty

-- Run 3 issuances for the already open rounds without the development fund configuration.
-- No development fund coupons are minted.
replicateA_ 3 $ runNextIssuance app
-- Mint one development fund coupon per issuance (two total).
runNextIssuance app
runNextIssuance app
context <- getPaymentTransferContext app alice
[(cid1, coupon1), (cid2, coupon2)] <- query @DevelopmentFundCoupon app.dso
let totalAmount = coupon1.amount + coupon2.amount

-- Unhappy path - requires that the sender matches the development fund beneficiary.
submitMultiMustFail [bob.primaryParty] [app.dso] $
exerciseCmd context.amuletRules AmuletRules_Transfer with
transfer = Transfer with
sender = bob.primaryParty
provider = bob.primaryParty
inputs = [InputDevelopmentFundCoupon cid1, InputDevelopmentFundCoupon cid2]
outputs = []
beneficiaries = None
context = context.context
expectedDso = Some app.dso

-- Happy path
transferResult <-
checkTransferMetadata app TxKind_MergeSplit alice.primaryParty $
checkBalanceChanges defaultAppWithUsers $
submitMulti [alice.primaryParty] [app.dso] $
exerciseCmd context.amuletRules AmuletRules_Transfer with
transfer = Transfer with
sender = alice.primaryParty
provider = alice.primaryParty
inputs = [InputDevelopmentFundCoupon cid1, InputDevelopmentFundCoupon cid2]
outputs = []
beneficiaries = None
context = context.context
expectedDso = Some app.dso
(_, openRound) <- getLatestActiveOpenRound app
let createFee = openRound.transferConfigUsd.createFee.fee * openRound.amuletPrice
transferResult.summary.senderChangeAmount === totalAmount - createFee

pure ()
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ test_designExample= do
inputUnclaimedActivityRecordAmount = Some 0.0
inputValidatorFaucetAmount = Some 0.0
inputSvRewardAmount = 0.0
inputDevelopmentFundAmount = Some 0.0
inputAmuletAmount = refreshAmuletAmount + lockedAmuletAmount
balanceChanges = Map.empty
holdingFees
Expand Down
152 changes: 144 additions & 8 deletions daml/splice-amulet-test/daml/Splice/Scripts/UnitTests/Issuance.daml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tickDuration = defaultAmuletConfig.tickDuration
amuletPrice : Decimal
amuletPrice = 0.005


-- Issuance curve retrieval
---------------------------

Expand Down Expand Up @@ -66,6 +67,16 @@ expectedParameters_E1_0_0p5 = IssuingRoundParameters with
unclaimedValidatorRewards = 7551.7503805175
unclaimedAppRewards = 68395.2511415525
unclaimedSvRewards = 0.0000000001
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_E1_0_0p5_DevFund5 : IssuingRoundParameters
expectedParameters_E1_0_0p5_DevFund5 =
expectedParameters_E1_0_0p5 with
issuancePerSvRewardCoupon = 5783.8660578387 -- decreased by ~5 % (expected linear scaling with 5 % fund allocation)
unclaimedValidatorRewards = 5649.1628614916 -- decreased by ~25 % (validator tranche near cap: small pool cut sharply reduces unclaimed remainder)
unclaimedAppRewards = 62687.4885844749 -- decreased by ~8.3 % (app tranche less constrained; closer to linear scaling)
unclaimedSvRewards = 0.0 -- decreased ~5 % (below rounding threshold)
amuletsToIssueToDevelopmentFund = 38051.7503805175

expectedParameters_E1_0p5_1p5 : IssuingRoundParameters
expectedParameters_E1_0p5_1p5 = IssuingRoundParameters with
Expand All @@ -77,6 +88,16 @@ expectedParameters_E1_0p5_1p5 = IssuingRoundParameters with
unclaimedValidatorRewards = 15162.1004566210
unclaimedAppRewards = 106447.0015220700
unclaimedSvRewards = 0.000000004
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_E1_0p5_1p5_DevFund5 : IssuingRoundParameters
expectedParameters_E1_0p5_1p5_DevFund5 =
expectedParameters_E1_0p5_1p5 with
issuancePerSvRewardCoupon = 1735.1598173516 -- decreased by ~5 % (expected linear scaling with 5 % fund allocation)
unclaimedValidatorRewards = 12878.9954337899 -- decreased by ~15 % (validator tranche near cap: small pool cut sharply reduces unclaimed remainder)
unclaimedAppRewards = 98836.6514459665 -- decreased by ~10 % (app tranche less constrained; closer to linear scaling)
unclaimedSvRewards = 0.0 -- decreased ~5 % (below rounding threshold)
amuletsToIssueToDevelopmentFund = 19025.8751902588

expectedParameters_E1_1p5_5 : IssuingRoundParameters
expectedParameters_E1_1p5_5 = IssuingRoundParameters with
Expand All @@ -88,6 +109,16 @@ expectedParameters_E1_1p5_5 = IssuingRoundParameters with
unclaimedValidatorRewards = 3746.5753424658
unclaimedAppRewards = 72200.4261796042
unclaimedSvRewards = 0.0
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_E1_1p5_5_DevFund5 : IssuingRoundParameters
expectedParameters_E1_1p5_5_DevFund5 =
expectedParameters_E1_1p5_5 with
issuancePerSvRewardCoupon = 361.4916286149 -- decreased by ~5 % (expected linear scaling with 5 % fund allocation)
unclaimedValidatorRewards = 2034.2465753425 -- decreased by ~45 % (validator tranche strongly cap-bound; small pool accentuates drop)
unclaimedAppRewards = 66302.4048706240 -- decreased by ~8.2 % (app tranche less constrained; close to linear scaling)
unclaimedSvRewards = 0.0000000016 -- minor rounding drift (below significance threshold)
amuletsToIssueToDevelopmentFund = 9512.9375951294

expectedParameters_E1_5_10 : IssuingRoundParameters
expectedParameters_E1_5_10 = IssuingRoundParameters with
Expand All @@ -99,6 +130,17 @@ expectedParameters_E1_5_10 = IssuingRoundParameters with
unclaimedValidatorRewards = 0.0000000017
unclaimedAppRewards = 19879.2694063927
unclaimedSvRewards = 0.0
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_E1_5_10_DevFund5 : IssuingRoundParameters
expectedParameters_E1_5_10_DevFund5 =
expectedParameters_E1_5_10 with
issuancePerValidatorFaucetCoupon = 339.5662100457 -- decreased by ~5.6 % (slightly above 5 % due to faucet cap effects)
issuancePerSvRewardCoupon = 90.3729071537 -- decreased by ~5 % (expected linear scaling)
unclaimedValidatorRewards = 0.0 -- minor rounding drift (below significance threshold)
unclaimedAppRewards = 16597.3059360731 -- decreased by ~16.5 % (cap constraints amplify reduction)
unclaimedSvRewards = 0.0000000029 -- minor rounding drift (below significance threshold)
amuletsToIssueToDevelopmentFund = 4756.4687975647

expectedParameters_E1_10plus : IssuingRoundParameters
expectedParameters_E1_10plus = IssuingRoundParameters with
Expand All @@ -110,23 +152,45 @@ expectedParameters_E1_10plus = IssuingRoundParameters with
unclaimedValidatorRewards = 0.0
unclaimedAppRewards = 0.0000000152
unclaimedSvRewards = 0.0000000023
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_E1_10plus_DevFund5 : IssuingRoundParameters
expectedParameters_E1_10plus_DevFund5 =
expectedParameters_E1_10plus with
issuancePerFeaturedAppRewardCoupon = 70.3246004566 -- decreased by ~6 % (slightly above 5 % since both featured and unfeatured tranches are below cap)
issuancePerValidatorFaucetCoupon = 140.7458143075 -- decreased by ~6.3 % (faucet below cap, reduced pool scales slightly more than linearly)
issuancePerSvRewardCoupon = 22.5932267884 -- decreased by ~5 % (expected linear scaling)
unclaimedAppRewards = 0.0000000084 -- decreased ~5 % (below rounding threshold)
unclaimedSvRewards = 0.0000000033 -- minor rounding drift (below significance threshold)
amuletsToIssueToDevelopmentFund = 2378.2343987823



testE1 : Script ()
testE1 = script do
validateOpenMiningRoundSummary summaryExample1

-- 0% Development Fund
expectedParameters_E1_0_0p5 === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_0_0p5 summaryExample1
expectedParameters_E1_0p5_1p5 === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_0p5_1p5 summaryExample1
expectedParameters_E1_1p5_5 === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_1p5_5 summaryExample1
expectedParameters_E1_5_10 === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_5_10 summaryExample1
expectedParameters_E1_10plus === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_10plus summaryExample1

-- 5% Development Fund
-- Most parameters decrease by ~5%; larger deviations occur when issuance caps bind or rounding applies.
expectedParameters_E1_0_0p5_DevFund5 === computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_0_0p5) summaryExample1
expectedParameters_E1_0p5_1p5_DevFund5 === computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_0p5_1p5) summaryExample1
expectedParameters_E1_1p5_5_DevFund5 === computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_1p5_5) summaryExample1
expectedParameters_E1_5_10_DevFund5 === computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_5_10) summaryExample1
expectedParameters_E1_10plus_DevFund5 === computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_10plus) summaryExample1


-- Example 2: all zeros
-----------------------

summaryExamplNoActivity : OpenMiningRoundSummary
summaryExamplNoActivity = OpenMiningRoundSummary with
summaryExampleNoActivity : OpenMiningRoundSummary
summaryExampleNoActivity = OpenMiningRoundSummary with
totalValidatorRewardCoupons = 0.0
totalFeaturedAppRewardCoupons = 0.0
totalUnfeaturedAppRewardCoupons = 0.0
Expand All @@ -143,12 +207,28 @@ expectedParameters_NoActivity_0_0p5 = IssuingRoundParameters with
unclaimedValidatorRewards = 38051.7503805175
unclaimedAppRewards = 114155.2511415525
unclaimedSvRewards = 608828.0060882801
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_NoActivity_0_0p5_DevFund5 : IssuingRoundParameters
expectedParameters_NoActivity_0_0p5_DevFund5 =
expectedParameters_NoActivity_0_0p5 with
issuancePerSvRewardCoupon = 578386.6057838661 -- decreased by ~5 % (expected linear scaling; no coupons active)
unclaimedValidatorRewards = 36149.1628614916 -- decreased by ~5 % (fund allocation directly reduces total issuance)
unclaimedAppRewards = 108447.4885844749 -- decreased by ~5 % (expected linear scaling)
unclaimedSvRewards = 578386.6057838661 -- decreased by ~5 % (identical scaling since all rewards remain unclaimed)
amuletsToIssueToDevelopmentFund = 38051.7503805175


testNoActivity : Script ()
testNoActivity = script do
validateOpenMiningRoundSummary summaryExamplNoActivity
validateOpenMiningRoundSummary summaryExampleNoActivity

-- 0% Development Fund
expectedParameters_NoActivity_0_0p5 === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_0_0p5 summaryExampleNoActivity

expectedParameters_NoActivity_0_0p5 === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_0_0p5 summaryExamplNoActivity
-- 5% Development Fund
-- Most parameters decrease by ~5%; larger deviations occur when issuance caps bind or rounding applies.
expectedParameters_NoActivity_0_0p5_DevFund5 === computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_0_0p5) summaryExampleNoActivity


-- Example 3: low activity
Expand All @@ -173,18 +253,31 @@ expectedParameters_E3_0_0p5 = IssuingRoundParameters with
unclaimedValidatorRewards = 9511.7503805175
unclaimedAppRewards = 104095.2511415525
unclaimedSvRewards = 0.0000000001
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_E3_0_0p5_DevFund5 : IssuingRoundParameters
expectedParameters_E3_0_0p5_DevFund5 =
expectedParameters_E3_0_0p5 with
issuancePerSvRewardCoupon = 289193.302891933 -- decreased by ~5 % (expected linear scaling; SV tranche not capped)
unclaimedValidatorRewards = 7609.1628614916 -- decreased by ~20 % (validator tranche near cap, amplifying reduction)
unclaimedAppRewards = 98387.4885844749 -- decreased by ~5.5 % (mostly linear scaling)
amuletsToIssueToDevelopmentFund = 38051.7503805175

testE4 : Script ()
testE4 = script do
validateOpenMiningRoundSummary summaryExample3

-- 0% Development Fund
expectedParameters_E3_0_0p5 === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_0_0p5 summaryExample3

-- 5% Development Fund
-- Most parameters decrease by ~5%; larger deviations occur when issuance caps bind or rounding applies.
expectedParameters_E3_0_0p5_DevFund5 === computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_0_0p5) summaryExample3


-- Example 4: millions of SV reward weight
-------------------------------------------


summaryExampleLargeSvRewardWeight : OpenMiningRoundSummary
summaryExampleLargeSvRewardWeight = OpenMiningRoundSummary with
totalValidatorRewardCoupons = 0.0
Expand All @@ -203,13 +296,56 @@ expectedParameters_LargeSvRewardWeight_10plus = IssuingRoundParameters with
unclaimedAppRewards = 35673.5159817352
unclaimedValidatorRewards = 9512.9375951294
unclaimedSvRewards = 0.0
amuletsToIssueToDevelopmentFund = 0.0

expectedParameters_LargeSvRewardWeight_10plus_DevFund5 : IssuingRoundParameters
expectedParameters_LargeSvRewardWeight_10plus_DevFund5 =
expectedParameters_LargeSvRewardWeight_10plus with
issuancePerSvRewardCoupon = 0.0009413844 -- decreased by ~5 % (expected linear scaling; SV weight dominates distribution)
unclaimedValidatorRewards = 9037.2907153729 -- decreased by ~5 % (linear with total issuance)
unclaimedAppRewards = 33889.8401826484 -- decreased by ~5 % (expected linear scaling)
unclaimedSvRewards = 0.0001188433 -- minor rounding drift (below significance threshold)
amuletsToIssueToDevelopmentFund = 2378.2343987823

testLargeSvRewardWeight : Script ()
testLargeSvRewardWeight = script do
validateOpenMiningRoundSummary summaryExamplNoActivity
validateOpenMiningRoundSummary summaryExampleNoActivity

-- 0% Development Fund
expectedParameters_LargeSvRewardWeight_10plus ===
computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_10plus summaryExampleLargeSvRewardWeight

-- 5% Development Fund
-- Most parameters decrease by ~5%; larger deviations occur when issuance caps bind or rounding applies.
expectedParameters_LargeSvRewardWeight_10plus_DevFund5 ===
computeIssuingRoundParameters tickDuration amuletPrice (withDevFund5 issuanceConfig_10plus) summaryExampleLargeSvRewardWeight


let actual = computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_10plus summaryExampleLargeSvRewardWeight
expectedParameters_LargeSvRewardWeight_10plus === actual
-- Example 5: Development Fund receives the full issuance
----------------------------------------------------------

expectedParameters_AllIssuanceForFund : IssuingRoundParameters
expectedParameters_AllIssuanceForFund = IssuingRoundParameters with
issuancePerValidatorRewardCoupon = 0.0
issuancePerFeaturedAppRewardCoupon = 0.0
issuancePerUnfeaturedAppRewardCoupon = 0.0
issuancePerValidatorFaucetCoupon = 0.0
issuancePerSvRewardCoupon = 0.0
unclaimedAppRewards = 0.0
unclaimedValidatorRewards = 0.0
unclaimedSvRewards = 0.0
amuletsToIssueToDevelopmentFund = 761035.0076103501

testAllIssuanceForFund : Script ()
testAllIssuanceForFund = script do
validateOpenMiningRoundSummary summaryExample3

-- 100% Development Fund
-- All issuance goes to the Development Fund; all reward-related fields are zero.
let issuanceConfig_0_0p5_fundOne = issuanceConfig_0_0p5 with optDevelopmentFundPercentage = Some 1.0
expectedParameters_AllIssuanceForFund === computeIssuingRoundParameters tickDuration amuletPrice issuanceConfig_0_0p5_fundOne summaryExample1


-- Utility: apply 5% Development Fund allocation
withDevFund5 : IssuanceConfig -> IssuanceConfig
withDevFund5 config = config with optDevelopmentFundPercentage = Some 0.05
15 changes: 13 additions & 2 deletions daml/splice-amulet-test/daml/Splice/Scripts/Util.daml
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,14 @@ getAmuletConfig app = do
now <- getTime
pure $ getValueAsOf now amuletRules.configSchedule

setAmuletConfig : AmuletApp -> AmuletConfig Unit.USD -> AmuletConfig Unit.USD -> Script ()
setAmuletConfig app baseConfig newConfig = do
Some (amuletRulesCid, _) <- queryAmuletRulesByKey app.dso
void $ submit app.dso $
exerciseCmd amuletRulesCid AmuletRules_SetConfig with
newConfig
baseConfig

-- Metadata verification
------------------------

Expand Down Expand Up @@ -693,13 +701,16 @@ genericCheckTxMetadata extractMeta extractSummary app expectedKind sender body =
mint <- case extractSummary result of
None -> pure 0.0
Some summary -> do
let inputUnclaimedActivityRecordAmount = fromOptional 0.0 summary.inputUnclaimedActivityRecordAmount
let
inputUnclaimedActivityRecordAmount = fromOptional 0.0 summary.inputUnclaimedActivityRecordAmount
inputDevelopmentFundAmountAmount = fromOptional 0.0 summary.inputDevelopmentFundAmount
expectUnlessZero svRewardAmountMetaKey summary.inputSvRewardAmount
expectUnlessZero appRewardAmountMetaKey summary.inputAppRewardAmount
expectUnlessZero validatorRewardAmountMetaKey summary.inputValidatorRewardAmount
expectUnlessZero unclaimedActivityRecordAmountMetaKey inputUnclaimedActivityRecordAmount
expectUnlessZero developmentFundAmountMetaKey inputDevelopmentFundAmountAmount
pure $ summary.inputAppRewardAmount + summary.inputValidatorRewardAmount + summary.inputSvRewardAmount +
inputUnclaimedActivityRecordAmount
inputUnclaimedActivityRecordAmount + inputDevelopmentFundAmountAmount
let expectedBurn = totalHoldingsBefore + mint - totalHoldingsAfter
-- mints are inferred, and show here as a negative burn
if (expectedBurn < 0.0)
Expand Down
Loading