From eb88a3485fc550108b5bfe68c0bd4200fd0a2660 Mon Sep 17 00:00:00 2001 From: Dann Wee Date: Sat, 12 Oct 2024 03:12:29 +0800 Subject: [PATCH] feat: contracts and scripts --- .DS_Store | Bin 0 -> 6148 bytes .gitignore | 4 +- abis/ExchangeAbi.json | 174 ++++++++++ abis/RegistryAbi.json | 299 ++++++++++++++++++ .../Vault.s.sol/84532/run-1728672574.json | 29 ++ .../Vault.s.sol/84532/run-1728672710.json | 29 ++ broadcast/Vault.s.sol/84532/run-latest.json | 29 ++ data/.DS_Store | Bin 0 -> 6148 bytes foundry.toml | 1 + lib/openzeppelin-contracts | 2 +- requirements.txt | 1 + script/Counter.s.sol | 19 -- script/deploy/Exchange.s.sol | 20 ++ script/deploy/Register.s.sol | 17 + script/deploy/Vault.s.sol | 22 ++ script/python/count-uen.py | 6 + script/python/remove-status.py | 27 ++ script/python/upload-uen.py | 94 ++++++ src/Counter.sol | 14 - src/Exchange.sol | 44 +++ src/Registry.sol | 194 ++++++++++++ src/Vault.sol | 11 + test/Counter.t.sol | 24 -- utils/constants.ts | 5 + 24 files changed, 1006 insertions(+), 59 deletions(-) create mode 100644 .DS_Store create mode 100644 abis/ExchangeAbi.json create mode 100644 abis/RegistryAbi.json create mode 100644 broadcast/Vault.s.sol/84532/run-1728672574.json create mode 100644 broadcast/Vault.s.sol/84532/run-1728672710.json create mode 100644 broadcast/Vault.s.sol/84532/run-latest.json create mode 100644 data/.DS_Store create mode 100644 requirements.txt delete mode 100644 script/Counter.s.sol create mode 100644 script/deploy/Exchange.s.sol create mode 100644 script/deploy/Register.s.sol create mode 100644 script/deploy/Vault.s.sol create mode 100644 script/python/count-uen.py create mode 100644 script/python/remove-status.py create mode 100644 script/python/upload-uen.py delete mode 100644 src/Counter.sol create mode 100644 src/Exchange.sol create mode 100644 src/Registry.sol create mode 100644 src/Vault.sol delete mode 100644 test/Counter.t.sol create mode 100644 utils/constants.ts diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f4088d0a3fd4dbdc105acd5be5a3503e9df8a6c0 GIT binary patch literal 6148 zcmeHK!AiqG5Z!H~ZYe?z3Oz1(Em&K%h?fxS4;aydN=-f>& z`|W^hcUa6qR6Hxi&g2Xc^2ooHZTFvYPH60XR+uHhF#eoo-Dg^an|p3 zuxvi~bL+nL7 literal 0 HcmV?d00001 diff --git a/.gitignore b/.gitignore index c700419..3b76291 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ docs/ .env # Data -data/json/combined_uen.json \ No newline at end of file +data/json/combined_uen.json +data/json/combined_uen_no_status.json +data/json/combined_uen_no_status_og.json \ No newline at end of file diff --git a/abis/ExchangeAbi.json b/abis/ExchangeAbi.json new file mode 100644 index 0000000..898ce6a --- /dev/null +++ b/abis/ExchangeAbi.json @@ -0,0 +1,174 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_registryAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_usdcAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [], + "name": "ReentrancyGuardReentrantCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "uen", + "type": "string" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_uen", + "type": "string" + } + ], + "name": "getMerchantWalletAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "getUSDCBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "registry", + "outputs": [ + { + "internalType": "contract Registry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_uen", + "type": "string" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usdcToken", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/abis/RegistryAbi.json b/abis/RegistryAbi.json new file mode 100644 index 0000000..2fd7328 --- /dev/null +++ b/abis/RegistryAbi.json @@ -0,0 +1,299 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "uen", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "entity_name", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "owner_name", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "wallet_address", + "type": "address" + } + ], + "name": "MerchantAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "uen", + "type": "string" + } + ], + "name": "MerchantDeleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "uen", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "entity_name", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "owner_name", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "wallet_address", + "type": "address" + } + ], + "name": "MerchantUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_uen", + "type": "string" + }, + { + "internalType": "string", + "name": "_entity_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_owner_name", + "type": "string" + }, + { + "internalType": "address", + "name": "_wallet_address", + "type": "address" + } + ], + "name": "addMerchantBrandNew", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_uen", + "type": "string" + }, + { + "internalType": "string", + "name": "_entity_name", + "type": "string" + } + ], + "name": "addMerchantByAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_uen", + "type": "string" + } + ], + "name": "deleteMerchant", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getAllMerchants", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "uen", + "type": "string" + }, + { + "internalType": "string", + "name": "entity_name", + "type": "string" + }, + { + "internalType": "string", + "name": "owner_name", + "type": "string" + }, + { + "internalType": "address", + "name": "wallet_address", + "type": "address" + } + ], + "internalType": "struct Registry.Merchant[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_uen", + "type": "string" + } + ], + "name": "getMerchantByUEN", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "uen", + "type": "string" + }, + { + "internalType": "string", + "name": "entity_name", + "type": "string" + }, + { + "internalType": "string", + "name": "owner_name", + "type": "string" + }, + { + "internalType": "address", + "name": "wallet_address", + "type": "address" + } + ], + "internalType": "struct Registry.Merchant", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_wallet_address", + "type": "address" + } + ], + "name": "getMerchantByWalletAddress", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "uen", + "type": "string" + }, + { + "internalType": "string", + "name": "entity_name", + "type": "string" + }, + { + "internalType": "string", + "name": "owner_name", + "type": "string" + }, + { + "internalType": "address", + "name": "wallet_address", + "type": "address" + } + ], + "internalType": "struct Registry.Merchant", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_uen", + "type": "string" + }, + { + "internalType": "string", + "name": "_entity_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_owner_name", + "type": "string" + }, + { + "internalType": "address", + "name": "_wallet_address", + "type": "address" + } + ], + "name": "updateMerchant", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/broadcast/Vault.s.sol/84532/run-1728672574.json b/broadcast/Vault.s.sol/84532/run-1728672574.json new file mode 100644 index 0000000..0748b0d --- /dev/null +++ b/broadcast/Vault.s.sol/84532/run-1728672574.json @@ -0,0 +1,29 @@ +{ + "transactions": [ + { + "hash": null, + "transactionType": "CREATE", + "contractName": null, + "contractAddress": "0x65342d69f033d20fc3d27e9d09ab0268c218f9de", + "function": null, + "arguments": null, + "transaction": { + "from": "0x4db804ff4066a22f7883d4b133762762f7dabfba", + "gas": "0x171fea", + "value": "0x0", + "input": "0x60c06040523480156200001157600080fd5b50604051620016c5380380620016c58339810160408190526200003491620001c4565b806040518060400160405280600d81526020016c21bab132902aa9a21021b7b4b760991b81525060405180604001604052806005815260200164635553444360d81b81525081600390816200008a91906200029d565b5060046200009982826200029d565b505050600080620000b083620000df60201b60201c565b9150915081620000c2576012620000c4565b805b60ff1660a05250506001600160a01b031660805250620003b4565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691620001289162000369565b600060405180830381855afa9150503d806000811462000165576040519150601f19603f3d011682016040523d82523d6000602084013e6200016a565b606091505b50915091508180156200017f57506020815110155b15620001b7576000818060200190518101906200019d91906200039a565b905060ff8111620001b5576001969095509350505050565b505b5060009485945092505050565b600060208284031215620001d757600080fd5b81516001600160a01b0381168114620001ef57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200022157607f821691505b6020821081036200024257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000298576000816000526020600020601f850160051c81016020861015620002735750805b601f850160051c820191505b8181101562000294578281556001016200027f565b5050505b505050565b81516001600160401b03811115620002b957620002b9620001f6565b620002d181620002ca84546200020c565b8462000248565b602080601f831160018114620003095760008415620002f05750858301515b600019600386901b1c1916600185901b17855562000294565b600085815260208120601f198616915b828110156200033a5788860151825594840194600190910190840162000319565b5085821015620003595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000825160005b818110156200038c576020818601810151858301520162000370565b506000920191825250919050565b600060208284031215620003ad57600080fd5b5051919050565b60805160a0516112d6620003ef600039600061050f0152600081816102330152818161039f015281816107f001526108b001526112d66000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de578063ba08765211610097578063ce96cb7711610071578063ce96cb7714610328578063d905777e1461033b578063dd62ed3e1461034e578063ef8b30f71461031557600080fd5b8063ba08765214610302578063c63d75b61461025d578063c6e6f5921461031557600080fd5b806370a082311461028557806394bf804d146102ae57806395d89b41146102c1578063a9059cbb146102c9578063b3d7f6b9146102dc578063b460af94146102ef57600080fd5b806323b872dd1161013057806323b872dd146101f9578063313ce5671461020c57806338d52e0f14610226578063402d267d1461025d5780634cdad506146101a85780636e553f651461027257600080fd5b806301e1d1141461017857806306fdde031461019357806307a2d13a146101a8578063095ea7b3146101bb5780630a28a477146101de57806318160ddd146101f1575b600080fd5b610180610387565b6040519081526020015b60405180910390f35b61019b610417565b60405161018a9190610ee2565b6101806101b6366004610f15565b6104a9565b6101ce6101c9366004610f4a565b6104bc565b604051901515815260200161018a565b6101806101ec366004610f15565b6104d4565b600254610180565b6101ce610207366004610f74565b6104e1565b610214610507565b60405160ff909116815260200161018a565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016815260200161018a565b61018061026b366004610fb0565b5060001990565b610180610280366004610fcb565b610533565b610180610293366004610fb0565b6001600160a01b031660009081526020819052604090205490565b6101806102bc366004610fcb565b610567565b61019b610585565b6101ce6102d7366004610f4a565b610594565b6101806102ea366004610f15565b6105a2565b6101806102fd366004610ff7565b6105af565b610180610310366004610ff7565b610607565b610180610323366004610f15565b610656565b610180610336366004610fb0565b610663565b610180610349366004610fb0565b610687565b61018061035c366004611033565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610412919061105d565b905090565b60606003805461042690611076565b80601f016020809104026020016040519081016040528092919081815260200182805461045290611076565b801561049f5780601f106104745761010080835404028352916020019161049f565b820191906000526020600020905b81548152906001019060200180831161048257829003601f168201915b5050505050905090565b60006104b68260006106a5565b92915050565b6000336104ca8185856106df565b5060019392505050565b60006104b68260016106f1565b6000336104ef858285610721565b6104fa85858561078c565b60019150505b9392505050565b6000610412817f00000000000000000000000000000000000000000000000000000000000000006110c6565b6000600019610546565b60405180910390fd5b600061055185610656565b905061055f338587846107eb565b949350505050565b60006000196000610577856105a2565b905061055f338583886107eb565b60606004805461042690611076565b6000336104ca81858561078c565b60006104b68260016106a5565b6000806105bb83610663565b9050808511156105e457828582604051633fa733bb60e21b815260040161053d939291906110df565b60006105ef866104d4565b90506105fe338686898561087d565b95945050505050565b60008061061383610687565b90508085111561063c57828582604051632e52afbb60e21b815260040161053d939291906110df565b6000610647866104a9565b90506105fe338686848a61087d565b60006104b68260006106f1565b6001600160a01b0381166000908152602081905260408120546104b69060006106a5565b6001600160a01b0381166000908152602081905260408120546104b6565b60006105006106b2610387565b6106bd906001611100565b6106c96000600a6111f7565b6002546106d69190611100565b8591908561093d565b6106ec838383600161098c565b505050565b600061050061070182600a6111f7565b60025461070e9190611100565b610716610387565b6106d6906001611100565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610786578181101561077757828183604051637dc7a0d960e11b815260040161053d939291906110df565b6107868484848403600061098c565b50505050565b6001600160a01b0383166107b657604051634b637e8f60e11b81526000600482015260240161053d565b6001600160a01b0382166107e05760405163ec442f0560e01b81526000600482015260240161053d565b6106ec838383610a53565b6108177f0000000000000000000000000000000000000000000000000000000000000000853085610b6a565b6108218382610bd1565b826001600160a01b0316846001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7848460405161086f929190918252602082015260400190565b60405180910390a350505050565b826001600160a01b0316856001600160a01b0316146108a1576108a1838683610721565b6108ab8382610c0b565b6108d67f00000000000000000000000000000000000000000000000000000000000000008584610c41565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db858560405161092e929190918252602082015260400190565b60405180910390a45050505050565b60008061094b868686610c72565b905061095683610d36565b801561097257506000848061096d5761096d611206565b868809115b156105fe57610982600182611100565b9695505050505050565b6001600160a01b0384166109b65760405163e602df0560e01b81526000600482015260240161053d565b6001600160a01b0383166109e057604051634a1406b160e11b81526000600482015260240161053d565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561078657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161086f91815260200190565b6001600160a01b038316610a7e578060026000828254610a739190611100565b90915550610add9050565b6001600160a01b03831660009081526020819052604090205481811015610abe5783818360405163391434e360e21b815260040161053d939291906110df565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610af957600280548290039055610b18565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610b5d91815260200190565b60405180910390a3505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526107869186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610d63565b6001600160a01b038216610bfb5760405163ec442f0560e01b81526000600482015260240161053d565b610c0760008383610a53565b5050565b6001600160a01b038216610c3557604051634b637e8f60e11b81526000600482015260240161053d565b610c0782600083610a53565b6040516001600160a01b038381166024830152604482018390526106ec91859182169063a9059cbb90606401610b9f565b6000838302816000198587098281108382030391505080600003610ca957838281610c9f57610c9f611206565b0492505050610500565b808411610cc95760405163227bc15360e01b815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60006002826003811115610d4c57610d4c61121c565b610d569190611232565b60ff166001149050919050565b6000610d786001600160a01b03841683610dc6565b90508051600014158015610d9d575080806020019051810190610d9b9190611262565b155b156106ec57604051635274afe760e01b81526001600160a01b038416600482015260240161053d565b60606105008383600084600080856001600160a01b03168486604051610dec9190611284565b60006040518083038185875af1925050503d8060008114610e29576040519150601f19603f3d011682016040523d82523d6000602084013e610e2e565b606091505b5091509150610982868383606082610e4e57610e4982610e95565b610500565b8151158015610e6557506001600160a01b0384163b155b15610e8e57604051639996b31560e01b81526001600160a01b038516600482015260240161053d565b5080610500565b805115610ea55780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60005b83811015610ed9578181015183820152602001610ec1565b50506000910152565b6020815260008251806020840152610f01816040850160208701610ebe565b601f01601f19169190910160400192915050565b600060208284031215610f2757600080fd5b5035919050565b80356001600160a01b0381168114610f4557600080fd5b919050565b60008060408385031215610f5d57600080fd5b610f6683610f2e565b946020939093013593505050565b600080600060608486031215610f8957600080fd5b610f9284610f2e565b9250610fa060208501610f2e565b9150604084013590509250925092565b600060208284031215610fc257600080fd5b61050082610f2e565b60008060408385031215610fde57600080fd5b82359150610fee60208401610f2e565b90509250929050565b60008060006060848603121561100c57600080fd5b8335925061101c60208501610f2e565b915061102a60408501610f2e565b90509250925092565b6000806040838503121561104657600080fd5b61104f83610f2e565b9150610fee60208401610f2e565b60006020828403121561106f57600080fd5b5051919050565b600181811c9082168061108a57607f821691505b6020821081036110aa57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60ff81811683821601908111156104b6576104b66110b0565b6001600160a01b039390931683526020830191909152604082015260600190565b808201808211156104b6576104b66110b0565b600181815b8085111561114e578160001904821115611134576111346110b0565b8085161561114157918102915b93841c9390800290611118565b509250929050565b600082611165575060016104b6565b81611172575060006104b6565b81600181146111885760028114611192576111ae565b60019150506104b6565b60ff8411156111a3576111a36110b0565b50506001821b6104b6565b5060208310610133831016604e8410600b84101617156111d1575081810a6104b6565b6111db8383611113565b80600019048211156111ef576111ef6110b0565b029392505050565b600061050060ff841683611156565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b600060ff83168061125357634e487b7160e01b600052601260045260246000fd5b8060ff84160691505092915050565b60006020828403121561127457600080fd5b8151801515811461050057600080fd5b60008251611296818460208701610ebe565b919091019291505056fea2646970667358221220f6b39fcf18e91a6be59124d5efdf5e59e95b641da3df7ac7adceaf43bd55176664736f6c63430008160033000000000000000000000000036cbd53842c5426634e7929541ec2318f3dcf7e", + "nonce": "0x309", + "chainId": "0x14a34" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1728672574, + "chain": 84532, + "commit": "aca650e" +} \ No newline at end of file diff --git a/broadcast/Vault.s.sol/84532/run-1728672710.json b/broadcast/Vault.s.sol/84532/run-1728672710.json new file mode 100644 index 0000000..09b7f20 --- /dev/null +++ b/broadcast/Vault.s.sol/84532/run-1728672710.json @@ -0,0 +1,29 @@ +{ + "transactions": [ + { + "hash": null, + "transactionType": "CREATE", + "contractName": null, + "contractAddress": "0xb68732044c7ad50d6e7e6d1277522e6abb2f5258", + "function": null, + "arguments": null, + "transaction": { + "from": "0x4db804ff4066a22f7883d4b133762762f7dabfba", + "gas": "0x171fea", + "value": "0x0", + "input": "0x60c06040523480156200001157600080fd5b50604051620016c5380380620016c58339810160408190526200003491620001c4565b806040518060400160405280600d81526020016c21bab132902aa9a21021b7b4b760991b81525060405180604001604052806005815260200164635553444360d81b81525081600390816200008a91906200029d565b5060046200009982826200029d565b505050600080620000b083620000df60201b60201c565b9150915081620000c2576012620000c4565b805b60ff1660a05250506001600160a01b031660805250620003b4565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691620001289162000369565b600060405180830381855afa9150503d806000811462000165576040519150601f19603f3d011682016040523d82523d6000602084013e6200016a565b606091505b50915091508180156200017f57506020815110155b15620001b7576000818060200190518101906200019d91906200039a565b905060ff8111620001b5576001969095509350505050565b505b5060009485945092505050565b600060208284031215620001d757600080fd5b81516001600160a01b0381168114620001ef57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200022157607f821691505b6020821081036200024257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000298576000816000526020600020601f850160051c81016020861015620002735750805b601f850160051c820191505b8181101562000294578281556001016200027f565b5050505b505050565b81516001600160401b03811115620002b957620002b9620001f6565b620002d181620002ca84546200020c565b8462000248565b602080601f831160018114620003095760008415620002f05750858301515b600019600386901b1c1916600185901b17855562000294565b600085815260208120601f198616915b828110156200033a5788860151825594840194600190910190840162000319565b5085821015620003595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000825160005b818110156200038c576020818601810151858301520162000370565b506000920191825250919050565b600060208284031215620003ad57600080fd5b5051919050565b60805160a0516112d6620003ef600039600061050f0152600081816102330152818161039f015281816107f001526108b001526112d66000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de578063ba08765211610097578063ce96cb7711610071578063ce96cb7714610328578063d905777e1461033b578063dd62ed3e1461034e578063ef8b30f71461031557600080fd5b8063ba08765214610302578063c63d75b61461025d578063c6e6f5921461031557600080fd5b806370a082311461028557806394bf804d146102ae57806395d89b41146102c1578063a9059cbb146102c9578063b3d7f6b9146102dc578063b460af94146102ef57600080fd5b806323b872dd1161013057806323b872dd146101f9578063313ce5671461020c57806338d52e0f14610226578063402d267d1461025d5780634cdad506146101a85780636e553f651461027257600080fd5b806301e1d1141461017857806306fdde031461019357806307a2d13a146101a8578063095ea7b3146101bb5780630a28a477146101de57806318160ddd146101f1575b600080fd5b610180610387565b6040519081526020015b60405180910390f35b61019b610417565b60405161018a9190610ee2565b6101806101b6366004610f15565b6104a9565b6101ce6101c9366004610f4a565b6104bc565b604051901515815260200161018a565b6101806101ec366004610f15565b6104d4565b600254610180565b6101ce610207366004610f74565b6104e1565b610214610507565b60405160ff909116815260200161018a565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016815260200161018a565b61018061026b366004610fb0565b5060001990565b610180610280366004610fcb565b610533565b610180610293366004610fb0565b6001600160a01b031660009081526020819052604090205490565b6101806102bc366004610fcb565b610567565b61019b610585565b6101ce6102d7366004610f4a565b610594565b6101806102ea366004610f15565b6105a2565b6101806102fd366004610ff7565b6105af565b610180610310366004610ff7565b610607565b610180610323366004610f15565b610656565b610180610336366004610fb0565b610663565b610180610349366004610fb0565b610687565b61018061035c366004611033565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610412919061105d565b905090565b60606003805461042690611076565b80601f016020809104026020016040519081016040528092919081815260200182805461045290611076565b801561049f5780601f106104745761010080835404028352916020019161049f565b820191906000526020600020905b81548152906001019060200180831161048257829003601f168201915b5050505050905090565b60006104b68260006106a5565b92915050565b6000336104ca8185856106df565b5060019392505050565b60006104b68260016106f1565b6000336104ef858285610721565b6104fa85858561078c565b60019150505b9392505050565b6000610412817f00000000000000000000000000000000000000000000000000000000000000006110c6565b6000600019610546565b60405180910390fd5b600061055185610656565b905061055f338587846107eb565b949350505050565b60006000196000610577856105a2565b905061055f338583886107eb565b60606004805461042690611076565b6000336104ca81858561078c565b60006104b68260016106a5565b6000806105bb83610663565b9050808511156105e457828582604051633fa733bb60e21b815260040161053d939291906110df565b60006105ef866104d4565b90506105fe338686898561087d565b95945050505050565b60008061061383610687565b90508085111561063c57828582604051632e52afbb60e21b815260040161053d939291906110df565b6000610647866104a9565b90506105fe338686848a61087d565b60006104b68260006106f1565b6001600160a01b0381166000908152602081905260408120546104b69060006106a5565b6001600160a01b0381166000908152602081905260408120546104b6565b60006105006106b2610387565b6106bd906001611100565b6106c96000600a6111f7565b6002546106d69190611100565b8591908561093d565b6106ec838383600161098c565b505050565b600061050061070182600a6111f7565b60025461070e9190611100565b610716610387565b6106d6906001611100565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610786578181101561077757828183604051637dc7a0d960e11b815260040161053d939291906110df565b6107868484848403600061098c565b50505050565b6001600160a01b0383166107b657604051634b637e8f60e11b81526000600482015260240161053d565b6001600160a01b0382166107e05760405163ec442f0560e01b81526000600482015260240161053d565b6106ec838383610a53565b6108177f0000000000000000000000000000000000000000000000000000000000000000853085610b6a565b6108218382610bd1565b826001600160a01b0316846001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7848460405161086f929190918252602082015260400190565b60405180910390a350505050565b826001600160a01b0316856001600160a01b0316146108a1576108a1838683610721565b6108ab8382610c0b565b6108d67f00000000000000000000000000000000000000000000000000000000000000008584610c41565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db858560405161092e929190918252602082015260400190565b60405180910390a45050505050565b60008061094b868686610c72565b905061095683610d36565b801561097257506000848061096d5761096d611206565b868809115b156105fe57610982600182611100565b9695505050505050565b6001600160a01b0384166109b65760405163e602df0560e01b81526000600482015260240161053d565b6001600160a01b0383166109e057604051634a1406b160e11b81526000600482015260240161053d565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561078657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161086f91815260200190565b6001600160a01b038316610a7e578060026000828254610a739190611100565b90915550610add9050565b6001600160a01b03831660009081526020819052604090205481811015610abe5783818360405163391434e360e21b815260040161053d939291906110df565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610af957600280548290039055610b18565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610b5d91815260200190565b60405180910390a3505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526107869186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610d63565b6001600160a01b038216610bfb5760405163ec442f0560e01b81526000600482015260240161053d565b610c0760008383610a53565b5050565b6001600160a01b038216610c3557604051634b637e8f60e11b81526000600482015260240161053d565b610c0782600083610a53565b6040516001600160a01b038381166024830152604482018390526106ec91859182169063a9059cbb90606401610b9f565b6000838302816000198587098281108382030391505080600003610ca957838281610c9f57610c9f611206565b0492505050610500565b808411610cc95760405163227bc15360e01b815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60006002826003811115610d4c57610d4c61121c565b610d569190611232565b60ff166001149050919050565b6000610d786001600160a01b03841683610dc6565b90508051600014158015610d9d575080806020019051810190610d9b9190611262565b155b156106ec57604051635274afe760e01b81526001600160a01b038416600482015260240161053d565b60606105008383600084600080856001600160a01b03168486604051610dec9190611284565b60006040518083038185875af1925050503d8060008114610e29576040519150601f19603f3d011682016040523d82523d6000602084013e610e2e565b606091505b5091509150610982868383606082610e4e57610e4982610e95565b610500565b8151158015610e6557506001600160a01b0384163b155b15610e8e57604051639996b31560e01b81526001600160a01b038516600482015260240161053d565b5080610500565b805115610ea55780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60005b83811015610ed9578181015183820152602001610ec1565b50506000910152565b6020815260008251806020840152610f01816040850160208701610ebe565b601f01601f19169190910160400192915050565b600060208284031215610f2757600080fd5b5035919050565b80356001600160a01b0381168114610f4557600080fd5b919050565b60008060408385031215610f5d57600080fd5b610f6683610f2e565b946020939093013593505050565b600080600060608486031215610f8957600080fd5b610f9284610f2e565b9250610fa060208501610f2e565b9150604084013590509250925092565b600060208284031215610fc257600080fd5b61050082610f2e565b60008060408385031215610fde57600080fd5b82359150610fee60208401610f2e565b90509250929050565b60008060006060848603121561100c57600080fd5b8335925061101c60208501610f2e565b915061102a60408501610f2e565b90509250925092565b6000806040838503121561104657600080fd5b61104f83610f2e565b9150610fee60208401610f2e565b60006020828403121561106f57600080fd5b5051919050565b600181811c9082168061108a57607f821691505b6020821081036110aa57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60ff81811683821601908111156104b6576104b66110b0565b6001600160a01b039390931683526020830191909152604082015260600190565b808201808211156104b6576104b66110b0565b600181815b8085111561114e578160001904821115611134576111346110b0565b8085161561114157918102915b93841c9390800290611118565b509250929050565b600082611165575060016104b6565b81611172575060006104b6565b81600181146111885760028114611192576111ae565b60019150506104b6565b60ff8411156111a3576111a36110b0565b50506001821b6104b6565b5060208310610133831016604e8410600b84101617156111d1575081810a6104b6565b6111db8383611113565b80600019048211156111ef576111ef6110b0565b029392505050565b600061050060ff841683611156565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b600060ff83168061125357634e487b7160e01b600052601260045260246000fd5b8060ff84160691505092915050565b60006020828403121561127457600080fd5b8151801515811461050057600080fd5b60008251611296818460208701610ebe565b919091019291505056fea2646970667358221220f6b39fcf18e91a6be59124d5efdf5e59e95b641da3df7ac7adceaf43bd55176664736f6c63430008160033000000000000000000000000036cbd53842c5426634e7929541ec2318f3dcf7e", + "nonce": "0x326", + "chainId": "0x14a34" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1728672710, + "chain": 84532, + "commit": "aca650e" +} \ No newline at end of file diff --git a/broadcast/Vault.s.sol/84532/run-latest.json b/broadcast/Vault.s.sol/84532/run-latest.json new file mode 100644 index 0000000..09b7f20 --- /dev/null +++ b/broadcast/Vault.s.sol/84532/run-latest.json @@ -0,0 +1,29 @@ +{ + "transactions": [ + { + "hash": null, + "transactionType": "CREATE", + "contractName": null, + "contractAddress": "0xb68732044c7ad50d6e7e6d1277522e6abb2f5258", + "function": null, + "arguments": null, + "transaction": { + "from": "0x4db804ff4066a22f7883d4b133762762f7dabfba", + "gas": "0x171fea", + "value": "0x0", + "input": "0x60c06040523480156200001157600080fd5b50604051620016c5380380620016c58339810160408190526200003491620001c4565b806040518060400160405280600d81526020016c21bab132902aa9a21021b7b4b760991b81525060405180604001604052806005815260200164635553444360d81b81525081600390816200008a91906200029d565b5060046200009982826200029d565b505050600080620000b083620000df60201b60201c565b9150915081620000c2576012620000c4565b805b60ff1660a05250506001600160a01b031660805250620003b4565b60408051600481526024810182526020810180516001600160e01b031663313ce56760e01b17905290516000918291829182916001600160a01b03871691620001289162000369565b600060405180830381855afa9150503d806000811462000165576040519150601f19603f3d011682016040523d82523d6000602084013e6200016a565b606091505b50915091508180156200017f57506020815110155b15620001b7576000818060200190518101906200019d91906200039a565b905060ff8111620001b5576001969095509350505050565b505b5060009485945092505050565b600060208284031215620001d757600080fd5b81516001600160a01b0381168114620001ef57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200022157607f821691505b6020821081036200024257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000298576000816000526020600020601f850160051c81016020861015620002735750805b601f850160051c820191505b8181101562000294578281556001016200027f565b5050505b505050565b81516001600160401b03811115620002b957620002b9620001f6565b620002d181620002ca84546200020c565b8462000248565b602080601f831160018114620003095760008415620002f05750858301515b600019600386901b1c1916600185901b17855562000294565b600085815260208120601f198616915b828110156200033a5788860151825594840194600190910190840162000319565b5085821015620003595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000825160005b818110156200038c576020818601810151858301520162000370565b506000920191825250919050565b600060208284031215620003ad57600080fd5b5051919050565b60805160a0516112d6620003ef600039600061050f0152600081816102330152818161039f015281816107f001526108b001526112d66000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de578063ba08765211610097578063ce96cb7711610071578063ce96cb7714610328578063d905777e1461033b578063dd62ed3e1461034e578063ef8b30f71461031557600080fd5b8063ba08765214610302578063c63d75b61461025d578063c6e6f5921461031557600080fd5b806370a082311461028557806394bf804d146102ae57806395d89b41146102c1578063a9059cbb146102c9578063b3d7f6b9146102dc578063b460af94146102ef57600080fd5b806323b872dd1161013057806323b872dd146101f9578063313ce5671461020c57806338d52e0f14610226578063402d267d1461025d5780634cdad506146101a85780636e553f651461027257600080fd5b806301e1d1141461017857806306fdde031461019357806307a2d13a146101a8578063095ea7b3146101bb5780630a28a477146101de57806318160ddd146101f1575b600080fd5b610180610387565b6040519081526020015b60405180910390f35b61019b610417565b60405161018a9190610ee2565b6101806101b6366004610f15565b6104a9565b6101ce6101c9366004610f4a565b6104bc565b604051901515815260200161018a565b6101806101ec366004610f15565b6104d4565b600254610180565b6101ce610207366004610f74565b6104e1565b610214610507565b60405160ff909116815260200161018a565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016815260200161018a565b61018061026b366004610fb0565b5060001990565b610180610280366004610fcb565b610533565b610180610293366004610fb0565b6001600160a01b031660009081526020819052604090205490565b6101806102bc366004610fcb565b610567565b61019b610585565b6101ce6102d7366004610f4a565b610594565b6101806102ea366004610f15565b6105a2565b6101806102fd366004610ff7565b6105af565b610180610310366004610ff7565b610607565b610180610323366004610f15565b610656565b610180610336366004610fb0565b610663565b610180610349366004610fb0565b610687565b61018061035c366004611033565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610412919061105d565b905090565b60606003805461042690611076565b80601f016020809104026020016040519081016040528092919081815260200182805461045290611076565b801561049f5780601f106104745761010080835404028352916020019161049f565b820191906000526020600020905b81548152906001019060200180831161048257829003601f168201915b5050505050905090565b60006104b68260006106a5565b92915050565b6000336104ca8185856106df565b5060019392505050565b60006104b68260016106f1565b6000336104ef858285610721565b6104fa85858561078c565b60019150505b9392505050565b6000610412817f00000000000000000000000000000000000000000000000000000000000000006110c6565b6000600019610546565b60405180910390fd5b600061055185610656565b905061055f338587846107eb565b949350505050565b60006000196000610577856105a2565b905061055f338583886107eb565b60606004805461042690611076565b6000336104ca81858561078c565b60006104b68260016106a5565b6000806105bb83610663565b9050808511156105e457828582604051633fa733bb60e21b815260040161053d939291906110df565b60006105ef866104d4565b90506105fe338686898561087d565b95945050505050565b60008061061383610687565b90508085111561063c57828582604051632e52afbb60e21b815260040161053d939291906110df565b6000610647866104a9565b90506105fe338686848a61087d565b60006104b68260006106f1565b6001600160a01b0381166000908152602081905260408120546104b69060006106a5565b6001600160a01b0381166000908152602081905260408120546104b6565b60006105006106b2610387565b6106bd906001611100565b6106c96000600a6111f7565b6002546106d69190611100565b8591908561093d565b6106ec838383600161098c565b505050565b600061050061070182600a6111f7565b60025461070e9190611100565b610716610387565b6106d6906001611100565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610786578181101561077757828183604051637dc7a0d960e11b815260040161053d939291906110df565b6107868484848403600061098c565b50505050565b6001600160a01b0383166107b657604051634b637e8f60e11b81526000600482015260240161053d565b6001600160a01b0382166107e05760405163ec442f0560e01b81526000600482015260240161053d565b6106ec838383610a53565b6108177f0000000000000000000000000000000000000000000000000000000000000000853085610b6a565b6108218382610bd1565b826001600160a01b0316846001600160a01b03167fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7848460405161086f929190918252602082015260400190565b60405180910390a350505050565b826001600160a01b0316856001600160a01b0316146108a1576108a1838683610721565b6108ab8382610c0b565b6108d67f00000000000000000000000000000000000000000000000000000000000000008584610c41565b826001600160a01b0316846001600160a01b0316866001600160a01b03167ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db858560405161092e929190918252602082015260400190565b60405180910390a45050505050565b60008061094b868686610c72565b905061095683610d36565b801561097257506000848061096d5761096d611206565b868809115b156105fe57610982600182611100565b9695505050505050565b6001600160a01b0384166109b65760405163e602df0560e01b81526000600482015260240161053d565b6001600160a01b0383166109e057604051634a1406b160e11b81526000600482015260240161053d565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561078657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161086f91815260200190565b6001600160a01b038316610a7e578060026000828254610a739190611100565b90915550610add9050565b6001600160a01b03831660009081526020819052604090205481811015610abe5783818360405163391434e360e21b815260040161053d939291906110df565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b038216610af957600280548290039055610b18565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610b5d91815260200190565b60405180910390a3505050565b6040516001600160a01b0384811660248301528381166044830152606482018390526107869186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610d63565b6001600160a01b038216610bfb5760405163ec442f0560e01b81526000600482015260240161053d565b610c0760008383610a53565b5050565b6001600160a01b038216610c3557604051634b637e8f60e11b81526000600482015260240161053d565b610c0782600083610a53565b6040516001600160a01b038381166024830152604482018390526106ec91859182169063a9059cbb90606401610b9f565b6000838302816000198587098281108382030391505080600003610ca957838281610c9f57610c9f611206565b0492505050610500565b808411610cc95760405163227bc15360e01b815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60006002826003811115610d4c57610d4c61121c565b610d569190611232565b60ff166001149050919050565b6000610d786001600160a01b03841683610dc6565b90508051600014158015610d9d575080806020019051810190610d9b9190611262565b155b156106ec57604051635274afe760e01b81526001600160a01b038416600482015260240161053d565b60606105008383600084600080856001600160a01b03168486604051610dec9190611284565b60006040518083038185875af1925050503d8060008114610e29576040519150601f19603f3d011682016040523d82523d6000602084013e610e2e565b606091505b5091509150610982868383606082610e4e57610e4982610e95565b610500565b8151158015610e6557506001600160a01b0384163b155b15610e8e57604051639996b31560e01b81526001600160a01b038516600482015260240161053d565b5080610500565b805115610ea55780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60005b83811015610ed9578181015183820152602001610ec1565b50506000910152565b6020815260008251806020840152610f01816040850160208701610ebe565b601f01601f19169190910160400192915050565b600060208284031215610f2757600080fd5b5035919050565b80356001600160a01b0381168114610f4557600080fd5b919050565b60008060408385031215610f5d57600080fd5b610f6683610f2e565b946020939093013593505050565b600080600060608486031215610f8957600080fd5b610f9284610f2e565b9250610fa060208501610f2e565b9150604084013590509250925092565b600060208284031215610fc257600080fd5b61050082610f2e565b60008060408385031215610fde57600080fd5b82359150610fee60208401610f2e565b90509250929050565b60008060006060848603121561100c57600080fd5b8335925061101c60208501610f2e565b915061102a60408501610f2e565b90509250925092565b6000806040838503121561104657600080fd5b61104f83610f2e565b9150610fee60208401610f2e565b60006020828403121561106f57600080fd5b5051919050565b600181811c9082168061108a57607f821691505b6020821081036110aa57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60ff81811683821601908111156104b6576104b66110b0565b6001600160a01b039390931683526020830191909152604082015260600190565b808201808211156104b6576104b66110b0565b600181815b8085111561114e578160001904821115611134576111346110b0565b8085161561114157918102915b93841c9390800290611118565b509250929050565b600082611165575060016104b6565b81611172575060006104b6565b81600181146111885760028114611192576111ae565b60019150506104b6565b60ff8411156111a3576111a36110b0565b50506001821b6104b6565b5060208310610133831016604e8410600b84101617156111d1575081810a6104b6565b6111db8383611113565b80600019048211156111ef576111ef6110b0565b029392505050565b600061050060ff841683611156565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b600060ff83168061125357634e487b7160e01b600052601260045260246000fd5b8060ff84160691505092915050565b60006020828403121561127457600080fd5b8151801515811461050057600080fd5b60008251611296818460208701610ebe565b919091019291505056fea2646970667358221220f6b39fcf18e91a6be59124d5efdf5e59e95b641da3df7ac7adceaf43bd55176664736f6c63430008160033000000000000000000000000036cbd53842c5426634e7929541ec2318f3dcf7e", + "nonce": "0x326", + "chainId": "0x14a34" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1728672710, + "chain": 84532, + "commit": "aca650e" +} \ No newline at end of file diff --git a/data/.DS_Store b/data/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9fb08002cf60bb236a0660b3a5cfcb3cb350d1a4 GIT binary patch literal 6148 zcmeHKQA@)x5KgwLEko#o!X5*@4xF1h#FtX%AF!eiDzmi%tF;-nvkzm?XZ=I|5`T|( zNhXfz+YlLdaQQBmyM%l#xr8ys{c*gXG(QNAqb^9zcn~?xk&mKOM$mhY zMhns8_>TQVYwH`fZ8z+j;9izN5fGoQp(>s{9 z#N?>cZi)Tw;dJWQ+dI3*XM@M|DU+|7LJohMl1+m%cmu;?53n1_vK86SY;T0b05L!e zERO+mirS6kO-VBm1H{0JFo5TS07di+RvOjO0S#Usaoj>g0UO^Eh{B*}u+j)4AY7*c z>Qru?7+j}=Uzj-0V5L!~Gp<&KdCbb(yimAW9sELtGwx}mmKY!g<{7B#u8Z~m^!NAw zd=mAD0b*dK7~obv==-oGQ(G4{hqYFK-h!fFT&3|V1q@Y+Ar?z<6I2QK1sZ^!!Ac`| QK 0, "Amount must be greater than zero"); + + Registry.Merchant memory merchant = registry.getMerchantByUEN(_uen); + require(merchant.wallet_address != address(0), "Invalid merchant wallet address"); + + usdcToken.safeTransferFrom(msg.sender, merchant.wallet_address, _amount); + + emit Transfer(msg.sender, merchant.wallet_address, _amount, _uen); + } + + function getMerchantWalletAddress(string memory _uen) external view returns (address) { + Registry.Merchant memory merchant = registry.getMerchantByUEN(_uen); + return merchant.wallet_address; + } + + function getUSDCBalance(address _account) external view returns (uint256) { + return usdcToken.balanceOf(_account); + } +} diff --git a/src/Registry.sol b/src/Registry.sol new file mode 100644 index 0000000..8872b7f --- /dev/null +++ b/src/Registry.sol @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +/** + * @title Registry Contract for Merchant Management + * @author Dann Wee + * @notice This contract manages merchant records + */ +contract Registry { + /// @notice Struct to store merchant information + struct Merchant { + string uen; + string entity_name; + string owner_name; + address wallet_address; + } + + // Mappings to store and retrieve merchant data + mapping(string => Merchant) private merchantsByUEN; + mapping(address => string) private uenByWalletAddress; + + // Array to store all UENs + string[] private allUENs; + + address public admin; + + // Events for logging Merchant Add, Update and Delete + event MerchantAdded(string uen, string entity_name, string owner_name, address wallet_address); + event MerchantUpdated(string uen, string entity_name, string owner_name, address wallet_address); + event MerchantDeleted(string uen); + + /** + * @notice Modifier to restrict certain function access to admin only + */ + modifier onlyAdmin() { + require(msg.sender == admin, "Only admin can call this function"); + _; + } + + /** + * @notice Constructor to set the admin as the contract deployer + */ + constructor() { + admin = msg.sender; + } + + ///////////////////////// + /////// FUNCTIONS /////// + ///////////////////////// + + /** + * @notice Function for admin to add a new merchant with minimal information + * @param _uen Unique Entity Number of the merchant + * @param _entity_name Name of the merchant entity + */ + function addMerchantByAdmin(string memory _uen, string memory _entity_name) public onlyAdmin { + require(bytes(merchantsByUEN[_uen].uen).length == 0, "Merchant with this UEN already exists"); + + Merchant memory newMerchant = Merchant(_uen, _entity_name, "", address(0)); + merchantsByUEN[_uen] = newMerchant; + allUENs.push(_uen); + + emit MerchantAdded(_uen, _entity_name, "", address(0)); + } + + /** + * @notice Function to add a new merchant with full information + * @param _uen Unique Entity Number of the merchant + * @param _entity_name Name of the merchant entity + * @param _owner_name Name of the merchant owner + * @param _wallet_address Wallet address of the merchant + */ + function addMerchantBrandNew( + string memory _uen, + string memory _entity_name, + string memory _owner_name, + address _wallet_address + ) public { + require(bytes(merchantsByUEN[_uen].uen).length == 0, "Merchant with this UEN already exists"); + require( + bytes(uenByWalletAddress[_wallet_address]).length == 0, "Wallet address already associated with a merchant" + ); + + Merchant memory newMerchant = Merchant(_uen, _entity_name, _owner_name, _wallet_address); + merchantsByUEN[_uen] = newMerchant; + uenByWalletAddress[_wallet_address] = _uen; + allUENs.push(_uen); + + emit MerchantAdded(_uen, _entity_name, _owner_name, _wallet_address); + } + + /** + * @notice Function to update an existing merchant's information + * @param _uen Unique Entity Number of the merchant to update + * @param _entity_name New entity name (optional) + * @param _owner_name New owner name (optional) + * @param _wallet_address New wallet address (optional) + */ + function updateMerchant( + string memory _uen, + string memory _entity_name, + string memory _owner_name, + address _wallet_address + ) public { + require(bytes(merchantsByUEN[_uen].uen).length > 0, "Merchant with this UEN does not exist"); + + Merchant storage merchant = merchantsByUEN[_uen]; + + if (bytes(_entity_name).length > 0) { + merchant.entity_name = _entity_name; + } + + if (bytes(_owner_name).length > 0) { + merchant.owner_name = _owner_name; + } + + if (_wallet_address != address(0) && _wallet_address != merchant.wallet_address) { + if (merchant.wallet_address != address(0)) { + delete uenByWalletAddress[merchant.wallet_address]; + } + uenByWalletAddress[_wallet_address] = _uen; + merchant.wallet_address = _wallet_address; + } + + emit MerchantUpdated(_uen, merchant.entity_name, merchant.owner_name, merchant.wallet_address); + } + + /** + * @notice Function for admin to delete a merchant + * @param _uen Unique Entity Number of the merchant to delete + */ + function deleteMerchant(string memory _uen) public onlyAdmin { + require(bytes(merchantsByUEN[_uen].uen).length > 0, "Merchant with this UEN does not exist"); + + address walletAddress = merchantsByUEN[_uen].wallet_address; + + // Remove from uenByWalletAddress mapping if wallet address exists + if (walletAddress != address(0)) { + delete uenByWalletAddress[walletAddress]; + } + + // Remove from merchantsByUEN mapping + delete merchantsByUEN[_uen]; + + // Remove from allUENs array + for (uint256 i = 0; i < allUENs.length; i++) { + if (keccak256(bytes(allUENs[i])) == keccak256(bytes(_uen))) { + allUENs[i] = allUENs[allUENs.length - 1]; + allUENs.pop(); + break; + } + } + + emit MerchantDeleted(_uen); + } + + ///////////////////////// + //////// GETTERS //////// + ///////////////////////// + + /** + * @notice Function to retrieve merchant information by UEN + * @param _uen Unique Entity Number of the merchant + * @return Merchant struct containing merchant information + */ + function getMerchantByUEN(string memory _uen) public view returns (Merchant memory) { + require(bytes(merchantsByUEN[_uen].uen).length > 0, "Merchant with this UEN does not exist"); + return merchantsByUEN[_uen]; + } + + /** + * @notice Function to retrieve merchant information by wallet address + * @param _wallet_address Wallet address of the merchant + * @return Merchant struct containing merchant information + */ + function getMerchantByWalletAddress(address _wallet_address) public view returns (Merchant memory) { + string memory uen = uenByWalletAddress[_wallet_address]; + require(bytes(uen).length > 0, "No merchant associated with this wallet address"); + return merchantsByUEN[uen]; + } + + /** + * @notice Function to retrieve all merchant records + * @return An array of Merchant structs containing all merchant information + */ + function getAllMerchants() public view returns (Merchant[] memory) { + Merchant[] memory allMerchants = new Merchant[](allUENs.length); + for (uint256 i = 0; i < allUENs.length; i++) { + allMerchants[i] = merchantsByUEN[allUENs[i]]; + } + return allMerchants; + } +} diff --git a/src/Vault.sol b/src/Vault.sol new file mode 100644 index 0000000..607442b --- /dev/null +++ b/src/Vault.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +import {ERC4626} from "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol"; +import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +contract Vault is ERC4626 { + constructor(IERC20 _asset) ERC4626(_asset) ERC20("Cube USD Coin", "cUSDC") {} +} diff --git a/test/Counter.t.sol b/test/Counter.t.sol deleted file mode 100644 index 54b724f..0000000 --- a/test/Counter.t.sol +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.13; - -import {Test, console} from "forge-std/Test.sol"; -import {Counter} from "../src/Counter.sol"; - -contract CounterTest is Test { - Counter public counter; - - function setUp() public { - counter = new Counter(); - counter.setNumber(0); - } - - function test_Increment() public { - counter.increment(); - assertEq(counter.number(), 1); - } - - function testFuzz_SetNumber(uint256 x) public { - counter.setNumber(x); - assertEq(counter.number(), x); - } -} diff --git a/utils/constants.ts b/utils/constants.ts new file mode 100644 index 0000000..07fab14 --- /dev/null +++ b/utils/constants.ts @@ -0,0 +1,5 @@ +export const REGISTRY_CONTRACT_ADDRESS = + "0xF64C3fA7F56b9C59010Be7a96BaB0d08055B3cfE"; + +export const EXCHANGE_CONTRACT_ADDRESS = + "0xA380B898c7e4d19cf8d97bfC3987B1c769fc6723";