From 4d39b55e649252ae22ad8ef90d58cdba878e7178 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Wed, 10 Apr 2024 13:43:58 -0500 Subject: [PATCH] Disable REP transfer and transferFrom --- ethereum/contracts/Onboarding.sol | 8 ++++++-- ethereum/contracts/core/Reputation.sol | 13 +++++++++++++ ethereum/test/Work1.js | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ethereum/contracts/Onboarding.sol b/ethereum/contracts/Onboarding.sol index af82a9e..bb498a2 100644 --- a/ethereum/contracts/Onboarding.sol +++ b/ethereum/contracts/Onboarding.sol @@ -42,8 +42,12 @@ contract Onboarding is WorkContract, IOnValidate { abi.encode(requestIndex) ); // We have an approval from stake.worker to transfer up to stake.amount - dao.transferFrom(stake.worker, address(this), stake.amount); - dao.stakeOnValidationPool(poolIndex, stake.amount, true); + dao.delegatedStakeOnValidationPool( + poolIndex, + stake.worker, + stake.amount, + true + ); } /// Callback to be executed when review pool completes diff --git a/ethereum/contracts/core/Reputation.sol b/ethereum/contracts/core/Reputation.sol index b166bcf..3ad4250 100644 --- a/ethereum/contracts/core/Reputation.sol +++ b/ethereum/contracts/core/Reputation.sol @@ -7,6 +7,19 @@ contract Reputation is ERC20("Reputation", "REP") { function decimals() public pure override returns (uint8) { return 9; } + + //function stake(address to, uint amount) public {} + function transfer(address, uint256) public pure override returns (bool) { + revert("REP transfer is not allowed"); + } + + function transferFrom( + address, + address, + uint256 + ) public pure override returns (bool) { + revert("REP transfer is not allowed"); + } } // TODO: try implementing as ERC721 diff --git a/ethereum/test/Work1.js b/ethereum/test/Work1.js index 0bebba0..7dd6f12 100644 --- a/ethereum/test/Work1.js +++ b/ethereum/test/Work1.js @@ -262,5 +262,7 @@ describe('Work1', () => { await work1.proposeNewPrice(12345, 'content-id', [1, 1, 1]); expect(await proposals.proposalCount()).to.equal(1); }); + + // TODO: can accept a new price }); });