File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed
Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -119,12 +119,22 @@ impl<'a> ContractsByArtifactBuilder<'a> {
119119 Self { artifacts : artifacts. into_iter ( ) . collect ( ) , storage_layouts : BTreeMap :: new ( ) }
120120 }
121121
122- /// Adds storage layouts from `ProjectCompileOutput` to known artifacts.
123- pub fn with_storage_layouts ( mut self , output : ProjectCompileOutput ) -> Self {
124- self . storage_layouts = output
125- . into_artifacts ( )
126- . filter_map ( |( id, artifact) | artifact. storage_layout . map ( |layout| ( id, layout) ) )
127- . collect ( ) ;
122+ /// Add storage layouts from the given `ProjectCompileOutput` to known artifacts.
123+ pub fn with_output ( self , output : & ProjectCompileOutput , base : & Path ) -> Self {
124+ self . with_storage_layouts ( output. artifact_ids ( ) . filter_map ( |( id, artifact) | {
125+ artifact
126+ . storage_layout
127+ . as_ref ( )
128+ . map ( |layout| ( id. with_stripped_file_prefixes ( base) , layout. clone ( ) ) )
129+ } ) )
130+ }
131+
132+ /// Add storage layouts.
133+ pub fn with_storage_layouts (
134+ mut self ,
135+ layouts : impl IntoIterator < Item = ( ArtifactId , StorageLayout ) > ,
136+ ) -> Self {
137+ self . storage_layouts . extend ( layouts) ;
128138 self
129139 }
130140
Original file line number Diff line number Diff line change @@ -535,9 +535,8 @@ impl MultiContractRunnerBuilder {
535535 }
536536
537537 // Create known contracts from linked contracts and storage layout information (if any).
538- let known_contracts = ContractsByArtifactBuilder :: new ( linked_contracts)
539- . with_storage_layouts ( output. clone ( ) . with_stripped_file_prefixes ( root) )
540- . build ( ) ;
538+ let known_contracts =
539+ ContractsByArtifactBuilder :: new ( linked_contracts) . with_output ( output, root) . build ( ) ;
541540
542541 Ok ( MultiContractRunner {
543542 contracts : deployable_contracts,
You can’t perform that action at this time.
0 commit comments