Hello icp community, I was trying to find the source code related to conversion of ICP tokens into cycles, since im working on a canister that takes icp tokens and those icp tokens should later be converted into cycles. I dont want to convert icp to cycle by myself and i want the process to be automated. I could not find any functions related to that in ic_cdk so if someone could tell how dfx converts ICP into cycles I would appreciate it so much.
This is the source code for dfx convert cycles
which is the dfx command to convert ICP to cycles in an ICP wallet: sdk/src/dfx/src/commands/cycles/convert.rs at ab9b342e608166502a3ab44092be8f23d1bff27d · dfinity/sdk · GitHub
3 Likes
You can find a library written in rust called mint_cycles.
The source code is also open
Find it below:
hope this helps!
1 Like