Last active
September 22, 2020 07:34
-
-
Save krebernisak/c55b8267b0721b55f5100cd3f7a0be5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
@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.
Alright 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well not associating address
0x0
, in events will cause issue, and it'll not get included in checkpoint. That's the idea while check pointing. Can you fix that ?