Skip to content

Commit

Permalink
Fix bytes32 toString bug (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
waynehoover authored Dec 23, 2023
1 parent 8adb30f commit 5695678
Show file tree
Hide file tree
Showing 24 changed files with 1,884 additions and 190 deletions.
54 changes: 54 additions & 0 deletions broadcast/QuestFactory.s.sol/10/run-1703359823.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/10/run-1703359830.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/10/run-1703359848.json

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions broadcast/QuestFactory.s.sol/10/run-1703361667.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/10/run-1703361674.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/10/run-1703361692.json

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions broadcast/QuestFactory.s.sol/10/run-latest.json

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions broadcast/QuestFactory.s.sol/11155111/run-1703361553.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/11155111/run-1703361566.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/11155111/run-1703361611.json

Large diffs are not rendered by default.

76 changes: 38 additions & 38 deletions broadcast/QuestFactory.s.sol/11155111/run-latest.json

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions broadcast/QuestFactory.s.sol/137/run-1703361704.json

Large diffs are not rendered by default.

145 changes: 145 additions & 0 deletions broadcast/QuestFactory.s.sol/137/run-1703361712.json

Large diffs are not rendered by default.

145 changes: 145 additions & 0 deletions broadcast/QuestFactory.s.sol/137/run-1703361741.json

Large diffs are not rendered by default.

108 changes: 54 additions & 54 deletions broadcast/QuestFactory.s.sol/137/run-latest.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/42161/run-1703361638.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/42161/run-1703361656.json

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions broadcast/QuestFactory.s.sol/42161/run-latest.json

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions broadcast/QuestFactory.s.sol/8453/run-1703361751.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/8453/run-1703361758.json

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions broadcast/QuestFactory.s.sol/8453/run-1703361776.json

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions broadcast/QuestFactory.s.sol/8453/run-latest.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion contracts/QuestFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto

string memory questIdString_ = bytes16ToUUID(questid_);
Quest storage quest_ = quests[questIdString_];
string memory jsonData_ = buildJsonString(uint256(txHash_).toHexString(), uint256(txHashChainId_).toString(), quest_.actionType, quest_.questName);
string memory jsonData_ = buildJsonString(uint256(txHash_).toHexString(32), uint256(txHashChainId_).toString(), quest_.actionType, quest_.questName);
bytes memory claimData_ = abi.encode(msg.sender, ref_, questIdString_, jsonData_);

this.claimOptimized{value: msg.value}(abi.encodePacked(r_,vs_), claimData_);
Expand Down Expand Up @@ -542,6 +542,10 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto
emit MintFeePaid(questId_, protocolFeeRecipient_, protocolPayout_, mintFeeRecipient_, mintPayout, address(0), 0);
}

function getQuestName(string calldata questId_) external view returns (string memory) {
return quests[questId_].questName;
}

/*//////////////////////////////////////////////////////////////
INTERNAL UPDATE
//////////////////////////////////////////////////////////////*/
Expand Down
4 changes: 2 additions & 2 deletions test/QuestFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@ contract TestQuestFactory is Test, Errors, Events, TestUtils {
vm.warp(START_TIME + 1);

bytes16 questId = hex'550e8400e29b41d4a716446655440000';
bytes32 txHash = hex'7e1975a6bf513022a8cc382a3cdb1e1dbcd58ebb1cb9abf11e64aadb21262516';
bytes32 txHash = hex'001975a6bf513022a8cc382a3cdb1e1dbcd58ebb1cb9abf11e64aadb21262516';
uint32 txHashChainId = 101;
string memory json = '{"actionTxHashes":["0x7e1975a6bf513022a8cc382a3cdb1e1dbcd58ebb1cb9abf11e64aadb21262516"],"actionNetworkChainIds":[101],"questName":"questName","actionType":"actionType"}';
string memory json = '{"actionTxHashes":["0x001975a6bf513022a8cc382a3cdb1e1dbcd58ebb1cb9abf11e64aadb21262516"],"actionNetworkChainIds":[101],"questName":"questName","actionType":"actionType"}';
bytes memory signData = abi.encode(participant, referrer, "550e8400-e29b-41d4-a716-446655440000", json);
bytes32 msgHash = keccak256(signData);
bytes32 digest = ECDSA.toEthSignedMessageHash(msgHash);
Expand Down

0 comments on commit 5695678

Please sign in to comment.