I have an interface to Dai from my contract and want to allow a user to approve the contract to transfer their Dai. Dai uses DSToken code which has an approve function that relies on msg.sender:
function approve(address guy, uint wad) public returns (bool) {
_approvals[msg.sender][guy] = wad;
Approval(msg.sender, guy, wad);
return true;
}
I have an interface my contract inherits which calls the interface contract like
contract DaiInterface {
function approve(address guy, uint wad) public returns (bool);
}
contract DaiTransferrer is Ownable {
DaiInterface daiContract;
function approveDai(address guy, uint wad) public {
daiContract.approve(guy, wad);
}
}
So the problem is that msg.sender changes by the time it gets to the token contract so I think the interface code gets approved rather than main contract which needs to transfer the Dai. What's the best way to solve this?