Reputation: 447
I am trying to deposit, trade/order, and withdraw tokens and ether from EtherDelta exchange using a contract. My understanding is that the best approach to this is that I create an interface of the functions of ether delta and create an instance of the real EtherDelta in my contract. The problem I am dealing with however is that, let say I deposit tokens from a contract to EtherDelta, I believe EtherDelta takes note of the msg.sender as the owner of those tokens. How can I have the contract be the owner, even though it is a user that calls the depositToEtherDelta function on my contract? I am trying to have the contract be the owner, not the person who called the contract function. Please help, thanks.
Upvotes: 1
Views: 2238
Reputation: 56
I guess you are confusing msg.sender et tx.origin tx.origin is the user that calls the function, but if your contract call the EtherDelta contract then msg.sender should be correctly set
By the way, using tx.origin is not a recommended practice. It's better to propagate the origin through functions parameters (this keyword).
Upvotes: 1