Rename withdrawTo to bridgeTransferFrom

This commit is contained in:
Amir Bandeali
2019-10-22 22:51:11 -07:00
parent f192648c76
commit 281658ba34
7 changed files with 15 additions and 15 deletions

View File

@@ -73,7 +73,7 @@ contract ERC20BridgeProxy is
uint256 balanceBefore = balanceOf(tokenAddress, to); uint256 balanceBefore = balanceOf(tokenAddress, to);
// Call the bridge, who should transfer `amount` of `tokenAddress` to // Call the bridge, who should transfer `amount` of `tokenAddress` to
// `to`. // `to`.
bytes4 success = IERC20Bridge(bridgeAddress).withdrawTo( bytes4 success = IERC20Bridge(bridgeAddress).bridgeTransferFrom(
tokenAddress, tokenAddress,
from, from,
to, to,

View File

@@ -42,7 +42,7 @@ contract Eth2DaiBridge is
/// @param amount Minimum amount of `toTokenAddress` tokens to buy. /// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoeded "from" token address. /// @param bridgeData The abi-encoeded "from" token address.
/// @return success The magic bytes if successful. /// @return success The magic bytes if successful.
function withdrawTo( function bridgeTransferFrom(
address toTokenAddress, address toTokenAddress,
address /* from */, address /* from */,
address to, address to,

View File

@@ -37,7 +37,7 @@ contract UniswapBridge is
address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95; address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95;
address constant private WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address constant private WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
// Struct to hold `withdrawTo()` local variables in memory and to avoid // Struct to hold `bridgeTransferFrom()` local variables in memory and to avoid
// stack overflows. // stack overflows.
struct WithdrawToState { struct WithdrawToState {
IUniswapExchange exchange; IUniswapExchange exchange;
@@ -60,7 +60,7 @@ contract UniswapBridge is
/// @param amount Minimum amount of `toTokenAddress` tokens to buy. /// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoded "from" token address. /// @param bridgeData The abi-encoded "from" token address.
/// @return success The magic bytes if successful. /// @return success The magic bytes if successful.
function withdrawTo( function bridgeTransferFrom(
address toTokenAddress, address toTokenAddress,
address /* from */, address /* from */,
address to, address to,

View File

@@ -31,7 +31,7 @@ contract IERC20Bridge {
/// @param amount Amount of asset to transfer. /// @param amount Amount of asset to transfer.
/// @param bridgeData Arbitrary asset data needed by the bridge contract. /// @param bridgeData Arbitrary asset data needed by the bridge contract.
/// @return success The magic bytes `0x37708e9b` if successful. /// @return success The magic bytes `0x37708e9b` if successful.
function withdrawTo( function bridgeTransferFrom(
address tokenAddress, address tokenAddress,
address from, address from,
address to, address to,

View File

@@ -72,7 +72,7 @@ contract TestERC20Bridge is
testToken.setBalance(owner, balance); testToken.setBalance(owner, balance);
} }
function withdrawTo( function bridgeTransferFrom(
address tokenAddress, address tokenAddress,
address from, address from,
address to, address to,

View File

@@ -45,7 +45,7 @@ blockchainTests.resets('Eth2DaiBridge unit tests', env => {
}); });
}); });
describe('withdrawTo()', () => { describe('bridgeTransferFrom()', () => {
interface WithdrawToOpts { interface WithdrawToOpts {
toTokenAddress?: string; toTokenAddress?: string;
fromTokenAddress?: string; fromTokenAddress?: string;
@@ -103,9 +103,9 @@ blockchainTests.resets('Eth2DaiBridge unit tests', env => {
_opts.toTokentransferRevertReason, _opts.toTokentransferRevertReason,
_opts.toTokenTransferReturnData, _opts.toTokenTransferReturnData,
); );
// Call withdrawTo(). // Call bridgeTransferFrom().
const [result, { logs }] = await txHelper.getResultAndReceiptAsync( const [result, { logs }] = await txHelper.getResultAndReceiptAsync(
testContract.withdrawTo, testContract.bridgeTransferFrom,
// "to" token address // "to" token address
_opts.toTokenAddress, _opts.toTokenAddress,
// Random from address. // Random from address.

View File

@@ -52,7 +52,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
}); });
}); });
describe('withdrawTo()', () => { describe('bridgeTransferFrom()', () => {
interface WithdrawToOpts { interface WithdrawToOpts {
fromTokenAddress: string; fromTokenAddress: string;
toTokenAddress: string; toTokenAddress: string;
@@ -115,9 +115,9 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
await testContract.setTokenBalance.awaitTransactionSuccessAsync(_opts.fromTokenAddress, { await testContract.setTokenBalance.awaitTransactionSuccessAsync(_opts.fromTokenAddress, {
value: new BigNumber(_opts.fromTokenBalance), value: new BigNumber(_opts.fromTokenBalance),
}); });
// Call withdrawTo(). // Call bridgeTransferFrom().
const [result, receipt] = await txHelper.getResultAndReceiptAsync( const [result, receipt] = await txHelper.getResultAndReceiptAsync(
testContract.withdrawTo, testContract.bridgeTransferFrom,
// The "to" token address. // The "to" token address.
_opts.toTokenAddress, _opts.toTokenAddress,
// The "from" address. // The "from" address.
@@ -203,7 +203,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
}); });
it('fails if "from" token does not exist', async () => { it('fails if "from" token does not exist', async () => {
const tx = testContract.withdrawTo.awaitTransactionSuccessAsync( const tx = testContract.bridgeTransferFrom.awaitTransactionSuccessAsync(
randomAddress(), randomAddress(),
randomAddress(), randomAddress(),
randomAddress(), randomAddress(),
@@ -275,7 +275,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
}); });
it('fails if "from" token does not exist', async () => { it('fails if "from" token does not exist', async () => {
const tx = testContract.withdrawTo.awaitTransactionSuccessAsync( const tx = testContract.bridgeTransferFrom.awaitTransactionSuccessAsync(
randomAddress(), randomAddress(),
randomAddress(), randomAddress(),
randomAddress(), randomAddress(),
@@ -333,7 +333,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
}); });
it('fails if "to" token does not exist', async () => { it('fails if "to" token does not exist', async () => {
const tx = testContract.withdrawTo.awaitTransactionSuccessAsync( const tx = testContract.bridgeTransferFrom.awaitTransactionSuccessAsync(
wethTokenAddress, wethTokenAddress,
randomAddress(), randomAddress(),
randomAddress(), randomAddress(),