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

Updating Limit Order pattern #48

Merged
merged 4 commits into from
Apr 22, 2024
Merged
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
2 changes: 2 additions & 0 deletions common/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
)

type Wallet interface {
Call(ctx context.Context, contractAddress gethCommon.Address, callData []byte) ([]byte, error)

Nonce(ctx context.Context) (uint64, error)
Address() gethCommon.Address
Balance(ctx context.Context) (*big.Int, error)
Expand Down
16 changes: 16 additions & 0 deletions constants/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ package constants

import (
"fmt"

"github.com/1inch/1inch-sdk-go/internal/slice_utils"
)

const AggregationRouterV5 = "0x1111111254eeb25477b68fb85ed929f73a960582" // Contract address is identical for all chains except zkSync
const AggregationRouterV6 = "0x111111125421cA6dc452d289314280a0f8842A65" // Contract address is identical for all chains except zkSync
const AggregationV5RouterZkSyncEra = "0x6e2B76966cbD9cF4cC2Fa0D76d24d5241E0ABC2F"
const AggregationRouterV5Name = "1inch Aggregation Router"
const AggregationRouterV5VersionNumber = "5"
const AggregationRouterV6Name = "1inch Aggregation Router"
const AggregationRouterV6VersionNumber = "6"

// Series Nonce Manager contract addresses are taken from limit-order-protocol/deployments

Expand All @@ -23,6 +28,17 @@ const SeriesNonceManagerKlaytn = "0x7871769b3816b23dB12E83a482aAc35F1FD35D4B"
const SeriesNonceManagerOptimism = "0x32d12a25f539E341089050E2d26794F041fC9dF8"
const SeriesNonceManagerPolygon = "0xa5eb255EF45dFb48B5d133d08833DEF69871691D"

func Get1inchRouterFromChainId(chainId int) (string, error) {
if slice_utils.Contains(chainId, ValidChainIds) {
if chainId == ZkSyncEraChainId {
return "", fmt.Errorf("zksync not supported: %d", chainId)
} else {
return AggregationRouterV6, nil
}
} else {
return "", fmt.Errorf("unrecognized chain id: %d", chainId)
}
}
func GetSeriesNonceManagerFromChainId(chainId int) (string, error) {
switch chainId {
case ArbitrumChainId:
Expand Down
Loading
Loading