Skip to content

Solution for the Optimizoor club's sqrt challenge

License

Notifications You must be signed in to change notification settings

kadenzipfel/op-club-sqrt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimizor Club SQRT challenge

This repo contains my solution to 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 adhere to is below. The sqrt function will be called by the challenge contract when you call its challenge function.

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

Test

This solution is written in Huff, so you will need huffc installed to compile it.

Note In order to use the huff compiler within foundry tests / scripts, FFI must be enabled. If you'd like to read into what this repo uses FFI for before running anything, see foundry-huff and huff-rs.

To test locally:

$ LOCAL=true forge test

About

Solution for the Optimizoor club's sqrt challenge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 100.0%