- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.6k
 
Add Cashmere to fees and bridge aggregators #4218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 4 commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      d403cfa
              
                up
              
              
                cashmerelabs 83ae116
              
                add cashmere
              
              
                cashmerelabs e220c31
              
                Update index.ts
              
              
                cashmerelabs 8b39708
              
                Update index.ts
              
              
                cashmerelabs 7e94463
              
                Delete bridge-aggregators/cashmere/index.ts
              
              
                g1nt0ki 16d0f52
              
                Reset daily revenue calculations to zero
              
              
                g1nt0ki File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import fetchURL from "../../utils/fetchURL"; | ||
| import { FetchOptions, FetchResultVolume, SimpleAdapter } from "../../adapters/types"; | ||
| import { CHAIN } from "../../helpers/chains"; | ||
| 
     | 
||
| const CASHMERE_BRIDGE_API_URL = "https://kapi.cashmere.exchange/defillama/bridge/volumes"; | ||
| 
     | 
||
| const getUrl = (startTime: number, endTime: number): string => { | ||
| return `${CASHMERE_BRIDGE_API_URL}?from_timestamp=${startTime}&to_timestamp=${endTime}`; | ||
| }; | ||
| 
     | 
||
| const fetch = async (options: FetchOptions): Promise<FetchResultVolume> => { | ||
| const url = getUrl(options.startTimestamp, options.endTimestamp); | ||
| const response = await fetchURL(url); | ||
| 
     | 
||
| return { | ||
| dailyBridgeVolume: response.volumeUsd || response.dailyBridgeVolume || 0, | ||
| }; | ||
| }; | ||
| 
     | 
||
| const methodology = { | ||
| Volume: "Total volume of Cashmere cross-chain transfers.", | ||
| }; | ||
| 
     | 
||
| const adapter: SimpleAdapter = { | ||
| version: 2, | ||
| fetch, | ||
| chains: [CHAIN.ETHEREUM], // Aggregate data across all chains, represented under Ethereum | ||
| start: "2025-09-08", | ||
| methodology, | ||
| }; | ||
| 
     | 
||
| export default adapter; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import fetchURL from "../../utils/fetchURL"; | ||
| import { FetchOptions, FetchResult, SimpleAdapter } from "../../adapters/types"; | ||
| import { CHAIN } from "../../helpers/chains"; | ||
| 
     | 
||
| const CASHMERE_API_URL = "https://kapi.cashmere.exchange/defillama/fees"; | ||
| 
     | 
||
| const getUrl = (startTime: number, endTime: number): string => { | ||
| return `${CASHMERE_API_URL}?from_timestamp=${startTime}&to_timestamp=${endTime}`; | ||
| }; | ||
| 
     | 
||
| const fetch = async (options: FetchOptions): Promise<FetchResult> => { | ||
| const url = getUrl(options.startTimestamp, options.endTimestamp); | ||
| const response = await fetchURL(url); | ||
| 
     | 
||
| return { | ||
| dailyVolume: response.volumeUsd || 0, | ||
| dailyFees: response.feesUsd || 0, | ||
| dailyUserFees: response.feesUsd || 0, | ||
| dailyRevenue: response.revenuesUsd || 0, | ||
| dailyProtocolRevenue: response.protocolRevenueUsd || 0, | ||
| dailyHoldersRevenue: (response.revenuesUsd - response.protocolRevenueUsd) || 0, | ||
| dailySupplySideRevenue: (response.feesUsd - response.revenuesUsd) || 0, | ||
| }; | ||
| }; | ||
| 
     | 
||
| const methodology = { | ||
| Volume: "Total cross-chain volume of the Cashmere", | ||
| Fees: "Total amount of fees paid by users for cross-chain Cashmere relayers", | ||
| UserFees: "Same as Fees - all fees are paid directly by end-users for Cashmere relayers", | ||
| Revenue: "All relayer fees are retained as protocol revenue", | ||
| ProtocolRevenue: "100% of fees go to protocol treasury", | ||
| HoldersRevenue: "No token holders revenue distribution - Cashmere operates as a service protocol without governance tokens", | ||
| SupplySideRevenue: "No liquidity providers - Cashmere operates bridge infrastructure, not AMM liquidity pools", | ||
| }; | ||
| 
     | 
||
| const adapter: SimpleAdapter = { | ||
| version: 2, | ||
| fetch, | ||
| chains: [CHAIN.ETHEREUM], // Aggregate data across all chains, represented under Ethereum | ||
| start: "2025-09-08", | ||
| methodology, | ||
| }; | ||
| 
     | 
||
| export default adapter; | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, why
response.volumeUsd || response.dailyBridgeVolume?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on second thought, excluding as we track bridge volume here: https://github.com/DefiLlama/bridges-server