sugarskins/csgo-steam-eth-trade

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

Opened this issue · 2 comments

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.

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");