This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3071: Infer DAI token from Ethereum chain ID r=mergify[bot] a=thomaseizinger We are going to use this to avoid including the token contract address in the orders that we are sending around. This introduces the ethereum::Address type into our config::File struct. Unfortunately, this opens a can of worms with a bug in the serde-hex library. See [0] for more details. We work around this by removing the dependency on serde-hex from our Ethereum deserialization code and instead hand-roll everything for our usecase. This also has the advantage that we can now again just use our structs directly in the route handlers of warp instead of serde_json::Value. See [1] for more on this. [0]: fspmarshall/serde-hex#8 [1]: #2405 Co-authored-by: Thomas Eizinger <[email protected]>
- Loading branch information
Showing
25 changed files
with
396 additions
and
177 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,61 @@ | ||
import { extractCndConfigOverrides } from "../src/test_environment"; | ||
|
||
describe("extractCndConfigOverrides", () => { | ||
test("given no overrides, returns empty object", () => { | ||
expect(extractCndConfigOverrides({})).toStrictEqual({}); | ||
expect( | ||
extractCndConfigOverrides({ | ||
cndConfigOverride: null, | ||
}) | ||
).toStrictEqual({}); | ||
expect( | ||
extractCndConfigOverrides({ | ||
cndConfigOverride: "", | ||
}) | ||
).toStrictEqual({}); | ||
expect( | ||
extractCndConfigOverrides({ | ||
cndConfigOverride: ["", "", ""], | ||
}) | ||
).toStrictEqual({}); | ||
}); | ||
|
||
test("given overrides, sets nested key", () => { | ||
const overrides = { | ||
cndConfigOverride: | ||
"ethereum.tokens.dai = 0x0000000000000000000000000000000000000000", | ||
}; | ||
|
||
const config = extractCndConfigOverrides(overrides); | ||
|
||
expect(config).toStrictEqual({ | ||
ethereum: { | ||
tokens: { | ||
dai: "0x0000000000000000000000000000000000000000", | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
test("given two overrides, sets them both", () => { | ||
const overrides = { | ||
cndConfigOverride: [ | ||
"ethereum.tokens.dai = 0x0000000000000000000000000000000000000000", | ||
"bitcoin.network = regtest", | ||
], | ||
}; | ||
|
||
const config = extractCndConfigOverrides(overrides); | ||
|
||
expect(config).toStrictEqual({ | ||
ethereum: { | ||
tokens: { | ||
dai: "0x0000000000000000000000000000000000000000", | ||
}, | ||
}, | ||
bitcoin: { | ||
network: "regtest", | ||
}, | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.