Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
/ warp Public archive

Warp - Bringing Solidity to Starknet at warp speed. Warp is a Solidity to Cairo Compiler, this allows teams to write/migrate Solidity to Cairo for easy onboarding into the StarkNet ecosystem.

License

Notifications You must be signed in to change notification settings

NethermindEth/warp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warp

📢 Warp is no longer maintained. Feel free to fork it. You can start developing warp by checking supported features and issues. Development instructions are here.

Warp brings Solidity to Starknet, making it possible to transpile Ethereum smart contracts to Starknet Cairo Contracts.

⚠️ Note: Cairo 1 is not fully supported yet. For more details see supported features.

⚠️ Note: Cairo 0 implementation of warp can be found at this tag.

Quickstart

Note: Executing Warp using Docker works only for x86 architecture. If you're using ARM architecture (such as Apple's M1) you can find warp installation instructions here.

Note: The method refers to warp for cairo 0. If you are looking for cairo 1 warp see installing from source. You might be also interested in supported features in cairo 1 warp.

The easiest way to start with warp is using docker. To do that navigate to the directory where you store your contracts and run command:

docker run --rm -v "$PWD:/dapp" nethermind/warp transpile <contract-path>

You can find docker installation guide here.

Quick links

Libraries


Libraries are bundled into the point of use, therefore if you try transpile a standalone library it will result in no output. If you would like to transpile and deploy a standalone library please alter its declaration to `contract`.

Supported features

Solidity: Warp supports Solidity 0.8. In order to support newer versions nethersolc has to be updated, and nethersolc binaries within warp repository have to be updated.

Cairo: The latest version of Cairo compiler supported by warp is 1.1. You can find compiler binaries together with warp plugin executable in cairo1 directory. Warp plugin repository is located here.

Warp doesn't support all features of Cairo 1 yet. You can find an example contract supported by warp in tests/behaviour/contracts/if/localVariables.sol:

contract WARP {
function ifNoElse(bool choice) pure public returns (uint8 a) {
uint8 x = 2;
if (choice) {
x = 1;
}
return x;
}
function ifWithElse(bool choice) pure public returns (uint8 a) {
uint8 x = 2;
if (choice) {
x = 1;
} else {
x= 3;
}
return x;
}
}

For more fully working examples see here. Uncommented lines are Solidity files that are passing tests. Those files are located in tests/behaviour/contracts/. There is also a list of compilation tests here. It contains contracts that are partially working ie. they are compiling, but the code might not yield correct results in runtime.

You can find a list of missing features here. Feel free to pick one of those and implement it yourself!