Fixed dYdX Bridge Tests

This commit is contained in:
Greg Hysen 2020-02-10 17:31:36 -08:00
parent 3b61129ade
commit 871105a48a
4 changed files with 14 additions and 10 deletions

View File

@ -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;

View File

@ -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';
@ -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;
@ -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;
@ -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,
);
}
};

View File

@ -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);
/**

View File

@ -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);