NethermindEth / warp

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.
https://nethermind.io/warp/
Apache License 2.0
754 stars 70 forks source link

Plugin Integration #1036

Closed rodrigo-pino closed 1 year ago

rodrigo-pino commented 1 year ago

This PR accomplish the following tasks:

  1. Add the warp binary. A an "enhanced" version of Scarb which features the parsing of custom implicits.
  2. Since warp is based on Scarb, warplib and the way files were transpiled were adapted to work the same way as Scarb
  3. warp uses Alpha7 release so this PR serves as an update from Alpha6 as well.

Example of an annotated cairo contract:

#[contract]
mod ContractUsesImplicit {
    use warplib::memory::WarpMemory;
    use warplib::memory::WarpMemoryTrait;
    use warplib::memory::WarpMemoryImpl;

    #[implicit(warp_memory: WarpMemory)]
    fn call_to_insert(value: felt252) {
        insert_to_warp_memory(value);
    }

    #[implicit(warp_memory: WarpMemory)]
    fn insert_to_warp_memory(value: felt252) {
        warp_memory.append(value);
    }
}

Result after expanding the implict attribute:

#[contract]
mod ContractUsesImplicit {
    use warplib::memory::WarpMemory;
    use warplib::memory::WarpMemoryTrait;
    use warplib::memory::WarpMemoryImpl;

    fn call_to_insert(ref warp_memory: WarpMemory, value: felt252) {
        insert_to_warp_memory(ref warp_memory, value);
    }
    fn insert_to_warp_memory(ref warp_memory: WarpMemory, value: felt252) {
        warp_memory.append(value);
    }
}