feat: add end-of-cycle-id to synthetic pox events

This commit is contained in:
Matthew Little
2024-02-22 18:33:02 +01:00
committed by Marzi
parent 3b6b05cb9f
commit abb78614b8

View File

@@ -115,6 +115,9 @@ fn create_event_info_data_code(
"stack-stx" => {
format!(
r#"
(let (
(unlock-burn-height (reward-cycle-to-burn-height (+ (current-pox-reward-cycle) u1 {lock_period})))
)
{{
data: {{
;; amount of ustx to lock.
@@ -122,7 +125,7 @@ fn create_event_info_data_code(
lock-amount: {lock_amount},
;; burnchain height when the unlock finishes.
;; derived from args[3]
unlock-burn-height: (reward-cycle-to-burn-height (+ (current-pox-reward-cycle) u1 {lock_period})),
unlock-burn-height: unlock-burn-height,
;; PoX address tuple.
;; equal to args[1].
pox-addr: {pox_addr},
@@ -140,8 +143,10 @@ fn create_event_info_data_code(
max-amount: {max_amount},
;; equal to args[7]
auth-id: {auth_id},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle unlock-burn-height),
}}
}}
}})
"#,
lock_amount = &args[0],
lock_period = &args[3],
@@ -156,6 +161,9 @@ fn create_event_info_data_code(
"delegate-stack-stx" => {
format!(
r#"
(let (
(unlock-burn-height (reward-cycle-to-burn-height (+ (current-pox-reward-cycle) u1 {lock_period})))
)
{{
data: {{
;; amount of ustx to lock.
@@ -163,7 +171,7 @@ fn create_event_info_data_code(
lock-amount: {lock_amount},
;; burnchain height when the unlock finishes.
;; derived from args[4]
unlock-burn-height: (reward-cycle-to-burn-height (+ (current-pox-reward-cycle) u1 {lock_period})),
unlock-burn-height: unlock-burn-height,
;; PoX address tuple.
;; equal to args[2]
pox-addr: {pox_addr},
@@ -178,8 +186,10 @@ fn create_event_info_data_code(
;; stacker
;; equal to args[0]
stacker: '{stacker},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle unlock-burn-height),
}}
}}
}})
"#,
stacker = &args[0],
lock_amount = &args[1],
@@ -210,6 +220,8 @@ fn create_event_info_data_code(
max-amount: {max_amount},
;; equal to args[4]
auth-id: {auth_id},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle (get unlock-height (stx-account tx-sender))),
}}
}}
"#,
@@ -239,7 +251,9 @@ fn create_event_info_data_code(
delegator: tx-sender,
;; stacker
;; equal to args[0]
stacker: '{stacker}
stacker: '{stacker},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle (get unlock-height (stx-account '{stacker}))),
}}
}}
"#,
@@ -281,6 +295,8 @@ fn create_event_info_data_code(
max-amount: {max_amount},
;; equal to args[5]
auth-id: {auth_id},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle new-unlock-ht),
}}
}})
"#,
@@ -320,7 +336,9 @@ fn create_event_info_data_code(
delegator: tx-sender,
;; stacker
;; equal to args[0]
stacker: '{stacker}
stacker: '{stacker},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle new-unlock-ht),
}}
}})
"#,
@@ -354,6 +372,8 @@ fn create_event_info_data_code(
max-amount: {max_amount},
;; equal to args[5]
auth-id: {auth_id},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle (get unlock-height (stx-account tx-sender))),
}}
}}
"#,
@@ -383,7 +403,9 @@ fn create_event_info_data_code(
;; delegator (this is the caller)
delegator: tx-sender,
;; equal to args[2]
reward-cycle-index: {reward_cycle_index}
reward-cycle-index: {reward_cycle_index},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle (get unlock-height (stx-account tx-sender))),
}}
}}
"#,
@@ -408,7 +430,9 @@ fn create_event_info_data_code(
unlock-burn-height: {until_burn_height},
;; optional PoX address tuple.
;; equal to args[3].
pox-addr: {pox_addr}
pox-addr: {pox_addr},
;; Get end cycle ID
end-cycle-id: (burn-height-to-reward-cycle {until_burn_height}),
}}
}}
"#,