Skip to content

Instantly share code, notes, and snippets.

@krebernisak
Last active September 22, 2020 07:34
Show Gist options
  • Save krebernisak/c55b8267b0721b55f5100cd3f7a0be5f to your computer and use it in GitHub Desktop.
Save krebernisak/c55b8267b0721b55f5100cd3f7a0be5f to your computer and use it in GitHub Desktop.
pragma solidity ^0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/token/ERC20/IERC20.sol";
contract LinkTokenOnMatic {
IERC20 public token;
// child chain manager
address public depositor;
address public deployer;
// This is the address of deployed & unchanged v4 LinkToken
constructor(address _token) public {
token = IERC20(_token);
require(token.totalSupply() == token.balanceOf(address(this)), "I need to have it all.");
// child chain manager proxy
depositor = 0xb5505a6d998549090530911180f38aC5130101c6;
deployer = msg.sender;
}
function updateDepositor(address newDespositor) external {
require(msg.sender == deployer, "You can't update me");
depositor = newDespositor;
}
// additional methods needed for enabling cross chain asset transfer
function deposit(address user, bytes calldata depositData) external {
require(msg.sender == depositor, "Only ChildChainManager can deposit");
require(user != address(0), "Not a valid address");
uint256 amount = abi.decode(depositData, (uint256));
token.transfer(user, amount);
}
function withdraw(uint256 amount) external {
token.transferFrom(msg.sender, address(this), amount);
}
}
@krebernisak
Copy link
Author

@itzmeanjan consider this proposal and discussion deprecated. I am working on a new implementation that will hopefully be ready for a test run in a day or two.

You can take a peek here.

@itzmeanjan
Copy link

Alright 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment