Skip to content

Commit

Permalink
fix: transfer to specific address
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Jan 25, 2024
1 parent 552fbf1 commit 4db5f58
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
19 changes: 17 additions & 2 deletions src/Auctions/Auction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ contract Auction is Governance {
uint256 initialAvailable;
uint256 currentAvailable;
uint256 minimumPrice;
address receiver;
bool active;
}

Expand Down Expand Up @@ -196,7 +197,16 @@ contract Auction is Governance {
address _from,
address _to,
uint256 _minimumPrice
) external virtual onlyGovernance returns (bytes32 _auctionId) {
) external virtual returns (bytes32) {
return enableAuction(_from, _to, _minimumPrice, governance);
}

function enableAuction(
address _from,
address _to,
uint256 _minimumPrice,
address _receiver

Check warning on line 208 in src/Auctions/Auction.sol

View workflow job for this annotation

GitHub Actions / solidity

Variable "_receiver" is unused
) public virtual onlyGovernance returns (bytes32 _auctionId) {
require(_from != address(0) && _to != address(0), "ZERO ADDRESS");
require(_from != address(this) && _to != address(this), "SELF");

Expand All @@ -212,6 +222,7 @@ contract Auction is Governance {
initialAvailable: 0,
currentAvailable: 0,
minimumPrice: _minimumPrice,
receiver: address,
active: true
});

Expand Down Expand Up @@ -306,7 +317,11 @@ contract Auction is Governance {
auctions[_id].currentAvailable = left;

// Pull token in.
ERC20(auction.toToken).transferFrom(msg.sender, address(this), needed);
ERC20(auction.toToken).transferFrom(
msg.sender,
auction.receiver,
needed
);

// Transfer from token out.
ERC20(auction.fromToken).transfer(_receiver, _amountTaken);
Expand Down
3 changes: 1 addition & 2 deletions src/swappers/AuctionSwapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract AuctionSwapper {
auction = _auction;
}
// Enable new auction.
Auction(_auction).enableAuction(_from, _to, _minimumPrice);
Auction(_auction).enableAuction(_from, _to, _minimumPrice, receiver);
}

function _disableAuction(address _from, address _to) internal virtual {
Expand Down Expand Up @@ -76,7 +76,6 @@ contract AuctionSwapper {
address _token,
uint256 _newAmount
) external virtual onlyAuction {
ERC20(_token).transferFrom(auction, address(this), _newAmount);
_postTake(_token, _newAmount);
}

Expand Down

0 comments on commit 4db5f58

Please sign in to comment.