Skip to content

Commit 92b7b6a

Browse files
feat: add swap icy webhook
1 parent 9fa782f commit 92b7b6a

34 files changed

+2478
-28
lines changed

codebase.md

+2-2
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- +migrate Up
2+
CREATE TABLE icy_swap_btc_requests (
3+
id uuid PRIMARY KEY DEFAULT (uuid()),
4+
profile_id varchar(255) NOT NULL,
5+
request_code varchar(255) NOT NULL,
6+
tx_status varchar(255),
7+
tx_id int,
8+
btc_address varchar(255),
9+
timestamp integer,
10+
amount varchar(255),
11+
token_name varchar(255),
12+
token_id varchar(255),
13+
swap_request_status varchar(255),
14+
revert_status varchar(255),
15+
tx_swap text
16+
);
17+
18+
-- +migrate Down
19+
DROP TABLE icy_swap_btc_requests;

pkg/config/config.go

+20-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type Config struct {
2929
Mochi Mochi
3030
MochiPay MochiPay
3131
MochiProfile MochiProfile
32+
IcyBackend IcyBackend
3233
Tono Tono
3334
ImprovMX ImprovMX
3435
CommunityNft CommunityNft
@@ -118,13 +119,22 @@ type Mochi struct {
118119
}
119120

120121
type MochiPay struct {
121-
BaseURL string
122+
BaseURL string
123+
ApplicationName string
124+
ApplicationPrivateKey string
125+
ApplicationId string
126+
ApplicationVaultId string
122127
}
123128

124129
type MochiProfile struct {
125130
BaseURL string
126131
}
127132

133+
type IcyBackend struct {
134+
BaseURL string
135+
PrivateKey string
136+
}
137+
128138
type Tono struct {
129139
BaseURL string
130140
}
@@ -325,11 +335,19 @@ func Generate(v ENV) *Config {
325335
APIKey: v.GetString("MOCHI_API_KEY"),
326336
},
327337
MochiPay: MochiPay{
328-
BaseURL: v.GetString("MOCHI_PAY_BASE_URL"),
338+
BaseURL: v.GetString("MOCHI_PAY_BASE_URL"),
339+
ApplicationName: v.GetString("MOCHI_PAY_APPLICATION_NAME"),
340+
ApplicationPrivateKey: v.GetString("MOCHI_PAY_APPLICATION_PRIVATE_KEY"),
341+
ApplicationId: v.GetString("MOCHI_PAY_APPLICATION_ID"),
342+
ApplicationVaultId: v.GetString("MOCHI_PAY_APPLICATION_VAULT_ID"),
329343
},
330344
MochiProfile: MochiProfile{
331345
BaseURL: v.GetString("MOCHI_PROFILE_BASE_URL"),
332346
},
347+
IcyBackend: IcyBackend{
348+
BaseURL: v.GetString("ICY_BACKEND_BASE_URL"),
349+
PrivateKey: v.GetString("ICY_BACKEND_PRIVATE_KEY"),
350+
},
333351
Tono: Tono{
334352
BaseURL: v.GetString("TONO_BASE_URL"),
335353
},

pkg/contracts/erc20/erc20.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/contracts/erc721/erc721.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+249
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
[
2+
{
3+
"inputs": [
4+
{ "internalType": "address", "name": "_icy", "type": "address" }
5+
],
6+
"stateMutability": "nonpayable",
7+
"type": "constructor"
8+
},
9+
{
10+
"anonymous": false,
11+
"inputs": [
12+
{
13+
"indexed": true,
14+
"internalType": "address",
15+
"name": "user",
16+
"type": "address"
17+
},
18+
{
19+
"indexed": true,
20+
"internalType": "address",
21+
"name": "newOwner",
22+
"type": "address"
23+
}
24+
],
25+
"name": "OwnershipTransferred",
26+
"type": "event"
27+
},
28+
{
29+
"anonymous": false,
30+
"inputs": [
31+
{
32+
"indexed": false,
33+
"internalType": "uint256",
34+
"name": "icyAmount",
35+
"type": "uint256"
36+
},
37+
{
38+
"indexed": false,
39+
"internalType": "string",
40+
"name": "btcAddress",
41+
"type": "string"
42+
},
43+
{
44+
"indexed": false,
45+
"internalType": "uint256",
46+
"name": "btcAmount",
47+
"type": "uint256"
48+
}
49+
],
50+
"name": "RevertIcy",
51+
"type": "event"
52+
},
53+
{
54+
"anonymous": false,
55+
"inputs": [
56+
{
57+
"indexed": false,
58+
"internalType": "address",
59+
"name": "signerAddress",
60+
"type": "address"
61+
}
62+
],
63+
"name": "SetSigner",
64+
"type": "event"
65+
},
66+
{
67+
"anonymous": false,
68+
"inputs": [
69+
{
70+
"indexed": false,
71+
"internalType": "uint256",
72+
"name": "icyAmount",
73+
"type": "uint256"
74+
},
75+
{
76+
"indexed": false,
77+
"internalType": "string",
78+
"name": "btcAddress",
79+
"type": "string"
80+
},
81+
{
82+
"indexed": false,
83+
"internalType": "uint256",
84+
"name": "btcAmount",
85+
"type": "uint256"
86+
}
87+
],
88+
"name": "Swap",
89+
"type": "event"
90+
},
91+
{ "stateMutability": "nonpayable", "type": "fallback" },
92+
{
93+
"inputs": [],
94+
"name": "REVERT_ICY_HASH",
95+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
96+
"stateMutability": "view",
97+
"type": "function"
98+
},
99+
{
100+
"inputs": [],
101+
"name": "SWAP_HASH",
102+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
103+
"stateMutability": "view",
104+
"type": "function"
105+
},
106+
{
107+
"inputs": [],
108+
"name": "eip712Domain",
109+
"outputs": [
110+
{ "internalType": "bytes1", "name": "fields", "type": "bytes1" },
111+
{ "internalType": "string", "name": "name", "type": "string" },
112+
{ "internalType": "string", "name": "version", "type": "string" },
113+
{ "internalType": "uint256", "name": "chainId", "type": "uint256" },
114+
{
115+
"internalType": "address",
116+
"name": "verifyingContract",
117+
"type": "address"
118+
},
119+
{ "internalType": "bytes32", "name": "salt", "type": "bytes32" },
120+
{ "internalType": "uint256[]", "name": "extensions", "type": "uint256[]" }
121+
],
122+
"stateMutability": "view",
123+
"type": "function"
124+
},
125+
{
126+
"inputs": [
127+
{ "internalType": "uint256", "name": "icyAmount", "type": "uint256" },
128+
{ "internalType": "string", "name": "btcAddress", "type": "string" },
129+
{ "internalType": "uint256", "name": "btcAmount", "type": "uint256" },
130+
{ "internalType": "uint256", "name": "nonce", "type": "uint256" },
131+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
132+
],
133+
"name": "getRevertIcyHash",
134+
"outputs": [
135+
{ "internalType": "bytes32", "name": "hash", "type": "bytes32" }
136+
],
137+
"stateMutability": "view",
138+
"type": "function"
139+
},
140+
{
141+
"inputs": [
142+
{ "internalType": "bytes32", "name": "_digest", "type": "bytes32" },
143+
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
144+
],
145+
"name": "getSigner",
146+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
147+
"stateMutability": "view",
148+
"type": "function"
149+
},
150+
{
151+
"inputs": [
152+
{ "internalType": "uint256", "name": "icyAmount", "type": "uint256" },
153+
{ "internalType": "string", "name": "btcAddress", "type": "string" },
154+
{ "internalType": "uint256", "name": "btcAmount", "type": "uint256" },
155+
{ "internalType": "uint256", "name": "nonce", "type": "uint256" },
156+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" }
157+
],
158+
"name": "getSwapHash",
159+
"outputs": [
160+
{ "internalType": "bytes32", "name": "hash", "type": "bytes32" }
161+
],
162+
"stateMutability": "view",
163+
"type": "function"
164+
},
165+
{
166+
"inputs": [],
167+
"name": "icy",
168+
"outputs": [
169+
{ "internalType": "contract ERC20", "name": "", "type": "address" }
170+
],
171+
"stateMutability": "view",
172+
"type": "function"
173+
},
174+
{
175+
"inputs": [],
176+
"name": "owner",
177+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
178+
"stateMutability": "view",
179+
"type": "function"
180+
},
181+
{
182+
"inputs": [
183+
{ "internalType": "uint256", "name": "icyAmount", "type": "uint256" },
184+
{ "internalType": "string", "name": "btcAddress", "type": "string" },
185+
{ "internalType": "uint256", "name": "btcAmount", "type": "uint256" },
186+
{ "internalType": "uint256", "name": "nonce", "type": "uint256" },
187+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
188+
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
189+
],
190+
"name": "revertIcy",
191+
"outputs": [],
192+
"stateMutability": "nonpayable",
193+
"type": "function"
194+
},
195+
{
196+
"inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
197+
"name": "revertedIcyHashes",
198+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
199+
"stateMutability": "view",
200+
"type": "function"
201+
},
202+
{
203+
"inputs": [
204+
{ "internalType": "address", "name": "_signerAddress", "type": "address" }
205+
],
206+
"name": "setSigner",
207+
"outputs": [],
208+
"stateMutability": "nonpayable",
209+
"type": "function"
210+
},
211+
{
212+
"inputs": [],
213+
"name": "signerAddress",
214+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
215+
"stateMutability": "view",
216+
"type": "function"
217+
},
218+
{
219+
"inputs": [
220+
{ "internalType": "uint256", "name": "icyAmount", "type": "uint256" },
221+
{ "internalType": "string", "name": "btcAddress", "type": "string" },
222+
{ "internalType": "uint256", "name": "btcAmount", "type": "uint256" },
223+
{ "internalType": "uint256", "name": "nonce", "type": "uint256" },
224+
{ "internalType": "uint256", "name": "deadline", "type": "uint256" },
225+
{ "internalType": "bytes", "name": "_signature", "type": "bytes" }
226+
],
227+
"name": "swap",
228+
"outputs": [],
229+
"stateMutability": "nonpayable",
230+
"type": "function"
231+
},
232+
{
233+
"inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
234+
"name": "swappedHashes",
235+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
236+
"stateMutability": "view",
237+
"type": "function"
238+
},
239+
{
240+
"inputs": [
241+
{ "internalType": "address", "name": "newOwner", "type": "address" }
242+
],
243+
"name": "transferOwnership",
244+
"outputs": [],
245+
"stateMutability": "nonpayable",
246+
"type": "function"
247+
},
248+
{ "stateMutability": "payable", "type": "receive" }
249+
]

0 commit comments

Comments
 (0)