-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add The Open Network token (jetton) transfer functionality according …
…to TEP-74 (#3331)
- Loading branch information
1 parent
2ab331d
commit 67b1c29
Showing
13 changed files
with
352 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright © 2017-2023 Trust Wallet. | ||
// | ||
// This file is part of Trust. The full Trust copyright notice, including | ||
// terms governing use, modification, and redistribution, is contained in the | ||
// file LICENSE at the root of the source code distribution tree. | ||
|
||
#include "Payloads.h" | ||
|
||
|
||
namespace TW::TheOpenNetwork { | ||
|
||
const uint64_t jettonTransferOperation = 0xf8a7ea5; | ||
|
||
using TW::CommonTON::Cell; | ||
using TW::CommonTON::CellBuilder; | ||
|
||
Cell::Ref jettonTransferPayload( | ||
const Address& responseAddress, | ||
const Address& toOwner, | ||
uint64_t jettonAmount, | ||
uint64_t forwardAmount, | ||
const std::string& comment, | ||
uint64_t query_id | ||
) { | ||
CellBuilder bodyBuilder; | ||
bodyBuilder.appendU32(jettonTransferOperation); | ||
bodyBuilder.appendU64(query_id); | ||
bodyBuilder.appendU128(jettonAmount); | ||
bodyBuilder.appendAddress(toOwner.addressData); | ||
bodyBuilder.appendAddress(responseAddress.addressData); | ||
bodyBuilder.appendBitZero(); // null custom_payload | ||
bodyBuilder.appendU128(forwardAmount); | ||
bodyBuilder.appendBitZero(); // forward_payload in this slice, not separate cell | ||
if (!comment.empty()) { | ||
const auto& data = Data(comment.begin(), comment.end()); | ||
bodyBuilder.appendU32(0); | ||
bodyBuilder.appendRaw(data, static_cast<uint16_t>(data.size()) * 8); | ||
} | ||
return bodyBuilder.intoCell(); | ||
} | ||
|
||
} // namespace TW::TheOpenNetwork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright © 2017-2023 Trust Wallet. | ||
// | ||
// This file is part of Trust. The full Trust copyright notice, including | ||
// terms governing use, modification, and redistribution, is contained in the | ||
// file LICENSE at the root of the source code distribution tree. | ||
|
||
#include "Everscale/CommonTON/CellBuilder.h" | ||
|
||
#include "TheOpenNetwork/Address.h" | ||
|
||
namespace TW::TheOpenNetwork { | ||
TW::CommonTON::Cell::Ref jettonTransferPayload( | ||
const Address& responseAddress, | ||
const Address& toOwner, | ||
uint64_t jettonAmount, | ||
uint64_t forwardAmount, | ||
const std::string& comment, | ||
uint64_t query_id); | ||
} // namespace TW::TheOpenNetwork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.