GithubHelp home page GithubHelp logo

johnsonayo / sqrt_foundry_template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from optimizorclub/sqrt_foundry_template

0.0 0.0 0.0 5.13 MB

Foundry template for the Optimizor Club SQRT challenge

License: MIT License

Solidity 100.00%

sqrt_foundry_template's Introduction

Optimizor Club SQRT challenge

This repo provides a Foundry template to write solutions for the Optimizor Club SQRT challenge.

In the SQRT problem your contract is given an array of Fixed18 numbers, and it must return the square root of each number with an error margin of 10^-5. The challenge contract can be found at 0x2747096ff9e0fce877cd168dcd5de16040a4ab85.

The interface that your solution contract must have can be represented by the Solidity interface below. Function sqrt will be called by the challenge contract when you make a challenge.

interface ISqrt {
    function sqrt(Fixed18[INPUT_SIZE] calldata) external view returns (Fixed18[INPUT_SIZE] memory);
}

You only need to modify contract MySolution in MySolution.sol with your code, or of write write one from scratch in your preferred language. The tests will run the challenge against your contract on multiple random seeds.

Test

Since your solution must not have the metadata hash that solc adds to the bytecode, we need to use a pre-release of solc 0.8.18 and use the option cbor_metadata = false which you can see in foundry.toml.

To test only your solution:

$ forge test --use ./bin/solc

To test the full workflow including commit and challenge against the mainnet contracts:

$ forge test --use ./bin/solc --rpc-url $RPC_URL

sqrt_foundry_template's People

Contributors

leonardoalt avatar nicobevilacqua avatar hrkrshnn avatar

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.