File tree Expand file tree Collapse file tree
contracts/ip_registry/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -787,6 +787,24 @@ impl IpRegistry {
787787 . unwrap_or ( Vec :: new ( & env) )
788788 }
789789
790+ /// Set or update the suggested price for an IP. Owner-only. Pass 0 to clear.
791+ pub fn set_ip_suggested_price ( env : Env , ip_id : u64 , price : i128 ) {
792+ let record = require_ip_exists ( & env, ip_id) ;
793+ record. owner . require_auth ( ) ;
794+ if price == 0 {
795+ env. storage ( ) . persistent ( ) . remove ( & DataKey :: SuggestedPrice ( ip_id) ) ;
796+ } else {
797+ env. storage ( ) . persistent ( ) . set ( & DataKey :: SuggestedPrice ( ip_id) , & price) ;
798+ env. storage ( ) . persistent ( ) . extend_ttl ( & DataKey :: SuggestedPrice ( ip_id) , LEDGER_BUMP , LEDGER_BUMP ) ;
799+ }
800+ }
801+
802+ /// Get the suggested price for an IP. Returns None if no price has been set.
803+ pub fn get_ip_suggested_price ( env : Env , ip_id : u64 ) -> Option < i128 > {
804+ require_ip_exists ( & env, ip_id) ;
805+ env. storage ( ) . persistent ( ) . get ( & DataKey :: SuggestedPrice ( ip_id) )
806+ }
807+
790808 /// Add a co-owner to an IP. Owner-only.
791809 /// Co-owners can verify commitments but cannot transfer or revoke the IP.
792810 pub fn add_co_owner ( env : Env , ip_id : u64 , co_owner : Address ) {
You can’t perform that action at this time.
0 commit comments