mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-11-04 15:47:26 +00:00 
			
		
		
		
	Add source adapter interface definition (#1377)
* add source adapter interface definition * add more context to method names * return a map to reduce chance of wrong order
This commit is contained in:
		
							parent
							
								
									4a3002b09c
								
							
						
					
					
						commit
						2abb2ce606
					
				
							
								
								
									
										18
									
								
								x/incentive/types/adapter.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								x/incentive/types/adapter.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
package types
 | 
			
		||||
 | 
			
		||||
import sdk "github.com/cosmos/cosmos-sdk/types"
 | 
			
		||||
 | 
			
		||||
// SourceAdapter queries source shares from an external module.
 | 
			
		||||
type SourceAdapter interface {
 | 
			
		||||
	// OwnerSharesBySource returns source shares owned by one address.
 | 
			
		||||
	//
 | 
			
		||||
	// For example, the shares a user owns in the kava:usdx and bnb:usdx swap pools.
 | 
			
		||||
	// It returns the shares for several sources at once, in a map of sourceIDs to shares. Specifying no sourceIDS will return no shares.
 | 
			
		||||
	// Note the returned map does not have a deterministic order.
 | 
			
		||||
	OwnerSharesBySource(ctx sdk.Context, owner sdk.AccAddress, sourceIDs []string) map[string]sdk.Dec
 | 
			
		||||
 | 
			
		||||
	// TotalSharesBySource returns the sum of all shares for a source (across all users).
 | 
			
		||||
	//
 | 
			
		||||
	// For example, the total number of shares in the kava:usdx swap pool for all users.
 | 
			
		||||
	TotalSharesBySource(ctx sdk.Context, sourceID string) sdk.Dec
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user