Skip to content

Commit

Permalink
Removed jetton-wallet @interface to lower code size. Made manual seri…
Browse files Browse the repository at this point in the history
…alization separate inline function. Added inline to more functions
  • Loading branch information
Shvandre committed Nov 30, 2024
1 parent 6aa840c commit b4b8ee9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3,358 deletions.
32 changes: 18 additions & 14 deletions sources/jetton_minter.tact
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,11 @@ contract JettonMinter with OwnableTransferable, Deployable {
if (msg.include_address) {
includedAddress = msg.owner_address;
}
let body: Builder = beginCell()
.storeUint(0xd1735400, 32)
.storeUint(msg.query_id, 64)
.storeSlice(targetJettonWallet.asSlice());
if (includedAddress != null) {
let includedAddressCell: Cell = beginCell().storeSlice(includedAddress!!.asSlice()).endCell();
body = body.storeBit(true); // Maybe bit
body = body.storeRef(includedAddressCell);
} else {
body = body.storeBit(false); // Maybe bit
}
send(SendParameters{
to: sender(),
value: 0,
mode: SendRemainingValue,
body: body.endCell()
body: self.takeWalletBody(targetJettonWallet, includedAddress, msg.query_id)
});
}
receive(msg: Mint) {
Expand Down Expand Up @@ -112,12 +101,27 @@ contract JettonMinter with OwnableTransferable, Deployable {
});
}

fun getJettonWalletByOwner(jetton_wallet_owner: Address): Address {
inline fun takeWalletBody(targetJettonWallet: Address, includedAddress: Address?, query_id: Int): Cell {
let body: Builder = beginCell()
.storeUint(0xd1735400, 32)
.storeUint(query_id, 64)
.storeSlice(targetJettonWallet.asSlice());
if (includedAddress != null) {
let includedAddressCell: Cell = beginCell().storeSlice(includedAddress!!.asSlice()).endCell();
body = body.storeBit(true); // Maybe bit
body = body.storeRef(includedAddressCell);
} else {
body = body.storeBit(false); // Maybe bit
}
return body.endCell();
}

inline fun getJettonWalletByOwner(jetton_wallet_owner: Address): Address {
let jwInit: StateInit = self.getJettonWalletInit(jetton_wallet_owner);
return contractAddress(jwInit);
}

fun getJettonWalletInit(address: Address): StateInit {
inline fun getJettonWalletInit(address: Address): StateInit {
return initOf JettonWallet(address, myAddress());
}

Expand Down
1 change: 0 additions & 1 deletion sources/jetton_wallet.tact
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
asm fun myCode(): Cell { MYCODE }

@interface("org.ton.jetton.wallet")
contract JettonWallet with Ownable {
balance: Int as coins;
owner: Address;
Expand Down
Loading

0 comments on commit b4b8ee9

Please sign in to comment.