Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access TONs in Jetton contract type wallet #514

Open
akegaviar opened this issue Jul 8, 2024 · 0 comments
Open

Access TONs in Jetton contract type wallet #514

akegaviar opened this issue Jul 8, 2024 · 0 comments

Comments

@akegaviar
Copy link
Owner

hey i wrote smart contract that allow users to send TONs to smart contract address and receive my jettons,everytime i mint new jettons and burn these on my main wallet (im not sure if thats good way but i couldnt find a way to "transfer" these). TON's are on my smart contract wallet but i cant really find a way to access them, how do i do that? Do i need to somehow transfer them to different wallet after every user transaction, how can i code that? Thanks.

smart contract code: https://mystb.in/RingsVaultDiploma

Answer

If those TONs are locked in your contract you do not have any other option other than having a receiver to withdraw contract's balance. So you need to implement a new operation to withdraw desired amount of TON coins to a specific receptient.

for example:

if (op == op::withdraw()) {
		throw_unless(73, equal_slices(sender_address, admin_address));
		slice to_address = in_msg_body~load_msg_addr();
		int amount = in_msg_body~load_coins();
		
		;; send raw message to "to_address" with specified withdraw "amount"
		;; consider reserving some ton coins for storage and future fees
		
		return ();
}


Original

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant