NEWTON
Asked
3 months ago
26
views
0
When I try to transpile my contract using warp transpiler I get an error: JavaScript heap out of memory
can anyone help?
update: I ran this command
export NODE_OPTIONS=--max-old-space-size=4096
before transpiling still show the same error
I'm transpiling llampay contracts : https://github.com/LlamaPay/llamapay/tree/master/contracts
The original LlamaPay has some unsupported features in Warp. And I fixed them:
Newton
asked
3 months ago
0
Accepted answer
Hi, the probable cause of this error appears to be the JavaScript engine and not Warp.
Here are some links that can help you fix it:
Found the case of the error. getLlamaPayContractByIndex
is a static array of size one billion π± . I think Warp is not ready for those numbers yet, also the way we currently handle storage as memory is somehow inneficient because we are "simulating" the evm in StarkNet. Also the constant was the one giving an error. Specifically when you do type(LlamaPay)
Bug fix: use a lower size storage var, or make it a dynamic array in the `LlamaPayFactory".
The fixed contract (works now)
//SPDX-License-Identifier: None
pragma solidity ^0.8.0;
import {LlamaPay} from "./LlamaPay.sol";
import {IERC20} from "./IERC20.sol";
contract LlamaPaxyFactory {
uint256 public getLlamaPayContractCount;
address[] public getLlamaPayContractByIndex;
event LlamaPayCreated(address token, address llamaPay);
function createLlamaPayContract(address _token) external returns (address llamaPayContract) {
llamaPayContract = address(new LlamaPay());
require(llamaPayContract != address(0));
getLlamaPayContractByIndex[getLlamaPayContractCount] = llamaPayContract;
unchecked{
++getLlamaPayContractCount;
}
emit LlamaPayCreated(_token, llamaPayContract);
}
}
Newton
answered
3 months ago
How to transpile multiple contracts at once using warp?
How to install Nethermind's Solidity to Cairo transpiler without an error "command not found: warp"?
What do I have as the result of a Cairo contract in JavaScript?
What is the technical difference of Kakarot compare to Nethermind's Warp?
why does keccak256 replace sha256 in warp?
Is there a javascript version of StarkEx playground?
How do I transform data from javascript to Cairo?
Hey, is there anyway to debug Cairo contracts in hardhat environment? Something like hardhat console in solidity
How to use multicall with protostar 0.9.0?
How to select the network my Pathfinder node runs on?
The only way to invoke a contract is using migrations (this applies for both devnet and testnet?)
How to write a struct in storage?
How do I connect my DAPP to a private Starknet network using starknetjs?
Error compiling Pathfinder (rust)