@@ -47,14 +47,6 @@ struct SetPausedRequest {
47
47
uint256 expiration; // unix timestamp of when the transaction should expire
48
48
}
49
49
50
- // SetDepositAllowedRequest is the payload for the setDepositAllowed() transaction.
51
- struct SetDepositAllowedRequest {
52
- address token; // token to be enabled / disabled
53
- bool allowed; // true if depsits are allowed otherwise false
54
- uint256 nonce; // used to make each transaction unique for replay prevention
55
- uint256 expiration; // unix timestamp of when the transaction should expire
56
- }
57
-
58
50
// RegisterStellarAssetRequest is the payload for the registerStellarAsset() transaction.
59
51
// The three fields define a new ERC20 token which represents the ethereum equivalent of
60
52
// a Stellar asset.
@@ -71,8 +63,6 @@ uint8 constant PAUSE_WITHDRAWALS = 1 << 1;
71
63
// bitwise flag representing the state where no withdrawals or deposits are allowed on the bridge
72
64
uint8 constant PAUSE_DEPOSITS_AND_WITHDRAWALS = PAUSE_DEPOSITS | PAUSE_WITHDRAWALS;
73
65
74
- // SET_DEPOSIT_ALLOWED is used to distinguish setDepositAllowed() signatures from signatures for other bridge functions.
75
- bytes32 constant SET_DEPOSIT_ALLOWED = keccak256 ("setDepositAllowed " );
76
66
// SET_PAUSED_ID is used to distinguish setPaused() signatures from signatures for other bridge functions.
77
67
bytes32 constant SET_PAUSED_ID = keccak256 ("setPaused " );
78
68
// REGISTER_STELLAR_ASSET_ID is used to distinguish registerStellarAsset() signatures from signatures for other bridge functions.
@@ -89,10 +79,7 @@ contract Bridge is Auth, ReentrancyGuard {
89
79
event SetPaused (uint8 value );
90
80
91
81
// to create a Bridge instance you need to provide the validator set configuration
92
- constructor (address [] memory _signers , uint8 _minThreshold ) Auth (_signers, _minThreshold) {
93
- emit SetDepositAllowed (address (0x0 ), true );
94
- depositAllowed[address (0x0 )] = true ;
95
- }
82
+ constructor (address [] memory _signers , uint8 _minThreshold ) Auth (_signers, _minThreshold) {}
96
83
97
84
// Deposit is emitted whenever ERC20 tokens (or ETH) are deposited on the bridge.
98
85
// The Deposit event initiates a Ethereum -> Stellar transfer.
@@ -123,13 +110,6 @@ contract Bridge is Auth, ReentrancyGuard {
123
110
// created by the bridge.
124
111
mapping (address => bool ) public isStellarAsset;
125
112
126
- // depositAllowed identifies whether an ERC20 token is can be deposited on
127
- // the bridge.
128
- mapping (address => bool ) public depositAllowed;
129
-
130
- // SetPaused is emitted whenever the paused state of the bridge changes
131
- event SetDepositAllowed (address token , bool allowed );
132
-
133
113
// depositERC20() deposits ERC20 tokens to the bridge and starts a ERC20 -> Stellar
134
114
// transfer. If deposits are disabled this function will fail.
135
115
function depositERC20 (
@@ -140,7 +120,6 @@ contract Bridge is Auth, ReentrancyGuard {
140
120
require ((paused & PAUSE_DEPOSITS) == 0 , "deposits are paused " );
141
121
require (amount > 0 , "deposit amount is zero " );
142
122
require (token != address (0x0 ), "invalid token address " );
143
- require (depositAllowed[token], "deposits not allowed for token " );
144
123
145
124
emit Deposit (token, msg .sender , destination, amount);
146
125
@@ -163,7 +142,6 @@ contract Bridge is Auth, ReentrancyGuard {
163
142
// depositETH() deposits ETH to the bridge and starts a ETH -> Stellar
164
143
// transfer. If deposits are disabled this function will fail.
165
144
function depositETH (uint256 destination ) external payable {
166
- require (depositAllowed[address (0 )], "eth deposits are not allowed " );
167
145
require ((paused & PAUSE_DEPOSITS) == 0 , "deposits are paused " );
168
146
require (msg .value > 0 , "deposit amount is zero " );
169
147
emit Deposit (address (0 ), msg .sender , destination, msg .value );
@@ -247,26 +225,6 @@ contract Bridge is Auth, ReentrancyGuard {
247
225
paused = request.value;
248
226
}
249
227
250
- // setDepositAllowed() will enable or disable deposits for a specific token.
251
- // setDepositAllowed() must be authorized by the bridge validators otherwise the transaction
252
- // will fail. Replay prevention is implemented by storing the request hash in the
253
- // fulfilledrequests set.
254
- function setDepositAllowed (
255
- SetDepositAllowedRequest memory request ,
256
- bytes [] calldata signatures ,
257
- uint8 [] calldata indexes
258
- ) external {
259
- bytes32 requestHash = keccak256 (abi.encode (domainSeparator, SET_DEPOSIT_ALLOWED, request));
260
- // ensure the same setPaused() transaction cannot be used more than once
261
- verifyRequest (requestHash, requestHash, request.expiration, signatures, indexes);
262
- emit SetDepositAllowed (request.token, request.allowed);
263
- if (request.allowed) {
264
- depositAllowed[request.token] = true ;
265
- } else {
266
- delete (depositAllowed[request.token]);
267
- }
268
- }
269
-
270
228
// registerStellarAsset() will creates an ERC20 token to represent a stellar asset.
271
229
// registerStellarAsset() must be authorized by the bridge validators otherwise the transaction
272
230
// will fail. Replay prevention is impemented by creating the ERC20 via the CREATE2 opcode (see
@@ -303,8 +261,6 @@ contract Bridge is Auth, ReentrancyGuard {
303
261
);
304
262
305
263
emit RegisterStellarAsset (asset);
306
- emit SetDepositAllowed (asset, true );
307
264
isStellarAsset[asset] = true ;
308
- depositAllowed[asset] = true ;
309
265
}
310
266
}
0 commit comments