Skip to content

Commit

Permalink
feat: change tx.origin to msg.sender (#113)
Browse files Browse the repository at this point in the history
* feat: change tx.origin to msg.sender

* chore: devnet upgrades
  • Loading branch information
scolear authored Sep 23, 2024
1 parent ccf53a6 commit 7b901b6
Show file tree
Hide file tree
Showing 8 changed files with 1,455 additions and 32 deletions.
476 changes: 476 additions & 0 deletions .openzeppelin/base-sepolia.json

Large diffs are not rendered by default.

476 changes: 476 additions & 0 deletions .openzeppelin/sepolia.json

Large diffs are not rendered by default.

476 changes: 476 additions & 0 deletions .openzeppelin/unknown-421614.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions contracts/DLCManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ contract DLCManager is
}

modifier onlyVaultCreator(bytes32 _uuid) {
if (dlcs[dlcIDsByUUID[_uuid]].creator != tx.origin) revert NotOwner();
if (dlcs[dlcIDsByUUID[_uuid]].creator != msg.sender) revert NotOwner();
_;
}

Expand Down Expand Up @@ -282,15 +282,15 @@ contract DLCManager is
onlyWhitelisted
returns (bytes32)
{
bytes32 _uuid = _generateUUID(tx.origin, _index);
bytes32 _uuid = _generateUUID(msg.sender, _index);

dlcs[_index] = DLCLink.DLC({
uuid: _uuid,
protocolContract: msg.sender, // deprecated
valueLocked: 0,
valueMinted: 0,
timestamp: block.timestamp,
creator: tx.origin,
creator: msg.sender,
status: DLCLink.DLCStatus.READY,
fundingTxId: "",
closingTxId: "",
Expand All @@ -301,10 +301,10 @@ contract DLCManager is
taprootPubKey: ""
});

emit CreateDLC(_uuid, tx.origin, block.timestamp);
emit CreateDLC(_uuid, msg.sender, block.timestamp);

dlcIDsByUUID[_uuid] = _index;
userVaults[tx.origin].push(_uuid);
userVaults[msg.sender].push(_uuid);
_index++;

return _uuid;
Expand Down
12 changes: 3 additions & 9 deletions deploymentFiles/arbsepolia/DLCManager.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "arbsepolia",
"updatedAt": "2024-08-21T18:35:51.183Z",
"gitSHA": "2e422e6",
"updatedAt": "2024-09-18T15:16:21.428Z",
"gitSHA": "ce5f215",
"contract": {
"name": "DLCManager",
"address": "0xE8FA6399d1b60968f04888F23Ed13Ed499C1Fd51",
Expand Down Expand Up @@ -41,7 +41,6 @@
"event DefaultAdminTransferScheduled(address indexed newAdmin, uint48 acceptSchedule)",
"event Initialized(uint8 version)",
"event Mint(address to, uint256 amount)",
"event NewDLCManagerContract(address newDLCManagerAddress)",
"event Paused(address account)",
"event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)",
"event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)",
Expand All @@ -67,7 +66,6 @@
"function acceptDefaultAdminTransfer()",
"function attestorGroupPubKey() view returns (string)",
"function beginDefaultAdminTransfer(address newAdmin)",
"function blacklistOnTokenContract(address account)",
"function btcFeeRecipient() view returns (string)",
"function btcMintFeeRate() view returns (uint256)",
"function btcRedeemFeeRate() view returns (uint256)",
Expand All @@ -91,7 +89,6 @@
"function getVault(bytes32 uuid) view returns (tuple(bytes32 uuid, address protocolContract, uint256 timestamp, uint256 valueLocked, address creator, uint8 status, string fundingTxId, string closingTxId, string btcFeeRecipient, uint256 btcMintFeeBasisPoints, uint256 btcRedeemFeeBasisPoints, string taprootPubKey, uint256 valueMinted, string wdTxId))",
"function grantRole(bytes32 role, address account)",
"function hasRole(bytes32 role, address account) view returns (bool)",
"function importData(address _dlcBTC, string _btcFeeRecipient, uint256 _minimumDeposit, uint256 _maximumDeposit, uint256 _btcMintFeeRate, uint256 _btcRedeemFeeRate, bool _whitelistingEnabled)",
"function initialize(address defaultAdmin, address dlcAdminRole, uint16 threshold, address tokenContract, string btcFeeRecipientToSet)",
"function isWhitelisted(address account) view returns (bool)",
"function maximumDeposit() view returns (uint256)",
Expand All @@ -106,6 +103,7 @@
"function rollbackDefaultAdminDelay()",
"function setAttestorGroupPubKey(string pubKey)",
"function setBtcFeeRecipient(string btcFeeRecipientToSet)",
"function setBtcFeeRecipientForVault(bytes32 uuid, string btcFeeRecipientToSet)",
"function setBtcMintFeeRate(uint256 newBtcMintFeeRate)",
"function setBtcRedeemFeeRate(uint256 newBtcRedeemFeeRate)",
"function setBurnerOnTokenContract(address burner)",
Expand All @@ -116,15 +114,11 @@
"function setStatusPending(bytes32 uuid, string wdTxId, bytes[] signatures, string taprootPubKey, uint256 newValueLocked)",
"function setTSSCommitment(bytes32 commitment)",
"function setThreshold(uint16 newThreshold)",
"function setUserVaultUUIDs(address user, bytes32[] uuids)",
"function setValueLocked(bytes32 uuid, uint256 valueLocked)",
"function setValueMinted(bytes32 uuid, uint256 valueMinted)",
"function setWhitelistingEnabled(bool isWhitelistingEnabled)",
"function setupVault() returns (bytes32)",
"function supportsInterface(bytes4 interfaceId) view returns (bool)",
"function transferTokenContractOwnership(address newOwner)",
"function tssCommitment() view returns (bytes32)",
"function unblacklistOnTokenContract(address account)",
"function unpauseContract()",
"function unwhitelistAddress(address addressToUnWhitelist)",
"function userVaults(address, uint256) view returns (bytes32)",
Expand Down
11 changes: 2 additions & 9 deletions deploymentFiles/basesepolia/DLCManager.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "basesepolia",
"updatedAt": "2024-08-21T17:54:50.155Z",
"gitSHA": "7fccf02",
"updatedAt": "2024-09-18T15:15:32.790Z",
"gitSHA": "ce5f215",
"contract": {
"name": "DLCManager",
"address": "0x050C24dBf1eEc17babE5fc585F06116A259CC77A",
Expand Down Expand Up @@ -41,7 +41,6 @@
"event DefaultAdminTransferScheduled(address indexed newAdmin, uint48 acceptSchedule)",
"event Initialized(uint8 version)",
"event Mint(address to, uint256 amount)",
"event NewDLCManagerContract(address newDLCManagerAddress)",
"event Paused(address account)",
"event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)",
"event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)",
Expand All @@ -67,7 +66,6 @@
"function acceptDefaultAdminTransfer()",
"function attestorGroupPubKey() view returns (string)",
"function beginDefaultAdminTransfer(address newAdmin)",
"function blacklistOnTokenContract(address account)",
"function btcFeeRecipient() view returns (string)",
"function btcMintFeeRate() view returns (uint256)",
"function btcRedeemFeeRate() view returns (uint256)",
Expand All @@ -91,7 +89,6 @@
"function getVault(bytes32 uuid) view returns (tuple(bytes32 uuid, address protocolContract, uint256 timestamp, uint256 valueLocked, address creator, uint8 status, string fundingTxId, string closingTxId, string btcFeeRecipient, uint256 btcMintFeeBasisPoints, uint256 btcRedeemFeeBasisPoints, string taprootPubKey, uint256 valueMinted, string wdTxId))",
"function grantRole(bytes32 role, address account)",
"function hasRole(bytes32 role, address account) view returns (bool)",
"function importData(address _dlcBTC, string _btcFeeRecipient, uint256 _minimumDeposit, uint256 _maximumDeposit, uint256 _btcMintFeeRate, uint256 _btcRedeemFeeRate, bool _whitelistingEnabled)",
"function initialize(address defaultAdmin, address dlcAdminRole, uint16 threshold, address tokenContract, string btcFeeRecipientToSet)",
"function isWhitelisted(address account) view returns (bool)",
"function maximumDeposit() view returns (uint256)",
Expand All @@ -117,15 +114,11 @@
"function setStatusPending(bytes32 uuid, string wdTxId, bytes[] signatures, string taprootPubKey, uint256 newValueLocked)",
"function setTSSCommitment(bytes32 commitment)",
"function setThreshold(uint16 newThreshold)",
"function setUserVaultUUIDs(address user, bytes32[] uuids)",
"function setValueLocked(bytes32 uuid, uint256 valueLocked)",
"function setValueMinted(bytes32 uuid, uint256 valueMinted)",
"function setWhitelistingEnabled(bool isWhitelistingEnabled)",
"function setupVault() returns (bytes32)",
"function supportsInterface(bytes4 interfaceId) view returns (bool)",
"function transferTokenContractOwnership(address newOwner)",
"function tssCommitment() view returns (bytes32)",
"function unblacklistOnTokenContract(address account)",
"function unpauseContract()",
"function unwhitelistAddress(address addressToUnWhitelist)",
"function userVaults(address, uint256) view returns (bytes32)",
Expand Down
11 changes: 2 additions & 9 deletions deploymentFiles/sepolia/DLCManager.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"network": "sepolia",
"updatedAt": "2024-08-21T18:05:02.207Z",
"gitSHA": "492e8fd",
"updatedAt": "2024-09-18T15:22:32.790Z",
"gitSHA": "ce5f215",
"contract": {
"name": "DLCManager",
"address": "0x2bAa7E92F3F14883264BfA63058cC223Ad719438",
Expand Down Expand Up @@ -41,7 +41,6 @@
"event DefaultAdminTransferScheduled(address indexed newAdmin, uint48 acceptSchedule)",
"event Initialized(uint8 version)",
"event Mint(address to, uint256 amount)",
"event NewDLCManagerContract(address newDLCManagerAddress)",
"event Paused(address account)",
"event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)",
"event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)",
Expand All @@ -67,7 +66,6 @@
"function acceptDefaultAdminTransfer()",
"function attestorGroupPubKey() view returns (string)",
"function beginDefaultAdminTransfer(address newAdmin)",
"function blacklistOnTokenContract(address account)",
"function btcFeeRecipient() view returns (string)",
"function btcMintFeeRate() view returns (uint256)",
"function btcRedeemFeeRate() view returns (uint256)",
Expand All @@ -91,7 +89,6 @@
"function getVault(bytes32 uuid) view returns (tuple(bytes32 uuid, address protocolContract, uint256 timestamp, uint256 valueLocked, address creator, uint8 status, string fundingTxId, string closingTxId, string btcFeeRecipient, uint256 btcMintFeeBasisPoints, uint256 btcRedeemFeeBasisPoints, string taprootPubKey, uint256 valueMinted, string wdTxId))",
"function grantRole(bytes32 role, address account)",
"function hasRole(bytes32 role, address account) view returns (bool)",
"function importData(address _dlcBTC, string _btcFeeRecipient, uint256 _minimumDeposit, uint256 _maximumDeposit, uint256 _btcMintFeeRate, uint256 _btcRedeemFeeRate, bool _whitelistingEnabled)",
"function initialize(address defaultAdmin, address dlcAdminRole, uint16 threshold, address tokenContract, string btcFeeRecipientToSet)",
"function isWhitelisted(address account) view returns (bool)",
"function maximumDeposit() view returns (uint256)",
Expand All @@ -117,15 +114,11 @@
"function setStatusPending(bytes32 uuid, string wdTxId, bytes[] signatures, string taprootPubKey, uint256 newValueLocked)",
"function setTSSCommitment(bytes32 commitment)",
"function setThreshold(uint16 newThreshold)",
"function setUserVaultUUIDs(address user, bytes32[] uuids)",
"function setValueLocked(bytes32 uuid, uint256 valueLocked)",
"function setValueMinted(bytes32 uuid, uint256 valueMinted)",
"function setWhitelistingEnabled(bool isWhitelistingEnabled)",
"function setupVault() returns (bytes32)",
"function supportsInterface(bytes4 interfaceId) view returns (bool)",
"function transferTokenContractOwnership(address newOwner)",
"function tssCommitment() view returns (bytes32)",
"function unblacklistOnTokenContract(address account)",
"function unpauseContract()",
"function unwhitelistAddress(address addressToUnWhitelist)",
"function userVaults(address, uint256) view returns (bytes32)",
Expand Down
15 changes: 15 additions & 0 deletions scripts/helpers/devnet-call-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Check if the command line argument is provided
if [ $# -eq 0 ]; then
echo "Please provide a command argument."
exit 1
fi

# Assign the command line argument to a variable
command=$1
extra_args="${@:2}"

HARDHAT_NETWORK=basesepolia dlc-link-eth $command $extra_args
HARDHAT_NETWORK=arbsepolia dlc-link-eth $command $extra_args
HARDHAT_NETWORK=sepolia dlc-link-eth $command $extra_args

0 comments on commit 7b901b6

Please sign in to comment.