@@ -77,6 +77,15 @@ pub enum Method {
7777 AddBalanceExported = frc42_dispatch:: method_hash!( "AddBalance" ) ,
7878 WithdrawBalanceExported = frc42_dispatch:: method_hash!( "WithdrawBalance" ) ,
7979 GetBalanceExported = frc42_dispatch:: method_hash!( "GetBalance" ) ,
80+ GetDealDataCommitmentExported = frc42_dispatch:: method_hash!( "GetDealDataCommitment" ) ,
81+ GetDealClientExported = frc42_dispatch:: method_hash!( "GetDealClient" ) ,
82+ GetDealProviderExported = frc42_dispatch:: method_hash!( "GetDealProvider" ) ,
83+ GetDealLabelExported = frc42_dispatch:: method_hash!( "GetDealLabel" ) ,
84+ GetDealTermExported = frc42_dispatch:: method_hash!( "GetDealTerm" ) ,
85+ GetDealEpochPriceExported = frc42_dispatch:: method_hash!( "GetDealEpochPrice" ) ,
86+ GetDealClientCollateralExported = frc42_dispatch:: method_hash!( "GetDealClientCollateral" ) ,
87+ GetDealProviderCollateralExported = frc42_dispatch:: method_hash!( "GetDealProviderCollateral" ) ,
88+ GetDealVerifiedExported = frc42_dispatch:: method_hash!( "GetDealVerified" ) ,
8089}
8190
8291/// Market Actor
@@ -1049,6 +1058,101 @@ impl Actor {
10491058 }
10501059 Ok ( ( ) )
10511060 }
1061+
1062+ /// Returns the data commitment and size of a deal proposal.
1063+ /// This will be available after the deal is published (whether or not is is activated)
1064+ /// and up until some undefined period after it is terminated.
1065+ fn get_deal_data_commitment (
1066+ rt : & mut impl Runtime ,
1067+ params : GetDealDataCommitmentParams ,
1068+ ) -> Result < GetDealDataCommitmentReturn , ActorError > {
1069+ rt. validate_immediate_caller_accept_any ( ) ?;
1070+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1071+ Ok ( GetDealDataCommitmentReturn { data : found. piece_cid , size : found. piece_size } )
1072+ }
1073+
1074+ /// Returns the client of a deal proposal.
1075+ fn get_deal_client (
1076+ rt : & mut impl Runtime ,
1077+ params : GetDealClientParams ,
1078+ ) -> Result < GetDealClientReturn , ActorError > {
1079+ rt. validate_immediate_caller_accept_any ( ) ?;
1080+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1081+ Ok ( GetDealClientReturn { client : found. client . id ( ) . unwrap ( ) } )
1082+ }
1083+
1084+ /// Returns the provider of a deal proposal.
1085+ fn get_deal_provider (
1086+ rt : & mut impl Runtime ,
1087+ params : GetDealProviderParams ,
1088+ ) -> Result < GetDealProviderReturn , ActorError > {
1089+ rt. validate_immediate_caller_accept_any ( ) ?;
1090+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1091+ Ok ( GetDealProviderReturn { provider : found. provider . id ( ) . unwrap ( ) } )
1092+ }
1093+
1094+ /// Returns the label of a deal proposal.
1095+ fn get_deal_label (
1096+ rt : & mut impl Runtime ,
1097+ params : GetDealLabelParams ,
1098+ ) -> Result < GetDealLabelReturn , ActorError > {
1099+ rt. validate_immediate_caller_accept_any ( ) ?;
1100+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1101+ Ok ( GetDealLabelReturn { label : found. label } )
1102+ }
1103+
1104+ /// Returns the start and end epochs of a deal proposal.
1105+ /// The deal term is a half-open range, exclusive of the end epoch.
1106+ fn get_deal_term (
1107+ rt : & mut impl Runtime ,
1108+ params : GetDealTermParams ,
1109+ ) -> Result < GetDealTermReturn , ActorError > {
1110+ rt. validate_immediate_caller_accept_any ( ) ?;
1111+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1112+ Ok ( GetDealTermReturn { start : found. start_epoch , end : found. end_epoch } )
1113+ }
1114+
1115+ /// Returns the per-epoch price of a deal proposal.
1116+ fn get_deal_epoch_price (
1117+ rt : & mut impl Runtime ,
1118+ params : GetDealEpochPriceParams ,
1119+ ) -> Result < GetDealEpochPriceReturn , ActorError > {
1120+ rt. validate_immediate_caller_accept_any ( ) ?;
1121+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1122+ Ok ( GetDealEpochPriceReturn { price_per_epoch : found. storage_price_per_epoch } )
1123+ }
1124+
1125+ /// Returns the client collateral requirement for a deal proposal.
1126+ fn get_deal_client_collateral (
1127+ rt : & mut impl Runtime ,
1128+ params : GetDealClientCollateralParams ,
1129+ ) -> Result < GetDealClientCollateralReturn , ActorError > {
1130+ rt. validate_immediate_caller_accept_any ( ) ?;
1131+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1132+ Ok ( GetDealClientCollateralReturn { collateral : found. client_collateral } )
1133+ }
1134+
1135+ /// Returns the provider collateral requirement for a deal proposal.
1136+ fn get_deal_provider_collateral (
1137+ rt : & mut impl Runtime ,
1138+ params : GetDealProviderCollateralParams ,
1139+ ) -> Result < GetDealProviderCollateralReturn , ActorError > {
1140+ rt. validate_immediate_caller_accept_any ( ) ?;
1141+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1142+ Ok ( GetDealProviderCollateralReturn { collateral : found. provider_collateral } )
1143+ }
1144+
1145+ /// Returns the verified flag for a deal proposal.
1146+ /// Note that the source of truth for verified allocations and claims is
1147+ /// the verified registry actor.
1148+ fn get_deal_verified (
1149+ rt : & mut impl Runtime ,
1150+ params : GetDealVerifiedParams ,
1151+ ) -> Result < GetDealVerifiedReturn , ActorError > {
1152+ rt. validate_immediate_caller_accept_any ( ) ?;
1153+ let found = rt. state :: < State > ( ) ?. get_proposal ( rt. store ( ) , params. id ) ?;
1154+ Ok ( GetDealVerifiedReturn { verified : found. verified_deal } )
1155+ }
10521156}
10531157
10541158fn compute_data_commitment < BS : Blockstore > (
@@ -1464,6 +1568,43 @@ impl ActorCode for Actor {
14641568 let res = Self :: get_balance ( rt, cbor:: deserialize_params ( params) ?) ?;
14651569 Ok ( RawBytes :: serialize ( res) ?)
14661570 }
1571+ Some ( Method :: GetDealDataCommitmentExported ) => {
1572+ let res = Self :: get_deal_data_commitment ( rt, cbor:: deserialize_params ( params) ?) ?;
1573+ Ok ( RawBytes :: serialize ( res) ?)
1574+ }
1575+ Some ( Method :: GetDealClientExported ) => {
1576+ let res = Self :: get_deal_client ( rt, cbor:: deserialize_params ( params) ?) ?;
1577+ Ok ( RawBytes :: serialize ( res) ?)
1578+ }
1579+ Some ( Method :: GetDealProviderExported ) => {
1580+ let res = Self :: get_deal_provider ( rt, cbor:: deserialize_params ( params) ?) ?;
1581+ Ok ( RawBytes :: serialize ( res) ?)
1582+ }
1583+ Some ( Method :: GetDealLabelExported ) => {
1584+ let res = Self :: get_deal_label ( rt, cbor:: deserialize_params ( params) ?) ?;
1585+ Ok ( RawBytes :: serialize ( res) ?)
1586+ }
1587+ Some ( Method :: GetDealTermExported ) => {
1588+ let res = Self :: get_deal_term ( rt, cbor:: deserialize_params ( params) ?) ?;
1589+ Ok ( RawBytes :: serialize ( res) ?)
1590+ }
1591+ Some ( Method :: GetDealEpochPriceExported ) => {
1592+ let res = Self :: get_deal_epoch_price ( rt, cbor:: deserialize_params ( params) ?) ?;
1593+ Ok ( RawBytes :: serialize ( res) ?)
1594+ }
1595+ Some ( Method :: GetDealClientCollateralExported ) => {
1596+ let res = Self :: get_deal_client_collateral ( rt, cbor:: deserialize_params ( params) ?) ?;
1597+ Ok ( RawBytes :: serialize ( res) ?)
1598+ }
1599+ Some ( Method :: GetDealProviderCollateralExported ) => {
1600+ let res =
1601+ Self :: get_deal_provider_collateral ( rt, cbor:: deserialize_params ( params) ?) ?;
1602+ Ok ( RawBytes :: serialize ( res) ?)
1603+ }
1604+ Some ( Method :: GetDealVerifiedExported ) => {
1605+ let res = Self :: get_deal_verified ( rt, cbor:: deserialize_params ( params) ?) ?;
1606+ Ok ( RawBytes :: serialize ( res) ?)
1607+ }
14671608 None => Err ( actor_error ! ( unhandled_message, "Invalid method" ) ) ,
14681609 }
14691610 }
0 commit comments