├── .env.example ├── .gitignore ├── README.md ├── abi ├── v1.1.0-20240307 │ ├── bridge-erc20.json │ ├── bridge-erc721.json │ └── bridge.json ├── v1.2.0-20240315 │ ├── bridge-erc20.json │ ├── bridge-erc721.json │ ├── bridge.json │ ├── erc20.json │ └── erc721.json ├── v1.3.0-20240327 │ ├── bridge-erc20.json │ ├── bridge-erc721.json │ ├── bridge.json │ ├── erc20.json │ └── erc721.json └── v1.4.0-20240513 │ ├── bridge-erc20.json │ ├── bridge-erc721.json │ ├── bridge.json │ ├── erc20.json │ └── erc721.json ├── contracts ├── BTCLayer2Bridge.sol ├── BTCLayer2BridgeERC20.sol ├── BTCLayer2BridgeERC721.sol ├── BridgeFeeRates.sol ├── ERC20TokenWrapped.sol ├── ERC721TokenWrapped.sol └── interfaces │ ├── IBTCLayer2BridgeERC20.sol │ └── IBTCLayer2BridgeERC721.sol ├── cs ├── Address.sol ├── BeaconProxy.sol ├── Context.sol ├── ERC1967Proxy.sol ├── ERC1967Upgrade.sol ├── IBeacon.sol ├── IERC1967.sol ├── Ownable.sol ├── Proxy.sol ├── ProxyAdmin.sol ├── StorageSlot.sol ├── TransparentUpgradeableProxy.sol ├── UpgradeableBeacon.sol └── draft-IERC1822.sol ├── hardhat.config.js ├── package.json ├── pnpm-lock.yaml ├── scripts ├── deploy.js ├── deployOnly │ ├── deploy-bridge-erc20.js │ ├── deploy-bridge-erc721.js │ ├── deploy-bridge.js │ ├── deploy-erc20.js │ └── deploy-erc721.js ├── upgrades │ ├── upgrade-bridge-erc20.js │ ├── upgrade-bridge-erc721.js │ └── upgrade-bridge.js └── verify.js ├── test ├── Lock.js └── claim.test.js └── yarn.lock /.env.example: -------------------------------------------------------------------------------- 1 | PRIVATE_KEY=0x 2 | NETWORK_URL= 3 | 4 | EXPLORER_API_URL= 5 | EXPLORER_URL= 6 | 7 | INITIAL_OWNER=0x 8 | SUPER_ADMIN_ADDRESS=0x 9 | NORMAL_ADMIN_ADDRESS=0x 10 | UNLOCK_TOKEN_ADMIN_ADDRESS=0x 11 | BRIDGE_FEE_ADDRESS=0x 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env 3 | coverage 4 | coverage.json 5 | typechain 6 | typechain-types 7 | deploy_output.json 8 | 9 | # Hardhat files 10 | cache 11 | artifacts 12 | .openzeppelin 13 | 14 | .env-test 15 | .env-pre-production 16 | .env* 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deployment steps 2 | 3 | ```shell 4 | yarn install 5 | npm run compile 6 | npm run deploy 7 | 8 | npm run verify 9 | ``` 10 | 11 | # Upgrade steps 12 | 1. update contract code 13 | 2. change PRIVATE_KEY in .env to owner private key 14 | 3. run on your needs: 15 | ```shell 16 | npm run upgrade-bridge 17 | ``` 18 | ```shell 19 | npm run upgrade-bridge-erc20 20 | ``` 21 | ```shell 22 | npm run upgrade-bridge-erc721 23 | ``` 24 | -------------------------------------------------------------------------------- /abi/v1.1.0-20240307/bridge-erc20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "uint8", 80 | "name": "_decimals", 81 | "type": "uint8" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "_cap", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "addERC20TokenWrapped", 90 | "outputs": [ 91 | { 92 | "internalType": "address", 93 | "name": "", 94 | "type": "address" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "uint256", 104 | "name": "", 105 | "type": "uint256" 106 | } 107 | ], 108 | "name": "allERC20TokenAddress", 109 | "outputs": [ 110 | { 111 | "internalType": "address", 112 | "name": "", 113 | "type": "address" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [], 121 | "name": "allERC20TokenAddressLength", 122 | "outputs": [ 123 | { 124 | "internalType": "uint256", 125 | "name": "", 126 | "type": "uint256" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "uint256", 136 | "name": "", 137 | "type": "uint256" 138 | } 139 | ], 140 | "name": "allERC20TxHash", 141 | "outputs": [ 142 | { 143 | "internalType": "bytes32", 144 | "name": "", 145 | "type": "bytes32" 146 | } 147 | ], 148 | "stateMutability": "view", 149 | "type": "function" 150 | }, 151 | { 152 | "inputs": [], 153 | "name": "allERC20TxHashLength", 154 | "outputs": [ 155 | { 156 | "internalType": "uint256", 157 | "name": "", 158 | "type": "uint256" 159 | } 160 | ], 161 | "stateMutability": "view", 162 | "type": "function" 163 | }, 164 | { 165 | "inputs": [], 166 | "name": "bridgeAddress", 167 | "outputs": [ 168 | { 169 | "internalType": "address", 170 | "name": "", 171 | "type": "address" 172 | } 173 | ], 174 | "stateMutability": "view", 175 | "type": "function" 176 | }, 177 | { 178 | "inputs": [ 179 | { 180 | "internalType": "address", 181 | "name": "sender", 182 | "type": "address" 183 | }, 184 | { 185 | "internalType": "address", 186 | "name": "token", 187 | "type": "address" 188 | }, 189 | { 190 | "internalType": "uint256", 191 | "name": "amount", 192 | "type": "uint256" 193 | } 194 | ], 195 | "name": "burnERC20Token", 196 | "outputs": [], 197 | "stateMutability": "nonpayable", 198 | "type": "function" 199 | }, 200 | { 201 | "inputs": [ 202 | { 203 | "internalType": "address", 204 | "name": "", 205 | "type": "address" 206 | } 207 | ], 208 | "name": "erc20TokenInfoSupported", 209 | "outputs": [ 210 | { 211 | "internalType": "bool", 212 | "name": "", 213 | "type": "bool" 214 | } 215 | ], 216 | "stateMutability": "view", 217 | "type": "function" 218 | }, 219 | { 220 | "inputs": [ 221 | { 222 | "internalType": "bytes32", 223 | "name": "", 224 | "type": "bytes32" 225 | } 226 | ], 227 | "name": "erc20TokenInfoToWrappedToken", 228 | "outputs": [ 229 | { 230 | "internalType": "address", 231 | "name": "", 232 | "type": "address" 233 | } 234 | ], 235 | "stateMutability": "view", 236 | "type": "function" 237 | }, 238 | { 239 | "inputs": [ 240 | { 241 | "internalType": "bytes32", 242 | "name": "", 243 | "type": "bytes32" 244 | } 245 | ], 246 | "name": "erc20TxHashUnlocked", 247 | "outputs": [ 248 | { 249 | "internalType": "bool", 250 | "name": "", 251 | "type": "bool" 252 | } 253 | ], 254 | "stateMutability": "view", 255 | "type": "function" 256 | }, 257 | { 258 | "inputs": [ 259 | { 260 | "internalType": "address", 261 | "name": "_initialOwner", 262 | "type": "address" 263 | }, 264 | { 265 | "internalType": "address", 266 | "name": "_bridgeAddress", 267 | "type": "address" 268 | } 269 | ], 270 | "name": "initialize", 271 | "outputs": [], 272 | "stateMutability": "nonpayable", 273 | "type": "function" 274 | }, 275 | { 276 | "inputs": [ 277 | { 278 | "internalType": "bytes32", 279 | "name": "txHash", 280 | "type": "bytes32" 281 | }, 282 | { 283 | "internalType": "address", 284 | "name": "token", 285 | "type": "address" 286 | }, 287 | { 288 | "internalType": "address", 289 | "name": "to", 290 | "type": "address" 291 | }, 292 | { 293 | "internalType": "uint256", 294 | "name": "amount", 295 | "type": "uint256" 296 | } 297 | ], 298 | "name": "mintERC20Token", 299 | "outputs": [], 300 | "stateMutability": "nonpayable", 301 | "type": "function" 302 | }, 303 | { 304 | "inputs": [], 305 | "name": "owner", 306 | "outputs": [ 307 | { 308 | "internalType": "address", 309 | "name": "", 310 | "type": "address" 311 | } 312 | ], 313 | "stateMutability": "view", 314 | "type": "function" 315 | }, 316 | { 317 | "inputs": [], 318 | "name": "renounceOwnership", 319 | "outputs": [], 320 | "stateMutability": "nonpayable", 321 | "type": "function" 322 | }, 323 | { 324 | "inputs": [ 325 | { 326 | "internalType": "address", 327 | "name": "newOwner", 328 | "type": "address" 329 | } 330 | ], 331 | "name": "transferOwnership", 332 | "outputs": [], 333 | "stateMutability": "nonpayable", 334 | "type": "function" 335 | }, 336 | { 337 | "inputs": [ 338 | { 339 | "internalType": "address", 340 | "name": "", 341 | "type": "address" 342 | }, 343 | { 344 | "internalType": "uint256", 345 | "name": "", 346 | "type": "uint256" 347 | } 348 | ], 349 | "name": "userERC20MintTxHash", 350 | "outputs": [ 351 | { 352 | "internalType": "bytes32", 353 | "name": "", 354 | "type": "bytes32" 355 | } 356 | ], 357 | "stateMutability": "view", 358 | "type": "function" 359 | }, 360 | { 361 | "inputs": [ 362 | { 363 | "internalType": "address", 364 | "name": "user", 365 | "type": "address" 366 | } 367 | ], 368 | "name": "userERC20MintTxHashLength", 369 | "outputs": [ 370 | { 371 | "internalType": "uint256", 372 | "name": "", 373 | "type": "uint256" 374 | } 375 | ], 376 | "stateMutability": "view", 377 | "type": "function" 378 | }, 379 | { 380 | "inputs": [], 381 | "name": "version", 382 | "outputs": [ 383 | { 384 | "internalType": "string", 385 | "name": "", 386 | "type": "string" 387 | } 388 | ], 389 | "stateMutability": "view", 390 | "type": "function" 391 | } 392 | ] -------------------------------------------------------------------------------- /abi/v1.1.0-20240307/bridge-erc721.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "string", 80 | "name": "_baseURI", 81 | "type": "string" 82 | } 83 | ], 84 | "name": "addERC721TokenWrapped", 85 | "outputs": [ 86 | { 87 | "internalType": "address", 88 | "name": "", 89 | "type": "address" 90 | } 91 | ], 92 | "stateMutability": "nonpayable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "uint256", 99 | "name": "", 100 | "type": "uint256" 101 | } 102 | ], 103 | "name": "allERC721TokenAddress", 104 | "outputs": [ 105 | { 106 | "internalType": "address", 107 | "name": "", 108 | "type": "address" 109 | } 110 | ], 111 | "stateMutability": "view", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [], 116 | "name": "allERC721TokenAddressLength", 117 | "outputs": [ 118 | { 119 | "internalType": "uint256", 120 | "name": "", 121 | "type": "uint256" 122 | } 123 | ], 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "inputs": [ 129 | { 130 | "internalType": "uint256", 131 | "name": "", 132 | "type": "uint256" 133 | } 134 | ], 135 | "name": "allERC721TxHash", 136 | "outputs": [ 137 | { 138 | "internalType": "bytes32", 139 | "name": "", 140 | "type": "bytes32" 141 | } 142 | ], 143 | "stateMutability": "view", 144 | "type": "function" 145 | }, 146 | { 147 | "inputs": [], 148 | "name": "allERC721TxHashLength", 149 | "outputs": [ 150 | { 151 | "internalType": "uint256", 152 | "name": "", 153 | "type": "uint256" 154 | } 155 | ], 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [ 161 | { 162 | "internalType": "address", 163 | "name": "sender", 164 | "type": "address" 165 | }, 166 | { 167 | "internalType": "address", 168 | "name": "token", 169 | "type": "address" 170 | }, 171 | { 172 | "internalType": "uint256[]", 173 | "name": "tokenIds", 174 | "type": "uint256[]" 175 | } 176 | ], 177 | "name": "batchBurnERC721Token", 178 | "outputs": [ 179 | { 180 | "internalType": "string[]", 181 | "name": "", 182 | "type": "string[]" 183 | } 184 | ], 185 | "stateMutability": "nonpayable", 186 | "type": "function" 187 | }, 188 | { 189 | "inputs": [ 190 | { 191 | "internalType": "bytes32", 192 | "name": "txHash", 193 | "type": "bytes32" 194 | }, 195 | { 196 | "internalType": "address", 197 | "name": "token", 198 | "type": "address" 199 | }, 200 | { 201 | "internalType": "address", 202 | "name": "to", 203 | "type": "address" 204 | }, 205 | { 206 | "internalType": "string[]", 207 | "name": "inscriptionIds", 208 | "type": "string[]" 209 | }, 210 | { 211 | "internalType": "uint256[]", 212 | "name": "tokenIds", 213 | "type": "uint256[]" 214 | } 215 | ], 216 | "name": "batchMintERC721Token", 217 | "outputs": [], 218 | "stateMutability": "nonpayable", 219 | "type": "function" 220 | }, 221 | { 222 | "inputs": [], 223 | "name": "bridgeAddress", 224 | "outputs": [ 225 | { 226 | "internalType": "address", 227 | "name": "", 228 | "type": "address" 229 | } 230 | ], 231 | "stateMutability": "view", 232 | "type": "function" 233 | }, 234 | { 235 | "inputs": [ 236 | { 237 | "internalType": "address", 238 | "name": "", 239 | "type": "address" 240 | } 241 | ], 242 | "name": "erc721TokenInfoSupported", 243 | "outputs": [ 244 | { 245 | "internalType": "bool", 246 | "name": "", 247 | "type": "bool" 248 | } 249 | ], 250 | "stateMutability": "view", 251 | "type": "function" 252 | }, 253 | { 254 | "inputs": [ 255 | { 256 | "internalType": "bytes32", 257 | "name": "", 258 | "type": "bytes32" 259 | } 260 | ], 261 | "name": "erc721TokenInfoToWrappedToken", 262 | "outputs": [ 263 | { 264 | "internalType": "address", 265 | "name": "", 266 | "type": "address" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "bytes32", 276 | "name": "", 277 | "type": "bytes32" 278 | } 279 | ], 280 | "name": "erc721TxHashUnlocked", 281 | "outputs": [ 282 | { 283 | "internalType": "bool", 284 | "name": "", 285 | "type": "bool" 286 | } 287 | ], 288 | "stateMutability": "view", 289 | "type": "function" 290 | }, 291 | { 292 | "inputs": [ 293 | { 294 | "internalType": "address", 295 | "name": "_initialOwner", 296 | "type": "address" 297 | }, 298 | { 299 | "internalType": "address", 300 | "name": "_bridgeAddress", 301 | "type": "address" 302 | } 303 | ], 304 | "name": "initialize", 305 | "outputs": [], 306 | "stateMutability": "nonpayable", 307 | "type": "function" 308 | }, 309 | { 310 | "inputs": [], 311 | "name": "owner", 312 | "outputs": [ 313 | { 314 | "internalType": "address", 315 | "name": "", 316 | "type": "address" 317 | } 318 | ], 319 | "stateMutability": "view", 320 | "type": "function" 321 | }, 322 | { 323 | "inputs": [], 324 | "name": "renounceOwnership", 325 | "outputs": [], 326 | "stateMutability": "nonpayable", 327 | "type": "function" 328 | }, 329 | { 330 | "inputs": [ 331 | { 332 | "internalType": "address", 333 | "name": "token", 334 | "type": "address" 335 | }, 336 | { 337 | "internalType": "string", 338 | "name": "newBaseTokenURI", 339 | "type": "string" 340 | } 341 | ], 342 | "name": "setBaseURI", 343 | "outputs": [], 344 | "stateMutability": "nonpayable", 345 | "type": "function" 346 | }, 347 | { 348 | "inputs": [ 349 | { 350 | "internalType": "address", 351 | "name": "token", 352 | "type": "address" 353 | }, 354 | { 355 | "internalType": "uint256", 356 | "name": "tokenId", 357 | "type": "uint256" 358 | } 359 | ], 360 | "name": "tokenURI", 361 | "outputs": [ 362 | { 363 | "internalType": "string", 364 | "name": "", 365 | "type": "string" 366 | } 367 | ], 368 | "stateMutability": "view", 369 | "type": "function" 370 | }, 371 | { 372 | "inputs": [ 373 | { 374 | "internalType": "address", 375 | "name": "newOwner", 376 | "type": "address" 377 | } 378 | ], 379 | "name": "transferOwnership", 380 | "outputs": [], 381 | "stateMutability": "nonpayable", 382 | "type": "function" 383 | }, 384 | { 385 | "inputs": [ 386 | { 387 | "internalType": "address", 388 | "name": "", 389 | "type": "address" 390 | }, 391 | { 392 | "internalType": "uint256", 393 | "name": "", 394 | "type": "uint256" 395 | } 396 | ], 397 | "name": "userERC721MintTxHash", 398 | "outputs": [ 399 | { 400 | "internalType": "bytes32", 401 | "name": "", 402 | "type": "bytes32" 403 | } 404 | ], 405 | "stateMutability": "view", 406 | "type": "function" 407 | }, 408 | { 409 | "inputs": [ 410 | { 411 | "internalType": "address", 412 | "name": "user", 413 | "type": "address" 414 | } 415 | ], 416 | "name": "userERC721MintTxHashLength", 417 | "outputs": [ 418 | { 419 | "internalType": "uint256", 420 | "name": "", 421 | "type": "uint256" 422 | } 423 | ], 424 | "stateMutability": "view", 425 | "type": "function" 426 | }, 427 | { 428 | "inputs": [], 429 | "name": "version", 430 | "outputs": [ 431 | { 432 | "internalType": "string", 433 | "name": "", 434 | "type": "string" 435 | } 436 | ], 437 | "stateMutability": "view", 438 | "type": "function" 439 | } 440 | ] -------------------------------------------------------------------------------- /abi/v1.2.0-20240315/bridge-erc20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "uint8", 80 | "name": "_decimals", 81 | "type": "uint8" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "_cap", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "addERC20TokenWrapped", 90 | "outputs": [ 91 | { 92 | "internalType": "address", 93 | "name": "", 94 | "type": "address" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "uint256", 104 | "name": "", 105 | "type": "uint256" 106 | } 107 | ], 108 | "name": "allERC20TokenAddress", 109 | "outputs": [ 110 | { 111 | "internalType": "address", 112 | "name": "", 113 | "type": "address" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [], 121 | "name": "allERC20TokenAddressLength", 122 | "outputs": [ 123 | { 124 | "internalType": "uint256", 125 | "name": "", 126 | "type": "uint256" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "uint256", 136 | "name": "", 137 | "type": "uint256" 138 | } 139 | ], 140 | "name": "allERC20TxHash", 141 | "outputs": [ 142 | { 143 | "internalType": "bytes32", 144 | "name": "", 145 | "type": "bytes32" 146 | } 147 | ], 148 | "stateMutability": "view", 149 | "type": "function" 150 | }, 151 | { 152 | "inputs": [], 153 | "name": "allERC20TxHashLength", 154 | "outputs": [ 155 | { 156 | "internalType": "uint256", 157 | "name": "", 158 | "type": "uint256" 159 | } 160 | ], 161 | "stateMutability": "view", 162 | "type": "function" 163 | }, 164 | { 165 | "inputs": [], 166 | "name": "bridgeAddress", 167 | "outputs": [ 168 | { 169 | "internalType": "address", 170 | "name": "", 171 | "type": "address" 172 | } 173 | ], 174 | "stateMutability": "view", 175 | "type": "function" 176 | }, 177 | { 178 | "inputs": [ 179 | { 180 | "internalType": "address", 181 | "name": "sender", 182 | "type": "address" 183 | }, 184 | { 185 | "internalType": "address", 186 | "name": "token", 187 | "type": "address" 188 | }, 189 | { 190 | "internalType": "uint256", 191 | "name": "amount", 192 | "type": "uint256" 193 | } 194 | ], 195 | "name": "burnERC20Token", 196 | "outputs": [], 197 | "stateMutability": "nonpayable", 198 | "type": "function" 199 | }, 200 | { 201 | "inputs": [ 202 | { 203 | "internalType": "address", 204 | "name": "", 205 | "type": "address" 206 | } 207 | ], 208 | "name": "erc20TokenInfoSupported", 209 | "outputs": [ 210 | { 211 | "internalType": "bool", 212 | "name": "", 213 | "type": "bool" 214 | } 215 | ], 216 | "stateMutability": "view", 217 | "type": "function" 218 | }, 219 | { 220 | "inputs": [ 221 | { 222 | "internalType": "bytes32", 223 | "name": "", 224 | "type": "bytes32" 225 | } 226 | ], 227 | "name": "erc20TokenInfoToWrappedToken", 228 | "outputs": [ 229 | { 230 | "internalType": "address", 231 | "name": "", 232 | "type": "address" 233 | } 234 | ], 235 | "stateMutability": "view", 236 | "type": "function" 237 | }, 238 | { 239 | "inputs": [ 240 | { 241 | "internalType": "bytes32", 242 | "name": "", 243 | "type": "bytes32" 244 | } 245 | ], 246 | "name": "erc20TxHashUnlocked", 247 | "outputs": [ 248 | { 249 | "internalType": "bool", 250 | "name": "", 251 | "type": "bool" 252 | } 253 | ], 254 | "stateMutability": "view", 255 | "type": "function" 256 | }, 257 | { 258 | "inputs": [ 259 | { 260 | "internalType": "address", 261 | "name": "_initialOwner", 262 | "type": "address" 263 | }, 264 | { 265 | "internalType": "address", 266 | "name": "_bridgeAddress", 267 | "type": "address" 268 | } 269 | ], 270 | "name": "initialize", 271 | "outputs": [], 272 | "stateMutability": "nonpayable", 273 | "type": "function" 274 | }, 275 | { 276 | "inputs": [ 277 | { 278 | "internalType": "bytes32", 279 | "name": "txHash", 280 | "type": "bytes32" 281 | }, 282 | { 283 | "internalType": "address", 284 | "name": "token", 285 | "type": "address" 286 | }, 287 | { 288 | "internalType": "address", 289 | "name": "to", 290 | "type": "address" 291 | }, 292 | { 293 | "internalType": "uint256", 294 | "name": "amount", 295 | "type": "uint256" 296 | } 297 | ], 298 | "name": "mintERC20Token", 299 | "outputs": [], 300 | "stateMutability": "nonpayable", 301 | "type": "function" 302 | }, 303 | { 304 | "inputs": [], 305 | "name": "owner", 306 | "outputs": [ 307 | { 308 | "internalType": "address", 309 | "name": "", 310 | "type": "address" 311 | } 312 | ], 313 | "stateMutability": "view", 314 | "type": "function" 315 | }, 316 | { 317 | "inputs": [], 318 | "name": "renounceOwnership", 319 | "outputs": [], 320 | "stateMutability": "nonpayable", 321 | "type": "function" 322 | }, 323 | { 324 | "inputs": [ 325 | { 326 | "internalType": "address", 327 | "name": "token", 328 | "type": "address" 329 | }, 330 | { 331 | "internalType": "address", 332 | "name": "account", 333 | "type": "address" 334 | }, 335 | { 336 | "internalType": "bool", 337 | "name": "state", 338 | "type": "bool" 339 | } 340 | ], 341 | "name": "setBlackListERC20Token", 342 | "outputs": [], 343 | "stateMutability": "nonpayable", 344 | "type": "function" 345 | }, 346 | { 347 | "inputs": [ 348 | { 349 | "internalType": "address", 350 | "name": "newOwner", 351 | "type": "address" 352 | } 353 | ], 354 | "name": "transferOwnership", 355 | "outputs": [], 356 | "stateMutability": "nonpayable", 357 | "type": "function" 358 | }, 359 | { 360 | "inputs": [ 361 | { 362 | "internalType": "address", 363 | "name": "", 364 | "type": "address" 365 | }, 366 | { 367 | "internalType": "uint256", 368 | "name": "", 369 | "type": "uint256" 370 | } 371 | ], 372 | "name": "userERC20MintTxHash", 373 | "outputs": [ 374 | { 375 | "internalType": "bytes32", 376 | "name": "", 377 | "type": "bytes32" 378 | } 379 | ], 380 | "stateMutability": "view", 381 | "type": "function" 382 | }, 383 | { 384 | "inputs": [ 385 | { 386 | "internalType": "address", 387 | "name": "user", 388 | "type": "address" 389 | } 390 | ], 391 | "name": "userERC20MintTxHashLength", 392 | "outputs": [ 393 | { 394 | "internalType": "uint256", 395 | "name": "", 396 | "type": "uint256" 397 | } 398 | ], 399 | "stateMutability": "view", 400 | "type": "function" 401 | }, 402 | { 403 | "inputs": [], 404 | "name": "version", 405 | "outputs": [ 406 | { 407 | "internalType": "string", 408 | "name": "", 409 | "type": "string" 410 | } 411 | ], 412 | "stateMutability": "view", 413 | "type": "function" 414 | } 415 | ] -------------------------------------------------------------------------------- /abi/v1.2.0-20240315/bridge-erc721.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "string", 80 | "name": "_baseURI", 81 | "type": "string" 82 | } 83 | ], 84 | "name": "addERC721TokenWrapped", 85 | "outputs": [ 86 | { 87 | "internalType": "address", 88 | "name": "", 89 | "type": "address" 90 | } 91 | ], 92 | "stateMutability": "nonpayable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "uint256", 99 | "name": "", 100 | "type": "uint256" 101 | } 102 | ], 103 | "name": "allERC721TokenAddress", 104 | "outputs": [ 105 | { 106 | "internalType": "address", 107 | "name": "", 108 | "type": "address" 109 | } 110 | ], 111 | "stateMutability": "view", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [], 116 | "name": "allERC721TokenAddressLength", 117 | "outputs": [ 118 | { 119 | "internalType": "uint256", 120 | "name": "", 121 | "type": "uint256" 122 | } 123 | ], 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "inputs": [ 129 | { 130 | "internalType": "uint256", 131 | "name": "", 132 | "type": "uint256" 133 | } 134 | ], 135 | "name": "allERC721TxHash", 136 | "outputs": [ 137 | { 138 | "internalType": "bytes32", 139 | "name": "", 140 | "type": "bytes32" 141 | } 142 | ], 143 | "stateMutability": "view", 144 | "type": "function" 145 | }, 146 | { 147 | "inputs": [], 148 | "name": "allERC721TxHashLength", 149 | "outputs": [ 150 | { 151 | "internalType": "uint256", 152 | "name": "", 153 | "type": "uint256" 154 | } 155 | ], 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [ 161 | { 162 | "internalType": "address", 163 | "name": "sender", 164 | "type": "address" 165 | }, 166 | { 167 | "internalType": "address", 168 | "name": "token", 169 | "type": "address" 170 | }, 171 | { 172 | "internalType": "uint256[]", 173 | "name": "tokenIds", 174 | "type": "uint256[]" 175 | } 176 | ], 177 | "name": "batchBurnERC721Token", 178 | "outputs": [ 179 | { 180 | "internalType": "string[]", 181 | "name": "", 182 | "type": "string[]" 183 | } 184 | ], 185 | "stateMutability": "nonpayable", 186 | "type": "function" 187 | }, 188 | { 189 | "inputs": [ 190 | { 191 | "internalType": "bytes32", 192 | "name": "txHash", 193 | "type": "bytes32" 194 | }, 195 | { 196 | "internalType": "address", 197 | "name": "token", 198 | "type": "address" 199 | }, 200 | { 201 | "internalType": "address", 202 | "name": "to", 203 | "type": "address" 204 | }, 205 | { 206 | "internalType": "string[]", 207 | "name": "inscriptionIds", 208 | "type": "string[]" 209 | }, 210 | { 211 | "internalType": "uint256[]", 212 | "name": "tokenIds", 213 | "type": "uint256[]" 214 | } 215 | ], 216 | "name": "batchMintERC721Token", 217 | "outputs": [], 218 | "stateMutability": "nonpayable", 219 | "type": "function" 220 | }, 221 | { 222 | "inputs": [], 223 | "name": "bridgeAddress", 224 | "outputs": [ 225 | { 226 | "internalType": "address", 227 | "name": "", 228 | "type": "address" 229 | } 230 | ], 231 | "stateMutability": "view", 232 | "type": "function" 233 | }, 234 | { 235 | "inputs": [ 236 | { 237 | "internalType": "address", 238 | "name": "", 239 | "type": "address" 240 | } 241 | ], 242 | "name": "erc721TokenInfoSupported", 243 | "outputs": [ 244 | { 245 | "internalType": "bool", 246 | "name": "", 247 | "type": "bool" 248 | } 249 | ], 250 | "stateMutability": "view", 251 | "type": "function" 252 | }, 253 | { 254 | "inputs": [ 255 | { 256 | "internalType": "bytes32", 257 | "name": "", 258 | "type": "bytes32" 259 | } 260 | ], 261 | "name": "erc721TokenInfoToWrappedToken", 262 | "outputs": [ 263 | { 264 | "internalType": "address", 265 | "name": "", 266 | "type": "address" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "bytes32", 276 | "name": "", 277 | "type": "bytes32" 278 | } 279 | ], 280 | "name": "erc721TxHashUnlocked", 281 | "outputs": [ 282 | { 283 | "internalType": "bool", 284 | "name": "", 285 | "type": "bool" 286 | } 287 | ], 288 | "stateMutability": "view", 289 | "type": "function" 290 | }, 291 | { 292 | "inputs": [ 293 | { 294 | "internalType": "address", 295 | "name": "_initialOwner", 296 | "type": "address" 297 | }, 298 | { 299 | "internalType": "address", 300 | "name": "_bridgeAddress", 301 | "type": "address" 302 | } 303 | ], 304 | "name": "initialize", 305 | "outputs": [], 306 | "stateMutability": "nonpayable", 307 | "type": "function" 308 | }, 309 | { 310 | "inputs": [], 311 | "name": "owner", 312 | "outputs": [ 313 | { 314 | "internalType": "address", 315 | "name": "", 316 | "type": "address" 317 | } 318 | ], 319 | "stateMutability": "view", 320 | "type": "function" 321 | }, 322 | { 323 | "inputs": [], 324 | "name": "renounceOwnership", 325 | "outputs": [], 326 | "stateMutability": "nonpayable", 327 | "type": "function" 328 | }, 329 | { 330 | "inputs": [ 331 | { 332 | "internalType": "address", 333 | "name": "token", 334 | "type": "address" 335 | }, 336 | { 337 | "internalType": "string", 338 | "name": "newBaseTokenURI", 339 | "type": "string" 340 | } 341 | ], 342 | "name": "setBaseURI", 343 | "outputs": [], 344 | "stateMutability": "nonpayable", 345 | "type": "function" 346 | }, 347 | { 348 | "inputs": [ 349 | { 350 | "internalType": "address", 351 | "name": "token", 352 | "type": "address" 353 | }, 354 | { 355 | "internalType": "uint256", 356 | "name": "tokenId", 357 | "type": "uint256" 358 | } 359 | ], 360 | "name": "tokenURI", 361 | "outputs": [ 362 | { 363 | "internalType": "string", 364 | "name": "", 365 | "type": "string" 366 | } 367 | ], 368 | "stateMutability": "view", 369 | "type": "function" 370 | }, 371 | { 372 | "inputs": [ 373 | { 374 | "internalType": "address", 375 | "name": "newOwner", 376 | "type": "address" 377 | } 378 | ], 379 | "name": "transferOwnership", 380 | "outputs": [], 381 | "stateMutability": "nonpayable", 382 | "type": "function" 383 | }, 384 | { 385 | "inputs": [ 386 | { 387 | "internalType": "address", 388 | "name": "", 389 | "type": "address" 390 | }, 391 | { 392 | "internalType": "uint256", 393 | "name": "", 394 | "type": "uint256" 395 | } 396 | ], 397 | "name": "userERC721MintTxHash", 398 | "outputs": [ 399 | { 400 | "internalType": "bytes32", 401 | "name": "", 402 | "type": "bytes32" 403 | } 404 | ], 405 | "stateMutability": "view", 406 | "type": "function" 407 | }, 408 | { 409 | "inputs": [ 410 | { 411 | "internalType": "address", 412 | "name": "user", 413 | "type": "address" 414 | } 415 | ], 416 | "name": "userERC721MintTxHashLength", 417 | "outputs": [ 418 | { 419 | "internalType": "uint256", 420 | "name": "", 421 | "type": "uint256" 422 | } 423 | ], 424 | "stateMutability": "view", 425 | "type": "function" 426 | }, 427 | { 428 | "inputs": [], 429 | "name": "version", 430 | "outputs": [ 431 | { 432 | "internalType": "string", 433 | "name": "", 434 | "type": "string" 435 | } 436 | ], 437 | "stateMutability": "view", 438 | "type": "function" 439 | } 440 | ] -------------------------------------------------------------------------------- /abi/v1.2.0-20240315/erc721.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "name", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "symbol", 12 | "type": "string" 13 | }, 14 | { 15 | "internalType": "string", 16 | "name": "baseTokenURI", 17 | "type": "string" 18 | } 19 | ], 20 | "stateMutability": "nonpayable", 21 | "type": "constructor" 22 | }, 23 | { 24 | "inputs": [], 25 | "name": "ERC721EnumerableForbiddenBatchMint", 26 | "type": "error" 27 | }, 28 | { 29 | "inputs": [ 30 | { 31 | "internalType": "address", 32 | "name": "sender", 33 | "type": "address" 34 | }, 35 | { 36 | "internalType": "uint256", 37 | "name": "tokenId", 38 | "type": "uint256" 39 | }, 40 | { 41 | "internalType": "address", 42 | "name": "owner", 43 | "type": "address" 44 | } 45 | ], 46 | "name": "ERC721IncorrectOwner", 47 | "type": "error" 48 | }, 49 | { 50 | "inputs": [ 51 | { 52 | "internalType": "address", 53 | "name": "operator", 54 | "type": "address" 55 | }, 56 | { 57 | "internalType": "uint256", 58 | "name": "tokenId", 59 | "type": "uint256" 60 | } 61 | ], 62 | "name": "ERC721InsufficientApproval", 63 | "type": "error" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "approver", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "ERC721InvalidApprover", 74 | "type": "error" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "operator", 81 | "type": "address" 82 | } 83 | ], 84 | "name": "ERC721InvalidOperator", 85 | "type": "error" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "address", 91 | "name": "owner", 92 | "type": "address" 93 | } 94 | ], 95 | "name": "ERC721InvalidOwner", 96 | "type": "error" 97 | }, 98 | { 99 | "inputs": [ 100 | { 101 | "internalType": "address", 102 | "name": "receiver", 103 | "type": "address" 104 | } 105 | ], 106 | "name": "ERC721InvalidReceiver", 107 | "type": "error" 108 | }, 109 | { 110 | "inputs": [ 111 | { 112 | "internalType": "address", 113 | "name": "sender", 114 | "type": "address" 115 | } 116 | ], 117 | "name": "ERC721InvalidSender", 118 | "type": "error" 119 | }, 120 | { 121 | "inputs": [ 122 | { 123 | "internalType": "uint256", 124 | "name": "tokenId", 125 | "type": "uint256" 126 | } 127 | ], 128 | "name": "ERC721NonexistentToken", 129 | "type": "error" 130 | }, 131 | { 132 | "inputs": [ 133 | { 134 | "internalType": "address", 135 | "name": "owner", 136 | "type": "address" 137 | }, 138 | { 139 | "internalType": "uint256", 140 | "name": "index", 141 | "type": "uint256" 142 | } 143 | ], 144 | "name": "ERC721OutOfBoundsIndex", 145 | "type": "error" 146 | }, 147 | { 148 | "anonymous": false, 149 | "inputs": [ 150 | { 151 | "indexed": true, 152 | "internalType": "address", 153 | "name": "owner", 154 | "type": "address" 155 | }, 156 | { 157 | "indexed": true, 158 | "internalType": "address", 159 | "name": "approved", 160 | "type": "address" 161 | }, 162 | { 163 | "indexed": true, 164 | "internalType": "uint256", 165 | "name": "tokenId", 166 | "type": "uint256" 167 | } 168 | ], 169 | "name": "Approval", 170 | "type": "event" 171 | }, 172 | { 173 | "anonymous": false, 174 | "inputs": [ 175 | { 176 | "indexed": true, 177 | "internalType": "address", 178 | "name": "owner", 179 | "type": "address" 180 | }, 181 | { 182 | "indexed": true, 183 | "internalType": "address", 184 | "name": "operator", 185 | "type": "address" 186 | }, 187 | { 188 | "indexed": false, 189 | "internalType": "bool", 190 | "name": "approved", 191 | "type": "bool" 192 | } 193 | ], 194 | "name": "ApprovalForAll", 195 | "type": "event" 196 | }, 197 | { 198 | "anonymous": false, 199 | "inputs": [ 200 | { 201 | "indexed": true, 202 | "internalType": "address", 203 | "name": "from", 204 | "type": "address" 205 | }, 206 | { 207 | "indexed": true, 208 | "internalType": "address", 209 | "name": "to", 210 | "type": "address" 211 | }, 212 | { 213 | "indexed": true, 214 | "internalType": "uint256", 215 | "name": "tokenId", 216 | "type": "uint256" 217 | } 218 | ], 219 | "name": "Transfer", 220 | "type": "event" 221 | }, 222 | { 223 | "inputs": [ 224 | { 225 | "internalType": "address", 226 | "name": "to", 227 | "type": "address" 228 | }, 229 | { 230 | "internalType": "uint256", 231 | "name": "tokenId", 232 | "type": "uint256" 233 | } 234 | ], 235 | "name": "approve", 236 | "outputs": [], 237 | "stateMutability": "nonpayable", 238 | "type": "function" 239 | }, 240 | { 241 | "inputs": [ 242 | { 243 | "internalType": "address", 244 | "name": "owner", 245 | "type": "address" 246 | } 247 | ], 248 | "name": "balanceOf", 249 | "outputs": [ 250 | { 251 | "internalType": "uint256", 252 | "name": "", 253 | "type": "uint256" 254 | } 255 | ], 256 | "stateMutability": "view", 257 | "type": "function" 258 | }, 259 | { 260 | "inputs": [], 261 | "name": "bridgeAddress", 262 | "outputs": [ 263 | { 264 | "internalType": "address", 265 | "name": "", 266 | "type": "address" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "address", 276 | "name": "sender", 277 | "type": "address" 278 | }, 279 | { 280 | "internalType": "uint256", 281 | "name": "tokenId", 282 | "type": "uint256" 283 | } 284 | ], 285 | "name": "burn", 286 | "outputs": [ 287 | { 288 | "internalType": "string", 289 | "name": "", 290 | "type": "string" 291 | } 292 | ], 293 | "stateMutability": "nonpayable", 294 | "type": "function" 295 | }, 296 | { 297 | "inputs": [ 298 | { 299 | "internalType": "uint256", 300 | "name": "tokenId", 301 | "type": "uint256" 302 | } 303 | ], 304 | "name": "getApproved", 305 | "outputs": [ 306 | { 307 | "internalType": "address", 308 | "name": "", 309 | "type": "address" 310 | } 311 | ], 312 | "stateMutability": "view", 313 | "type": "function" 314 | }, 315 | { 316 | "inputs": [], 317 | "name": "getBaseURI", 318 | "outputs": [ 319 | { 320 | "internalType": "string", 321 | "name": "", 322 | "type": "string" 323 | } 324 | ], 325 | "stateMutability": "view", 326 | "type": "function" 327 | }, 328 | { 329 | "inputs": [ 330 | { 331 | "internalType": "address", 332 | "name": "owner", 333 | "type": "address" 334 | }, 335 | { 336 | "internalType": "address", 337 | "name": "operator", 338 | "type": "address" 339 | } 340 | ], 341 | "name": "isApprovedForAll", 342 | "outputs": [ 343 | { 344 | "internalType": "bool", 345 | "name": "", 346 | "type": "bool" 347 | } 348 | ], 349 | "stateMutability": "view", 350 | "type": "function" 351 | }, 352 | { 353 | "inputs": [ 354 | { 355 | "internalType": "address", 356 | "name": "to", 357 | "type": "address" 358 | }, 359 | { 360 | "internalType": "uint256", 361 | "name": "tokenId", 362 | "type": "uint256" 363 | }, 364 | { 365 | "internalType": "string", 366 | "name": "inscriptionId", 367 | "type": "string" 368 | } 369 | ], 370 | "name": "mint", 371 | "outputs": [], 372 | "stateMutability": "nonpayable", 373 | "type": "function" 374 | }, 375 | { 376 | "inputs": [ 377 | { 378 | "internalType": "string", 379 | "name": "", 380 | "type": "string" 381 | } 382 | ], 383 | "name": "mpInscriptionId2TokenId", 384 | "outputs": [ 385 | { 386 | "internalType": "uint256", 387 | "name": "tokenId", 388 | "type": "uint256" 389 | }, 390 | { 391 | "internalType": "bool", 392 | "name": "isUsed", 393 | "type": "bool" 394 | } 395 | ], 396 | "stateMutability": "view", 397 | "type": "function" 398 | }, 399 | { 400 | "inputs": [ 401 | { 402 | "internalType": "uint256", 403 | "name": "", 404 | "type": "uint256" 405 | } 406 | ], 407 | "name": "mpTokenId2InscriptionId", 408 | "outputs": [ 409 | { 410 | "internalType": "string", 411 | "name": "", 412 | "type": "string" 413 | } 414 | ], 415 | "stateMutability": "view", 416 | "type": "function" 417 | }, 418 | { 419 | "inputs": [], 420 | "name": "name", 421 | "outputs": [ 422 | { 423 | "internalType": "string", 424 | "name": "", 425 | "type": "string" 426 | } 427 | ], 428 | "stateMutability": "view", 429 | "type": "function" 430 | }, 431 | { 432 | "inputs": [ 433 | { 434 | "internalType": "uint256", 435 | "name": "tokenId", 436 | "type": "uint256" 437 | } 438 | ], 439 | "name": "ownerOf", 440 | "outputs": [ 441 | { 442 | "internalType": "address", 443 | "name": "", 444 | "type": "address" 445 | } 446 | ], 447 | "stateMutability": "view", 448 | "type": "function" 449 | }, 450 | { 451 | "inputs": [ 452 | { 453 | "internalType": "address", 454 | "name": "from", 455 | "type": "address" 456 | }, 457 | { 458 | "internalType": "address", 459 | "name": "to", 460 | "type": "address" 461 | }, 462 | { 463 | "internalType": "uint256", 464 | "name": "tokenId", 465 | "type": "uint256" 466 | } 467 | ], 468 | "name": "safeTransferFrom", 469 | "outputs": [], 470 | "stateMutability": "nonpayable", 471 | "type": "function" 472 | }, 473 | { 474 | "inputs": [ 475 | { 476 | "internalType": "address", 477 | "name": "from", 478 | "type": "address" 479 | }, 480 | { 481 | "internalType": "address", 482 | "name": "to", 483 | "type": "address" 484 | }, 485 | { 486 | "internalType": "uint256", 487 | "name": "tokenId", 488 | "type": "uint256" 489 | }, 490 | { 491 | "internalType": "bytes", 492 | "name": "data", 493 | "type": "bytes" 494 | } 495 | ], 496 | "name": "safeTransferFrom", 497 | "outputs": [], 498 | "stateMutability": "nonpayable", 499 | "type": "function" 500 | }, 501 | { 502 | "inputs": [ 503 | { 504 | "internalType": "address", 505 | "name": "operator", 506 | "type": "address" 507 | }, 508 | { 509 | "internalType": "bool", 510 | "name": "approved", 511 | "type": "bool" 512 | } 513 | ], 514 | "name": "setApprovalForAll", 515 | "outputs": [], 516 | "stateMutability": "nonpayable", 517 | "type": "function" 518 | }, 519 | { 520 | "inputs": [ 521 | { 522 | "internalType": "string", 523 | "name": "newBaseTokenURI", 524 | "type": "string" 525 | } 526 | ], 527 | "name": "setBaseURI", 528 | "outputs": [], 529 | "stateMutability": "nonpayable", 530 | "type": "function" 531 | }, 532 | { 533 | "inputs": [ 534 | { 535 | "internalType": "bytes4", 536 | "name": "interfaceId", 537 | "type": "bytes4" 538 | } 539 | ], 540 | "name": "supportsInterface", 541 | "outputs": [ 542 | { 543 | "internalType": "bool", 544 | "name": "", 545 | "type": "bool" 546 | } 547 | ], 548 | "stateMutability": "view", 549 | "type": "function" 550 | }, 551 | { 552 | "inputs": [], 553 | "name": "symbol", 554 | "outputs": [ 555 | { 556 | "internalType": "string", 557 | "name": "", 558 | "type": "string" 559 | } 560 | ], 561 | "stateMutability": "view", 562 | "type": "function" 563 | }, 564 | { 565 | "inputs": [ 566 | { 567 | "internalType": "uint256", 568 | "name": "index", 569 | "type": "uint256" 570 | } 571 | ], 572 | "name": "tokenByIndex", 573 | "outputs": [ 574 | { 575 | "internalType": "uint256", 576 | "name": "", 577 | "type": "uint256" 578 | } 579 | ], 580 | "stateMutability": "view", 581 | "type": "function" 582 | }, 583 | { 584 | "inputs": [ 585 | { 586 | "internalType": "address", 587 | "name": "owner", 588 | "type": "address" 589 | }, 590 | { 591 | "internalType": "uint256", 592 | "name": "index", 593 | "type": "uint256" 594 | } 595 | ], 596 | "name": "tokenOfOwnerByIndex", 597 | "outputs": [ 598 | { 599 | "internalType": "uint256", 600 | "name": "", 601 | "type": "uint256" 602 | } 603 | ], 604 | "stateMutability": "view", 605 | "type": "function" 606 | }, 607 | { 608 | "inputs": [ 609 | { 610 | "internalType": "uint256", 611 | "name": "tokenId", 612 | "type": "uint256" 613 | } 614 | ], 615 | "name": "tokenURI", 616 | "outputs": [ 617 | { 618 | "internalType": "string", 619 | "name": "", 620 | "type": "string" 621 | } 622 | ], 623 | "stateMutability": "view", 624 | "type": "function" 625 | }, 626 | { 627 | "inputs": [], 628 | "name": "totalSupply", 629 | "outputs": [ 630 | { 631 | "internalType": "uint256", 632 | "name": "", 633 | "type": "uint256" 634 | } 635 | ], 636 | "stateMutability": "view", 637 | "type": "function" 638 | }, 639 | { 640 | "inputs": [ 641 | { 642 | "internalType": "address", 643 | "name": "from", 644 | "type": "address" 645 | }, 646 | { 647 | "internalType": "address", 648 | "name": "to", 649 | "type": "address" 650 | }, 651 | { 652 | "internalType": "uint256", 653 | "name": "tokenId", 654 | "type": "uint256" 655 | } 656 | ], 657 | "name": "transferFrom", 658 | "outputs": [], 659 | "stateMutability": "nonpayable", 660 | "type": "function" 661 | } 662 | ] -------------------------------------------------------------------------------- /abi/v1.3.0-20240327/bridge-erc20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "uint8", 80 | "name": "_decimals", 81 | "type": "uint8" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "_cap", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "addERC20TokenWrapped", 90 | "outputs": [ 91 | { 92 | "internalType": "address", 93 | "name": "", 94 | "type": "address" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "uint256", 104 | "name": "", 105 | "type": "uint256" 106 | } 107 | ], 108 | "name": "allERC20TokenAddress", 109 | "outputs": [ 110 | { 111 | "internalType": "address", 112 | "name": "", 113 | "type": "address" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [], 121 | "name": "allERC20TokenAddressLength", 122 | "outputs": [ 123 | { 124 | "internalType": "uint256", 125 | "name": "", 126 | "type": "uint256" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "uint256", 136 | "name": "", 137 | "type": "uint256" 138 | } 139 | ], 140 | "name": "allERC20TxHash", 141 | "outputs": [ 142 | { 143 | "internalType": "bytes32", 144 | "name": "", 145 | "type": "bytes32" 146 | } 147 | ], 148 | "stateMutability": "view", 149 | "type": "function" 150 | }, 151 | { 152 | "inputs": [], 153 | "name": "allERC20TxHashLength", 154 | "outputs": [ 155 | { 156 | "internalType": "uint256", 157 | "name": "", 158 | "type": "uint256" 159 | } 160 | ], 161 | "stateMutability": "view", 162 | "type": "function" 163 | }, 164 | { 165 | "inputs": [], 166 | "name": "bridgeAddress", 167 | "outputs": [ 168 | { 169 | "internalType": "address", 170 | "name": "", 171 | "type": "address" 172 | } 173 | ], 174 | "stateMutability": "view", 175 | "type": "function" 176 | }, 177 | { 178 | "inputs": [ 179 | { 180 | "internalType": "address", 181 | "name": "sender", 182 | "type": "address" 183 | }, 184 | { 185 | "internalType": "address", 186 | "name": "token", 187 | "type": "address" 188 | }, 189 | { 190 | "internalType": "uint256", 191 | "name": "amount", 192 | "type": "uint256" 193 | } 194 | ], 195 | "name": "burnERC20Token", 196 | "outputs": [], 197 | "stateMutability": "nonpayable", 198 | "type": "function" 199 | }, 200 | { 201 | "inputs": [ 202 | { 203 | "internalType": "address", 204 | "name": "", 205 | "type": "address" 206 | } 207 | ], 208 | "name": "erc20TokenInfoSupported", 209 | "outputs": [ 210 | { 211 | "internalType": "bool", 212 | "name": "", 213 | "type": "bool" 214 | } 215 | ], 216 | "stateMutability": "view", 217 | "type": "function" 218 | }, 219 | { 220 | "inputs": [ 221 | { 222 | "internalType": "bytes32", 223 | "name": "", 224 | "type": "bytes32" 225 | } 226 | ], 227 | "name": "erc20TokenInfoToWrappedToken", 228 | "outputs": [ 229 | { 230 | "internalType": "address", 231 | "name": "", 232 | "type": "address" 233 | } 234 | ], 235 | "stateMutability": "view", 236 | "type": "function" 237 | }, 238 | { 239 | "inputs": [ 240 | { 241 | "internalType": "bytes32", 242 | "name": "", 243 | "type": "bytes32" 244 | } 245 | ], 246 | "name": "erc20TxHashUnlocked", 247 | "outputs": [ 248 | { 249 | "internalType": "bool", 250 | "name": "", 251 | "type": "bool" 252 | } 253 | ], 254 | "stateMutability": "view", 255 | "type": "function" 256 | }, 257 | { 258 | "inputs": [ 259 | { 260 | "internalType": "address", 261 | "name": "_initialOwner", 262 | "type": "address" 263 | }, 264 | { 265 | "internalType": "address", 266 | "name": "_bridgeAddress", 267 | "type": "address" 268 | } 269 | ], 270 | "name": "initialize", 271 | "outputs": [], 272 | "stateMutability": "nonpayable", 273 | "type": "function" 274 | }, 275 | { 276 | "inputs": [ 277 | { 278 | "internalType": "bytes32", 279 | "name": "txHash", 280 | "type": "bytes32" 281 | }, 282 | { 283 | "internalType": "address", 284 | "name": "token", 285 | "type": "address" 286 | }, 287 | { 288 | "internalType": "address", 289 | "name": "to", 290 | "type": "address" 291 | }, 292 | { 293 | "internalType": "uint256", 294 | "name": "amount", 295 | "type": "uint256" 296 | } 297 | ], 298 | "name": "mintERC20Token", 299 | "outputs": [], 300 | "stateMutability": "nonpayable", 301 | "type": "function" 302 | }, 303 | { 304 | "inputs": [], 305 | "name": "owner", 306 | "outputs": [ 307 | { 308 | "internalType": "address", 309 | "name": "", 310 | "type": "address" 311 | } 312 | ], 313 | "stateMutability": "view", 314 | "type": "function" 315 | }, 316 | { 317 | "inputs": [], 318 | "name": "renounceOwnership", 319 | "outputs": [], 320 | "stateMutability": "nonpayable", 321 | "type": "function" 322 | }, 323 | { 324 | "inputs": [ 325 | { 326 | "internalType": "address", 327 | "name": "token", 328 | "type": "address" 329 | }, 330 | { 331 | "internalType": "address", 332 | "name": "account", 333 | "type": "address" 334 | }, 335 | { 336 | "internalType": "bool", 337 | "name": "state", 338 | "type": "bool" 339 | } 340 | ], 341 | "name": "setBlackListERC20Token", 342 | "outputs": [], 343 | "stateMutability": "nonpayable", 344 | "type": "function" 345 | }, 346 | { 347 | "inputs": [ 348 | { 349 | "internalType": "address", 350 | "name": "newOwner", 351 | "type": "address" 352 | } 353 | ], 354 | "name": "transferOwnership", 355 | "outputs": [], 356 | "stateMutability": "nonpayable", 357 | "type": "function" 358 | }, 359 | { 360 | "inputs": [ 361 | { 362 | "internalType": "address", 363 | "name": "", 364 | "type": "address" 365 | }, 366 | { 367 | "internalType": "uint256", 368 | "name": "", 369 | "type": "uint256" 370 | } 371 | ], 372 | "name": "userERC20MintTxHash", 373 | "outputs": [ 374 | { 375 | "internalType": "bytes32", 376 | "name": "", 377 | "type": "bytes32" 378 | } 379 | ], 380 | "stateMutability": "view", 381 | "type": "function" 382 | }, 383 | { 384 | "inputs": [ 385 | { 386 | "internalType": "address", 387 | "name": "user", 388 | "type": "address" 389 | } 390 | ], 391 | "name": "userERC20MintTxHashLength", 392 | "outputs": [ 393 | { 394 | "internalType": "uint256", 395 | "name": "", 396 | "type": "uint256" 397 | } 398 | ], 399 | "stateMutability": "view", 400 | "type": "function" 401 | }, 402 | { 403 | "inputs": [], 404 | "name": "version", 405 | "outputs": [ 406 | { 407 | "internalType": "string", 408 | "name": "", 409 | "type": "string" 410 | } 411 | ], 412 | "stateMutability": "view", 413 | "type": "function" 414 | } 415 | ] -------------------------------------------------------------------------------- /abi/v1.3.0-20240327/bridge-erc721.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "string", 80 | "name": "_baseURI", 81 | "type": "string" 82 | } 83 | ], 84 | "name": "addERC721TokenWrapped", 85 | "outputs": [ 86 | { 87 | "internalType": "address", 88 | "name": "", 89 | "type": "address" 90 | } 91 | ], 92 | "stateMutability": "nonpayable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "uint256", 99 | "name": "", 100 | "type": "uint256" 101 | } 102 | ], 103 | "name": "allERC721TokenAddress", 104 | "outputs": [ 105 | { 106 | "internalType": "address", 107 | "name": "", 108 | "type": "address" 109 | } 110 | ], 111 | "stateMutability": "view", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [], 116 | "name": "allERC721TokenAddressLength", 117 | "outputs": [ 118 | { 119 | "internalType": "uint256", 120 | "name": "", 121 | "type": "uint256" 122 | } 123 | ], 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "inputs": [ 129 | { 130 | "internalType": "uint256", 131 | "name": "", 132 | "type": "uint256" 133 | } 134 | ], 135 | "name": "allERC721TxHash", 136 | "outputs": [ 137 | { 138 | "internalType": "bytes32", 139 | "name": "", 140 | "type": "bytes32" 141 | } 142 | ], 143 | "stateMutability": "view", 144 | "type": "function" 145 | }, 146 | { 147 | "inputs": [], 148 | "name": "allERC721TxHashLength", 149 | "outputs": [ 150 | { 151 | "internalType": "uint256", 152 | "name": "", 153 | "type": "uint256" 154 | } 155 | ], 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [ 161 | { 162 | "internalType": "address", 163 | "name": "sender", 164 | "type": "address" 165 | }, 166 | { 167 | "internalType": "address", 168 | "name": "token", 169 | "type": "address" 170 | }, 171 | { 172 | "internalType": "uint256[]", 173 | "name": "tokenIds", 174 | "type": "uint256[]" 175 | } 176 | ], 177 | "name": "batchBurnERC721Token", 178 | "outputs": [ 179 | { 180 | "internalType": "string[]", 181 | "name": "", 182 | "type": "string[]" 183 | } 184 | ], 185 | "stateMutability": "nonpayable", 186 | "type": "function" 187 | }, 188 | { 189 | "inputs": [ 190 | { 191 | "internalType": "bytes32", 192 | "name": "txHash", 193 | "type": "bytes32" 194 | }, 195 | { 196 | "internalType": "address", 197 | "name": "token", 198 | "type": "address" 199 | }, 200 | { 201 | "internalType": "address", 202 | "name": "to", 203 | "type": "address" 204 | }, 205 | { 206 | "internalType": "string[]", 207 | "name": "inscriptionIds", 208 | "type": "string[]" 209 | }, 210 | { 211 | "internalType": "uint256[]", 212 | "name": "tokenIds", 213 | "type": "uint256[]" 214 | } 215 | ], 216 | "name": "batchMintERC721Token", 217 | "outputs": [], 218 | "stateMutability": "nonpayable", 219 | "type": "function" 220 | }, 221 | { 222 | "inputs": [], 223 | "name": "bridgeAddress", 224 | "outputs": [ 225 | { 226 | "internalType": "address", 227 | "name": "", 228 | "type": "address" 229 | } 230 | ], 231 | "stateMutability": "view", 232 | "type": "function" 233 | }, 234 | { 235 | "inputs": [ 236 | { 237 | "internalType": "address", 238 | "name": "", 239 | "type": "address" 240 | } 241 | ], 242 | "name": "erc721TokenInfoSupported", 243 | "outputs": [ 244 | { 245 | "internalType": "bool", 246 | "name": "", 247 | "type": "bool" 248 | } 249 | ], 250 | "stateMutability": "view", 251 | "type": "function" 252 | }, 253 | { 254 | "inputs": [ 255 | { 256 | "internalType": "bytes32", 257 | "name": "", 258 | "type": "bytes32" 259 | } 260 | ], 261 | "name": "erc721TokenInfoToWrappedToken", 262 | "outputs": [ 263 | { 264 | "internalType": "address", 265 | "name": "", 266 | "type": "address" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "bytes32", 276 | "name": "", 277 | "type": "bytes32" 278 | } 279 | ], 280 | "name": "erc721TxHashUnlocked", 281 | "outputs": [ 282 | { 283 | "internalType": "bool", 284 | "name": "", 285 | "type": "bool" 286 | } 287 | ], 288 | "stateMutability": "view", 289 | "type": "function" 290 | }, 291 | { 292 | "inputs": [ 293 | { 294 | "internalType": "address", 295 | "name": "_initialOwner", 296 | "type": "address" 297 | }, 298 | { 299 | "internalType": "address", 300 | "name": "_bridgeAddress", 301 | "type": "address" 302 | } 303 | ], 304 | "name": "initialize", 305 | "outputs": [], 306 | "stateMutability": "nonpayable", 307 | "type": "function" 308 | }, 309 | { 310 | "inputs": [], 311 | "name": "owner", 312 | "outputs": [ 313 | { 314 | "internalType": "address", 315 | "name": "", 316 | "type": "address" 317 | } 318 | ], 319 | "stateMutability": "view", 320 | "type": "function" 321 | }, 322 | { 323 | "inputs": [], 324 | "name": "renounceOwnership", 325 | "outputs": [], 326 | "stateMutability": "nonpayable", 327 | "type": "function" 328 | }, 329 | { 330 | "inputs": [ 331 | { 332 | "internalType": "address", 333 | "name": "token", 334 | "type": "address" 335 | }, 336 | { 337 | "internalType": "string", 338 | "name": "newBaseTokenURI", 339 | "type": "string" 340 | } 341 | ], 342 | "name": "setBaseURI", 343 | "outputs": [], 344 | "stateMutability": "nonpayable", 345 | "type": "function" 346 | }, 347 | { 348 | "inputs": [ 349 | { 350 | "internalType": "address", 351 | "name": "token", 352 | "type": "address" 353 | }, 354 | { 355 | "internalType": "uint256", 356 | "name": "tokenId", 357 | "type": "uint256" 358 | } 359 | ], 360 | "name": "tokenURI", 361 | "outputs": [ 362 | { 363 | "internalType": "string", 364 | "name": "", 365 | "type": "string" 366 | } 367 | ], 368 | "stateMutability": "view", 369 | "type": "function" 370 | }, 371 | { 372 | "inputs": [ 373 | { 374 | "internalType": "address", 375 | "name": "newOwner", 376 | "type": "address" 377 | } 378 | ], 379 | "name": "transferOwnership", 380 | "outputs": [], 381 | "stateMutability": "nonpayable", 382 | "type": "function" 383 | }, 384 | { 385 | "inputs": [ 386 | { 387 | "internalType": "address", 388 | "name": "", 389 | "type": "address" 390 | }, 391 | { 392 | "internalType": "uint256", 393 | "name": "", 394 | "type": "uint256" 395 | } 396 | ], 397 | "name": "userERC721MintTxHash", 398 | "outputs": [ 399 | { 400 | "internalType": "bytes32", 401 | "name": "", 402 | "type": "bytes32" 403 | } 404 | ], 405 | "stateMutability": "view", 406 | "type": "function" 407 | }, 408 | { 409 | "inputs": [ 410 | { 411 | "internalType": "address", 412 | "name": "user", 413 | "type": "address" 414 | } 415 | ], 416 | "name": "userERC721MintTxHashLength", 417 | "outputs": [ 418 | { 419 | "internalType": "uint256", 420 | "name": "", 421 | "type": "uint256" 422 | } 423 | ], 424 | "stateMutability": "view", 425 | "type": "function" 426 | }, 427 | { 428 | "inputs": [], 429 | "name": "version", 430 | "outputs": [ 431 | { 432 | "internalType": "string", 433 | "name": "", 434 | "type": "string" 435 | } 436 | ], 437 | "stateMutability": "view", 438 | "type": "function" 439 | } 440 | ] -------------------------------------------------------------------------------- /abi/v1.3.0-20240327/erc721.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "name", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "symbol", 12 | "type": "string" 13 | }, 14 | { 15 | "internalType": "string", 16 | "name": "baseTokenURI", 17 | "type": "string" 18 | } 19 | ], 20 | "stateMutability": "nonpayable", 21 | "type": "constructor" 22 | }, 23 | { 24 | "inputs": [], 25 | "name": "ERC721EnumerableForbiddenBatchMint", 26 | "type": "error" 27 | }, 28 | { 29 | "inputs": [ 30 | { 31 | "internalType": "address", 32 | "name": "sender", 33 | "type": "address" 34 | }, 35 | { 36 | "internalType": "uint256", 37 | "name": "tokenId", 38 | "type": "uint256" 39 | }, 40 | { 41 | "internalType": "address", 42 | "name": "owner", 43 | "type": "address" 44 | } 45 | ], 46 | "name": "ERC721IncorrectOwner", 47 | "type": "error" 48 | }, 49 | { 50 | "inputs": [ 51 | { 52 | "internalType": "address", 53 | "name": "operator", 54 | "type": "address" 55 | }, 56 | { 57 | "internalType": "uint256", 58 | "name": "tokenId", 59 | "type": "uint256" 60 | } 61 | ], 62 | "name": "ERC721InsufficientApproval", 63 | "type": "error" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "approver", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "ERC721InvalidApprover", 74 | "type": "error" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "operator", 81 | "type": "address" 82 | } 83 | ], 84 | "name": "ERC721InvalidOperator", 85 | "type": "error" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "address", 91 | "name": "owner", 92 | "type": "address" 93 | } 94 | ], 95 | "name": "ERC721InvalidOwner", 96 | "type": "error" 97 | }, 98 | { 99 | "inputs": [ 100 | { 101 | "internalType": "address", 102 | "name": "receiver", 103 | "type": "address" 104 | } 105 | ], 106 | "name": "ERC721InvalidReceiver", 107 | "type": "error" 108 | }, 109 | { 110 | "inputs": [ 111 | { 112 | "internalType": "address", 113 | "name": "sender", 114 | "type": "address" 115 | } 116 | ], 117 | "name": "ERC721InvalidSender", 118 | "type": "error" 119 | }, 120 | { 121 | "inputs": [ 122 | { 123 | "internalType": "uint256", 124 | "name": "tokenId", 125 | "type": "uint256" 126 | } 127 | ], 128 | "name": "ERC721NonexistentToken", 129 | "type": "error" 130 | }, 131 | { 132 | "inputs": [ 133 | { 134 | "internalType": "address", 135 | "name": "owner", 136 | "type": "address" 137 | }, 138 | { 139 | "internalType": "uint256", 140 | "name": "index", 141 | "type": "uint256" 142 | } 143 | ], 144 | "name": "ERC721OutOfBoundsIndex", 145 | "type": "error" 146 | }, 147 | { 148 | "anonymous": false, 149 | "inputs": [ 150 | { 151 | "indexed": true, 152 | "internalType": "address", 153 | "name": "owner", 154 | "type": "address" 155 | }, 156 | { 157 | "indexed": true, 158 | "internalType": "address", 159 | "name": "approved", 160 | "type": "address" 161 | }, 162 | { 163 | "indexed": true, 164 | "internalType": "uint256", 165 | "name": "tokenId", 166 | "type": "uint256" 167 | } 168 | ], 169 | "name": "Approval", 170 | "type": "event" 171 | }, 172 | { 173 | "anonymous": false, 174 | "inputs": [ 175 | { 176 | "indexed": true, 177 | "internalType": "address", 178 | "name": "owner", 179 | "type": "address" 180 | }, 181 | { 182 | "indexed": true, 183 | "internalType": "address", 184 | "name": "operator", 185 | "type": "address" 186 | }, 187 | { 188 | "indexed": false, 189 | "internalType": "bool", 190 | "name": "approved", 191 | "type": "bool" 192 | } 193 | ], 194 | "name": "ApprovalForAll", 195 | "type": "event" 196 | }, 197 | { 198 | "anonymous": false, 199 | "inputs": [ 200 | { 201 | "indexed": true, 202 | "internalType": "address", 203 | "name": "from", 204 | "type": "address" 205 | }, 206 | { 207 | "indexed": true, 208 | "internalType": "address", 209 | "name": "to", 210 | "type": "address" 211 | }, 212 | { 213 | "indexed": true, 214 | "internalType": "uint256", 215 | "name": "tokenId", 216 | "type": "uint256" 217 | } 218 | ], 219 | "name": "Transfer", 220 | "type": "event" 221 | }, 222 | { 223 | "inputs": [ 224 | { 225 | "internalType": "address", 226 | "name": "to", 227 | "type": "address" 228 | }, 229 | { 230 | "internalType": "uint256", 231 | "name": "tokenId", 232 | "type": "uint256" 233 | } 234 | ], 235 | "name": "approve", 236 | "outputs": [], 237 | "stateMutability": "nonpayable", 238 | "type": "function" 239 | }, 240 | { 241 | "inputs": [ 242 | { 243 | "internalType": "address", 244 | "name": "owner", 245 | "type": "address" 246 | } 247 | ], 248 | "name": "balanceOf", 249 | "outputs": [ 250 | { 251 | "internalType": "uint256", 252 | "name": "", 253 | "type": "uint256" 254 | } 255 | ], 256 | "stateMutability": "view", 257 | "type": "function" 258 | }, 259 | { 260 | "inputs": [], 261 | "name": "bridgeAddress", 262 | "outputs": [ 263 | { 264 | "internalType": "address", 265 | "name": "", 266 | "type": "address" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "address", 276 | "name": "sender", 277 | "type": "address" 278 | }, 279 | { 280 | "internalType": "uint256", 281 | "name": "tokenId", 282 | "type": "uint256" 283 | } 284 | ], 285 | "name": "burn", 286 | "outputs": [ 287 | { 288 | "internalType": "string", 289 | "name": "", 290 | "type": "string" 291 | } 292 | ], 293 | "stateMutability": "nonpayable", 294 | "type": "function" 295 | }, 296 | { 297 | "inputs": [ 298 | { 299 | "internalType": "uint256", 300 | "name": "tokenId", 301 | "type": "uint256" 302 | } 303 | ], 304 | "name": "getApproved", 305 | "outputs": [ 306 | { 307 | "internalType": "address", 308 | "name": "", 309 | "type": "address" 310 | } 311 | ], 312 | "stateMutability": "view", 313 | "type": "function" 314 | }, 315 | { 316 | "inputs": [], 317 | "name": "getBaseURI", 318 | "outputs": [ 319 | { 320 | "internalType": "string", 321 | "name": "", 322 | "type": "string" 323 | } 324 | ], 325 | "stateMutability": "view", 326 | "type": "function" 327 | }, 328 | { 329 | "inputs": [ 330 | { 331 | "internalType": "address", 332 | "name": "owner", 333 | "type": "address" 334 | }, 335 | { 336 | "internalType": "address", 337 | "name": "operator", 338 | "type": "address" 339 | } 340 | ], 341 | "name": "isApprovedForAll", 342 | "outputs": [ 343 | { 344 | "internalType": "bool", 345 | "name": "", 346 | "type": "bool" 347 | } 348 | ], 349 | "stateMutability": "view", 350 | "type": "function" 351 | }, 352 | { 353 | "inputs": [ 354 | { 355 | "internalType": "address", 356 | "name": "to", 357 | "type": "address" 358 | }, 359 | { 360 | "internalType": "uint256", 361 | "name": "tokenId", 362 | "type": "uint256" 363 | }, 364 | { 365 | "internalType": "string", 366 | "name": "inscriptionId", 367 | "type": "string" 368 | } 369 | ], 370 | "name": "mint", 371 | "outputs": [], 372 | "stateMutability": "nonpayable", 373 | "type": "function" 374 | }, 375 | { 376 | "inputs": [ 377 | { 378 | "internalType": "string", 379 | "name": "", 380 | "type": "string" 381 | } 382 | ], 383 | "name": "mpInscriptionId2TokenId", 384 | "outputs": [ 385 | { 386 | "internalType": "uint256", 387 | "name": "tokenId", 388 | "type": "uint256" 389 | }, 390 | { 391 | "internalType": "bool", 392 | "name": "isUsed", 393 | "type": "bool" 394 | } 395 | ], 396 | "stateMutability": "view", 397 | "type": "function" 398 | }, 399 | { 400 | "inputs": [ 401 | { 402 | "internalType": "uint256", 403 | "name": "", 404 | "type": "uint256" 405 | } 406 | ], 407 | "name": "mpTokenId2InscriptionId", 408 | "outputs": [ 409 | { 410 | "internalType": "string", 411 | "name": "", 412 | "type": "string" 413 | } 414 | ], 415 | "stateMutability": "view", 416 | "type": "function" 417 | }, 418 | { 419 | "inputs": [], 420 | "name": "name", 421 | "outputs": [ 422 | { 423 | "internalType": "string", 424 | "name": "", 425 | "type": "string" 426 | } 427 | ], 428 | "stateMutability": "view", 429 | "type": "function" 430 | }, 431 | { 432 | "inputs": [ 433 | { 434 | "internalType": "uint256", 435 | "name": "tokenId", 436 | "type": "uint256" 437 | } 438 | ], 439 | "name": "ownerOf", 440 | "outputs": [ 441 | { 442 | "internalType": "address", 443 | "name": "", 444 | "type": "address" 445 | } 446 | ], 447 | "stateMutability": "view", 448 | "type": "function" 449 | }, 450 | { 451 | "inputs": [ 452 | { 453 | "internalType": "address", 454 | "name": "from", 455 | "type": "address" 456 | }, 457 | { 458 | "internalType": "address", 459 | "name": "to", 460 | "type": "address" 461 | }, 462 | { 463 | "internalType": "uint256", 464 | "name": "tokenId", 465 | "type": "uint256" 466 | } 467 | ], 468 | "name": "safeTransferFrom", 469 | "outputs": [], 470 | "stateMutability": "nonpayable", 471 | "type": "function" 472 | }, 473 | { 474 | "inputs": [ 475 | { 476 | "internalType": "address", 477 | "name": "from", 478 | "type": "address" 479 | }, 480 | { 481 | "internalType": "address", 482 | "name": "to", 483 | "type": "address" 484 | }, 485 | { 486 | "internalType": "uint256", 487 | "name": "tokenId", 488 | "type": "uint256" 489 | }, 490 | { 491 | "internalType": "bytes", 492 | "name": "data", 493 | "type": "bytes" 494 | } 495 | ], 496 | "name": "safeTransferFrom", 497 | "outputs": [], 498 | "stateMutability": "nonpayable", 499 | "type": "function" 500 | }, 501 | { 502 | "inputs": [ 503 | { 504 | "internalType": "address", 505 | "name": "operator", 506 | "type": "address" 507 | }, 508 | { 509 | "internalType": "bool", 510 | "name": "approved", 511 | "type": "bool" 512 | } 513 | ], 514 | "name": "setApprovalForAll", 515 | "outputs": [], 516 | "stateMutability": "nonpayable", 517 | "type": "function" 518 | }, 519 | { 520 | "inputs": [ 521 | { 522 | "internalType": "string", 523 | "name": "newBaseTokenURI", 524 | "type": "string" 525 | } 526 | ], 527 | "name": "setBaseURI", 528 | "outputs": [], 529 | "stateMutability": "nonpayable", 530 | "type": "function" 531 | }, 532 | { 533 | "inputs": [ 534 | { 535 | "internalType": "bytes4", 536 | "name": "interfaceId", 537 | "type": "bytes4" 538 | } 539 | ], 540 | "name": "supportsInterface", 541 | "outputs": [ 542 | { 543 | "internalType": "bool", 544 | "name": "", 545 | "type": "bool" 546 | } 547 | ], 548 | "stateMutability": "view", 549 | "type": "function" 550 | }, 551 | { 552 | "inputs": [], 553 | "name": "symbol", 554 | "outputs": [ 555 | { 556 | "internalType": "string", 557 | "name": "", 558 | "type": "string" 559 | } 560 | ], 561 | "stateMutability": "view", 562 | "type": "function" 563 | }, 564 | { 565 | "inputs": [ 566 | { 567 | "internalType": "uint256", 568 | "name": "index", 569 | "type": "uint256" 570 | } 571 | ], 572 | "name": "tokenByIndex", 573 | "outputs": [ 574 | { 575 | "internalType": "uint256", 576 | "name": "", 577 | "type": "uint256" 578 | } 579 | ], 580 | "stateMutability": "view", 581 | "type": "function" 582 | }, 583 | { 584 | "inputs": [ 585 | { 586 | "internalType": "address", 587 | "name": "owner", 588 | "type": "address" 589 | }, 590 | { 591 | "internalType": "uint256", 592 | "name": "index", 593 | "type": "uint256" 594 | } 595 | ], 596 | "name": "tokenOfOwnerByIndex", 597 | "outputs": [ 598 | { 599 | "internalType": "uint256", 600 | "name": "", 601 | "type": "uint256" 602 | } 603 | ], 604 | "stateMutability": "view", 605 | "type": "function" 606 | }, 607 | { 608 | "inputs": [ 609 | { 610 | "internalType": "uint256", 611 | "name": "tokenId", 612 | "type": "uint256" 613 | } 614 | ], 615 | "name": "tokenURI", 616 | "outputs": [ 617 | { 618 | "internalType": "string", 619 | "name": "", 620 | "type": "string" 621 | } 622 | ], 623 | "stateMutability": "view", 624 | "type": "function" 625 | }, 626 | { 627 | "inputs": [], 628 | "name": "totalSupply", 629 | "outputs": [ 630 | { 631 | "internalType": "uint256", 632 | "name": "", 633 | "type": "uint256" 634 | } 635 | ], 636 | "stateMutability": "view", 637 | "type": "function" 638 | }, 639 | { 640 | "inputs": [ 641 | { 642 | "internalType": "address", 643 | "name": "from", 644 | "type": "address" 645 | }, 646 | { 647 | "internalType": "address", 648 | "name": "to", 649 | "type": "address" 650 | }, 651 | { 652 | "internalType": "uint256", 653 | "name": "tokenId", 654 | "type": "uint256" 655 | } 656 | ], 657 | "name": "transferFrom", 658 | "outputs": [], 659 | "stateMutability": "nonpayable", 660 | "type": "function" 661 | } 662 | ] -------------------------------------------------------------------------------- /abi/v1.4.0-20240513/bridge-erc20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "uint8", 80 | "name": "_decimals", 81 | "type": "uint8" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "_cap", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "addERC20TokenWrapped", 90 | "outputs": [ 91 | { 92 | "internalType": "address", 93 | "name": "", 94 | "type": "address" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "uint256", 104 | "name": "", 105 | "type": "uint256" 106 | } 107 | ], 108 | "name": "allERC20TokenAddress", 109 | "outputs": [ 110 | { 111 | "internalType": "address", 112 | "name": "", 113 | "type": "address" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [], 121 | "name": "allERC20TokenAddressLength", 122 | "outputs": [ 123 | { 124 | "internalType": "uint256", 125 | "name": "", 126 | "type": "uint256" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "uint256", 136 | "name": "", 137 | "type": "uint256" 138 | } 139 | ], 140 | "name": "allERC20TxHash", 141 | "outputs": [ 142 | { 143 | "internalType": "bytes32", 144 | "name": "", 145 | "type": "bytes32" 146 | } 147 | ], 148 | "stateMutability": "view", 149 | "type": "function" 150 | }, 151 | { 152 | "inputs": [], 153 | "name": "allERC20TxHashLength", 154 | "outputs": [ 155 | { 156 | "internalType": "uint256", 157 | "name": "", 158 | "type": "uint256" 159 | } 160 | ], 161 | "stateMutability": "view", 162 | "type": "function" 163 | }, 164 | { 165 | "inputs": [], 166 | "name": "bridgeAddress", 167 | "outputs": [ 168 | { 169 | "internalType": "address", 170 | "name": "", 171 | "type": "address" 172 | } 173 | ], 174 | "stateMutability": "view", 175 | "type": "function" 176 | }, 177 | { 178 | "inputs": [ 179 | { 180 | "internalType": "address", 181 | "name": "sender", 182 | "type": "address" 183 | }, 184 | { 185 | "internalType": "address", 186 | "name": "token", 187 | "type": "address" 188 | }, 189 | { 190 | "internalType": "uint256", 191 | "name": "amount", 192 | "type": "uint256" 193 | } 194 | ], 195 | "name": "burnERC20Token", 196 | "outputs": [], 197 | "stateMutability": "nonpayable", 198 | "type": "function" 199 | }, 200 | { 201 | "inputs": [ 202 | { 203 | "internalType": "address", 204 | "name": "", 205 | "type": "address" 206 | } 207 | ], 208 | "name": "erc20TokenInfoSupported", 209 | "outputs": [ 210 | { 211 | "internalType": "bool", 212 | "name": "", 213 | "type": "bool" 214 | } 215 | ], 216 | "stateMutability": "view", 217 | "type": "function" 218 | }, 219 | { 220 | "inputs": [ 221 | { 222 | "internalType": "bytes32", 223 | "name": "", 224 | "type": "bytes32" 225 | } 226 | ], 227 | "name": "erc20TokenInfoToWrappedToken", 228 | "outputs": [ 229 | { 230 | "internalType": "address", 231 | "name": "", 232 | "type": "address" 233 | } 234 | ], 235 | "stateMutability": "view", 236 | "type": "function" 237 | }, 238 | { 239 | "inputs": [ 240 | { 241 | "internalType": "bytes32", 242 | "name": "", 243 | "type": "bytes32" 244 | } 245 | ], 246 | "name": "erc20TxHashUnlocked", 247 | "outputs": [ 248 | { 249 | "internalType": "bool", 250 | "name": "", 251 | "type": "bool" 252 | } 253 | ], 254 | "stateMutability": "view", 255 | "type": "function" 256 | }, 257 | { 258 | "inputs": [ 259 | { 260 | "internalType": "address", 261 | "name": "_initialOwner", 262 | "type": "address" 263 | }, 264 | { 265 | "internalType": "address", 266 | "name": "_bridgeAddress", 267 | "type": "address" 268 | } 269 | ], 270 | "name": "initialize", 271 | "outputs": [], 272 | "stateMutability": "nonpayable", 273 | "type": "function" 274 | }, 275 | { 276 | "inputs": [ 277 | { 278 | "internalType": "bytes32", 279 | "name": "txHash", 280 | "type": "bytes32" 281 | }, 282 | { 283 | "internalType": "address", 284 | "name": "token", 285 | "type": "address" 286 | }, 287 | { 288 | "internalType": "address", 289 | "name": "to", 290 | "type": "address" 291 | }, 292 | { 293 | "internalType": "uint256", 294 | "name": "amount", 295 | "type": "uint256" 296 | } 297 | ], 298 | "name": "mintERC20Token", 299 | "outputs": [], 300 | "stateMutability": "nonpayable", 301 | "type": "function" 302 | }, 303 | { 304 | "inputs": [], 305 | "name": "owner", 306 | "outputs": [ 307 | { 308 | "internalType": "address", 309 | "name": "", 310 | "type": "address" 311 | } 312 | ], 313 | "stateMutability": "view", 314 | "type": "function" 315 | }, 316 | { 317 | "inputs": [], 318 | "name": "renounceOwnership", 319 | "outputs": [], 320 | "stateMutability": "nonpayable", 321 | "type": "function" 322 | }, 323 | { 324 | "inputs": [ 325 | { 326 | "internalType": "address", 327 | "name": "token", 328 | "type": "address" 329 | }, 330 | { 331 | "internalType": "address", 332 | "name": "account", 333 | "type": "address" 334 | }, 335 | { 336 | "internalType": "bool", 337 | "name": "state", 338 | "type": "bool" 339 | } 340 | ], 341 | "name": "setBlackListERC20Token", 342 | "outputs": [], 343 | "stateMutability": "nonpayable", 344 | "type": "function" 345 | }, 346 | { 347 | "inputs": [ 348 | { 349 | "internalType": "address", 350 | "name": "newOwner", 351 | "type": "address" 352 | } 353 | ], 354 | "name": "transferOwnership", 355 | "outputs": [], 356 | "stateMutability": "nonpayable", 357 | "type": "function" 358 | }, 359 | { 360 | "inputs": [ 361 | { 362 | "internalType": "address", 363 | "name": "", 364 | "type": "address" 365 | }, 366 | { 367 | "internalType": "uint256", 368 | "name": "", 369 | "type": "uint256" 370 | } 371 | ], 372 | "name": "userERC20MintTxHash", 373 | "outputs": [ 374 | { 375 | "internalType": "bytes32", 376 | "name": "", 377 | "type": "bytes32" 378 | } 379 | ], 380 | "stateMutability": "view", 381 | "type": "function" 382 | }, 383 | { 384 | "inputs": [ 385 | { 386 | "internalType": "address", 387 | "name": "user", 388 | "type": "address" 389 | } 390 | ], 391 | "name": "userERC20MintTxHashLength", 392 | "outputs": [ 393 | { 394 | "internalType": "uint256", 395 | "name": "", 396 | "type": "uint256" 397 | } 398 | ], 399 | "stateMutability": "view", 400 | "type": "function" 401 | }, 402 | { 403 | "inputs": [], 404 | "name": "version", 405 | "outputs": [ 406 | { 407 | "internalType": "string", 408 | "name": "", 409 | "type": "string" 410 | } 411 | ], 412 | "stateMutability": "view", 413 | "type": "function" 414 | } 415 | ] -------------------------------------------------------------------------------- /abi/v1.4.0-20240513/bridge-erc721.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "InvalidInitialization", 5 | "type": "error" 6 | }, 7 | { 8 | "inputs": [], 9 | "name": "NotInitializing", 10 | "type": "error" 11 | }, 12 | { 13 | "inputs": [ 14 | { 15 | "internalType": "address", 16 | "name": "owner", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "OwnableInvalidOwner", 21 | "type": "error" 22 | }, 23 | { 24 | "inputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "account", 28 | "type": "address" 29 | } 30 | ], 31 | "name": "OwnableUnauthorizedAccount", 32 | "type": "error" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint64", 40 | "name": "version", 41 | "type": "uint64" 42 | } 43 | ], 44 | "name": "Initialized", 45 | "type": "event" 46 | }, 47 | { 48 | "anonymous": false, 49 | "inputs": [ 50 | { 51 | "indexed": true, 52 | "internalType": "address", 53 | "name": "previousOwner", 54 | "type": "address" 55 | }, 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "newOwner", 60 | "type": "address" 61 | } 62 | ], 63 | "name": "OwnershipTransferred", 64 | "type": "event" 65 | }, 66 | { 67 | "inputs": [ 68 | { 69 | "internalType": "string", 70 | "name": "_name", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "_symbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "string", 80 | "name": "_baseURI", 81 | "type": "string" 82 | } 83 | ], 84 | "name": "addERC721TokenWrapped", 85 | "outputs": [ 86 | { 87 | "internalType": "address", 88 | "name": "", 89 | "type": "address" 90 | } 91 | ], 92 | "stateMutability": "nonpayable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "uint256", 99 | "name": "", 100 | "type": "uint256" 101 | } 102 | ], 103 | "name": "allERC721TokenAddress", 104 | "outputs": [ 105 | { 106 | "internalType": "address", 107 | "name": "", 108 | "type": "address" 109 | } 110 | ], 111 | "stateMutability": "view", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [], 116 | "name": "allERC721TokenAddressLength", 117 | "outputs": [ 118 | { 119 | "internalType": "uint256", 120 | "name": "", 121 | "type": "uint256" 122 | } 123 | ], 124 | "stateMutability": "view", 125 | "type": "function" 126 | }, 127 | { 128 | "inputs": [ 129 | { 130 | "internalType": "uint256", 131 | "name": "", 132 | "type": "uint256" 133 | } 134 | ], 135 | "name": "allERC721TxHash", 136 | "outputs": [ 137 | { 138 | "internalType": "bytes32", 139 | "name": "", 140 | "type": "bytes32" 141 | } 142 | ], 143 | "stateMutability": "view", 144 | "type": "function" 145 | }, 146 | { 147 | "inputs": [], 148 | "name": "allERC721TxHashLength", 149 | "outputs": [ 150 | { 151 | "internalType": "uint256", 152 | "name": "", 153 | "type": "uint256" 154 | } 155 | ], 156 | "stateMutability": "view", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [ 161 | { 162 | "internalType": "address", 163 | "name": "sender", 164 | "type": "address" 165 | }, 166 | { 167 | "internalType": "address", 168 | "name": "token", 169 | "type": "address" 170 | }, 171 | { 172 | "internalType": "uint256[]", 173 | "name": "tokenIds", 174 | "type": "uint256[]" 175 | } 176 | ], 177 | "name": "batchBurnERC721Token", 178 | "outputs": [ 179 | { 180 | "internalType": "string[]", 181 | "name": "", 182 | "type": "string[]" 183 | } 184 | ], 185 | "stateMutability": "nonpayable", 186 | "type": "function" 187 | }, 188 | { 189 | "inputs": [ 190 | { 191 | "internalType": "bytes32", 192 | "name": "txHash", 193 | "type": "bytes32" 194 | }, 195 | { 196 | "internalType": "address", 197 | "name": "token", 198 | "type": "address" 199 | }, 200 | { 201 | "internalType": "address", 202 | "name": "to", 203 | "type": "address" 204 | }, 205 | { 206 | "internalType": "string[]", 207 | "name": "inscriptionIds", 208 | "type": "string[]" 209 | }, 210 | { 211 | "internalType": "uint256[]", 212 | "name": "tokenIds", 213 | "type": "uint256[]" 214 | } 215 | ], 216 | "name": "batchMintERC721Token", 217 | "outputs": [], 218 | "stateMutability": "nonpayable", 219 | "type": "function" 220 | }, 221 | { 222 | "inputs": [], 223 | "name": "bridgeAddress", 224 | "outputs": [ 225 | { 226 | "internalType": "address", 227 | "name": "", 228 | "type": "address" 229 | } 230 | ], 231 | "stateMutability": "view", 232 | "type": "function" 233 | }, 234 | { 235 | "inputs": [ 236 | { 237 | "internalType": "address", 238 | "name": "", 239 | "type": "address" 240 | } 241 | ], 242 | "name": "erc721TokenInfoSupported", 243 | "outputs": [ 244 | { 245 | "internalType": "bool", 246 | "name": "", 247 | "type": "bool" 248 | } 249 | ], 250 | "stateMutability": "view", 251 | "type": "function" 252 | }, 253 | { 254 | "inputs": [ 255 | { 256 | "internalType": "bytes32", 257 | "name": "", 258 | "type": "bytes32" 259 | } 260 | ], 261 | "name": "erc721TokenInfoToWrappedToken", 262 | "outputs": [ 263 | { 264 | "internalType": "address", 265 | "name": "", 266 | "type": "address" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "bytes32", 276 | "name": "", 277 | "type": "bytes32" 278 | } 279 | ], 280 | "name": "erc721TxHashUnlocked", 281 | "outputs": [ 282 | { 283 | "internalType": "bool", 284 | "name": "", 285 | "type": "bool" 286 | } 287 | ], 288 | "stateMutability": "view", 289 | "type": "function" 290 | }, 291 | { 292 | "inputs": [ 293 | { 294 | "internalType": "address", 295 | "name": "_initialOwner", 296 | "type": "address" 297 | }, 298 | { 299 | "internalType": "address", 300 | "name": "_bridgeAddress", 301 | "type": "address" 302 | } 303 | ], 304 | "name": "initialize", 305 | "outputs": [], 306 | "stateMutability": "nonpayable", 307 | "type": "function" 308 | }, 309 | { 310 | "inputs": [], 311 | "name": "owner", 312 | "outputs": [ 313 | { 314 | "internalType": "address", 315 | "name": "", 316 | "type": "address" 317 | } 318 | ], 319 | "stateMutability": "view", 320 | "type": "function" 321 | }, 322 | { 323 | "inputs": [], 324 | "name": "renounceOwnership", 325 | "outputs": [], 326 | "stateMutability": "nonpayable", 327 | "type": "function" 328 | }, 329 | { 330 | "inputs": [ 331 | { 332 | "internalType": "address", 333 | "name": "token", 334 | "type": "address" 335 | }, 336 | { 337 | "internalType": "string", 338 | "name": "newBaseTokenURI", 339 | "type": "string" 340 | } 341 | ], 342 | "name": "setBaseURI", 343 | "outputs": [], 344 | "stateMutability": "nonpayable", 345 | "type": "function" 346 | }, 347 | { 348 | "inputs": [ 349 | { 350 | "internalType": "address", 351 | "name": "token", 352 | "type": "address" 353 | }, 354 | { 355 | "internalType": "uint256", 356 | "name": "tokenId", 357 | "type": "uint256" 358 | } 359 | ], 360 | "name": "tokenURI", 361 | "outputs": [ 362 | { 363 | "internalType": "string", 364 | "name": "", 365 | "type": "string" 366 | } 367 | ], 368 | "stateMutability": "view", 369 | "type": "function" 370 | }, 371 | { 372 | "inputs": [ 373 | { 374 | "internalType": "address", 375 | "name": "newOwner", 376 | "type": "address" 377 | } 378 | ], 379 | "name": "transferOwnership", 380 | "outputs": [], 381 | "stateMutability": "nonpayable", 382 | "type": "function" 383 | }, 384 | { 385 | "inputs": [ 386 | { 387 | "internalType": "address", 388 | "name": "", 389 | "type": "address" 390 | }, 391 | { 392 | "internalType": "uint256", 393 | "name": "", 394 | "type": "uint256" 395 | } 396 | ], 397 | "name": "userERC721MintTxHash", 398 | "outputs": [ 399 | { 400 | "internalType": "bytes32", 401 | "name": "", 402 | "type": "bytes32" 403 | } 404 | ], 405 | "stateMutability": "view", 406 | "type": "function" 407 | }, 408 | { 409 | "inputs": [ 410 | { 411 | "internalType": "address", 412 | "name": "user", 413 | "type": "address" 414 | } 415 | ], 416 | "name": "userERC721MintTxHashLength", 417 | "outputs": [ 418 | { 419 | "internalType": "uint256", 420 | "name": "", 421 | "type": "uint256" 422 | } 423 | ], 424 | "stateMutability": "view", 425 | "type": "function" 426 | }, 427 | { 428 | "inputs": [], 429 | "name": "version", 430 | "outputs": [ 431 | { 432 | "internalType": "string", 433 | "name": "", 434 | "type": "string" 435 | } 436 | ], 437 | "stateMutability": "view", 438 | "type": "function" 439 | } 440 | ] -------------------------------------------------------------------------------- /abi/v1.4.0-20240513/erc721.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "name", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "symbol", 12 | "type": "string" 13 | }, 14 | { 15 | "internalType": "string", 16 | "name": "baseTokenURI", 17 | "type": "string" 18 | } 19 | ], 20 | "stateMutability": "nonpayable", 21 | "type": "constructor" 22 | }, 23 | { 24 | "inputs": [], 25 | "name": "ERC721EnumerableForbiddenBatchMint", 26 | "type": "error" 27 | }, 28 | { 29 | "inputs": [ 30 | { 31 | "internalType": "address", 32 | "name": "sender", 33 | "type": "address" 34 | }, 35 | { 36 | "internalType": "uint256", 37 | "name": "tokenId", 38 | "type": "uint256" 39 | }, 40 | { 41 | "internalType": "address", 42 | "name": "owner", 43 | "type": "address" 44 | } 45 | ], 46 | "name": "ERC721IncorrectOwner", 47 | "type": "error" 48 | }, 49 | { 50 | "inputs": [ 51 | { 52 | "internalType": "address", 53 | "name": "operator", 54 | "type": "address" 55 | }, 56 | { 57 | "internalType": "uint256", 58 | "name": "tokenId", 59 | "type": "uint256" 60 | } 61 | ], 62 | "name": "ERC721InsufficientApproval", 63 | "type": "error" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "approver", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "ERC721InvalidApprover", 74 | "type": "error" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "operator", 81 | "type": "address" 82 | } 83 | ], 84 | "name": "ERC721InvalidOperator", 85 | "type": "error" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "address", 91 | "name": "owner", 92 | "type": "address" 93 | } 94 | ], 95 | "name": "ERC721InvalidOwner", 96 | "type": "error" 97 | }, 98 | { 99 | "inputs": [ 100 | { 101 | "internalType": "address", 102 | "name": "receiver", 103 | "type": "address" 104 | } 105 | ], 106 | "name": "ERC721InvalidReceiver", 107 | "type": "error" 108 | }, 109 | { 110 | "inputs": [ 111 | { 112 | "internalType": "address", 113 | "name": "sender", 114 | "type": "address" 115 | } 116 | ], 117 | "name": "ERC721InvalidSender", 118 | "type": "error" 119 | }, 120 | { 121 | "inputs": [ 122 | { 123 | "internalType": "uint256", 124 | "name": "tokenId", 125 | "type": "uint256" 126 | } 127 | ], 128 | "name": "ERC721NonexistentToken", 129 | "type": "error" 130 | }, 131 | { 132 | "inputs": [ 133 | { 134 | "internalType": "address", 135 | "name": "owner", 136 | "type": "address" 137 | }, 138 | { 139 | "internalType": "uint256", 140 | "name": "index", 141 | "type": "uint256" 142 | } 143 | ], 144 | "name": "ERC721OutOfBoundsIndex", 145 | "type": "error" 146 | }, 147 | { 148 | "anonymous": false, 149 | "inputs": [ 150 | { 151 | "indexed": true, 152 | "internalType": "address", 153 | "name": "owner", 154 | "type": "address" 155 | }, 156 | { 157 | "indexed": true, 158 | "internalType": "address", 159 | "name": "approved", 160 | "type": "address" 161 | }, 162 | { 163 | "indexed": true, 164 | "internalType": "uint256", 165 | "name": "tokenId", 166 | "type": "uint256" 167 | } 168 | ], 169 | "name": "Approval", 170 | "type": "event" 171 | }, 172 | { 173 | "anonymous": false, 174 | "inputs": [ 175 | { 176 | "indexed": true, 177 | "internalType": "address", 178 | "name": "owner", 179 | "type": "address" 180 | }, 181 | { 182 | "indexed": true, 183 | "internalType": "address", 184 | "name": "operator", 185 | "type": "address" 186 | }, 187 | { 188 | "indexed": false, 189 | "internalType": "bool", 190 | "name": "approved", 191 | "type": "bool" 192 | } 193 | ], 194 | "name": "ApprovalForAll", 195 | "type": "event" 196 | }, 197 | { 198 | "anonymous": false, 199 | "inputs": [ 200 | { 201 | "indexed": true, 202 | "internalType": "address", 203 | "name": "from", 204 | "type": "address" 205 | }, 206 | { 207 | "indexed": true, 208 | "internalType": "address", 209 | "name": "to", 210 | "type": "address" 211 | }, 212 | { 213 | "indexed": true, 214 | "internalType": "uint256", 215 | "name": "tokenId", 216 | "type": "uint256" 217 | } 218 | ], 219 | "name": "Transfer", 220 | "type": "event" 221 | }, 222 | { 223 | "inputs": [ 224 | { 225 | "internalType": "address", 226 | "name": "to", 227 | "type": "address" 228 | }, 229 | { 230 | "internalType": "uint256", 231 | "name": "tokenId", 232 | "type": "uint256" 233 | } 234 | ], 235 | "name": "approve", 236 | "outputs": [], 237 | "stateMutability": "nonpayable", 238 | "type": "function" 239 | }, 240 | { 241 | "inputs": [ 242 | { 243 | "internalType": "address", 244 | "name": "owner", 245 | "type": "address" 246 | } 247 | ], 248 | "name": "balanceOf", 249 | "outputs": [ 250 | { 251 | "internalType": "uint256", 252 | "name": "", 253 | "type": "uint256" 254 | } 255 | ], 256 | "stateMutability": "view", 257 | "type": "function" 258 | }, 259 | { 260 | "inputs": [], 261 | "name": "bridgeAddress", 262 | "outputs": [ 263 | { 264 | "internalType": "address", 265 | "name": "", 266 | "type": "address" 267 | } 268 | ], 269 | "stateMutability": "view", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "address", 276 | "name": "sender", 277 | "type": "address" 278 | }, 279 | { 280 | "internalType": "uint256", 281 | "name": "tokenId", 282 | "type": "uint256" 283 | } 284 | ], 285 | "name": "burn", 286 | "outputs": [ 287 | { 288 | "internalType": "string", 289 | "name": "", 290 | "type": "string" 291 | } 292 | ], 293 | "stateMutability": "nonpayable", 294 | "type": "function" 295 | }, 296 | { 297 | "inputs": [ 298 | { 299 | "internalType": "uint256", 300 | "name": "tokenId", 301 | "type": "uint256" 302 | } 303 | ], 304 | "name": "getApproved", 305 | "outputs": [ 306 | { 307 | "internalType": "address", 308 | "name": "", 309 | "type": "address" 310 | } 311 | ], 312 | "stateMutability": "view", 313 | "type": "function" 314 | }, 315 | { 316 | "inputs": [], 317 | "name": "getBaseURI", 318 | "outputs": [ 319 | { 320 | "internalType": "string", 321 | "name": "", 322 | "type": "string" 323 | } 324 | ], 325 | "stateMutability": "view", 326 | "type": "function" 327 | }, 328 | { 329 | "inputs": [ 330 | { 331 | "internalType": "address", 332 | "name": "owner", 333 | "type": "address" 334 | }, 335 | { 336 | "internalType": "address", 337 | "name": "operator", 338 | "type": "address" 339 | } 340 | ], 341 | "name": "isApprovedForAll", 342 | "outputs": [ 343 | { 344 | "internalType": "bool", 345 | "name": "", 346 | "type": "bool" 347 | } 348 | ], 349 | "stateMutability": "view", 350 | "type": "function" 351 | }, 352 | { 353 | "inputs": [ 354 | { 355 | "internalType": "address", 356 | "name": "to", 357 | "type": "address" 358 | }, 359 | { 360 | "internalType": "uint256", 361 | "name": "tokenId", 362 | "type": "uint256" 363 | }, 364 | { 365 | "internalType": "string", 366 | "name": "inscriptionId", 367 | "type": "string" 368 | } 369 | ], 370 | "name": "mint", 371 | "outputs": [], 372 | "stateMutability": "nonpayable", 373 | "type": "function" 374 | }, 375 | { 376 | "inputs": [ 377 | { 378 | "internalType": "string", 379 | "name": "", 380 | "type": "string" 381 | } 382 | ], 383 | "name": "mpInscriptionId2TokenId", 384 | "outputs": [ 385 | { 386 | "internalType": "uint256", 387 | "name": "tokenId", 388 | "type": "uint256" 389 | }, 390 | { 391 | "internalType": "bool", 392 | "name": "isUsed", 393 | "type": "bool" 394 | } 395 | ], 396 | "stateMutability": "view", 397 | "type": "function" 398 | }, 399 | { 400 | "inputs": [ 401 | { 402 | "internalType": "uint256", 403 | "name": "", 404 | "type": "uint256" 405 | } 406 | ], 407 | "name": "mpTokenId2InscriptionId", 408 | "outputs": [ 409 | { 410 | "internalType": "string", 411 | "name": "", 412 | "type": "string" 413 | } 414 | ], 415 | "stateMutability": "view", 416 | "type": "function" 417 | }, 418 | { 419 | "inputs": [], 420 | "name": "name", 421 | "outputs": [ 422 | { 423 | "internalType": "string", 424 | "name": "", 425 | "type": "string" 426 | } 427 | ], 428 | "stateMutability": "view", 429 | "type": "function" 430 | }, 431 | { 432 | "inputs": [ 433 | { 434 | "internalType": "uint256", 435 | "name": "tokenId", 436 | "type": "uint256" 437 | } 438 | ], 439 | "name": "ownerOf", 440 | "outputs": [ 441 | { 442 | "internalType": "address", 443 | "name": "", 444 | "type": "address" 445 | } 446 | ], 447 | "stateMutability": "view", 448 | "type": "function" 449 | }, 450 | { 451 | "inputs": [ 452 | { 453 | "internalType": "address", 454 | "name": "from", 455 | "type": "address" 456 | }, 457 | { 458 | "internalType": "address", 459 | "name": "to", 460 | "type": "address" 461 | }, 462 | { 463 | "internalType": "uint256", 464 | "name": "tokenId", 465 | "type": "uint256" 466 | } 467 | ], 468 | "name": "safeTransferFrom", 469 | "outputs": [], 470 | "stateMutability": "nonpayable", 471 | "type": "function" 472 | }, 473 | { 474 | "inputs": [ 475 | { 476 | "internalType": "address", 477 | "name": "from", 478 | "type": "address" 479 | }, 480 | { 481 | "internalType": "address", 482 | "name": "to", 483 | "type": "address" 484 | }, 485 | { 486 | "internalType": "uint256", 487 | "name": "tokenId", 488 | "type": "uint256" 489 | }, 490 | { 491 | "internalType": "bytes", 492 | "name": "data", 493 | "type": "bytes" 494 | } 495 | ], 496 | "name": "safeTransferFrom", 497 | "outputs": [], 498 | "stateMutability": "nonpayable", 499 | "type": "function" 500 | }, 501 | { 502 | "inputs": [ 503 | { 504 | "internalType": "address", 505 | "name": "operator", 506 | "type": "address" 507 | }, 508 | { 509 | "internalType": "bool", 510 | "name": "approved", 511 | "type": "bool" 512 | } 513 | ], 514 | "name": "setApprovalForAll", 515 | "outputs": [], 516 | "stateMutability": "nonpayable", 517 | "type": "function" 518 | }, 519 | { 520 | "inputs": [ 521 | { 522 | "internalType": "string", 523 | "name": "newBaseTokenURI", 524 | "type": "string" 525 | } 526 | ], 527 | "name": "setBaseURI", 528 | "outputs": [], 529 | "stateMutability": "nonpayable", 530 | "type": "function" 531 | }, 532 | { 533 | "inputs": [ 534 | { 535 | "internalType": "bytes4", 536 | "name": "interfaceId", 537 | "type": "bytes4" 538 | } 539 | ], 540 | "name": "supportsInterface", 541 | "outputs": [ 542 | { 543 | "internalType": "bool", 544 | "name": "", 545 | "type": "bool" 546 | } 547 | ], 548 | "stateMutability": "view", 549 | "type": "function" 550 | }, 551 | { 552 | "inputs": [], 553 | "name": "symbol", 554 | "outputs": [ 555 | { 556 | "internalType": "string", 557 | "name": "", 558 | "type": "string" 559 | } 560 | ], 561 | "stateMutability": "view", 562 | "type": "function" 563 | }, 564 | { 565 | "inputs": [ 566 | { 567 | "internalType": "uint256", 568 | "name": "index", 569 | "type": "uint256" 570 | } 571 | ], 572 | "name": "tokenByIndex", 573 | "outputs": [ 574 | { 575 | "internalType": "uint256", 576 | "name": "", 577 | "type": "uint256" 578 | } 579 | ], 580 | "stateMutability": "view", 581 | "type": "function" 582 | }, 583 | { 584 | "inputs": [ 585 | { 586 | "internalType": "address", 587 | "name": "owner", 588 | "type": "address" 589 | }, 590 | { 591 | "internalType": "uint256", 592 | "name": "index", 593 | "type": "uint256" 594 | } 595 | ], 596 | "name": "tokenOfOwnerByIndex", 597 | "outputs": [ 598 | { 599 | "internalType": "uint256", 600 | "name": "", 601 | "type": "uint256" 602 | } 603 | ], 604 | "stateMutability": "view", 605 | "type": "function" 606 | }, 607 | { 608 | "inputs": [ 609 | { 610 | "internalType": "uint256", 611 | "name": "tokenId", 612 | "type": "uint256" 613 | } 614 | ], 615 | "name": "tokenURI", 616 | "outputs": [ 617 | { 618 | "internalType": "string", 619 | "name": "", 620 | "type": "string" 621 | } 622 | ], 623 | "stateMutability": "view", 624 | "type": "function" 625 | }, 626 | { 627 | "inputs": [], 628 | "name": "totalSupply", 629 | "outputs": [ 630 | { 631 | "internalType": "uint256", 632 | "name": "", 633 | "type": "uint256" 634 | } 635 | ], 636 | "stateMutability": "view", 637 | "type": "function" 638 | }, 639 | { 640 | "inputs": [ 641 | { 642 | "internalType": "address", 643 | "name": "from", 644 | "type": "address" 645 | }, 646 | { 647 | "internalType": "address", 648 | "name": "to", 649 | "type": "address" 650 | }, 651 | { 652 | "internalType": "uint256", 653 | "name": "tokenId", 654 | "type": "uint256" 655 | } 656 | ], 657 | "name": "transferFrom", 658 | "outputs": [], 659 | "stateMutability": "nonpayable", 660 | "type": "function" 661 | } 662 | ] -------------------------------------------------------------------------------- /contracts/BTCLayer2BridgeERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.20; 4 | 5 | import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; 6 | import "./ERC20TokenWrapped.sol"; 7 | 8 | contract BTCLayer2BridgeERC20 is OwnableUpgradeable { 9 | address public bridgeAddress; 10 | mapping(bytes32 => address) public erc20TokenInfoToWrappedToken; 11 | mapping(address => bool) public erc20TokenInfoSupported; 12 | address[] public allERC20TokenAddress; 13 | mapping(bytes32 => bool) public erc20TxHashUnlocked; 14 | bytes32[] public allERC20TxHash; 15 | mapping(address => bytes32[]) public userERC20MintTxHash; 16 | 17 | string public constant version = "1.2.0"; 18 | 19 | modifier onlyValidAddress(address addr) { 20 | require(addr != address(0), "Illegal address"); 21 | _; 22 | } 23 | 24 | modifier onlyBridge() { 25 | require( 26 | msg.sender == bridgeAddress, 27 | "TokenWrapped::onlyBridge: Not BTCLayer2Bridge" 28 | ); 29 | _; 30 | } 31 | 32 | function initialize( 33 | address _initialOwner, 34 | address _bridgeAddress 35 | ) external onlyValidAddress(_initialOwner) 36 | onlyValidAddress(_bridgeAddress) virtual initializer { 37 | bridgeAddress = _bridgeAddress; 38 | // Initialize OZ contracts 39 | __Ownable_init_unchained(_initialOwner); 40 | } 41 | 42 | function addERC20TokenWrapped(string memory _name, string memory _symbol, uint8 _decimals, uint256 _cap) external onlyBridge returns (address) { 43 | bytes32 tokenInfoHash = keccak256( 44 | abi.encodePacked(_name, _symbol, _decimals, _cap) 45 | ); 46 | address wrappedToken = erc20TokenInfoToWrappedToken[tokenInfoHash]; 47 | require(wrappedToken == address(0), "The current token already exists"); 48 | // Create a new wrapped erc20 using create2 49 | ERC20TokenWrapped newWrappedToken = (new ERC20TokenWrapped){ 50 | salt: tokenInfoHash 51 | }(_name, _symbol, _decimals, _cap); 52 | // Create mappings 53 | address tokenWrappedAddress = address(newWrappedToken); 54 | erc20TokenInfoToWrappedToken[tokenInfoHash] = tokenWrappedAddress; 55 | erc20TokenInfoSupported[tokenWrappedAddress] = true; 56 | allERC20TokenAddress.push(tokenWrappedAddress); 57 | return tokenWrappedAddress; 58 | } 59 | 60 | function mintERC20Token(bytes32 txHash, address token, address to, uint256 amount) external onlyBridge { 61 | require(erc20TxHashUnlocked[txHash] == false, "Transaction has been executed"); 62 | erc20TxHashUnlocked[txHash] = true; 63 | require(erc20TokenInfoSupported[token], "This token is not supported"); 64 | allERC20TxHash.push(txHash); 65 | userERC20MintTxHash[to].push(txHash); 66 | ERC20TokenWrapped(token).mint(to, amount); 67 | } 68 | 69 | function burnERC20Token(address sender, address token, uint256 amount) external onlyBridge { 70 | require(erc20TokenInfoSupported[token], "This token is not supported"); 71 | ERC20TokenWrapped(token).burn(sender, amount); 72 | } 73 | 74 | function allERC20TokenAddressLength() public view returns (uint256) { 75 | return allERC20TokenAddress.length; 76 | } 77 | 78 | function allERC20TxHashLength() public view returns (uint256) { 79 | return allERC20TxHash.length; 80 | } 81 | 82 | function userERC20MintTxHashLength(address user) public view returns (uint256) { 83 | return userERC20MintTxHash[user].length; 84 | } 85 | 86 | function setBlackListERC20Token(address token, address account, bool state) external onlyBridge { 87 | require(erc20TokenInfoSupported[token], "This token is not supported"); 88 | ERC20TokenWrapped(token).setBlackList(account, state); 89 | } 90 | } -------------------------------------------------------------------------------- /contracts/BTCLayer2BridgeERC721.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.20; 4 | 5 | import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; 6 | import "./ERC721TokenWrapped.sol"; 7 | 8 | contract BTCLayer2BridgeERC721 is OwnableUpgradeable { 9 | address public bridgeAddress; 10 | mapping(bytes32 => address) public erc721TokenInfoToWrappedToken; 11 | mapping(address => bool) public erc721TokenInfoSupported; 12 | address[] public allERC721TokenAddress; 13 | mapping(bytes32 => bool) public erc721TxHashUnlocked; 14 | bytes32[] public allERC721TxHash; 15 | mapping(address => bytes32[]) public userERC721MintTxHash; 16 | 17 | string public constant version = "1.1.0"; 18 | 19 | modifier onlyValidAddress(address addr) { 20 | require(addr != address(0), "Illegal address"); 21 | _; 22 | } 23 | 24 | modifier onlyBridge() { 25 | require( 26 | msg.sender == bridgeAddress, 27 | "TokenWrapped::onlyBridge: Not BTCLayer2Bridge" 28 | ); 29 | _; 30 | } 31 | 32 | function initialize( 33 | address _initialOwner, 34 | address _bridgeAddress 35 | ) external onlyValidAddress(_initialOwner) 36 | onlyValidAddress(_bridgeAddress) virtual initializer { 37 | bridgeAddress = _bridgeAddress; 38 | // Initialize OZ contracts 39 | __Ownable_init_unchained(_initialOwner); 40 | } 41 | 42 | function addERC721TokenWrapped(string memory _name, string memory _symbol, string memory _baseURI) external onlyBridge returns (address) { 43 | bytes32 tokenInfoHash = keccak256( 44 | abi.encodePacked(_name, _symbol, _baseURI) 45 | ); 46 | address wrappedToken = erc721TokenInfoToWrappedToken[tokenInfoHash]; 47 | require(wrappedToken == address(0), "The current token already exists"); 48 | // Create a new wrapped erc20 using create2 49 | ERC721TokenWrapped newWrappedToken = (new ERC721TokenWrapped){ 50 | salt: tokenInfoHash 51 | }(_name, _symbol, _baseURI); 52 | // Create mappings 53 | address tokenWrappedAddress = address(newWrappedToken); 54 | erc721TokenInfoToWrappedToken[tokenInfoHash] = tokenWrappedAddress; 55 | erc721TokenInfoSupported[tokenWrappedAddress] = true; 56 | allERC721TokenAddress.push(tokenWrappedAddress); 57 | return tokenWrappedAddress; 58 | } 59 | 60 | function setBaseURI(address token, string calldata newBaseTokenURI) external onlyBridge { 61 | ERC721TokenWrapped(token).setBaseURI(newBaseTokenURI); 62 | } 63 | 64 | //tokenURI: id->tokenId->tokenURI(tokenId) 65 | function tokenURI(address token, uint256 tokenId) public view returns (string memory) { 66 | return ERC721TokenWrapped(token).tokenURI(tokenId); 67 | } 68 | 69 | function batchMintERC721Token(bytes32 txHash, address token, address to, string[] memory inscriptionIds, uint256[] memory tokenIds) external onlyBridge { 70 | require(inscriptionIds.length == tokenIds.length, "length is not match."); 71 | 72 | require(!erc721TxHashUnlocked[txHash], "Transaction has been executed"); 73 | erc721TxHashUnlocked[txHash] = true; 74 | require(erc721TokenInfoSupported[token], "This token is not supported"); 75 | allERC721TxHash.push(txHash); 76 | 77 | userERC721MintTxHash[to].push(txHash); 78 | 79 | //batch mint 80 | for (uint16 i = 0; i < tokenIds.length; i++) { 81 | ERC721TokenWrapped(token).mint(to, tokenIds[i], inscriptionIds[i]); 82 | } 83 | } 84 | 85 | function batchBurnERC721Token(address sender, address token, uint256[] memory tokenIds) external onlyBridge returns (string[] memory) { 86 | require(erc721TokenInfoSupported[token], "This token is not supported"); 87 | 88 | //batch burn 89 | string[] memory burnInscriptionIds = new string[](tokenIds.length); 90 | for (uint16 i = 0; i < tokenIds.length; i++) { 91 | burnInscriptionIds[i] = ERC721TokenWrapped(token).burn(sender, tokenIds[i]); 92 | } 93 | 94 | return burnInscriptionIds; 95 | } 96 | 97 | function allERC721TokenAddressLength() public view returns (uint256) { 98 | return allERC721TokenAddress.length; 99 | } 100 | 101 | function allERC721TxHashLength() public view returns (uint256) { 102 | return allERC721TxHash.length; 103 | } 104 | 105 | function userERC721MintTxHashLength(address user) public view returns (uint256) { 106 | return userERC721MintTxHash[user].length; 107 | } 108 | } -------------------------------------------------------------------------------- /contracts/BridgeFeeRates.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.8.20; 4 | 5 | library BridgeFeeRates { 6 | struct stRate{ 7 | bool isSet; 8 | uint256 rate; 9 | } 10 | 11 | struct White { 12 | mapping(address => stRate) whiteList; 13 | } 14 | 15 | //_address is msg.sender or token. 16 | function setWhiteList(White storage white, address _address, uint256 _rate) internal { 17 | require(_address != address (0), "invalid _address"); 18 | require(_rate >= 0, "invalid _rate"); 19 | 20 | white.whiteList[_address] = stRate(true, _rate); 21 | } 22 | 23 | function deleteWhiteList(White storage white, address _address) internal { 24 | require(_address != address (0), "invalid _address"); 25 | delete white.whiteList[_address]; 26 | } 27 | 28 | 29 | function getBridgeFeeRate(White storage white, address msgSender, address token) internal view returns(uint256) { 30 | if (white.whiteList[msgSender].isSet) { 31 | return white.whiteList[msgSender].rate; 32 | } 33 | 34 | if (token != address (0) && white.whiteList[token].isSet) { 35 | return white.whiteList[token].rate; 36 | } 37 | 38 | return 100; 39 | } 40 | 41 | function getBridgeFeeRateTimes(White storage white, address msgSender, address token, uint256 times) internal view returns(uint256) { 42 | return getBridgeFeeRate(white, msgSender, token) * times; 43 | } 44 | } -------------------------------------------------------------------------------- /contracts/ERC20TokenWrapped.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | // Implementation of permit based on https://github.com/WETH10/WETH10/blob/main/contracts/WETH10.sol 3 | pragma solidity 0.8.20; 4 | 5 | import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; 6 | import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Capped.sol"; 7 | 8 | contract ERC20TokenWrapped is ERC20Permit, ERC20Capped { 9 | // PolygonZkEVM Bridge address 10 | address public immutable bridgeAddress; 11 | 12 | // Decimals 13 | uint8 private immutable _decimals; 14 | 15 | string public constant version = "1.2.0"; 16 | 17 | // Blacklist 18 | mapping(address => bool) public isBlackListed; 19 | 20 | event SetBlackList(address account, bool state); 21 | 22 | modifier onlyBridge() { 23 | require( 24 | msg.sender == bridgeAddress, 25 | "TokenWrapped::onlyBridge: Not BTCLayer2Bridge" 26 | ); 27 | _; 28 | } 29 | 30 | constructor( 31 | string memory name, 32 | string memory symbol, 33 | uint8 __decimals, 34 | uint256 __cap 35 | ) ERC20(name, symbol) ERC20Permit(name) ERC20Capped(__cap){ 36 | bridgeAddress = msg.sender; 37 | _decimals = __decimals; 38 | } 39 | 40 | function mint(address to, uint256 value) external onlyBridge { 41 | _mint(to, value); 42 | } 43 | 44 | // Notice that is not require to approve wrapped tokens to use the bridge 45 | function burn(address account, uint256 value) external onlyBridge { 46 | _burn(account, value); 47 | } 48 | 49 | function decimals() public view virtual override returns (uint8) { 50 | return _decimals; 51 | } 52 | 53 | // Blacklist restrict from-address, contains(burn's from-address) 54 | function _update(address from, address to, uint256 value) override(ERC20, ERC20Capped) internal virtual { 55 | require(!isBlackListed[from], "from is in blackList"); 56 | ERC20Capped._update(from, to, value); 57 | } 58 | 59 | function setBlackList(address account, bool state) external onlyBridge { 60 | isBlackListed[account] = state; 61 | emit SetBlackList(account, state); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /contracts/ERC721TokenWrapped.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | // Implementation of permit based on https://github.com/WETH10/WETH10/blob/main/contracts/WETH10.sol 3 | pragma solidity 0.8.20; 4 | 5 | import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; 6 | 7 | contract ERC721TokenWrapped is ERC721Enumerable { 8 | // PolygonZkEVM Bridge address 9 | address public immutable bridgeAddress; 10 | string private _baseTokenURI; 11 | 12 | struct TokenId { 13 | uint256 tokenId; 14 | bool isUsed; 15 | } 16 | 17 | mapping(string => TokenId) public mpInscriptionId2TokenId; 18 | mapping(uint256 => string) public mpTokenId2InscriptionId; 19 | 20 | modifier onlyBridge() { 21 | require( 22 | msg.sender == bridgeAddress, 23 | "TokenWrapped::onlyBridge: Not BTCLayer2Bridge" 24 | ); 25 | _; 26 | } 27 | 28 | constructor( 29 | string memory name, 30 | string memory symbol, 31 | string memory baseTokenURI 32 | ) ERC721(name, symbol) { 33 | bridgeAddress = msg.sender; 34 | _baseTokenURI = baseTokenURI; 35 | } 36 | 37 | function mint(address to, uint256 tokenId, string memory inscriptionId) external onlyBridge { 38 | //adjust exist 39 | require(bytes(mpTokenId2InscriptionId[tokenId]).length <= 0, "tokenId is repeat"); 40 | require(!mpInscriptionId2TokenId[inscriptionId].isUsed, "inscriptionId is repeat"); 41 | 42 | mpInscriptionId2TokenId[inscriptionId] = TokenId(tokenId, true); 43 | mpTokenId2InscriptionId[tokenId] = inscriptionId; 44 | 45 | _mint(to, tokenId); 46 | } 47 | 48 | // Notice that is not require to approve wrapped tokens to use the bridge 49 | function burn(address sender, uint256 tokenId) external onlyBridge returns (string memory){ 50 | require(_ownerOf(tokenId) == sender, "Illegal permissions"); 51 | string memory inscriptionId = mpTokenId2InscriptionId[tokenId]; 52 | 53 | //adjust exist 54 | delete mpInscriptionId2TokenId[inscriptionId]; 55 | delete mpTokenId2InscriptionId[tokenId]; 56 | 57 | _burn(tokenId); 58 | return inscriptionId; 59 | } 60 | 61 | function _baseURI() internal view virtual override returns (string memory) { 62 | return _baseTokenURI; 63 | } 64 | 65 | function getBaseURI() external view returns (string memory) { 66 | return _baseTokenURI; 67 | } 68 | 69 | function setBaseURI(string calldata newBaseTokenURI) external onlyBridge { 70 | _baseTokenURI = newBaseTokenURI; 71 | } 72 | 73 | function tokenURI(uint256 tokenId) public view override virtual returns (string memory) { 74 | require(bytes(mpTokenId2InscriptionId[tokenId]).length > 0, "tokenId is not exist"); 75 | 76 | string memory inscriptionId = mpTokenId2InscriptionId[tokenId]; 77 | return bytes(_baseTokenURI).length > 0 ? string.concat(_baseTokenURI, inscriptionId) : ""; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /contracts/interfaces/IBTCLayer2BridgeERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: AGPL-3.0 2 | 3 | pragma solidity ^0.8.20; 4 | 5 | interface IBTCLayer2BridgeERC20 { 6 | function addERC20TokenWrapped(string memory _name, string memory _symbol, uint8 _decimals, uint256 _cap) external returns(address); 7 | function mintERC20Token(bytes32 txHash, address token, address to, uint256 amount) external; 8 | function burnERC20Token(address sender, address token, uint256 amount) external; 9 | function allERC20TokenAddressLength() external view returns(uint256); 10 | function allERC20TxHashLength() external view returns(uint256); 11 | function userERC20MintTxHashLength(address user) external view returns(uint256); 12 | function setBlackListERC20Token(address token, address account, bool state) external; 13 | } -------------------------------------------------------------------------------- /contracts/interfaces/IBTCLayer2BridgeERC721.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: AGPL-3.0 2 | 3 | pragma solidity ^0.8.20; 4 | 5 | interface IBTCLayer2BridgeERC721 { 6 | function addERC721TokenWrapped(string memory _name, string memory _symbol, string memory _baseURI) external returns(address); 7 | function setBaseURI(address token, string calldata newBaseTokenURI) external; 8 | function tokenURI(address token, uint256 tokenId) external returns (string memory); 9 | function batchMintERC721Token(bytes32 txHash, address token, address to, string[] memory inscriptionIds, uint256[] memory tokenIds) external; 10 | function batchBurnERC721Token(address sender, address token, uint256[] memory tokenIds) external returns(string[] memory burnInscriptionIds); 11 | function allERC721TokenAddressLength() external view returns(uint256); 12 | function allERC721TxHashLength() external view returns(uint256); 13 | function userERC721MintTxHashLength(address user) external view returns(uint256); 14 | } -------------------------------------------------------------------------------- /cs/Address.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) 3 | 4 | pragma solidity ^0.8.1; 5 | 6 | /** 7 | * @dev Collection of functions related to the address type 8 | */ 9 | library Address { 10 | /** 11 | * @dev Returns true if `account` is a contract. 12 | * 13 | * [IMPORTANT] 14 | * ==== 15 | * It is unsafe to assume that an address for which this function returns 16 | * false is an externally-owned account (EOA) and not a contract. 17 | * 18 | * Among others, `isContract` will return false for the following 19 | * types of addresses: 20 | * 21 | * - an externally-owned account 22 | * - a contract in construction 23 | * - an address where a contract will be created 24 | * - an address where a contract lived, but was destroyed 25 | * ==== 26 | * 27 | * [IMPORTANT] 28 | * ==== 29 | * You shouldn't rely on `isContract` to protect against flash loan attacks! 30 | * 31 | * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets 32 | * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract 33 | * constructor. 34 | * ==== 35 | */ 36 | function isContract(address account) internal view returns (bool) { 37 | // This method relies on extcodesize/address.code.length, which returns 0 38 | // for contracts in construction, since the code is only stored at the end 39 | // of the constructor execution. 40 | 41 | return account.code.length > 0; 42 | } 43 | 44 | /** 45 | * @dev Replacement for Solidity's `transfer`: sends `amount` wei to 46 | * `recipient`, forwarding all available gas and reverting on errors. 47 | * 48 | * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost 49 | * of certain opcodes, possibly making contracts go over the 2300 gas limit 50 | * imposed by `transfer`, making them unable to receive funds via 51 | * `transfer`. {sendValue} removes this limitation. 52 | * 53 | * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. 54 | * 55 | * IMPORTANT: because control is transferred to `recipient`, care must be 56 | * taken to not create reentrancy vulnerabilities. Consider using 57 | * {ReentrancyGuard} or the 58 | * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. 59 | */ 60 | function sendValue(address payable recipient, uint256 amount) internal { 61 | require(address(this).balance >= amount, "Address: insufficient balance"); 62 | 63 | (bool success, ) = recipient.call{value: amount}(""); 64 | require(success, "Address: unable to send value, recipient may have reverted"); 65 | } 66 | 67 | /** 68 | * @dev Performs a Solidity function call using a low level `call`. A 69 | * plain `call` is an unsafe replacement for a function call: use this 70 | * function instead. 71 | * 72 | * If `target` reverts with a revert reason, it is bubbled up by this 73 | * function (like regular Solidity function calls). 74 | * 75 | * Returns the raw returned data. To convert to the expected return value, 76 | * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. 77 | * 78 | * Requirements: 79 | * 80 | * - `target` must be a contract. 81 | * - calling `target` with `data` must not revert. 82 | * 83 | * _Available since v3.1._ 84 | */ 85 | function functionCall(address target, bytes memory data) internal returns (bytes memory) { 86 | return functionCallWithValue(target, data, 0, "Address: low-level call failed"); 87 | } 88 | 89 | /** 90 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with 91 | * `errorMessage` as a fallback revert reason when `target` reverts. 92 | * 93 | * _Available since v3.1._ 94 | */ 95 | function functionCall( 96 | address target, 97 | bytes memory data, 98 | string memory errorMessage 99 | ) internal returns (bytes memory) { 100 | return functionCallWithValue(target, data, 0, errorMessage); 101 | } 102 | 103 | /** 104 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], 105 | * but also transferring `value` wei to `target`. 106 | * 107 | * Requirements: 108 | * 109 | * - the calling contract must have an ETH balance of at least `value`. 110 | * - the called Solidity function must be `payable`. 111 | * 112 | * _Available since v3.1._ 113 | */ 114 | function functionCallWithValue( 115 | address target, 116 | bytes memory data, 117 | uint256 value 118 | ) internal returns (bytes memory) { 119 | return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); 120 | } 121 | 122 | /** 123 | * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but 124 | * with `errorMessage` as a fallback revert reason when `target` reverts. 125 | * 126 | * _Available since v3.1._ 127 | */ 128 | function functionCallWithValue( 129 | address target, 130 | bytes memory data, 131 | uint256 value, 132 | string memory errorMessage 133 | ) internal returns (bytes memory) { 134 | require(address(this).balance >= value, "Address: insufficient balance for call"); 135 | (bool success, bytes memory returndata) = target.call{value: value}(data); 136 | return verifyCallResultFromTarget(target, success, returndata, errorMessage); 137 | } 138 | 139 | /** 140 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], 141 | * but performing a static call. 142 | * 143 | * _Available since v3.3._ 144 | */ 145 | function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { 146 | return functionStaticCall(target, data, "Address: low-level static call failed"); 147 | } 148 | 149 | /** 150 | * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], 151 | * but performing a static call. 152 | * 153 | * _Available since v3.3._ 154 | */ 155 | function functionStaticCall( 156 | address target, 157 | bytes memory data, 158 | string memory errorMessage 159 | ) internal view returns (bytes memory) { 160 | (bool success, bytes memory returndata) = target.staticcall(data); 161 | return verifyCallResultFromTarget(target, success, returndata, errorMessage); 162 | } 163 | 164 | /** 165 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], 166 | * but performing a delegate call. 167 | * 168 | * _Available since v3.4._ 169 | */ 170 | function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { 171 | return functionDelegateCall(target, data, "Address: low-level delegate call failed"); 172 | } 173 | 174 | /** 175 | * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], 176 | * but performing a delegate call. 177 | * 178 | * _Available since v3.4._ 179 | */ 180 | function functionDelegateCall( 181 | address target, 182 | bytes memory data, 183 | string memory errorMessage 184 | ) internal returns (bytes memory) { 185 | (bool success, bytes memory returndata) = target.delegatecall(data); 186 | return verifyCallResultFromTarget(target, success, returndata, errorMessage); 187 | } 188 | 189 | /** 190 | * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling 191 | * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. 192 | * 193 | * _Available since v4.8._ 194 | */ 195 | function verifyCallResultFromTarget( 196 | address target, 197 | bool success, 198 | bytes memory returndata, 199 | string memory errorMessage 200 | ) internal view returns (bytes memory) { 201 | if (success) { 202 | if (returndata.length == 0) { 203 | // only check isContract if the call was successful and the return data is empty 204 | // otherwise we already know that it was a contract 205 | require(isContract(target), "Address: call to non-contract"); 206 | } 207 | return returndata; 208 | } else { 209 | _revert(returndata, errorMessage); 210 | } 211 | } 212 | 213 | /** 214 | * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the 215 | * revert reason or using the provided one. 216 | * 217 | * _Available since v4.3._ 218 | */ 219 | function verifyCallResult( 220 | bool success, 221 | bytes memory returndata, 222 | string memory errorMessage 223 | ) internal pure returns (bytes memory) { 224 | if (success) { 225 | return returndata; 226 | } else { 227 | _revert(returndata, errorMessage); 228 | } 229 | } 230 | 231 | function _revert(bytes memory returndata, string memory errorMessage) private pure { 232 | // Look for revert reason and bubble it up if present 233 | if (returndata.length > 0) { 234 | // The easiest way to bubble the revert reason is using memory via assembly 235 | /// @solidity memory-safe-assembly 236 | assembly { 237 | let returndata_size := mload(returndata) 238 | revert(add(32, returndata), returndata_size) 239 | } 240 | } else { 241 | revert(errorMessage); 242 | } 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /cs/BeaconProxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IBeacon.sol"; 7 | import "./Proxy.sol"; 8 | import "./ERC1967Upgrade.sol"; 9 | 10 | /** 11 | * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}. 12 | * 13 | * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't 14 | * conflict with the storage layout of the implementation behind the proxy. 15 | * 16 | * _Available since v3.4._ 17 | */ 18 | contract BeaconProxy is Proxy, ERC1967Upgrade { 19 | /** 20 | * @dev Initializes the proxy with `beacon`. 21 | * 22 | * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This 23 | * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity 24 | * constructor. 25 | * 26 | * Requirements: 27 | * 28 | * - `beacon` must be a contract with the interface {IBeacon}. 29 | */ 30 | constructor(address beacon, bytes memory data) payable { 31 | _upgradeBeaconToAndCall(beacon, data, false); 32 | } 33 | 34 | /** 35 | * @dev Returns the current beacon address. 36 | */ 37 | function _beacon() internal view virtual returns (address) { 38 | return _getBeacon(); 39 | } 40 | 41 | /** 42 | * @dev Returns the current implementation address of the associated beacon. 43 | */ 44 | function _implementation() internal view virtual override returns (address) { 45 | return IBeacon(_getBeacon()).implementation(); 46 | } 47 | 48 | /** 49 | * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. 50 | * 51 | * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. 52 | * 53 | * Requirements: 54 | * 55 | * - `beacon` must be a contract. 56 | * - The implementation returned by `beacon` must be a contract. 57 | */ 58 | function _setBeacon(address beacon, bytes memory data) internal virtual { 59 | _upgradeBeaconToAndCall(beacon, data, false); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /cs/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Provides information about the current execution context, including the 8 | * sender of the transaction and its data. While these are generally available 9 | * via msg.sender and msg.data, they should not be accessed in such a direct 10 | * manner, since when dealing with meta-transactions the account sending and 11 | * paying for execution may not be the actual sender (as far as an application 12 | * is concerned). 13 | * 14 | * This contract is only required for intermediate, library-like contracts. 15 | */ 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes calldata) { 22 | return msg.data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /cs/ERC1967Proxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./Proxy.sol"; 7 | import "./ERC1967Upgrade.sol"; 8 | 9 | /** 10 | * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an 11 | * implementation address that can be changed. This address is stored in storage in the location specified by 12 | * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the 13 | * implementation behind the proxy. 14 | */ 15 | contract ERC1967Proxy is Proxy, ERC1967Upgrade { 16 | /** 17 | * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. 18 | * 19 | * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded 20 | * function call, and allows initializing the storage of the proxy like a Solidity constructor. 21 | */ 22 | constructor(address _logic, bytes memory _data) payable { 23 | _upgradeToAndCall(_logic, _data, false); 24 | } 25 | 26 | /** 27 | * @dev Returns the current implementation address. 28 | */ 29 | function _implementation() internal view virtual override returns (address impl) { 30 | return ERC1967Upgrade._getImplementation(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /cs/ERC1967Upgrade.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.3) (proxy/ERC1967/ERC1967Upgrade.sol) 3 | 4 | pragma solidity ^0.8.2; 5 | 6 | import "./IBeacon.sol"; 7 | import "./IERC1967.sol"; 8 | import "./draft-IERC1822.sol"; 9 | import "./Address.sol"; 10 | import "./StorageSlot.sol"; 11 | 12 | /** 13 | * @dev This abstract contract provides getters and event emitting update functions for 14 | * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. 15 | * 16 | * _Available since v4.1._ 17 | * 18 | * @custom:oz-upgrades-unsafe-allow delegatecall 19 | */ 20 | abstract contract ERC1967Upgrade is IERC1967 { 21 | // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 22 | bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; 23 | 24 | /** 25 | * @dev Storage slot with the address of the current implementation. 26 | * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is 27 | * validated in the constructor. 28 | */ 29 | bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; 30 | 31 | /** 32 | * @dev Returns the current implementation address. 33 | */ 34 | function _getImplementation() internal view returns (address) { 35 | return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; 36 | } 37 | 38 | /** 39 | * @dev Stores a new address in the EIP1967 implementation slot. 40 | */ 41 | function _setImplementation(address newImplementation) private { 42 | require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); 43 | StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; 44 | } 45 | 46 | /** 47 | * @dev Perform implementation upgrade 48 | * 49 | * Emits an {Upgraded} event. 50 | */ 51 | function _upgradeTo(address newImplementation) internal { 52 | _setImplementation(newImplementation); 53 | emit Upgraded(newImplementation); 54 | } 55 | 56 | /** 57 | * @dev Perform implementation upgrade with additional setup call. 58 | * 59 | * Emits an {Upgraded} event. 60 | */ 61 | function _upgradeToAndCall( 62 | address newImplementation, 63 | bytes memory data, 64 | bool forceCall 65 | ) internal { 66 | _upgradeTo(newImplementation); 67 | if (data.length > 0 || forceCall) { 68 | Address.functionDelegateCall(newImplementation, data); 69 | } 70 | } 71 | 72 | /** 73 | * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. 74 | * 75 | * Emits an {Upgraded} event. 76 | */ 77 | function _upgradeToAndCallUUPS( 78 | address newImplementation, 79 | bytes memory data, 80 | bool forceCall 81 | ) internal { 82 | // Upgrades from old implementations will perform a rollback test. This test requires the new 83 | // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing 84 | // this special case will break upgrade paths from old UUPS implementation to new ones. 85 | if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { 86 | _setImplementation(newImplementation); 87 | } else { 88 | try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { 89 | require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); 90 | } catch { 91 | revert("ERC1967Upgrade: new implementation is not UUPS"); 92 | } 93 | _upgradeToAndCall(newImplementation, data, forceCall); 94 | } 95 | } 96 | 97 | /** 98 | * @dev Storage slot with the admin of the contract. 99 | * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is 100 | * validated in the constructor. 101 | */ 102 | bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; 103 | 104 | /** 105 | * @dev Returns the current admin. 106 | */ 107 | function _getAdmin() internal view returns (address) { 108 | return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; 109 | } 110 | 111 | /** 112 | * @dev Stores a new address in the EIP1967 admin slot. 113 | */ 114 | function _setAdmin(address newAdmin) private { 115 | require(newAdmin != address(0), "ERC1967: new admin is the zero address"); 116 | StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; 117 | } 118 | 119 | /** 120 | * @dev Changes the admin of the proxy. 121 | * 122 | * Emits an {AdminChanged} event. 123 | */ 124 | function _changeAdmin(address newAdmin) internal { 125 | emit AdminChanged(_getAdmin(), newAdmin); 126 | _setAdmin(newAdmin); 127 | } 128 | 129 | /** 130 | * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. 131 | * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. 132 | */ 133 | bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; 134 | 135 | /** 136 | * @dev Returns the current beacon. 137 | */ 138 | function _getBeacon() internal view returns (address) { 139 | return StorageSlot.getAddressSlot(_BEACON_SLOT).value; 140 | } 141 | 142 | /** 143 | * @dev Stores a new beacon in the EIP1967 beacon slot. 144 | */ 145 | function _setBeacon(address newBeacon) private { 146 | require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); 147 | require( 148 | Address.isContract(IBeacon(newBeacon).implementation()), 149 | "ERC1967: beacon implementation is not a contract" 150 | ); 151 | StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; 152 | } 153 | 154 | /** 155 | * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does 156 | * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). 157 | * 158 | * Emits a {BeaconUpgraded} event. 159 | */ 160 | function _upgradeBeaconToAndCall( 161 | address newBeacon, 162 | bytes memory data, 163 | bool forceCall 164 | ) internal { 165 | _setBeacon(newBeacon); 166 | emit BeaconUpgraded(newBeacon); 167 | if (data.length > 0 || forceCall) { 168 | Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); 169 | } 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /cs/IBeacon.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev This is the interface that {BeaconProxy} expects of its beacon. 8 | */ 9 | interface IBeacon { 10 | /** 11 | * @dev Must return an address that can be used as a delegate call target. 12 | * 13 | * {BeaconProxy} will check that this address is a contract. 14 | */ 15 | function implementation() external view returns (address); 16 | } 17 | -------------------------------------------------------------------------------- /cs/IERC1967.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. 8 | * 9 | * _Available since v4.9._ 10 | */ 11 | interface IERC1967 { 12 | /** 13 | * @dev Emitted when the implementation is upgraded. 14 | */ 15 | event Upgraded(address indexed implementation); 16 | 17 | /** 18 | * @dev Emitted when the admin account has changed. 19 | */ 20 | event AdminChanged(address previousAdmin, address newAdmin); 21 | 22 | /** 23 | * @dev Emitted when the beacon is changed. 24 | */ 25 | event BeaconUpgraded(address indexed beacon); 26 | } 27 | -------------------------------------------------------------------------------- /cs/Ownable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./Context.sol"; 7 | 8 | /** 9 | * @dev Contract module which provides a basic access control mechanism, where 10 | * there is an account (an owner) that can be granted exclusive access to 11 | * specific functions. 12 | * 13 | * By default, the owner account will be the one that deploys the contract. This 14 | * can later be changed with {transferOwnership}. 15 | * 16 | * This module is used through inheritance. It will make available the modifier 17 | * `onlyOwner`, which can be applied to your functions to restrict their use to 18 | * the owner. 19 | */ 20 | abstract contract Ownable is Context { 21 | address private _owner; 22 | 23 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 24 | 25 | /** 26 | * @dev Initializes the contract setting the deployer as the initial owner. 27 | */ 28 | constructor() { 29 | _transferOwnership(_msgSender()); 30 | } 31 | 32 | /** 33 | * @dev Throws if called by any account other than the owner. 34 | */ 35 | modifier onlyOwner() { 36 | _checkOwner(); 37 | _; 38 | } 39 | 40 | /** 41 | * @dev Returns the address of the current owner. 42 | */ 43 | function owner() public view virtual returns (address) { 44 | return _owner; 45 | } 46 | 47 | /** 48 | * @dev Throws if the sender is not the owner. 49 | */ 50 | function _checkOwner() internal view virtual { 51 | require(owner() == _msgSender(), "Ownable: caller is not the owner"); 52 | } 53 | 54 | /** 55 | * @dev Leaves the contract without owner. It will not be possible to call 56 | * `onlyOwner` functions anymore. Can only be called by the current owner. 57 | * 58 | * NOTE: Renouncing ownership will leave the contract without an owner, 59 | * thereby removing any functionality that is only available to the owner. 60 | */ 61 | function renounceOwnership() public virtual onlyOwner { 62 | _transferOwnership(address(0)); 63 | } 64 | 65 | /** 66 | * @dev Transfers ownership of the contract to a new account (`newOwner`). 67 | * Can only be called by the current owner. 68 | */ 69 | function transferOwnership(address newOwner) public virtual onlyOwner { 70 | require(newOwner != address(0), "Ownable: new owner is the zero address"); 71 | _transferOwnership(newOwner); 72 | } 73 | 74 | /** 75 | * @dev Transfers ownership of the contract to a new account (`newOwner`). 76 | * Internal function without access restriction. 77 | */ 78 | function _transferOwnership(address newOwner) internal virtual { 79 | address oldOwner = _owner; 80 | _owner = newOwner; 81 | emit OwnershipTransferred(oldOwner, newOwner); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /cs/Proxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM 8 | * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to 9 | * be specified by overriding the virtual {_implementation} function. 10 | * 11 | * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a 12 | * different contract through the {_delegate} function. 13 | * 14 | * The success and return data of the delegated call will be returned back to the caller of the proxy. 15 | */ 16 | abstract contract Proxy { 17 | /** 18 | * @dev Delegates the current call to `implementation`. 19 | * 20 | * This function does not return to its internal call site, it will return directly to the external caller. 21 | */ 22 | function _delegate(address implementation) internal virtual { 23 | assembly { 24 | // Copy msg.data. We take full control of memory in this inline assembly 25 | // block because it will not return to Solidity code. We overwrite the 26 | // Solidity scratch pad at memory position 0. 27 | calldatacopy(0, 0, calldatasize()) 28 | 29 | // Call the implementation. 30 | // out and outsize are 0 because we don't know the size yet. 31 | let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) 32 | 33 | // Copy the returned data. 34 | returndatacopy(0, 0, returndatasize()) 35 | 36 | switch result 37 | // delegatecall returns 0 on error. 38 | case 0 { 39 | revert(0, returndatasize()) 40 | } 41 | default { 42 | return(0, returndatasize()) 43 | } 44 | } 45 | } 46 | 47 | /** 48 | * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function 49 | * and {_fallback} should delegate. 50 | */ 51 | function _implementation() internal view virtual returns (address); 52 | 53 | /** 54 | * @dev Delegates the current call to the address returned by `_implementation()`. 55 | * 56 | * This function does not return to its internal call site, it will return directly to the external caller. 57 | */ 58 | function _fallback() internal virtual { 59 | _beforeFallback(); 60 | _delegate(_implementation()); 61 | } 62 | 63 | /** 64 | * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other 65 | * function in the contract matches the call data. 66 | */ 67 | fallback() external payable virtual { 68 | _fallback(); 69 | } 70 | 71 | /** 72 | * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data 73 | * is empty. 74 | */ 75 | receive() external payable virtual { 76 | _fallback(); 77 | } 78 | 79 | /** 80 | * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` 81 | * call, or as part of the Solidity `fallback` or `receive` functions. 82 | * 83 | * If overridden should call `super._beforeFallback()`. 84 | */ 85 | function _beforeFallback() internal virtual {} 86 | } 87 | -------------------------------------------------------------------------------- /cs/ProxyAdmin.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.3) (proxy/transparent/ProxyAdmin.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./TransparentUpgradeableProxy.sol"; 7 | import "./Ownable.sol"; 8 | 9 | /** 10 | * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an 11 | * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}. 12 | */ 13 | contract ProxyAdmin is Ownable { 14 | /** 15 | * @dev Returns the current implementation of `proxy`. 16 | * 17 | * Requirements: 18 | * 19 | * - This contract must be the admin of `proxy`. 20 | */ 21 | function getProxyImplementation(ITransparentUpgradeableProxy proxy) public view virtual returns (address) { 22 | // We need to manually run the static call since the getter cannot be flagged as view 23 | // bytes4(keccak256("implementation()")) == 0x5c60da1b 24 | (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b"); 25 | require(success); 26 | return abi.decode(returndata, (address)); 27 | } 28 | 29 | /** 30 | * @dev Returns the current admin of `proxy`. 31 | * 32 | * Requirements: 33 | * 34 | * - This contract must be the admin of `proxy`. 35 | */ 36 | function getProxyAdmin(ITransparentUpgradeableProxy proxy) public view virtual returns (address) { 37 | // We need to manually run the static call since the getter cannot be flagged as view 38 | // bytes4(keccak256("admin()")) == 0xf851a440 39 | (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440"); 40 | require(success); 41 | return abi.decode(returndata, (address)); 42 | } 43 | 44 | /** 45 | * @dev Changes the admin of `proxy` to `newAdmin`. 46 | * 47 | * Requirements: 48 | * 49 | * - This contract must be the current admin of `proxy`. 50 | */ 51 | function changeProxyAdmin(ITransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner { 52 | proxy.changeAdmin(newAdmin); 53 | } 54 | 55 | /** 56 | * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. 57 | * 58 | * Requirements: 59 | * 60 | * - This contract must be the admin of `proxy`. 61 | */ 62 | function upgrade(ITransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner { 63 | proxy.upgradeTo(implementation); 64 | } 65 | 66 | /** 67 | * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See 68 | * {TransparentUpgradeableProxy-upgradeToAndCall}. 69 | * 70 | * Requirements: 71 | * 72 | * - This contract must be the admin of `proxy`. 73 | */ 74 | function upgradeAndCall( 75 | ITransparentUpgradeableProxy proxy, 76 | address implementation, 77 | bytes memory data 78 | ) public payable virtual onlyOwner { 79 | proxy.upgradeToAndCall{value: msg.value}(implementation, data); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /cs/StorageSlot.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Library for reading and writing primitive types to specific storage slots. 8 | * 9 | * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. 10 | * This library helps with reading and writing to such slots without the need for inline assembly. 11 | * 12 | * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. 13 | * 14 | * Example usage to set ERC1967 implementation slot: 15 | * ``` 16 | * contract ERC1967 { 17 | * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; 18 | * 19 | * function _getImplementation() internal view returns (address) { 20 | * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; 21 | * } 22 | * 23 | * function _setImplementation(address newImplementation) internal { 24 | * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); 25 | * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; 26 | * } 27 | * } 28 | * ``` 29 | * 30 | * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ 31 | */ 32 | library StorageSlot { 33 | struct AddressSlot { 34 | address value; 35 | } 36 | 37 | struct BooleanSlot { 38 | bool value; 39 | } 40 | 41 | struct Bytes32Slot { 42 | bytes32 value; 43 | } 44 | 45 | struct Uint256Slot { 46 | uint256 value; 47 | } 48 | 49 | /** 50 | * @dev Returns an `AddressSlot` with member `value` located at `slot`. 51 | */ 52 | function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { 53 | /// @solidity memory-safe-assembly 54 | assembly { 55 | r.slot := slot 56 | } 57 | } 58 | 59 | /** 60 | * @dev Returns an `BooleanSlot` with member `value` located at `slot`. 61 | */ 62 | function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { 63 | /// @solidity memory-safe-assembly 64 | assembly { 65 | r.slot := slot 66 | } 67 | } 68 | 69 | /** 70 | * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. 71 | */ 72 | function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { 73 | /// @solidity memory-safe-assembly 74 | assembly { 75 | r.slot := slot 76 | } 77 | } 78 | 79 | /** 80 | * @dev Returns an `Uint256Slot` with member `value` located at `slot`. 81 | */ 82 | function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { 83 | /// @solidity memory-safe-assembly 84 | assembly { 85 | r.slot := slot 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /cs/TransparentUpgradeableProxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.3) (proxy/transparent/TransparentUpgradeableProxy.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./ERC1967Proxy.sol"; 7 | 8 | /** 9 | * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy} 10 | * does not implement this interface directly, and some of its functions are implemented by an internal dispatch 11 | * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not 12 | * include them in the ABI so this interface must be used to interact with it. 13 | */ 14 | interface ITransparentUpgradeableProxy is IERC1967 { 15 | function admin() external view returns (address); 16 | 17 | function implementation() external view returns (address); 18 | 19 | function changeAdmin(address) external; 20 | 21 | function upgradeTo(address) external; 22 | 23 | function upgradeToAndCall(address, bytes memory) external payable; 24 | } 25 | 26 | /** 27 | * @dev This contract implements a proxy that is upgradeable by an admin. 28 | * 29 | * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector 30 | * clashing], which can potentially be used in an attack, this contract uses the 31 | * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two 32 | * things that go hand in hand: 33 | * 34 | * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if 35 | * that call matches one of the admin functions exposed by the proxy itself. 36 | * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the 37 | * implementation. If the admin tries to call a function on the implementation it will fail with an error that says 38 | * "admin cannot fallback to proxy target". 39 | * 40 | * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing 41 | * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due 42 | * to sudden errors when trying to call a function from the proxy implementation. 43 | * 44 | * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, 45 | * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. 46 | * 47 | * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not 48 | * inherit from that interface, and instead the admin functions are implicitly implemented using a custom dispatch 49 | * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to 50 | * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the 51 | * implementation. 52 | * 53 | * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the compiler 54 | * will not check that there are no selector conflicts, due to the note above. A selector clash between any new function 55 | * and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This could 56 | * render the admin operations inaccessible, which could prevent upgradeability. Transparency may also be compromised. 57 | */ 58 | contract TransparentUpgradeableProxy is ERC1967Proxy { 59 | /** 60 | * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and 61 | * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. 62 | */ 63 | constructor( 64 | address _logic, 65 | address admin_, 66 | bytes memory _data 67 | ) payable ERC1967Proxy(_logic, _data) { 68 | _changeAdmin(admin_); 69 | } 70 | 71 | /** 72 | * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. 73 | * 74 | * CAUTION: This modifier is deprecated, as it could cause issues if the modified function has arguments, and the 75 | * implementation provides a function with the same selector. 76 | */ 77 | modifier ifAdmin() { 78 | if (msg.sender == _getAdmin()) { 79 | _; 80 | } else { 81 | _fallback(); 82 | } 83 | } 84 | 85 | /** 86 | * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior 87 | */ 88 | function _fallback() internal virtual override { 89 | if (msg.sender == _getAdmin()) { 90 | bytes memory ret; 91 | bytes4 selector = msg.sig; 92 | if (selector == ITransparentUpgradeableProxy.upgradeTo.selector) { 93 | ret = _dispatchUpgradeTo(); 94 | } else if (selector == ITransparentUpgradeableProxy.upgradeToAndCall.selector) { 95 | ret = _dispatchUpgradeToAndCall(); 96 | } else if (selector == ITransparentUpgradeableProxy.changeAdmin.selector) { 97 | ret = _dispatchChangeAdmin(); 98 | } else if (selector == ITransparentUpgradeableProxy.admin.selector) { 99 | ret = _dispatchAdmin(); 100 | } else if (selector == ITransparentUpgradeableProxy.implementation.selector) { 101 | ret = _dispatchImplementation(); 102 | } else { 103 | revert("TransparentUpgradeableProxy: admin cannot fallback to proxy target"); 104 | } 105 | assembly { 106 | return(add(ret, 0x20), mload(ret)) 107 | } 108 | } else { 109 | super._fallback(); 110 | } 111 | } 112 | 113 | /** 114 | * @dev Returns the current admin. 115 | * 116 | * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the 117 | * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. 118 | * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` 119 | */ 120 | function _dispatchAdmin() private returns (bytes memory) { 121 | _requireZeroValue(); 122 | 123 | address admin = _getAdmin(); 124 | return abi.encode(admin); 125 | } 126 | 127 | /** 128 | * @dev Returns the current implementation. 129 | * 130 | * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the 131 | * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. 132 | * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` 133 | */ 134 | function _dispatchImplementation() private returns (bytes memory) { 135 | _requireZeroValue(); 136 | 137 | address implementation = _implementation(); 138 | return abi.encode(implementation); 139 | } 140 | 141 | /** 142 | * @dev Changes the admin of the proxy. 143 | * 144 | * Emits an {AdminChanged} event. 145 | */ 146 | function _dispatchChangeAdmin() private returns (bytes memory) { 147 | _requireZeroValue(); 148 | 149 | address newAdmin = abi.decode(msg.data[4:], (address)); 150 | _changeAdmin(newAdmin); 151 | 152 | return ""; 153 | } 154 | 155 | /** 156 | * @dev Upgrade the implementation of the proxy. 157 | */ 158 | function _dispatchUpgradeTo() private returns (bytes memory) { 159 | _requireZeroValue(); 160 | 161 | address newImplementation = abi.decode(msg.data[4:], (address)); 162 | _upgradeToAndCall(newImplementation, bytes(""), false); 163 | 164 | return ""; 165 | } 166 | 167 | /** 168 | * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified 169 | * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the 170 | * proxied contract. 171 | */ 172 | function _dispatchUpgradeToAndCall() private returns (bytes memory) { 173 | (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes)); 174 | _upgradeToAndCall(newImplementation, data, true); 175 | 176 | return ""; 177 | } 178 | 179 | /** 180 | * @dev Returns the current admin. 181 | */ 182 | function _admin() internal view virtual returns (address) { 183 | return _getAdmin(); 184 | } 185 | 186 | /** 187 | * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to 188 | * emulate some proxy functions being non-payable while still allowing value to pass through. 189 | */ 190 | function _requireZeroValue() private { 191 | require(msg.value == 0); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /cs/UpgradeableBeacon.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IBeacon.sol"; 7 | import "./Ownable.sol"; 8 | import "./Address.sol"; 9 | 10 | /** 11 | * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their 12 | * implementation contract, which is where they will delegate all function calls. 13 | * 14 | * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. 15 | */ 16 | contract UpgradeableBeacon is IBeacon, Ownable { 17 | address private _implementation; 18 | 19 | /** 20 | * @dev Emitted when the implementation returned by the beacon is changed. 21 | */ 22 | event Upgraded(address indexed implementation); 23 | 24 | /** 25 | * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the 26 | * beacon. 27 | */ 28 | constructor(address implementation_) { 29 | _setImplementation(implementation_); 30 | } 31 | 32 | /** 33 | * @dev Returns the current implementation address. 34 | */ 35 | function implementation() public view virtual override returns (address) { 36 | return _implementation; 37 | } 38 | 39 | /** 40 | * @dev Upgrades the beacon to a new implementation. 41 | * 42 | * Emits an {Upgraded} event. 43 | * 44 | * Requirements: 45 | * 46 | * - msg.sender must be the owner of the contract. 47 | * - `newImplementation` must be a contract. 48 | */ 49 | function upgradeTo(address newImplementation) public virtual onlyOwner { 50 | _setImplementation(newImplementation); 51 | emit Upgraded(newImplementation); 52 | } 53 | 54 | /** 55 | * @dev Sets the implementation contract address for this beacon 56 | * 57 | * Requirements: 58 | * 59 | * - `newImplementation` must be a contract. 60 | */ 61 | function _setImplementation(address newImplementation) private { 62 | require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract"); 63 | _implementation = newImplementation; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /cs/draft-IERC1822.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified 8 | * proxy whose upgrades are fully controlled by the current implementation. 9 | */ 10 | interface IERC1822Proxiable { 11 | /** 12 | * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation 13 | * address. 14 | * 15 | * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks 16 | * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this 17 | * function revert if invoked through a proxy. 18 | */ 19 | function proxiableUUID() external view returns (bytes32); 20 | } 21 | -------------------------------------------------------------------------------- /hardhat.config.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | require("@nomicfoundation/hardhat-toolbox"); 3 | require('@openzeppelin/hardhat-upgrades'); 4 | require('hardhat-dependency-compiler'); 5 | require('hardhat-contract-sizer'); 6 | require("@nomicfoundation/hardhat-verify"); 7 | const {toNumber} = require("ethers"); 8 | /** @type import('hardhat/config').HardhatUserConfig */ 9 | module.exports = { 10 | solidity: { 11 | compilers: [ 12 | { 13 | version: "0.8.20", 14 | settings: { 15 | evmVersion: 'paris', 16 | optimizer: { 17 | enabled: true, 18 | runs: 999999 19 | } 20 | } 21 | } 22 | ] 23 | }, 24 | networks: { 25 | btclayer2: { 26 | url: `${process.env.NETWORK_URL}`, 27 | timeout: 2000000, 28 | accounts: [`${process.env.PRIVATE_KEY}`] 29 | } 30 | }, 31 | etherscan: { 32 | apiKey: { 33 | btclayer2: "no-api-key-needed" 34 | }, 35 | // apiKey: "process.env.API_KEY", 36 | customChains: [ 37 | { 38 | network: "btclayer2", 39 | chainId: toNumber(`${process.env.CHAIN_ID}`), 40 | urls: { 41 | apiURL: `${process.env.EXPLORER_API_URL}`, 42 | browserURL: `${process.env.EXPLORER_URL}` 43 | } 44 | } 45 | ] 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", 4 | "@nomicfoundation/hardhat-ethers": "^3.0.0", 5 | "@nomicfoundation/hardhat-network-helpers": "^1.0.0", 6 | "@nomicfoundation/hardhat-toolbox": "^3.0.0", 7 | "@nomicfoundation/hardhat-verify": "^1.0.0", 8 | "@typechain/ethers-v6": "^0.4.0", 9 | "@typechain/hardhat": "^8.0.0", 10 | "chai": "^4.2.0", 11 | "ethers": "^6.4.0", 12 | "hardhat": "^2.19.0", 13 | "hardhat-gas-reporter": "^1.0.8", 14 | "solidity-coverage": "^0.8.0", 15 | "typechain": "^8.1.0" 16 | }, 17 | "scripts": { 18 | "compile": "npx hardhat compile && npx hardhat size-contracts", 19 | "deploy": "npx hardhat run scripts/deploy.js --network btclayer2", 20 | "verify": "npx hardhat run scripts/verify.js --network btclayer2", 21 | "upgrade-bridge": "npx hardhat run scripts/upgrades/upgrade-bridge.js --network btclayer2", 22 | "upgrade-bridge-erc20": "npx hardhat run scripts/upgrades/upgrade-bridge-erc20.js --network btclayer2", 23 | "upgrade-bridge-erc721": "npx hardhat run scripts/upgrades/upgrade-bridge-erc721.js --network btclayer2", 24 | "flatten": "npx hardhat flatten ./contracts/BTCLayer2Bridge.sol > FlattenedBTCLayer2Bridge.sol && npx hardhat flatten ./contracts/BTCLayer2BridgeERC20.sol > FlattenedBTCLayer2BridgeERC20.sol && npx hardhat flatten ./contracts/BTCLayer2BridgeERC721.sol > FlattenedBTCLayer2BridgeERC721.sol" 25 | }, 26 | "dependencies": { 27 | "dotenv": "^8.6.0", 28 | "@openzeppelin/contracts": "^5.0.0", 29 | "@openzeppelin/contracts-upgradeable": "^5.0.0", 30 | "@openzeppelin/hardhat-upgrades": "^2.3.3", 31 | "hardhat-contract-sizer": "^2.10.0", 32 | "hardhat-dependency-compiler": "^1.1.3" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /scripts/deploy.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades} = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | const pathOutputJson = path.join(__dirname, '../deploy_output.json'); 8 | let deployOutput = {}; 9 | if (fs.existsSync(pathOutputJson)) { 10 | deployOutput = require(pathOutputJson); 11 | } 12 | async function main() { 13 | let deployer = new ethers.Wallet(process.env.PRIVATE_KEY, ethers.provider); 14 | console.log(await deployer.getAddress()) 15 | const bTCLayer2BridgeFactory = await ethers.getContractFactory("BTCLayer2Bridge", deployer); 16 | const bTCLayer2BridgeERC20Factory = await ethers.getContractFactory("BTCLayer2BridgeERC20", deployer); 17 | const bTCLayer2BridgeERC721Factory = await ethers.getContractFactory("BTCLayer2BridgeERC721", deployer); 18 | let bTCLayer2BridgeDeployContract; 19 | if (deployOutput.bTCLayer2BridgeDeployContract === undefined || deployOutput.bTCLayer2BridgeDeployContract === '') { 20 | bTCLayer2BridgeDeployContract = await upgrades.deployProxy( 21 | bTCLayer2BridgeFactory, 22 | [], 23 | { 24 | initializer: false, 25 | constructorArgs: [], 26 | unsafeAllow: ['constructor', 'state-variable-immutable'], 27 | }); 28 | console.log('tx hash:', bTCLayer2BridgeDeployContract.deploymentTransaction().hash); 29 | } else { 30 | bTCLayer2BridgeDeployContract = bTCLayer2BridgeFactory.attach(deployOutput.bTCLayer2BridgeDeployContract); 31 | } 32 | 33 | console.log('bTCLayer2BridgeDeployContract deployed to:', bTCLayer2BridgeDeployContract.target); 34 | 35 | let bTCLayer2BridgeERC20DeployContract; 36 | if (deployOutput.bTCLayer2BridgeERC20DeployContract === undefined || deployOutput.bTCLayer2BridgeERC20DeployContract === '') { 37 | bTCLayer2BridgeERC20DeployContract = await upgrades.deployProxy( 38 | bTCLayer2BridgeERC20Factory, 39 | [ 40 | process.env.INITIAL_OWNER, 41 | bTCLayer2BridgeDeployContract.target 42 | ], 43 | { 44 | constructorArgs: [], 45 | unsafeAllow: ['constructor', 'state-variable-immutable'], 46 | }); 47 | console.log('tx hash:', bTCLayer2BridgeERC20DeployContract.deploymentTransaction().hash); 48 | } else { 49 | bTCLayer2BridgeERC20DeployContract = bTCLayer2BridgeERC20Factory.attach(deployOutput.bTCLayer2BridgeERC20DeployContract); 50 | } 51 | 52 | console.log('bTCLayer2BridgeERC20DeployContract deployed to:', bTCLayer2BridgeERC20DeployContract.target); 53 | 54 | let bTCLayer2BridgeERC721DeployContract; 55 | if (deployOutput.bTCLayer2BridgeERC721DeployContract === undefined || deployOutput.bTCLayer2BridgeERC721DeployContract === '') { 56 | bTCLayer2BridgeERC721DeployContract = await upgrades.deployProxy( 57 | bTCLayer2BridgeERC721Factory, 58 | [ 59 | process.env.INITIAL_OWNER, 60 | bTCLayer2BridgeDeployContract.target 61 | ], 62 | { 63 | constructorArgs: [], 64 | unsafeAllow: ['constructor', 'state-variable-immutable'], 65 | }); 66 | console.log('tx hash:', bTCLayer2BridgeERC721DeployContract.deploymentTransaction().hash); 67 | } else { 68 | bTCLayer2BridgeERC721DeployContract = bTCLayer2BridgeERC721Factory.attach(deployOutput.bTCLayer2BridgeERC721DeployContract); 69 | } 70 | 71 | console.log('bTCLayer2BridgeERC721DeployContract deployed to:', bTCLayer2BridgeERC721DeployContract.target); 72 | 73 | const tx = await bTCLayer2BridgeDeployContract.initialize(process.env.INITIAL_OWNER, 74 | process.env.SUPER_ADMIN_ADDRESS, 75 | bTCLayer2BridgeERC20DeployContract.target, 76 | bTCLayer2BridgeERC721DeployContract.target, 77 | process.env.BRIDGE_FEE_ADDRESS); 78 | await tx.wait(1); 79 | 80 | console.log(await bTCLayer2BridgeDeployContract.bridgeERC20Address()); 81 | console.log(await bTCLayer2BridgeDeployContract.bridgeERC721Address()); 82 | 83 | deployOutput.bTCLayer2BridgeDeployContract = bTCLayer2BridgeDeployContract.target; 84 | deployOutput.bTCLayer2BridgeERC20DeployContract = bTCLayer2BridgeERC20DeployContract.target; 85 | deployOutput.bTCLayer2BridgeERC721DeployContract = bTCLayer2BridgeERC721DeployContract.target; 86 | fs.writeFileSync(pathOutputJson, JSON.stringify(deployOutput, null, 1)); 87 | } 88 | 89 | main().catch((error) => { 90 | console.error(error); 91 | process.exitCode = 1; 92 | }); 93 | -------------------------------------------------------------------------------- /scripts/deployOnly/deploy-bridge-erc20.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | const pathOutputJson = path.join(__dirname, '../../deploy_output.json'); 8 | let deployOutput = {}; 9 | if (fs.existsSync(pathOutputJson)) { 10 | deployOutput = require(pathOutputJson); 11 | } 12 | console.log(`BridgeErc20 Contract Proxy Addr: ${deployOutput.bTCLayer2BridgeERC20DeployContract}`) 13 | 14 | async function main() { 15 | let [owner] = await ethers.getSigners(); 16 | console.log(`Using owner account: ${await owner.getAddress()}`) 17 | 18 | // 1. Get the contract to deploy 19 | const BridgeFactory = await ethers.getContractFactory("BTCLayer2BridgeERC20", owner); 20 | console.log('Deploying ...'); 21 | 22 | // 2. Instantiating a new Box smart contract 23 | const bridge = await BridgeFactory.deploy(); 24 | 25 | // 3. Waiting for the deployment to resolve 26 | await bridge.waitForDeployment(); 27 | 28 | // 4. Use the contract instance to get the contract address 29 | console.log('bridge-erc20 deployed to:', bridge.target); 30 | } 31 | 32 | main().catch((error) => { 33 | console.error(error); 34 | process.exitCode = 1; 35 | }); 36 | 37 | // deploy+verify. 38 | // cmd1: npx hardhat run scripts/deployOnly/deploy-bridge-erc20.js --network btclayer2 39 | // cmd2: npx hardhat verify --network btclayer2 0xB354DE4A8072BBD6e32bB152D72287475CAAeEDe 40 | 41 | -------------------------------------------------------------------------------- /scripts/deployOnly/deploy-bridge-erc721.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | const pathOutputJson = path.join(__dirname, '../../deploy_output.json'); 8 | let deployOutput = {}; 9 | if (fs.existsSync(pathOutputJson)) { 10 | deployOutput = require(pathOutputJson); 11 | } 12 | console.log(`BridgeERC721 Contract Proxy Addr: ${deployOutput.bTCLayer2BridgeERC721DeployContract}`) 13 | 14 | async function main() { 15 | let [owner] = await ethers.getSigners(); 16 | console.log(`Using owner account: ${await owner.getAddress()}`) 17 | 18 | // 1. Get the contract to deploy 19 | const BridgeFactory = await ethers.getContractFactory("BTCLayer2BridgeERC721", owner); 20 | console.log('Deploying ...'); 21 | 22 | // 2. Instantiating a new Box smart contract 23 | const bridge = await BridgeFactory.deploy(); 24 | 25 | // 3. Waiting for the deployment to resolve 26 | await bridge.waitForDeployment(); 27 | 28 | // 4. Use the contract instance to get the contract address 29 | console.log('bridge-erc721 deployed to:', bridge.target); 30 | } 31 | 32 | main().catch((error) => { 33 | console.error(error); 34 | process.exitCode = 1; 35 | }); 36 | 37 | // deploy+verify. 38 | // cmd1: npx hardhat run scripts/deployOnly/deploy-bridge-erc721.js --network btclayer2 39 | // cmd2: npx hardhat verify --network btclayer2 0xB354DE4A8072BBD6e32bB152D72287475CAAeEDe 40 | 41 | -------------------------------------------------------------------------------- /scripts/deployOnly/deploy-bridge.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | const pathOutputJson = path.join(__dirname, '../../deploy_output.json'); 8 | let deployOutput = {}; 9 | if (fs.existsSync(pathOutputJson)) { 10 | deployOutput = require(pathOutputJson); 11 | } 12 | console.log(`Bridge Contract Proxy Addr: ${deployOutput.bTCLayer2BridgeDeployContract}`) 13 | 14 | async function main() { 15 | let [owner] = await ethers.getSigners(); 16 | console.log(`Using owner account: ${await owner.getAddress()}`) 17 | 18 | // 1. Get the contract to deploy 19 | const BridgeFactory = await ethers.getContractFactory("BTCLayer2Bridge", owner); 20 | console.log('Deploying ...'); 21 | 22 | // 2. Instantiating a new Box smart contract 23 | const bridge = await BridgeFactory.deploy(); 24 | 25 | // 3. Waiting for the deployment to resolve 26 | await bridge.waitForDeployment(); 27 | 28 | // 4. Use the contract instance to get the contract address 29 | console.log('bridge deployed to:', bridge.target); 30 | } 31 | 32 | main().catch((error) => { 33 | console.error(error); 34 | process.exitCode = 1; 35 | }); 36 | 37 | // deploy+verify. 38 | // cmd1: npx hardhat run scripts/deployOnly/deploy-bridge.js --network btclayer2 39 | // cmd2: npx hardhat verify --network btclayer2 0xB354DE4A8072BBD6e32bB152D72287475CAAeEDe 40 | 41 | -------------------------------------------------------------------------------- /scripts/deployOnly/deploy-erc20.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | async function main() { 8 | let [owner] = await ethers.getSigners(); 9 | console.log(`Using owner account: ${await owner.getAddress()}`) 10 | 11 | // 1. Get the contract to deploy 12 | const BridgeFactory = await ethers.getContractFactory("ERC20TokenWrapped", owner); 13 | console.log('Deploying ...'); 14 | 15 | // 2. Instantiating a new Box smart contract 16 | const bridge = await BridgeFactory.deploy("20-1","20-1","18","10000000000000000000000000000"); 17 | 18 | // 3. Waiting for the deployment to resolve 19 | await bridge.waitForDeployment(); 20 | 21 | // 4. Use the contract instance to get the contract address 22 | console.log('erc20 deployed to:', bridge.target); 23 | } 24 | 25 | main().catch((error) => { 26 | console.error(error); 27 | process.exitCode = 1; 28 | }); 29 | 30 | // deploy+verify. 31 | // cmd1: npx hardhat run scripts/deployOnly/deploy-bridge-erc20.js --network btclayer2 32 | // cmd2: npx hardhat verify --network btclayer2 0xB354DE4A8072BBD6e32bB152D72287475CAAeEDe 33 | 34 | -------------------------------------------------------------------------------- /scripts/deployOnly/deploy-erc721.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | async function main() { 8 | let [owner] = await ethers.getSigners(); 9 | console.log(`Using owner account: ${await owner.getAddress()}`) 10 | 11 | // 1. Get the contract to deploy 12 | const BridgeFactory = await ethers.getContractFactory("ERC721TokenWrapped", owner); 13 | console.log('Deploying ...'); 14 | 15 | // 2. Instantiating a new Box smart contract 16 | const bridge = await BridgeFactory.deploy("111","111","111"); 17 | 18 | // 3. Waiting for the deployment to resolve 19 | await bridge.waitForDeployment(); 20 | 21 | // 4. Use the contract instance to get the contract address 22 | console.log('erc721 deployed to:', bridge.target); 23 | } 24 | 25 | main().catch((error) => { 26 | console.error(error); 27 | process.exitCode = 1; 28 | }); 29 | 30 | // deploy+verify. 31 | // cmd1: npx hardhat run scripts/deployOnly/deploy-bridge-erc721.js --network btclayer2 32 | // cmd2: npx hardhat verify --network btclayer2 0xB354DE4A8072BBD6e32bB152D72287475CAAeEDe --show-stack-traces 222 222 222 33 | 34 | -------------------------------------------------------------------------------- /scripts/upgrades/upgrade-bridge-erc20.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | const pathOutputJson = path.join(__dirname, '../../deploy_output.json'); 8 | let deployOutput = {}; 9 | if (fs.existsSync(pathOutputJson)) { 10 | deployOutput = require(pathOutputJson); 11 | } 12 | console.log(`Bridge ERC20 Contract Proxy Addr: ${deployOutput.bTCLayer2BridgeERC20DeployContract}`) 13 | 14 | async function main() { 15 | let [owner] = await ethers.getSigners(); 16 | console.log(`Using owner account: ${await owner.getAddress()}`) 17 | 18 | const btcLayer2BridgeERC20Factory = await ethers.getContractFactory("BTCLayer2BridgeERC20", owner); 19 | const btcLayer2BridgeERC20Contract = btcLayer2BridgeERC20Factory.attach(deployOutput.bTCLayer2BridgeERC20DeployContract); 20 | const upgraded = await upgrades.upgradeProxy(btcLayer2BridgeERC20Contract, btcLayer2BridgeERC20Factory); 21 | console.log('BTCLayer2BridgeERC20Contract upgrade to:', upgraded.target); 22 | } 23 | 24 | main().catch((error) => { 25 | console.error(error); 26 | process.exitCode = 1; 27 | }); 28 | -------------------------------------------------------------------------------- /scripts/upgrades/upgrade-bridge-erc721.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | const pathOutputJson = path.join(__dirname, '../../deploy_output.json'); 8 | let deployOutput = {}; 9 | if (fs.existsSync(pathOutputJson)) { 10 | deployOutput = require(pathOutputJson); 11 | } 12 | console.log(`Bridge ERC721 Contract Proxy Addr: ${deployOutput.bTCLayer2BridgeERC721DeployContract}`) 13 | 14 | async function main() { 15 | let [owner] = await ethers.getSigners(); 16 | console.log(`Using owner account: ${await owner.getAddress()}`) 17 | 18 | const btcLayer2BridgeERC721Factory = await ethers.getContractFactory("BTCLayer2BridgeERC721", owner); 19 | const btcLayer2BridgeERC721Contract = btcLayer2BridgeERC721Factory.attach(deployOutput.bTCLayer2BridgeERC721DeployContract); 20 | const upgraded = await upgrades.upgradeProxy(btcLayer2BridgeERC721Contract, btcLayer2BridgeERC721Factory); 21 | console.log('BTCLayer2BridgeERC721Contract upgrade to:', upgraded.target); 22 | } 23 | 24 | main().catch((error) => { 25 | console.error(error); 26 | process.exitCode = 1; 27 | }); 28 | -------------------------------------------------------------------------------- /scripts/upgrades/upgrade-bridge.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require('hardhat'); 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); 6 | 7 | const pathOutputJson = path.join(__dirname, '../../deploy_output.json'); 8 | let deployOutput = {}; 9 | if (fs.existsSync(pathOutputJson)) { 10 | deployOutput = require(pathOutputJson); 11 | } 12 | console.log(`Bridge Contract Proxy Addr: ${deployOutput.bTCLayer2BridgeDeployContract}`) 13 | 14 | async function main() { 15 | let [owner] = await ethers.getSigners(); 16 | console.log(`Using owner account: ${await owner.getAddress()}`) 17 | 18 | const btcLayer2BridgeFactory = await ethers.getContractFactory("BTCLayer2Bridge", owner); 19 | const btcLayer2BridgeContract = btcLayer2BridgeFactory.attach(deployOutput.bTCLayer2BridgeDeployContract); 20 | const upgraded = await upgrades.upgradeProxy(btcLayer2BridgeContract, btcLayer2BridgeFactory); 21 | console.log('BTCLayer2BridgeContract upgrade to:', upgraded.target); 22 | } 23 | 24 | main().catch((error) => { 25 | console.error(error); 26 | process.exitCode = 1; 27 | }); 28 | -------------------------------------------------------------------------------- /scripts/verify.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | const path = require('path'); 3 | const hre = require('hardhat'); 4 | const { expect } = require('chai'); 5 | 6 | const pathDeployOutputParameters = path.join(__dirname, '../deploy_output.json'); 7 | const deployOutputParameters = require(pathDeployOutputParameters); 8 | 9 | async function main() { 10 | // verify bridge ERC20 11 | try { 12 | await hre.run( 13 | 'verify:verify', 14 | { 15 | address: deployOutputParameters.bTCLayer2BridgeERC20DeployContract, 16 | constructorArguments: [], 17 | }, 18 | ); 19 | } catch (error) { 20 | expect(error.message.toLowerCase().includes('unknown action')).to.be.equal(true); 21 | } 22 | 23 | //verify bridge ERC721 24 | try { 25 | await hre.run( 26 | 'verify:verify', 27 | { 28 | address: deployOutputParameters.bTCLayer2BridgeERC721DeployContract, 29 | constructorArguments: [], 30 | }, 31 | ); 32 | } catch (error) { 33 | expect(error.message.toLowerCase().includes('unknown action')).to.be.equal(true); 34 | } 35 | 36 | // verify bridge 37 | try { 38 | await hre.run( 39 | 'verify:verify', 40 | { 41 | address: deployOutputParameters.bTCLayer2BridgeDeployContract, 42 | constructorArguments: [], 43 | }, 44 | ); 45 | } catch (error) { 46 | expect(error.message.toLowerCase().includes('unknown action')).to.be.equal(true); 47 | } 48 | } 49 | 50 | main().then(() => process.exit(0)).catch((error) => { 51 | console.error(error); 52 | process.exit(1); 53 | }); 54 | -------------------------------------------------------------------------------- /test/Lock.js: -------------------------------------------------------------------------------- 1 | const { 2 | time, 3 | loadFixture, 4 | } = require("@nomicfoundation/hardhat-toolbox/network-helpers"); 5 | const { anyValue } = require("@nomicfoundation/hardhat-chai-matchers/withArgs"); 6 | const { expect } = require("chai"); 7 | 8 | describe("Lock", function () { 9 | // We define a fixture to reuse the same setup in every test. 10 | // We use loadFixture to run this setup once, snapshot that state, 11 | // and reset Hardhat Network to that snapshot in every test. 12 | async function deployOneYearLockFixture() { 13 | const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60; 14 | const ONE_GWEI = 1_000_000_000; 15 | 16 | const lockedAmount = ONE_GWEI; 17 | const unlockTime = (await time.latest()) + ONE_YEAR_IN_SECS; 18 | 19 | // Contracts are deployed using the first signer/account by default 20 | const [owner, otherAccount] = await ethers.getSigners(); 21 | 22 | const Lock = await ethers.getContractFactory("Lock"); 23 | const lock = await Lock.deploy(unlockTime, { value: lockedAmount }); 24 | 25 | return { lock, unlockTime, lockedAmount, owner, otherAccount }; 26 | } 27 | 28 | describe("Deployment", function () { 29 | it("Should set the right unlockTime", async function () { 30 | const { lock, unlockTime } = await loadFixture(deployOneYearLockFixture); 31 | 32 | expect(await lock.unlockTime()).to.equal(unlockTime); 33 | }); 34 | 35 | it("Should set the right owner", async function () { 36 | const { lock, owner } = await loadFixture(deployOneYearLockFixture); 37 | 38 | expect(await lock.owner()).to.equal(owner.address); 39 | }); 40 | 41 | it("Should receive and store the funds to lock", async function () { 42 | const { lock, lockedAmount } = await loadFixture( 43 | deployOneYearLockFixture 44 | ); 45 | 46 | expect(await ethers.provider.getBalance(lock.target)).to.equal( 47 | lockedAmount 48 | ); 49 | }); 50 | 51 | it("Should fail if the unlockTime is not in the future", async function () { 52 | // We don't use the fixture here because we want a different deployment 53 | const latestTime = await time.latest(); 54 | const Lock = await ethers.getContractFactory("Lock"); 55 | await expect(Lock.deploy(latestTime, { value: 1 })).to.be.revertedWith( 56 | "Unlock time should be in the future" 57 | ); 58 | }); 59 | }); 60 | 61 | describe("Withdrawals", function () { 62 | describe("Validations", function () { 63 | it("Should revert with the right error if called too soon", async function () { 64 | const { lock } = await loadFixture(deployOneYearLockFixture); 65 | 66 | await expect(lock.withdraw()).to.be.revertedWith( 67 | "You can't withdraw yet" 68 | ); 69 | }); 70 | 71 | it("Should revert with the right error if called from another account", async function () { 72 | const { lock, unlockTime, otherAccount } = await loadFixture( 73 | deployOneYearLockFixture 74 | ); 75 | 76 | // We can increase the time in Hardhat Network 77 | await time.increaseTo(unlockTime); 78 | 79 | // We use lock.connect() to send a transaction from another account 80 | await expect(lock.connect(otherAccount).withdraw()).to.be.revertedWith( 81 | "You aren't the owner" 82 | ); 83 | }); 84 | 85 | it("Shouldn't fail if the unlockTime has arrived and the owner calls it", async function () { 86 | const { lock, unlockTime } = await loadFixture( 87 | deployOneYearLockFixture 88 | ); 89 | 90 | // Transactions are sent using the first signer by default 91 | await time.increaseTo(unlockTime); 92 | 93 | await expect(lock.withdraw()).not.to.be.reverted; 94 | }); 95 | }); 96 | 97 | describe("Events", function () { 98 | it("Should emit an event on withdrawals", async function () { 99 | const { lock, unlockTime, lockedAmount } = await loadFixture( 100 | deployOneYearLockFixture 101 | ); 102 | 103 | await time.increaseTo(unlockTime); 104 | 105 | await expect(lock.withdraw()) 106 | .to.emit(lock, "Withdrawal") 107 | .withArgs(lockedAmount, anyValue); // We accept any value as `when` arg 108 | }); 109 | }); 110 | 111 | describe("Transfers", function () { 112 | it("Should transfer the funds to the owner", async function () { 113 | const { lock, unlockTime, lockedAmount, owner } = await loadFixture( 114 | deployOneYearLockFixture 115 | ); 116 | 117 | await time.increaseTo(unlockTime); 118 | 119 | await expect(lock.withdraw()).to.changeEtherBalances( 120 | [owner, lock], 121 | [lockedAmount, -lockedAmount] 122 | ); 123 | }); 124 | }); 125 | }); 126 | }); 127 | -------------------------------------------------------------------------------- /test/claim.test.js: -------------------------------------------------------------------------------- 1 | const { ethers } = require('hardhat'); 2 | const { expect } = require('chai'); 3 | 4 | const RewardDistributionAddr = '0x90DE61B6F65a29d510f56b6A31A18d9D7cc838EC'; 5 | let deployer; 6 | describe('Staking static data', () => { 7 | beforeEach(async () => { 8 | [deployer] = await ethers.getSigners(); 9 | }); 10 | // npx hardhat test test/claim.test.js --network lumozL1Devnet --grep "1.Claim" 11 | it('1.Claim', async () => { 12 | const rewardDistributionV2Contract = await ethers.getContractAt('RewardDistribution', RewardDistributionAddr, deployer); 13 | console.log(await rewardDistributionV2Contract.basicSettlementInterval()); 14 | let amount = ethers.parseEther('5751927'); 15 | console.log(amount); 16 | const tx = await rewardDistributionV2Contract.claim(4, amount, ["0x2b665c23457d0c5bd4fb764c1bc831c848342a4692fb65d745b0bbf1d1901096", "0x88b7f46f4db66a862a24c27a80ca1f7be628d6aa841356c504a81a225819b22a", "0xb9bbce523b7e89d25c58950a0cbf089d22f7cb0ef343e3c93143617d1829096e"]); 17 | console.log(`https://sepolia.etherscan.io/tx/${tx.hash}`); 18 | await tx.wait(1); 19 | }).timeout(1000000); 20 | }); --------------------------------------------------------------------------------