Rename withdrawTo to bridgeTransferFrom
This commit is contained in:
parent
f192648c76
commit
281658ba34
@ -73,7 +73,7 @@ contract ERC20BridgeProxy is
|
||||
uint256 balanceBefore = balanceOf(tokenAddress, to);
|
||||
// Call the bridge, who should transfer `amount` of `tokenAddress` to
|
||||
// `to`.
|
||||
bytes4 success = IERC20Bridge(bridgeAddress).withdrawTo(
|
||||
bytes4 success = IERC20Bridge(bridgeAddress).bridgeTransferFrom(
|
||||
tokenAddress,
|
||||
from,
|
||||
to,
|
||||
|
@ -42,7 +42,7 @@ contract Eth2DaiBridge is
|
||||
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
|
||||
/// @param bridgeData The abi-encoeded "from" token address.
|
||||
/// @return success The magic bytes if successful.
|
||||
function withdrawTo(
|
||||
function bridgeTransferFrom(
|
||||
address toTokenAddress,
|
||||
address /* from */,
|
||||
address to,
|
||||
|
@ -37,7 +37,7 @@ contract UniswapBridge is
|
||||
address constant private UNISWAP_EXCHANGE_FACTORY_ADDRESS = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95;
|
||||
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.
|
||||
struct WithdrawToState {
|
||||
IUniswapExchange exchange;
|
||||
@ -60,7 +60,7 @@ contract UniswapBridge is
|
||||
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
|
||||
/// @param bridgeData The abi-encoded "from" token address.
|
||||
/// @return success The magic bytes if successful.
|
||||
function withdrawTo(
|
||||
function bridgeTransferFrom(
|
||||
address toTokenAddress,
|
||||
address /* from */,
|
||||
address to,
|
||||
|
@ -31,7 +31,7 @@ contract IERC20Bridge {
|
||||
/// @param amount Amount of asset to transfer.
|
||||
/// @param bridgeData Arbitrary asset data needed by the bridge contract.
|
||||
/// @return success The magic bytes `0x37708e9b` if successful.
|
||||
function withdrawTo(
|
||||
function bridgeTransferFrom(
|
||||
address tokenAddress,
|
||||
address from,
|
||||
address to,
|
||||
|
@ -72,7 +72,7 @@ contract TestERC20Bridge is
|
||||
testToken.setBalance(owner, balance);
|
||||
}
|
||||
|
||||
function withdrawTo(
|
||||
function bridgeTransferFrom(
|
||||
address tokenAddress,
|
||||
address from,
|
||||
address to,
|
||||
|
@ -45,7 +45,7 @@ blockchainTests.resets('Eth2DaiBridge unit tests', env => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('withdrawTo()', () => {
|
||||
describe('bridgeTransferFrom()', () => {
|
||||
interface WithdrawToOpts {
|
||||
toTokenAddress?: string;
|
||||
fromTokenAddress?: string;
|
||||
@ -103,9 +103,9 @@ blockchainTests.resets('Eth2DaiBridge unit tests', env => {
|
||||
_opts.toTokentransferRevertReason,
|
||||
_opts.toTokenTransferReturnData,
|
||||
);
|
||||
// Call withdrawTo().
|
||||
// Call bridgeTransferFrom().
|
||||
const [result, { logs }] = await txHelper.getResultAndReceiptAsync(
|
||||
testContract.withdrawTo,
|
||||
testContract.bridgeTransferFrom,
|
||||
// "to" token address
|
||||
_opts.toTokenAddress,
|
||||
// Random from address.
|
||||
|
@ -52,7 +52,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('withdrawTo()', () => {
|
||||
describe('bridgeTransferFrom()', () => {
|
||||
interface WithdrawToOpts {
|
||||
fromTokenAddress: string;
|
||||
toTokenAddress: string;
|
||||
@ -115,9 +115,9 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
|
||||
await testContract.setTokenBalance.awaitTransactionSuccessAsync(_opts.fromTokenAddress, {
|
||||
value: new BigNumber(_opts.fromTokenBalance),
|
||||
});
|
||||
// Call withdrawTo().
|
||||
// Call bridgeTransferFrom().
|
||||
const [result, receipt] = await txHelper.getResultAndReceiptAsync(
|
||||
testContract.withdrawTo,
|
||||
testContract.bridgeTransferFrom,
|
||||
// The "to" token address.
|
||||
_opts.toTokenAddress,
|
||||
// The "from" address.
|
||||
@ -203,7 +203,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
|
||||
});
|
||||
|
||||
it('fails if "from" token does not exist', async () => {
|
||||
const tx = testContract.withdrawTo.awaitTransactionSuccessAsync(
|
||||
const tx = testContract.bridgeTransferFrom.awaitTransactionSuccessAsync(
|
||||
randomAddress(),
|
||||
randomAddress(),
|
||||
randomAddress(),
|
||||
@ -275,7 +275,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
|
||||
});
|
||||
|
||||
it('fails if "from" token does not exist', async () => {
|
||||
const tx = testContract.withdrawTo.awaitTransactionSuccessAsync(
|
||||
const tx = testContract.bridgeTransferFrom.awaitTransactionSuccessAsync(
|
||||
randomAddress(),
|
||||
randomAddress(),
|
||||
randomAddress(),
|
||||
@ -333,7 +333,7 @@ blockchainTests.resets('UniswapBridge unit tests', env => {
|
||||
});
|
||||
|
||||
it('fails if "to" token does not exist', async () => {
|
||||
const tx = testContract.withdrawTo.awaitTransactionSuccessAsync(
|
||||
const tx = testContract.bridgeTransferFrom.awaitTransactionSuccessAsync(
|
||||
wethTokenAddress,
|
||||
randomAddress(),
|
||||
randomAddress(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user