Last active
November 10, 2020 23:26
-
-
Save nginnever/38bcb22bd17dee9f23208478a698a9d4 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
address constant public amb_mediator = 0x5275e7264AB0Bb75D970E7442De0Aadd0C0b85ae; | |
function depositAndBridge() external override payable returns (bool success) { | |
require(address(this).balance + flashSupply <= type(uint112).max, "WETH::deposit: supply limit exceeded"); | |
// Create token balance for deposit | |
balanceOf[msg.sender] += msg.value; | |
// Approve the new tokens to the mediator contract | |
allowance[msg.sender][amb_mediator] = msg.value; | |
emit Approval(msg.sender, amb_mediator, msg.value); | |
// Transfer new tokens to mediator contract here to lock newly printed balance on the mediator | |
emit TransferAndBridge(address(0), msg.sender, msg.value); | |
(bool _success, bytes memory data) = amb_mediator.call(abi.encodeWithSignature("relayTokens(ERC677 token, address _receiver, uint256 _value)", address(this), msg.sender, msg.value)); | |
return true; | |
} | |
function respondToMediatorApproval(address _token, address _sender, uint256 _val) external override returns (bool success) { | |
(bool _success, bytes memory data) = amb_mediator.call(abi.encodeWithSignature("relayTokens(ERC677 token, address _receiver, uint256 _value)", _token, _sender, _val)); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment