-
Notifications
You must be signed in to change notification settings - Fork 61
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
1 parent
11c0388
commit b986efa
Showing
14 changed files
with
5,597 additions
and
0 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,3 @@ | ||
node_modules | ||
temp | ||
build |
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,6 @@ | ||
[submodule "contracts/jetton_dao"] | ||
path = contracts/jetton_dao | ||
url = https://github.com/EmelyanenkoK/jetton_dao | ||
[submodule "contracts/awaited_minter"] | ||
path = contracts/awaited_minter | ||
url = https://github.com/1IxI1/share-distributor-contract/ |
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 @@ | ||
build |
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,7 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 4, | ||
"singleQuote": true, | ||
"bracketSpacing": true, | ||
"semi": true | ||
} |
Submodule awaited_minter
added at
33dad4
Submodule jetton_dao
added at
69c8be
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,8 @@ | ||
import type { Config } from 'jest'; | ||
|
||
const config: Config = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; | ||
|
||
export default config; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "liquid_staking", | ||
"version": "0.0.1", | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@ton-community/blueprint": "^0.9.0", | ||
"@ton-community/sandbox": "^0.10.0", | ||
"@ton-community/test-utils": "^0.2.0", | ||
"@types/jest": "^29.5.0", | ||
"@types/node": "^18.15.5", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.6", | ||
"ton": "^13.4.1", | ||
"ton-core": "^0.49.0", | ||
"ton-crypto": "^3.2.0", | ||
"ts-jest": "^29.0.5", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
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 { Pool } from '../wrappers/Pool'; | ||
import { compile, NetworkProvider } from '@ton-community/blueprint'; | ||
|
||
export async function run(provider: NetworkProvider) { | ||
const pool = provider.open(Pool.createFromConfig({}, await compile('Pool'))); | ||
|
||
await pool.sendDeploy(provider.sender(), toNano('0.05')); | ||
|
||
await provider.waitForDeploy(pool.address); | ||
|
||
// run methods on `pool` | ||
} |
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,38 @@ | ||
import { Blockchain, SandboxContract } from '@ton-community/sandbox'; | ||
import { Cell, toNano } from 'ton-core'; | ||
import { Pool } from '../wrappers/Pool'; | ||
import '@ton-community/test-utils'; | ||
import { compile } from '@ton-community/blueprint'; | ||
|
||
describe('Pool', () => { | ||
let code: Cell; | ||
|
||
beforeAll(async () => { | ||
code = await compile('Pool'); | ||
}); | ||
|
||
let blockchain: Blockchain; | ||
let pool: SandboxContract<Pool>; | ||
|
||
beforeEach(async () => { | ||
blockchain = await Blockchain.create(); | ||
|
||
pool = blockchain.openContract(Pool.createFromConfig({}, code)); | ||
|
||
const deployer = await blockchain.treasury('deployer'); | ||
|
||
const deployResult = await pool.sendDeploy(deployer.getSender(), toNano('0.05')); | ||
|
||
expect(deployResult.transactions).toHaveTransaction({ | ||
from: deployer.address, | ||
to: pool.address, | ||
deploy: true, | ||
success: true, | ||
}); | ||
}); | ||
|
||
it('should deploy', async () => { | ||
// the check is done inside beforeEach | ||
// blockchain and pool are ready to use | ||
}); | ||
}); |
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,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"outDir": "dist", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"skipLibCheck": true | ||
} | ||
} |
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,6 @@ | ||
import { CompilerConfig } from '@ton-community/blueprint'; | ||
|
||
export const compile: CompilerConfig = { | ||
lang: 'func', | ||
targets: ['contracts/pool.func'], | ||
}; |
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,29 @@ | ||
import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from 'ton-core'; | ||
|
||
export type PoolConfig = {}; | ||
|
||
export function poolConfigToCell(config: PoolConfig): Cell { | ||
return beginCell().endCell(); | ||
} | ||
|
||
export class Pool implements Contract { | ||
constructor(readonly address: Address, readonly init?: { code: Cell; data: Cell }) {} | ||
|
||
static createFromAddress(address: Address) { | ||
return new Pool(address); | ||
} | ||
|
||
static createFromConfig(config: PoolConfig, code: Cell, workchain = 0) { | ||
const data = poolConfigToCell(config); | ||
const init = { code, data }; | ||
return new Pool(contractAddress(workchain, init), init); | ||
} | ||
|
||
async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) { | ||
await provider.internal(via, { | ||
value, | ||
sendMode: SendMode.PAY_GAS_SEPARATELY, | ||
body: beginCell().endCell(), | ||
}); | ||
} | ||
} |