Skip to content

Commit

Permalink
use toTopic
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Oct 31, 2023
1 parent 4f8cd8d commit 70446e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Expand Up @@ -10,6 +10,7 @@ import { ALLOWANCES_NAME, BALANCES_NAME, METADATA_NAME } from "./constants.sol";

import { AccessControlLib } from "../../utils/AccessControlLib.sol";
import { PuppetMaster } from "../puppet/PuppetMaster.sol";
import { toTopic } from "../puppet/utils.sol";

import { IERC20Mintable } from "./IERC20Mintable.sol";

Expand All @@ -18,7 +19,7 @@ import { Balances } from "./tables/Balances.sol";
import { TotalSupply } from "./tables/TotalSupply.sol";
import { Metadata } from "./tables/Metadata.sol";

import { _allowancesTableId, _balancesTableId, _totalSupplyTableId, _metadataTableId, _toBytes32 } from "./utils.sol";
import { _allowancesTableId, _balancesTableId, _totalSupplyTableId, _metadataTableId } from "./utils.sol";

contract ERC20System is System, IERC20Mintable, PuppetMaster {
using WorldResourceIdInstance for ResourceId;
Expand Down Expand Up @@ -231,7 +232,7 @@ contract ERC20System is System, IERC20Mintable, PuppetMaster {
}

// Emit Transfer event on puppet
puppet().log(Transfer.selector, _toBytes32(from), _toBytes32(to), abi.encode(value));
puppet().log(Transfer.selector, toTopic(from), toTopic(to), abi.encode(value));
}

/**
Expand All @@ -252,7 +253,7 @@ contract ERC20System is System, IERC20Mintable, PuppetMaster {
Allowances.set(_allowancesTableId(_namespace()), owner, spender, value);

// Emit Approval event on puppet
puppet().log(Approval.selector, _toBytes32(owner), _toBytes32(spender), abi.encode(value));
puppet().log(Approval.selector, toTopic(owner), toTopic(spender), abi.encode(value));
}

/**
Expand Down
4 changes: 0 additions & 4 deletions packages/world-modules/src/modules/erc20-puppet/utils.sol
Expand Up @@ -25,10 +25,6 @@ function _metadataTableId(bytes14 namespace) pure returns (ResourceId) {
return WorldResourceIdLib.encode({ typeId: RESOURCE_TABLE, namespace: namespace, name: METADATA_NAME });
}

function _toBytes32(address addr) pure returns (bytes32) {
return bytes32(uint256(uint160(addr)));
}

function _erc20SystemId(bytes14 namespace) pure returns (ResourceId) {
return WorldResourceIdLib.encode({ typeId: RESOURCE_SYSTEM, namespace: namespace, name: ERC20_SYSTEM_NAME });
}

0 comments on commit 70446e7

Please sign in to comment.