Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MORALIS_API_KEY=
5 changes: 5 additions & 0 deletions docs/00_protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ type Protocol interface {
// GetContractAddress returns the contract address for a specific chain.
GetContractAddress(chainID *big.Int) common.Address

// Can this protocol be withdrawn from or be the source state of an intent?
IsSource() bool

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source is an overloaded term in our stack. Maybe CanSourceFunds tokens or assets or funds


// Can you supply to this protocol?
IsDestination() bool
}

// ProtocolConfig contains configuration data for initializing a protocol.
Expand Down
3 changes: 3 additions & 0 deletions generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package protocolregistry

//go:generate go run tools/tokens.go
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.22

require (
github.com/ethereum/go-ethereum v1.11.5
github.com/joho/godotenv v1.5.1
github.com/rocket-pool/rocketpool-go v1.8.2
github.com/stretchr/testify v1.9.0
)
Expand Down Expand Up @@ -35,4 +36,3 @@ require (
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ=
github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw=
github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand Down
5 changes: 4 additions & 1 deletion pkg/aave.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func NewAaveOperation(
case AaveProtocolDeploymentSpark:
contract = SparkLendContractAddress
case AaveProtocolDeploymentPolygon:
contract = polygonAaveDataProviderContract
contract = AavePolygonV3ContractAddress
}

var version string = "3"
Expand Down Expand Up @@ -475,3 +475,6 @@ func (l *AaveOperation) GetName() string {

// GetVersion returns the version of the protocol
func (l *AaveOperation) GetVersion() string { return l.version }

func (l *AaveOperation) IsSource() bool { return true }
func (l *AaveOperation) IsDestination() bool { return true }
3 changes: 3 additions & 0 deletions pkg/ankr.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,6 @@ func (l *AnkrOperation) GetName() string { return Ankr }

// GetVersion returns the version of the protocol
func (l *AnkrOperation) GetVersion() string { return l.version }

func (l *AnkrOperation) IsSource() bool { return true }
func (l *AnkrOperation) IsDestination() bool { return true }
3 changes: 3 additions & 0 deletions pkg/binance.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,6 @@ func (l *BinanceWrappedEthOperation) GetName() string { return BinanceStakedETH

// GetVersion returns the version of the protocol
func (l *BinanceWrappedEthOperation) GetVersion() string { return l.version }

func (l *BinanceWrappedEthOperation) IsSource() bool { return true }
func (l *BinanceWrappedEthOperation) IsDestination() bool { return true }
19 changes: 18 additions & 1 deletion pkg/compound.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,24 @@ func (l *CompoundOperation) GetType() ProtocolType { return TypeLoan }
func (l *CompoundOperation) GetContractAddress(chainID *big.Int) common.Address { return l.contract }

// Name returns the human readable name for the protocol
func (l *CompoundOperation) GetName() string { return Compound }
func (l *CompoundOperation) GetName() string {

switch strings.ToLower(l.contract.Hex()) {
case strings.ToLower(CompoundV3ETHPool):
return "Compound ETH pool"
case strings.ToLower(CompoundV3PolygonUSDCPool),
strings.ToLower(CompoundV3USDCPool):
return "Compound USDC Pool"
case strings.ToLower(CompoundV3PolygonUSDTPool):
return "Compound USDT pool"

default:
return Compound
}
}

// GetVersion returns the version of the protocol
func (l *CompoundOperation) GetVersion() string { return l.version }

func (l *CompoundOperation) IsSource() bool { return true }
func (l *CompoundOperation) IsDestination() bool { return true }
24 changes: 14 additions & 10 deletions pkg/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,23 @@ type Protocol interface {
GetName() string
GetVersion() string
GetContractAddress(chainID *big.Int) common.Address
IsSource() bool
IsDestination() bool
}

const (
AaveV3 ProtocolName = "aave_v3"
SparkLend ProtocolName = "spark_lend"
Lido ProtocolName = "lido"
RocketPool ProtocolName = "rocket_pool"
Ankr ProtocolName = "ankr"
Renzo ProtocolName = "renzo"
Compound ProtocolName = "compound"
ListaDao ProtocolName = "lista_dao"
AvalonFinance ProtocolName = "avalon_finance"
BinanceStakedETH ProtocolName = "binance_staked_eth"
AaveV3 ProtocolName = "aave_v3"
SparkLend ProtocolName = "spark_lend"
Lido ProtocolName = "lido"
RocketPool ProtocolName = "rocket_pool"
Ankr ProtocolName = "ankr"
Renzo ProtocolName = "renzo"
Compound ProtocolName = "compound"
ListaDao ProtocolName = "lista_dao"
AvalonFinance ProtocolName = "avalon_finance"
BinanceStakedETH ProtocolName = "binance_staked_eth"
VenusProtocolIsolatedPool ProtocolName = "venus_isolated_pool"
VenusProtocolCorePool ProtocolName = "venus_core_pool"
)

var (
Expand Down
3 changes: 3 additions & 0 deletions pkg/lido.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,6 @@ func (l *LidoOperation) GetName() string { return Lido }

// GetVersion returns the version of the protocol
func (l *LidoOperation) GetVersion() string { return l.version }

func (l *LidoOperation) IsSource() bool { return false }
func (l *LidoOperation) IsDestination() bool { return true }
3 changes: 3 additions & 0 deletions pkg/listadao_stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,6 @@ func (l *ListaStakingOperation) GetName() string { return ListaDao }

// GetVersion returns the version of the protocol
func (l *ListaStakingOperation) GetVersion() string { return "1" }

func (l *ListaStakingOperation) IsSource() bool { return false }
func (l *ListaStakingOperation) IsDestination() bool { return true }
2 changes: 1 addition & 1 deletion pkg/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,5 +336,5 @@ func (r *ProtocolRegistryImpl) setupBnbProtocols(client *ethclient.Client) error
return err
}

return nil
return registerVenusPools(r, client, BscChainID.Int64())
Comment thread
adelowo marked this conversation as resolved.
}
3 changes: 3 additions & 0 deletions pkg/rocket_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,6 @@ func (l *RocketpoolOperation) GetName() string { return RocketPool }

// GetVersion returns the version of the protocol
func (l *RocketpoolOperation) GetVersion() string { return l.version }

func (l *RocketpoolOperation) IsSource() bool { return true }
func (l *RocketpoolOperation) IsDestination() bool { return true }
4 changes: 4 additions & 0 deletions pkg/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (

const zeroAddress = "0x0000000000000000000000000000000000000000"

func IsZeroAddress(addr common.Address) bool {
return common.HexToAddress(zeroAddress).Hex() == addr.Hex()
}

// nativeDenomAddress native denom token address.
const nativeDenomAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"

Expand Down
Loading