Commit Graph

89 Commits

Author SHA1 Message Date
Dmitry Holodov
df057ac5cd time index shift (#450) 2023-05-02 10:52:28 -05:00
noot
c131112da1 feat: close stream after NotifyETHLocked is sent (#446) 2023-05-01 23:03:26 -04:00
noot
fb95751dda feat: update SwapCreater.sol claimRelayer to no longer use forwarder (#449)
Co-authored-by: Dmitry Holodov <dimalinux@protonmail.com>
2023-05-01 19:23:17 -04:00
noot
19014027a0 fix: move counterparty-relay checks to backend (#442) 2023-04-28 13:04:26 -04:00
noot
c1d5347616 fix: set GasLimit for relayed transactions (#425)
Co-authored-by: Dmitry Holodov <dimalinux@protonmail.com>
2023-04-26 15:55:46 -04:00
noot
dbcc97f9c1 feat: add bootnode binary (#397) 2023-04-21 12:52:07 -04:00
noot
f344d09fc6 add AUTHORS file and update copyright in license header (#389) 2023-04-18 12:25:30 -04:00
Dmitry Holodov
15b8378c76 ERC20 balance support (#380)
* Added --token flag to swapcli's balances request allowing the user to query their token balance
* --eth-asset flag on swapcli make changed to --token
* Added TokenInfo RPC API method to retrieve an ERC20 token's metadata
* Added an end-to-end ERC20 unit test to the daemon package
* Fixed ERC20 token approval amount to SwapCreator contract to use the minimum value required (instead of approving the entire user's balance for transfer by the contract)
* Fixed a race condition between concurrent contract calls to approve/new_swap in ERC20 token swaps
* Removed hard coded assumptions that all tokens have 18 decimals
* Maked the decimal places in our test ERC20 token configurable
* Fixed token exchange rate calculations
* Updated ongoing and past swap queries to correctly support ERC20 tokens
* Initial unit tests in swapcli's main package
2023-04-17 11:59:47 -05:00
noot
a2d9e8ddd7 net: add initiate, query and relay timeouts (#378)
Co-authored-by: Dmitry Holodov <dimalinux@protonmail.com>
2023-04-15 14:09:49 +02:00
Dmitry Holodov
a17f95d414 SwapFactory to SwapCreator rename, upgrade to solc 0.8.19 (#372) 2023-04-09 03:08:17 -05:00
Dmitry Holodov
7fef2d7b76 XMR taker is relayer of last resort for the maker (#366)
Co-authored-by: noot <36753753+noot@users.noreply.github.com>
2023-04-05 20:16:41 -05:00
noot
b26228805c add license header to files; update readme disclaimer (#368) 2023-04-04 13:12:12 -04:00
Dmitry Holodov
528715b602 swapd daemon setup/start decoupled from CLI parsing (#354) 2023-03-25 19:18:51 -05:00
Dmitry Holodov
0e80eee4dc integrated relayer into swapd (#342) 2023-03-17 14:22:16 -05:00
noot
848051b852 remove NotifyXMRLocked message, have xmrtaker check for lock independently (#341) 2023-03-11 16:13:47 -05:00
Dmitry Holodov
51d89a4d18 added more required tags to serialized structs (#330) 2023-02-28 22:41:03 -06:00
Dmitry Holodov
1d7c00a8ed dedicated monero address type (#327)
Adds custom type for monero addresses with better validations.
2023-02-25 11:18:16 -06:00
noot
112ed74cfb fix: update xmrmaker refund path wallet to use address from xmrtaker swap keys (#304)
Co-authored-by: Dmitry Holodov <dimalinux@protonmail.com>
2023-02-20 16:33:49 -05:00
Dmitry Holodov
b157adc28b JSON validation (#309)
Integrates the go-playground validator library into our codebase for objects that are serialized/deserialized.
2023-02-18 18:37:52 -06:00
Dmitry Holodov
943e95cc11 JSON updates (#305)
* ensures  all p2p message types have JSON tags
* when available, marshaling uses our project types
* "common" package was decoupled from the "message" package
* protocol version bumped
2023-02-16 01:15:58 -06:00
Dmitry Holodov
bb9a50dd7f upgrade linter (#297)
Upgraded linter to 1.50.1 and improved protocol documentation.
2023-02-07 22:31:06 -06:00
noot
17ab2f11ff feat: add relayer discovery and transaction submission via network (#291)
Co-authored-by: Dmitry Holodov <dimalinux@protonmail.com>
2023-02-03 19:01:32 -05:00
Dmitry Holodov
2905d1b1f9 Fixed Point Math (#269)
Updates our code to use the fixed point match library apd.Decimal.
2023-01-10 16:03:22 -06:00
noot
5068dab46a remove previous net/* contents, move net/swapnet/* to net/ (#270) 2023-01-09 17:09:11 -05:00
noot
3ef8ae9427 refactor net package to separate generic and swap-specific functionality (#268) 2023-01-08 09:59:34 -05:00
Dmitry Holodov
6e146f0dc5 support fallback monero nodes in default configs (#265)
Allows configuring multiple monerod nodes in our default configs. They get tried sequentially and the first one that works gets used.
2022-12-20 15:10:40 -06:00
Dmitry Holodov
ed15ed9c82 libp2p QUIC and NAT traversal features (#251)
Enables additional libp2p NAT traversal features and enables nodes to communicate using UDP/QUIC in addition to TCP. Switches to using libp2p's "routed host". Most commands that previously accepted multiaddress values now accept a Peer IDs instead.
2022-12-19 18:25:24 -06:00
noot
83b1c877ff implement discoverLoop to find peers if count is low (#252) 2022-12-06 21:23:26 -05:00
Dmitry Holodov
1e83673f23 add package comments (#236)
package comments added to all packages
2022-12-02 00:43:32 -06:00
noot
6a85b4a327 fix: don't re-advertise if we have no offers (#245) 2022-11-30 18:43:53 -05:00
noot
be9888f05b implement event watcher for contract events; remove unneeded network messages (#219) 2022-11-13 14:19:37 +01:00
noot
50e1080d22 unused param fix in offer manager, fix erc20 relayer claim (#215) 2022-10-31 20:48:36 -04:00
Dmitry Holodov
cdcd4db15d monero transaction checks (#207)
* Bob now waits for his XMR transfer to the A+B wallet to have 10 confirmations before notifying Alice that the XMR is locked.
* Alice now rejects the locked Monero if there is more than one block left before she can spend the funds (1 block freedom is in case of network latency on Alice's side). This eliminates Bob's ability to double spend and allows Alice to sweep funds to her primary wallet from the A+B wallet in a reasonable time frame.
* Sweeping received XMR to the primary wallet is now the default behavior.
* A+B swap wallets are created with a restore height set for quick wallet creation in production where the blockchain is big.
* Fixes SleepWithContext moving it into the common package and having it return an error when the sleep is interrupted by the context being canceled.
* Fixed timeout and context handling in integration tests
* Added new GetChainHeight method that queries monerod instead of monero-wallet-rpc
2022-10-31 00:26:25 -05:00
noot
a51ea4e731 implement database; persist offers to disk and reload on startup (#200) 2022-10-11 15:44:37 -04:00
Dmitry Holodov
130ed147aa removed --ethereum-chain-id flag (#201)
Removes the --ethereum-chain-id flag and updates the code to dynamically determines the chain ID using the ethereum endpoint.
2022-10-09 20:43:56 -05:00
Dmitry Holodov
ecd91f624c monero-wallet-rpc now embedded (#192)
* Embeds monero-wallet-rpc instead of having the user start it separately.
* Location of all the files standardized and documented in docs/default-file-locations.md.
* Ethereum and Monero wallets will be created if they do not exist.
* New RPC API  personal_balances added including swapcli support.
2022-10-07 22:18:46 -05:00
noot
87357180f5 remove hardhat dependency from ethereum/ dir (#196) 2022-10-03 18:13:38 -04:00
Dmitry Holodov
5698e25239 RPC and WS endpoints share the same port (#187)
Combine our HTTP RPC and Websocket services into a single HTTP server, eliminating the --ws-port flag to swapd and using --swapd-port flag for swapcli.
2022-09-10 14:54:43 -05:00
Dmitry Holodov
476bc69b82 CLI cleanups (#185)
* Switches to current v2 version of urfave CLI
* Fixes incorrect port values in the help
* Provides defaults directly to urfave for clear `--help` messaging
* `--base-path` flag renamed to `--data-dir`. This matches `monerod`'s' `--data-dir` and almost matches the `geth` flag `--datadir`
* Bootnodes and contract address are provided for stagenet testing
* Bootnodes can be provided individually by repeating the `--bootnodes`/`--bn` flag, or as a comma separated block (original behavior), or even a combination of both. (Makes adding/removing bootnodes a lot easier.)
* More precise error messaging when XMR maker/taker values are off
* Fixes bug in the peer finder where XMR was hardcoded as the provides coin
* `cleanup-test-processes.sh` displays which processes are being killed
2022-09-07 19:45:01 -05:00
doonte
067b12f584 add direct ERC-20 swap support (#158)
Co-authored-by: noot <elizabethjbinks@gmail.com>
Co-authored-by: noot <36753753+noot@users.noreply.github.com>
2022-09-05 14:12:22 -04:00
noot
01593106d0 fix private IP filters (#175) 2022-08-27 10:55:10 -04:00
noot
ae42d8da54 add 127.0.0.1 to private filter list (#174) 2022-08-26 20:17:05 -04:00
noot
38b079cb96 persist peerstore to disk (#173) 2022-08-24 20:34:40 -04:00
noot
d7d7cf0e0a cleanup todos, either fix or add issue numbers (#166) 2022-08-20 23:57:23 -04:00
Dmitry Holodov
b2c8641087 rename module (#156) 2022-08-19 20:31:50 -04:00
Dmitry Holodov
3d48bd9e9e upgraded libp2p dependencies (#151)
Updates our libp2p dependencies to the latest stable versions.
2022-08-14 16:14:10 -05:00
Dmitry Holodov
cbecd6a891 fix various concurrency issues (#147)
* Fixes lock issues on the XMR Maker's offer list (new package protocol/xmrmaker/offers)
* Fixes lock issues on the swapState maps
* Fixes go routine sync issues in TestError_ShouldOnlyTakeOfferOnce that were sometimes breaking TestSuccess_ConcurrentSwaps
* Ensures that the id field of "types.Offer" is initialized when created
2022-08-10 08:12:12 -05:00
Dmitry Holodov
e9f437b7bb fix incorrect padding in NewPublicKeyFromBigInt (#143) 2022-08-01 20:19:36 -04:00
Dmitry Holodov
adfb0fa602 Test cleanup (#135)
* version independent monerod path with localhost-only binding

* fixed lint target and install script

* created 3rd ETH key constant to avoid race condition in tests

* updated run-integration-tests.sh with the same changes made to run-unit-tests.sh

* new design for paritioning out 2 unique keys to test packages

* restored accidentally deleted tests/alice.key

* removed websocket connection leaks from tests

* made file paths unique between tests with better file cleanup

* fix for the websocket connection leak commit

* reverted increase of GenerateBlocks (didn't mean to commit that)

* fixed maker/taker key that I had reversed

* fixed incorrect zero-balance check

* fixed comment on ClaimOrRefund

* added back sample script for installing go in /usr/local/go

* etchclient creation cleanup using t.Cleanup()

* minor cleanup to ganache_test_keys code

* initial dynamic monero-wallet-rpc implementation for tests

* converted monero tests to use dynamic monero-wallet-rpc services

* unit tests all using dynamic monero-wallet-rpc services

* fixed 2 tests that failed after moving to dynamic monero-wallet-rpc services

* fixed low balance issues in TestSwapState_NotifyClaimed

Co-authored-by: noot <36753753+noot@users.noreply.github.com>
2022-06-29 13:36:03 -04:00
noot
cca0b6c771 allow for multiple ongoing swaps (#128) 2022-06-13 20:50:10 -04:00