@@ -6,7 +6,10 @@ use near_sdk::{
66 near, require, AccountId , Gas , Promise , PromiseOrValue ,
77} ;
88
9- use crate :: asset:: { BorrowAsset , FungibleAsset } ;
9+ use crate :: {
10+ asset:: { BorrowAsset , FungibleAsset } ,
11+ supply:: SupplyPosition ,
12+ } ;
1013
1114pub type TimestampNs = u64 ;
1215
@@ -508,13 +511,13 @@ impl IdleBalanceDelta {
508511#[ near( event_json( standard = "templar-vault" ) ) ]
509512pub enum Event {
510513 #[ event_version( "1.0.0" ) ]
511- MintedShares { amount : U128 , receiver : AccountId } ,
514+ IdleBalanceUpdated { prev : U128 , delta : IdleBalanceDelta } ,
512515 #[ event_version( "1.0.0" ) ]
513- AllocationStarted { op_id : U64 , remaining : U128 } ,
516+ PerformanceFeeAccrued { recipient : AccountId , shares : U128 } ,
514517 #[ event_version( "1.0.0" ) ]
515- IdleBalanceUpdated { prev : U128 , delta : IdleBalanceDelta } ,
518+ LockChange { is_locked : bool , market_index : u32 } ,
516519
517- // Allocation lifecycle (plan/request)
520+ // Allocation
518521 #[ event_version( "1.0.0" ) ]
519522 AllocationRequestedQueue { op_id : U64 , total : U128 } ,
520523 #[ event_version( "1.0.0" ) ]
@@ -523,8 +526,8 @@ pub enum Event {
523526 total : U128 ,
524527 plan : Vec < ( AccountId , U128 ) > ,
525528 } ,
526-
527- // Per-step planning and outcomes
529+ # [ event_version ( "1.0.0" ) ]
530+ AllocationStarted { op_id : U64 , remaining : U128 } ,
528531 #[ event_version( "1.0.0" ) ]
529532 AllocationStepPlanned {
530533 op_id : U64 ,
@@ -563,8 +566,6 @@ pub enum Event {
563566 refunded : U128 ,
564567 remaining_after : U128 ,
565568 } ,
566-
567- // Completion and stop
568569 #[ event_version( "1.0.0" ) ]
569570 AllocationCompleted { op_id : u64 } ,
570571 #[ event_version( "1.0.0" ) ]
@@ -575,12 +576,6 @@ pub enum Event {
575576 reason : Option < String > ,
576577 } ,
577578
578- #[ event_version( "1.0.0" ) ]
579- PerformanceFeeAccrued { recipient : AccountId , shares : U128 } ,
580-
581- #[ event_version( "1.0.0" ) ]
582- LockChange { is_locked : bool , market_index : u32 } ,
583-
584579 // Admin and configuration events
585580 #[ event_version( "1.0.0" ) ]
586581 CuratorSet { account : AccountId } ,
@@ -594,7 +589,6 @@ pub enum Event {
594589 FeeRecipientSet { account : AccountId } ,
595590 #[ event_version( "1.0.0" ) ]
596591 PerformanceFeeSet { fee : U128 } ,
597-
598592 #[ event_version( "1.0.0" ) ]
599593 TimelockSet { seconds : U64 } ,
600594 #[ event_version( "1.0.0" ) ]
@@ -606,34 +600,30 @@ pub enum Event {
606600 #[ event_version( "1.0.0" ) ]
607601 MarketCreated { market : AccountId } ,
608602 #[ event_version( "1.0.0" ) ]
603+ MarketEnabled { market : AccountId } ,
604+ #[ event_version( "1.0.0" ) ]
605+ MarketRemovalSubmitted {
606+ market : AccountId ,
607+ removable_at : U64 ,
608+ } ,
609+ #[ event_version( "1.0.0" ) ]
610+ MarketRemovalRevoked { market : AccountId } ,
611+ #[ event_version( "1.0.0" ) ]
609612 SupplyCapRaiseSubmitted {
610613 market : AccountId ,
611614 new_cap : U128 ,
612615 valid_at_ns : u64 ,
613616 } ,
614617 #[ event_version( "1.0.0" ) ]
615618 SupplyCapRaiseRevoked { market : AccountId } ,
616-
617619 #[ event_version( "1.0.0" ) ]
618620 SupplyCapSet { market : AccountId , new_cap : U128 } ,
619- #[ event_version( "1.0.0" ) ]
620- MarketEnabled { market : AccountId } ,
621- #[ event_version( "1.0.0" ) ]
622- MarketAlreadyInWithdrawQueue { market : AccountId } ,
623- #[ event_version( "1.0.0" ) ]
624- WithdrawQueueMarketAdded { market : AccountId } ,
621+
625622 #[ event_version( "1.0.0" ) ]
626623 WithdrawDequeued { index : U64 } ,
627624 #[ event_version( "1.0.0" ) ]
628625 WithdrawalParked { id : U64 } ,
629626 #[ event_version( "1.0.0" ) ]
630- MarketRemovalSubmitted {
631- market : AccountId ,
632- removable_at : U64 ,
633- } ,
634- #[ event_version( "1.0.0" ) ]
635- MarketRemovalRevoked { market : AccountId } ,
636- #[ event_version( "1.0.0" ) ]
637627 WithdrawExecutionRequired { op_id : U64 , market_index : u32 } ,
638628
639629 // User flows
@@ -672,19 +662,27 @@ pub enum Event {
672662
673663 // Withdrawal read diagnostics
674664 #[ event_version( "1.0.0" ) ]
675- WithdrawalPositionReadFailed {
665+ CreateWithdrawalFailed {
676666 op_id : U64 ,
677667 market : AccountId ,
678668 index : u32 ,
679- before : U128 ,
669+ need : U128 ,
680670 } ,
681671
682672 #[ event_version( "1.0.0" ) ]
683- CreateWithdrawalFailed {
673+ WithdrawalInflowMismatch {
684674 op_id : U64 ,
685675 market : AccountId ,
686676 index : u32 ,
687- need : U128 ,
677+ delta : U128 ,
678+ inflow : U128 ,
679+ } ,
680+ #[ event_version( "1.0.0" ) ]
681+ WithdrawalOverpayCredited {
682+ op_id : U64 ,
683+ market : AccountId ,
684+ index : u32 ,
685+ extra : U128 ,
688686 } ,
689687
690688 // Payout and stop diagnostics
@@ -720,27 +718,29 @@ pub enum Event {
720718 } ,
721719
722720 #[ event_version( "1.0.0" ) ]
723- WithdrawalPositionMissing {
721+ ReportedPosition {
724722 op_id : U64 ,
725723 market : AccountId ,
726724 index : u32 ,
727- before : U128 ,
725+ position : SupplyPosition ,
728726 } ,
729727 #[ event_version( "1.0.0" ) ]
730- WithdrawalInflowMismatch {
728+ PositionReadFailed {
731729 op_id : U64 ,
732730 market : AccountId ,
733731 index : u32 ,
734- delta : U128 ,
735- inflow : U128 ,
732+ before : U128 ,
736733 } ,
737734 #[ event_version( "1.0.0" ) ]
738- WithdrawalOverpayCredited {
735+ PositionMissing {
739736 op_id : U64 ,
740737 market : AccountId ,
741738 index : u32 ,
742- extra : U128 ,
739+ before : U128 ,
743740 } ,
741+
742+ #[ event_version( "1.0.0" ) ]
743+ VaultBalance { amount : U128 } ,
744744}
745745
746746#[ near( serializers = [ borsh, serde] ) ]
0 commit comments