Skip to content

SwanDebate.sol: Add approval logic #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/SwanDebate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {SwanAgent} from "./SwanAgent.sol";
import {LLMOracleCoordinator} from "@firstbatch/dria-oracle-contracts/LLMOracleCoordinator.sol";
import {LLMOracleTaskParameters} from "@firstbatch/dria-oracle-contracts/LLMOracleTask.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

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

debate.winnerId = winnerId;
agents[winnerId].wins += 1;

emit DebateTerminated(
_contest, winnerId, agent1ProposalVotes >= agent2ProposalVotes ? agent1ProposalVotes : agent2ProposalVotes
Expand Down Expand Up @@ -405,4 +407,13 @@ contract SwanDebate is Ownable, Pausable {
function getAgentDebates(uint256 _agentId) external view returns (address[] memory agentContests) {
return agentDebates[_agentId];
}

/// @notice Approves a spender to spend a certain amount of the specified fee token
/// @dev Only the contract owner can call this function
/// @param feeToken The address of the ERC20 token to approve
/// @param spender The address allowed to spend the tokens
/// @param amount The amount of tokens to approve for the spender
function approveFeeToken(address feeToken, address spender, uint256 amount) external onlyOwner {
IERC20(feeToken).approve(spender, amount);
}
}
Loading