Skip to content

Instantly share code, notes, and snippets.

@kien-ngo
Created January 6, 2023 00:44
Show Gist options
  • Select an option

  • Save kien-ngo/38d02af83bbb2f6b3d3651b532849353 to your computer and use it in GitHub Desktop.

Select an option

Save kien-ngo/38d02af83bbb2f6b3d3651b532849353 to your computer and use it in GitHub Desktop.
USDC (Polygon) Receiver contract
pragma solidity ^0.8.17;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/utils/SafeERC20.sol";
contract USDCPolygonReceiver {
SafeERC20 public token; // Syntax is wrong here?!
// This is the USDC contract address on Polygon, hard-coded
address public usdcContractAddress = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174;
// MOME receiving address
// address public desiredAddress = 0xbc70651e0cbaa2433f382b03b650a13d37877673;
constructor() public {
token = SafeERC20(usdcContractAddress);
}
function transfer(address _to, uint256 _value) public {
// require(_to == desiredAddress, "Invalid transfer destination");
require(_to != address(0), "Cannot transfer to 0x0 address");
require(_value > 0, "Cannot transfer 0 or negative value");
token.transfer(_to, _value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment