Skip to content

Commit f9920bf

Browse files
author
sidhujag
committed
use 3 week cancel not 1.5
1 parent ec2d7b9 commit f9920bf

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

contracts/token/SyscoinERC20Manager.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ contract SyscoinERC20Manager is Initializable {
1313
uint private constant SUPERBLOCK_SUBMITTER_LOCK_FEE = 10000; // 10000 = 0.01%
1414
uint private constant MIN_CANCEL_DEPOSIT = 3000000000000000000; // 3 eth
1515
uint private constant CANCEL_TRANSFER_TIMEOUT = 3600; // 1 hour in seconds
16-
uint private constant CANCEL_MINT_TIMEOUT = 907200; // 1.5 weeks in seconds
16+
uint private constant CANCEL_MINT_TIMEOUT = 1814400; // 3 weeks in seconds
1717
// Variables set by constructor
1818

1919
// Contract to trust for tx included in a syscoin block verification.
@@ -163,9 +163,9 @@ contract SyscoinERC20Manager is Initializable {
163163
// ensure msg.sender is same as tokenFreezerAddress
164164
// we don't have to do this but we do it anyway so someone can't accidentily cancel a transfer they did not make
165165
require(msg.sender == bridgeTransfer.tokenFreezerAddress, "#SyscoinERC20Manager cancelTransferRequest(): Only msg.sender is allowed to cancel");
166-
// if freezeBurnERC20 was called less than 1.5 weeks ago then return error
167-
// 0.5 week buffer since only 1 week of blocks are allowed to pass before cannot mint on sys
168-
require((block.timestamp - bridgeTransfer.timestamp) > (net == Network.MAINNET? CANCEL_MINT_TIMEOUT: 36000), "#SyscoinERC20Manager cancelTransferRequest(): Transfer must be at least 1.5 week old");
166+
// if freezeBurnERC20 was called less than 3 weeks ago then return error
167+
// 0.5 week buffer since only 2.5 week of blocks are allowed to pass before cannot mint on sys
168+
require((block.timestamp - bridgeTransfer.timestamp) > CANCEL_MINT_TIMEOUT, "#SyscoinERC20Manager cancelTransferRequest(): Transfer must be at least 3 week old");
169169
// ensure min deposit paid
170170
require(msg.value >= MIN_CANCEL_DEPOSIT,
171171
"#SyscoinERC20Manager cancelTransferRequest(): Cancel deposit incorrect");

test/superblocks.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/testSyscoinERC20Manager.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ contract('SyscoinERC20Manager', function(accounts) {
143143
let wrongBridgeTransferId = 299;
144144
let erc20ManagerForCancel, erc20AssetCancel;
145145
let bridgetransferid;
146-
const CANCEL_MINT_TIMEOUT = 907200; // 1.5 weeks in seconds
146+
const CANCEL_MINT_TIMEOUT = 1814400; // 3 weeks in seconds
147147
const CANCEL_TRANSFER_TIMEOUT = 3600; // 1 hour in seconds
148148

149149
beforeEach("Prepare env", async () => {
@@ -189,12 +189,12 @@ contract('SyscoinERC20Manager', function(accounts) {
189189
it("Freeze is not old enough", async () => {
190190
await expectRevert(
191191
erc20ManagerForCancel.methods.cancelTransferRequest(bridgetransferid).send({from: cancelAddress}),
192-
"#SyscoinERC20Manager cancelTransferRequest(): Transfer must be at least 1.5 week old"
192+
"#SyscoinERC20Manager cancelTransferRequest(): Transfer must be at least 3 week old"
193193
);
194194
});
195195

196196
it("Cancel deposit is not enough", async () => {
197-
// travel in time 1.5 weeks forward
197+
// travel in time 3 weeks forward
198198
await blockchainTimeoutSeconds(CANCEL_MINT_TIMEOUT);
199199
await expectRevert(
200200
erc20ManagerForCancel.methods.cancelTransferRequest(bridgetransferid).send({from: cancelAddress}),
@@ -204,7 +204,7 @@ contract('SyscoinERC20Manager', function(accounts) {
204204
})
205205

206206
it("should process cancel request succesfully", async () => {
207-
// travel in time 1.5 weeks forward
207+
// travel in time 3 weeks forward
208208
await blockchainTimeoutSeconds(CANCEL_MINT_TIMEOUT);
209209
let tx = await erc20ManagerForCancel.methods.cancelTransferRequest(bridgetransferid).send({from: cancelAddress, value: web3.utils.toWei('3', 'ether')});
210210
assert.equal(cancelAddress, tx.events.CancelTransferRequest.returnValues.canceller, "msg.sender incorrect");
@@ -233,7 +233,7 @@ contract('SyscoinERC20Manager', function(accounts) {
233233
let startingErc20Bal = await erc20AssetCancel.balanceOf(cancelAddress);
234234
let startingAssetGUIDBal = await erc20ManagerForCancel.methods.assetBalances(assetGUID).call();
235235

236-
// travel in time 1.5 weeks forward
236+
// travel in time 3 weeks forward
237237
await blockchainTimeoutSeconds(CANCEL_MINT_TIMEOUT);
238238
await erc20ManagerForCancel.methods.cancelTransferRequest(bridgetransferid).send({from: cancelAddress, value: web3.utils.toWei('3', 'ether')});
239239

@@ -285,7 +285,7 @@ contract('SyscoinERC20Manager', function(accounts) {
285285
})
286286

287287
it("should processCancelTransferFail succesfully", async () => {
288-
// travel in time 1.5 weeks forward
288+
// travel in time 3 weeks forward
289289
await blockchainTimeoutSeconds(CANCEL_MINT_TIMEOUT);
290290
await erc20ManagerForCancel.methods.cancelTransferRequest(bridgetransferid).send({from: cancelAddress, value: web3.utils.toWei('3', 'ether')});
291291

0 commit comments

Comments
 (0)