Browse Source

Fixed transfer

master
Lev 2 years ago
parent
commit
e24423bd31
  1. 4
      package.json
  2. 2
      sources/output/jetton_TONB.pkg
  3. 2
      sources/output/jetton_TONB.ts
  4. BIN
      sources/output/jetton_TONBWallet.code.boc
  5. 14
      sources/output/jetton_TONBWallet.code.fc
  6. 40
      sources/output/jetton_TONBWallet.code.fif
  7. 113
      sources/output/jetton_TONBWallet.code.rev.fif
  8. 2
      sources/output/jetton_TONBWallet.md
  9. 2
      sources/output/jetton_TONBWallet.pkg
  10. 4
      sources/output/jetton_TONBWallet.ts
  11. 36
      sources/tests/__snapshots__/jetton.spec.ts.snap
  12. 34
      sources/tests/jetton.spec.ts
  13. 2
      sources/utils/interactions.ts
  14. 14
      sources/wallet.tact

4
package.json

@ -26,10 +26,10 @@
"qs": "^6.11.0",
"subcommand": "^2.1.1",
"ton": "^13.3.0",
"ton-contract-executor": "^0.6.0",
"ton-contract-executor": "^0.6.2",
"ton-core": "^0.46.0",
"ton-crypto": "^3.2.0",
"ton-emulator": "^1.2.0",
"ton-emulator": "^2.1.0",
"ton-nodejs": "^1.4.3",
"ton-tact": "^0.9.2",
"ts-jest": "^29.0.3",

2
sources/output/jetton_TONB.pkg

File diff suppressed because one or more lines are too long

2
sources/output/jetton_TONB.ts

File diff suppressed because one or more lines are too long

BIN
sources/output/jetton_TONBWallet.code.boc

Binary file not shown.

14
sources/output/jetton_TONBWallet.code.fc

