Giter Site home page Giter Site logo

foundry-yul's Introduction

Anurag's GitHub stats

foundry-yul's People

Contributors

codeforcer avatar flyq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

foundry-yul's Issues

Cannot deploy yul (test failure)

If I clone the repo and run forge test -vvv, I get the following error:

ERROR forge::runner: setUp failed reason="YulDeployer could not deploy contract" contract=0x7fa9385be102ac3eac297483dd6233d62b3e1496

Digging into it and attempting to log the compiled bytecode, it appears that the bytecode is correct (0x6009600b5f3960095ff3fe5f35608052366080f3), but the create function returns an error. I'm uncertain as to why that's the case.

Any insight would be helpful.

Yul with external function testing?

Hi,
First of all, thanks for the useful repo!
I am new to Yul and Yul testing and playing with your example code to understand how to test with Yul.
Getting the following error while I want to test an eternal function.

Compiler run failed
error[9582]: TypeError: Member "uri" not found or not visible after argument-dependent lookup in contract Example.
  --> test/Example.t.sol:19:9:
   |
19 |         exampleContract.uri(1);

Probably it doesn't find uri function but I don't know how to make the call uri function.

Here are the code

// Example.yul
object "Example" {
  code {
    datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
    return(0, datasize("Runtime"))
  }
  object "Runtime" {
    // Return the calldata
    code {
      mstore(0x80, calldataload(0))
      return(0x80, calldatasize())

      switch getSelector()
      case 0x0e89341c /* uri(uint256 id) */ {
        mstore(0, 0x0a)
        return(0, 0x40)
      }

      function getSelector() -> selector {
        selector := div(calldataload(0), 0x100000000000000000000000000000000000000000000000000000000)
      }
    }
  }
}

And the test file (Check the testUri)

// Example.t.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "forge-std/Test.sol";
import "./lib/YulDeployer.sol";

interface Example {}

contract ExampleTest is Test {
    YulDeployer yulDeployer = new YulDeployer();

    Example exampleContract;

    function setUp() public {
        exampleContract = Example(yulDeployer.deployContract("Example"));
    }

    function testUri() public {
        exampleContract.uri(1);
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.