forked from EmelyanenkoK/Multisig
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
4,731 additions
and
296 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
WALLET_MNEMONIC= | ||
WALLET_VERSION=v3r2 |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
import {toNano} from '@ton/core'; | ||
import {compile, NetworkProvider} from '@ton/blueprint'; | ||
import {Librarian} from "../wrappers/Librarian"; | ||
|
||
export async function run(provider: NetworkProvider) { | ||
const order_code_raw = await compile('Order'); | ||
|
||
// deploy lib | ||
|
||
const librarian_code = await compile('Librarian'); | ||
const librarian = provider.open(Librarian.createFromConfig({code: order_code_raw}, librarian_code)); | ||
await librarian.sendDeploy(provider.sender(), toNano("10")); | ||
} |
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 |
---|---|---|
@@ -1,54 +1,20 @@ | ||
import { toNano, Address, beginCell } from 'ton-core'; | ||
import { Multisig } from '../wrappers/Multisig'; | ||
import { Order } from '../wrappers/Order'; | ||
import { compile, NetworkProvider, sleep } from '@ton/blueprint'; | ||
import { Librarian } from '../wrappers/Librarian'; | ||
|
||
|
||
const waitForTransaction = async (provider:NetworkProvider, address:Address, | ||
action:string = "transaction", | ||
curTxLt:string | null = null, | ||
maxRetry:number = 15, | ||
interval:number=1000) => { | ||
let done = false; | ||
let count = 0; | ||
const ui = provider.ui(); | ||
let blockNum = (await provider.api().getLastBlock()).last.seqno; | ||
if(curTxLt == null) { | ||
let initialState = await provider.api().getAccount(blockNum, address); | ||
let lt = initialState?.account?.last?.lt; | ||
curTxLt = lt ? lt : null; | ||
} | ||
do { | ||
ui.write(`Awaiting ${action} completion (${++count}/${maxRetry})`); | ||
await sleep(interval); | ||
let newBlockNum = (await provider.api().getLastBlock()).last.seqno; | ||
if (blockNum == newBlockNum) { | ||
continue; | ||
} | ||
blockNum = newBlockNum; | ||
const curState = await provider.api().getAccount(blockNum, address); | ||
if(curState?.account?.last !== null){ | ||
done = curState?.account?.last?.lt !== curTxLt; | ||
} | ||
} while(!done && count < maxRetry); | ||
return done; | ||
} | ||
import {Address, toNano} from '@ton/core'; | ||
import {Multisig} from '../wrappers/Multisig'; | ||
import {compile, NetworkProvider} from '@ton/blueprint'; | ||
|
||
export async function run(provider: NetworkProvider) { | ||
const multisig_code = await compile('Multisig'); | ||
const order_code_raw = await compile('Order'); | ||
|
||
const librarian_code = await compile('Librarian'); | ||
const librarian = provider.open(Librarian.createFromConfig({code:order_code_raw}, librarian_code)); | ||
await librarian.sendDeploy(provider.sender(), toNano("1000")); | ||
await waitForTransaction(provider, librarian.address, "Librarian deploy"); | ||
// deploy multisig | ||
|
||
/*const multiownerWallet = provider.open(Multisig.createFromConfig({}, multisig_code)); | ||
const multiownerWallet = provider.open(Multisig.createFromConfig({ | ||
threshold: 2, | ||
signers: [Address.parse('UQBONmT67oFPvbbByzbXK6xS0V4YbBHs1mT-Gz8afP2AHdyt'), Address.parse('0QAR0lJjOVUzyT4QBKg50k216RBqvpvEPlq2_xGtdMkgFgcY'), Address.parse('UQAGkOdcs7i0OomLkySkVdiLbzriH4ptQAgYWqHRVK2vXO4z')], | ||
proposers: [Address.parse('0QAR0lJjOVUzyT4QBKg50k216RBqvpvEPlq2_xGtdMkgFgcY')], | ||
allowArbitrarySeqno: true | ||
}, multisig_code)); | ||
|
||
await multiownerWallet.sendDeploy(provider.sender(), toNano('0.05')); | ||
await provider.waitForDeploy(multiownerWallet.address); | ||
*/ | ||
// run methods on `multiownerWallet` | ||
|
||
} |
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,63 @@ | ||
import {Address, beginCell, toNano} from '@ton/core'; | ||
import {Multisig} from '../wrappers/Multisig'; | ||
import {compile, NetworkProvider} from '@ton/blueprint'; | ||
|
||
export async function run(provider: NetworkProvider) { | ||
const multisig_code = await compile('Multisig'); | ||
|
||
// deploy multisig | ||
|
||
const multiownerWallet = provider.open(Multisig.createFromConfig({ | ||
threshold: 2, | ||
signers: [Address.parse('UQBONmT67oFPvbbByzbXK6xS0V4YbBHs1mT-Gz8afP2AHdyt'), Address.parse('0QAR0lJjOVUzyT4QBKg50k216RBqvpvEPlq2_xGtdMkgFgcY'), Address.parse('UQAGkOdcs7i0OomLkySkVdiLbzriH4ptQAgYWqHRVK2vXO4z')], | ||
proposers: [Address.parse('0QAR0lJjOVUzyT4QBKg50k216RBqvpvEPlq2_xGtdMkgFgcY')], | ||
allowArbitrarySeqno: true | ||
}, multisig_code)); | ||
|
||
// create new order | ||
|
||
const masterMsg = beginCell() | ||
.storeUint(0x178d4519, 32) // internal_transfer | ||
.storeUint(0, 64) // query_id | ||
.storeCoins(5000000000n) // jetton amount | ||
.storeAddress(Address.parse('0QAR0lJjOVUzyT4QBKg50k216RBqvpvEPlq2_xGtdMkgFgcY')) // from address (will be ignored) | ||
.storeAddress(Address.parse('0QAR0lJjOVUzyT4QBKg50k216RBqvpvEPlq2_xGtdMkgFgcY')) // response address | ||
.storeCoins(0) // forward payload | ||
.storeBit(false) // no forward | ||
.endCell(); | ||
|
||
await multiownerWallet.sendNewOrder(provider.sender(), [{ | ||
type: 'transfer', | ||
sendMode: 3, | ||
message: { | ||
info: { | ||
type: 'internal', | ||
ihrDisabled: false, | ||
bounce: true, | ||
bounced: false, | ||
dest: Address.parse('EQAZym3GBvem-frRGy1gUIaO-IBb5ByJPrm8aXtN7a_6PBW6'), // jetton-minter | ||
value: { | ||
coins: toNano('1') // ton amount | ||
}, | ||
ihrFee: 0n, | ||
forwardFee: 0n, | ||
createdLt: 0n, | ||
createdAt: 0 | ||
}, | ||
body: beginCell() | ||
.storeUint(0x642b7d07, 32) // mint | ||
.storeUint(0, 64) // query_id | ||
.storeAddress(Address.parse('0QAR0lJjOVUzyT4QBKg50k216RBqvpvEPlq2_xGtdMkgFgcY')) // mint to this regular wallet | ||
.storeCoins(toNano('0.5')) // ton amount | ||
.storeRef(masterMsg) | ||
.endCell() | ||
} | ||
}], | ||
Math.floor(Date.now() / 1000 + 3600), // expired in hour | ||
toNano('1'), // ton amount | ||
0, // index | ||
false, // not signer | ||
123n // order_seqno | ||
); | ||
|
||
} |