@ -364,9 +364,17 @@ _ $__gen_get_get_wallet_data() method_id(97026) {
$self'linker_address = $msg'setLinkerAddress;
}
}
if ((__tact_address_neq($ctx'sender, $self'master) & __tact_address_neq($ctx'sender, $self'linker_address))) {
var ($sinit'code, $sinit'data) = $__gen_TONBWallet_init_child(__tact_context_sys, $self'master, $msg'from);
throw_unless(4429, __tact_address_eq($contractAddress(($sinit'code, $sinit'data)), $ctx'sender));
if (__tact_address_neq($ctx'sender, $self'master)) {
int $is_from_linker = false;
if ((~ null?($self'linker_address))) {
if (__tact_address_eq($ctx'sender, __tact_not_null($self'linker_address))) {
$is_from_linker = true;
}
}
if ((~ $is_from_linker)) {
var ($sinit'code, $sinit'data) = $__gen_TONBWallet_init_child(__tact_context_sys, $self'master, $msg'from);
throw_unless(4429, __tact_address_eq($contractAddress(($sinit'code, $sinit'data)), $ctx'sender));
}
}
$self'balance = ($self'balance + $msg'amount);
throw_unless(62972, ($self'balance >= 0));

40
sources/output/jetton_TONBWallet.code.fif

@ -669,20 +669,34 @@ PROGRAM{
}>
s0 s13 PUSH2
__tact_address_neq INLINECALLDICT
s1 s11 PUSH2
__tact_address_neq INLINECALLDICT
AND
IF:<{
__tact_context_sys GETGLOB
s14 s8 PUSH2
$__gen_TONBWallet_init_child CALLDICT
SWAP
4429 PUSHINT
s0 s2 XCHG
$contractAddress INLINECALLDICT
s2 PUSH
__tact_address_eq INLINECALLDICT
THROWANYIFNOT
FALSE
s11 PUSH
ISNULL
NOT
IF:<{
s11 PUSH
__tact_not_null INLINECALLDICT
s2 s(-1) PUXC
__tact_address_eq INLINECALLDICT
IF:<{
DROP
TRUE
}>
}>
NOT
IF:<{
__tact_context_sys GETGLOB
s14 s8 PUSH2
$__gen_TONBWallet_init_child CALLDICT
SWAP
4429 PUSHINT
s0 s2 XCHG
$contractAddress INLINECALLDICT
s2 PUSH
__tact_address_eq INLINECALLDICT
THROWANYIFNOT
}>
}>
s15 s8 XCPU
ADD

113
sources/output/jetton_TONBWallet.code.rev.fif

@ -905,51 +905,69 @@ SETCP0
s0 s13 PUSH2
SDEQ
NOT
s1 s11 PUSH2
SDEQ
NOT
AND
<{
2 GETGLOBVAR
s14 s8 PUSH2
38 CALLDICT
s0 s1 XCHG
4429 PUSHINT
s0 s2 XCHG
0 PUSHINT
s11 PUSH
ISNULL
NOT
<{
0 PUSHINT
ROTREV
NEWC
0 PUSHINT
s0 s1 XCHG
2 STU
3 PUSHINT
s0 s1 XCHG
2 STU
0 PUSHINT
s0 s1 XCHG
1 STU
s1 s2 XCHG
STREF
STREF
ENDC
HASHCU
NEWC
2 PUSHINT
s0 s1 XCHG
2 STU
0 PUSHINT
s11 PUSH
s0 PUSH
ISNULL
128 THROWIF
s2 s-1 PUXC
SDEQ
<{
s0 POP
-1 PUSHINT
}> PUSHCONT
IF
}> PUSHCONT
IF
NOT
<{
2 GETGLOBVAR
s14 s8 PUSH2
38 CALLDICT
s0 s1 XCHG
1 STU
s1 s2 XCHG
8 STI
256 STU
ENDC
CTOS
}> CALLREF
s2 PUSH
SDEQ
THROWANYIFNOT
4429 PUSHINT
s0 s2 XCHG
<{
0 PUSHINT
ROTREV
NEWC
0 PUSHINT
s0 s1 XCHG
2 STU
3 PUSHINT
s0 s1 XCHG
2 STU
0 PUSHINT
s0 s1 XCHG
1 STU
s1 s2 XCHG
STREF
STREF
ENDC
HASHCU
NEWC
2 PUSHINT
s0 s1 XCHG
2 STU
0 PUSHINT
s0 s1 XCHG
1 STU
s1 s2 XCHG
8 STI
256 STU
ENDC
CTOS
}> CALLREF
s2 PUSH
SDEQ
THROWANYIFNOT
}> PUSHCONT
IF
}> PUSHCONT
IF
s15 s8 XCPU
@ -1161,10 +1179,6 @@ SETCP0
s2 PUSH
0 GTINT
AND
<{
s8 POP
2DROP
}> PUSHCONT
<{
0 PUSHINT
s0 s9 XCHG
@ -1313,7 +1327,12 @@ SETCP0
s0 s1 XCHG
SENDRAWMSG
}> CALLREF
}> IFREFELSE
}> PUSHCONT
<{
s8 POP
2DROP
}> PUSHCONT
IFELSE
}> IFELSEREF
NEWC
2 GETGLOBVAR

2
sources/output/jetton_TONBWallet.md

@ -1,6 +1,6 @@
# TACT Compilation Report
Contract: TONBWallet
BOC Size: 2048 bytes
BOC Size: 2067 bytes
# Types
Total Types: 29

2
sources/output/jetton_TONBWallet.pkg

File diff suppressed because one or more lines are too long

4
sources/output/jetton_TONBWallet.ts

@ -1478,8 +1478,8 @@ function dictValueParserWithdraw(): DictionaryValue<Withdraw> {
}
async function TONBWallet_init(master: Address, owner: Address) {
const __init = 'te6ccgEBBgEAZgAB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9H9wf1MRgEBUOpnbPCcDBFCqbW3bPALI+EIBzFVQUFaBAQHPAFADzxYBzxbKAMgibrOafwHKABKBAQHPAJUycFjKAOJYIG6VMHABywGSzxbiyQHMye1UHR4ASMhVMIIQe92X3lAFyx8Tyz8B+gIBzxYBIG6VMHABywGSzxbiyQH2yHEBygFQBwHKAHABygJQBc8WUAP6AnABymgjbrMlbrOxjkx/AcoAyHABygBwAcoAJG6znX8BygAEIG7y0IBQBMyWNANwAcoA4iRus51/AcoABCBu8tCAUATMljQDcAHKAOJwAcoAAn8BygACyVjMlzMzAXABygDiIW6zHwAwnH8BygABIG7y0IABzJUxcAHKAOLJAfsAAIVXBtbXAGyMwGBVUgUFaBAQHPAFADzxYBzxbKAMgibrOafwHKABKBAQHPAJUycFjKAOJYIG6VMHABywGSzxbiyQHMyYAE1ALQ9AQwbQGBYIQBgBD0D2+h8uCHAYFghCICgBD0F8j0AMlAA/AlgBh7/YF2omhqAPwxQICA64B9IACA/SAAgOkAagDoaQAAysCAgOuASTaA8X0gEOuFgOGASIDJGLbxGIgTCBKIEggRtgttnkJABxvd6ME4LnYerpZXPY9CdhzrJUKNs0E4TusalpWyPlmRadeW/vixHME4TujwAfLZsB5P5B1ZLNZRCcABJfA/hCUxLwJjA=';
const __system = 'te6cckECJwEAB/4AAQHAAQEFoMEJAgEU/wD0pBP0vPLICwMCAWIIBAIBIAYFAHG93owTgudh6ullc9j0J2HOslQo2zQThO6xqWlbI+WZFp15b++LEcwThO6PAB8tmwHk/kHVks1lEJwBh7/YF2omhqAPwxQICA64B9IACA/SAAgOkAagDoaQAAysCAgOuASTaA8X0gEOuFgOGASIDJGLbxGIgTCBKIEggRtgttnkBwASXwP4QlMS8CYwAgLKDAkCAnELCgBNQC0PQEMG0BgWCEAYAQ9A9vofLghwGBYIQiAoAQ9BfI9ADJQAPwJYAIVXBtbXAGyMwGBVUgUFaBAQHPAFADzxYBzxbKAMgibrOafwHKABKBAQHPAJUycFjKAOJYIG6VMHABywGSzx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TP/oA+kABAfpAIdcLAcMAkQGSMW3iAdIAAZHUkm0B4voAUWYWFRRDMAHSMO1E0NQB+GKBAQHXAPpAAQH6QAEB0gDUAdDSAAGVgQEB1wCSbQHi+kAh1wsBwwCRAZIxbeIxECYQJRAkECNsFlUFgCDXIdMf0z8x+gAwgTVSIoIQF41FGboDghB73ZfeuhOxEvL0FqAFJgCAyPhCAcxVUFBWgQEBzwBQA88WAc8WygDIIm6zmn8BygASgQEBzwCVMnBYygDiWCBulTBwAcsBks8W4skBzMntVEfCpFA=';
let systemCell = Cell.fromBase64(__system);
let builder = new TupleBuilder();
builder.writeCell(systemCell);

36
sources/tests/__snapshots__/jetton.spec.ts.snap

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`jetton should deploy and deposit the wallet with the correct sum of money 1`] = `
exports[`jetton should deploy and deposit the wallet with the correct sum of money + withdraw should be working 1`] = `
[
{
"type": "deploy",
@ -13,7 +13,7 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
},
"bounce": true,
"from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P",
"to": "kQARvF2GzXY8kGo8EO2AxHCdVSVMqmP0pod9Q_GW1C8Vdi26",
"to": "kQCgC9v8VlLgcAqjnYBphuag9zsz4uNqZ5Ljp5owpkHL5t9u",
"type": "internal",
"value": 1200000000n,
},
@ -31,8 +31,8 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
"type": "cell",
},
"bounce": false,
"from": "kQARvF2GzXY8kGo8EO2AxHCdVSVMqmP0pod9Q_GW1C8Vdi26",
"to": "kQAgW4rD7L7jO9_YMVn-LKJH1Z5Ng4s_G8LfeTG6aYuA58xu",
"from": "kQCgC9v8VlLgcAqjnYBphuag9zsz4uNqZ5Ljp5owpkHL5t9u",
"to": "kQCb-hsQ8GpnGdMASvglnuSNAH_3BEqkXicdTRUxOS-Tj0bm",
"type": "internal",
"value": 11365000n,
},
@ -43,15 +43,15 @@ exports[`jetton should deploy and deposit the wallet with the correct sum of mon
"messages": [
{
"body": {
"cell": "x{178D4519000000000000000043B9ACA008002378BB0D9AEC7920D47821DB0188E13AAA4A9954C7E94D0EFA87E32DA85E2AED00023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{8000000000000000000000000000000000000000000000000000000000000000200102DC561F65F719DEFEC18ACFF165123EACF26C1C59F8DE16FBC98DD34C5C073C_}",
"cell": "x{178D4519000000000000000043B9ACA008014017B7F8ACA5C0E015473B00D30DCD41EE7667C5C6D4CF25C74F34614C8397CD00023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{80000000000000000000000000000000000000000000000000000000000000002004DFD0D887835338CE980257C12CF7246803FFB8225522F138EA68A989C97C9C7C_}",
"type": "cell",
},
"bounce": false,
"from": "kQARvF2GzXY8kGo8EO2AxHCdVSVMqmP0pod9Q_GW1C8Vdi26",
"to": "kQDw_1r97a4JZHQhzXS1TNtQoCM7KzhazVMoGfbme_ASRl9L",
"from": "kQCgC9v8VlLgcAqjnYBphuag9zsz4uNqZ5Ljp5owpkHL5t9u",
"to": "kQCz-T_vzRzdycSvptielZ5gy5UMUE4VmKnSM5wGE11g0n4O",
"type": "internal",
"value": 42293000n,
"value": 42141000n,
},
],
"type": "sent",
@ -69,7 +69,7 @@ exports[`jetton should work correctly with the staking 1`] = `
},
"bounce": true,
"from": "kQAI-3FJVc_ywSuY4vq0bYrzR7S4Och4y7bTU_i5yLOB3A6P",
"to": "kQCUp9iwvsCkm4HlN2V-yoIL2_lmaOUhJSVeIwqsTfuGOkLp",
"to": "kQCEp9Xa_tc20MxUf4bEIQaq-lmyW3q_0g6UPYenF9LQKJRX",
"type": "internal",
"value": 100200000000n,
},
@ -87,8 +87,8 @@ exports[`jetton should work correctly with the staking 1`] = `
"type": "cell",
},
"bounce": false,
"from": "kQCUp9iwvsCkm4HlN2V-yoIL2_lmaOUhJSVeIwqsTfuGOkLp",
"to": "kQDaE50R-IOeyYvl7P7cnbkEjDQMUYps7YugwTKWJoqwqOH6",
"from": "kQCEp9Xa_tc20MxUf4bEIQaq-lmyW3q_0g6UPYenF9LQKJRX",
"to": "kQDSpq8vAolKxm_t83PJHfSlhQZpwox3pIVtdk63PPZrknwN",
"type": "internal",
"value": 11365000n,
},
@ -99,15 +99,15 @@ exports[`jetton should work correctly with the staking 1`] = `
"messages": [
{
"body": {
"cell": "x{178D451900000000000000005174876E800801294FB1617D81493703CA6ECAFD950417B7F2CCD1CA424A4ABC4615589BF70C7500023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{80000000000000000000000000000000000000000000000000000000000000002006D09CE88FC41CF64C5F2F67F6E4EDC82461A0628C53676C5D060994B134558544_}",
"cell": "x{178D451900000000000000005174876E800801094FABB5FDAE6DA198A8FF0D88420D55F4B364B6F57FA41D287B0F4E2FA5A05100023EDC525573FCB04AE638BEAD1B62BCD1ED2E0E721E32EDB4D4FE2E722CE07702_}
x{8000000000000000000000000000000000000000000000000000000000000000200695357978144A56337F6F9B9E48EFA52C28334E1463BD242B6BB275B9E7B35C94_}",
"type": "cell",
},
"bounce": false,
"from": "kQCUp9iwvsCkm4HlN2V-yoIL2_lmaOUhJSVeIwqsTfuGOkLp",
"to": "kQAhe-C5pZaLYVtsvlprNC53th6GxI2qyS81QDuC2f3RZ2pl",
"from": "kQCEp9Xa_tc20MxUf4bEIQaq-lmyW3q_0g6UPYenF9LQKJRX",
"to": "kQCrkVOqKyuE6nGTEpCuoMa5bd5z7FlJRMuvxFa4BbXmckiO",
"type": "internal",
"value": 42285000n,
"value": 42133000n,
},
],
"type": "sent",
@ -120,7 +120,7 @@ exports[`jetton should work correctly with the staking 1`] = `
"type": "cell",
},
"bounce": true,
"from": "kQCUp9iwvsCkm4HlN2V-yoIL2_lmaOUhJSVeIwqsTfuGOkLp",
"from": "kQCEp9Xa_tc20MxUf4bEIQaq-lmyW3q_0g6UPYenF9LQKJRX",
"to": "kQAQUSIm_zYC9VxtmVfOeKhmjxmGLXoU3PR_y7RQR9lxXtJM",
"type": "internal",
"value": 99491421000n,

34
sources/tests/jetton.spec.ts

@ -1,6 +1,6 @@
import { toNano, Address } from "ton";
import { ContractSystem } from "ton-emulator";
import {TONB} from '../output/jetton_TONB';
import { TONB } from '../output/jetton_TONB';
import { default_content } from '../utils/config';
import { TONBWallet } from '../output/jetton_TONBWallet';
import { beginCell } from 'ton-core';
@ -9,7 +9,7 @@ import { PseudoStaking } from '../output/jetton_PseudoStaking';
describe('jetton', () => {
it('should deploy and deposit the wallet with the correct sum of money', async () => {
it('should deploy and deposit the wallet with the correct sum of money + withdraw should be working', async () => {
// Create jetton
let system = await ContractSystem.create();
@ -49,8 +49,8 @@ describe('jetton', () => {
let owner = system.treasure('owner');
let pseudostaking_contract = system.open(await PseudoStaking.fromInit());
let contract = system.open(await TONB.fromInit(owner.address, default_content, pseudostaking_contract.address));
await pseudostaking_contract.send(owner, { value: toNano('10000')}, "Deposit");
await contract.send(owner, {value: toNano('0.1')}, { $$type: "SetStakingPool", staking_pool: pseudostaking_contract.address });
await pseudostaking_contract.send(owner, { value: toNano('10000') }, "Deposit");
await contract.send(owner, { value: toNano('0.1') }, { $$type: "SetStakingPool", staking_pool: pseudostaking_contract.address });
await system.run();
let tracker = system.track(contract.address);
// Mint
@ -60,7 +60,31 @@ describe('jetton', () => {
// console.log(events)
expect(events).toMatchSnapshot();
expect((events[4] as any).messages[0].value).toBeGreaterThan(99000000000n);
});
it('should correctly work with transfers', async () => {
let system = await ContractSystem.create();
let owner = system.treasure('owner');
let contract = system.open(await TONB.fromInit(owner.address, default_content, null));
let dude = system.treasure('dude')
// Mint
await contract.send(owner, { value: toNano('100.2') }, { $$type: 'Deposit', amount: toNano('100') });
await system.run();
// let addr = Address.parse((events[4] as any).messages[0].to);
// let wallet_contract = system.contract(addr);
let wallet_contract = system.open(await TONBWallet.fromInit(contract.address, owner.address))
let wallet_contract_2 = system.open(await TONBWallet.fromInit(contract.address, dude.address))
let tracker = system.track(wallet_contract.address);
let tracker_2 = system.track(wallet_contract_2.address);
await wallet_contract.send(owner, { value: toNano("0.2") }, {
amount: toNano(10), destination: dude.address, queryId: 0n,
forwardTonAmount: 0n, $$type: 'TokenTransfer',
forwardPayload: beginCell().endCell(),
responseDestination: null, customPayload: null
});
await system.run();
expect((await wallet_contract_2.getGetWalletData()).balance).toEqual(10000000000n);
});
});

2
sources/utils/interactions.ts

@ -67,7 +67,7 @@ export async function getTONBState(tonb_content?: any) {
if (!tonb_content) {
tonb_content = default_content;
}
return await TONB.init(owner, tonb_content);
return await TONB.init(owner, tonb_content, null);
}
export async function getTONB(tonb_content?: any) {

14
sources/wallet.tact

@ -91,9 +91,17 @@ contract TONBWallet {
}
// todo: request a linker otherwise
}
if (ctx.sender != self.master && ctx.sender != self.linker_address) {
let sinit: StateInit = initOf TONBWallet(self.master, msg.from);
require(contractAddress(sinit) == ctx.sender, "Invalid sender");
if (ctx.sender != self.master/* && ctx.sender != self.linker_address*/) {
let is_from_linker: Bool = false;
if (self.linker_address != null) {
if (ctx.sender == self.linker_address!!) {
is_from_linker = true;
}
}
if (!is_from_linker) {
let sinit: StateInit = initOf TONBWallet(self.master, msg.from);
require(contractAddress(sinit) == ctx.sender, "Invalid sender");
}
}
// Update balance

Loading…
Cancel
Save