You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1971 lines
83 KiB
1971 lines
83 KiB
import { Cell, Slice, Address, Builder, beginCell, ComputeError, TupleItem, TupleReader, Dictionary, contractAddress, ContractProvider, Sender, Contract, ContractABI, TupleBuilder, DictionaryValue } from 'ton-core'; |
|
import { ContractSystem, ContractExecutor } from 'ton-emulator'; |
|
|
|
export type StateInit = { |
|
$$type: 'StateInit'; |
|
code: Cell; |
|
data: Cell; |
|
} |
|
|
|
export function storeStateInit(src: StateInit) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeRef(src.code); |
|
b_0.storeRef(src.data); |
|
}; |
|
} |
|
|
|
export function loadStateInit(slice: Slice) { |
|
let sc_0 = slice; |
|
let _code = sc_0.loadRef(); |
|
let _data = sc_0.loadRef(); |
|
return { $$type: 'StateInit' as const, code: _code, data: _data }; |
|
} |
|
|
|
function loadTupleStateInit(source: TupleReader) { |
|
let _code = source.readCell(); |
|
let _data = source.readCell(); |
|
return { $$type: 'StateInit' as const, code: _code, data: _data }; |
|
} |
|
|
|
function storeTupleStateInit(source: StateInit) { |
|
let builder = new TupleBuilder(); |
|
builder.writeCell(source.code); |
|
builder.writeCell(source.data); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserStateInit(): DictionaryValue<StateInit> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeStateInit(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadStateInit(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type Context = { |
|
$$type: 'Context'; |
|
bounced: boolean; |
|
sender: Address; |
|
value: bigint; |
|
raw: Cell; |
|
} |
|
|
|
export function storeContext(src: Context) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeBit(src.bounced); |
|
b_0.storeAddress(src.sender); |
|
b_0.storeInt(src.value, 257); |
|
b_0.storeRef(src.raw); |
|
}; |
|
} |
|
|
|
export function loadContext(slice: Slice) { |
|
let sc_0 = slice; |
|
let _bounced = sc_0.loadBit(); |
|
let _sender = sc_0.loadAddress(); |
|
let _value = sc_0.loadIntBig(257); |
|
let _raw = sc_0.loadRef(); |
|
return { $$type: 'Context' as const, bounced: _bounced, sender: _sender, value: _value, raw: _raw }; |
|
} |
|
|
|
function loadTupleContext(source: TupleReader) { |
|
let _bounced = source.readBoolean(); |
|
let _sender = source.readAddress(); |
|
let _value = source.readBigNumber(); |
|
let _raw = source.readCell(); |
|
return { $$type: 'Context' as const, bounced: _bounced, sender: _sender, value: _value, raw: _raw }; |
|
} |
|
|
|
function storeTupleContext(source: Context) { |
|
let builder = new TupleBuilder(); |
|
builder.writeBoolean(source.bounced); |
|
builder.writeAddress(source.sender); |
|
builder.writeNumber(source.value); |
|
builder.writeSlice(source.raw); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserContext(): DictionaryValue<Context> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeContext(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadContext(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type SendParameters = { |
|
$$type: 'SendParameters'; |
|
bounce: boolean; |
|
to: Address; |
|
value: bigint; |
|
mode: bigint; |
|
body: Cell | null; |
|
code: Cell | null; |
|
data: Cell | null; |
|
} |
|
|
|
export function storeSendParameters(src: SendParameters) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeBit(src.bounce); |
|
b_0.storeAddress(src.to); |
|
b_0.storeInt(src.value, 257); |
|
b_0.storeInt(src.mode, 257); |
|
if (src.body !== null && src.body !== undefined) { b_0.storeBit(true).storeRef(src.body); } else { b_0.storeBit(false); } |
|
if (src.code !== null && src.code !== undefined) { b_0.storeBit(true).storeRef(src.code); } else { b_0.storeBit(false); } |
|
if (src.data !== null && src.data !== undefined) { b_0.storeBit(true).storeRef(src.data); } else { b_0.storeBit(false); } |
|
}; |
|
} |
|
|
|
export function loadSendParameters(slice: Slice) { |
|
let sc_0 = slice; |
|
let _bounce = sc_0.loadBit(); |
|
let _to = sc_0.loadAddress(); |
|
let _value = sc_0.loadIntBig(257); |
|
let _mode = sc_0.loadIntBig(257); |
|
let _body = sc_0.loadBit() ? sc_0.loadRef() : null; |
|
let _code = sc_0.loadBit() ? sc_0.loadRef() : null; |
|
let _data = sc_0.loadBit() ? sc_0.loadRef() : null; |
|
return { $$type: 'SendParameters' as const, bounce: _bounce, to: _to, value: _value, mode: _mode, body: _body, code: _code, data: _data }; |
|
} |
|
|
|
function loadTupleSendParameters(source: TupleReader) { |
|
let _bounce = source.readBoolean(); |
|
let _to = source.readAddress(); |
|
let _value = source.readBigNumber(); |
|
let _mode = source.readBigNumber(); |
|
let _body = source.readCellOpt(); |
|
let _code = source.readCellOpt(); |
|
let _data = source.readCellOpt(); |
|
return { $$type: 'SendParameters' as const, bounce: _bounce, to: _to, value: _value, mode: _mode, body: _body, code: _code, data: _data }; |
|
} |
|
|
|
function storeTupleSendParameters(source: SendParameters) { |
|
let builder = new TupleBuilder(); |
|
builder.writeBoolean(source.bounce); |
|
builder.writeAddress(source.to); |
|
builder.writeNumber(source.value); |
|
builder.writeNumber(source.mode); |
|
builder.writeCell(source.body); |
|
builder.writeCell(source.code); |
|
builder.writeCell(source.data); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserSendParameters(): DictionaryValue<SendParameters> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeSendParameters(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadSendParameters(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type TokenTransfer = { |
|
$$type: 'TokenTransfer'; |
|
queryId: bigint; |
|
amount: bigint; |
|
destination: Address; |
|
responseDestination: Address | null; |
|
customPayload: Cell | null; |
|
forwardTonAmount: bigint; |
|
forwardPayload: Cell; |
|
} |
|
|
|
export function storeTokenTransfer(src: TokenTransfer) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(260734629, 32); |
|
b_0.storeUint(src.queryId, 64); |
|
b_0.storeCoins(src.amount); |
|
b_0.storeAddress(src.destination); |
|
b_0.storeAddress(src.responseDestination); |
|
if (src.customPayload !== null && src.customPayload !== undefined) { b_0.storeBit(true).storeRef(src.customPayload); } else { b_0.storeBit(false); } |
|
b_0.storeCoins(src.forwardTonAmount); |
|
b_0.storeBuilder(src.forwardPayload.asBuilder()); |
|
}; |
|
} |
|
|
|
export function loadTokenTransfer(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 260734629) { throw Error('Invalid prefix'); } |
|
let _queryId = sc_0.loadUintBig(64); |
|
let _amount = sc_0.loadCoins(); |
|
let _destination = sc_0.loadAddress(); |
|
let _responseDestination = sc_0.loadMaybeAddress(); |
|
let _customPayload = sc_0.loadBit() ? sc_0.loadRef() : null; |
|
let _forwardTonAmount = sc_0.loadCoins(); |
|
let _forwardPayload = sc_0.asCell(); |
|
return { $$type: 'TokenTransfer' as const, queryId: _queryId, amount: _amount, destination: _destination, responseDestination: _responseDestination, customPayload: _customPayload, forwardTonAmount: _forwardTonAmount, forwardPayload: _forwardPayload }; |
|
} |
|
|
|
function loadTupleTokenTransfer(source: TupleReader) { |
|
let _queryId = source.readBigNumber(); |
|
let _amount = source.readBigNumber(); |
|
let _destination = source.readAddress(); |
|
let _responseDestination = source.readAddressOpt(); |
|
let _customPayload = source.readCellOpt(); |
|
let _forwardTonAmount = source.readBigNumber(); |
|
let _forwardPayload = source.readCell(); |
|
return { $$type: 'TokenTransfer' as const, queryId: _queryId, amount: _amount, destination: _destination, responseDestination: _responseDestination, customPayload: _customPayload, forwardTonAmount: _forwardTonAmount, forwardPayload: _forwardPayload }; |
|
} |
|
|
|
function storeTupleTokenTransfer(source: TokenTransfer) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.queryId); |
|
builder.writeNumber(source.amount); |
|
builder.writeAddress(source.destination); |
|
builder.writeAddress(source.responseDestination); |
|
builder.writeCell(source.customPayload); |
|
builder.writeNumber(source.forwardTonAmount); |
|
builder.writeSlice(source.forwardPayload); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserTokenTransfer(): DictionaryValue<TokenTransfer> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeTokenTransfer(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadTokenTransfer(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type TokenTransferInternal = { |
|
$$type: 'TokenTransferInternal'; |
|
queryId: bigint; |
|
amount: bigint; |
|
from: Address; |
|
responseAddress: Address | null; |
|
forwardTonAmount: bigint; |
|
forwardPayload: Cell; |
|
setLinker: bigint | null; |
|
setLinkerAddress: Address | null; |
|
} |
|
|
|
export function storeTokenTransferInternal(src: TokenTransferInternal) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(395134233, 32); |
|
b_0.storeUint(src.queryId, 64); |
|
b_0.storeCoins(src.amount); |
|
b_0.storeAddress(src.from); |
|
b_0.storeAddress(src.responseAddress); |
|
b_0.storeCoins(src.forwardTonAmount); |
|
b_0.storeBuilder(src.forwardPayload.asBuilder()); |
|
let b_1 = new Builder(); |
|
if (src.setLinker !== null && src.setLinker !== undefined) { b_1.storeBit(true).storeInt(src.setLinker, 257); } else { b_1.storeBit(false); } |
|
b_1.storeAddress(src.setLinkerAddress); |
|
b_0.storeRef(b_1.endCell()); |
|
}; |
|
} |
|
|
|
export function loadTokenTransferInternal(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 395134233) { throw Error('Invalid prefix'); } |
|
let _queryId = sc_0.loadUintBig(64); |
|
let _amount = sc_0.loadCoins(); |
|
let _from = sc_0.loadAddress(); |
|
let _responseAddress = sc_0.loadMaybeAddress(); |
|
let _forwardTonAmount = sc_0.loadCoins(); |
|
let _forwardPayload = sc_0.asCell(); |
|
let sc_1 = sc_0.loadRef().beginParse(); |
|
let _setLinker = sc_1.loadBit() ? sc_1.loadIntBig(257) : null; |
|
let _setLinkerAddress = sc_1.loadMaybeAddress(); |
|
return { $$type: 'TokenTransferInternal' as const, queryId: _queryId, amount: _amount, from: _from, responseAddress: _responseAddress, forwardTonAmount: _forwardTonAmount, forwardPayload: _forwardPayload, setLinker: _setLinker, setLinkerAddress: _setLinkerAddress }; |
|
} |
|
|
|
function loadTupleTokenTransferInternal(source: TupleReader) { |
|
let _queryId = source.readBigNumber(); |
|
let _amount = source.readBigNumber(); |
|
let _from = source.readAddress(); |
|
let _responseAddress = source.readAddressOpt(); |
|
let _forwardTonAmount = source.readBigNumber(); |
|
let _forwardPayload = source.readCell(); |
|
let _setLinker = source.readBigNumberOpt(); |
|
let _setLinkerAddress = source.readAddressOpt(); |
|
return { $$type: 'TokenTransferInternal' as const, queryId: _queryId, amount: _amount, from: _from, responseAddress: _responseAddress, forwardTonAmount: _forwardTonAmount, forwardPayload: _forwardPayload, setLinker: _setLinker, setLinkerAddress: _setLinkerAddress }; |
|
} |
|
|
|
function storeTupleTokenTransferInternal(source: TokenTransferInternal) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.queryId); |
|
builder.writeNumber(source.amount); |
|
builder.writeAddress(source.from); |
|
builder.writeAddress(source.responseAddress); |
|
builder.writeNumber(source.forwardTonAmount); |
|
builder.writeSlice(source.forwardPayload); |
|
builder.writeNumber(source.setLinker); |
|
builder.writeAddress(source.setLinkerAddress); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserTokenTransferInternal(): DictionaryValue<TokenTransferInternal> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeTokenTransferInternal(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadTokenTransferInternal(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type TokenNotification = { |
|
$$type: 'TokenNotification'; |
|
queryId: bigint; |
|
amount: bigint; |
|
from: Address; |
|
forwardPayload: Cell; |
|
} |
|
|
|
export function storeTokenNotification(src: TokenNotification) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1935855772, 32); |
|
b_0.storeUint(src.queryId, 64); |
|
b_0.storeCoins(src.amount); |
|
b_0.storeAddress(src.from); |
|
b_0.storeBuilder(src.forwardPayload.asBuilder()); |
|
}; |
|
} |
|
|
|
export function loadTokenNotification(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1935855772) { throw Error('Invalid prefix'); } |
|
let _queryId = sc_0.loadUintBig(64); |
|
let _amount = sc_0.loadCoins(); |
|
let _from = sc_0.loadAddress(); |
|
let _forwardPayload = sc_0.asCell(); |
|
return { $$type: 'TokenNotification' as const, queryId: _queryId, amount: _amount, from: _from, forwardPayload: _forwardPayload }; |
|
} |
|
|
|
function loadTupleTokenNotification(source: TupleReader) { |
|
let _queryId = source.readBigNumber(); |
|
let _amount = source.readBigNumber(); |
|
let _from = source.readAddress(); |
|
let _forwardPayload = source.readCell(); |
|
return { $$type: 'TokenNotification' as const, queryId: _queryId, amount: _amount, from: _from, forwardPayload: _forwardPayload }; |
|
} |
|
|
|
function storeTupleTokenNotification(source: TokenNotification) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.queryId); |
|
builder.writeNumber(source.amount); |
|
builder.writeAddress(source.from); |
|
builder.writeSlice(source.forwardPayload); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserTokenNotification(): DictionaryValue<TokenNotification> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeTokenNotification(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadTokenNotification(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type TokenBurn = { |
|
$$type: 'TokenBurn'; |
|
queryId: bigint; |
|
amount: bigint; |
|
owner: Address; |
|
responseAddress: Address | null; |
|
} |
|
|
|
export function storeTokenBurn(src: TokenBurn) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1499400124, 32); |
|
b_0.storeUint(src.queryId, 64); |
|
b_0.storeCoins(src.amount); |
|
b_0.storeAddress(src.owner); |
|
b_0.storeAddress(src.responseAddress); |
|
}; |
|
} |
|
|
|
export function loadTokenBurn(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1499400124) { throw Error('Invalid prefix'); } |
|
let _queryId = sc_0.loadUintBig(64); |
|
let _amount = sc_0.loadCoins(); |
|
let _owner = sc_0.loadAddress(); |
|
let _responseAddress = sc_0.loadMaybeAddress(); |
|
return { $$type: 'TokenBurn' as const, queryId: _queryId, amount: _amount, owner: _owner, responseAddress: _responseAddress }; |
|
} |
|
|
|
function loadTupleTokenBurn(source: TupleReader) { |
|
let _queryId = source.readBigNumber(); |
|
let _amount = source.readBigNumber(); |
|
let _owner = source.readAddress(); |
|
let _responseAddress = source.readAddressOpt(); |
|
return { $$type: 'TokenBurn' as const, queryId: _queryId, amount: _amount, owner: _owner, responseAddress: _responseAddress }; |
|
} |
|
|
|
function storeTupleTokenBurn(source: TokenBurn) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.queryId); |
|
builder.writeNumber(source.amount); |
|
builder.writeAddress(source.owner); |
|
builder.writeAddress(source.responseAddress); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserTokenBurn(): DictionaryValue<TokenBurn> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeTokenBurn(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadTokenBurn(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type TokenBurnNotification = { |
|
$$type: 'TokenBurnNotification'; |
|
queryId: bigint; |
|
amount: bigint; |
|
owner: Address; |
|
responseAddress: Address | null; |
|
} |
|
|
|
export function storeTokenBurnNotification(src: TokenBurnNotification) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(2078119902, 32); |
|
b_0.storeUint(src.queryId, 64); |
|
b_0.storeCoins(src.amount); |
|
b_0.storeAddress(src.owner); |
|
b_0.storeAddress(src.responseAddress); |
|
}; |
|
} |
|
|
|
export function loadTokenBurnNotification(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 2078119902) { throw Error('Invalid prefix'); } |
|
let _queryId = sc_0.loadUintBig(64); |
|
let _amount = sc_0.loadCoins(); |
|
let _owner = sc_0.loadAddress(); |
|
let _responseAddress = sc_0.loadMaybeAddress(); |
|
return { $$type: 'TokenBurnNotification' as const, queryId: _queryId, amount: _amount, owner: _owner, responseAddress: _responseAddress }; |
|
} |
|
|
|
function loadTupleTokenBurnNotification(source: TupleReader) { |
|
let _queryId = source.readBigNumber(); |
|
let _amount = source.readBigNumber(); |
|
let _owner = source.readAddress(); |
|
let _responseAddress = source.readAddressOpt(); |
|
return { $$type: 'TokenBurnNotification' as const, queryId: _queryId, amount: _amount, owner: _owner, responseAddress: _responseAddress }; |
|
} |
|
|
|
function storeTupleTokenBurnNotification(source: TokenBurnNotification) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.queryId); |
|
builder.writeNumber(source.amount); |
|
builder.writeAddress(source.owner); |
|
builder.writeAddress(source.responseAddress); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserTokenBurnNotification(): DictionaryValue<TokenBurnNotification> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeTokenBurnNotification(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadTokenBurnNotification(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type TokenExcesses = { |
|
$$type: 'TokenExcesses'; |
|
queryId: bigint; |
|
} |
|
|
|
export function storeTokenExcesses(src: TokenExcesses) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(3576854235, 32); |
|
b_0.storeUint(src.queryId, 64); |
|
}; |
|
} |
|
|
|
export function loadTokenExcesses(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 3576854235) { throw Error('Invalid prefix'); } |
|
let _queryId = sc_0.loadUintBig(64); |
|
return { $$type: 'TokenExcesses' as const, queryId: _queryId }; |
|
} |
|
|
|
function loadTupleTokenExcesses(source: TupleReader) { |
|
let _queryId = source.readBigNumber(); |
|
return { $$type: 'TokenExcesses' as const, queryId: _queryId }; |
|
} |
|
|
|
function storeTupleTokenExcesses(source: TokenExcesses) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.queryId); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserTokenExcesses(): DictionaryValue<TokenExcesses> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeTokenExcesses(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadTokenExcesses(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type TokenUpdateContent = { |
|
$$type: 'TokenUpdateContent'; |
|
content: Cell | null; |
|
} |
|
|
|
export function storeTokenUpdateContent(src: TokenUpdateContent) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(201882270, 32); |
|
if (src.content !== null && src.content !== undefined) { b_0.storeBit(true).storeRef(src.content); } else { b_0.storeBit(false); } |
|
}; |
|
} |
|
|
|
export function loadTokenUpdateContent(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 201882270) { throw Error('Invalid prefix'); } |
|
let _content = sc_0.loadBit() ? sc_0.loadRef() : null; |
|
return { $$type: 'TokenUpdateContent' as const, content: _content }; |
|
} |
|
|
|
function loadTupleTokenUpdateContent(source: TupleReader) { |
|
let _content = source.readCellOpt(); |
|
return { $$type: 'TokenUpdateContent' as const, content: _content }; |
|
} |
|
|
|
function storeTupleTokenUpdateContent(source: TokenUpdateContent) { |
|
let builder = new TupleBuilder(); |
|
builder.writeCell(source.content); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserTokenUpdateContent(): DictionaryValue<TokenUpdateContent> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeTokenUpdateContent(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadTokenUpdateContent(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type StakingWithdraw = { |
|
$$type: 'StakingWithdraw'; |
|
value: bigint; |
|
} |
|
|
|
export function storeStakingWithdraw(src: StakingWithdraw) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(3665837821, 32); |
|
b_0.storeCoins(src.value); |
|
}; |
|
} |
|
|
|
export function loadStakingWithdraw(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 3665837821) { throw Error('Invalid prefix'); } |
|
let _value = sc_0.loadCoins(); |
|
return { $$type: 'StakingWithdraw' as const, value: _value }; |
|
} |
|
|
|
function loadTupleStakingWithdraw(source: TupleReader) { |
|
let _value = source.readBigNumber(); |
|
return { $$type: 'StakingWithdraw' as const, value: _value }; |
|
} |
|
|
|
function storeTupleStakingWithdraw(source: StakingWithdraw) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.value); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserStakingWithdraw(): DictionaryValue<StakingWithdraw> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeStakingWithdraw(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadStakingWithdraw(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type JettonData = { |
|
$$type: 'JettonData'; |
|
totalSupply: bigint; |
|
mintable: boolean; |
|
owner: Address; |
|
content: Cell | null; |
|
walletCode: Cell; |
|
} |
|
|
|
export function storeJettonData(src: JettonData) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeInt(src.totalSupply, 257); |
|
b_0.storeBit(src.mintable); |
|
b_0.storeAddress(src.owner); |
|
if (src.content !== null && src.content !== undefined) { b_0.storeBit(true).storeRef(src.content); } else { b_0.storeBit(false); } |
|
b_0.storeRef(src.walletCode); |
|
}; |
|
} |
|
|
|
export function loadJettonData(slice: Slice) { |
|
let sc_0 = slice; |
|
let _totalSupply = sc_0.loadIntBig(257); |
|
let _mintable = sc_0.loadBit(); |
|
let _owner = sc_0.loadAddress(); |
|
let _content = sc_0.loadBit() ? sc_0.loadRef() : null; |
|
let _walletCode = sc_0.loadRef(); |
|
return { $$type: 'JettonData' as const, totalSupply: _totalSupply, mintable: _mintable, owner: _owner, content: _content, walletCode: _walletCode }; |
|
} |
|
|
|
function loadTupleJettonData(source: TupleReader) { |
|
let _totalSupply = source.readBigNumber(); |
|
let _mintable = source.readBoolean(); |
|
let _owner = source.readAddress(); |
|
let _content = source.readCellOpt(); |
|
let _walletCode = source.readCell(); |
|
return { $$type: 'JettonData' as const, totalSupply: _totalSupply, mintable: _mintable, owner: _owner, content: _content, walletCode: _walletCode }; |
|
} |
|
|
|
function storeTupleJettonData(source: JettonData) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.totalSupply); |
|
builder.writeBoolean(source.mintable); |
|
builder.writeAddress(source.owner); |
|
builder.writeCell(source.content); |
|
builder.writeCell(source.walletCode); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserJettonData(): DictionaryValue<JettonData> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeJettonData(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadJettonData(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type JettonWalletData = { |
|
$$type: 'JettonWalletData'; |
|
balance: bigint; |
|
owner: Address; |
|
master: Address; |
|
walletCode: Cell; |
|
} |
|
|
|
export function storeJettonWalletData(src: JettonWalletData) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeInt(src.balance, 257); |
|
b_0.storeAddress(src.owner); |
|
b_0.storeAddress(src.master); |
|
b_0.storeRef(src.walletCode); |
|
}; |
|
} |
|
|
|
export function loadJettonWalletData(slice: Slice) { |
|
let sc_0 = slice; |
|
let _balance = sc_0.loadIntBig(257); |
|
let _owner = sc_0.loadAddress(); |
|
let _master = sc_0.loadAddress(); |
|
let _walletCode = sc_0.loadRef(); |
|
return { $$type: 'JettonWalletData' as const, balance: _balance, owner: _owner, master: _master, walletCode: _walletCode }; |
|
} |
|
|
|
function loadTupleJettonWalletData(source: TupleReader) { |
|
let _balance = source.readBigNumber(); |
|
let _owner = source.readAddress(); |
|
let _master = source.readAddress(); |
|
let _walletCode = source.readCell(); |
|
return { $$type: 'JettonWalletData' as const, balance: _balance, owner: _owner, master: _master, walletCode: _walletCode }; |
|
} |
|
|
|
function storeTupleJettonWalletData(source: JettonWalletData) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.balance); |
|
builder.writeAddress(source.owner); |
|
builder.writeAddress(source.master); |
|
builder.writeCell(source.walletCode); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserJettonWalletData(): DictionaryValue<JettonWalletData> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeJettonWalletData(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadJettonWalletData(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type SetLinkerNeighbor = { |
|
$$type: 'SetLinkerNeighbor'; |
|
neighbor: Address | null; |
|
} |
|
|
|
export function storeSetLinkerNeighbor(src: SetLinkerNeighbor) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(3019699393, 32); |
|
b_0.storeAddress(src.neighbor); |
|
}; |
|
} |
|
|
|
export function loadSetLinkerNeighbor(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 3019699393) { throw Error('Invalid prefix'); } |
|
let _neighbor = sc_0.loadMaybeAddress(); |
|
return { $$type: 'SetLinkerNeighbor' as const, neighbor: _neighbor }; |
|
} |
|
|
|
function loadTupleSetLinkerNeighbor(source: TupleReader) { |
|
let _neighbor = source.readAddressOpt(); |
|
return { $$type: 'SetLinkerNeighbor' as const, neighbor: _neighbor }; |
|
} |
|
|
|
function storeTupleSetLinkerNeighbor(source: SetLinkerNeighbor) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(source.neighbor); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserSetLinkerNeighbor(): DictionaryValue<SetLinkerNeighbor> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeSetLinkerNeighbor(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadSetLinkerNeighbor(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type InitLinker = { |
|
$$type: 'InitLinker'; |
|
neighbor: Address | null; |
|
walletAmount: bigint; |
|
walletCode: Cell; |
|
walletData: Cell; |
|
walletAddress: Address; |
|
responseAddress: Address | null; |
|
} |
|
|
|
export function storeInitLinker(src: InitLinker) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1740669268, 32); |
|
b_0.storeAddress(src.neighbor); |
|
b_0.storeInt(src.walletAmount, 257); |
|
b_0.storeRef(src.walletCode); |
|
b_0.storeRef(src.walletData); |
|
b_0.storeAddress(src.walletAddress); |
|
let b_1 = new Builder(); |
|
b_1.storeAddress(src.responseAddress); |
|
b_0.storeRef(b_1.endCell()); |
|
}; |
|
} |
|
|
|
export function loadInitLinker(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1740669268) { throw Error('Invalid prefix'); } |
|
let _neighbor = sc_0.loadMaybeAddress(); |
|
let _walletAmount = sc_0.loadIntBig(257); |
|
let _walletCode = sc_0.loadRef(); |
|
let _walletData = sc_0.loadRef(); |
|
let _walletAddress = sc_0.loadAddress(); |
|
let sc_1 = sc_0.loadRef().beginParse(); |
|
let _responseAddress = sc_1.loadMaybeAddress(); |
|
return { $$type: 'InitLinker' as const, neighbor: _neighbor, walletAmount: _walletAmount, walletCode: _walletCode, walletData: _walletData, walletAddress: _walletAddress, responseAddress: _responseAddress }; |
|
} |
|
|
|
function loadTupleInitLinker(source: TupleReader) { |
|
let _neighbor = source.readAddressOpt(); |
|
let _walletAmount = source.readBigNumber(); |
|
let _walletCode = source.readCell(); |
|
let _walletData = source.readCell(); |
|
let _walletAddress = source.readAddress(); |
|
let _responseAddress = source.readAddressOpt(); |
|
return { $$type: 'InitLinker' as const, neighbor: _neighbor, walletAmount: _walletAmount, walletCode: _walletCode, walletData: _walletData, walletAddress: _walletAddress, responseAddress: _responseAddress }; |
|
} |
|
|
|
function storeTupleInitLinker(source: InitLinker) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(source.neighbor); |
|
builder.writeNumber(source.walletAmount); |
|
builder.writeCell(source.walletCode); |
|
builder.writeCell(source.walletData); |
|
builder.writeAddress(source.walletAddress); |
|
builder.writeAddress(source.responseAddress); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserInitLinker(): DictionaryValue<InitLinker> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeInitLinker(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadInitLinker(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type ForwardToWallet = { |
|
$$type: 'ForwardToWallet'; |
|
body: Cell; |
|
} |
|
|
|
export function storeForwardToWallet(src: ForwardToWallet) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1562223291, 32); |
|
b_0.storeRef(src.body); |
|
}; |
|
} |
|
|
|
export function loadForwardToWallet(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1562223291) { throw Error('Invalid prefix'); } |
|
let _body = sc_0.loadRef(); |
|
return { $$type: 'ForwardToWallet' as const, body: _body }; |
|
} |
|
|
|
function loadTupleForwardToWallet(source: TupleReader) { |
|
let _body = source.readCell(); |
|
return { $$type: 'ForwardToWallet' as const, body: _body }; |
|
} |
|
|
|
function storeTupleForwardToWallet(source: ForwardToWallet) { |
|
let builder = new TupleBuilder(); |
|
builder.writeCell(source.body); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserForwardToWallet(): DictionaryValue<ForwardToWallet> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeForwardToWallet(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadForwardToWallet(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type BlacklistWallet = { |
|
$$type: 'BlacklistWallet'; |
|
wallet: Address; |
|
} |
|
|
|
export function storeBlacklistWallet(src: BlacklistWallet) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(43811734, 32); |
|
b_0.storeAddress(src.wallet); |
|
}; |
|
} |
|
|
|
export function loadBlacklistWallet(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 43811734) { throw Error('Invalid prefix'); } |
|
let _wallet = sc_0.loadAddress(); |
|
return { $$type: 'BlacklistWallet' as const, wallet: _wallet }; |
|
} |
|
|
|
function loadTupleBlacklistWallet(source: TupleReader) { |
|
let _wallet = source.readAddress(); |
|
return { $$type: 'BlacklistWallet' as const, wallet: _wallet }; |
|
} |
|
|
|
function storeTupleBlacklistWallet(source: BlacklistWallet) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(source.wallet); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserBlacklistWallet(): DictionaryValue<BlacklistWallet> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeBlacklistWallet(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadBlacklistWallet(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type InitiateBlacklistVote = { |
|
$$type: 'InitiateBlacklistVote'; |
|
adminIndex: bigint; |
|
wallet: Address; |
|
quorum_percent: bigint; |
|
vote_time: bigint; |
|
} |
|
|
|
export function storeInitiateBlacklistVote(src: InitiateBlacklistVote) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(3909090059, 32); |
|
b_0.storeInt(src.adminIndex, 257); |
|
b_0.storeAddress(src.wallet); |
|
b_0.storeInt(src.quorum_percent, 257); |
|
let b_1 = new Builder(); |
|
b_1.storeInt(src.vote_time, 257); |
|
b_0.storeRef(b_1.endCell()); |
|
}; |
|
} |
|
|
|
export function loadInitiateBlacklistVote(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 3909090059) { throw Error('Invalid prefix'); } |
|
let _adminIndex = sc_0.loadIntBig(257); |
|
let _wallet = sc_0.loadAddress(); |
|
let _quorum_percent = sc_0.loadIntBig(257); |
|
let sc_1 = sc_0.loadRef().beginParse(); |
|
let _vote_time = sc_1.loadIntBig(257); |
|
return { $$type: 'InitiateBlacklistVote' as const, adminIndex: _adminIndex, wallet: _wallet, quorum_percent: _quorum_percent, vote_time: _vote_time }; |
|
} |
|
|
|
function loadTupleInitiateBlacklistVote(source: TupleReader) { |
|
let _adminIndex = source.readBigNumber(); |
|
let _wallet = source.readAddress(); |
|
let _quorum_percent = source.readBigNumber(); |
|
let _vote_time = source.readBigNumber(); |
|
return { $$type: 'InitiateBlacklistVote' as const, adminIndex: _adminIndex, wallet: _wallet, quorum_percent: _quorum_percent, vote_time: _vote_time }; |
|
} |
|
|
|
function storeTupleInitiateBlacklistVote(source: InitiateBlacklistVote) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.adminIndex); |
|
builder.writeAddress(source.wallet); |
|
builder.writeNumber(source.quorum_percent); |
|
builder.writeNumber(source.vote_time); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserInitiateBlacklistVote(): DictionaryValue<InitiateBlacklistVote> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeInitiateBlacklistVote(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadInitiateBlacklistVote(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type InitiateLiquidationVote = { |
|
$$type: 'InitiateLiquidationVote'; |
|
adminIndex: bigint; |
|
quorum_percent: bigint; |
|
vote_time: bigint; |
|
} |
|
|
|
export function storeInitiateLiquidationVote(src: InitiateLiquidationVote) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(301696559, 32); |
|
b_0.storeInt(src.adminIndex, 257); |
|
b_0.storeInt(src.quorum_percent, 257); |
|
b_0.storeInt(src.vote_time, 257); |
|
}; |
|
} |
|
|
|
export function loadInitiateLiquidationVote(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 301696559) { throw Error('Invalid prefix'); } |
|
let _adminIndex = sc_0.loadIntBig(257); |
|
let _quorum_percent = sc_0.loadIntBig(257); |
|
let _vote_time = sc_0.loadIntBig(257); |
|
return { $$type: 'InitiateLiquidationVote' as const, adminIndex: _adminIndex, quorum_percent: _quorum_percent, vote_time: _vote_time }; |
|
} |
|
|
|
function loadTupleInitiateLiquidationVote(source: TupleReader) { |
|
let _adminIndex = source.readBigNumber(); |
|
let _quorum_percent = source.readBigNumber(); |
|
let _vote_time = source.readBigNumber(); |
|
return { $$type: 'InitiateLiquidationVote' as const, adminIndex: _adminIndex, quorum_percent: _quorum_percent, vote_time: _vote_time }; |
|
} |
|
|
|
function storeTupleInitiateLiquidationVote(source: InitiateLiquidationVote) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.adminIndex); |
|
builder.writeNumber(source.quorum_percent); |
|
builder.writeNumber(source.vote_time); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserInitiateLiquidationVote(): DictionaryValue<InitiateLiquidationVote> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeInitiateLiquidationVote(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadInitiateLiquidationVote(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type FinishVote = { |
|
$$type: 'FinishVote'; |
|
voteId: bigint; |
|
} |
|
|
|
export function storeFinishVote(src: FinishVote) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(710362179, 32); |
|
b_0.storeInt(src.voteId, 257); |
|
}; |
|
} |
|
|
|
export function loadFinishVote(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 710362179) { throw Error('Invalid prefix'); } |
|
let _voteId = sc_0.loadIntBig(257); |
|
return { $$type: 'FinishVote' as const, voteId: _voteId }; |
|
} |
|
|
|
function loadTupleFinishVote(source: TupleReader) { |
|
let _voteId = source.readBigNumber(); |
|
return { $$type: 'FinishVote' as const, voteId: _voteId }; |
|
} |
|
|
|
function storeTupleFinishVote(source: FinishVote) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.voteId); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserFinishVote(): DictionaryValue<FinishVote> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeFinishVote(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadFinishVote(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type VoteMsg = { |
|
$$type: 'VoteMsg'; |
|
voteId: bigint; |
|
adminIndex: bigint; |
|
vote: bigint; |
|
} |
|
|
|
export function storeVoteMsg(src: VoteMsg) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1493035179, 32); |
|
b_0.storeInt(src.voteId, 257); |
|
b_0.storeInt(src.adminIndex, 257); |
|
b_0.storeInt(src.vote, 257); |
|
}; |
|
} |
|
|
|
export function loadVoteMsg(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1493035179) { throw Error('Invalid prefix'); } |
|
let _voteId = sc_0.loadIntBig(257); |
|
let _adminIndex = sc_0.loadIntBig(257); |
|
let _vote = sc_0.loadIntBig(257); |
|
return { $$type: 'VoteMsg' as const, voteId: _voteId, adminIndex: _adminIndex, vote: _vote }; |
|
} |
|
|
|
function loadTupleVoteMsg(source: TupleReader) { |
|
let _voteId = source.readBigNumber(); |
|
let _adminIndex = source.readBigNumber(); |
|
let _vote = source.readBigNumber(); |
|
return { $$type: 'VoteMsg' as const, voteId: _voteId, adminIndex: _adminIndex, vote: _vote }; |
|
} |
|
|
|
function storeTupleVoteMsg(source: VoteMsg) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.voteId); |
|
builder.writeNumber(source.adminIndex); |
|
builder.writeNumber(source.vote); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserVoteMsg(): DictionaryValue<VoteMsg> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeVoteMsg(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadVoteMsg(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type AddressList = { |
|
$$type: 'AddressList'; |
|
addresses: Dictionary<bigint, Address>; |
|
length: bigint; |
|
} |
|
|
|
export function storeAddressList(src: AddressList) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeDict(src.addresses, Dictionary.Keys.BigInt(257), Dictionary.Values.Address()); |
|
b_0.storeInt(src.length, 257); |
|
}; |
|
} |
|
|
|
export function loadAddressList(slice: Slice) { |
|
let sc_0 = slice; |
|
let _addresses = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.Address(), sc_0); |
|
let _length = sc_0.loadIntBig(257); |
|
return { $$type: 'AddressList' as const, addresses: _addresses, length: _length }; |
|
} |
|
|
|
function loadTupleAddressList(source: TupleReader) { |
|
let _addresses = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.Address(), source.readCellOpt()); |
|
let _length = source.readBigNumber(); |
|
return { $$type: 'AddressList' as const, addresses: _addresses, length: _length }; |
|
} |
|
|
|
function storeTupleAddressList(source: AddressList) { |
|
let builder = new TupleBuilder(); |
|
builder.writeCell(source.addresses.size > 0 ? beginCell().storeDictDirect(source.addresses, Dictionary.Keys.BigInt(257), Dictionary.Values.Address()).endCell() : null); |
|
builder.writeNumber(source.length); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserAddressList(): DictionaryValue<AddressList> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeAddressList(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadAddressList(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type Distribution = { |
|
$$type: 'Distribution'; |
|
addresses: AddressList; |
|
percents: Dictionary<bigint, bigint>; |
|
} |
|
|
|
export function storeDistribution(src: Distribution) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.store(storeAddressList(src.addresses)); |
|
b_0.storeDict(src.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)); |
|
}; |
|
} |
|
|
|
export function loadDistribution(slice: Slice) { |
|
let sc_0 = slice; |
|
let _addresses = loadAddressList(sc_0); |
|
let _percents = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0); |
|
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents }; |
|
} |
|
|
|
function loadTupleDistribution(source: TupleReader) { |
|
const _addresses = loadTupleAddressList(source.readTuple()); |
|
let _percents = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt()); |
|
return { $$type: 'Distribution' as const, addresses: _addresses, percents: _percents }; |
|
} |
|
|
|
function storeTupleDistribution(source: Distribution) { |
|
let builder = new TupleBuilder(); |
|
builder.writeTuple(storeTupleAddressList(source.addresses)); |
|
builder.writeCell(source.percents.size > 0 ? beginCell().storeDictDirect(source.percents, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserDistribution(): DictionaryValue<Distribution> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeDistribution(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadDistribution(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type InitiateDistributionVote = { |
|
$$type: 'InitiateDistributionVote'; |
|
adminIndex: bigint; |
|
quorum_percent: bigint; |
|
vote_time: bigint; |
|
distribution: Distribution; |
|
} |
|
|
|
export function storeInitiateDistributionVote(src: InitiateDistributionVote) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(2512227654, 32); |
|
b_0.storeInt(src.adminIndex, 257); |
|
b_0.storeInt(src.quorum_percent, 257); |
|
b_0.storeInt(src.vote_time, 257); |
|
let b_1 = new Builder(); |
|
b_1.store(storeDistribution(src.distribution)); |
|
b_0.storeRef(b_1.endCell()); |
|
}; |
|
} |
|
|
|
export function loadInitiateDistributionVote(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 2512227654) { throw Error('Invalid prefix'); } |
|
let _adminIndex = sc_0.loadIntBig(257); |
|
let _quorum_percent = sc_0.loadIntBig(257); |
|
let _vote_time = sc_0.loadIntBig(257); |
|
let sc_1 = sc_0.loadRef().beginParse(); |
|
let _distribution = loadDistribution(sc_1); |
|
return { $$type: 'InitiateDistributionVote' as const, adminIndex: _adminIndex, quorum_percent: _quorum_percent, vote_time: _vote_time, distribution: _distribution }; |
|
} |
|
|
|
function loadTupleInitiateDistributionVote(source: TupleReader) { |
|
let _adminIndex = source.readBigNumber(); |
|
let _quorum_percent = source.readBigNumber(); |
|
let _vote_time = source.readBigNumber(); |
|
const _distribution = loadTupleDistribution(source.readTuple()); |
|
return { $$type: 'InitiateDistributionVote' as const, adminIndex: _adminIndex, quorum_percent: _quorum_percent, vote_time: _vote_time, distribution: _distribution }; |
|
} |
|
|
|
function storeTupleInitiateDistributionVote(source: InitiateDistributionVote) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.adminIndex); |
|
builder.writeNumber(source.quorum_percent); |
|
builder.writeNumber(source.vote_time); |
|
builder.writeTuple(storeTupleDistribution(source.distribution)); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserInitiateDistributionVote(): DictionaryValue<InitiateDistributionVote> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeInitiateDistributionVote(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadInitiateDistributionVote(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type SetStakingPool = { |
|
$$type: 'SetStakingPool'; |
|
staking_pool: Address | null; |
|
} |
|
|
|
export function storeSetStakingPool(src: SetStakingPool) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(124047688, 32); |
|
b_0.storeAddress(src.staking_pool); |
|
}; |
|
} |
|
|
|
export function loadSetStakingPool(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 124047688) { throw Error('Invalid prefix'); } |
|
let _staking_pool = sc_0.loadMaybeAddress(); |
|
return { $$type: 'SetStakingPool' as const, staking_pool: _staking_pool }; |
|
} |
|
|
|
function loadTupleSetStakingPool(source: TupleReader) { |
|
let _staking_pool = source.readAddressOpt(); |
|
return { $$type: 'SetStakingPool' as const, staking_pool: _staking_pool }; |
|
} |
|
|
|
function storeTupleSetStakingPool(source: SetStakingPool) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(source.staking_pool); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserSetStakingPool(): DictionaryValue<SetStakingPool> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeSetStakingPool(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadSetStakingPool(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type RequestLinker = { |
|
$$type: 'RequestLinker'; |
|
client: Address; |
|
} |
|
|
|
export function storeRequestLinker(src: RequestLinker) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1512653598, 32); |
|
b_0.storeAddress(src.client); |
|
}; |
|
} |
|
|
|
export function loadRequestLinker(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1512653598) { throw Error('Invalid prefix'); } |
|
let _client = sc_0.loadAddress(); |
|
return { $$type: 'RequestLinker' as const, client: _client }; |
|
} |
|
|
|
function loadTupleRequestLinker(source: TupleReader) { |
|
let _client = source.readAddress(); |
|
return { $$type: 'RequestLinker' as const, client: _client }; |
|
} |
|
|
|
function storeTupleRequestLinker(source: RequestLinker) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(source.client); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserRequestLinker(): DictionaryValue<RequestLinker> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeRequestLinker(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadRequestLinker(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type Unstake = { |
|
$$type: 'Unstake'; |
|
amount: bigint; |
|
} |
|
|
|
export function storeUnstake(src: Unstake) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(3125946401, 32); |
|
b_0.storeInt(src.amount, 257); |
|
}; |
|
} |
|
|
|
export function loadUnstake(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 3125946401) { throw Error('Invalid prefix'); } |
|
let _amount = sc_0.loadIntBig(257); |
|
return { $$type: 'Unstake' as const, amount: _amount }; |
|
} |
|
|
|
function loadTupleUnstake(source: TupleReader) { |
|
let _amount = source.readBigNumber(); |
|
return { $$type: 'Unstake' as const, amount: _amount }; |
|
} |
|
|
|
function storeTupleUnstake(source: Unstake) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.amount); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserUnstake(): DictionaryValue<Unstake> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeUnstake(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadUnstake(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type RequestUnstake = { |
|
$$type: 'RequestUnstake'; |
|
founderIndex: bigint; |
|
} |
|
|
|
export function storeRequestUnstake(src: RequestUnstake) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(3922648959, 32); |
|
b_0.storeInt(src.founderIndex, 257); |
|
}; |
|
} |
|
|
|
export function loadRequestUnstake(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 3922648959) { throw Error('Invalid prefix'); } |
|
let _founderIndex = sc_0.loadIntBig(257); |
|
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex }; |
|
} |
|
|
|
function loadTupleRequestUnstake(source: TupleReader) { |
|
let _founderIndex = source.readBigNumber(); |
|
return { $$type: 'RequestUnstake' as const, founderIndex: _founderIndex }; |
|
} |
|
|
|
function storeTupleRequestUnstake(source: RequestUnstake) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.founderIndex); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserRequestUnstake(): DictionaryValue<RequestUnstake> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeRequestUnstake(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadRequestUnstake(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type CollectProfit = { |
|
$$type: 'CollectProfit'; |
|
adminIndex: bigint; |
|
} |
|
|
|
export function storeCollectProfit(src: CollectProfit) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1368467253, 32); |
|
b_0.storeInt(src.adminIndex, 257); |
|
}; |
|
} |
|
|
|
export function loadCollectProfit(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1368467253) { throw Error('Invalid prefix'); } |
|
let _adminIndex = sc_0.loadIntBig(257); |
|
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex }; |
|
} |
|
|
|
function loadTupleCollectProfit(source: TupleReader) { |
|
let _adminIndex = source.readBigNumber(); |
|
return { $$type: 'CollectProfit' as const, adminIndex: _adminIndex }; |
|
} |
|
|
|
function storeTupleCollectProfit(source: CollectProfit) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.adminIndex); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserCollectProfit(): DictionaryValue<CollectProfit> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeCollectProfit(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadCollectProfit(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type SetOwner = { |
|
$$type: 'SetOwner'; |
|
owner: Address; |
|
} |
|
|
|
export function storeSetOwner(src: SetOwner) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(3072093686, 32); |
|
b_0.storeAddress(src.owner); |
|
}; |
|
} |
|
|
|
export function loadSetOwner(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 3072093686) { throw Error('Invalid prefix'); } |
|
let _owner = sc_0.loadAddress(); |
|
return { $$type: 'SetOwner' as const, owner: _owner }; |
|
} |
|
|
|
function loadTupleSetOwner(source: TupleReader) { |
|
let _owner = source.readAddress(); |
|
return { $$type: 'SetOwner' as const, owner: _owner }; |
|
} |
|
|
|
function storeTupleSetOwner(source: SetOwner) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(source.owner); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserSetOwner(): DictionaryValue<SetOwner> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeSetOwner(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadSetOwner(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type WithdrawalRequests = { |
|
$$type: 'WithdrawalRequests'; |
|
addresses: Dictionary<bigint, Address>; |
|
amounts: Dictionary<bigint, bigint>; |
|
n_requests: bigint; |
|
} |
|
|
|
export function storeWithdrawalRequests(src: WithdrawalRequests) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeDict(src.addresses, Dictionary.Keys.BigInt(257), Dictionary.Values.Address()); |
|
b_0.storeDict(src.amounts, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)); |
|
b_0.storeInt(src.n_requests, 257); |
|
}; |
|
} |
|
|
|
export function loadWithdrawalRequests(slice: Slice) { |
|
let sc_0 = slice; |
|
let _addresses = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.Address(), sc_0); |
|
let _amounts = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0); |
|
let _n_requests = sc_0.loadIntBig(257); |
|
return { $$type: 'WithdrawalRequests' as const, addresses: _addresses, amounts: _amounts, n_requests: _n_requests }; |
|
} |
|
|
|
function loadTupleWithdrawalRequests(source: TupleReader) { |
|
let _addresses = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.Address(), source.readCellOpt()); |
|
let _amounts = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt()); |
|
let _n_requests = source.readBigNumber(); |
|
return { $$type: 'WithdrawalRequests' as const, addresses: _addresses, amounts: _amounts, n_requests: _n_requests }; |
|
} |
|
|
|
function storeTupleWithdrawalRequests(source: WithdrawalRequests) { |
|
let builder = new TupleBuilder(); |
|
builder.writeCell(source.addresses.size > 0 ? beginCell().storeDictDirect(source.addresses, Dictionary.Keys.BigInt(257), Dictionary.Values.Address()).endCell() : null); |
|
builder.writeCell(source.amounts.size > 0 ? beginCell().storeDictDirect(source.amounts, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null); |
|
builder.writeNumber(source.n_requests); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserWithdrawalRequests(): DictionaryValue<WithdrawalRequests> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeWithdrawalRequests(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadWithdrawalRequests(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type Proposal = { |
|
$$type: 'Proposal'; |
|
type: bigint; |
|
blacklistAddress: Address | null; |
|
distribution: Distribution | null; |
|
} |
|
|
|
export function storeProposal(src: Proposal) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeInt(src.type, 257); |
|
b_0.storeAddress(src.blacklistAddress); |
|
if (src.distribution !== null && src.distribution !== undefined) { b_0.storeBit(true); b_0.store(storeDistribution(src.distribution)); } else { b_0.storeBit(false); } |
|
}; |
|
} |
|
|
|
export function loadProposal(slice: Slice) { |
|
let sc_0 = slice; |
|
let _type = sc_0.loadIntBig(257); |
|
let _blacklistAddress = sc_0.loadMaybeAddress(); |
|
let _distribution = sc_0.loadBit() ? loadDistribution(sc_0) : null; |
|
return { $$type: 'Proposal' as const, type: _type, blacklistAddress: _blacklistAddress, distribution: _distribution }; |
|
} |
|
|
|
function loadTupleProposal(source: TupleReader) { |
|
let _type = source.readBigNumber(); |
|
let _blacklistAddress = source.readAddressOpt(); |
|
const _distribution_p = source.readTupleOpt(); |
|
const _distribution = _distribution_p ? loadTupleDistribution(_distribution_p) : null; |
|
return { $$type: 'Proposal' as const, type: _type, blacklistAddress: _blacklistAddress, distribution: _distribution }; |
|
} |
|
|
|
function storeTupleProposal(source: Proposal) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.type); |
|
builder.writeAddress(source.blacklistAddress); |
|
if (source.distribution !== null && source.distribution !== undefined) { |
|
builder.writeTuple(storeTupleDistribution(source.distribution)); |
|
} else { |
|
builder.writeTuple(null); |
|
} |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserProposal(): DictionaryValue<Proposal> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeProposal(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadProposal(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type Vote = { |
|
$$type: 'Vote'; |
|
id: bigint; |
|
votes: Dictionary<bigint, bigint>; |
|
vote_end: bigint; |
|
quorum_percent: bigint; |
|
ended: boolean; |
|
result: boolean | null; |
|
} |
|
|
|
export function storeVote(src: Vote) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeInt(src.id, 257); |
|
b_0.storeDict(src.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)); |
|
b_0.storeInt(src.vote_end, 257); |
|
b_0.storeInt(src.quorum_percent, 257); |
|
b_0.storeBit(src.ended); |
|
if (src.result !== null && src.result !== undefined) { b_0.storeBit(true).storeBit(src.result); } else { b_0.storeBit(false); } |
|
}; |
|
} |
|
|
|
export function loadVote(slice: Slice) { |
|
let sc_0 = slice; |
|
let _id = sc_0.loadIntBig(257); |
|
let _votes = Dictionary.load(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), sc_0); |
|
let _vote_end = sc_0.loadIntBig(257); |
|
let _quorum_percent = sc_0.loadIntBig(257); |
|
let _ended = sc_0.loadBit(); |
|
let _result = sc_0.loadBit() ? sc_0.loadBit() : null; |
|
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result }; |
|
} |
|
|
|
function loadTupleVote(source: TupleReader) { |
|
let _id = source.readBigNumber(); |
|
let _votes = Dictionary.loadDirect(Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257), source.readCellOpt()); |
|
let _vote_end = source.readBigNumber(); |
|
let _quorum_percent = source.readBigNumber(); |
|
let _ended = source.readBoolean(); |
|
let _result = source.readBooleanOpt(); |
|
return { $$type: 'Vote' as const, id: _id, votes: _votes, vote_end: _vote_end, quorum_percent: _quorum_percent, ended: _ended, result: _result }; |
|
} |
|
|
|
function storeTupleVote(source: Vote) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.id); |
|
builder.writeCell(source.votes.size > 0 ? beginCell().storeDictDirect(source.votes, Dictionary.Keys.BigInt(257), Dictionary.Values.BigInt(257)).endCell() : null); |
|
builder.writeNumber(source.vote_end); |
|
builder.writeNumber(source.quorum_percent); |
|
builder.writeBoolean(source.ended); |
|
builder.writeBoolean(source.result); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserVote(): DictionaryValue<Vote> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeVote(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadVote(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type ChangeOwner = { |
|
$$type: 'ChangeOwner'; |
|
newOwner: Address; |
|
} |
|
|
|
export function storeChangeOwner(src: ChangeOwner) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(256331011, 32); |
|
b_0.storeAddress(src.newOwner); |
|
}; |
|
} |
|
|
|
export function loadChangeOwner(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 256331011) { throw Error('Invalid prefix'); } |
|
let _newOwner = sc_0.loadAddress(); |
|
return { $$type: 'ChangeOwner' as const, newOwner: _newOwner }; |
|
} |
|
|
|
function loadTupleChangeOwner(source: TupleReader) { |
|
let _newOwner = source.readAddress(); |
|
return { $$type: 'ChangeOwner' as const, newOwner: _newOwner }; |
|
} |
|
|
|
function storeTupleChangeOwner(source: ChangeOwner) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(source.newOwner); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserChangeOwner(): DictionaryValue<ChangeOwner> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeChangeOwner(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadChangeOwner(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type Deposit = { |
|
$$type: 'Deposit'; |
|
amount: bigint; |
|
} |
|
|
|
export function storeDeposit(src: Deposit) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(569292295, 32); |
|
b_0.storeCoins(src.amount); |
|
}; |
|
} |
|
|
|
export function loadDeposit(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 569292295) { throw Error('Invalid prefix'); } |
|
let _amount = sc_0.loadCoins(); |
|
return { $$type: 'Deposit' as const, amount: _amount }; |
|
} |
|
|
|
function loadTupleDeposit(source: TupleReader) { |
|
let _amount = source.readBigNumber(); |
|
return { $$type: 'Deposit' as const, amount: _amount }; |
|
} |
|
|
|
function storeTupleDeposit(source: Deposit) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.amount); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserDeposit(): DictionaryValue<Deposit> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeDeposit(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadDeposit(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
export type Withdraw = { |
|
$$type: 'Withdraw'; |
|
amount: bigint; |
|
} |
|
|
|
export function storeWithdraw(src: Withdraw) { |
|
return (builder: Builder) => { |
|
let b_0 = builder; |
|
b_0.storeUint(1616450832, 32); |
|
b_0.storeInt(src.amount, 257); |
|
}; |
|
} |
|
|
|
export function loadWithdraw(slice: Slice) { |
|
let sc_0 = slice; |
|
if (sc_0.loadUint(32) !== 1616450832) { throw Error('Invalid prefix'); } |
|
let _amount = sc_0.loadIntBig(257); |
|
return { $$type: 'Withdraw' as const, amount: _amount }; |
|
} |
|
|
|
function loadTupleWithdraw(source: TupleReader) { |
|
let _amount = source.readBigNumber(); |
|
return { $$type: 'Withdraw' as const, amount: _amount }; |
|
} |
|
|
|
function storeTupleWithdraw(source: Withdraw) { |
|
let builder = new TupleBuilder(); |
|
builder.writeNumber(source.amount); |
|
return builder.build(); |
|
} |
|
|
|
function dictValueParserWithdraw(): DictionaryValue<Withdraw> { |
|
return { |
|
serialize: (src, buidler) => { |
|
buidler.storeRef(beginCell().store(storeWithdraw(src)).endCell()); |
|
}, |
|
parse: (src) => { |
|
return loadWithdraw(src.loadRef().beginParse()); |
|
} |
|
} |
|
} |
|
async function TONB_init(owner: Address, content: Cell | null, staking_pool: Address | null) { |
|
const __init = 'te6ccgEBBwEAqwABFP8A9KQT9LzyyAsBAgFiAgMCAs0EBQAJoUrd4A0AAdQBN2m1tcFMAf21tIwzIzAwQSxBKEEkQOBA3EDYQNYGANJQy/oCUAnPFidus5Z/AcoAF8yWN3BQB8oA4hXKAFADIG6VMHABywGSzxbiASBulTBwAcsBks8W4gHIgQEBzwBYIG6VMHABywGSzxbiEoEBAc8AyEMTUFRQI/QA9ACBAQHPAMlYzMkBzMk='; |
|
const __code = 'te6ccgECTQEAEKgAART/APSkE/S88sgLAQIBYgIDAgLKBAUCASAZGgSp17aLt+3Ah10nCH5UwINcLH94C0NMDAXGwwAGRf5Fw4gH6QCJQZm8E+GECkVvgIIIQIe62B7rjAiDAACLXScEhsOMCIIIQYFkVELrjAiCCEAdk0Ui6gYHCAkCAnYTFAHkMO1E0NQB+GL6APpAAQHSAAGR1JJtAeLSAPpAIdcLAcMAkQGSMW3iAfpAIdcLAcMAkQGSMW3iAdQB0IEBAdcA+kAh1wsBwwCRAZIxbeIBgQEB1wDUMND0BPQEgQEB1wBVIDMQbBBrEGoQaRBoEGdYbBwMCgHiW+1E0NQB+GL6APpAAQHSAAGR1JJtAeLSAPpAIdcLAcMAkQGSMW3iAfpAIdcLAcMAkQGSMW3iAdQB0IEBAdcA+kAh1wsBwwCRAZIxbeIBgQEB1wDUMND0BPQEgQEB1wBVIDMQbBBrEGoQaRBoEGdYbBxEAeQw7UTQ1AH4YvoA+kABAdIAAZHUkm0B4tIA+kAh1wsBwwCRAZIxbeIB+kAh1wsBwwCRAZIxbeIB1AHQgQEB1wD6QCHXCwHDAJEBkjFt4gGBAQHXANQw0PQE9ASBAQHXAFUgMxBsEGsQahBpEGgQZ1hsHAwQA/6O8jDtRNDUAfhi+gD6QAEB0gABkdSSbQHi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INQB0NIAAZWBAQHXAJJtAeL6QCHXCwHDAJEBkjFt4jEQKBAnECYQJRAkECMDpDDtRNDUAfhigQEB1wD6QAEB+kABAdIA1AHQ0gABlYEBAdcAkm0B4vpAIdcLAcMAkQGSMW3iMRAmECUQJBAjbBYG2zw3ELwQqxCaEIkQeFUF2zx+doAEumwiggCvECiz8vT4QW8kgRFNUz7HBfL0UeehggD1/CHC//L0QzBSP9s8MCLCADCBPrsBggr68IC88vT4QlQglPAoXNs8f1B2cIBAbW1WEARWEQQQOkur2zwQVhA0WX18encBBNs8eAH2yHEBygFQBwHKAHABygJQBc8WUAP6AnABymgjbrMlbrOxjkx/AcoAyHABygBwAcoAJG6znX8BygAEIG7y0IBQBMyWNANwAcoA4iRus51/AcoABCBu8tCAUATMljQDcAHKAOJwAcoAAn8BygACyVjMlzMzAXABygDiIW6zeQAwnH8BygABIG7y0IABzJUxcAHKAOLJAfsAAQzIVXDbPMl7AJyCEBeNRRlQCcsfF8s/UAX6AlADzxYBIG6VMHABywGSzxbiAfoCAc8WyCJus5p/AcoAEoEBAc8AlTJwWMoA4lggbpUwcAHLAZLPFuLJAcwASnBZyHABywFzAcsBcAHLABLMzMn5AMhyAcsBcAHLABLKB8v/ydAAJGwx+gAxcdch+gAx+gAwpwOrAABs0x8BghAPin6luvLggdM/+gD6QAEB+kAh1wsBwwCRAZIxbeIB0gABkdSSbQHi+gBRZhYVFEMwAdIw7UTQ1AH4YoEBAdcA+kABAfpAAQHSANQB0NIAAZWBAQHXAJJtAeL6QCHXCwHDAJEBkjFt4jEQJhAlECQQI2wWVQWAINch0x/TPzH6ADCBNVIighAXjUUZugOCEHvdl966E7ES8vQWoAWAAIDI+EIBzFVQUFaBAQHPAFADzxYBzxbKAMgibrOafwHKABKBAQHPAJUycFjKAOJYIG6VMHABywGSzxbiyQHMye1Ui+TZeA=='; |
|
let systemCell = Cell.fromBase64(__system); |
|
let builder = new TupleBuilder(); |
|
builder.writeCell(systemCell); |
|
builder.writeAddress(owner); |
|
builder.writeCell(content); |
|
builder.writeAddress(staking_pool); |
|
let __stack = builder.build(); |
|
let codeCell = Cell.fromBoc(Buffer.from(__code, 'base64'))[0]; |
|
let initCell = Cell.fromBoc(Buffer.from(__init, 'base64'))[0]; |
|
let system = await ContractSystem.create(); |
|
let executor = await ContractExecutor.create({ code: initCell, data: new Cell() }, system); |
|
let res = await executor.get('init', __stack); |
|
if (!res.success) { throw Error(res.error); } |
|
if (res.exitCode !== 0 && res.exitCode !== 1) { |
|
if (TONB_errors[res.exitCode]) { |
|
throw new ComputeError(TONB_errors[res.exitCode].message, res.exitCode); |
|
} else { |
|
throw new ComputeError('Exit code: ' + res.exitCode, res.exitCode); |
|
} |
|
} |
|
|
|
let data = res.stack.readCell(); |
|
return { code: codeCell, data }; |
|
} |
|
|
|
const TONB_errors: { [key: number]: { message: string } } = { |
|
2: { message: `Stack undeflow` }, |
|
3: { message: `Stack overflow` }, |
|
4: { message: `Integer overflow` }, |
|
5: { message: `Integer out of expected range` }, |
|
6: { message: `Invalid opcode` }, |
|
7: { message: `Type check error` }, |
|
8: { message: `Cell overflow` }, |
|
9: { message: `Cell underflow` }, |
|
10: { message: `Dictionary error` }, |
|
13: { message: `Out of gas error` }, |
|
32: { message: `Method ID not found` }, |
|
34: { message: `Action is invalid or not supported` }, |
|
37: { message: `Not enough TON` }, |
|
38: { message: `Not enough extra-currencies` }, |
|
128: { message: `Null reference exception` }, |
|
129: { message: `Invalid serialization prefix` }, |
|
130: { message: `Invalid incoming message` }, |
|
131: { message: `Constraints error` }, |
|
132: { message: `Access denied` }, |
|
133: { message: `Contract stopped` }, |
|
134: { message: `Invalid argument` }, |
|
135: { message: `Code of a contract was not found` }, |
|
136: { message: `Invalid address` }, |
|
4429: { message: `Invalid sender` }, |
|
6384: { message: `not enough money for withdraw` }, |
|
6873: { message: `Only an admin can initiate a vote` }, |
|
13650: { message: `Invalid bounced message` }, |
|
16059: { message: `Invalid value` }, |
|
18474: { message: `only the owner can set a new owner` }, |
|
19362: { message: `Invalid quorum percent` }, |
|
29720: { message: `Invalid vote` }, |
|
29821: { message: `Voting requires at least 1 ton for the fees` }, |
|
30386: { message: `Vote already ended` }, |
|
32366: { message: `not enough money for deposit` }, |
|
34326: { message: `Vote is not finished yet` }, |
|
37444: { message: `Only a founder can request unstake` }, |
|
41207: { message: `invalid sender` }, |
|
42983: { message: `No profit to collect` }, |
|
44816: { message: `Wallet is blacklisted` }, |
|
46931: { message: `Invalid vote id` }, |
|
49606: { message: `Invalid admin index` }, |
|
53981: { message: `Only an admin can collect profit` }, |
|
56549: { message: `Only an admin can vote` }, |
|
61070: { message: `Invalid vote time` }, |
|
61265: { message: `Only the owner can trigger un-staking` }, |
|
62972: { message: `Invalid balance` }, |
|
} |
|
|
|
export class TONB implements Contract { |
|
|
|
static async init(owner: Address, content: Cell | null, staking_pool: Address | null) { |
|
return await TONB_init(owner,content,staking_pool); |
|
} |
|
|
|
static async fromInit(owner: Address, content: Cell | null, staking_pool: Address | null) { |
|
const init = await TONB_init(owner,content,staking_pool); |
|
const address = contractAddress(0, init); |
|
return new TONB(address, init); |
|
} |
|
|
|
static fromAddress(address: Address) { |
|
return new TONB(address); |
|
} |
|
|
|
readonly address: Address; |
|
readonly init?: { code: Cell, data: Cell }; |
|
readonly abi: ContractABI = { |
|
errors: TONB_errors |
|
}; |
|
|
|
private constructor(address: Address, init?: { code: Cell, data: Cell }) { |
|
this.address = address; |
|
this.init = init; |
|
} |
|
|
|
async send(provider: ContractProvider, via: Sender, args: { value: bigint, bounce?: boolean| null | undefined }, message: Deposit | null | Withdraw | SetStakingPool | SetOwner | TokenUpdateContent | TokenBurnNotification | BlacklistWallet | RequestLinker | 'Withdraw completed' | Unstake) { |
|
|
|
let body: Cell | null = null; |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'Deposit') { |
|
body = beginCell().store(storeDeposit(message)).endCell(); |
|
} |
|
if (message === null) { |
|
body = new Cell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'Withdraw') { |
|
body = beginCell().store(storeWithdraw(message)).endCell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'SetStakingPool') { |
|
body = beginCell().store(storeSetStakingPool(message)).endCell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'SetOwner') { |
|
body = beginCell().store(storeSetOwner(message)).endCell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'TokenUpdateContent') { |
|
body = beginCell().store(storeTokenUpdateContent(message)).endCell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'TokenBurnNotification') { |
|
body = beginCell().store(storeTokenBurnNotification(message)).endCell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'BlacklistWallet') { |
|
body = beginCell().store(storeBlacklistWallet(message)).endCell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'RequestLinker') { |
|
body = beginCell().store(storeRequestLinker(message)).endCell(); |
|
} |
|
if (message === 'Withdraw completed') { |
|
body = beginCell().storeUint(0, 32).storeStringTail(message).endCell(); |
|
} |
|
if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'Unstake') { |
|
body = beginCell().store(storeUnstake(message)).endCell(); |
|
} |
|
if (body === null) { throw new Error('Invalid message type'); } |
|
|
|
await provider.internal(via, { ...args, body: body }); |
|
|
|
} |
|
|
|
async getGetWalletAddress(provider: ContractProvider, owner: Address) { |
|
let builder = new TupleBuilder(); |
|
builder.writeAddress(owner); |
|
let source = (await provider.get('get_wallet_address', builder.build())).stack; |
|
let result = source.readAddress(); |
|
return result; |
|
} |
|
|
|
async getGetJettonData(provider: ContractProvider) { |
|
let builder = new TupleBuilder(); |
|
let source = (await provider.get('get_jetton_data', builder.build())).stack; |
|
const result = loadTupleJettonData(source); |
|
return result; |
|
} |
|
|
|
async getOwner(provider: ContractProvider) { |
|
let builder = new TupleBuilder(); |
|
let source = (await provider.get('owner', builder.build())).stack; |
|
let result = source.readAddress(); |
|
return result; |
|
} |
|
|
|
} |