Skip to content

Commit

Permalink
chore: fix jolt events
Browse files Browse the repository at this point in the history
  • Loading branch information
Darlington02 committed Jan 13, 2025
1 parent 23fbfc9 commit 50e8a1a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/jolt/jolt.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub mod JoltComponent {
pub jolt_id: u256,
pub jolt_type: felt252,
pub sender: ContractAddress,
pub amount: u256,
pub recipient: ContractAddress,
pub block_timestamp: u64,
}
Expand All @@ -62,6 +63,7 @@ pub mod JoltComponent {
pub jolt_id: u256,
pub jolt_type: felt252,
pub sender: ContractAddress,
pub amount: u256,
pub recipient: ContractAddress,
pub expiration_timestamp: u64,
pub block_timestamp: u64,
Expand All @@ -72,6 +74,7 @@ pub mod JoltComponent {
pub jolt_id: u256,
pub jolt_type: felt252,
pub sender: ContractAddress,
pub amount: u256,
pub recipient: ContractAddress,
pub expiration_timestamp: u64,
pub block_timestamp: u64,
Expand Down Expand Up @@ -464,6 +467,7 @@ pub mod JoltComponent {
jolt_id,
jolt_type: 'TIP',
sender,
amount,
recipient: recipient,
block_timestamp: get_block_timestamp(),
}
Expand Down Expand Up @@ -502,6 +506,7 @@ pub mod JoltComponent {
jolt_id,
jolt_type: 'TRANSFER',
sender,
amount,
recipient: recipient,
block_timestamp: get_block_timestamp(),
}
Expand Down Expand Up @@ -558,6 +563,7 @@ pub mod JoltComponent {
jolt_id,
jolt_type: 'SUBSCRIPTION',
sender,
amount: subscription_data.amount,
recipient: subscription_data.fee_address,
block_timestamp: get_block_timestamp(),
}
Expand Down Expand Up @@ -597,6 +603,7 @@ pub mod JoltComponent {
jolt_id,
jolt_type: 'REQUEST',
sender,
amount,
recipient: recipient,
expiration_timestamp,
block_timestamp: get_block_timestamp(),
Expand Down Expand Up @@ -637,6 +644,7 @@ pub mod JoltComponent {
jolt_id,
jolt_type: 'REQUEST FULFILLMENT',
sender: jolt_details.recipient,
amount: jolt_details.amount,
recipient: jolt_details.sender,
expiration_timestamp: jolt_details.expiration_stamp,
block_timestamp: get_block_timestamp(),
Expand Down Expand Up @@ -704,6 +712,7 @@ pub mod JoltComponent {
jolt_id,
jolt_type: 'SUBSCRIPTION',
sender,
amount,
recipient: fee_address,
block_timestamp: get_block_timestamp(),
}
Expand Down
6 changes: 6 additions & 0 deletions tests/test_jolt.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ fn test_jolt_event_is_emitted_on_tipping() {
Jolted {
jolt_id: jolt_id,
jolt_type: 'TIP',
amount: 2000000000000000000,
sender: ADDRESS1.try_into().unwrap(),
recipient: ADDRESS2.try_into().unwrap(),
block_timestamp: 36000,
Expand Down Expand Up @@ -409,6 +410,7 @@ fn test_jolt_event_is_emitted_on_transfer() {
jolt_id: jolt_id,
jolt_type: 'TRANSFER',
sender: ADDRESS1.try_into().unwrap(),
amount: 2000000000000000000,
recipient: ADDRESS2.try_into().unwrap(),
block_timestamp: 36000,
}
Expand Down Expand Up @@ -551,6 +553,7 @@ fn test_jolt_event_is_emitted_on_request() {
jolt_id: jolt_id,
jolt_type: 'REQUEST',
sender: ADDRESS1.try_into().unwrap(),
amount: 2000000000000000000,
recipient: ADDRESS2.try_into().unwrap(),
expiration_timestamp: 154600,
block_timestamp: 36000,
Expand Down Expand Up @@ -844,6 +847,7 @@ fn test_jolt_event_is_emitted_on_request_fulfillment() {
jolt_id: jolt_id,
jolt_type: 'REQUEST FULFILLMENT',
sender: ADDRESS1.try_into().unwrap(),
amount: 2000000000000000000,
recipient: ADDRESS2.try_into().unwrap(),
expiration_timestamp: 8460,
block_timestamp: 5840,
Expand Down Expand Up @@ -1055,6 +1059,7 @@ fn test_jolt_event_is_emitted_on_subscription() {
jolt_id: jolt_id,
jolt_type: 'SUBSCRIPTION',
sender: ADDRESS1.try_into().unwrap(),
amount: 1000000000000000000,
recipient: ADMIN.try_into().unwrap(),
block_timestamp: 36000,
}
Expand Down Expand Up @@ -1285,6 +1290,7 @@ fn test_auto_renewal_emits_susbcription_event() {
jolt_id: renewal_jolt_id,
jolt_type: 'SUBSCRIPTION',
sender: ADDRESS1.try_into().unwrap(),
amount: 1000000000000000000,
recipient: ADMIN.try_into().unwrap(),
block_timestamp: 36000,
}
Expand Down

0 comments on commit 50e8a1a

Please sign in to comment.