Skip to content

Commit

Permalink
Merge pull request #53 from aave/fix/refactor-dependencies
Browse files Browse the repository at this point in the history
Refactor dependencies contracts
  • Loading branch information
miguelmtzinf authored May 24, 2022
2 parents 093769b + 4aa3be1 commit 303bd3e
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 19 deletions.
2 changes: 1 addition & 1 deletion contracts/bridges/OptimismBridgeExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import {ICrossDomainMessenger} from '../interfaces/ICrossDomainMessenger.sol';
import {ICrossDomainMessenger} from '../dependencies/optimism/interfaces/ICrossDomainMessenger.sol';
import {L2BridgeExecutor} from './L2BridgeExecutor.sol';

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/bridges/PolygonBridgeExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import {IFxMessageProcessor} from '../interfaces/IFxMessageProcessor.sol';
import {IFxMessageProcessor} from '../dependencies/polygon/fxportal/interfaces/IFxMessageProcessor.sol';
import {BridgeExecutorBase} from './BridgeExecutorBase.sol';

/**
Expand Down
72 changes: 72 additions & 0 deletions contracts/dependencies/arbitrum/interfaces/ArbRetryableTx.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
pragma solidity >=0.4.21 <0.9.0;

/**
* @title precompiled contract in every Arbitrum chain for retryable transaction related data retrieval and interactions. Exists at 0x000000000000000000000000000000000000006E
*/
interface ArbRetryableTx {
/**
* @notice Redeem a redeemable tx.
* Revert if called by an L2 contract, or if userTxHash does not exist, or if userTxHash reverts.
* If this returns, userTxHash has been completed and is no longer available for redemption.
* If this reverts, userTxHash is still available for redemption (until it times out or is canceled).
* @param userTxHash unique identifier of retryable message: keccak256(keccak256(ArbchainId, inbox-sequence-number), uint(0) )
*/
function redeem(bytes32 userTxHash) external;

/**
* @notice Return the minimum lifetime of redeemable txn.
* @return lifetime in seconds
*/
function getLifetime() external view returns (uint256);

/**
* @notice Return the timestamp when userTxHash will age out, or zero if userTxHash does not exist.
* The timestamp could be in the past, because aged-out tickets might not be discarded immediately.
* @param userTxHash unique ticket identifier
* @return timestamp for ticket's deadline
*/
function getTimeout(bytes32 userTxHash) external view returns (uint256);

/**
* @notice Return the price, in wei, of submitting a new retryable tx with a given calldata size.
* @param calldataSize call data size to get price of (in wei)
* @return (price, nextUpdateTimestamp). Price is guaranteed not to change until nextUpdateTimestamp.
*/
function getSubmissionPrice(uint256 calldataSize) external view returns (uint256, uint256);

/**
* @notice Return the price, in wei, of extending the lifetime of userTxHash by an additional lifetime period. Revert if userTxHash doesn't exist.
* @param userTxHash unique ticket identifier
* @return (price, nextUpdateTimestamp). Price is guaranteed not to change until nextUpdateTimestamp.
*/
function getKeepalivePrice(bytes32 userTxHash) external view returns (uint256, uint256);

/**
@notice Deposits callvalue into the sender's L2 account, then adds one lifetime period to the life of userTxHash.
* If successful, emits LifetimeExtended event.
* Revert if userTxHash does not exist, or if the timeout of userTxHash is already at least one lifetime period in the future, or if the sender has insufficient funds (after the deposit).
* @param userTxHash unique ticket identifier
* @return New timeout of userTxHash.
*/
function keepalive(bytes32 userTxHash) external payable returns (uint256);

/**
* @notice Return the beneficiary of userTxHash.
* Revert if userTxHash doesn't exist.
* @param userTxHash unique ticket identifier
* @return address of beneficiary for ticket
*/
function getBeneficiary(bytes32 userTxHash) external view returns (address);

/**
* @notice Cancel userTxHash and refund its callvalue to its beneficiary.
* Revert if userTxHash doesn't exist, or if called by anyone other than userTxHash's beneficiary.
* @param userTxHash unique ticket identifier
*/
function cancel(bytes32 userTxHash) external;

event TicketCreated(bytes32 indexed userTxHash);
event LifetimeExtended(bytes32 indexed userTxHash, uint256 newTimeout);
event Redeemed(bytes32 indexed userTxHash);
event Canceled(bytes32 indexed userTxHash);
}
File renamed without changes.
11 changes: 0 additions & 11 deletions contracts/interfaces/IArbRetryableTx.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/mocks/MockInbox.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//SPDX-License-Identifier: Unlicense
pragma solidity >=0.7.0;

import {IInbox} from '../dependencies/arbitrum/interfaces/IInbox.sol';
import {AddressAliasHelper} from '../dependencies/arbitrum/AddressAliasHelper.sol';
import {IInbox} from '../interfaces/IInbox.sol';

contract MockInbox is IInbox {
uint256 public messageNum;
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/MockOvmL1CrossDomainMessenger.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.10;

import {ICrossDomainMessenger} from '../interfaces/ICrossDomainMessenger.sol';
import {ICrossDomainMessenger} from '../dependencies/optimism/interfaces/ICrossDomainMessenger.sol';
import {MockOvmL2CrossDomainMessenger} from './MockOvmL2CrossDomainMessenger.sol';

contract MockOvmL1CrossDomainMessenger is ICrossDomainMessenger {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/MockOvmL2CrossDomainMessenger.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.10;

import {ICrossDomainMessenger} from '../interfaces/ICrossDomainMessenger.sol';
import {ICrossDomainMessenger} from '../dependencies/optimism/interfaces/ICrossDomainMessenger.sol';
import {MockOvmL1CrossDomainMessenger} from './MockOvmL1CrossDomainMessenger.sol';

contract MockOvmL2CrossDomainMessenger is ICrossDomainMessenger {
Expand Down
6 changes: 3 additions & 3 deletions tasks/l2/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { eArbitrumNetwork, eEthereumNetwork } from '../../helpers/types';
import {
ArbitrumBridgeExecutor__factory,
Greeter__factory,
IArbRetryableTx__factory,
ArbRetryableTx__factory,
IInbox__factory,
} from '../../typechain';

Expand Down Expand Up @@ -107,7 +107,7 @@ task(
const inbox = IInbox__factory.connect(INBOX, deployer);
console.log(`INBOX at: ${inbox.address}`);

const retryable = IArbRetryableTx__factory.connect(
const retryable = ArbRetryableTx__factory.connect(
ADDRESSES['RETRYABLE_TICKET_TX_ADDRESS'],
l2Provider
);
Expand Down Expand Up @@ -189,7 +189,7 @@ task('arbitrum:redeem-retryable', 'Redeem a retryable ticket on arbitrum')
`Deployer address: ${deployer.address} (${formatUnits(await deployer.getBalance())})`
);

const retryable = IArbRetryableTx__factory.connect(
const retryable = ArbRetryableTx__factory.connect(
ADDRESSES['RETRYABLE_TICKET_TX_ADDRESS'],
deployer
);
Expand Down

0 comments on commit 303bd3e

Please sign in to comment.