I have a requirement where we are building a platform that receives funds on Ethereum L1 and sends that fund back to the same address on polygon L2. I know bridges are there to transfer funds from l1 to l2 but they don't want it. I have tried sending weth in a smart contract which I have deployed on polygon but it doesn't work below is the code. What I have done is define the interface of the Ethereum contract on polygon and declare some methods of eth contract. Any hint would be appreciated. Thanks
Code:
pragma solidity ^0.8.0;
interface EthToken{
function approve()external returns(bool);
function transferFrom()external returns(bool);
function name()external returns(string memory);
function totalSupply()external returns(uint256);
function transfer(address add, uint256 amount) external returns(bool);
}
contract getFunds{
EthToken token = EthToken(0xA6FA4fB5f76172d178d61B04b0ecd319C5d1C0aa);
// we write out all the global variables.
address payable public requester;
address[] public senders;
function generateRequest() public {
requester = payable(msg.sender);
}
function transferEth(address add)public returns(bool){
token.transfer(add, 1000000 wei);
return true;
}
function name()public returns(string memory){
return token.name();
}
function totalSupply() public returns(uint256){
uint256 supply = token.totalSupply();
return supply;
}
function getContractBalance()public view returns(uint256){
return address(this).balance;
}
function donate() public payable {
// we ensure that there is a minimum value of wei that can be sent
require(msg.value > 100000 gwei);
senders.push(msg.sender);
}
function makePayment() public{
require(requester == msg.sender);
requester.transfer(address(this).balance);
senders = new address[](0);
}
function getSenders() public view returns(address[] memory){
return senders;
}
}```