Skip to content
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

Token Multiplexing: modify existing structs #901

Closed
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
21 changes: 12 additions & 9 deletions core/services/ocr2/plugins/liquiditymanager/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ type NetworkType string

// ProposedTransfer is a transfer that is proposed by the rebalancing algorithm.
type ProposedTransfer struct {
From NetworkSelector
To NetworkSelector
Amount *ubig.Big
From NetworkSelector
To NetworkSelector
Amount *ubig.Big
TokenID TokenID
}

func (p ProposedTransfer) FromNetwork() NetworkSelector {
Expand All @@ -105,7 +106,7 @@ func (p ProposedTransfer) TransferStatus() TransferStatus {
}

func (p ProposedTransfer) String() string {
return fmt.Sprintf("from:%d to:%d amount:%s", p.From, p.To, p.Amount.String())
return fmt.Sprintf("from:%d to:%d amount:%s token:%s", p.From, p.To, p.Amount.String(), p.TokenID.String())
}

// Transfer is a ProposedTransfer that has had a lot of its information resolved.
Expand Down Expand Up @@ -256,13 +257,15 @@ const (
)

type Edge struct {
Source NetworkSelector
Dest NetworkSelector
Source NetworkSelector
Dest NetworkSelector
TokenID TokenID
}

func NewEdge(source, dest NetworkSelector) Edge {
func NewEdge(source, dest NetworkSelector, tid TokenID) Edge {
return Edge{
Source: source,
Dest: dest,
Source: source,
Dest: dest,
TokenID: tid,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import (
type NetworkLiquidity struct {
Network NetworkSelector
Liquidity *ubig.Big
TokenID TokenID
}

func (n NetworkLiquidity) String() string {
return fmt.Sprintf("NetworkLiquidity{Network: %d, Liquidity: %s}", n.Network, n.Liquidity.String())
return fmt.Sprintf("NetworkLiquidity{Network: %d, Liquidity: %s, TokenID: %s}", n.Network, n.Liquidity.String(), n.TokenID.String())
}

func NewNetworkLiquidity(chain NetworkSelector, liq *big.Int) NetworkLiquidity {
func NewNetworkLiquidity(chain NetworkSelector, liq *big.Int, tid TokenID) NetworkLiquidity {
return NetworkLiquidity{
Network: chain,
Liquidity: ubig.New(liq),
TokenID: tid,
}
}

Expand Down Expand Up @@ -122,4 +124,5 @@ func DecodeOutcome(b []byte) (Outcome, error) {
type ConfigDigestWithMeta struct {
Digest ConfigDigest
NetworkSel NetworkSelector
TokenID TokenID
}
Loading