Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2479 from 0xProject/test/dydx-mainnet-tests/updat…
Browse files Browse the repository at this point in the history
…eDeployment

Fixed dYdX Bridge Tests
  • Loading branch information
hysz authored Feb 13, 2020
2 parents 3b61129 + a8c09d0 commit a4ac418
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
4 changes: 4 additions & 0 deletions contracts/integrations/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
{
"note": "Added ChainlinkStopLimit contract and tests",
"pr": 2473
},
{
"note": "Fixed the mainnet dYdX Bridge tests.",
"pr": 2479
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion contracts/integrations/contracts/test/TestDydxUser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ interface IDydx {
/// @dev Deploy this contract and call `init` to run the mainnet DydxBridge integration tests.
contract TestDydxUser {

address public constant DYDX_BRIDGE_ADDRESS = 0x96DdBa19b69D6EA2549f6a12d005595167414744;
address public constant DYDX_BRIDGE_ADDRESS = 0x55dC8f21D20D4c6ED3C82916A438A413ca68e335;
address public constant DYDX_ADDRESS = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;
address public constant DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
uint256 public constant DYDX_DAI_MARKET_ID = 3;
Expand Down
14 changes: 7 additions & 7 deletions contracts/integrations/test/bridges/dydx_bridge_mainnet_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { contractAddresses, dydxAccountOwner } from '../mainnet_fork_utils';

import { dydxEvents } from './abi/dydxEvents';

blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
blockchainTests.fork.resets('Mainnet dydx bridge tests', env => {
let testContract: DydxBridgeContract;
// random account to receive tokens from dydx
const receiver = '0x986ccf5234d9cfbb25246f1a5bfa51f4ccfcb308';
Expand Down Expand Up @@ -73,7 +73,7 @@ blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
accountOwner: dydxAccountOwner,
accountNumber: bridgeData.accountNumbers[action.accountId.toNumber()],
market: action.marketId,
update: [[true, scaledAmount]],
update: { deltaWei: { sign: true, value: scaledAmount } },
from: dydxAccountOwner,
});
break;
Expand All @@ -83,7 +83,7 @@ blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
accountOwner: dydxAccountOwner,
accountNumber: bridgeData.accountNumbers[action.accountId.toNumber()],
market: action.marketId,
update: [[false, scaledAmount]],
update: { deltaWei: { sign: false, value: scaledAmount } },
to: receiver,
});
break;
Expand Down Expand Up @@ -112,10 +112,10 @@ blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
expect(log.args.from, 'from').to.equal(expectedEvent.from);
// We only check the first update field because it's the delta balance (amount deposited).
// The next field is the new total, which depends on interest rates at the time of execution.
expect(log.args.update[0][0], 'update sign').to.equal(expectedEvent.update[0][0]);
const updateValueHex = log.args.update[0][1]._hex;
const updateValueBn = new BigNumber(updateValueHex, 16);
expect(updateValueBn, 'update value').to.bignumber.equal(expectedEvent.update[0][1]);
expect(log.args.update.deltaWei.sign, 'update sign').to.equal(expectedEvent.update.deltaWei.sign);
expect(log.args.update.deltaWei.value, 'update value').to.bignumber.equal(
expectedEvent.update.deltaWei.value,
);
}
};

Expand Down
2 changes: 1 addition & 1 deletion contracts/integrations/test/mainnet_fork_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ContractWrappers } from '@0x/contract-wrappers';
import { Web3ProviderEngine } from '@0x/dev-utils';

const chainId = 1;
export const dydxAccountOwner = '0xeb58c2caa96f39626dcceb74fdbb7a9a8b54ec18';
export const dydxAccountOwner = '0xfdac948232c5bfbe24b770326ee4dff7a8dd8484';
export const contractAddresses = getContractAddressesForChainOrThrow(chainId);

/**
Expand Down
6 changes: 5 additions & 1 deletion contracts/test-utils/src/web3_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export let providerConfigs: Web3Config = {
shouldUseInProcessGanache: true,
shouldAllowUnlimitedContractSize: true,
hardfork: 'istanbul',
unlocked_accounts: ['0x6cc5f688a315f3dc28a7781717a9a798a59fda7b', '0x55dc8f21d20d4c6ed3c82916a438a413ca68e335'],
unlocked_accounts: [
'0x6cc5f688a315f3dc28a7781717a9a798a59fda7b',
'0x55dc8f21d20d4c6ed3c82916a438a413ca68e335',
'0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0', // ERC20BridgeProxy
],
};

export const provider: Web3ProviderEngine = web3Factory.getRpcProvider(providerConfigs);
Expand Down

0 comments on commit a4ac418

Please sign in to comment.