Comments (2)
Hey, I was looking for "good first issues" as I'm looking for a new job and bumped into this issue.
Full disclosure, I have NO experience with Cairo but I used chatGPT to generate this based on the solidity code and the Babylonian method. Your project seems cool and I just wanted to help.
Also, here's my LinkedIn in case you have something that fits my skills
// Define the sqrt function using the Babylonian method
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
// Initialize z to y
z = y;
// Divide y by 2 and add 1 to get the first estimate, x
uint x = y / 2 + 1;
// Iterate until convergence
while (x < z) {
// Set z = x
z = x;
// Calculate the next estimate, x
x = (y / x + x) / 2;
}
} else if (y != 0) {
// If y <= 3, set z = 1
z = 1;
}
// Create a new Cairo context for drawing
cairo_t* cr = cairo_create(surface);
// Draw the square root symbol using Cairo
cairo_move_to(cr, 0, 0);
cairo_line_to(cr, 10, 10);
cairo_line_to(cr, 20, 0);
cairo_stroke(cr);
// Clean up the Cairo context
cairo_destroy(cr);
}
from instaswap.
It's great. Can you rewrite it in cairo1 and add tests fot it? @mehrdadmms
from instaswap.
Related Issues (14)
- Readme
- add fee mechanism for add_liquidity and remove_liquidity function
- add test for add_liquidity method
- add test for remove_liquidity method
- add test for buy_tokens method
- add test for sell_tokens method
- feat: scaffold SDK interface
- refactor instaswap_pair.cairo with loop
- Scaffold
- Add SPECIFICATIONS
- implement factory part for amm
- Add test for get_currency_amount_when_buy and get_currency_amount_when_sell functions
- emit event when functions call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instaswap.