-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f70b9b7
commit 1800ddc
Showing
11 changed files
with
1,918 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
[ | ||
{ | ||
"name": "RelayAdded", | ||
"inputs": [ | ||
{ "name": "uri_hash", "type": "string", "indexed": true }, | ||
{ | ||
"name": "relay", | ||
"type": "tuple", | ||
"components": [ | ||
{ "name": "uri", "type": "string" }, | ||
{ "name": "operator", "type": "string" }, | ||
{ "name": "is_mandatory", "type": "bool" }, | ||
{ "name": "description", "type": "string" } | ||
], | ||
"indexed": false | ||
} | ||
], | ||
"anonymous": false, | ||
"type": "event" | ||
}, | ||
{ | ||
"name": "RelayRemoved", | ||
"inputs": [ | ||
{ "name": "uri_hash", "type": "string", "indexed": true }, | ||
{ "name": "uri", "type": "string", "indexed": false } | ||
], | ||
"anonymous": false, | ||
"type": "event" | ||
}, | ||
{ | ||
"name": "AllowedListUpdated", | ||
"inputs": [ | ||
{ "name": "allowed_list_version", "type": "uint256", "indexed": true } | ||
], | ||
"anonymous": false, | ||
"type": "event" | ||
}, | ||
{ | ||
"name": "OwnerChanged", | ||
"inputs": [{ "name": "new_owner", "type": "address", "indexed": true }], | ||
"anonymous": false, | ||
"type": "event" | ||
}, | ||
{ | ||
"name": "ManagerChanged", | ||
"inputs": [{ "name": "new_manager", "type": "address", "indexed": true }], | ||
"anonymous": false, | ||
"type": "event" | ||
}, | ||
{ | ||
"name": "ERC20Recovered", | ||
"inputs": [ | ||
{ "name": "token", "type": "address", "indexed": true }, | ||
{ "name": "amount", "type": "uint256", "indexed": false }, | ||
{ "name": "recipient", "type": "address", "indexed": true } | ||
], | ||
"anonymous": false, | ||
"type": "event" | ||
}, | ||
{ | ||
"stateMutability": "nonpayable", | ||
"type": "constructor", | ||
"inputs": [{ "name": "owner", "type": "address" }], | ||
"outputs": [] | ||
}, | ||
{ | ||
"stateMutability": "view", | ||
"type": "function", | ||
"name": "get_relays_amount", | ||
"inputs": [], | ||
"outputs": [{ "name": "", "type": "uint256" }] | ||
}, | ||
{ | ||
"stateMutability": "view", | ||
"type": "function", | ||
"name": "get_owner", | ||
"inputs": [], | ||
"outputs": [{ "name": "", "type": "address" }] | ||
}, | ||
{ | ||
"stateMutability": "view", | ||
"type": "function", | ||
"name": "get_manager", | ||
"inputs": [], | ||
"outputs": [{ "name": "", "type": "address" }] | ||
}, | ||
{ | ||
"stateMutability": "view", | ||
"type": "function", | ||
"name": "get_relays", | ||
"inputs": [], | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "tuple[]", | ||
"components": [ | ||
{ "name": "uri", "type": "string" }, | ||
{ "name": "operator", "type": "string" }, | ||
{ "name": "is_mandatory", "type": "bool" }, | ||
{ "name": "description", "type": "string" } | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"stateMutability": "view", | ||
"type": "function", | ||
"name": "get_relay_by_uri", | ||
"inputs": [{ "name": "relay_uri", "type": "string" }], | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "tuple", | ||
"components": [ | ||
{ "name": "uri", "type": "string" }, | ||
{ "name": "operator", "type": "string" }, | ||
{ "name": "is_mandatory", "type": "bool" }, | ||
{ "name": "description", "type": "string" } | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"stateMutability": "view", | ||
"type": "function", | ||
"name": "get_allowed_list_version", | ||
"inputs": [], | ||
"outputs": [{ "name": "", "type": "uint256" }] | ||
}, | ||
{ | ||
"stateMutability": "nonpayable", | ||
"type": "function", | ||
"name": "add_relay", | ||
"inputs": [ | ||
{ "name": "uri", "type": "string" }, | ||
{ "name": "operator", "type": "string" }, | ||
{ "name": "is_mandatory", "type": "bool" }, | ||
{ "name": "description", "type": "string" } | ||
], | ||
"outputs": [] | ||
}, | ||
{ | ||
"stateMutability": "nonpayable", | ||
"type": "function", | ||
"name": "remove_relay", | ||
"inputs": [{ "name": "uri", "type": "string" }], | ||
"outputs": [] | ||
}, | ||
{ | ||
"stateMutability": "nonpayable", | ||
"type": "function", | ||
"name": "change_owner", | ||
"inputs": [{ "name": "owner", "type": "address" }], | ||
"outputs": [] | ||
}, | ||
{ | ||
"stateMutability": "nonpayable", | ||
"type": "function", | ||
"name": "set_manager", | ||
"inputs": [{ "name": "manager", "type": "address" }], | ||
"outputs": [] | ||
}, | ||
{ | ||
"stateMutability": "nonpayable", | ||
"type": "function", | ||
"name": "dismiss_manager", | ||
"inputs": [], | ||
"outputs": [] | ||
}, | ||
{ | ||
"stateMutability": "nonpayable", | ||
"type": "function", | ||
"name": "recover_erc20", | ||
"inputs": [ | ||
{ "name": "token", "type": "address" }, | ||
{ "name": "amount", "type": "uint256" }, | ||
{ "name": "recipient", "type": "address" } | ||
], | ||
"outputs": [] | ||
}, | ||
{ "stateMutability": "nonpayable", "type": "fallback" } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package dappmanager | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
) | ||
|
||
type DappmanagerAdapter struct { | ||
dappmanagerUrl string | ||
mevBootDnpName string | ||
} | ||
|
||
// NewDappmanagerAdapter creates a new instance of DappmanagerAdapter with provided dappmanagerUrl and mevBoostDnpName | ||
func NewDappmanagerAdapter(dappmanagerUrl, mevBoostDnpName string) *DappmanagerAdapter { | ||
return &DappmanagerAdapter{ | ||
dappmanagerUrl, | ||
mevBoostDnpName, | ||
} | ||
} | ||
|
||
// GetRelaysUsed fetches env RELAYS from MEV BOOST pkg | ||
func (da *DappmanagerAdapter) GetRelaysUsed(ctx context.Context) ([]string, error) { | ||
url := fmt.Sprintf("%s/env/%s?envName=RELAYS", da.dappmanagerUrl, da.mevBootDnpName) | ||
req, err := http.NewRequest("GET", url, nil) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create GET request for URL %s: %w", url, err) | ||
} | ||
|
||
client := &http.Client{} | ||
resp, err := client.Do(req) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to send request to Dappmanager at %s: %w", url, err) | ||
} | ||
|
||
defer resp.Body.Close() | ||
|
||
var result []string | ||
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { | ||
return nil, fmt.Errorf("failed to decode response for GetRelaysUsed: %w", err) | ||
} | ||
|
||
return result, nil | ||
} |
Oops, something went wrong.