Skip to content

Commit

Permalink
internal: Add basic simnet xmr swap.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeGruffins committed Sep 24, 2024
1 parent 5736f60 commit ac416c1
Show file tree
Hide file tree
Showing 5 changed files with 1,260 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ client/cmd/translationsreport/worksheets
server/cmd/dexadm/dexadm
server/cmd/geogame/geogame
internal/libsecp256k1/secp256k1
internal/cmd/xmrswap/xmrswap
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
require (
decred.org/dcrwallet/v4 v4.1.1
fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412
github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240625142744-cc26860b4026
github.com/btcsuite/btcd/btcec/v2 v2.3.4
github.com/btcsuite/btcd/btcutil v1.1.5
Expand Down Expand Up @@ -43,6 +44,7 @@ require (
github.com/decred/go-socks v1.1.0
github.com/decred/slog v1.2.0
github.com/decred/vspd/types/v2 v2.1.0
github.com/dev-warrior777/go-monero v0.1.0
github.com/dgraph-io/badger v1.6.2
github.com/ethereum/go-ethereum v1.14.8
github.com/fatih/color v1.16.0
Expand All @@ -51,6 +53,7 @@ require (
github.com/gcash/bchutil v0.0.0-20210113190856-6ea28dff4000
github.com/go-chi/chi/v5 v5.0.1
github.com/gorilla/websocket v1.5.1
github.com/haven-protocol-org/monero-go-utils v0.0.0-20211126154105-058b2666f217
github.com/huandu/skiplist v1.2.0
github.com/jessevdk/go-flags v1.5.0
github.com/jrick/logrotate v1.0.0
Expand Down Expand Up @@ -81,7 +84,6 @@ require (
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/aead/siphash v1.0.1 // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ github.com/decred/vspd/types/v2 v2.1.0 h1:cUVlmHPeLVsksPRnr2WHsmC2t1Skl6g1WH0Hmp
github.com/decred/vspd/types/v2 v2.1.0/go.mod h1:2xnNqedkt9GuL+pK8uIzDxqYxFlwLRflYFJH64b76n0=
github.com/denis-tingajkin/go-header v0.4.2/go.mod h1:eLRHAVXzE5atsKAnNRDB90WHCFFnBUn4RN0nRcs1LJA=
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
github.com/dev-warrior777/go-monero v0.1.0 h1:86JJRiYNk2muLJFWM6kgb7qZh1gE/ETjvjHSW+3Rn5c=
github.com/dev-warrior777/go-monero v0.1.0/go.mod h1:DSf/k695WklA8lTl1EzqNLhtKP3BE3x5KU6tsPrXp4k=
github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8=
github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE=
github.com/dgraph-io/ristretto v0.0.2 h1:a5WaUrDa0qm0YrAAS1tUykT5El3kt62KNZZeMxQn3po=
Expand Down Expand Up @@ -613,6 +615,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/haven-protocol-org/monero-go-utils v0.0.0-20211126154105-058b2666f217 h1:CflMOYZHhaBo+7up92oOYcesIG+qDCAKdJo+niKBFWM=
github.com/haven-protocol-org/monero-go-utils v0.0.0-20211126154105-058b2666f217/go.mod h1:vSMDRpw62HGWO1Fi9DQwfgs4e3JCbt475GWY/W5DQZI=
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4=
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
Expand Down
31 changes: 31 additions & 0 deletions internal/adaptorsigs/dcr/dcr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package dcr

import "github.com/decred/dcrd/txscript/v4"

func LockRefundTxScript(kal, kaf []byte, locktime int64) ([]byte, error) {
return txscript.NewScriptBuilder().
AddOp(txscript.OP_IF).
AddOp(txscript.OP_2).
AddData(kal).
AddData(kaf).
AddOp(txscript.OP_2).
AddOp(txscript.OP_CHECKMULTISIG).
AddOp(txscript.OP_ELSE).
AddInt64(locktime).
AddOp(txscript.OP_CHECKSEQUENCEVERIFY).
AddOp(txscript.OP_DROP).
AddData(kaf).
AddOp(txscript.OP_CHECKSIG).
AddOp(txscript.OP_ENDIF).
Script()
}

func LockTxScript(kal, kaf []byte) ([]byte, error) {
return txscript.NewScriptBuilder().
AddOp(txscript.OP_2).
AddData(kal).
AddData(kaf).
AddOp(txscript.OP_2).
AddOp(txscript.OP_CHECKMULTISIG).
Script()
}
Loading

0 comments on commit ac416c1

Please sign in to comment.