Skip to content

Commit

Permalink
Add constant nft gas limit
Browse files Browse the repository at this point in the history
Signed-off-by: deniallugo <[email protected]>
  • Loading branch information
Deniallugo committed May 11, 2021
1 parent a0d0c6e commit 25dfcac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions contracts/contracts/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ contract Config {
/// @dev ERC20 tokens and ETH withdrawals gas limit, used only for complete withdrawals
uint256 internal constant WITHDRAWAL_GAS_LIMIT = 100000;

/// @dev NFT withdrawals gas limit, used only for complete withdrawals
uint256 internal constant WITHDRAWAL_NFT_GAS_LIMIT = 300000;

/// @dev Bytes in one chunk
uint8 internal constant CHUNK_BYTES = 10;

Expand Down
10 changes: 8 additions & 2 deletions contracts/contracts/ZkSync.sol
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,13 @@ contract ZkSync is UpgradeableMaster, Storage, Config, Events, ReentrancyGuard {
Operations.WithdrawNFT memory op = pendingWithdrawnNFTs[_tokenId];
require(op.creatorAddress != address(0), "op"); // No NFT to withdraw
NFTFactory _factory = governance.getNFTFactory(op.creatorAccountId, op.creatorAddress);
_factory.mintNFTFromZkSync(op.creatorAddress, op.receiver, op.serialId, op.contentHash, op.tokenId);
_factory.mintNFTFromZkSync{gas: WITHDRAWAL_NFT_GAS_LIMIT}(
op.creatorAddress,
op.receiver,
op.serialId,
op.contentHash,
op.tokenId
);
// Save withdrawn nfts for future deposits
withdrawnNFTs[op.tokenId] = address(_factory);
emit WithdrawalNFT(op.tokenId);
Expand Down Expand Up @@ -389,7 +395,7 @@ contract ZkSync is UpgradeableMaster, Storage, Config, Events, ReentrancyGuard {
function withdrawOrStoreNFT(Operations.WithdrawNFT memory op) internal {
NFTFactory _factory = governance.getNFTFactory(op.creatorAccountId, op.creatorAddress);
try
_factory.mintNFTFromZkSync{gas: WITHDRAWAL_GAS_LIMIT}(
_factory.mintNFTFromZkSync{gas: WITHDRAWAL_NFT_GAS_LIMIT}(
op.creatorAddress,
op.receiver,
op.serialId,
Expand Down

0 comments on commit 25dfcac

Please sign in to comment.