sugarskins / csgo-steam-eth-trade

secure trading of CS:GO Steam community market weapons without a trusted third-party middleman
GNU General Public License v3.0
7 stars 1 forks source link

investigate using 1 contract for all trades on the main-net #9

Open danoctavian opened 4 years ago

danoctavian commented 4 years ago

Currently the contract is assumed to be unique per vendor since the vendor (owner) deposits LINK in order to request chainlink oracles to validate item delivery, so all the vendor specific are currently marked with the modifier onlyOwner.

This simplifies things but means that there will be many contracts in existence and a vendor needs to deploy a contract.

Investigate the possibility of using just 1 contract to manage all trades and see if that improves the UX of buyers/sellers and whether it detracts from security or overall complexity.

danoctavian commented 4 years ago

This would require managing LINK funds per individual vendor. Payments using a particular ERC20 token can be achieved by using

a call to approve before calling the contract with this:

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol#L50

then the contract can claim the funds with a call such as this:

IERC20.IERC20 erc20 = IERC20.IERC20('token_address');
require(erc20.transferFrom(msg.sender, address(this), value), "Transfer failed");
danoctavian commented 4 years ago

solving as part of this https://github.com/sugarskins/csgo-steam-eth-trade/pull/17/files