Skip to content

DexLib is a library used by Kyberswap backend to integrate with decentralized exchanges. This library enables external DEX developers to integrate their DEX with Kyberswap by creating pull requests to this repository.

Notifications You must be signed in to change notification settings

KyberNetwork/kyberswap-dex-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kyberswap-dex-lib

Marshal/unmarshal pool simulator

When implementing a new pool simulator, to make it marshal-able and unmarshal-able, we have to notice the following:

  • rerun go generate ./... to register the new pool simulator struct

    • Because we might marshal/unmarshal a pool simulator under the IPoolSimulator interface. We have to register the underlying struct so we can unmarshal it as IPoolSimulator.
  • pointer aliases

    • If the pool simulator struct contains pointer aliases, we must use msgpack:"-" tag to ignore the aliases and set them inside the AfterMsgpackUnmarshal() method. For an example:
      type PoolSimulator struct {
          vault *Vault
          vaultUtils *VaultUtils
      }
      
      type VaultUtils struct {
          vault *Vault `msgpack:"-"`
      }
      
      func (p *PoolSimulator) AfterMsgpackUnmarshal() error {
          if p.vaultUtils != nil {
              p.vaultUtils.vault = p.vault
          }
          return nil
      }
      

About

DexLib is a library used by Kyberswap backend to integrate with decentralized exchanges. This library enables external DEX developers to integrate their DEX with Kyberswap by creating pull requests to this repository.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages