Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
ed0d8480
Commit
ed0d8480
authored
Aug 22, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: cleanup
parent
6d049fea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
6 deletions
+133
-6
batch_file_test.go
op-chain-ops/safe/batch_file_test.go
+13
-5
deposit-tx.json
op-chain-ops/safe/testdata/deposit-tx.json
+56
-0
finalize-withdrawal-tx.json
op-chain-ops/safe/testdata/finalize-withdrawal-tx.json
+64
-0
tx-batch.json
op-chain-ops/safe/tx-batch.json
+0
-1
No files found.
op-chain-ops/safe/batch_file_test.go
View file @
ed0d8480
...
...
@@ -3,7 +3,7 @@ package safe
import
(
"bytes"
"encoding/json"
"fmt"
//
"fmt"
"math/big"
"os"
"testing"
...
...
@@ -35,6 +35,7 @@ func testBatchJSON(t *testing.T, path string) {
require
.
JSONEq
(
t
,
string
(
b
),
string
(
data
))
}
// TestBatchAddCallFinalizeWithdrawalTransaction ensures that structs can be serialized correctly.
func
TestBatchAddCallFinalizeWithdrawalTransaction
(
t
*
testing
.
T
)
{
file
,
err
:=
os
.
ReadFile
(
"testdata/portal-abi.json"
)
require
.
NoError
(
t
,
err
)
...
...
@@ -58,11 +59,15 @@ func TestBatchAddCallFinalizeWithdrawalTransaction(t *testing.T) {
value
:=
big
.
NewInt
(
222
)
require
.
NoError
(
t
,
batch
.
AddCall
(
to
,
value
,
sig
,
argument
,
portalABI
))
d
,
err
:=
json
.
MarshalIndent
(
batch
,
" "
,
"
"
)
expected
,
err
:=
os
.
ReadFile
(
"testdata/finalize-withdrawal-tx.json
"
)
require
.
NoError
(
t
,
err
)
fmt
.
Println
(
string
(
d
))
serialized
,
err
:=
json
.
Marshal
(
batch
)
require
.
NoError
(
t
,
err
)
require
.
JSONEq
(
t
,
string
(
expected
),
string
(
serialized
))
}
// TestBatchAddCallDespostTransaction ensures that simple calls can be serialized correctly.
func
TestBatchAddCallDespostTransaction
(
t
*
testing
.
T
)
{
file
,
err
:=
os
.
ReadFile
(
"testdata/portal-abi.json"
)
require
.
NoError
(
t
,
err
)
...
...
@@ -82,7 +87,10 @@ func TestBatchAddCallDespostTransaction(t *testing.T) {
}
require
.
NoError
(
t
,
batch
.
AddCall
(
to
,
value
,
sig
,
argument
,
portalABI
))
d
,
err
:=
json
.
MarshalIndent
(
batch
,
" "
,
" "
)
expected
,
err
:=
os
.
ReadFile
(
"testdata/deposit-tx.json"
)
require
.
NoError
(
t
,
err
)
serialized
,
err
:=
json
.
Marshal
(
batch
)
require
.
NoError
(
t
,
err
)
fmt
.
Println
(
string
(
d
))
require
.
JSONEq
(
t
,
string
(
expected
),
string
(
serialize
d
))
}
op-chain-ops/safe/testdata/deposit-tx.json
0 → 100644
View file @
ed0d8480
{
"version"
:
""
,
"chainId"
:
""
,
"createdAt"
:
0
,
"meta"
:
{
"createdFromSafeAddress"
:
""
,
"createdFromOwnerAddress"
:
""
,
"name"
:
""
,
"description"
:
""
},
"transactions"
:
[
{
"to"
:
"0x0000000000000000000000000000000000000001"
,
"value"
:
"222"
,
"data"
:
"0xe9e05c42000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000"
,
"contractMethod"
:
{
"inputs"
:
[
{
"internalType"
:
"address"
,
"name"
:
"_to"
,
"type"
:
"address"
},
{
"internalType"
:
"uint256"
,
"name"
:
"_value"
,
"type"
:
"uint256"
},
{
"internalType"
:
"uint64"
,
"name"
:
"_gasLimit"
,
"type"
:
"uint64"
},
{
"internalType"
:
"bool"
,
"name"
:
"_isCreation"
,
"type"
:
"bool"
},
{
"internalType"
:
"bytes"
,
"name"
:
"_data"
,
"type"
:
"bytes"
}
],
"name"
:
"depositTransaction"
,
"payable"
:
false
},
"contractInputsValues"
:
{
"_data"
:
"0x"
,
"_gasLimit"
:
"100"
,
"_isCreation"
:
"false"
,
"_to"
:
"0x0100000000000000000000000000000000000000"
,
"_value"
:
"2"
}
}
]
}
op-chain-ops/safe/testdata/finalize-withdrawal-tx.json
0 → 100644
View file @
ed0d8480
{
"version"
:
""
,
"chainId"
:
""
,
"createdAt"
:
0
,
"meta"
:
{
"createdFromSafeAddress"
:
""
,
"createdFromOwnerAddress"
:
""
,
"name"
:
""
,
"description"
:
""
},
"transactions"
:
[
{
"to"
:
"0x0000000000000000000000000000000000000001"
,
"value"
:
"222"
,
"data"
:
"0x8c3152e900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000"
,
"contractMethod"
:
{
"inputs"
:
[
{
"internalType"
:
"TypesWithdrawalTransaction"
,
"name"
:
"_tx"
,
"type"
:
"tuple"
,
"components"
:
[
{
"internalType"
:
"uint256"
,
"name"
:
"nonce"
,
"type"
:
"uint256"
},
{
"internalType"
:
"address"
,
"name"
:
"sender"
,
"type"
:
"address"
},
{
"internalType"
:
"address"
,
"name"
:
"target"
,
"type"
:
"address"
},
{
"internalType"
:
"uint256"
,
"name"
:
"value"
,
"type"
:
"uint256"
},
{
"internalType"
:
"uint256"
,
"name"
:
"gasLimit"
,
"type"
:
"uint256"
},
{
"internalType"
:
"bytes"
,
"name"
:
"data"
,
"type"
:
"bytes"
}
]
}
],
"name"
:
"finalizeWithdrawalTransaction"
,
"payable"
:
false
},
"contractInputsValues"
:
{
"_tx"
:
"[0,0x0000000000000000000000000000000000000001,0x0000000000000000000000000000000000000002,1,2,0x]"
}
}
]
}
op-chain-ops/safe/tx-batch.json
deleted
100644 → 0
View file @
6d049fea
{
"version"
:
"1.0","chainId"
:
"1","createdAt"
:
1692061927446
,
"meta"
:{
"name"
:
"Transactions Batch","description"
:
"","txBuilderVersion"
:
"1.16.1","createdFromSafeAddress"
:
"0xc9D26D376dD75573E0C3247C141881F053d27Ae8","createdFromOwnerAddress"
:
"","checksum"
:
"0x9d01f75b6ab0cb240db3e3be44efdb96d64b2c88ef160bb13f46f279845c1a72"},"transactions"
:[{
"to"
:
"0x9e760aBd847E48A56b4a348Cba56Ae7267FeCE80","value"
:
"0","data"
:
null
,
"contractMethod"
:{
"inputs"
:[{
"components"
:[{
"internalType"
:
"uint256","name"
:
"nonce","type"
:
"uint256"},{"internalType"
:
"address","name"
:
"sender","type"
:
"address"},{"internalType"
:
"address","name"
:
"target","type"
:
"address"},{"internalType"
:
"uint256","name"
:
"value","type"
:
"uint256"},{"internalType"
:
"uint256","name"
:
"gasLimit","type"
:
"uint256"},{"internalType"
:
"bytes","name"
:
"data","type"
:
"bytes"}],"internalType"
:
"struct Types.WithdrawalTransaction","name"
:
"_tx","type"
:
"tuple"}],"name"
:
"finalizeWithdrawalTransaction","payable"
:
false
},
"contractInputsValues"
:
{
"_tx"
:
"[0,
\"
0x0000000000000000000000000000000000000000
\"
,
\"
0x0000000000000000000000000000000000000000
\"
,0,0,
\"
0x
\"
]"
}
}
]}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment