From 0a5be65a9a86e101bddf4c7418e167cc236459cb Mon Sep 17 00:00:00 2001 From: Rodrigo <95635797+poly-rodr@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:14:44 -0300 Subject: [PATCH] migration to amoy (#14) --- go.mod | 21 +++-- go.sum | 82 +++++++++++++------ .../exchange_order_builder_impl_test.go | 26 +++--- pkg/config/config.go | 20 ++--- pkg/config/config_test.go | 32 ++++---- pkg/eip712/eip712_test.go | 36 ++++---- pkg/utils/module_test.go | 10 +-- 7 files changed, 128 insertions(+), 99 deletions(-) diff --git a/go.mod b/go.mod index 2aaa070..f6f73f8 100644 --- a/go.mod +++ b/go.mod @@ -3,14 +3,14 @@ module github.com/polymarket/go-order-utils go 1.21 require ( - github.com/ethereum/go-ethereum v1.13.5 + github.com/ethereum/go-ethereum v1.13.14 github.com/stretchr/testify v1.8.4 ) require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/StackExchange/wmi v1.2.1 // indirect - github.com/bits-and-blooms/bitset v1.7.0 // indirect + github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/consensys/bavard v0.1.13 // indirect github.com/consensys/gnark-crypto v0.12.1 // indirect @@ -20,11 +20,10 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-ole/go-ole v1.2.5 // indirect - github.com/go-stack/stack v1.8.1 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect - github.com/holiman/uint256 v1.2.3 // indirect + github.com/holiman/uint256 v1.2.4 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect @@ -32,12 +31,12 @@ require ( github.com/supranational/blst v0.3.11 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/tools v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 80a5d3f..e7e3edf 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bw github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo= -github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88= +github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= @@ -34,6 +34,10 @@ github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/Yj github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 h1:d28BXYi+wUpz1KBmiF9bWrjEMacUEREV6MBi2ODnrfQ= +github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs= github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA= github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -47,33 +51,44 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY= github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= -github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= -github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= +github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ= +github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU= +github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA= +github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2GihuqhwdILrV+7GJel5lyPV3u1+PgzrWLc0TkE= +github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= -github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +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= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= -github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= @@ -88,10 +103,18 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= @@ -113,6 +136,10 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= @@ -135,29 +162,38 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= +github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= +golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/builder/exchange_order_builder_impl_test.go b/pkg/builder/exchange_order_builder_impl_test.go index 03a5cf6..751b07a 100644 --- a/pkg/builder/exchange_order_builder_impl_test.go +++ b/pkg/builder/exchange_order_builder_impl_test.go @@ -12,7 +12,7 @@ import ( ) var ( - chainId = new(big.Int).SetInt64(80001) + chainId = new(big.Int).SetInt64(80002) // publicly known private key privateKey, _ = crypto.ToECDSA(common.Hex2Bytes("ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80")) // private key address @@ -123,8 +123,8 @@ func TestBuildOrderHash(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, orderHash) - expectedOrderHash := common.Hex2Bytes("bf58957703791db2ab057528d03d1cff5375d9a475b14a9073bb7d892398dc96") - assert.Equal(t, expectedOrderHash, orderHash[:]) + expectedOrderHash := common.HexToHash("02ca1d1aa31103804173ad1acd70066cb6c1258a4be6dada055111f9a7ea4e55") + assert.Equal(t, expectedOrderHash.String(), orderHash.String()) // NegRisk // random salt @@ -167,8 +167,8 @@ func TestBuildOrderHash(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, orderHash) - expectedOrderHash = common.Hex2Bytes("053c3169ec6c9e99e3640cb12b9c9245917daf36bd4fd39ea09d201a07b53952") - assert.Equal(t, expectedOrderHash, orderHash[:]) + expectedOrderHash = common.HexToHash("f15790d3edc4b5aed427b0b543a9206fcf4b1a13dfed016d33bfb313076263b8") + assert.Equal(t, expectedOrderHash.String(), orderHash.String()) } func TestBuildOrderSignature(t *testing.T) { @@ -221,8 +221,8 @@ func TestBuildOrderSignature(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, orderSignature) - expectedSignature := common.Hex2Bytes("3874d2cfe79c0e82577f4f76ec58d950522ee5923a6f08441927d382c8178a5a2190fd4d5c49705e94d75999a58ec843f94a432e87ebc15cdb2186d315b3cc201b") - assert.Equal(t, expectedSignature, orderSignature) + expectedSignature := "302cd9abd0b5fcaa202a344437ec0b6660da984e24ae9ad915a592a90facf5a51bb8a873cd8d270f070217fea1986531d5eec66f1162a81f66e026db653bf7ce1c" + assert.Equal(t, expectedSignature, common.Bytes2Hex(orderSignature)) // NegRisk // random salt @@ -273,8 +273,8 @@ func TestBuildOrderSignature(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, orderSignature) - expectedSignature = common.Hex2Bytes("b47e588cfb8630ffa255d1a04a4bb2b996967c2143fc107ab443282ed7dcc123288842968fa29e6f2e789e39ea02f13654d4dd55002b8672e9a91e2ba9045aa21b") - assert.Equal(t, expectedSignature, orderSignature) + expectedSignature = "1b3646ef347e5bd144c65bd3357ba19c12c12abaeedae733cf8579bc51a2752c0454c3bc6b236957e393637982c769b8dc0706c0f5c399983d933850afd1cbcd1c" + assert.Equal(t, expectedSignature, common.Bytes2Hex(orderSignature)) } func TestBuildSignedOrder(t *testing.T) { @@ -338,8 +338,8 @@ func TestBuildSignedOrder(t *testing.T) { assert.Equal(t, signedOrder.SignatureType.String(), "0") assert.NotEmpty(t, hex.EncodeToString(signedOrder.Signature)) - expectedSignature := common.Hex2Bytes("3874d2cfe79c0e82577f4f76ec58d950522ee5923a6f08441927d382c8178a5a2190fd4d5c49705e94d75999a58ec843f94a432e87ebc15cdb2186d315b3cc201b") - assert.Equal(t, expectedSignature, signedOrder.Signature) + expectedSignature := "302cd9abd0b5fcaa202a344437ec0b6660da984e24ae9ad915a592a90facf5a51bb8a873cd8d270f070217fea1986531d5eec66f1162a81f66e026db653bf7ce1c" + assert.Equal(t, expectedSignature, common.Bytes2Hex(signedOrder.Signature)) // NegRisk // random salt @@ -401,6 +401,6 @@ func TestBuildSignedOrder(t *testing.T) { assert.Equal(t, signedOrder.SignatureType.String(), "0") assert.NotEmpty(t, hex.EncodeToString(signedOrder.Signature)) - expectedSignature = common.Hex2Bytes("b47e588cfb8630ffa255d1a04a4bb2b996967c2143fc107ab443282ed7dcc123288842968fa29e6f2e789e39ea02f13654d4dd55002b8672e9a91e2ba9045aa21b") - assert.Equal(t, expectedSignature, signedOrder.Signature) + expectedSignature = "1b3646ef347e5bd144c65bd3357ba19c12c12abaeedae733cf8579bc51a2752c0454c3bc6b236957e393637982c769b8dc0706c0f5c399983d933850afd1cbcd1c" + assert.Equal(t, expectedSignature, common.Bytes2Hex(signedOrder.Signature)) } diff --git a/pkg/config/config.go b/pkg/config/config.go index c9e8081..6468908 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -18,14 +18,14 @@ type Contracts struct { func GetContracts(chainId int64) (*Contracts, error) { var ( - MUMBAI_CONTRACTS = &Contracts{ - Exchange: common.HexToAddress("0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E"), - FeeModule: common.HexToAddress("0x56C79347e95530c01A2FC76E732f9566dA16E113"), - NegRiskExchange: common.HexToAddress("0x87d1A0DdB4C63a6301916F02090A51a7241571e4"), - NegRiskFeeModule: common.HexToAddress("0x311FD94978961EeF4B903519B33B47B506aB6823"), - NegRiskAdapter: common.HexToAddress("0x9A6930BB811fe3dFE1c35e4502134B38EC54399C"), - Collateral: common.HexToAddress("0x2E8DCfE708D44ae2e406a1c02DFE2Fa13012f961"), - Conditional: common.HexToAddress("0x7D8610E9567d2a6C9FBf66a5A13E9Ba8bb120d43"), + AMOY_CONTRACTS = &Contracts{ + Exchange: common.HexToAddress("0xdFE02Eb6733538f8Ea35D585af8DE5958AD99E40"), + FeeModule: common.HexToAddress("0x9A9faEf45C671cc57B3e117c5B3053075416490f"), + NegRiskExchange: common.HexToAddress("0xC5d563A36AE78145C45a50134d48A1215220f80a"), + NegRiskFeeModule: common.HexToAddress("0x78769d50be1763ed1ca0d5e878d93f05aabff29e"), + NegRiskAdapter: common.HexToAddress("0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296"), + Collateral: common.HexToAddress("0x9c4e1703476e875070ee25b56a58b008cfb8fa78"), + Conditional: common.HexToAddress("0x69308FB512518e39F9b16112fA8d994F4e2Bf8bB"), } MATIC_CONTRACTS = &Contracts{ @@ -42,8 +42,8 @@ func GetContracts(chainId int64) (*Contracts, error) { switch chainId { case 137: return MATIC_CONTRACTS, nil - case 80001: - return MUMBAI_CONTRACTS, nil + case 80002: + return AMOY_CONTRACTS, nil default: return nil, fmt.Errorf("invalid chain id") } diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 81fcf13..55232d1 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -10,14 +10,14 @@ import ( func TestGetContracts(t *testing.T) { var ( - mumbai = &Contracts{ - Exchange: common.HexToAddress("0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E"), - FeeModule: common.HexToAddress("0x56C79347e95530c01A2FC76E732f9566dA16E113"), - Collateral: common.HexToAddress("0x2E8DCfE708D44ae2e406a1c02DFE2Fa13012f961"), - Conditional: common.HexToAddress("0x7D8610E9567d2a6C9FBf66a5A13E9Ba8bb120d43"), - NegRiskFeeModule: common.HexToAddress("0x311FD94978961EeF4B903519B33B47B506aB6823"), - NegRiskExchange: common.HexToAddress("0x87d1A0DdB4C63a6301916F02090A51a7241571e4"), - NegRiskAdapter: common.HexToAddress("0x9A6930BB811fe3dFE1c35e4502134B38EC54399C"), + amoy = &Contracts{ + Exchange: common.HexToAddress("0xdFE02Eb6733538f8Ea35D585af8DE5958AD99E40"), + FeeModule: common.HexToAddress("0x9A9faEf45C671cc57B3e117c5B3053075416490f"), + NegRiskExchange: common.HexToAddress("0xC5d563A36AE78145C45a50134d48A1215220f80a"), + NegRiskFeeModule: common.HexToAddress("0x78769d50be1763ed1ca0d5e878d93f05aabff29e"), + NegRiskAdapter: common.HexToAddress("0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296"), + Collateral: common.HexToAddress("0x9c4e1703476e875070ee25b56a58b008cfb8fa78"), + Conditional: common.HexToAddress("0x69308FB512518e39F9b16112fA8d994F4e2Bf8bB"), } matic = &Contracts{ @@ -31,16 +31,16 @@ func TestGetContracts(t *testing.T) { } ) - c, err := GetContracts(80001) + c, err := GetContracts(80002) assert.NotNil(t, c) assert.Nil(t, err) - assert.True(t, bytes.Equal(c.Exchange[:], mumbai.Exchange[:])) - assert.True(t, bytes.Equal(c.FeeModule[:], mumbai.FeeModule[:])) - assert.True(t, bytes.Equal(c.Collateral[:], mumbai.Collateral[:])) - assert.True(t, bytes.Equal(c.Conditional[:], mumbai.Conditional[:])) - assert.True(t, bytes.Equal(c.NegRiskFeeModule[:], mumbai.NegRiskFeeModule[:])) - assert.True(t, bytes.Equal(c.NegRiskExchange[:], mumbai.NegRiskExchange[:])) - assert.True(t, bytes.Equal(c.NegRiskAdapter[:], mumbai.NegRiskAdapter[:])) + assert.True(t, bytes.Equal(c.Exchange[:], amoy.Exchange[:])) + assert.True(t, bytes.Equal(c.FeeModule[:], amoy.FeeModule[:])) + assert.True(t, bytes.Equal(c.Collateral[:], amoy.Collateral[:])) + assert.True(t, bytes.Equal(c.Conditional[:], amoy.Conditional[:])) + assert.True(t, bytes.Equal(c.NegRiskFeeModule[:], amoy.NegRiskFeeModule[:])) + assert.True(t, bytes.Equal(c.NegRiskExchange[:], amoy.NegRiskExchange[:])) + assert.True(t, bytes.Equal(c.NegRiskAdapter[:], amoy.NegRiskAdapter[:])) c, err = GetContracts(137) assert.NotNil(t, c) diff --git a/pkg/eip712/eip712_test.go b/pkg/eip712/eip712_test.go index b13ab4f..9a78a8f 100644 --- a/pkg/eip712/eip712_test.go +++ b/pkg/eip712/eip712_test.go @@ -1,7 +1,6 @@ package eip712 import ( - "encoding/hex" "math/big" "testing" @@ -12,31 +11,31 @@ import ( ) func TestBuildEIP712DomainSeparator(t *testing.T) { - expectedMumbai := common.Hex2Bytes("66b157d2cc69ba84f05ab5f6ae3a7438d209df5c167c89848968e301da841e1c") + expectedAmoy := common.HexToHash("0x029ca49b31e01a0230787b3673a6977ee0dbb02f78e68d2ee41d330893e17594") name := crypto.Keccak256Hash([]byte("Polymarket CTF Exchange")) version := crypto.Keccak256Hash([]byte("1")) - chainId := big.NewInt(80001) + chainId := big.NewInt(80002) address := common.HexToAddress("0x0000000000000000000000000000000000000000") actual, err := BuildEIP712DomainSeparator(name, version, chainId, address) assert.NoError(t, err) assert.NotEmpty(t, actual) - assert.Equal(t, expectedMumbai, actual[:]) + assert.Equal(t, expectedAmoy.String(), actual.String()) - expectedPolygon := common.Hex2Bytes("0ba60c2a4504ef46ef2d139f27cd131dbc8b9643d0565a54bb14de0e31cd5600") + expectedPolygon := common.HexToHash("0ba60c2a4504ef46ef2d139f27cd131dbc8b9643d0565a54bb14de0e31cd5600") chainId = big.NewInt(137) actual, err = BuildEIP712DomainSeparator(name, version, chainId, address) assert.NoError(t, err) assert.NotEmpty(t, actual) - assert.NotEqual(t, expectedMumbai, actual[:]) - assert.Equal(t, expectedPolygon, actual[:]) + assert.NotEqual(t, expectedAmoy.String(), actual.String()) + assert.Equal(t, expectedPolygon.String(), actual.String()) } func TestBuildEIP712DomainSeparatorNoContract(t *testing.T) { // Calculated in foundry - expectedMumbai := common.Hex2Bytes("4a3577f6d2decf700867987650d4fe51bd2b991c2e7603094244852187451f06") - chainId := big.NewInt(80001) + expectedAmoy := common.HexToHash("0xf231a704e0942ea4f4f4a68a19fa01e198ddae4595d821697230159c60e562b0") + chainId := big.NewInt(80002) name := crypto.Keccak256Hash([]byte("Polymarket CTF Exchange")) version := crypto.Keccak256Hash([]byte("1")) @@ -44,23 +43,23 @@ func TestBuildEIP712DomainSeparatorNoContract(t *testing.T) { actual, err := BuildEIP712DomainSeparatorNoContract(name, version, chainId) assert.NoError(t, err) assert.NotEmpty(t, actual) - assert.Equal(t, expectedMumbai, actual[:]) + assert.Equal(t, expectedAmoy.String(), actual.String()) // Calculated in foundry - expectedPolygon := common.Hex2Bytes("aee1d7dd93bb10f6c6a59417017905bc5dbec7ddbd71475cd19d8a95845e632d") + expectedPolygon := common.HexToHash("aee1d7dd93bb10f6c6a59417017905bc5dbec7ddbd71475cd19d8a95845e632d") chainId = big.NewInt(137) actual, err = BuildEIP712DomainSeparatorNoContract(name, version, chainId) assert.NoError(t, err) assert.NotEmpty(t, actual) - assert.NotEqual(t, expectedMumbai, actual[:]) - assert.Equal(t, expectedPolygon, actual[:]) + assert.NotEqual(t, expectedAmoy.String(), actual.String()) + assert.Equal(t, expectedPolygon.String(), actual.String()) } func TestHashTypedDataV4(t *testing.T) { name := crypto.Keccak256Hash([]byte("Polymarket CTF Exchange")) version := crypto.Keccak256Hash([]byte("1")) - chainId := big.NewInt(80001) + chainId := big.NewInt(80002) address := common.HexToAddress("0x0000000000000000000000000000000000000000") domainSeparator, err := BuildEIP712DomainSeparator(name, version, chainId, address) @@ -82,11 +81,6 @@ func TestHashTypedDataV4(t *testing.T) { assert.NoError(t, err) assert.NotEmpty(t, dataHashBytes) - expectedTypedDataHash := "caaea30a004febfda6fd75f0ccf024a806839d6a6f9e1fd79424787ab078a7e3" - expectedTypedDataHashBytes := common.Hex2Bytes(expectedTypedDataHash) - - assert.Equal(t, expectedTypedDataHashBytes, dataHashBytes[:]) - - typedDataHash := hex.EncodeToString(dataHashBytes[:]) - assert.Equal(t, expectedTypedDataHash, typedDataHash) + expectedTypedDataHash := "0x5b9fd6432c2890e6293b3880add5e3d40ead280b31f7cd70f06b43f8d37dcc13" + assert.Equal(t, expectedTypedDataHash, dataHashBytes.String()) } diff --git a/pkg/utils/module_test.go b/pkg/utils/module_test.go index 24448ed..d5dd40b 100644 --- a/pkg/utils/module_test.go +++ b/pkg/utils/module_test.go @@ -10,14 +10,14 @@ import ( ) func TestGetVerifyingContractAddress(t *testing.T) { - // mumbai - contract, err := GetVerifyingContractAddress(big.NewInt(80001), model.CTFExchange) + // amoy + contract, err := GetVerifyingContractAddress(big.NewInt(80002), model.CTFExchange) assert.NoError(t, err) - assert.Equal(t, common.HexToAddress("0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E").Hex(), contract.Hex()) + assert.Equal(t, common.HexToAddress("0xdFE02Eb6733538f8Ea35D585af8DE5958AD99E40").Hex(), contract.Hex()) - contract, err = GetVerifyingContractAddress(big.NewInt(80001), model.NegRiskCTFExchange) + contract, err = GetVerifyingContractAddress(big.NewInt(80002), model.NegRiskCTFExchange) assert.NoError(t, err) - assert.Equal(t, common.HexToAddress("0x87d1A0DdB4C63a6301916F02090A51a7241571e4").Hex(), contract.Hex()) + assert.Equal(t, common.HexToAddress("0xC5d563A36AE78145C45a50134d48A1215220f80a").Hex(), contract.Hex()) // polygon mainnet contract, err = GetVerifyingContractAddress(big.NewInt(137), model.CTFExchange)