mixin_bot 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mixin_bot/version.rb +1 -1
- data/lib/mixin_bot.rb +1 -0
- data/lib/mvm/abis/bridge.json +154 -0
- data/lib/mvm/abis/erc20.json +188 -0
- data/lib/mvm/abis/erc721.json +317 -0
- data/lib/mvm/abis/mirror.json +163 -0
- data/lib/mvm/abis/registry.json +248 -0
- data/lib/mvm/bridge.rb +38 -0
- data/lib/mvm/client.rb +50 -0
- data/lib/mvm/nft.rb +53 -0
- data/lib/mvm/scan.rb +27 -0
- data/lib/mvm.rb +28 -0
- metadata +26 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1555506a74f1562be6b92eb661ee0a870bfe2a1a027d808984d4214c1ecde0cc
|
4
|
+
data.tar.gz: 6d93e542cf33a92cd3088944ee1ee22a7bd3be3e974760e6ad802e29d003c1b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ac6e4f3ac3cd7ed3477794d34d47b9dbdd2fdbb47e2a4bd502976393faec0376d7833dad77fd43c24a04254ce456248af952b8e3f1db85cd2a04323fcb36970
|
7
|
+
data.tar.gz: 83eecbd6f63ffb8caa4b295bf8f5ded53608e3036d1570104417089a1370c55216395adc7d79da7e958414052f1bb894dfabe95607a77b8dce9e89f130eb0072
|
data/lib/mixin_bot/version.rb
CHANGED
data/lib/mixin_bot.rb
CHANGED
@@ -0,0 +1,154 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"type": "constructor",
|
4
|
+
"stateMutability": "nonpayable",
|
5
|
+
"inputs": [
|
6
|
+
{ "type": "address", "name": "factory", "internalType": "address" },
|
7
|
+
{ "type": "address", "name": "xin", "internalType": "address" }
|
8
|
+
]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"type": "event",
|
12
|
+
"name": "Bound",
|
13
|
+
"inputs": [
|
14
|
+
{
|
15
|
+
"type": "address",
|
16
|
+
"name": "from",
|
17
|
+
"internalType": "address",
|
18
|
+
"indexed": true
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"type": "address",
|
22
|
+
"name": "to",
|
23
|
+
"internalType": "address",
|
24
|
+
"indexed": true
|
25
|
+
}
|
26
|
+
],
|
27
|
+
"anonymous": false
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"type": "event",
|
31
|
+
"name": "Through",
|
32
|
+
"inputs": [
|
33
|
+
{
|
34
|
+
"type": "address",
|
35
|
+
"name": "asset",
|
36
|
+
"internalType": "address",
|
37
|
+
"indexed": true
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"type": "address",
|
41
|
+
"name": "from",
|
42
|
+
"internalType": "address",
|
43
|
+
"indexed": true
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"type": "address",
|
47
|
+
"name": "to",
|
48
|
+
"internalType": "address",
|
49
|
+
"indexed": true
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"type": "uint256",
|
53
|
+
"name": "amount",
|
54
|
+
"internalType": "uint256",
|
55
|
+
"indexed": false
|
56
|
+
}
|
57
|
+
],
|
58
|
+
"anonymous": false
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"type": "event",
|
62
|
+
"name": "Vault",
|
63
|
+
"inputs": [
|
64
|
+
{
|
65
|
+
"type": "address",
|
66
|
+
"name": "from",
|
67
|
+
"internalType": "address",
|
68
|
+
"indexed": true
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"type": "uint256",
|
72
|
+
"name": "amount",
|
73
|
+
"internalType": "uint256",
|
74
|
+
"indexed": false
|
75
|
+
}
|
76
|
+
],
|
77
|
+
"anonymous": false
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"type": "function",
|
81
|
+
"stateMutability": "view",
|
82
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
83
|
+
"name": "BASE",
|
84
|
+
"inputs": []
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"type": "function",
|
88
|
+
"stateMutability": "view",
|
89
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
90
|
+
"name": "FACTORY",
|
91
|
+
"inputs": []
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"type": "function",
|
95
|
+
"stateMutability": "view",
|
96
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
97
|
+
"name": "OWNER",
|
98
|
+
"inputs": []
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"type": "function",
|
102
|
+
"stateMutability": "view",
|
103
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
104
|
+
"name": "XIN",
|
105
|
+
"inputs": []
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"type": "function",
|
109
|
+
"stateMutability": "nonpayable",
|
110
|
+
"outputs": [],
|
111
|
+
"name": "bind",
|
112
|
+
"inputs": [
|
113
|
+
{ "type": "address", "name": "receiver", "internalType": "address" }
|
114
|
+
]
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"type": "function",
|
118
|
+
"stateMutability": "view",
|
119
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
120
|
+
"name": "bridges",
|
121
|
+
"inputs": [{ "type": "address", "name": "", "internalType": "address" }]
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"type": "function",
|
125
|
+
"stateMutability": "nonpayable",
|
126
|
+
"outputs": [],
|
127
|
+
"name": "pass",
|
128
|
+
"inputs": [
|
129
|
+
{ "type": "address", "name": "asset", "internalType": "address" },
|
130
|
+
{ "type": "uint256", "name": "amount", "internalType": "uint256" }
|
131
|
+
]
|
132
|
+
},
|
133
|
+
{
|
134
|
+
"type": "function",
|
135
|
+
"stateMutability": "payable",
|
136
|
+
"outputs": [],
|
137
|
+
"name": "release",
|
138
|
+
"inputs": [
|
139
|
+
{ "type": "address", "name": "receiver", "internalType": "address" },
|
140
|
+
{ "type": "bytes", "name": "input", "internalType": "bytes" }
|
141
|
+
]
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"type": "function",
|
145
|
+
"stateMutability": "nonpayable",
|
146
|
+
"outputs": [],
|
147
|
+
"name": "vault",
|
148
|
+
"inputs": [
|
149
|
+
{ "type": "address", "name": "asset", "internalType": "address" },
|
150
|
+
{ "type": "uint256", "name": "amount", "internalType": "uint256" }
|
151
|
+
]
|
152
|
+
},
|
153
|
+
{ "type": "receive", "stateMutability": "payable" }
|
154
|
+
]
|
@@ -0,0 +1,188 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"type": "constructor",
|
4
|
+
"stateMutability": "nonpayable",
|
5
|
+
"inputs": [
|
6
|
+
{ "type": "uint128", "name": "_id", "internalType": "uint128" },
|
7
|
+
{ "type": "string", "name": "_name", "internalType": "string" },
|
8
|
+
{ "type": "string", "name": "_symbol", "internalType": "string" }
|
9
|
+
]
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"type": "event",
|
13
|
+
"name": "Approval",
|
14
|
+
"inputs": [
|
15
|
+
{
|
16
|
+
"type": "address",
|
17
|
+
"name": "owner",
|
18
|
+
"internalType": "address",
|
19
|
+
"indexed": true
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"type": "address",
|
23
|
+
"name": "spender",
|
24
|
+
"internalType": "address",
|
25
|
+
"indexed": true
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"type": "uint256",
|
29
|
+
"name": "value",
|
30
|
+
"internalType": "uint256",
|
31
|
+
"indexed": false
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"anonymous": false
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"type": "event",
|
38
|
+
"name": "Transfer",
|
39
|
+
"inputs": [
|
40
|
+
{
|
41
|
+
"type": "address",
|
42
|
+
"name": "from",
|
43
|
+
"internalType": "address",
|
44
|
+
"indexed": true
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"type": "address",
|
48
|
+
"name": "to",
|
49
|
+
"internalType": "address",
|
50
|
+
"indexed": true
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"type": "uint256",
|
54
|
+
"name": "value",
|
55
|
+
"internalType": "uint256",
|
56
|
+
"indexed": false
|
57
|
+
}
|
58
|
+
],
|
59
|
+
"anonymous": false
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"type": "function",
|
63
|
+
"stateMutability": "view",
|
64
|
+
"outputs": [
|
65
|
+
{ "type": "uint256", "name": "remaining", "internalType": "uint256" }
|
66
|
+
],
|
67
|
+
"name": "allowance",
|
68
|
+
"inputs": [
|
69
|
+
{ "type": "address", "name": "_owner", "internalType": "address" },
|
70
|
+
{ "type": "address", "name": "_spender", "internalType": "address" }
|
71
|
+
]
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"type": "function",
|
75
|
+
"stateMutability": "nonpayable",
|
76
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
77
|
+
"name": "approve",
|
78
|
+
"inputs": [
|
79
|
+
{ "type": "address", "name": "_spender", "internalType": "address" },
|
80
|
+
{ "type": "uint256", "name": "_value", "internalType": "uint256" }
|
81
|
+
]
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"type": "function",
|
85
|
+
"stateMutability": "view",
|
86
|
+
"outputs": [
|
87
|
+
{ "type": "uint256", "name": "balance", "internalType": "uint256" }
|
88
|
+
],
|
89
|
+
"name": "balanceOf",
|
90
|
+
"inputs": [
|
91
|
+
{ "type": "address", "name": "_owner", "internalType": "address" }
|
92
|
+
]
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"type": "function",
|
96
|
+
"stateMutability": "nonpayable",
|
97
|
+
"outputs": [],
|
98
|
+
"name": "burn",
|
99
|
+
"inputs": [
|
100
|
+
{ "type": "address", "name": "to", "internalType": "address" },
|
101
|
+
{ "type": "uint256", "name": "value", "internalType": "uint256" }
|
102
|
+
]
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"type": "function",
|
106
|
+
"stateMutability": "view",
|
107
|
+
"outputs": [{ "type": "uint8", "name": "", "internalType": "uint8" }],
|
108
|
+
"name": "decimals",
|
109
|
+
"inputs": []
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"type": "function",
|
113
|
+
"stateMutability": "view",
|
114
|
+
"outputs": [{ "type": "uint128", "name": "", "internalType": "uint128" }],
|
115
|
+
"name": "id",
|
116
|
+
"inputs": []
|
117
|
+
},
|
118
|
+
{
|
119
|
+
"type": "function",
|
120
|
+
"stateMutability": "nonpayable",
|
121
|
+
"outputs": [],
|
122
|
+
"name": "mint",
|
123
|
+
"inputs": [
|
124
|
+
{ "type": "address", "name": "to", "internalType": "address" },
|
125
|
+
{ "type": "uint256", "name": "value", "internalType": "uint256" }
|
126
|
+
]
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"type": "function",
|
130
|
+
"stateMutability": "view",
|
131
|
+
"outputs": [{ "type": "string", "name": "", "internalType": "string" }],
|
132
|
+
"name": "name",
|
133
|
+
"inputs": []
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"type": "function",
|
137
|
+
"stateMutability": "view",
|
138
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
139
|
+
"name": "registry",
|
140
|
+
"inputs": []
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"type": "function",
|
144
|
+
"stateMutability": "view",
|
145
|
+
"outputs": [{ "type": "string", "name": "", "internalType": "string" }],
|
146
|
+
"name": "symbol",
|
147
|
+
"inputs": []
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"type": "function",
|
151
|
+
"stateMutability": "view",
|
152
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
153
|
+
"name": "totalSupply",
|
154
|
+
"inputs": []
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"type": "function",
|
158
|
+
"stateMutability": "nonpayable",
|
159
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
160
|
+
"name": "transfer",
|
161
|
+
"inputs": [
|
162
|
+
{ "type": "address", "name": "to", "internalType": "address" },
|
163
|
+
{ "type": "uint256", "name": "value", "internalType": "uint256" }
|
164
|
+
]
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"type": "function",
|
168
|
+
"stateMutability": "nonpayable",
|
169
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
170
|
+
"name": "transferFrom",
|
171
|
+
"inputs": [
|
172
|
+
{ "type": "address", "name": "from", "internalType": "address" },
|
173
|
+
{ "type": "address", "name": "to", "internalType": "address" },
|
174
|
+
{ "type": "uint256", "name": "value", "internalType": "uint256" }
|
175
|
+
]
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"type": "function",
|
179
|
+
"stateMutability": "nonpayable",
|
180
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
181
|
+
"name": "transferWithExtra",
|
182
|
+
"inputs": [
|
183
|
+
{ "type": "address", "name": "to", "internalType": "address" },
|
184
|
+
{ "type": "uint256", "name": "value", "internalType": "uint256" },
|
185
|
+
{ "type": "bytes", "name": "extra", "internalType": "bytes" }
|
186
|
+
]
|
187
|
+
}
|
188
|
+
]
|
@@ -0,0 +1,317 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"type": "constructor",
|
4
|
+
"stateMutability": "nonpayable",
|
5
|
+
"inputs": [
|
6
|
+
{ "type": "uint256", "name": "_collection", "internalType": "uint256" },
|
7
|
+
{ "type": "string", "name": "_name", "internalType": "string" },
|
8
|
+
{ "type": "string", "name": "_symbol", "internalType": "string" }
|
9
|
+
]
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"type": "event",
|
13
|
+
"name": "Approval",
|
14
|
+
"inputs": [
|
15
|
+
{
|
16
|
+
"type": "address",
|
17
|
+
"name": "_owner",
|
18
|
+
"internalType": "address",
|
19
|
+
"indexed": true
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"type": "address",
|
23
|
+
"name": "_approved",
|
24
|
+
"internalType": "address",
|
25
|
+
"indexed": true
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"type": "uint256",
|
29
|
+
"name": "_tokenId",
|
30
|
+
"internalType": "uint256",
|
31
|
+
"indexed": true
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"anonymous": false
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"type": "event",
|
38
|
+
"name": "ApprovalForAll",
|
39
|
+
"inputs": [
|
40
|
+
{
|
41
|
+
"type": "address",
|
42
|
+
"name": "_owner",
|
43
|
+
"internalType": "address",
|
44
|
+
"indexed": true
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"type": "address",
|
48
|
+
"name": "_operator",
|
49
|
+
"internalType": "address",
|
50
|
+
"indexed": true
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"type": "bool",
|
54
|
+
"name": "_approved",
|
55
|
+
"internalType": "bool",
|
56
|
+
"indexed": false
|
57
|
+
}
|
58
|
+
],
|
59
|
+
"anonymous": false
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"type": "event",
|
63
|
+
"name": "OwnershipTransferred",
|
64
|
+
"inputs": [
|
65
|
+
{
|
66
|
+
"type": "address",
|
67
|
+
"name": "previousOwner",
|
68
|
+
"internalType": "address",
|
69
|
+
"indexed": true
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"type": "address",
|
73
|
+
"name": "newOwner",
|
74
|
+
"internalType": "address",
|
75
|
+
"indexed": true
|
76
|
+
}
|
77
|
+
],
|
78
|
+
"anonymous": false
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"type": "event",
|
82
|
+
"name": "Transfer",
|
83
|
+
"inputs": [
|
84
|
+
{
|
85
|
+
"type": "address",
|
86
|
+
"name": "_from",
|
87
|
+
"internalType": "address",
|
88
|
+
"indexed": true
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"type": "address",
|
92
|
+
"name": "_to",
|
93
|
+
"internalType": "address",
|
94
|
+
"indexed": true
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"type": "uint256",
|
98
|
+
"name": "_tokenId",
|
99
|
+
"internalType": "uint256",
|
100
|
+
"indexed": true
|
101
|
+
}
|
102
|
+
],
|
103
|
+
"anonymous": false
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"type": "function",
|
107
|
+
"stateMutability": "view",
|
108
|
+
"outputs": [{ "type": "string", "name": "", "internalType": "string" }],
|
109
|
+
"name": "CANNOT_TRANSFER_TO_ZERO_ADDRESS",
|
110
|
+
"inputs": []
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"type": "function",
|
114
|
+
"stateMutability": "view",
|
115
|
+
"outputs": [{ "type": "string", "name": "", "internalType": "string" }],
|
116
|
+
"name": "NOT_CURRENT_OWNER",
|
117
|
+
"inputs": []
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"type": "function",
|
121
|
+
"stateMutability": "nonpayable",
|
122
|
+
"outputs": [],
|
123
|
+
"name": "approve",
|
124
|
+
"inputs": [
|
125
|
+
{ "type": "address", "name": "_approved", "internalType": "address" },
|
126
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" }
|
127
|
+
]
|
128
|
+
},
|
129
|
+
{
|
130
|
+
"type": "function",
|
131
|
+
"stateMutability": "view",
|
132
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
133
|
+
"name": "balanceOf",
|
134
|
+
"inputs": [
|
135
|
+
{ "type": "address", "name": "_owner", "internalType": "address" }
|
136
|
+
]
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"type": "function",
|
140
|
+
"stateMutability": "nonpayable",
|
141
|
+
"outputs": [],
|
142
|
+
"name": "burn",
|
143
|
+
"inputs": [
|
144
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" }
|
145
|
+
]
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"type": "function",
|
149
|
+
"stateMutability": "view",
|
150
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
151
|
+
"name": "collection",
|
152
|
+
"inputs": []
|
153
|
+
},
|
154
|
+
{
|
155
|
+
"type": "function",
|
156
|
+
"stateMutability": "view",
|
157
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
158
|
+
"name": "getApproved",
|
159
|
+
"inputs": [
|
160
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" }
|
161
|
+
]
|
162
|
+
},
|
163
|
+
{
|
164
|
+
"type": "function",
|
165
|
+
"stateMutability": "view",
|
166
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
167
|
+
"name": "isApprovedForAll",
|
168
|
+
"inputs": [
|
169
|
+
{ "type": "address", "name": "_owner", "internalType": "address" },
|
170
|
+
{ "type": "address", "name": "_operator", "internalType": "address" }
|
171
|
+
]
|
172
|
+
},
|
173
|
+
{
|
174
|
+
"type": "function",
|
175
|
+
"stateMutability": "nonpayable",
|
176
|
+
"outputs": [],
|
177
|
+
"name": "mint",
|
178
|
+
"inputs": [
|
179
|
+
{ "type": "address", "name": "_to", "internalType": "address" },
|
180
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" },
|
181
|
+
{ "type": "string", "name": "_uri", "internalType": "string" }
|
182
|
+
]
|
183
|
+
},
|
184
|
+
{
|
185
|
+
"type": "function",
|
186
|
+
"stateMutability": "view",
|
187
|
+
"outputs": [
|
188
|
+
{ "type": "string", "name": "_name", "internalType": "string" }
|
189
|
+
],
|
190
|
+
"name": "name",
|
191
|
+
"inputs": []
|
192
|
+
},
|
193
|
+
{
|
194
|
+
"type": "function",
|
195
|
+
"stateMutability": "view",
|
196
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
197
|
+
"name": "owner",
|
198
|
+
"inputs": []
|
199
|
+
},
|
200
|
+
{
|
201
|
+
"type": "function",
|
202
|
+
"stateMutability": "view",
|
203
|
+
"outputs": [
|
204
|
+
{ "type": "address", "name": "_owner", "internalType": "address" }
|
205
|
+
],
|
206
|
+
"name": "ownerOf",
|
207
|
+
"inputs": [
|
208
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" }
|
209
|
+
]
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"type": "function",
|
213
|
+
"stateMutability": "nonpayable",
|
214
|
+
"outputs": [],
|
215
|
+
"name": "safeTransferFrom",
|
216
|
+
"inputs": [
|
217
|
+
{ "type": "address", "name": "_from", "internalType": "address" },
|
218
|
+
{ "type": "address", "name": "_to", "internalType": "address" },
|
219
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" }
|
220
|
+
]
|
221
|
+
},
|
222
|
+
{
|
223
|
+
"type": "function",
|
224
|
+
"stateMutability": "nonpayable",
|
225
|
+
"outputs": [],
|
226
|
+
"name": "safeTransferFrom",
|
227
|
+
"inputs": [
|
228
|
+
{ "type": "address", "name": "_from", "internalType": "address" },
|
229
|
+
{ "type": "address", "name": "_to", "internalType": "address" },
|
230
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" },
|
231
|
+
{ "type": "bytes", "name": "_data", "internalType": "bytes" }
|
232
|
+
]
|
233
|
+
},
|
234
|
+
{
|
235
|
+
"type": "function",
|
236
|
+
"stateMutability": "nonpayable",
|
237
|
+
"outputs": [],
|
238
|
+
"name": "setApprovalForAll",
|
239
|
+
"inputs": [
|
240
|
+
{ "type": "address", "name": "_operator", "internalType": "address" },
|
241
|
+
{ "type": "bool", "name": "_approved", "internalType": "bool" }
|
242
|
+
]
|
243
|
+
},
|
244
|
+
{
|
245
|
+
"type": "function",
|
246
|
+
"stateMutability": "view",
|
247
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
248
|
+
"name": "supportsInterface",
|
249
|
+
"inputs": [
|
250
|
+
{ "type": "bytes4", "name": "_interfaceID", "internalType": "bytes4" }
|
251
|
+
]
|
252
|
+
},
|
253
|
+
{
|
254
|
+
"type": "function",
|
255
|
+
"stateMutability": "view",
|
256
|
+
"outputs": [
|
257
|
+
{ "type": "string", "name": "_symbol", "internalType": "string" }
|
258
|
+
],
|
259
|
+
"name": "symbol",
|
260
|
+
"inputs": []
|
261
|
+
},
|
262
|
+
{
|
263
|
+
"type": "function",
|
264
|
+
"stateMutability": "view",
|
265
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
266
|
+
"name": "tokenByIndex",
|
267
|
+
"inputs": [
|
268
|
+
{ "type": "uint256", "name": "_index", "internalType": "uint256" }
|
269
|
+
]
|
270
|
+
},
|
271
|
+
{
|
272
|
+
"type": "function",
|
273
|
+
"stateMutability": "view",
|
274
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
275
|
+
"name": "tokenOfOwnerByIndex",
|
276
|
+
"inputs": [
|
277
|
+
{ "type": "address", "name": "_owner", "internalType": "address" },
|
278
|
+
{ "type": "uint256", "name": "_index", "internalType": "uint256" }
|
279
|
+
]
|
280
|
+
},
|
281
|
+
{
|
282
|
+
"type": "function",
|
283
|
+
"stateMutability": "view",
|
284
|
+
"outputs": [{ "type": "string", "name": "", "internalType": "string" }],
|
285
|
+
"name": "tokenURI",
|
286
|
+
"inputs": [
|
287
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" }
|
288
|
+
]
|
289
|
+
},
|
290
|
+
{
|
291
|
+
"type": "function",
|
292
|
+
"stateMutability": "view",
|
293
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
294
|
+
"name": "totalSupply",
|
295
|
+
"inputs": []
|
296
|
+
},
|
297
|
+
{
|
298
|
+
"type": "function",
|
299
|
+
"stateMutability": "nonpayable",
|
300
|
+
"outputs": [],
|
301
|
+
"name": "transferFrom",
|
302
|
+
"inputs": [
|
303
|
+
{ "type": "address", "name": "_from", "internalType": "address" },
|
304
|
+
{ "type": "address", "name": "_to", "internalType": "address" },
|
305
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" }
|
306
|
+
]
|
307
|
+
},
|
308
|
+
{
|
309
|
+
"type": "function",
|
310
|
+
"stateMutability": "nonpayable",
|
311
|
+
"outputs": [],
|
312
|
+
"name": "transferOwnership",
|
313
|
+
"inputs": [
|
314
|
+
{ "type": "address", "name": "_newOwner", "internalType": "address" }
|
315
|
+
]
|
316
|
+
}
|
317
|
+
]
|
@@ -0,0 +1,163 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"type": "constructor",
|
4
|
+
"stateMutability": "nonpayable",
|
5
|
+
"inputs": [
|
6
|
+
{ "type": "address", "name": "factory", "internalType": "address" }
|
7
|
+
]
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"type": "event",
|
11
|
+
"name": "Bound",
|
12
|
+
"inputs": [
|
13
|
+
{
|
14
|
+
"type": "address",
|
15
|
+
"name": "from",
|
16
|
+
"internalType": "address",
|
17
|
+
"indexed": true
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type": "address",
|
21
|
+
"name": "to",
|
22
|
+
"internalType": "address",
|
23
|
+
"indexed": true
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"anonymous": false
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"type": "event",
|
30
|
+
"name": "CollectionCreated",
|
31
|
+
"inputs": [
|
32
|
+
{
|
33
|
+
"type": "address",
|
34
|
+
"name": "at",
|
35
|
+
"internalType": "address",
|
36
|
+
"indexed": true
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"type": "uint256",
|
40
|
+
"name": "id",
|
41
|
+
"internalType": "uint256",
|
42
|
+
"indexed": false
|
43
|
+
}
|
44
|
+
],
|
45
|
+
"anonymous": false
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"type": "event",
|
49
|
+
"name": "Through",
|
50
|
+
"inputs": [
|
51
|
+
{
|
52
|
+
"type": "address",
|
53
|
+
"name": "collection",
|
54
|
+
"internalType": "address",
|
55
|
+
"indexed": true
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"type": "address",
|
59
|
+
"name": "from",
|
60
|
+
"internalType": "address",
|
61
|
+
"indexed": true
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"type": "address",
|
65
|
+
"name": "to",
|
66
|
+
"internalType": "address",
|
67
|
+
"indexed": true
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"type": "uint256",
|
71
|
+
"name": "id",
|
72
|
+
"internalType": "uint256",
|
73
|
+
"indexed": false
|
74
|
+
}
|
75
|
+
],
|
76
|
+
"anonymous": false
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"type": "function",
|
80
|
+
"stateMutability": "view",
|
81
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
82
|
+
"name": "FACTORY",
|
83
|
+
"inputs": []
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"type": "function",
|
87
|
+
"stateMutability": "view",
|
88
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
89
|
+
"name": "VERSION",
|
90
|
+
"inputs": []
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"type": "function",
|
94
|
+
"stateMutability": "nonpayable",
|
95
|
+
"outputs": [],
|
96
|
+
"name": "bind",
|
97
|
+
"inputs": [
|
98
|
+
{ "type": "address", "name": "receiver", "internalType": "address" }
|
99
|
+
]
|
100
|
+
},
|
101
|
+
{
|
102
|
+
"type": "function",
|
103
|
+
"stateMutability": "view",
|
104
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
105
|
+
"name": "bridges",
|
106
|
+
"inputs": [{ "type": "address", "name": "", "internalType": "address" }]
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"type": "function",
|
110
|
+
"stateMutability": "view",
|
111
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
112
|
+
"name": "collections",
|
113
|
+
"inputs": [{ "type": "address", "name": "", "internalType": "address" }]
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"type": "function",
|
117
|
+
"stateMutability": "view",
|
118
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
119
|
+
"name": "contracts",
|
120
|
+
"inputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }]
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"type": "function",
|
124
|
+
"stateMutability": "view",
|
125
|
+
"outputs": [
|
126
|
+
{ "type": "address", "name": "collection", "internalType": "address" },
|
127
|
+
{ "type": "uint256", "name": "id", "internalType": "uint256" }
|
128
|
+
],
|
129
|
+
"name": "mints",
|
130
|
+
"inputs": [{ "type": "address", "name": "", "internalType": "address" }]
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"type": "function",
|
134
|
+
"stateMutability": "nonpayable",
|
135
|
+
"outputs": [{ "type": "bytes4", "name": "", "internalType": "bytes4" }],
|
136
|
+
"name": "onERC721Received",
|
137
|
+
"inputs": [
|
138
|
+
{ "type": "address", "name": "", "internalType": "address" },
|
139
|
+
{ "type": "address", "name": "_from", "internalType": "address" },
|
140
|
+
{ "type": "uint256", "name": "_tokenId", "internalType": "uint256" },
|
141
|
+
{ "type": "bytes", "name": "_data", "internalType": "bytes" }
|
142
|
+
]
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"type": "function",
|
146
|
+
"stateMutability": "nonpayable",
|
147
|
+
"outputs": [],
|
148
|
+
"name": "pass",
|
149
|
+
"inputs": [
|
150
|
+
{ "type": "address", "name": "asset", "internalType": "address" }
|
151
|
+
]
|
152
|
+
},
|
153
|
+
{
|
154
|
+
"type": "function",
|
155
|
+
"stateMutability": "view",
|
156
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
157
|
+
"name": "tokens",
|
158
|
+
"inputs": [
|
159
|
+
{ "type": "address", "name": "", "internalType": "address" },
|
160
|
+
{ "type": "uint256", "name": "", "internalType": "uint256" }
|
161
|
+
]
|
162
|
+
}
|
163
|
+
]
|
@@ -0,0 +1,248 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"type": "constructor",
|
4
|
+
"stateMutability": "nonpayable",
|
5
|
+
"inputs": [
|
6
|
+
{ "type": "bytes", "name": "raw", "internalType": "bytes" },
|
7
|
+
{ "type": "uint128", "name": "pid", "internalType": "uint128" }
|
8
|
+
]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"type": "event",
|
12
|
+
"name": "AssetCreated",
|
13
|
+
"inputs": [
|
14
|
+
{
|
15
|
+
"type": "address",
|
16
|
+
"name": "at",
|
17
|
+
"internalType": "address",
|
18
|
+
"indexed": true
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"type": "uint256",
|
22
|
+
"name": "id",
|
23
|
+
"internalType": "uint256",
|
24
|
+
"indexed": false
|
25
|
+
}
|
26
|
+
],
|
27
|
+
"anonymous": false
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"type": "event",
|
31
|
+
"name": "Halted",
|
32
|
+
"inputs": [
|
33
|
+
{
|
34
|
+
"type": "bool",
|
35
|
+
"name": "state",
|
36
|
+
"internalType": "bool",
|
37
|
+
"indexed": false
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"anonymous": false
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"type": "event",
|
44
|
+
"name": "Iterated",
|
45
|
+
"inputs": [
|
46
|
+
{
|
47
|
+
"type": "uint256[4]",
|
48
|
+
"name": "from",
|
49
|
+
"internalType": "uint256[4]",
|
50
|
+
"indexed": false
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"type": "uint256[4]",
|
54
|
+
"name": "to",
|
55
|
+
"internalType": "uint256[4]",
|
56
|
+
"indexed": false
|
57
|
+
}
|
58
|
+
],
|
59
|
+
"anonymous": false
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"type": "event",
|
63
|
+
"name": "MixinEvent",
|
64
|
+
"inputs": [
|
65
|
+
{
|
66
|
+
"type": "uint64",
|
67
|
+
"name": "nonce",
|
68
|
+
"internalType": "uint64",
|
69
|
+
"indexed": true
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"type": "address",
|
73
|
+
"name": "user",
|
74
|
+
"internalType": "address",
|
75
|
+
"indexed": true
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"type": "address",
|
79
|
+
"name": "asset",
|
80
|
+
"internalType": "address",
|
81
|
+
"indexed": true
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"type": "uint256",
|
85
|
+
"name": "amount",
|
86
|
+
"internalType": "uint256",
|
87
|
+
"indexed": false
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"type": "bytes",
|
91
|
+
"name": "extra",
|
92
|
+
"internalType": "bytes",
|
93
|
+
"indexed": false
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"type": "uint64",
|
97
|
+
"name": "timestamp",
|
98
|
+
"internalType": "uint64",
|
99
|
+
"indexed": false
|
100
|
+
}
|
101
|
+
],
|
102
|
+
"anonymous": false
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"type": "event",
|
106
|
+
"name": "MixinTransaction",
|
107
|
+
"inputs": [
|
108
|
+
{
|
109
|
+
"type": "bytes",
|
110
|
+
"name": "raw",
|
111
|
+
"internalType": "bytes",
|
112
|
+
"indexed": false
|
113
|
+
}
|
114
|
+
],
|
115
|
+
"anonymous": false
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"type": "event",
|
119
|
+
"name": "UserCreated",
|
120
|
+
"inputs": [
|
121
|
+
{
|
122
|
+
"type": "address",
|
123
|
+
"name": "at",
|
124
|
+
"internalType": "address",
|
125
|
+
"indexed": true
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"type": "bytes",
|
129
|
+
"name": "members",
|
130
|
+
"internalType": "bytes",
|
131
|
+
"indexed": false
|
132
|
+
}
|
133
|
+
],
|
134
|
+
"anonymous": false
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"type": "function",
|
138
|
+
"stateMutability": "view",
|
139
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
140
|
+
"name": "GROUP",
|
141
|
+
"inputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }]
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"type": "function",
|
145
|
+
"stateMutability": "view",
|
146
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
147
|
+
"name": "HALTED",
|
148
|
+
"inputs": []
|
149
|
+
},
|
150
|
+
{
|
151
|
+
"type": "function",
|
152
|
+
"stateMutability": "view",
|
153
|
+
"outputs": [{ "type": "uint64", "name": "", "internalType": "uint64" }],
|
154
|
+
"name": "INBOUND",
|
155
|
+
"inputs": []
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"type": "function",
|
159
|
+
"stateMutability": "view",
|
160
|
+
"outputs": [{ "type": "uint64", "name": "", "internalType": "uint64" }],
|
161
|
+
"name": "OUTBOUND",
|
162
|
+
"inputs": []
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"type": "function",
|
166
|
+
"stateMutability": "view",
|
167
|
+
"outputs": [{ "type": "uint128", "name": "", "internalType": "uint128" }],
|
168
|
+
"name": "PID",
|
169
|
+
"inputs": []
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"type": "function",
|
173
|
+
"stateMutability": "view",
|
174
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
175
|
+
"name": "VERSION",
|
176
|
+
"inputs": []
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"type": "function",
|
180
|
+
"stateMutability": "view",
|
181
|
+
"outputs": [{ "type": "uint128", "name": "", "internalType": "uint128" }],
|
182
|
+
"name": "assets",
|
183
|
+
"inputs": [{ "type": "address", "name": "", "internalType": "address" }]
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"type": "function",
|
187
|
+
"stateMutability": "view",
|
188
|
+
"outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }],
|
189
|
+
"name": "balances",
|
190
|
+
"inputs": [{ "type": "uint128", "name": "", "internalType": "uint128" }]
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"type": "function",
|
194
|
+
"stateMutability": "nonpayable",
|
195
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
196
|
+
"name": "burn",
|
197
|
+
"inputs": [
|
198
|
+
{ "type": "address", "name": "user", "internalType": "address" },
|
199
|
+
{ "type": "uint256", "name": "amount", "internalType": "uint256" },
|
200
|
+
{ "type": "bytes", "name": "extra", "internalType": "bytes" }
|
201
|
+
]
|
202
|
+
},
|
203
|
+
{
|
204
|
+
"type": "function",
|
205
|
+
"stateMutability": "nonpayable",
|
206
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
207
|
+
"name": "claim",
|
208
|
+
"inputs": [
|
209
|
+
{ "type": "address", "name": "asset", "internalType": "address" },
|
210
|
+
{ "type": "uint256", "name": "amount", "internalType": "uint256" }
|
211
|
+
]
|
212
|
+
},
|
213
|
+
{
|
214
|
+
"type": "function",
|
215
|
+
"stateMutability": "view",
|
216
|
+
"outputs": [{ "type": "address", "name": "", "internalType": "address" }],
|
217
|
+
"name": "contracts",
|
218
|
+
"inputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }]
|
219
|
+
},
|
220
|
+
{
|
221
|
+
"type": "function",
|
222
|
+
"stateMutability": "nonpayable",
|
223
|
+
"outputs": [],
|
224
|
+
"name": "halt",
|
225
|
+
"inputs": [{ "type": "bytes", "name": "raw", "internalType": "bytes" }]
|
226
|
+
},
|
227
|
+
{
|
228
|
+
"type": "function",
|
229
|
+
"stateMutability": "nonpayable",
|
230
|
+
"outputs": [],
|
231
|
+
"name": "iterate",
|
232
|
+
"inputs": [{ "type": "bytes", "name": "raw", "internalType": "bytes" }]
|
233
|
+
},
|
234
|
+
{
|
235
|
+
"type": "function",
|
236
|
+
"stateMutability": "nonpayable",
|
237
|
+
"outputs": [{ "type": "bool", "name": "", "internalType": "bool" }],
|
238
|
+
"name": "mixin",
|
239
|
+
"inputs": [{ "type": "bytes", "name": "raw", "internalType": "bytes" }]
|
240
|
+
},
|
241
|
+
{
|
242
|
+
"type": "function",
|
243
|
+
"stateMutability": "view",
|
244
|
+
"outputs": [{ "type": "bytes", "name": "", "internalType": "bytes" }],
|
245
|
+
"name": "users",
|
246
|
+
"inputs": [{ "type": "address", "name": "", "internalType": "address" }]
|
247
|
+
}
|
248
|
+
]
|
data/lib/mvm/bridge.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MVM
|
4
|
+
class Bridge
|
5
|
+
attr_reader :client
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@client = MVM::Client.new 'bridge.mvm.dev'
|
9
|
+
end
|
10
|
+
|
11
|
+
def user(public_key)
|
12
|
+
path = '/users'
|
13
|
+
|
14
|
+
payload = {
|
15
|
+
public_key: public_key
|
16
|
+
}
|
17
|
+
|
18
|
+
client.post path, json: payload
|
19
|
+
end
|
20
|
+
|
21
|
+
def extra(receivers: [], threshold: 1, extra: '')
|
22
|
+
return if receivers.blank?
|
23
|
+
|
24
|
+
path = '/extra'
|
25
|
+
|
26
|
+
payload = {
|
27
|
+
receivers: receivers,
|
28
|
+
threshold: threshold,
|
29
|
+
extra: extra
|
30
|
+
}
|
31
|
+
|
32
|
+
client.post path, json: payload
|
33
|
+
end
|
34
|
+
|
35
|
+
def mirror
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/mvm/client.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MVM
|
4
|
+
class Client
|
5
|
+
SERVER_SCHEME = 'https'
|
6
|
+
|
7
|
+
attr_reader :host
|
8
|
+
|
9
|
+
def initialize(host)
|
10
|
+
@host = host
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(path, options = {})
|
14
|
+
request(:get, path, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def post(path, options = {})
|
18
|
+
request(:post, path, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def request(verb, path, options = {})
|
24
|
+
uri = uri_for path
|
25
|
+
|
26
|
+
options[:headers] ||= {}
|
27
|
+
options[:headers]['Content-Type'] ||= 'application/json'
|
28
|
+
|
29
|
+
begin
|
30
|
+
response = HTTP.timeout(connect: 5, write: 5, read: 5).request(verb, uri, options)
|
31
|
+
rescue HTTP::Error => e
|
32
|
+
raise HttpError, e.message
|
33
|
+
end
|
34
|
+
|
35
|
+
raise ResponseError, response.to_s if response.status.server_error?
|
36
|
+
return response.status.to_s unless response.status.success?
|
37
|
+
|
38
|
+
JSON.parse(response.body.to_s)
|
39
|
+
end
|
40
|
+
|
41
|
+
def uri_for(path)
|
42
|
+
uri_options = {
|
43
|
+
scheme: SERVER_SCHEME,
|
44
|
+
host: host,
|
45
|
+
path: path
|
46
|
+
}
|
47
|
+
Addressable::URI.new(uri_options)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/mvm/nft.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MVM
|
4
|
+
class Nft
|
5
|
+
RPC_URL = 'https://geth.mvm.dev'
|
6
|
+
MIRROR_ADDRESS = '0xC193486e6Bf3E8461cb8fcdF178676a5D75c066A'
|
7
|
+
|
8
|
+
attr_reader :client, :mirror
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@client = Eth::Client.create RPC_URL
|
12
|
+
@mirror = Eth::Contract.from_abi name: 'Mirror', address: MIRROR_ADDRESS, abi: File.open(File.expand_path('./abis/mirror.json', __dir__)).read
|
13
|
+
end
|
14
|
+
|
15
|
+
def collection_from_contract(address)
|
16
|
+
collection = @client.call @mirror, 'collections', address
|
17
|
+
return if collection.zero?
|
18
|
+
|
19
|
+
MixinBot::Utils::UUID.new(hex: collection.to_fs(16)).unpacked
|
20
|
+
end
|
21
|
+
|
22
|
+
def contract_from_collection(uuid)
|
23
|
+
collection = uuid.to_s.gsub('-', '').to_i(16)
|
24
|
+
contract = @client.call @mirror, 'contracts', collection
|
25
|
+
address = Eth::Address.new contract
|
26
|
+
return unless address.valid?
|
27
|
+
|
28
|
+
address.checksummed
|
29
|
+
end
|
30
|
+
|
31
|
+
def owner_of(collection_id, token_id)
|
32
|
+
address = contract_from_collection collection_id
|
33
|
+
return if address.blank? || address.to_i(16).zero?
|
34
|
+
|
35
|
+
contract = Eth::Contract.from_abi name: 'Collectible', address: address, abi: File.open(File.expand_path('./abis/erc721.json', __dir__)).read
|
36
|
+
owner = @client.call contract, 'ownerOf', token_id.to_i
|
37
|
+
address = Eth::Address.new owner
|
38
|
+
return unless address.valid?
|
39
|
+
|
40
|
+
address.checksummed
|
41
|
+
rescue IOError
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def token_of_owner_by_index(contract, owner, index)
|
46
|
+
contract = Eth::Contract.from_abi name: 'Collectible', address: contract, abi: File.open(File.expand_path('./abis/erc721.json', __dir__)).read
|
47
|
+
|
48
|
+
@client.call contract, 'tokenOfOwnerByIndex', owner, index
|
49
|
+
rescue IOError
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/mvm/scan.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MVM
|
4
|
+
class Scan
|
5
|
+
attr_reader :client
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@client = Client.new 'scan.mvm.dev'
|
9
|
+
end
|
10
|
+
|
11
|
+
def tokens(address, type: nil)
|
12
|
+
path = '/api'
|
13
|
+
r = client.get(
|
14
|
+
path,
|
15
|
+
params: {
|
16
|
+
address: address,
|
17
|
+
action: 'tokenlist',
|
18
|
+
module: 'account'
|
19
|
+
}
|
20
|
+
)['result']
|
21
|
+
|
22
|
+
r = r.filter(&->(token) { token['type'] == type }) if type.present?
|
23
|
+
|
24
|
+
r
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/mvm.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/all'
|
4
|
+
require 'http'
|
5
|
+
require 'eth'
|
6
|
+
|
7
|
+
require_relative './mvm/bridge'
|
8
|
+
require_relative './mvm/client'
|
9
|
+
require_relative './mvm/nft'
|
10
|
+
require_relative './mvm/scan'
|
11
|
+
|
12
|
+
module MVM
|
13
|
+
class Error < StandardError; end
|
14
|
+
class HttpError < Error; end
|
15
|
+
class ResponseError < Error; end
|
16
|
+
|
17
|
+
def self.bridge
|
18
|
+
@bridge ||= MVM::Bridge.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.nft
|
22
|
+
@nft ||= MVM::Nft.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.scan
|
26
|
+
@scan ||= MVM::Scan.new
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixin_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- an-lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: eth
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.5'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.5'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: faye-websocket
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,6 +317,16 @@ files:
|
|
303
317
|
- lib/mixin_bot/utils/transaction.rb
|
304
318
|
- lib/mixin_bot/utils/uuid.rb
|
305
319
|
- lib/mixin_bot/version.rb
|
320
|
+
- lib/mvm.rb
|
321
|
+
- lib/mvm/abis/bridge.json
|
322
|
+
- lib/mvm/abis/erc20.json
|
323
|
+
- lib/mvm/abis/erc721.json
|
324
|
+
- lib/mvm/abis/mirror.json
|
325
|
+
- lib/mvm/abis/registry.json
|
326
|
+
- lib/mvm/bridge.rb
|
327
|
+
- lib/mvm/client.rb
|
328
|
+
- lib/mvm/nft.rb
|
329
|
+
- lib/mvm/scan.rb
|
306
330
|
homepage: https://github.com/an-lee/mixin_bot
|
307
331
|
licenses:
|
308
332
|
- MIT
|