Skip to content

AdeptusDigitales/shortest-path-faster-cairo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shortest-path-faster-cairo

Cairo implementation of the Shortest Path Faster algorithm.

The best way to understand the algorithm is to understand Bellman-Ford as a prerequisit:
https://www.geeksforgeeks.org/bellman-ford-algorithm-dp-23/

and from there have a look at the improvements made to create the SPF algorithm:
https://www.geeksforgeeks.org/shortest-path-faster-algorithm/

The code is not actually a pure implementation of the SPF-algorithm as it has been adjusted to simulate it's usage as a solver within a DEX aggregator.
An assumption is being made that the highest liquidity pairing for every shitcoin is with one of 4 different tokens. On Ethereum mainnet these would be:

  1. ETH
  2. USDC
  3. DAI
  4. USDT

Therefore we only search for a route from Shitcoin1 via ETH/USDC/DAI/USDT to Shitcoin2

To run the test (Linux/Mac only):

Install protostar:

curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash

then run:

prototstar test ./tests

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published