Merge pull request #2479 from 0xProject/test/dydx-mainnet-tests/updateDeployment
Fixed dYdX Bridge Tests
This commit is contained in:
commit
a4ac418bc9
@ -5,6 +5,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Added ChainlinkStopLimit contract and tests",
|
"note": "Added ChainlinkStopLimit contract and tests",
|
||||||
"pr": 2473
|
"pr": 2473
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Fixed the mainnet dYdX Bridge tests.",
|
||||||
|
"pr": 2479
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -130,7 +130,7 @@ interface IDydx {
|
|||||||
/// @dev Deploy this contract and call `init` to run the mainnet DydxBridge integration tests.
|
/// @dev Deploy this contract and call `init` to run the mainnet DydxBridge integration tests.
|
||||||
contract TestDydxUser {
|
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 DYDX_ADDRESS = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e;
|
||||||
address public constant DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
|
address public constant DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
|
||||||
uint256 public constant DYDX_DAI_MARKET_ID = 3;
|
uint256 public constant DYDX_DAI_MARKET_ID = 3;
|
||||||
|
@ -14,7 +14,7 @@ import { contractAddresses, dydxAccountOwner } from '../mainnet_fork_utils';
|
|||||||
|
|
||||||
import { dydxEvents } from './abi/dydxEvents';
|
import { dydxEvents } from './abi/dydxEvents';
|
||||||
|
|
||||||
blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
|
blockchainTests.fork.resets('Mainnet dydx bridge tests', env => {
|
||||||
let testContract: DydxBridgeContract;
|
let testContract: DydxBridgeContract;
|
||||||
// random account to receive tokens from dydx
|
// random account to receive tokens from dydx
|
||||||
const receiver = '0x986ccf5234d9cfbb25246f1a5bfa51f4ccfcb308';
|
const receiver = '0x986ccf5234d9cfbb25246f1a5bfa51f4ccfcb308';
|
||||||
@ -73,7 +73,7 @@ blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
|
|||||||
accountOwner: dydxAccountOwner,
|
accountOwner: dydxAccountOwner,
|
||||||
accountNumber: bridgeData.accountNumbers[action.accountId.toNumber()],
|
accountNumber: bridgeData.accountNumbers[action.accountId.toNumber()],
|
||||||
market: action.marketId,
|
market: action.marketId,
|
||||||
update: [[true, scaledAmount]],
|
update: { deltaWei: { sign: true, value: scaledAmount } },
|
||||||
from: dydxAccountOwner,
|
from: dydxAccountOwner,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -83,7 +83,7 @@ blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
|
|||||||
accountOwner: dydxAccountOwner,
|
accountOwner: dydxAccountOwner,
|
||||||
accountNumber: bridgeData.accountNumbers[action.accountId.toNumber()],
|
accountNumber: bridgeData.accountNumbers[action.accountId.toNumber()],
|
||||||
market: action.marketId,
|
market: action.marketId,
|
||||||
update: [[false, scaledAmount]],
|
update: { deltaWei: { sign: false, value: scaledAmount } },
|
||||||
to: receiver,
|
to: receiver,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -112,10 +112,10 @@ blockchainTests.fork.skip('Mainnet dydx bridge tests', env => {
|
|||||||
expect(log.args.from, 'from').to.equal(expectedEvent.from);
|
expect(log.args.from, 'from').to.equal(expectedEvent.from);
|
||||||
// We only check the first update field because it's the delta balance (amount deposited).
|
// 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.
|
// 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]);
|
expect(log.args.update.deltaWei.sign, 'update sign').to.equal(expectedEvent.update.deltaWei.sign);
|
||||||
const updateValueHex = log.args.update[0][1]._hex;
|
expect(log.args.update.deltaWei.value, 'update value').to.bignumber.equal(
|
||||||
const updateValueBn = new BigNumber(updateValueHex, 16);
|
expectedEvent.update.deltaWei.value,
|
||||||
expect(updateValueBn, 'update value').to.bignumber.equal(expectedEvent.update[0][1]);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import { ContractWrappers } from '@0x/contract-wrappers';
|
|||||||
import { Web3ProviderEngine } from '@0x/dev-utils';
|
import { Web3ProviderEngine } from '@0x/dev-utils';
|
||||||
|
|
||||||
const chainId = 1;
|
const chainId = 1;
|
||||||
export const dydxAccountOwner = '0xeb58c2caa96f39626dcceb74fdbb7a9a8b54ec18';
|
export const dydxAccountOwner = '0xfdac948232c5bfbe24b770326ee4dff7a8dd8484';
|
||||||
export const contractAddresses = getContractAddressesForChainOrThrow(chainId);
|
export const contractAddresses = getContractAddressesForChainOrThrow(chainId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,11 @@ export let providerConfigs: Web3Config = {
|
|||||||
shouldUseInProcessGanache: true,
|
shouldUseInProcessGanache: true,
|
||||||
shouldAllowUnlimitedContractSize: true,
|
shouldAllowUnlimitedContractSize: true,
|
||||||
hardfork: 'istanbul',
|
hardfork: 'istanbul',
|
||||||
unlocked_accounts: ['0x6cc5f688a315f3dc28a7781717a9a798a59fda7b', '0x55dc8f21d20d4c6ed3c82916a438a413ca68e335'],
|
unlocked_accounts: [
|
||||||
|
'0x6cc5f688a315f3dc28a7781717a9a798a59fda7b',
|
||||||
|
'0x55dc8f21d20d4c6ed3c82916a438a413ca68e335',
|
||||||
|
'0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0', // ERC20BridgeProxy
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const provider: Web3ProviderEngine = web3Factory.getRpcProvider(providerConfigs);
|
export const provider: Web3ProviderEngine = web3Factory.getRpcProvider(providerConfigs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user