Skip to content

Commit

Permalink
Fixed reference implementation of transferAndCallback (missing _trans…
Browse files Browse the repository at this point in the history
…fer).
  • Loading branch information
cfries committed Nov 10, 2024
1 parent 4030cd3 commit 55cfbaa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions assets/erc-6123/contracts/ERC20Settlement.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ contract ERC20Settlement is ERC20, IERC20Settlement{
}

function transferAndCallback(address to, uint256 value, uint256 transactionID, address callbackContract) public onlySDC{
if ( balanceOf(sdcAddress) < value)
if ( balanceOf(sdcAddress) < value) {
ISDC(callbackContract).afterTransfer(false, transactionID, Strings.toString(transactionID));
else
}
else {
_transfer(sdcAddress,to,value);
ISDC(callbackContract).afterTransfer(true, transactionID, Strings.toString(transactionID));
}
}

function transferFromAndCallback(address from, address to, uint256 value, uint256 transactionID, address callbackContract) external view onlySDC {
Expand All @@ -52,8 +55,9 @@ contract ERC20Settlement is ERC20, IERC20Settlement{
function transferBatchAndCallback(address[] memory to, uint256[] memory values, uint256 transactionID, address callbackContract) public onlySDC{
require (to.length == values.length, "Array Length mismatch");
uint256 requiredBalance = 0;
for(uint256 i = 0; i < values.length; i++)
for(uint256 i = 0; i < values.length; i++) {
requiredBalance += values[i];
}
if (balanceOf(msg.sender) < requiredBalance){
ISDC(callbackContract).afterTransfer(false, transactionID, Strings.toString(transactionID));
return;
Expand Down

0 comments on commit 55cfbaa

Please sign in to comment.