| 
									
										
										
										
											2021-12-03 09:00:31 -08:00
										 |  |  | use crate::{
 | 
					
						
							|  |  |  |     account::{
 | 
					
						
							|  |  |  |         Account, AccountSharedData, InheritableAccountFields, DUMMY_INHERITABLE_ACCOUNT_FIELDS,
 | 
					
						
							|  |  |  |     },
 | 
					
						
							|  |  |  |     clock::INITIAL_RENT_EPOCH,
 | 
					
						
							| 
									
										
										
										
											2021-03-25 15:23:20 +09:00
										 |  |  | };
 | 
					
						
							| 
									
										
										
										
											2018-12-03 13:31:11 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-21 16:34:40 -08:00
										 |  |  | crate::declare_id!("NativeLoader1111111111111111111111111111111");
 | 
					
						
							| 
									
										
										
										
											2019-02-13 20:43:56 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-13 21:16:26 -07:00
										 |  |  | /// Create an executable account with the given shared object name.
 | 
					
						
							| 
									
										
										
										
											2021-03-25 15:23:20 +09:00
										 |  |  | #[deprecated(
 | 
					
						
							|  |  |  |     since = "1.5.17",
 | 
					
						
							|  |  |  |     note = "Please use `create_loadable_account_for_test` instead"
 | 
					
						
							|  |  |  | )]
 | 
					
						
							| 
									
										
										
										
											2021-03-09 15:06:07 -06:00
										 |  |  | pub fn create_loadable_account(name: &str, lamports: u64) -> AccountSharedData {
 | 
					
						
							| 
									
										
										
										
											2021-03-25 15:23:20 +09:00
										 |  |  |     create_loadable_account_with_fields(name, (lamports, INITIAL_RENT_EPOCH))
 | 
					
						
							|  |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | pub fn create_loadable_account_with_fields(
 | 
					
						
							|  |  |  |     name: &str,
 | 
					
						
							|  |  |  |     (lamports, rent_epoch): InheritableAccountFields,
 | 
					
						
							|  |  |  | ) -> AccountSharedData {
 | 
					
						
							| 
									
										
										
										
											2021-03-15 19:27:17 -05:00
										 |  |  |     AccountSharedData::from(Account {
 | 
					
						
							| 
									
										
										
										
											2020-12-11 11:03:31 +09:00
										 |  |  |         lamports,
 | 
					
						
							| 
									
										
										
										
											2019-02-13 21:16:26 -07:00
										 |  |  |         owner: id(),
 | 
					
						
							| 
									
										
										
										
											2020-04-08 14:36:18 -07:00
										 |  |  |         data: name.as_bytes().to_vec(),
 | 
					
						
							| 
									
										
										
										
											2019-02-13 20:43:56 -07:00
										 |  |  |         executable: true,
 | 
					
						
							| 
									
										
										
										
											2021-03-25 15:23:20 +09:00
										 |  |  |         rent_epoch,
 | 
					
						
							| 
									
										
										
										
											2021-03-15 19:27:17 -05:00
										 |  |  |     })
 | 
					
						
							| 
									
										
										
										
											2019-02-13 20:43:56 -07:00
										 |  |  | }
 | 
					
						
							| 
									
										
										
										
											2021-03-25 15:23:20 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | pub fn create_loadable_account_for_test(name: &str) -> AccountSharedData {
 | 
					
						
							|  |  |  |     create_loadable_account_with_fields(name, DUMMY_INHERITABLE_ACCOUNT_FIELDS)
 | 
					
						
							|  |  |  | }
 |