| 
									
										
										
										
											2014-10-31 14:30:08 +01:00
										 |  |  | package xeth | 
					
						
							| 
									
										
										
										
											2014-08-05 11:10:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2014-10-23 15:01:27 +02:00
										 |  |  | 	"github.com/ethereum/go-ethereum/ethutil" | 
					
						
							| 
									
										
										
										
											2014-10-31 14:43:14 +01:00
										 |  |  | 	"github.com/ethereum/go-ethereum/state" | 
					
						
							| 
									
										
										
										
											2014-08-05 11:10:24 +02:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-05 11:26:12 +02:00
										 |  |  | type Object struct { | 
					
						
							| 
									
										
										
										
											2014-10-31 14:43:14 +01:00
										 |  |  | 	*state.StateObject | 
					
						
							| 
									
										
										
										
											2014-08-05 11:10:24 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-05 11:26:12 +02:00
										 |  |  | func (self *Object) StorageString(str string) *ethutil.Value { | 
					
						
							| 
									
										
										
										
											2014-08-05 11:10:24 +02:00
										 |  |  | 	if ethutil.IsHex(str) { | 
					
						
							|  |  |  | 		return self.Storage(ethutil.Hex2Bytes(str[2:])) | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		return self.Storage(ethutil.RightPadBytes([]byte(str), 32)) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-05 11:26:12 +02:00
										 |  |  | func (self *Object) StorageValue(addr *ethutil.Value) *ethutil.Value { | 
					
						
							| 
									
										
										
										
											2014-08-05 11:10:24 +02:00
										 |  |  | 	return self.Storage(addr.Bytes()) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-05 11:26:12 +02:00
										 |  |  | func (self *Object) Storage(addr []byte) *ethutil.Value { | 
					
						
							| 
									
										
										
										
											2014-08-05 11:10:24 +02:00
										 |  |  | 	return self.StateObject.GetStorage(ethutil.BigD(addr)) | 
					
						
							|  |  |  | } |