Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
germartinez committed Jul 5, 2023
1 parent cf5d853 commit cd40717
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions packages/protocol-kit/hardhat/deploy/deploy-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise<v
log: true,
deterministicDeployment: true
})

await deploy('TokenCallbackHandler_SV1_4_1', {
from: deployer,
args: [],
log: true,
deterministicDeployment: true
})
}

export default deploy
2 changes: 1 addition & 1 deletion packages/protocol-kit/src/Safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import {
} from './types'
import {
EthSafeSignature,
SAFE_FEATURES,
hasSafeFeature,
isMetaTransactionArray,
isSafeMultisigTransactionResponse,
SAFE_FEATURES,
sameString
} from './utils'
import {
Expand Down
5 changes: 4 additions & 1 deletion packages/protocol-kit/tests/e2e/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
import { BigNumber } from 'ethers'
import { deployments, waffle } from 'hardhat'
import semverSatisfies from 'semver/functions/satisfies'
import { itif } from './utils/helpers'
import { getContractNetworks } from './utils/setupContractNetworks'
import { getSafeWithOwners } from './utils/setupContracts'
Expand All @@ -30,7 +31,9 @@ describe('Safe Info', () => {
safeVersion: safeVersionDeployed
}
}
const predictedSafeAddress = '0x1A154d62d3d6a71115Bd4636C641B9E2b8Aa605d'
const predictedSafeAddress = semverSatisfies(safeVersionDeployed, '1.3.0')
? '0xe37d3CA59F5e702eA928688409Ccd74E14be2EF4'
: '0x2374BBC0a7fe89F9A782Dbc6CF95ADA2817AE5F9'
return {
chainId: (await waffle.provider.getNetwork()).chainId,
safe: await getSafeWithOwners([accounts[0].address, accounts[1].address]),
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol-kit/tests/e2e/utils/setupContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import { DebugTransactionGuard } from '@safe-global/protocol-kit/typechain/tests
import { deployments, ethers } from 'hardhat'
import semverSatisfies from 'semver/functions/satisfies'
import { AbiItem } from 'web3-utils'
import { PREDETERMINED_SALT_NONCE } from '../../../src/contracts/utils'

export const getSafeSingleton = async (): Promise<{
contract: Safe_V1_4_1 | Safe_V1_3_0 | Safe_V1_2_0 | Safe_V1_1_1 | Safe_V1_0_0
Expand Down Expand Up @@ -88,15 +87,16 @@ export const getFactory = async (): Promise<{
export const getSafeTemplate = async (): Promise<
Safe_V1_4_1 | Safe_V1_3_0 | Safe_V1_2_0 | Safe_V1_1_1 | Safe_V1_0_0
> => {
const randomSaltNonce = Math.floor(Math.random() * 1000000000) + 1
const singleton = (await getSafeSingleton()).contract
const factory = (await getFactory()).contract
const template = await factory.callStatic.createProxyWithNonce(
singleton.address,
'0x',
PREDETERMINED_SALT_NONCE
randomSaltNonce
)
await factory
.createProxyWithNonce(singleton.address, '0x', PREDETERMINED_SALT_NONCE)
.createProxyWithNonce(singleton.address, '0x', randomSaltNonce)
.then((tx: any) => tx.wait())
const Safe = await ethers.getContractFactory(safeDeployed.name)
return Safe.attach(template) as
Expand Down

0 comments on commit cd40717

Please sign in to comment.