Skip to content

Commit d5e58b0

Browse files
committed
SwanDebate.sol: Add approval logic
1 parent 39e2d89 commit d5e58b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/SwanDebate.sol

+11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
66
import {SwanAgent} from "./SwanAgent.sol";
77
import {LLMOracleCoordinator} from "@firstbatch/dria-oracle-contracts/LLMOracleCoordinator.sol";
88
import {LLMOracleTaskParameters} from "@firstbatch/dria-oracle-contracts/LLMOracleTask.sol";
9+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
910

1011
/// @notice Interface for JokeRace contest interactions
1112
/// @dev Provides functions to interact with JokeRace contests and query their state
@@ -337,6 +338,7 @@ contract SwanDebate is Ownable, Pausable {
337338
}
338339

339340
debate.winnerId = winnerId;
341+
agents[winnerId].wins += 1;
340342

341343
emit DebateTerminated(
342344
_contest, winnerId, agent1ProposalVotes >= agent2ProposalVotes ? agent1ProposalVotes : agent2ProposalVotes
@@ -405,4 +407,13 @@ contract SwanDebate is Ownable, Pausable {
405407
function getAgentDebates(uint256 _agentId) external view returns (address[] memory agentContests) {
406408
return agentDebates[_agentId];
407409
}
410+
411+
/// @notice Approves a spender to spend a certain amount of the specified fee token
412+
/// @dev Only the contract owner can call this function
413+
/// @param feeToken The address of the ERC20 token to approve
414+
/// @param spender The address allowed to spend the tokens
415+
/// @param amount The amount of tokens to approve for the spender
416+
function approveFeeToken(address feeToken, address spender, uint256 amount) external onlyOwner {
417+
IERC20(feeToken).approve(spender, amount);
418+
}
408419
}

0 commit comments

Comments
 (0)