Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions contracts/contracts/test/mock/relay.tolk

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/tests/ccip/onramp/OnRamp.Setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, Cell, beginCell, toNano } from '@ton/core'
import { Cell, beginCell, toNano } from '@ton/core'
import { Blockchain, SandboxContract, TreasuryContract } from '@ton/sandbox'

import { generateRandomContractId } from '../../../src/utils'
Expand Down
11 changes: 4 additions & 7 deletions contracts/tests/ccip/onramp/OnRamp.executorExited.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import * as coverage from '../../coverage/coverage'
import * as or from '../../../wrappers/gen/ccip/OnRamp'
import * as ex from '../../../wrappers/gen/ccip/CCIPSendExecutor'
import * as rt from '../../../wrappers/gen/ccip/Router'
import * as relay from '../../../wrappers/test/mock/Relay'
import { setup } from './OnRamp.Setup'
import { getStorage } from '../../../wrappers/utils'
import { contractCode } from '../../../wrappers/codeLoader'
import { ChainSelectors } from '../../utils/Selectors'
import EVM_ADDRESS from '../../utils/evmAddress'
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('OnRamp - executor exit', () => {
},
executor: {
deployableCode: deployableCode,
executorCode: await relay.ContractClient.code(),
executorCode: Cell.EMPTY,
},
}))

Expand Down Expand Up @@ -114,12 +114,9 @@ describe('OnRamp - executor exit', () => {
throw new Error('Executor address not found')
}

const relayContract = blockchain.openContract(
relay.ContractClient.createFromAddress(executorAddress),
)
executorSender = await relayContract.getSender(deployer.getSender())
executorSender = blockchain.sender(executorAddress)

const executorStorageCell = await relayContract.getStorage()
const executorStorageCell = await getStorage(blockchain, executorAddress)
const storage = ex.CCIPSendExecutor_InitialData.fromSlice(executorStorageCell.beginParse())
executorID = storage.id
})
Expand Down
11 changes: 4 additions & 7 deletions contracts/tests/ccip/onramp/OnRamp.generateMessageID.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { WRAPPED_NATIVE } from '../../../src/utils'

import * as or from '../../../wrappers/gen/ccip/OnRamp'
import * as ex from '../../../wrappers/gen/ccip/CCIPSendExecutor'
import * as relay from '../../../wrappers/test/mock/Relay'
import { setup } from './OnRamp.Setup'
import { getStorage } from '../../../wrappers/utils'
import { contractCode } from '../../../wrappers/codeLoader'
import { ChainSelectors } from '../../utils/Selectors'
import * as on from '../../../wrappers/gen/ccip/OnRamp'
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('OnRamp - generate message id', () => {
},
executor: {
deployableCode: deployableCode,
executorCode: await relay.ContractClient.code(),
executorCode: Cell.EMPTY,
},
}))

Expand Down Expand Up @@ -131,12 +131,9 @@ describe('OnRamp - generate message id', () => {
throw new Error('Executor address not found')
}

const relayContract = blockchain.openContract(
relay.ContractClient.createFromAddress(executorAddress),
)
executorSender = await relayContract.getSender(deployer.getSender())
executorSender = blockchain.sender(executorAddress)

const executorStorageCell = await relayContract.getStorage()
const executorStorageCell = await getStorage(blockchain, executorAddress)
const storage = ex.CCIPSendExecutor_InitialData.fromSlice(executorStorageCell.beginParse())
executorID = storage.id
})
Expand Down
148 changes: 0 additions & 148 deletions contracts/wrappers/test/mock/Relay.ts

This file was deleted.

7 changes: 0 additions & 7 deletions contracts/wrappers/tests.mock.Relay.compile.ts

This file was deleted.

11 changes: 10 additions & 1 deletion contracts/wrappers/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Builder, Slice, TupleItem } from '@ton/core'
import { Address, Builder, Cell, Slice, TupleItem } from '@ton/core'
import { Blockchain } from '@ton/sandbox'
import { createHash } from 'crypto'

/// Returns the facility ID for the given CRC16 key (e.g. stringCrc16("link.chain.ton.mcms.Timelock")).
Expand Down Expand Up @@ -61,3 +62,11 @@ export const remainingBitsOrRefCodec = {
}
},
}

export async function getStorage(blockchain: Blockchain, addr: Address): Promise<Cell> {
const contract = await blockchain.getContract(addr)
if (contract.accountState == undefined) throw new Error('Contract account state is undefined')
const state = contract.accountState
if (state.type !== 'active') throw new Error('Contract account state is not active')
return state.state.data!
}
Loading