Updates:
Had a call with Sultan and he will share a workflow proposal.
With some help from our bot friends:
To automatically distribute non-transferrable ERC20 token $sweat when making payments to contributors in $TDF tokens, you will need to create a smart contract that handles the distribution. Here's a high-level overview of the steps involved:
Overall, creating a smart contract to automatically distribute non-transferrable ERC20 token $sweat when making payments to contributors in $TDF tokens is a feasible approach. However, you will need to have a good understanding of smart contract development and ERC20 tokens to implement this solution effectively.
Sample contract
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract SweatToken {
IERC20 public tdfToken;
IERC20 public sweatToken;
uint public sweatPerTDF;
constructor(IERC20 _tdfToken, IERC20 _sweatToken, uint _sweatPerTDF) {
tdfToken = _tdfToken;
sweatToken = _sweatToken;
sweatPerTDF = _sweatPerTDF;
}
function distributeSweat() public {
uint tdfBalance = tdfToken.balanceOf(msg.sender);
require(tdfBalance >= sweatPerTDF, "Not enough TDF tokens");
uint sweatAmount = tdfBalance / sweatPerTDF;
require(sweatToken.balanceOf(address(this)) >= sweatAmount, "Not enough sweat tokens");
tdfToken.transferFrom(msg.sender, address(this), tdfBalance);
sweatToken.transfer(msg.sender, sweatAmount);
}
}