Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
34 changes: 0 additions & 34 deletions contracts/Lock.sol

This file was deleted.

21 changes: 21 additions & 0 deletions contracts/ccip_token_transfer/LinkiSwapMultipleFeeTokenSender.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/
import {OwnerIsCreator} from "@chainlink/contracts-ccip/src/v0.8/shared/access/OwnerIsCreator.sol";
import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";
import {IERC20} from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.0/token/ERC20/IERC20.sol";
import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

contract LinkiSwapMultipleFeeTokenTransferor is OwnerIsCreator {

Expand Down Expand Up @@ -32,12 +33,18 @@ contract LinkiSwapMultipleFeeTokenTransferor is OwnerIsCreator {

IERC20 private s_linkToken;

AggregatorV3Interface internal dataFeed;

/// @notice Constructor initializes the contract with the router address.
/// @param _router The address of the router contract.
/// @param _link The address of the link contract.
constructor(address _router, address _link) {
s_router = IRouterClient(_router);
s_linkToken = IERC20(_link);

// BTC/ETH price feed contract address
dataFeed = AggregatorV3Interface(0x5fb1616F78dA7aFC9FF79e0371741a747D2a7F22);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add feed contract for all the pairs currently on testnet.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Testnet, I think it's just BTC to ETH that is available for crypto-to-crypto pairs, others are Crypto to USD. Except you want me to include the Mainnet assets which includes several crypto to crypto pairs.?
Uploading Screenshot 2023-12-10 at 04.15.29.png…

// Other price feed for other cryptos should be initialise here
}

/// @dev Modifier that checks if the chain with the given destinationChainSelector is allowlisted.
Expand Down Expand Up @@ -229,6 +236,20 @@ contract LinkiSwapMultipleFeeTokenTransferor is OwnerIsCreator {
/// It is automatically called when Ether is transferred to the contract without any data.
receive() external payable {}

/**
* Returns the latest answer.
*/
function getChainlinkDataFeedLatestAnswer() public view returns (int) {
(
/* uint80 roundID */,
int answer,
/*uint startedAt*/,
/*uint timeStamp*/,
/*uint80 answeredInRound*/
) = dataFeed.latestRoundData();
return answer;
}

/// @notice Allows the contract owner to withdraw the entire balance of Ether from the contract.
/// @dev This function reverts if there are no funds to withdraw or if the transfer fails.
/// It should only be callable by the owner of the contract.
Expand Down