diff --git a/packages/ri/contracts/.gitignore b/packages/ri/contracts/.gitignore new file mode 100644 index 0000000000..079b7896f2 --- /dev/null +++ b/packages/ri/contracts/.gitignore @@ -0,0 +1,6 @@ +out/ +/cache/ +node_modules/ +.env +bindings/ +artifacts/ \ No newline at end of file diff --git a/packages/ri/contracts/.prettierrc b/packages/ri/contracts/.prettierrc new file mode 100644 index 0000000000..9a5a009900 --- /dev/null +++ b/packages/ri/contracts/.prettierrc @@ -0,0 +1,7 @@ +{ + "printWidth": 120, + "semi": true, + "tabWidth": 2, + "useTabs": false, + "bracketSpacing": true +} diff --git a/packages/ri/contracts/.solhint.json b/packages/ri/contracts/.solhint.json new file mode 100644 index 0000000000..cb52819591 --- /dev/null +++ b/packages/ri/contracts/.solhint.json @@ -0,0 +1,11 @@ +{ + "extends": "solhint:recommended", + "rules": { + "compiler-version": ["error", ">=0.8.0"], + "avoid-low-level-calls": "off", + "no-inline-assembly": "off", + "func-visibility": ["warn", { "ignoreConstructors": true }], + "no-empty-blocks": "off", + "no-complex-fallback": "off" + } +} diff --git a/packages/ri/contracts/README.md b/packages/ri/contracts/README.md new file mode 100644 index 0000000000..94832d8d27 --- /dev/null +++ b/packages/ri/contracts/README.md @@ -0,0 +1,5 @@ +# Reference Implementation Contracts + +### Adding new functions + +When adding new facets or new functions to existing facets, make sure to add the function selectors in `src/test/utils/Deploy.sol`. diff --git a/packages/ri/contracts/abi/Diamond.json b/packages/ri/contracts/abi/Diamond.json new file mode 100644 index 0000000000..ea9fa4ebca --- /dev/null +++ b/packages/ri/contracts/abi/Diamond.json @@ -0,0 +1,2201 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_diamondOwner", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamondCut.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondCut.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": { + "object": "0x60806040526040516200287238038062002872833981016040819052620000269162000e65565b604080516000808252602082019092526200004e9183916200010360201b620000f41760201c565b62000064826200029060201b620002931760201c565b60006200007b6200031460201b6200034d1760201c565b6301ffc9a760e01b6000908152600482016020526040808220805460ff1990811660019081179092556307e4c70760e21b845282842080548216831790556348e2b09360e01b845282842080548216831790556307f5828d60e41b8452919092208054909116909117905560060180546001600160a01b031916301790555062001264915050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f54600080516020620027de8339815191529061ffff811690819060009060071615620001625750600381901c60009081526002840160205260409020545b60005b8751811015620001fe57620001e483838a84815181106200018a576200018a62001011565b6020026020010151600001518b8581518110620001ab57620001ab62001011565b6020026020010151602001518c8681518110620001cc57620001cc62001011565b6020026020010151604001516200032760201b60201c565b909350915080620001f5816200103d565b91505062000165565b508282146200021b5760038401805461ffff191661ffff84161790555b60078216156200023e57600382901c600090815260028501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb6738787876040516200027393929190620010cc565b60405180910390a162000287868662000b65565b50505050505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132180546001600160a01b031981166001600160a01b03848116918217909355604051600080516020620027de833981519152939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600080516020620027de83398151915290565b60008080600080516020620027de83398151915290506000845111620003a85760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b60648201526084015b60405180910390fd5b6000856002811115620003bf57620003bf62001059565b036200057457620003ea86604051806060016040528060248152602001620027fe6024913962000d8a565b60018181018054918201815560009081526020812090910180546001600160a01b0319166001600160a01b0389161790555b84518110156200056d5760008582815181106200043d576200043d62001011565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c15620004e05760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016200039f565b6001600160e01b031980831660008181526020879052604090206001600160601b031960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a819003620005455760038c901c600090815260028601602052604081209b909b555b8b62000551816200103d565b9c5050505050808062000564906200103d565b9150506200041c565b5062000b59565b60018560028111156200058b576200058b62001059565b03620007a457620005b6866040518060600160405280602881526020016200284a6028913962000d8a565b60005b84518110156200056d576000858281518110620005da57620005da62001011565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c308103620006715760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b60648201526084016200039f565b896001600160a01b0316816001600160a01b031603620006e95760405162461bcd60e51b81526020600482015260386024820152600080516020620027be83398151915260448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016200039f565b6001600160a01b038116620007565760405162461bcd60e51b81526020600482015260386024820152600080516020620027be83398151915260448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016200039f565b506001600160e01b031990911660009081526020849052604090206001600160601b03919091166001600160601b031960608a901b16179055806200079b816200103d565b915050620005b9565b6002856002811115620007bb57620007bb62001059565b0362000b00576001600160a01b03861615620008405760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016200039f565b600388901c6007891660005b865181101562000adb5760008a90036200088d57826200086c81620011d3565b60008181526002870160205260409020549b509350600792506200089d9050565b816200089981620011d3565b9250505b6000806000808a8581518110620008b857620008b862001011565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c6200095a5760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016200039f565b30606082901c03620009c65760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b60648201526084016200039f565b600587901b8f901b94506001600160e01b03198086169083161462000a18576001600160e01b03198516600090815260208a90526040902080546001600160601b0319166001600160601b0383161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e016905085821462000a7f576000828152600288016020526040902080546001600160e01b031980841c19909116908516831c17905562000aa3565b80836001600160e01b031916901c816001600160e01b031960001b901c198e16179c505b8460000362000ac257600086815260028801602052604081208190559c505b505050808062000ad2906200103d565b9150506200084c565b508062000aea836008620011ed565b62000af691906200120f565b9950505062000b59565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084016200039f565b50959694955050505050565b6001600160a01b03821662000bef5780511562000beb5760405162461bcd60e51b815260206004820152603c60248201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860448201527f3029206275745f63616c6c64617461206973206e6f7420656d7074790000000060648201526084016200039f565b5050565b600081511162000c685760405162461bcd60e51b815260206004820152603d60248201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460448201527f7920627574205f696e6974206973206e6f74206164647265737328302900000060648201526084016200039f565b6001600160a01b038216301462000c9e5762000c9e82604051806060016040528060288152602001620028226028913962000d8a565b600080836001600160a01b03168360405162000cbb91906200122a565b600060405180830381855af49150503d806000811462000cf8576040519150601f19603f3d011682016040523d82523d6000602084013e62000cfd565b606091505b50915091508162000d845780511562000d2c578060405162461bcd60e51b81526004016200039f919062001248565b60405162461bcd60e51b815260206004820152602660248201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e2072656044820152651d995c9d195960d21b60648201526084016200039f565b50505050565b813b818162000d845760405162461bcd60e51b81526004016200039f919062001248565b80516001600160a01b038116811462000dc657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171562000e065762000e0662000dcb565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000e375762000e3762000dcb565b604052919050565b60006001600160401b0382111562000e5b5762000e5b62000dcb565b5060051b60200190565b6000806040838503121562000e7957600080fd5b62000e848362000dae565b602084810151919350906001600160401b038082111562000ea457600080fd5b818601915086601f83011262000eb957600080fd5b815162000ed062000eca8262000e3f565b62000e0c565b81815260059190911b8301840190848101908983111562000ef057600080fd5b8585015b83811015620010005780518581111562000f0d57600080fd5b86016060818d03601f1901121562000f2457600080fd5b62000f2e62000de1565b62000f3b89830162000dae565b815260408201516003811062000f5057600080fd5b818a015260608201518781111562000f6757600080fd5b8083019250508c603f83011262000f7d57600080fd5b8882015162000f9062000eca8262000e3f565b81815260059190911b8301604001908a8101908f83111562000fb157600080fd5b6040850194505b8285101562000fea5784516001600160e01b03198116811462000fda57600080fd5b8252938b0193908b019062000fb8565b6040840152505084525091860191860162000ef4565b508096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162001052576200105262001027565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60005b838110156200108c57818101518382015260200162001072565b8381111562000d845750506000910152565b60008151808452620010b88160208601602086016200106f565b601f01601f19169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b84811015620011a157898403607f19018652815180516001600160a01b031685528381015189860190600381106200113d57634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b808310156200118b5783516001600160e01b03191682529286019260019290920191908601906200115f565b50978501979550505090820190600101620010f5565b50506001600160a01b038a16908801528681036040880152620011c581896200109e565b9a9950505050505050505050565b600081620011e557620011e562001027565b506000190190565b60008160001904831182151516156200120a576200120a62001027565b500290565b6000821982111562001225576200122562001027565b500190565b600082516200123e8184602087016200106f565b9190910192915050565b6020815260006200125d60208301846200109e565b9392505050565b61154a80620012746000396000f3fe60806040523661000b57005b600080357fffffffff000000000000000000000000000000000000000000000000000000001681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c806100d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f7420657869737460448201526064015b60405180910390fd5b3660008037600080366000845af43d6000803e8080156100ef573d6000f35b3d6000fd5b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9061ffff8116908190600090600716156101635750600381901c60009081526002840160205260409020545b60005b87518110156101ea576101d383838a848151811061018657610186611166565b6020026020010151600001518b85815181106101a4576101a4611166565b6020026020010151602001518c86815181106101c2576101c2611166565b602002602001015160400151610371565b9093509150806101e2816111c4565b915050610166565b50828214610223576003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff84161790555b600782161561024557600382901c600090815260028501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673878787604051610278939291906112a1565b60405180910390a161028a8686610e72565b50505050505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132180547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff8481169182179093556040517fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b600080807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90506000845111610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201527f6163657420746f2063757400000000000000000000000000000000000000000060648201526084016100c7565b600085600281111561043d5761043d6111fc565b0361066857610464866040518060600160405280602481526020016114ca6024913961112b565b60018181018054918201815560009081526020812090910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff89161790555b84518110156106625760008582815181106104d8576104d8611166565b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815291859052604090912054909150606081901c156105ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016100c7565b7fffffffff0000000000000000000000000000000000000000000000000000000080831660008181526020879052604090207fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060608d901b168e17905560e060058e901b811692831c199c909c1690821c179a81900361063f5760038c901c600090815260028601602052604081209b909b555b8b610649816111c4565b9c5050505050808061065a906111c4565b9150506104bb565b50610e66565b600185600281111561067c5761067c6111fc565b03610976576106a3866040518060600160405280602881526020016115166028913961112b565b60005b84518110156106625760008582815181106106c3576106c3611166565b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815291859052604090912054909150606081901c308103610798576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201527f757461626c652066756e6374696f6e000000000000000000000000000000000060648201526084016100c7565b8973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016100c7565b73ffffffffffffffffffffffffffffffffffffffff81166108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016100c7565b507fffffffff0000000000000000000000000000000000000000000000000000000090911660009081526020849052604090206bffffffffffffffffffffffff919091167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060608a901b161790558061096e816111c4565b9150506106a6565b600285600281111561098a5761098a6111fc565b03610dde5773ffffffffffffffffffffffffffffffffffffffff861615610a33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016100c7565b600388901c6007891660005b8651811015610dbe5760008a9003610a7b5782610a5b81611409565b60008181526002870160205260409020549b50935060079250610a899050565b81610a8581611409565b9250505b6000806000808a8581518110610aa157610aa1611166565b6020908102919091018101517fffffffff0000000000000000000000000000000000000000000000000000000081166000908152918a9052604090912054909150606081901c610b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016100c7565b30606082901c03610c06576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201527f7461626c652066756e6374696f6e00000000000000000000000000000000000060648201526084016100c7565b600587901b8f901b94507fffffffff0000000000000000000000000000000000000000000000000000000080861690831614610ca4577fffffffff000000000000000000000000000000000000000000000000000000008516600090815260208a90526040902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff83161790555b7fffffffff0000000000000000000000000000000000000000000000000000000091909116600090815260208990526040812055600381901c611fff16925060051b60e0169050858214610d39576000828152600288016020526040902080547fffffffff0000000000000000000000000000000000000000000000000000000080841c19909116908516831c179055610d8a565b80837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c817fffffffff0000000000000000000000000000000000000000000000000000000060001b901c198e16179c505b84600003610da857600086815260028801602052604081208190559c505b5050508080610db6906111c4565b915050610a3f565b5080610dcb83600861143e565b610dd5919061147b565b99505050610e66565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560448201527f74416374696f6e0000000000000000000000000000000000000000000000000060648201526084016100c7565b50959694955050505050565b73ffffffffffffffffffffffffffffffffffffffff8216610f2057805115610f1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603c60248201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860448201527f3029206275745f63616c6c64617461206973206e6f7420656d7074790000000060648201526084016100c7565b5050565b6000815111610fb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460448201527f7920627574205f696e6974206973206e6f74206164647265737328302900000060648201526084016100c7565b73ffffffffffffffffffffffffffffffffffffffff82163014610ff057610ff0826040518060600160405280602881526020016114ee6028913961112b565b6000808373ffffffffffffffffffffffffffffffffffffffff16836040516110189190611493565b600060405180830381855af49150503d8060008114611053576040519150601f19603f3d011682016040523d82523d6000602084013e611058565b606091505b5091509150816111255780511561109d57806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c791906114af565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e20726560448201527f766572746564000000000000000000000000000000000000000000000000000060648201526084016100c7565b50505050565b813b8181611125576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c791906114af565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036111f5576111f5611195565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60005b8381101561124657818101518382015260200161122e565b838111156111255750506000910152565b6000815180845261126f81602086016020860161122b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b848110156113cc577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808a8503018652815188850173ffffffffffffffffffffffffffffffffffffffff82511686528482015160038110611353577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b808310156113b75783517fffffffff00000000000000000000000000000000000000000000000000000000168252928601926001929092019190860190611375565b509785019795505050908201906001016112ca565b505073ffffffffffffffffffffffffffffffffffffffff8a169088015286810360408801526113fb8189611257565b9a9950505050505050505050565b60008161141857611418611195565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561147657611476611195565b500290565b6000821982111561148e5761148e611195565b500190565b600082516114a581846020870161122b565b9190910192915050565b6020815260006114c26020830184611257565b939250505056fe4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465a164736f6c634300080d000a4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756ec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465", + "sourceMap": "765:1837:45:-:0;;;786:704;;;;;;;;;;;;;;;;;;:::i;:::-;925:12;;;921:1;925:12;;;;;;;;;878:60;;900:11;;878:21;;;;;:60;;:::i;:::-;944:42;972:13;944:27;;;;;:42;;:::i;:::-;993:25;1021:27;:25;;;;;:27;;:::i;:::-;-1:-1:-1;;;1166:49:45;;;;:22;;;:49;;;;;;:56;;-1:-1:-1;;1166:56:45;;;1218:4;1166:56;;;;;;-1:-1:-1;;;1228:53:45;;;;;:60;;;;;;;;-1:-1:-1;;;1294:55:45;;;;;:62;;;;;;;;-1:-1:-1;;;1362:49:45;;;;;;:56;;;;;;;;;;1459:10;;:26;;-1:-1:-1;;;;;;1459:26:45;1480:4;1459:26;;;-1:-1:-1;765:1837:45;;-1:-1:-1;;765:1837:45;2745:1530:52;2960:16;;-1:-1:-1;;;;;;;;;;;1304:45:52;2960:16;;;;;;2878:25;;3208:1;3192:17;:21;3188:205;;-1:-1:-1;3384:1:52;3367:18;;;3350:36;;;;:16;;;:36;;;;;;3188:205;3435:18;3430:339;3468:11;:18;3455:10;:31;3430:339;;;3542:220;3582:13;3605:12;3627:11;3639:10;3627:23;;;;;;;;:::i;:::-;;;;;;;:36;;;3673:11;3685:10;3673:23;;;;;;;;:::i;:::-;;;;;;;:30;;;3713:11;3725:10;3713:23;;;;;;;;:::i;:::-;;;;;;;:41;;;3542:30;;;:220;;:::i;:::-;3510:252;;-1:-1:-1;3510:252:52;-1:-1:-1;3488:12:52;;;;:::i;:::-;;;;3430:339;;;;3795:21;3778:13;:38;3774:99;;3826:16;;;:40;;-1:-1:-1;;3826:40:52;;;;;;;3774:99;4021:1;4005:17;;:21;4001:174;;4151:1;4134:18;;;4117:36;;;;:16;;;:36;;;;;:51;;;4001:174;4185:41;4196:11;4209:5;4216:9;4185:41;;;;;;;;:::i;:::-;;;;;;;;4232:38;4253:5;4260:9;4232:20;:38::i;:::-;2872:1403;;;;2745:1530;;;:::o;1623:246::-;1757:16;;;-1:-1:-1;;;;;;1779:28:52;;-1:-1:-1;;;;;1779:28:52;;;;;;;;;1818:46;;-1:-1:-1;;;;;;;;;;;1304:45:52;1757:16;;;;;;1818:46;;1683:25;;1818:46;1677:192;;1623:246;:::o;1354:177::-;-1:-1:-1;;;;;;;;;;;1304:45:52;1354:177::o;4279:6098::-;4498:7;;;-1:-1:-1;;;;;;;;;;;4522:44:52;;4600:1;4580:10;:17;:21;4572:77;;;;-1:-1:-1;;;4572:77:52;;6964:2:85;4572:77:52;;;6946:21:85;7003:2;6983:18;;;6976:30;7042:34;7022:18;;;7015:62;-1:-1:-1;;;7093:18:85;;;7086:41;7144:19;;4572:77:52;;;;;;;;;4670:30;4659:7;:41;;;;;;;;:::i;:::-;;4655:5674;;4710:80;4733:16;4710:80;;;;;;;;;;;;;;;;;:22;:80::i;:::-;4798:17;;;;:40;;;;;;;-1:-1:-1;4798:40:52;;;;;;;;;;;-1:-1:-1;;;;;;4798:40:52;-1:-1:-1;;;;;4798:40:52;;;;;4846:1113;4890:10;:17;4874:13;:33;4846:1113;;;4936:15;4954:10;4965:13;4954:25;;;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;;5008:19:52;;4989:16;5008:19;;;;;;;;;;;;4954:25;;-1:-1:-1;5045:26:52;;;;:40;5037:106;;;;-1:-1:-1;;;5037:106:52;;7376:2:85;5037:106:52;;;7358:21:85;7415:2;7395:18;;;7388:30;7454:34;7434:18;;;7427:62;7525:23;7505:18;;;7498:51;7566:19;;5037:106:52;7174:417:85;5037:106:52;-1:-1:-1;;;;;;5187:19:52;;;5237:23;5187:19;;;;;;;;;;-1:-1:-1;;;;;;5209:25:52;;;;:51;;;5187:73;;5391:25;5415:1;5391:25;;;;;5531:45;;;5529:48;5513:64;;;;5592:43;;;5512:124;;5702:29;;;5698:227;;5867:1;5849:19;;;5832:37;;;;:16;;;:37;;;;;:53;;;;5698:227;5934:16;;;;:::i;:::-;;;;4926:1033;;;4909:15;;;;;:::i;:::-;;;;4846:1113;;;;4655:5674;;;5986:34;5975:7;:45;;;;;;;;:::i;:::-;;5971:4358;;6030:84;6053:16;6030:84;;;;;;;;;;;;;;;;;:22;:84::i;:::-;6209:21;6204:756;6248:10;:17;6232:13;:33;6204:756;;;6294:15;6312:10;6323:13;6312:25;;;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;;6366:19:52;;6347:16;6366:19;;;;;;;;;;;;6312:25;;-1:-1:-1;6421:26:52;;;;6544:4;6517:32;;6509:92;;;;-1:-1:-1;;;6509:92:52;;7798:2:85;6509:92:52;;;7780:21:85;7837:2;7817:18;;;7810:30;7876:34;7856:18;;;7849:62;-1:-1:-1;;;7927:18:85;;;7920:45;7982:19;;6509:92:52;7596:411:85;6509:92:52;6638:16;-1:-1:-1;;;;;6619:35:52;:15;-1:-1:-1;;;;;6619:35:52;;6611:104;;;;-1:-1:-1;;;6611:104:52;;8214:2:85;6611:104:52;;;8196:21:85;8253:2;8233:18;;;8226:30;-1:-1:-1;;;;;;;;;;;8272:18:85;;;8265:62;8363:26;8343:18;;;8336:54;8407:19;;6611:104:52;8012:420:85;6611:104:52;-1:-1:-1;;;;;6733:29:52;;6725:98;;;;-1:-1:-1;;;6725:98:52;;8639:2:85;6725:98:52;;;8621:21:85;8678:2;8658:18;;;8651:30;-1:-1:-1;;;;;;;;;;;8697:18:85;;;8690:62;8788:26;8768:18;;;8761:54;8832:19;;6725:98:52;8437:420:85;6725:98:52;-1:-1:-1;;;;;;;6870:19:52;;;2288:44;6870:19;;;;;;;;;;-1:-1:-1;;;;;6893:29:52;;;;-1:-1:-1;;;;;;6926:25:52;;;;6892:59;;6870:81;;6267:15;;;;:::i;:::-;;;;6204:756;;5971:4358;6987:33;6976:7;:44;;;;;;;;:::i;:::-;;6972:3357;;-1:-1:-1;;;;;7119:30:52;;;7111:97;;;;-1:-1:-1;;;7111:97:52;;9064:2:85;7111:97:52;;;9046:21:85;9103:2;9083:18;;;9076:30;9142:34;9122:18;;;9115:62;9213:24;9193:18;;;9186:52;9255:19;;7111:97:52;8862:418:85;7111:97:52;7347:1;7329:19;;;7489:1;7472:18;;7301:25;7498:2687;7542:10;:17;7526:13;:33;7498:2687;;;7609:1;7592:18;;;7588:249;;7659:19;;;;:::i;:::-;7706:35;;;;:16;;;:35;;;;;;;-1:-1:-1;7659:19:52;-1:-1:-1;7775:1:52;;-1:-1:-1;7588:249:52;;-1:-1:-1;7588:249:52;;7805:21;;;;:::i;:::-;;;;7588:249;7846:19;7875:29;7914:33;8030:15;8048:10;8059:13;8048:25;;;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;;8104:19:52;;8085:16;8104:19;;;;;;;;;;;;8048:25;;-1:-1:-1;8143:26:52;;;;8135:108;;;;-1:-1:-1;;;8135:108:52;;9628:2:85;8135:108:52;;;9610:21:85;9667:2;9647:18;;;9640:30;9706:34;9686:18;;;9679:62;9777:25;9757:18;;;9750:53;9820:19;;8135:108:52;9426:419:85;8135:108:52;8355:4;8317:26;;;;:43;8309:102;;;;-1:-1:-1;;;8309:102:52;;10052:2:85;8309:102:52;;;10034:21:85;10091:2;10071:18;;;10064:30;10130:34;10110:18;;;10103:62;-1:-1:-1;;;10181:18:85;;;10174:44;10235:19;;8309:102:52;9850:410:85;8309:102:52;8584:1;8561:24;;;8543:43;;;;-1:-1:-1;;;;;;;8603:24:52;;;;;;;8599:204;;-1:-1:-1;;;;;;8766:23:52;;:9;:23;;;;;;;;;;;;-1:-1:-1;;;;;;8724:66:52;-1:-1:-1;;;;;8725:29:52;;8724:66;8698:92;;8599:204;-1:-1:-1;;;;;;8821:19:52;;;;:9;:19;;;;;;;;;;8814:26;9053:1;9033:21;;;;;;-1:-1:-1;9214:1:52;9188:27;;;;-1:-1:-1;9239:42:52;;;9235:809;;9295:23;9321:39;;;:16;;;:39;;;;;;;-1:-1:-1;;;;;;9513:48:52;;;9511:51;9493:69;;;9579:21;;;:50;;9492:138;9693:57;;9235:809;;;10007:25;9990:12;-1:-1:-1;;;;;9982:21:52;;:50;;9939:25;-1:-1:-1;;;;;;2375:35:52;;9916:48;;9914:51;9898:13;:67;9897:136;9869:164;;9235:809;10057:19;10080:1;10057:24;10053:124;;10102:35;;;;:16;;;:35;;;;;10095:42;;;10102:35;-1:-1:-1;10053:124:52;7578:2607;;;7561:15;;;;;:::i;:::-;;;;7498:2687;;;-1:-1:-1;10233:19:52;10209:21;:17;10229:1;10209:21;:::i;:::-;:43;;;;:::i;:::-;10192:60;;7022:3237;;6972:3357;;;10273:49;;-1:-1:-1;;;10273:49:52;;10773:2:85;10273:49:52;;;10755:21:85;10812:2;10792:18;;;10785:30;10851:34;10831:18;;;10824:62;-1:-1:-1;;;10902:18:85;;;10895:37;10949:19;;10273:49:52;10571:403:85;6972:3357:52;-1:-1:-1;10342:14:52;;10358:13;;-1:-1:-1;;;;;4279:6098:52:o;10381:753::-;-1:-1:-1;;;;;10469:19:52;;10465:665;;10506:16;;:21;10498:94;;;;-1:-1:-1;;;10498:94:52;;11181:2:85;10498:94:52;;;11163:21:85;11220:2;11200:18;;;11193:30;11259:34;11239:18;;;11232:62;11330:30;11310:18;;;11303:58;11378:19;;10498:94:52;10979:424:85;10498:94:52;10381:753;;:::o;10465:665::-;10640:1;10621:9;:16;:20;10613:94;;;;-1:-1:-1;;;10613:94:52;;11610:2:85;10613:94:52;;;11592:21:85;11649:2;11629:18;;;11622:30;11688:34;11668:18;;;11661:62;11759:31;11739:18;;;11732:59;11808:19;;10613:94:52;11408:425:85;10613:94:52;-1:-1:-1;;;;;10719:22:52;;10736:4;10719:22;10715:120;;10753:73;10776:5;10753:73;;;;;;;;;;;;;;;;;:22;:73::i;:::-;10843:12;10857:18;10879:5;-1:-1:-1;;;;;10879:18:52;10898:9;10879:29;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10842:66;;;;10921:7;10916:208;;10944:12;;:16;10940:176;;11021:5;11007:21;;-1:-1:-1;;;11007:21:52;;;;;;;;:::i;10940:176::-;11057:48;;-1:-1:-1;;;11057:48:52;;12543:2:85;11057:48:52;;;12525:21:85;12582:2;12562:18;;;12555:30;12621:34;12601:18;;;12594:62;-1:-1:-1;;;12672:18:85;;;12665:36;12718:19;;11057:48:52;12341:402:85;10940:176:52;10605:525;;10381:753;;:::o;11138:237::-;11297:22;;11356:13;11338:16;11330:40;;;;-1:-1:-1;;;11330:40:52;;;;;;;;:::i;14:177:85:-;93:13;;-1:-1:-1;;;;;135:31:85;;125:42;;115:70;;181:1;178;171:12;115:70;14:177;;;:::o;196:127::-;257:10;252:3;248:20;245:1;238:31;288:4;285:1;278:15;312:4;309:1;302:15;328:253;400:2;394:9;442:4;430:17;;-1:-1:-1;;;;;462:34:85;;498:22;;;459:62;456:88;;;524:18;;:::i;:::-;560:2;553:22;328:253;:::o;586:275::-;657:2;651:9;722:2;703:13;;-1:-1:-1;;699:27:85;687:40;;-1:-1:-1;;;;;742:34:85;;778:22;;;739:62;736:88;;;804:18;;:::i;:::-;840:2;833:22;586:275;;-1:-1:-1;586:275:85:o;866:191::-;934:4;-1:-1:-1;;;;;956:30:85;;953:56;;;989:18;;:::i;:::-;-1:-1:-1;1034:1:85;1030:14;1046:4;1026:25;;866:191::o;1062:2428::-;1193:6;1201;1254:2;1242:9;1233:7;1229:23;1225:32;1222:52;;;1270:1;1267;1260:12;1222:52;1293:40;1323:9;1293:40;:::i;:::-;1352:2;1383:18;;;1377:25;1283:50;;-1:-1:-1;1352:2:85;-1:-1:-1;;;;;1451:14:85;;;1448:34;;;1478:1;1475;1468:12;1448:34;1516:6;1505:9;1501:22;1491:32;;1561:7;1554:4;1550:2;1546:13;1542:27;1532:55;;1583:1;1580;1573:12;1532:55;1612:2;1606:9;1635:68;1651:51;1699:2;1651:51;:::i;:::-;1635:68;:::i;:::-;1737:15;;;1819:1;1815:10;;;;1807:19;;1803:28;;;1768:12;;;;1843:19;;;1840:39;;;1875:1;1872;1865:12;1840:39;1907:2;1903;1899:11;1919:1541;1935:6;1930:3;1927:15;1919:1541;;;2014:3;2008:10;2050:2;2037:11;2034:19;2031:39;;;2066:1;2063;2056:12;2031:39;2093:20;;2165:4;2137:16;;;-1:-1:-1;;2133:30:85;2129:41;2126:61;;;2183:1;2180;2173:12;2126:61;2213:22;;:::i;:::-;2262:42;2300:2;2296;2292:11;2262:42;:::i;:::-;2255:5;2248:57;2347:2;2343;2339:11;2333:18;2386:1;2377:7;2374:14;2364:42;;2402:1;2399;2392:12;2364:42;2426:14;;;2419:31;2493:4;2485:13;;2479:20;2515:16;;;2512:36;;;2544:1;2541;2534:12;2512:36;2579:8;2575:2;2571:17;2561:27;;;2628:7;2623:2;2619;2615:11;2611:25;2601:53;;2650:1;2647;2640:12;2601:53;2691:2;2687;2683:11;2677:18;2721:68;2737:51;2785:2;2737:51;:::i;2721:68::-;2833:17;;;2931:1;2927:10;;;;2919:19;;2940:2;2915:28;;2872:14;;;;2959:21;;;2956:41;;;2993:1;2990;2983:12;2956:41;3031:2;3027;3023:11;3010:24;;3047:298;3065:8;3058:5;3055:19;3047:298;;;3148:12;;-1:-1:-1;;;;;;3199:34:85;;3187:47;;3177:75;;3248:1;3245;3238:12;3177:75;3269:22;;3086:14;;;;3317;;;;3047:298;;;3376:2;3365:14;;3358:29;-1:-1:-1;;3400:18:85;;-1:-1:-1;3438:12:85;;;;1952;;1919:1541;;;1923:3;3479:5;3469:15;;;;;;;;1062:2428;;;;;:::o;3495:127::-;3556:10;3551:3;3547:20;3544:1;3537:31;3587:4;3584:1;3577:15;3611:4;3608:1;3601:15;3627:127;3688:10;3683:3;3679:20;3676:1;3669:31;3719:4;3716:1;3709:15;3743:4;3740:1;3733:15;3759:135;3798:3;3819:17;;;3816:43;;3839:18;;:::i;:::-;-1:-1:-1;3886:1:85;3875:13;;3759:135::o;4008:127::-;4069:10;4064:3;4060:20;4057:1;4050:31;4100:4;4097:1;4090:15;4124:4;4121:1;4114:15;4140:258;4212:1;4222:113;4236:6;4233:1;4230:13;4222:113;;;4312:11;;;4306:18;4293:11;;;4286:39;4258:2;4251:10;4222:113;;;4353:6;4350:1;4347:13;4344:48;;;-1:-1:-1;;4388:1:85;4370:16;;4363:27;4140:258::o;4403:257::-;4444:3;4482:5;4476:12;4509:6;4504:3;4497:19;4525:63;4581:6;4574:4;4569:3;4565:14;4558:4;4551:5;4547:16;4525:63;:::i;:::-;4642:2;4621:15;-1:-1:-1;;4617:29:85;4608:39;;;;4649:4;4604:50;;4403:257;-1:-1:-1;;4403:257:85:o;4665:2092::-;4935:4;4964:2;5004;4993:9;4989:18;5034:2;5023:9;5016:21;5057:6;5092;5086:13;5123:6;5115;5108:22;5149:3;5139:13;;5183:2;5172:9;5168:18;5161:25;;5245:2;5235:6;5232:1;5228:14;5217:9;5213:30;5209:39;5267:4;5306:2;5298:6;5294:15;5327:1;5337:1249;5351:6;5348:1;5345:13;5337:1249;;;5416:22;;;-1:-1:-1;;5412:37:85;5400:50;;5473:13;;5560:9;;-1:-1:-1;;;;;5556:35:85;5541:51;;5631:11;;;5625:18;5513:15;;;;5683:1;5666:19;;5656:170;;5736:10;5731:3;5727:20;5724:1;5717:31;5775:4;5772:1;5765:15;5807:4;5804:1;5797:15;5656:170;5846:15;;;5839:37;5899:4;5944:11;;;5938:18;5976:15;;;5969:27;;;6057:21;;6091:24;;;;6181:23;;;;-1:-1:-1;;6137:15:85;;;;6242:236;6258:8;6253:3;6250:17;6242:236;;;6339:15;;-1:-1:-1;;;;;;6335:42:85;6321:57;;6447:17;;;;6286:1;6277:11;;;;;6404:14;;;;6242:236;;;-1:-1:-1;6564:12:85;;;;6501:5;-1:-1:-1;;;6529:15:85;;;;5373:1;5366:9;5337:1249;;;-1:-1:-1;;;;;;;3965:31:85;;6622:18;;;3953:44;6679:22;;;6672:4;6657:20;;6650:52;6719:32;6683:6;6736;6719:32;:::i;:::-;6711:40;4665:2092;-1:-1:-1;;;;;;;;;;4665:2092:85:o;9285:136::-;9324:3;9352:5;9342:39;;9361:18;;:::i;:::-;-1:-1:-1;;;9397:18:85;;9285:136::o;10265:168::-;10305:7;10371:1;10367;10363:6;10359:14;10356:1;10353:21;10348:1;10341:9;10334:17;10330:45;10327:71;;;10378:18;;:::i;:::-;-1:-1:-1;10418:9:85;;10265:168::o;10438:128::-;10478:3;10509:1;10505:6;10502:1;10499:13;10496:39;;;10515:18;;:::i;:::-;-1:-1:-1;10551:9:85;;10438:128::o;11838:274::-;11967:3;12005:6;11999:13;12021:53;12067:6;12062:3;12055:4;12047:6;12043:17;12021:53;:::i;:::-;12090:16;;;;;11838:274;-1:-1:-1;;11838:274:85:o;12117:219::-;12266:2;12255:9;12248:21;12229:4;12286:44;12326:2;12315:9;12311:18;12303:6;12286:44;:::i;:::-;12278:52;12117:219;-1:-1:-1;;;12117:219:85:o;12341:402::-;765:1837:45;;;;;;", + "linkReferences": {} + }, + "deployedBytecode": { + "object": "0x60806040523661000b57005b600080357fffffffff000000000000000000000000000000000000000000000000000000001681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c806100d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f7420657869737460448201526064015b60405180910390fd5b3660008037600080366000845af43d6000803e8080156100ef573d6000f35b3d6000fd5b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9061ffff8116908190600090600716156101635750600381901c60009081526002840160205260409020545b60005b87518110156101ea576101d383838a848151811061018657610186611166565b6020026020010151600001518b85815181106101a4576101a4611166565b6020026020010151602001518c86815181106101c2576101c2611166565b602002602001015160400151610371565b9093509150806101e2816111c4565b915050610166565b50828214610223576003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff84161790555b600782161561024557600382901c600090815260028501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673878787604051610278939291906112a1565b60405180910390a161028a8686610e72565b50505050505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132180547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff8481169182179093556040517fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b600080807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90506000845111610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201527f6163657420746f2063757400000000000000000000000000000000000000000060648201526084016100c7565b600085600281111561043d5761043d6111fc565b0361066857610464866040518060600160405280602481526020016114ca6024913961112b565b60018181018054918201815560009081526020812090910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff89161790555b84518110156106625760008582815181106104d8576104d8611166565b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815291859052604090912054909150606081901c156105ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016100c7565b7fffffffff0000000000000000000000000000000000000000000000000000000080831660008181526020879052604090207fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060608d901b168e17905560e060058e901b811692831c199c909c1690821c179a81900361063f5760038c901c600090815260028601602052604081209b909b555b8b610649816111c4565b9c5050505050808061065a906111c4565b9150506104bb565b50610e66565b600185600281111561067c5761067c6111fc565b03610976576106a3866040518060600160405280602881526020016115166028913961112b565b60005b84518110156106625760008582815181106106c3576106c3611166565b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815291859052604090912054909150606081901c308103610798576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201527f757461626c652066756e6374696f6e000000000000000000000000000000000060648201526084016100c7565b8973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016100c7565b73ffffffffffffffffffffffffffffffffffffffff81166108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016100c7565b507fffffffff0000000000000000000000000000000000000000000000000000000090911660009081526020849052604090206bffffffffffffffffffffffff919091167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060608a901b161790558061096e816111c4565b9150506106a6565b600285600281111561098a5761098a6111fc565b03610dde5773ffffffffffffffffffffffffffffffffffffffff861615610a33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016100c7565b600388901c6007891660005b8651811015610dbe5760008a9003610a7b5782610a5b81611409565b60008181526002870160205260409020549b50935060079250610a899050565b81610a8581611409565b9250505b6000806000808a8581518110610aa157610aa1611166565b6020908102919091018101517fffffffff0000000000000000000000000000000000000000000000000000000081166000908152918a9052604090912054909150606081901c610b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016100c7565b30606082901c03610c06576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201527f7461626c652066756e6374696f6e00000000000000000000000000000000000060648201526084016100c7565b600587901b8f901b94507fffffffff0000000000000000000000000000000000000000000000000000000080861690831614610ca4577fffffffff000000000000000000000000000000000000000000000000000000008516600090815260208a90526040902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff83161790555b7fffffffff0000000000000000000000000000000000000000000000000000000091909116600090815260208990526040812055600381901c611fff16925060051b60e0169050858214610d39576000828152600288016020526040902080547fffffffff0000000000000000000000000000000000000000000000000000000080841c19909116908516831c179055610d8a565b80837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c817fffffffff0000000000000000000000000000000000000000000000000000000060001b901c198e16179c505b84600003610da857600086815260028801602052604081208190559c505b5050508080610db6906111c4565b915050610a3f565b5080610dcb83600861143e565b610dd5919061147b565b99505050610e66565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560448201527f74416374696f6e0000000000000000000000000000000000000000000000000060648201526084016100c7565b50959694955050505050565b73ffffffffffffffffffffffffffffffffffffffff8216610f2057805115610f1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603c60248201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860448201527f3029206275745f63616c6c64617461206973206e6f7420656d7074790000000060648201526084016100c7565b5050565b6000815111610fb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460448201527f7920627574205f696e6974206973206e6f74206164647265737328302900000060648201526084016100c7565b73ffffffffffffffffffffffffffffffffffffffff82163014610ff057610ff0826040518060600160405280602881526020016114ee6028913961112b565b6000808373ffffffffffffffffffffffffffffffffffffffff16836040516110189190611493565b600060405180830381855af49150503d8060008114611053576040519150601f19603f3d011682016040523d82523d6000602084013e611058565b606091505b5091509150816111255780511561109d57806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c791906114af565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e20726560448201527f766572746564000000000000000000000000000000000000000000000000000060648201526084016100c7565b50505050565b813b8181611125576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c791906114af565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036111f5576111f5611195565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60005b8381101561124657818101518382015260200161122e565b838111156111255750506000910152565b6000815180845261126f81602086016020860161122b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b848110156113cc577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808a8503018652815188850173ffffffffffffffffffffffffffffffffffffffff82511686528482015160038110611353577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b808310156113b75783517fffffffff00000000000000000000000000000000000000000000000000000000168252928601926001929092019190860190611375565b509785019795505050908201906001016112ca565b505073ffffffffffffffffffffffffffffffffffffffff8a169088015286810360408801526113fb8189611257565b9a9950505050505050505050565b60008161141857611418611195565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561147657611476611195565b500290565b6000821982111561148e5761148e611195565b500190565b600082516114a581846020870161122b565b9190910192915050565b6020815260006114c26020830184611257565b939250505056fe4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465a164736f6c634300080d000a", + "sourceMap": "765:1837:45:-:0;;;;;;;;1644:25;1891:7;;;;1881:18;;1304:45:52;1881:18:45;;;;;;;;;1304:45:52;;1865:36:45;;;1907:64;;;;;;;216:2:85;1907:64:45;;;198:21:85;;;235:18;;;228:30;294:34;274:18;;;267:62;346:18;;1907:64:45;;;;;;;;;2148:14;2145:1;2142;2129:34;2280:1;2277;2261:14;2258:1;2251:5;2244;2231:51;2340:16;2337:1;2334;2319:38;2432:6;2445:52;;;;2532:16;2529:1;2522:27;2445:52;2472:16;2469:1;2462:27;2745:1530:52;2960:16;;1304:45;;2960:16;;;;;;2878:25;;3208:1;3192:17;:21;3188:205;;-1:-1:-1;3384:1:52;3367:18;;;3350:36;;;;:16;;;:36;;;;;;3188:205;3435:18;3430:339;3468:11;:18;3455:10;:31;3430:339;;;3542:220;3582:13;3605:12;3627:11;3639:10;3627:23;;;;;;;;:::i;:::-;;;;;;;:36;;;3673:11;3685:10;3673:23;;;;;;;;:::i;:::-;;;;;;;:30;;;3713:11;3725:10;3713:23;;;;;;;;:::i;:::-;;;;;;;:41;;;3542:30;:220::i;:::-;3510:252;;-1:-1:-1;3510:252:52;-1:-1:-1;3488:12:52;;;;:::i;:::-;;;;3430:339;;;;3795:21;3778:13;:38;3774:99;;3826:16;;;:40;;;;;;;;;;3774:99;4021:1;4005:17;;:21;4001:174;;4151:1;4134:18;;;4117:36;;;;:16;;;:36;;;;;:51;;;4001:174;4185:41;4196:11;4209:5;4216:9;4185:41;;;;;;;;:::i;:::-;;;;;;;;4232:38;4253:5;4260:9;4232:20;:38::i;:::-;2872:1403;;;;2745:1530;;;:::o;1623:246::-;1757:16;;;1779:28;;;1757:16;1779:28;;;;;;;;;1818:46;;1304:45;;1757:16;;;;;;1818:46;;1683:25;;1818:46;1677:192;;1623:246;:::o;1354:177::-;1304:45;;1354:177::o;4279:6098::-;4498:7;;;1304:45;4522:44;;4600:1;4580:10;:17;:21;4572:77;;;;;;;4341:2:85;4572:77:52;;;4323:21:85;4380:2;4360:18;;;4353:30;4419:34;4399:18;;;4392:62;4490:13;4470:18;;;4463:41;4521:19;;4572:77:52;4139:407:85;4572:77:52;4670:30;4659:7;:41;;;;;;;;:::i;:::-;;4655:5674;;4710:80;4733:16;4710:80;;;;;;;;;;;;;;;;;:22;:80::i;:::-;4798:17;;;;:40;;;;;;;-1:-1:-1;4798:40:52;;;;;;;;;;;;;;;;;;;4846:1113;4890:10;:17;4874:13;:33;4846:1113;;;4936:15;4954:10;4965:13;4954:25;;;;;;;;:::i;:::-;;;;;;;;;;;;5008:19;;;4989:16;5008:19;;;;;;;;;;;;4954:25;;-1:-1:-1;5045:26:52;;;;:40;5037:106;;;;;;;4753:2:85;5037:106:52;;;4735:21:85;4792:2;4772:18;;;4765:30;4831:34;4811:18;;;4804:62;4902:23;4882:18;;;4875:51;4943:19;;5037:106:52;4551:417:85;5037:106:52;5187:19;;;;5237:23;5187:19;;;;;;;;;;5209:51;:25;;;;:51;;;5187:73;;5391:25;5415:1;5391:25;;;;;5531:45;;;5529:48;5513:64;;;;5592:43;;;5512:124;;5702:29;;;5698:227;;5867:1;5849:19;;;5832:37;;;;:16;;;:37;;;;;:53;;;;5698:227;5934:16;;;;:::i;:::-;;;;4926:1033;;;4909:15;;;;;:::i;:::-;;;;4846:1113;;;;4655:5674;;;5986:34;5975:7;:45;;;;;;;;:::i;:::-;;5971:4358;;6030:84;6053:16;6030:84;;;;;;;;;;;;;;;;;:22;:84::i;:::-;6209:21;6204:756;6248:10;:17;6232:13;:33;6204:756;;;6294:15;6312:10;6323:13;6312:25;;;;;;;;:::i;:::-;;;;;;;;;;;;6366:19;;;6347:16;6366:19;;;;;;;;;;;;6312:25;;-1:-1:-1;6421:26:52;;;;6544:4;6517:32;;6509:92;;;;;;;5175:2:85;6509:92:52;;;5157:21:85;5214:2;5194:18;;;5187:30;5253:34;5233:18;;;5226:62;5324:17;5304:18;;;5297:45;5359:19;;6509:92:52;4973:411:85;6509:92:52;6638:16;6619:35;;:15;:35;;;6611:104;;;;;;;5591:2:85;6611:104:52;;;5573:21:85;5630:2;5610:18;;;5603:30;5669:34;5649:18;;;5642:62;5740:26;5720:18;;;5713:54;5784:19;;6611:104:52;5389:420:85;6611:104:52;6733:29;;;6725:98;;;;;;;6016:2:85;6725:98:52;;;5998:21:85;6055:2;6035:18;;;6028:30;6094:34;6074:18;;;6067:62;6165:26;6145:18;;;6138:54;6209:19;;6725:98:52;5814:420:85;6725:98:52;-1:-1:-1;6870:19:52;;;;2288:44;6870:19;;;;;;;;;;6892:59;6893:29;;;;6892:59;6926:25;;;;6892:59;;6870:81;;6267:15;;;;:::i;:::-;;;;6204:756;;5971:4358;6987:33;6976:7;:44;;;;;;;;:::i;:::-;;6972:3357;;7119:30;;;;7111:97;;;;;;;6441:2:85;7111:97:52;;;6423:21:85;6480:2;6460:18;;;6453:30;6519:34;6499:18;;;6492:62;6590:24;6570:18;;;6563:52;6632:19;;7111:97:52;6239:418:85;7111:97:52;7347:1;7329:19;;;7489:1;7472:18;;7301:25;7498:2687;7542:10;:17;7526:13;:33;7498:2687;;;7609:1;7592:18;;;7588:249;;7659:19;;;;:::i;:::-;7706:35;;;;:16;;;:35;;;;;;;-1:-1:-1;7659:19:52;-1:-1:-1;7775:1:52;;-1:-1:-1;7588:249:52;;-1:-1:-1;7588:249:52;;7805:21;;;;:::i;:::-;;;;7588:249;7846:19;7875:29;7914:33;8030:15;8048:10;8059:13;8048:25;;;;;;;;:::i;:::-;;;;;;;;;;;;8104:19;;;8085:16;8104:19;;;;;;;;;;;;8048:25;;-1:-1:-1;8143:26:52;;;;8135:108;;;;;;;7065:2:85;8135:108:52;;;7047:21:85;7104:2;7084:18;;;7077:30;7143:34;7123:18;;;7116:62;7214:25;7194:18;;;7187:53;7257:19;;8135:108:52;6863:419:85;8135:108:52;8355:4;8317:26;;;;:43;8309:102;;;;;;;7489:2:85;8309:102:52;;;7471:21:85;7528:2;7508:18;;;7501:30;7567:34;7547:18;;;7540:62;7638:16;7618:18;;;7611:44;7672:19;;8309:102:52;7287:410:85;8309:102:52;8584:1;8561:24;;;8543:43;;;;-1:-1:-1;8603:24:52;;;;;;;;8599:204;;8766:23;;;:9;:23;;;;;;;;;;;;8724:66;;;8725:29;;8724:66;8698:92;;8599:204;8821:19;;;;;:9;:19;;;;;;;;;;8814:26;9053:1;9033:21;;;;;;-1:-1:-1;9214:1:52;9188:27;;;;-1:-1:-1;9239:42:52;;;9235:809;;9295:23;9321:39;;;:16;;;:39;;;;;;;9579:21;9513:48;;;9511:51;9493:69;;;9579:21;;;:50;;9492:138;9693:57;;9235:809;;;10007:25;9990:12;9982:21;;;:50;;9939:25;2391:17;2375:35;;9916:48;;9914:51;9898:13;:67;9897:136;9869:164;;9235:809;10057:19;10080:1;10057:24;10053:124;;10102:35;;;;:16;;;:35;;;;;10095:42;;;10102:35;-1:-1:-1;10053:124:52;7578:2607;;;7561:15;;;;;:::i;:::-;;;;7498:2687;;;-1:-1:-1;10233:19:52;10209:21;:17;10229:1;10209:21;:::i;:::-;:43;;;;:::i;:::-;10192:60;;7022:3237;;6972:3357;;;10273:49;;;;;8270:2:85;10273:49:52;;;8252:21:85;8309:2;8289:18;;;8282:30;8348:34;8328:18;;;8321:62;8419:9;8399:18;;;8392:37;8446:19;;10273:49:52;8068:403:85;6972:3357:52;-1:-1:-1;10342:14:52;;10358:13;;-1:-1:-1;;;;;4279:6098:52:o;10381:753::-;10469:19;;;10465:665;;10506:16;;:21;10498:94;;;;;;;8678:2:85;10498:94:52;;;8660:21:85;8717:2;8697:18;;;8690:30;8756:34;8736:18;;;8729:62;8827:30;8807:18;;;8800:58;8875:19;;10498:94:52;8476:424:85;10498:94:52;10381:753;;:::o;10465:665::-;10640:1;10621:9;:16;:20;10613:94;;;;;;;9107:2:85;10613:94:52;;;9089:21:85;9146:2;9126:18;;;9119:30;9185:34;9165:18;;;9158:62;9256:31;9236:18;;;9229:59;9305:19;;10613:94:52;8905:425:85;10613:94:52;10719:22;;;10736:4;10719:22;10715:120;;10753:73;10776:5;10753:73;;;;;;;;;;;;;;;;;:22;:73::i;:::-;10843:12;10857:18;10879:5;:18;;10898:9;10879:29;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10842:66;;;;10921:7;10916:208;;10944:12;;:16;10940:176;;11021:5;11007:21;;;;;;;;;;;:::i;10940:176::-;11057:48;;;;;10040:2:85;11057:48:52;;;10022:21:85;10079:2;10059:18;;;10052:30;10118:34;10098:18;;;10091:62;10189:8;10169:18;;;10162:36;10215:19;;11057:48:52;9838:402:85;10940:176:52;10605:525;;10381:753;;:::o;11138:237::-;11297:22;;11356:13;11338:16;11330:40;;;;;;;;;;;;;:::i;375:184:85:-;427:77;424:1;417:88;524:4;521:1;514:15;548:4;545:1;538:15;564:184;616:77;613:1;606:88;713:4;710:1;703:15;737:4;734:1;727:15;753:195;792:3;823:66;816:5;813:77;810:103;;893:18;;:::i;:::-;-1:-1:-1;940:1:85;929:13;;753:195::o;1085:184::-;1137:77;1134:1;1127:88;1234:4;1231:1;1224:15;1258:4;1255:1;1248:15;1274:258;1346:1;1356:113;1370:6;1367:1;1364:13;1356:113;;;1446:11;;;1440:18;1427:11;;;1420:39;1392:2;1385:10;1356:113;;;1487:6;1484:1;1481:13;1478:48;;;-1:-1:-1;;1522:1:85;1504:16;;1497:27;1274:258::o;1537:316::-;1578:3;1616:5;1610:12;1643:6;1638:3;1631:19;1659:63;1715:6;1708:4;1703:3;1699:14;1692:4;1685:5;1681:16;1659:63;:::i;:::-;1767:2;1755:15;1772:66;1751:88;1742:98;;;;1842:4;1738:109;;1537:316;-1:-1:-1;;1537:316:85:o;1858:2276::-;2128:4;2157:2;2197;2186:9;2182:18;2227:2;2216:9;2209:21;2250:6;2285;2279:13;2316:6;2308;2301:22;2342:3;2332:13;;2376:2;2365:9;2361:18;2354:25;;2438:2;2428:6;2425:1;2421:14;2410:9;2406:30;2402:39;2460:4;2499:2;2491:6;2487:15;2520:1;2530:1433;2544:6;2541:1;2538:13;2530:1433;;;2633:66;2621:9;2613:6;2609:22;2605:95;2600:3;2593:108;2730:6;2724:13;2776:2;2768:6;2764:15;2822:42;2817:2;2811:9;2807:58;2799:6;2792:74;2913:2;2909;2905:11;2899:18;2957:1;2943:12;2940:19;2930:227;;3001:77;2998:1;2991:88;3106:4;3103:1;3096:15;3138:4;3135:1;3128:15;2930:227;3177:15;;;3170:37;3230:4;3275:11;;;3269:18;3307:15;;;3300:27;;;3388:21;;3422:24;;;;3512:23;;;;-1:-1:-1;;3468:15:85;;;;3573:282;3589:8;3584:3;3581:17;3573:282;;;3670:15;;3687:66;3666:88;3652:103;;3824:17;;;;3617:1;3608:11;;;;;3781:14;;;;3573:282;;;-1:-1:-1;3941:12:85;;;;3878:5;-1:-1:-1;;;3906:15:85;;;;2566:1;2559:9;2530:1433;;;-1:-1:-1;;1030:42:85;1019:54;;3999:18;;;1007:67;4056:22;;;4049:4;4034:20;;4027:52;4096:32;4060:6;4113;4096:32;:::i;:::-;4088:40;1858:2276;-1:-1:-1;;;;;;;;;;1858:2276:85:o;6662:196::-;6701:3;6729:5;6719:39;;6738:18;;:::i;:::-;-1:-1:-1;6785:66:85;6774:78;;6662:196::o;7702:228::-;7742:7;7868:1;7800:66;7796:74;7793:1;7790:81;7785:1;7778:9;7771:17;7767:105;7764:131;;;7875:18;;:::i;:::-;-1:-1:-1;7915:9:85;;7702:228::o;7935:128::-;7975:3;8006:1;8002:6;7999:1;7996:13;7993:39;;;8012:18;;:::i;:::-;-1:-1:-1;8048:9:85;;7935:128::o;9335:274::-;9464:3;9502:6;9496:13;9518:53;9564:6;9559:3;9552:4;9544:6;9540:17;9518:53;:::i;:::-;9587:16;;;;;9335:274;-1:-1:-1;;9335:274:85:o;9614:219::-;9763:2;9752:9;9745:21;9726:4;9783:44;9823:2;9812:9;9808:18;9800:6;9783:44;:::i;:::-;9775:52;9614:219;-1:-1:-1;;;9614:219:85:o", + "linkReferences": {} + }, + "ast": { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/diamond/Diamond.sol", + "exportedSymbols": { + "Diamond": [ + 24321 + ], + "DiamondStorage": [ + 25176 + ], + "IDiamondCut": [ + 25086 + ], + "IDiamondLoupe": [ + 25127 + ], + "IERC165": [ + 22353 + ], + "IERC173": [ + 25150 + ], + "LibDiamond": [ + 26029 + ] + }, + "id": 24322, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 24176, + "literals": [ + "solidity", + "^", + "0.8", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "32:23:45" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/../../../node_modules/openzeppelin-solidity/contracts/interfaces/IERC165.sol", + "file": "@openzeppelin/contracts/interfaces/IERC165.sol", + "id": 24178, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 24322, + "sourceUnit": 22116, + "src": "441:73:45", + "symbolAliases": [ + { + "foreign": { + "id": 24177, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 22353, + "src": "450:7:45", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/diamond/libraries/LibDiamond.sol", + "file": "./libraries/LibDiamond.sol", + "id": 24181, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 24322, + "sourceUnit": 26030, + "src": "515:72:45", + "symbolAliases": [ + { + "foreign": { + "id": 24179, + "name": "LibDiamond", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26029, + "src": "524:10:45", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + }, + { + "foreign": { + "id": 24180, + "name": "DiamondStorage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25176, + "src": "536:14:45", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/diamond/interfaces/IDiamondCut.sol", + "file": "./interfaces/IDiamondCut.sol", + "id": 24183, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 24322, + "sourceUnit": 25087, + "src": "588:59:45", + "symbolAliases": [ + { + "foreign": { + "id": 24182, + "name": "IDiamondCut", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25086, + "src": "597:11:45", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/diamond/interfaces/IDiamondLoupe.sol", + "file": "./interfaces/IDiamondLoupe.sol", + "id": 24185, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 24322, + "sourceUnit": 25128, + "src": "648:63:45", + "symbolAliases": [ + { + "foreign": { + "id": 24184, + "name": "IDiamondLoupe", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25127, + "src": "657:13:45", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/diamond/interfaces/IERC173.sol", + "file": "./interfaces/IERC173.sol", + "id": 24187, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 24322, + "sourceUnit": 25151, + "src": "712:51:45", + "symbolAliases": [ + { + "foreign": { + "id": 24186, + "name": "IERC173", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25150, + "src": "721:7:45", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "Diamond", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 24321, + "linearizedBaseContracts": [ + 24321 + ], + "name": "Diamond", + "nameLocation": "774:7:45", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 24276, + "nodeType": "Block", + "src": "872:618:45", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 24199, + "name": "_diamondCut", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24193, + "src": "900:11:45", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_FacetCut_$25063_memory_ptr_$dyn_memory_ptr", + "typeString": "struct IDiamondCut.FacetCut memory[] memory" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 24202, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "921:1:45", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 24201, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "913:7:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 24200, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "913:7:45", + "typeDescriptions": {} + } + }, + "id": 24203, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "913:10:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 24206, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "935:1:45", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 24205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "925:9:45", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 24204, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "929:5:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 24207, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "925:12:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_struct$_FacetCut_$25063_memory_ptr_$dyn_memory_ptr", + "typeString": "struct IDiamondCut.FacetCut memory[] memory" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 24196, + "name": "LibDiamond", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26029, + "src": "878:10:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_LibDiamond_$26029_$", + "typeString": "type(library LibDiamond)" + } + }, + "id": 24198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "diamondCut", + "nodeType": "MemberAccess", + "referencedDeclaration": 25404, + "src": "878:21:45", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_array$_t_struct$_FacetCut_$25063_memory_ptr_$dyn_memory_ptr_$_t_address_$_t_bytes_memory_ptr_$returns$__$", + "typeString": "function (struct IDiamondCut.FacetCut memory[] memory,address,bytes memory)" + } + }, + "id": 24208, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "878:60:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 24209, + "nodeType": "ExpressionStatement", + "src": "878:60:45" + }, + { + "expression": { + "arguments": [ + { + "id": 24213, + "name": "_diamondOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24189, + "src": "972:13:45", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "id": 24210, + "name": "LibDiamond", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26029, + "src": "944:10:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_LibDiamond_$26029_$", + "typeString": "type(library LibDiamond)" + } + }, + "id": 24212, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setContractOwner", + "nodeType": "MemberAccess", + "referencedDeclaration": 25227, + "src": "944:27:45", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 24214, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "944:42:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 24215, + "nodeType": "ExpressionStatement", + "src": "944:42:45" + }, + { + "assignments": [ + 24218 + ], + "declarations": [ + { + "constant": false, + "id": 24218, + "mutability": "mutable", + "name": "ds", + "nameLocation": "1016:2:45", + "nodeType": "VariableDeclaration", + "scope": 24276, + "src": "993:25:45", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage" + }, + "typeName": { + "id": 24217, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 24216, + "name": "DiamondStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 25176, + "src": "993:14:45" + }, + "referencedDeclaration": 25176, + "src": "993:14:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage" + } + }, + "visibility": "internal" + } + ], + "id": 24222, + "initialValue": { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 24219, + "name": "LibDiamond", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26029, + "src": "1021:10:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_LibDiamond_$26029_$", + "typeString": "type(library LibDiamond)" + } + }, + "id": 24220, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "diamondStorage", + "nodeType": "MemberAccess", + "referencedDeclaration": 25193, + "src": "1021:25:45", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_struct$_DiamondStorage_$25176_storage_ptr_$", + "typeString": "function () pure returns (struct DiamondStorage storage pointer)" + } + }, + "id": 24221, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1021:27:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage storage pointer" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "993:55:45" + }, + { + "expression": { + "id": 24232, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "expression": { + "id": 24223, + "name": "ds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24218, + "src": "1166:2:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage storage pointer" + } + }, + "id": 24229, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "supportedInterfaces", + "nodeType": "MemberAccess", + "referencedDeclaration": 25171, + "src": "1166:22:45", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes4_$_t_bool_$", + "typeString": "mapping(bytes4 => bool)" + } + }, + "id": 24230, + "indexExpression": { + "expression": { + "arguments": [ + { + "id": 24226, + "name": "IERC165", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 22353, + "src": "1194:7:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC165_$22353_$", + "typeString": "type(contract IERC165)" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_contract$_IERC165_$22353_$", + "typeString": "type(contract IERC165)" + } + ], + "id": 24225, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1189:4:45", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 24227, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1189:13:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_contract$_IERC165_$22353", + "typeString": "type(contract IERC165)" + } + }, + "id": 24228, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "interfaceId", + "nodeType": "MemberAccess", + "src": "1189:25:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1166:49:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 24231, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1218:4:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "1166:56:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 24233, + "nodeType": "ExpressionStatement", + "src": "1166:56:45" + }, + { + "expression": { + "id": 24243, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "expression": { + "id": 24234, + "name": "ds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24218, + "src": "1228:2:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage storage pointer" + } + }, + "id": 24240, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "supportedInterfaces", + "nodeType": "MemberAccess", + "referencedDeclaration": 25171, + "src": "1228:22:45", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes4_$_t_bool_$", + "typeString": "mapping(bytes4 => bool)" + } + }, + "id": 24241, + "indexExpression": { + "expression": { + "arguments": [ + { + "id": 24237, + "name": "IDiamondCut", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25086, + "src": "1256:11:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IDiamondCut_$25086_$", + "typeString": "type(contract IDiamondCut)" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_contract$_IDiamondCut_$25086_$", + "typeString": "type(contract IDiamondCut)" + } + ], + "id": 24236, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1251:4:45", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 24238, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1251:17:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_contract$_IDiamondCut_$25086", + "typeString": "type(contract IDiamondCut)" + } + }, + "id": 24239, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "interfaceId", + "nodeType": "MemberAccess", + "src": "1251:29:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1228:53:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 24242, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1284:4:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "1228:60:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 24244, + "nodeType": "ExpressionStatement", + "src": "1228:60:45" + }, + { + "expression": { + "id": 24254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "expression": { + "id": 24245, + "name": "ds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24218, + "src": "1294:2:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage storage pointer" + } + }, + "id": 24251, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "supportedInterfaces", + "nodeType": "MemberAccess", + "referencedDeclaration": 25171, + "src": "1294:22:45", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes4_$_t_bool_$", + "typeString": "mapping(bytes4 => bool)" + } + }, + "id": 24252, + "indexExpression": { + "expression": { + "arguments": [ + { + "id": 24248, + "name": "IDiamondLoupe", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25127, + "src": "1322:13:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IDiamondLoupe_$25127_$", + "typeString": "type(contract IDiamondLoupe)" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_contract$_IDiamondLoupe_$25127_$", + "typeString": "type(contract IDiamondLoupe)" + } + ], + "id": 24247, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1317:4:45", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 24249, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1317:19:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_contract$_IDiamondLoupe_$25127", + "typeString": "type(contract IDiamondLoupe)" + } + }, + "id": 24250, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "interfaceId", + "nodeType": "MemberAccess", + "src": "1317:31:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1294:55:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 24253, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1352:4:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "1294:62:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 24255, + "nodeType": "ExpressionStatement", + "src": "1294:62:45" + }, + { + "expression": { + "id": 24265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "expression": { + "id": 24256, + "name": "ds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24218, + "src": "1362:2:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage storage pointer" + } + }, + "id": 24262, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "supportedInterfaces", + "nodeType": "MemberAccess", + "referencedDeclaration": 25171, + "src": "1362:22:45", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes4_$_t_bool_$", + "typeString": "mapping(bytes4 => bool)" + } + }, + "id": 24263, + "indexExpression": { + "expression": { + "arguments": [ + { + "id": 24259, + "name": "IERC173", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25150, + "src": "1390:7:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC173_$25150_$", + "typeString": "type(contract IERC173)" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_type$_t_contract$_IERC173_$25150_$", + "typeString": "type(contract IERC173)" + } + ], + "id": 24258, + "name": "type", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -27, + "src": "1385:4:45", + "typeDescriptions": { + "typeIdentifier": "t_function_metatype_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 24260, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1385:13:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_magic_meta_type_t_contract$_IERC173_$25150", + "typeString": "type(contract IERC173)" + } + }, + "id": 24261, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "interfaceId", + "nodeType": "MemberAccess", + "src": "1385:25:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1362:49:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 24264, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1414:4:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "1362:56:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 24266, + "nodeType": "ExpressionStatement", + "src": "1362:56:45" + }, + { + "expression": { + "id": 24274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "id": 24267, + "name": "ds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24218, + "src": "1459:2:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage storage pointer" + } + }, + "id": 24269, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "diamond", + "nodeType": "MemberAccess", + "referencedDeclaration": 25175, + "src": "1459:10:45", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 24272, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -28, + "src": "1480:4:45", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Diamond_$24321", + "typeString": "contract Diamond" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_Diamond_$24321", + "typeString": "contract Diamond" + } + ], + "id": 24271, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1472:7:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 24270, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1472:7:45", + "typeDescriptions": {} + } + }, + "id": 24273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1472:13:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1459:26:45", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 24275, + "nodeType": "ExpressionStatement", + "src": "1459:26:45" + } + ] + }, + "id": 24277, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 24194, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 24189, + "mutability": "mutable", + "name": "_diamondOwner", + "nameLocation": "806:13:45", + "nodeType": "VariableDeclaration", + "scope": 24277, + "src": "798:21:45", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 24188, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "798:7:45", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 24193, + "mutability": "mutable", + "name": "_diamondCut", + "nameLocation": "851:11:45", + "nodeType": "VariableDeclaration", + "scope": 24277, + "src": "821:41:45", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_FacetCut_$25063_memory_ptr_$dyn_memory_ptr", + "typeString": "struct IDiamondCut.FacetCut[]" + }, + "typeName": { + "baseType": { + "id": 24191, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 24190, + "name": "IDiamondCut.FacetCut", + "nodeType": "IdentifierPath", + "referencedDeclaration": 25063, + "src": "821:20:45" + }, + "referencedDeclaration": 25063, + "src": "821:20:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_FacetCut_$25063_storage_ptr", + "typeString": "struct IDiamondCut.FacetCut" + } + }, + "id": 24192, + "nodeType": "ArrayTypeName", + "src": "821:22:45", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_FacetCut_$25063_storage_$dyn_storage_ptr", + "typeString": "struct IDiamondCut.FacetCut[]" + } + }, + "visibility": "internal" + } + ], + "src": "797:66:45" + }, + "returnParameters": { + "id": 24195, + "nodeType": "ParameterList", + "parameters": [], + "src": "872:0:45" + }, + "scope": 24321, + "src": "786:704:45", + "stateMutability": "payable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 24315, + "nodeType": "Block", + "src": "1638:929:45", + "statements": [ + { + "assignments": [ + 24282 + ], + "declarations": [ + { + "constant": false, + "id": 24282, + "mutability": "mutable", + "name": "ds", + "nameLocation": "1667:2:45", + "nodeType": "VariableDeclaration", + "scope": 24315, + "src": "1644:25:45", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage" + }, + "typeName": { + "id": 24281, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 24280, + "name": "DiamondStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 25176, + "src": "1644:14:45" + }, + "referencedDeclaration": 25176, + "src": "1644:14:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage" + } + }, + "visibility": "internal" + } + ], + "id": 24283, + "nodeType": "VariableDeclarationStatement", + "src": "1644:25:45" + }, + { + "assignments": [ + 24285 + ], + "declarations": [ + { + "constant": false, + "id": 24285, + "mutability": "mutable", + "name": "position", + "nameLocation": "1683:8:45", + "nodeType": "VariableDeclaration", + "scope": 24315, + "src": "1675:16:45", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 24284, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1675:7:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 24288, + "initialValue": { + "expression": { + "id": 24286, + "name": "LibDiamond", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26029, + "src": "1694:10:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_LibDiamond_$26029_$", + "typeString": "type(library LibDiamond)" + } + }, + "id": 24287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DIAMOND_STORAGE_POSITION", + "nodeType": "MemberAccess", + "referencedDeclaration": 25181, + "src": "1694:35:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1675:54:45" + }, + { + "AST": { + "nodeType": "YulBlock", + "src": "1771:33:45", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1779:19:45", + "value": { + "name": "position", + "nodeType": "YulIdentifier", + "src": "1790:8:45" + }, + "variableNames": [ + { + "name": "ds.slot", + "nodeType": "YulIdentifier", + "src": "1779:7:45" + } + ] + } + ] + }, + "evmVersion": "london", + "externalReferences": [ + { + "declaration": 24282, + "isOffset": false, + "isSlot": true, + "src": "1779:7:45", + "suffix": "slot", + "valueSize": 1 + }, + { + "declaration": 24285, + "isOffset": false, + "isSlot": false, + "src": "1790:8:45", + "valueSize": 1 + } + ], + "id": 24289, + "nodeType": "InlineAssembly", + "src": "1762:42:45" + }, + { + "assignments": [ + 24291 + ], + "declarations": [ + { + "constant": false, + "id": 24291, + "mutability": "mutable", + "name": "facet", + "nameLocation": "1857:5:45", + "nodeType": "VariableDeclaration", + "scope": 24315, + "src": "1849:13:45", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 24290, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1849:7:45", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 24303, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "baseExpression": { + "expression": { + "id": 24296, + "name": "ds", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24282, + "src": "1881:2:45", + "typeDescriptions": { + "typeIdentifier": "t_struct$_DiamondStorage_$25176_storage_ptr", + "typeString": "struct DiamondStorage storage pointer" + } + }, + "id": 24297, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "facets", + "nodeType": "MemberAccess", + "referencedDeclaration": 25158, + "src": "1881:9:45", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes4_$_t_bytes32_$", + "typeString": "mapping(bytes4 => bytes32)" + } + }, + "id": 24300, + "indexExpression": { + "expression": { + "id": 24298, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "1891:3:45", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 24299, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sig", + "nodeType": "MemberAccess", + "src": "1891:7:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1881:18:45", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 24295, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1873:7:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_bytes20_$", + "typeString": "type(bytes20)" + }, + "typeName": { + "id": 24294, + "name": "bytes20", + "nodeType": "ElementaryTypeName", + "src": "1873:7:45", + "typeDescriptions": {} + } + }, + "id": 24301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1873:27:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes20", + "typeString": "bytes20" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes20", + "typeString": "bytes20" + } + ], + "id": 24293, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1865:7:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 24292, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1865:7:45", + "typeDescriptions": {} + } + }, + "id": 24302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1865:36:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1849:52:45" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 24310, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 24305, + "name": "facet", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24291, + "src": "1915:5:45", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 24308, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1932:1:45", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 24307, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1924:7:45", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 24306, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1924:7:45", + "typeDescriptions": {} + } + }, + "id": 24309, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1924:10:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1915:19:45", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4469616d6f6e643a2046756e6374696f6e20646f6573206e6f74206578697374", + "id": 24311, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1936:34:45", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_6e6486aeb9db70da259b7171a739046119facaec2d8a6bd46f1145fe8391014a", + "typeString": "literal_string \"Diamond: Function does not exist\"" + }, + "value": "Diamond: Function does not exist" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_6e6486aeb9db70da259b7171a739046119facaec2d8a6bd46f1145fe8391014a", + "typeString": "literal_string \"Diamond: Function does not exist\"" + } + ], + "id": 24304, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "1907:7:45", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 24312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1907:64:45", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 24313, + "nodeType": "ExpressionStatement", + "src": "1907:64:45" + }, + { + "AST": { + "nodeType": "YulBlock", + "src": "2071:492:45", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2142:1:45", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2145:1:45", + "type": "", + "value": "0" + }, + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nodeType": "YulIdentifier", + "src": "2148:12:45" + }, + "nodeType": "YulFunctionCall", + "src": "2148:14:45" + } + ], + "functionName": { + "name": "calldatacopy", + "nodeType": "YulIdentifier", + "src": "2129:12:45" + }, + "nodeType": "YulFunctionCall", + "src": "2129:34:45" + }, + "nodeType": "YulExpressionStatement", + "src": "2129:34:45" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "2217:65:45", + "value": { + "arguments": [ + { + "arguments": [], + "functionName": { + "name": "gas", + "nodeType": "YulIdentifier", + "src": "2244:3:45" + }, + "nodeType": "YulFunctionCall", + "src": "2244:5:45" + }, + { + "name": "facet", + "nodeType": "YulIdentifier", + "src": "2251:5:45" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2258:1:45", + "type": "", + "value": "0" + }, + { + "arguments": [], + "functionName": { + "name": "calldatasize", + "nodeType": "YulIdentifier", + "src": "2261:12:45" + }, + "nodeType": "YulFunctionCall", + "src": "2261:14:45" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2277:1:45", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2280:1:45", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "delegatecall", + "nodeType": "YulIdentifier", + "src": "2231:12:45" + }, + "nodeType": "YulFunctionCall", + "src": "2231:51:45" + }, + "variables": [ + { + "name": "result", + "nodeType": "YulTypedName", + "src": "2221:6:45", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2334:1:45", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2337:1:45", + "type": "", + "value": "0" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nodeType": "YulIdentifier", + "src": "2340:14:45" + }, + "nodeType": "YulFunctionCall", + "src": "2340:16:45" + } + ], + "functionName": { + "name": "returndatacopy", + "nodeType": "YulIdentifier", + "src": "2319:14:45" + }, + "nodeType": "YulFunctionCall", + "src": "2319:38:45" + }, + "nodeType": "YulExpressionStatement", + "src": "2319:38:45" + }, + { + "cases": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2452:45:45", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2469:1:45", + "type": "", + "value": "0" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nodeType": "YulIdentifier", + "src": "2472:14:45" + }, + "nodeType": "YulFunctionCall", + "src": "2472:16:45" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2462:6:45" + }, + "nodeType": "YulFunctionCall", + "src": "2462:27:45" + }, + "nodeType": "YulExpressionStatement", + "src": "2462:27:45" + } + ] + }, + "nodeType": "YulCase", + "src": "2445:52:45", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2450:1:45", + "type": "", + "value": "0" + } + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2512:45:45", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2529:1:45", + "type": "", + "value": "0" + }, + { + "arguments": [], + "functionName": { + "name": "returndatasize", + "nodeType": "YulIdentifier", + "src": "2532:14:45" + }, + "nodeType": "YulFunctionCall", + "src": "2532:16:45" + } + ], + "functionName": { + "name": "return", + "nodeType": "YulIdentifier", + "src": "2522:6:45" + }, + "nodeType": "YulFunctionCall", + "src": "2522:27:45" + }, + "nodeType": "YulExpressionStatement", + "src": "2522:27:45" + } + ] + }, + "nodeType": "YulCase", + "src": "2504:53:45", + "value": "default" + } + ], + "expression": { + "name": "result", + "nodeType": "YulIdentifier", + "src": "2432:6:45" + }, + "nodeType": "YulSwitch", + "src": "2425:132:45" + } + ] + }, + "evmVersion": "london", + "externalReferences": [ + { + "declaration": 24291, + "isOffset": false, + "isSlot": false, + "src": "2251:5:45", + "valueSize": 1 + } + ], + "id": 24314, + "nodeType": "InlineAssembly", + "src": "2062:501:45" + } + ] + }, + "id": 24316, + "implemented": true, + "kind": "fallback", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 24278, + "nodeType": "ParameterList", + "parameters": [], + "src": "1618:2:45" + }, + "returnParameters": { + "id": 24279, + "nodeType": "ParameterList", + "parameters": [], + "src": "1638:0:45" + }, + "scope": 24321, + "src": "1610:957:45", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 24319, + "nodeType": "Block", + "src": "2598:2:45", + "statements": [] + }, + "id": 24320, + "implemented": true, + "kind": "receive", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 24317, + "nodeType": "ParameterList", + "parameters": [], + "src": "2578:2:45" + }, + "returnParameters": { + "id": 24318, + "nodeType": "ParameterList", + "parameters": [], + "src": "2598:0:45" + }, + "scope": 24321, + "src": "2571:29:45", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 24322, + "src": "765:1837:45", + "usedErrors": [] + } + ], + "src": "32:2571:45" + } +} \ No newline at end of file diff --git a/packages/ri/contracts/abi/EmberFacet.json b/packages/ri/contracts/abi/EmberFacet.json new file mode 100644 index 0000000000..b9327f7171 --- /dev/null +++ b/packages/ri/contracts/abi/EmberFacet.json @@ -0,0 +1,1246 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + }, + { + "internalType": "address", + "name": "component", + "type": "address" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "addComponentToEntityExternally", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "callerEntityID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "entryPoint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + }, + { + "internalType": "address", + "name": "component", + "type": "address" + } + ], + "name": "removeComponentFromEntityExternally", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "world", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": { + "object": "0x608060405234801561001057600080fd5b50610744806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c806357e0cc421161005057806357e0cc42146100ae578063b0d691fe146100bf578063ceb44dd5146100c757600080fd5b806330b67baa1461006c57806344694faa14610099575b600080fd5b60015460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100ac6100a73660046104a8565b6100da565b005b600254604051908152602001610090565b6100ac610161565b6100ac6100d5366004610503565b6102f9565b6040517f4cc8221500000000000000000000000000000000000000000000000000000000815260048101839052819073ffffffffffffffffffffffffffffffffffffffff821690634cc8221590602401600060405180830381600087803b15801561014457600080fd5b505af1158015610158573d6000803e3d6000fd5b50505050505050565b60008060005b60038201548110156102d557600082600301828154811061018a5761018a6105ec565b600091825260208220015460405133602482015282357fffffffff0000000000000000000000000000000000000000000000000000000016604482015273ffffffffffffffffffffffffffffffffffffffff909116925061028e9083907fab0870370000000000000000000000000000000000000000000000000000000090606401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610387565b90506000818060200190518101906102a6919061061b565b905080156102bf57600285015550600193506102d59050565b50505080806102cd90610634565b915050610167565b50816102e357600060028201555b805460ff16156102f557600060028201555b5050565b6040517f8b282947000000000000000000000000000000000000000000000000000000008152829073ffffffffffffffffffffffffffffffffffffffff821690638b2829479061034f90879086906004016106c3565b600060405180830381600087803b15801561036957600080fd5b505af115801561037d573d6000803e3d6000fd5b5050505050505050565b60606000808473ffffffffffffffffffffffffffffffffffffffff16846040516103b1919061071b565b600060405180830381855af49150503d80600081146103ec576040519150601f19603f3d011682016040523d82523d6000602084013e6103f1565b606091505b509092509050811515600003610477578051156104115780518082602001fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f44656c656761746543616c6c2072657665727465640000000000000000000000604482015260640160405180910390fd5b949350505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146104a357600080fd5b919050565b600080604083850312156104bb57600080fd5b823591506104cb6020840161047f565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561051857600080fd5b833592506105286020850161047f565b9150604084013567ffffffffffffffff8082111561054557600080fd5b818601915086601f83011261055957600080fd5b81358181111561056b5761056b6104d4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156105b1576105b16104d4565b816040528281528960208487010111156105ca57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561062d57600080fd5b5051919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361068c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60005b838110156106ae578181015183820152602001610696565b838111156106bd576000848401525b50505050565b82815260406020820152600082518060408401526106e8816060850160208701610693565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016060019392505050565b6000825161072d818460208701610693565b919091019291505056fea164736f6c634300080d000a", + "sourceMap": "537:750:58:-:0;;;;;;;;;;;;;;;;;;;", + "linkReferences": {} + }, + "deployedBytecode": { + "object": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c806357e0cc421161005057806357e0cc42146100ae578063b0d691fe146100bf578063ceb44dd5146100c757600080fd5b806330b67baa1461006c57806344694faa14610099575b600080fd5b60015460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100ac6100a73660046104a8565b6100da565b005b600254604051908152602001610090565b6100ac610161565b6100ac6100d5366004610503565b6102f9565b6040517f4cc8221500000000000000000000000000000000000000000000000000000000815260048101839052819073ffffffffffffffffffffffffffffffffffffffff821690634cc8221590602401600060405180830381600087803b15801561014457600080fd5b505af1158015610158573d6000803e3d6000fd5b50505050505050565b60008060005b60038201548110156102d557600082600301828154811061018a5761018a6105ec565b600091825260208220015460405133602482015282357fffffffff0000000000000000000000000000000000000000000000000000000016604482015273ffffffffffffffffffffffffffffffffffffffff909116925061028e9083907fab0870370000000000000000000000000000000000000000000000000000000090606401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610387565b90506000818060200190518101906102a6919061061b565b905080156102bf57600285015550600193506102d59050565b50505080806102cd90610634565b915050610167565b50816102e357600060028201555b805460ff16156102f557600060028201555b5050565b6040517f8b282947000000000000000000000000000000000000000000000000000000008152829073ffffffffffffffffffffffffffffffffffffffff821690638b2829479061034f90879086906004016106c3565b600060405180830381600087803b15801561036957600080fd5b505af115801561037d573d6000803e3d6000fd5b5050505050505050565b60606000808473ffffffffffffffffffffffffffffffffffffffff16846040516103b1919061071b565b600060405180830381855af49150503d80600081146103ec576040519150601f19603f3d011682016040523d82523d6000602084013e6103f1565b606091505b509092509050811515600003610477578051156104115780518082602001fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f44656c656761746543616c6c2072657665727465640000000000000000000000604482015260640160405180910390fd5b949350505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146104a357600080fd5b919050565b600080604083850312156104bb57600080fd5b823591506104cb6020840161047f565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561051857600080fd5b833592506105286020850161047f565b9150604084013567ffffffffffffffff8082111561054557600080fd5b818601915086601f83011261055957600080fd5b81358181111561056b5761056b6104d4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156105b1576105b16104d4565b816040528281528960208487010111156105ca57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561062d57600080fd5b5051919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361068c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60005b838110156106ae578181015183820152602001610696565b838111156106bd576000848401525b50505050565b82815260406020820152600082518060408401526106e8816060850160208701610693565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016060019392505050565b6000825161072d818460208701610693565b919091019291505056fea164736f6c634300080d000a", + "sourceMap": "537:750:58:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;628:83;698:7;;628:83;;698:7;;;;160:74:85;;148:2;133:18;628:83:58;;;;;;;;1037:156;;;;;;:::i;:::-;;:::i;:::-;;730:93;801:17;;730:93;;851:25:85;;;839:2;824:18;730:93:58;705:177:85;1231:54:58;;;:::i;842:191::-;;;;;;:::i;:::-;;:::i;1037:156::-;1172:16;;;;;;;;851:25:85;;;1156:9:58;;1172:8;;;;;;824:18:85;;1172:16:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1126:67;1037:156;;:::o;1231:54::-;403:10:35;;569:9;564:538;588:28;;;:35;584:39;;564:538;;;638:24;665:10;:28;;694:1;665:31;;;;;;;;:::i;:::-;;;;;;;;;;791:100;;871:10;791:100;;;2564:74:85;883:7:35;;;;2654:18:85;;;2647:107;665:31:35;;;;;-1:-1:-1;730:169:35;;665:31;;814:55;;2537:18:85;;791:100:35;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;730:25;:169::i;:::-;704:195;;907:22;943:10;932:33;;;;;;;;;;;;:::i;:::-;907:58;-1:-1:-1;977:18:35;;973:123;;1007:26;;;:43;-1:-1:-1;1068:4:35;;-1:-1:-1;1082:5:35;;-1:-1:-1;1082:5:35;973:123;630:472;;;625:3;;;;;:::i;:::-;;;;564:538;;;;1112:5;1107:57;;1156:1;1127:26;;;:30;1107:57;1180:37;;;;1176:88;;;1256:1;1227:26;;;:30;1176:88;397:871;;1231:54:58:o;842:191::-;1008:20;;;;;992:9;;1008:5;;;;;;:20;;1014:6;;1022:5;;1008:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;962:71;842:191;;;:::o;652:588:67:-;733:12;754;768:23;795:4;:17;;813:8;795:27;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;753:69:67;;-1:-1:-1;753:69:67;-1:-1:-1;869:16:67;;;880:5;869:16;865:348;;943:17;;:21;939:268;;1068:10;1062:17;1118:14;1105:10;1101:2;1097:19;1090:43;939:268;1167:31;;;;;4568:2:85;1167:31:67;;;4550:21:85;4607:2;4587:18;;;4580:30;4646:23;4626:18;;;4619:51;4687:18;;1167:31:67;;;;;;;939:268;1225:10;652:588;-1:-1:-1;;;;652:588:67:o;245:196:85:-;313:20;;373:42;362:54;;352:65;;342:93;;431:1;428;421:12;342:93;245:196;;;:::o;446:254::-;514:6;522;575:2;563:9;554:7;550:23;546:32;543:52;;;591:1;588;581:12;543:52;627:9;614:23;604:33;;656:38;690:2;679:9;675:18;656:38;:::i;:::-;646:48;;446:254;;;;;:::o;887:184::-;939:77;936:1;929:88;1036:4;1033:1;1026:15;1060:4;1057:1;1050:15;1076:1122;1162:6;1170;1178;1231:2;1219:9;1210:7;1206:23;1202:32;1199:52;;;1247:1;1244;1237:12;1199:52;1283:9;1270:23;1260:33;;1312:38;1346:2;1335:9;1331:18;1312:38;:::i;:::-;1302:48;;1401:2;1390:9;1386:18;1373:32;1424:18;1465:2;1457:6;1454:14;1451:34;;;1481:1;1478;1471:12;1451:34;1519:6;1508:9;1504:22;1494:32;;1564:7;1557:4;1553:2;1549:13;1545:27;1535:55;;1586:1;1583;1576:12;1535:55;1622:2;1609:16;1644:2;1640;1637:10;1634:36;;;1650:18;;:::i;:::-;1784:2;1778:9;1846:4;1838:13;;1689:66;1834:22;;;1858:2;1830:31;1826:40;1814:53;;;1882:18;;;1902:22;;;1879:46;1876:72;;;1928:18;;:::i;:::-;1968:10;1964:2;1957:22;2003:2;1995:6;1988:18;2043:7;2038:2;2033;2029;2025:11;2021:20;2018:33;2015:53;;;2064:1;2061;2054:12;2015:53;2120:2;2115;2111;2107:11;2102:2;2094:6;2090:15;2077:46;2165:1;2160:2;2155;2147:6;2143:15;2139:24;2132:35;2186:6;2176:16;;;;;;;1076:1122;;;;;:::o;2203:184::-;2255:77;2252:1;2245:88;2352:4;2349:1;2342:15;2376:4;2373:1;2366:15;2765:184;2835:6;2888:2;2876:9;2867:7;2863:23;2859:32;2856:52;;;2904:1;2901;2894:12;2856:52;-1:-1:-1;2927:16:85;;2765:184;-1:-1:-1;2765:184:85:o;2954:349::-;2993:3;3024:66;3017:5;3014:77;3011:257;;3124:77;3121:1;3114:88;3225:4;3222:1;3215:15;3253:4;3250:1;3243:15;3011:257;-1:-1:-1;3295:1:85;3284:13;;2954:349::o;3308:258::-;3380:1;3390:113;3404:6;3401:1;3398:13;3390:113;;;3480:11;;;3474:18;3461:11;;;3454:39;3426:2;3419:10;3390:113;;;3521:6;3518:1;3515:13;3512:48;;;3556:1;3547:6;3542:3;3538:16;3531:27;3512:48;;3308:258;;;:::o;3571:511::-;3746:6;3735:9;3728:25;3789:2;3784;3773:9;3769:18;3762:30;3709:4;3821:6;3815:13;3864:6;3859:2;3848:9;3844:18;3837:34;3880:66;3939:6;3934:2;3923:9;3919:18;3914:2;3906:6;3902:15;3880:66;:::i;:::-;3998:2;3986:15;4003:66;3982:88;3967:104;;;;4073:2;3963:113;;3571:511;-1:-1:-1;;;3571:511:85:o;4087:274::-;4216:3;4254:6;4248:13;4270:53;4316:6;4311:3;4304:4;4296:6;4292:17;4270:53;:::i;:::-;4339:16;;;;;4087:274;-1:-1:-1;;4087:274:85:o", + "linkReferences": {} + }, + "ast": { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/facets/EmberFacet.sol", + "exportedSymbols": { + "AppStorage": [ + 26638 + ], + "Component": [ + 11026 + ], + "EmberFacet": [ + 26303 + ], + "EntityType": [ + 23214 + ], + "EntityTypeComponent": [ + 23302 + ], + "Position": [ + 23685 + ], + "PositionComponent": [ + 23778 + ], + "UsingAccessControl": [ + 23164 + ], + "UsingDiamondOwner": [ + 26055 + ], + "World": [ + 11262 + ] + }, + "id": 26304, + "license": "Unlicense", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 26207, + "literals": [ + "solidity", + ">=", + "0.8", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "38:24:58" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/components/PositionComponent.sol", + "file": "../components/PositionComponent.sol", + "id": 26210, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26304, + "sourceUnit": 23779, + "src": "64:82:58", + "symbolAliases": [ + { + "foreign": { + "id": 26208, + "name": "PositionComponent", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23778, + "src": "73:17:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + }, + { + "foreign": { + "id": 26209, + "name": "Position", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23685, + "src": "92:8:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/components/EntityTypeComponent.sol", + "file": "../components/EntityTypeComponent.sol", + "id": 26213, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26304, + "sourceUnit": 23303, + "src": "147:88:58", + "symbolAliases": [ + { + "foreign": { + "id": 26211, + "name": "EntityTypeComponent", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23302, + "src": "156:19:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + }, + { + "foreign": { + "id": 26212, + "name": "EntityType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23214, + "src": "177:10:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/../../../node_modules/@mud/solecs/src/World.sol", + "file": "solecs/World.sol", + "id": 26215, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26304, + "sourceUnit": 11263, + "src": "236:41:58", + "symbolAliases": [ + { + "foreign": { + "id": 26214, + "name": "World", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11262, + "src": "245:5:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/../../../node_modules/@mud/solecs/src/Component.sol", + "file": "solecs/Component.sol", + "id": 26217, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26304, + "sourceUnit": 11027, + "src": "278:49:58", + "symbolAliases": [ + { + "foreign": { + "id": 26216, + "name": "Component", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11026, + "src": "287:9:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/diamond/utils/UsingDiamondOwner.sol", + "file": "../diamond/utils/UsingDiamondOwner.sol", + "id": 26219, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26304, + "sourceUnit": 26056, + "src": "328:75:58", + "symbolAliases": [ + { + "foreign": { + "id": 26218, + "name": "UsingDiamondOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26055, + "src": "337:17:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/access/UsingAccessControl.sol", + "file": "../access/UsingAccessControl.sol", + "id": 26221, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26304, + "sourceUnit": 23165, + "src": "404:70:58", + "symbolAliases": [ + { + "foreign": { + "id": 26220, + "name": "UsingAccessControl", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23164, + "src": "413:18:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/libraries/LibAppStorage.sol", + "file": "../libraries/LibAppStorage.sol", + "id": 26223, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26304, + "sourceUnit": 26648, + "src": "475:60:58", + "symbolAliases": [ + { + "foreign": { + "id": 26222, + "name": "AppStorage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26638, + "src": "484:10:58", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 26224, + "name": "UsingDiamondOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 26055, + "src": "560:17:58" + }, + "id": 26225, + "nodeType": "InheritanceSpecifier", + "src": "560:17:58" + }, + { + "baseName": { + "id": 26226, + "name": "UsingAccessControl", + "nodeType": "IdentifierPath", + "referencedDeclaration": 23164, + "src": "579:18:58" + }, + "id": 26227, + "nodeType": "InheritanceSpecifier", + "src": "579:18:58" + } + ], + "canonicalName": "EmberFacet", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 26303, + "linearizedBaseContracts": [ + 26303, + 23164, + 29488, + 26055 + ], + "name": "EmberFacet", + "nameLocation": "546:10:58", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 26230, + "mutability": "mutable", + "name": "s", + "nameLocation": "622:1:58", + "nodeType": "VariableDeclaration", + "scope": 26303, + "src": "602:21:58", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AppStorage_$26638_storage", + "typeString": "struct AppStorage" + }, + "typeName": { + "id": 26229, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 26228, + "name": "AppStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 26638, + "src": "602:10:58" + }, + "referencedDeclaration": 26638, + "src": "602:10:58", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AppStorage_$26638_storage_ptr", + "typeString": "struct AppStorage" + } + }, + "visibility": "internal" + }, + { + "body": { + "id": 26241, + "nodeType": "Block", + "src": "677:34:58", + "statements": [ + { + "expression": { + "arguments": [ + { + "expression": { + "id": 26237, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26230, + "src": "698:1:58", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AppStorage_$26638_storage", + "typeString": "struct AppStorage storage ref" + } + }, + "id": 26238, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "world", + "nodeType": "MemberAccess", + "referencedDeclaration": 26628, + "src": "698:7:58", + "typeDescriptions": { + "typeIdentifier": "t_contract$_World_$11262", + "typeString": "contract World" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_World_$11262", + "typeString": "contract World" + } + ], + "id": 26236, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "690:7:58", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 26235, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "690:7:58", + "typeDescriptions": {} + } + }, + "id": 26239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "690:16:58", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 26234, + "id": 26240, + "nodeType": "Return", + "src": "683:23:58" + } + ] + }, + "functionSelector": "30b67baa", + "id": 26242, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "world", + "nameLocation": "637:5:58", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26231, + "nodeType": "ParameterList", + "parameters": [], + "src": "642:2:58" + }, + "returnParameters": { + "id": 26234, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 26233, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 26242, + "src": "668:7:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 26232, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "668:7:58", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "667:9:58" + }, + "scope": 26303, + "src": "628:83:58", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 26250, + "nodeType": "Block", + "src": "788:35:58", + "statements": [ + { + "expression": { + "expression": { + "id": 26247, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26230, + "src": "801:1:58", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AppStorage_$26638_storage", + "typeString": "struct AppStorage storage ref" + } + }, + "id": 26248, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "_callerEntityID", + "nodeType": "MemberAccess", + "referencedDeclaration": 26630, + "src": "801:17:58", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 26246, + "id": 26249, + "nodeType": "Return", + "src": "794:24:58" + } + ] + }, + "functionSelector": "57e0cc42", + "id": 26251, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "callerEntityID", + "nameLocation": "739:14:58", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26243, + "nodeType": "ParameterList", + "parameters": [], + "src": "753:2:58" + }, + "returnParameters": { + "id": 26246, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 26245, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 26251, + "src": "779:7:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 26244, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "779:7:58", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "778:9:58" + }, + "scope": 26303, + "src": "730:93:58", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 26274, + "nodeType": "Block", + "src": "962:71:58", + "statements": [ + { + "assignments": [ + 26262 + ], + "declarations": [ + { + "constant": false, + "id": 26262, + "mutability": "mutable", + "name": "c", + "nameLocation": "978:1:58", + "nodeType": "VariableDeclaration", + "scope": 26274, + "src": "968:11:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + }, + "typeName": { + "id": 26261, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 26260, + "name": "Component", + "nodeType": "IdentifierPath", + "referencedDeclaration": 11026, + "src": "968:9:58" + }, + "referencedDeclaration": 11026, + "src": "968:9:58", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + } + }, + "visibility": "internal" + } + ], + "id": 26266, + "initialValue": { + "arguments": [ + { + "id": 26264, + "name": "component", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26255, + "src": "992:9:58", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 26263, + "name": "Component", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11026, + "src": "982:9:58", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Component_$11026_$", + "typeString": "type(contract Component)" + } + }, + "id": 26265, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "982:20:58", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "968:34:58" + }, + { + "expression": { + "arguments": [ + { + "id": 26270, + "name": "entity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26253, + "src": "1014:6:58", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 26271, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26257, + "src": "1022:5:58", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "id": 26267, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26262, + "src": "1008:1:58", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + } + }, + "id": 26269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "set", + "nodeType": "MemberAccess", + "referencedDeclaration": 10855, + "src": "1008:5:58", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$_t_bytes_memory_ptr_$returns$__$", + "typeString": "function (uint256,bytes memory) external" + } + }, + "id": 26272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1008:20:58", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 26273, + "nodeType": "ExpressionStatement", + "src": "1008:20:58" + } + ] + }, + "functionSelector": "ceb44dd5", + "id": 26275, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "addComponentToEntityExternally", + "nameLocation": "851:30:58", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26258, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 26253, + "mutability": "mutable", + "name": "entity", + "nameLocation": "895:6:58", + "nodeType": "VariableDeclaration", + "scope": 26275, + "src": "887:14:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 26252, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "887:7:58", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26255, + "mutability": "mutable", + "name": "component", + "nameLocation": "915:9:58", + "nodeType": "VariableDeclaration", + "scope": 26275, + "src": "907:17:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 26254, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "907:7:58", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26257, + "mutability": "mutable", + "name": "value", + "nameLocation": "943:5:58", + "nodeType": "VariableDeclaration", + "scope": 26275, + "src": "930:18:58", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 26256, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "930:5:58", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "visibility": "internal" + } + ], + "src": "881:71:58" + }, + "returnParameters": { + "id": 26259, + "nodeType": "ParameterList", + "parameters": [], + "src": "962:0:58" + }, + "scope": 26303, + "src": "842:191:58", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 26295, + "nodeType": "Block", + "src": "1126:67:58", + "statements": [ + { + "assignments": [ + 26284 + ], + "declarations": [ + { + "constant": false, + "id": 26284, + "mutability": "mutable", + "name": "c", + "nameLocation": "1142:1:58", + "nodeType": "VariableDeclaration", + "scope": 26295, + "src": "1132:11:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + }, + "typeName": { + "id": 26283, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 26282, + "name": "Component", + "nodeType": "IdentifierPath", + "referencedDeclaration": 11026, + "src": "1132:9:58" + }, + "referencedDeclaration": 11026, + "src": "1132:9:58", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + } + }, + "visibility": "internal" + } + ], + "id": 26288, + "initialValue": { + "arguments": [ + { + "id": 26286, + "name": "component", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26279, + "src": "1156:9:58", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 26285, + "name": "Component", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11026, + "src": "1146:9:58", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Component_$11026_$", + "typeString": "type(contract Component)" + } + }, + "id": 26287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1146:20:58", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1132:34:58" + }, + { + "expression": { + "arguments": [ + { + "id": 26292, + "name": "entity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26277, + "src": "1181:6:58", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 26289, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26284, + "src": "1172:1:58", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Component_$11026", + "typeString": "contract Component" + } + }, + "id": 26291, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "remove", + "nodeType": "MemberAccess", + "referencedDeclaration": 10928, + "src": "1172:8:58", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 26293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1172:16:58", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 26294, + "nodeType": "ExpressionStatement", + "src": "1172:16:58" + } + ] + }, + "functionSelector": "44694faa", + "id": 26296, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "removeComponentFromEntityExternally", + "nameLocation": "1046:35:58", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26280, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 26277, + "mutability": "mutable", + "name": "entity", + "nameLocation": "1090:6:58", + "nodeType": "VariableDeclaration", + "scope": 26296, + "src": "1082:14:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 26276, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1082:7:58", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26279, + "mutability": "mutable", + "name": "component", + "nameLocation": "1106:9:58", + "nodeType": "VariableDeclaration", + "scope": 26296, + "src": "1098:17:58", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 26278, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1098:7:58", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1081:35:58" + }, + "returnParameters": { + "id": 26281, + "nodeType": "ParameterList", + "parameters": [], + "src": "1126:0:58" + }, + "scope": 26303, + "src": "1037:156:58", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 26301, + "nodeType": "Block", + "src": "1283:2:58", + "statements": [] + }, + "functionSelector": "b0d691fe", + "id": 26302, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 26299, + "kind": "modifierInvocation", + "modifierName": { + "id": 26298, + "name": "populateCallerEntityID", + "nodeType": "IdentifierPath", + "referencedDeclaration": 23163, + "src": "1260:22:58" + }, + "nodeType": "ModifierInvocation", + "src": "1260:22:58" + } + ], + "name": "entryPoint", + "nameLocation": "1240:10:58", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26297, + "nodeType": "ParameterList", + "parameters": [], + "src": "1250:2:58" + }, + "returnParameters": { + "id": 26300, + "nodeType": "ParameterList", + "parameters": [], + "src": "1283:0:58" + }, + "scope": 26303, + "src": "1231:54:58", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 26304, + "src": "537:750:58", + "usedErrors": [] + } + ], + "src": "38:1250:58" + } +} \ No newline at end of file diff --git a/packages/ri/contracts/abi/LibAppStorage.json b/packages/ri/contracts/abi/LibAppStorage.json new file mode 100644 index 0000000000..2693cccb70 --- /dev/null +++ b/packages/ri/contracts/abi/LibAppStorage.json @@ -0,0 +1,458 @@ +{ + "abi": [], + "bytecode": { + "object": "0x602d6037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c634300080d000a", + "sourceMap": "428:145:62:-:0;;;;;;;;;;;;;;;-1:-1:-1;;;428:145:62;;;;;;;;;;;;;;;;;", + "linkReferences": {} + }, + "deployedBytecode": { + "object": "0x73000000000000000000000000000000000000000030146080604052600080fdfea164736f6c634300080d000a", + "sourceMap": "428:145:62:-:0;;;;;;;;", + "linkReferences": {} + }, + "ast": { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/libraries/LibAppStorage.sol", + "exportedSymbols": { + "AppStorage": [ + 26638 + ], + "Config": [ + 26622 + ], + "LibAppStorage": [ + 26647 + ], + "World": [ + 11262 + ] + }, + "id": 26648, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/../../../node_modules/@mud/solecs/src/World.sol", + "file": "solecs/World.sol", + "id": 26616, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 26648, + "sourceUnit": 11263, + "src": "0:41:62", + "symbolAliases": [ + { + "foreign": { + "id": 26615, + "name": "World", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11262, + "src": "9:5:62", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 26617, + "literals": [ + "solidity", + "^", + "0.8", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "43:23:62" + }, + { + "canonicalName": "Config", + "id": 26622, + "members": [ + { + "constant": false, + "id": 26619, + "mutability": "mutable", + "name": "resetCallerEntityID", + "nameLocation": "123:19:62", + "nodeType": "VariableDeclaration", + "scope": 26622, + "src": "118:24:62", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 26618, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "118:4:62", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26621, + "mutability": "mutable", + "name": "personaMirror", + "nameLocation": "154:13:62", + "nodeType": "VariableDeclaration", + "scope": 26622, + "src": "146:21:62", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 26620, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "146:7:62", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "name": "Config", + "nameLocation": "107:6:62", + "nodeType": "StructDefinition", + "scope": 26648, + "src": "100:70:62", + "visibility": "public" + }, + { + "canonicalName": "AppStorage", + "id": 26638, + "members": [ + { + "constant": false, + "id": 26625, + "mutability": "mutable", + "name": "config", + "nameLocation": "200:6:62", + "nodeType": "VariableDeclaration", + "scope": 26638, + "src": "193:13:62", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Config_$26622_storage_ptr", + "typeString": "struct Config" + }, + "typeName": { + "id": 26624, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 26623, + "name": "Config", + "nodeType": "IdentifierPath", + "referencedDeclaration": 26622, + "src": "193:6:62" + }, + "referencedDeclaration": 26622, + "src": "193:6:62", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Config_$26622_storage_ptr", + "typeString": "struct Config" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26628, + "mutability": "mutable", + "name": "world", + "nameLocation": "216:5:62", + "nodeType": "VariableDeclaration", + "scope": 26638, + "src": "210:11:62", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_World_$11262", + "typeString": "contract World" + }, + "typeName": { + "id": 26627, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 26626, + "name": "World", + "nodeType": "IdentifierPath", + "referencedDeclaration": 11262, + "src": "210:5:62" + }, + "referencedDeclaration": 11262, + "src": "210:5:62", + "typeDescriptions": { + "typeIdentifier": "t_contract$_World_$11262", + "typeString": "contract World" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26630, + "mutability": "mutable", + "name": "_callerEntityID", + "nameLocation": "233:15:62", + "nodeType": "VariableDeclaration", + "scope": 26638, + "src": "225:23:62", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 26629, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "225:7:62", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26633, + "mutability": "mutable", + "name": "accessControllers", + "nameLocation": "337:17:62", + "nodeType": "VariableDeclaration", + "scope": 26638, + "src": "327:27:62", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 26631, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "327:7:62", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 26632, + "nodeType": "ArrayTypeName", + "src": "327:9:62", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26637, + "mutability": "mutable", + "name": "embodiedSystemSelectorToImplementation", + "nameLocation": "385:38:62", + "nodeType": "VariableDeclaration", + "scope": 26638, + "src": "358:65:62", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes4_$_t_address_$", + "typeString": "mapping(bytes4 => address)" + }, + "typeName": { + "id": 26636, + "keyType": { + "id": 26634, + "name": "bytes4", + "nodeType": "ElementaryTypeName", + "src": "366:6:62", + "typeDescriptions": { + "typeIdentifier": "t_bytes4", + "typeString": "bytes4" + } + }, + "nodeType": "Mapping", + "src": "358:26:62", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes4_$_t_address_$", + "typeString": "mapping(bytes4 => address)" + }, + "valueType": { + "id": 26635, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "376:7:62", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + }, + "visibility": "internal" + } + ], + "name": "AppStorage", + "nameLocation": "178:10:62", + "nodeType": "StructDefinition", + "scope": 26648, + "src": "171:255:62", + "visibility": "public" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "LibAppStorage", + "contractDependencies": [], + "contractKind": "library", + "fullyImplemented": true, + "id": 26647, + "linearizedBaseContracts": [ + 26647 + ], + "name": "LibAppStorage", + "nameLocation": "436:13:62", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 26645, + "nodeType": "Block", + "src": "526:45:62", + "statements": [ + { + "AST": { + "nodeType": "YulBlock", + "src": "541:26:62", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "549:12:62", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "560:1:62", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "ds.slot", + "nodeType": "YulIdentifier", + "src": "549:7:62" + } + ] + } + ] + }, + "evmVersion": "london", + "externalReferences": [ + { + "declaration": 26642, + "isOffset": false, + "isSlot": true, + "src": "549:7:62", + "suffix": "slot", + "valueSize": 1 + } + ], + "id": 26644, + "nodeType": "InlineAssembly", + "src": "532:35:62" + } + ] + }, + "id": 26646, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "diamondStorage", + "nameLocation": "463:14:62", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26639, + "nodeType": "ParameterList", + "parameters": [], + "src": "477:2:62" + }, + "returnParameters": { + "id": 26643, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 26642, + "mutability": "mutable", + "name": "ds", + "nameLocation": "522:2:62", + "nodeType": "VariableDeclaration", + "scope": 26646, + "src": "503:21:62", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AppStorage_$26638_storage_ptr", + "typeString": "struct AppStorage" + }, + "typeName": { + "id": 26641, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 26640, + "name": "AppStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 26638, + "src": "503:10:62" + }, + "referencedDeclaration": 26638, + "src": "503:10:62", + "typeDescriptions": { + "typeIdentifier": "t_struct$_AppStorage_$26638_storage_ptr", + "typeString": "struct AppStorage" + } + }, + "visibility": "internal" + } + ], + "src": "502:23:62" + }, + "scope": 26647, + "src": "454:117:62", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + } + ], + "scope": 26648, + "src": "428:145:62", + "usedErrors": [] + } + ], + "src": "0:574:62" + } +} \ No newline at end of file diff --git a/packages/ri/contracts/abi/PositionComponent.json b/packages/ri/contracts/abi/PositionComponent.json new file mode 100644 index 0000000000..1a3c06557f --- /dev/null +++ b/packages/ri/contracts/abi/PositionComponent.json @@ -0,0 +1,1568 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "world", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "getEntities", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "getEntitiesWithValue", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + } + ], + "internalType": "struct Position", + "name": "position", + "type": "tuple" + } + ], + "name": "getEntitiesWithValue", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + } + ], + "name": "getRawValue", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + } + ], + "name": "getValue", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + } + ], + "internalType": "struct Position", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + } + ], + "name": "has", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "registerIndexer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + } + ], + "name": "remove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "entity", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "x", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "y", + "type": "uint256" + } + ], + "internalType": "struct Position", + "name": "value", + "type": "tuple" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "world", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": { + "object": "0x60806040523480156200001157600080fd5b50604051620022c5380380620022c583398101604081905262000034916200014f565b600080546001600160a01b0319166001600160a01b038316908117909155819063f303477030620000827ff2b6dccd2b727ad73194b365dd7ad2c6b1e96e25269352f5a0a3b0fa694445e290565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015620000c957600080fd5b505af1158015620000de573d6000803e3d6000fd5b50505050604051620000f09062000141565b604051809103906000f0801580156200010d573d6000803e3d6000fd5b50600280546001600160a01b03929092166001600160a01b0319928316179055600180549091163317905550620001819050565b61040f8062001eb683390190565b6000602082840312156200016257600080fd5b81516001600160a01b03811681146200017a57600080fd5b9392505050565b611d2580620001916000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063b8bc073d11610066578063b8bc073d1461022b578063cccf7a8e1461024b578063f2fde38b1461026e578063fd4ab6d81461028157600080fd5b80638da5cb5b146101ca578063ab9dbd07146101ea578063b361be461461021857600080fd5b80634cc82215116100c85780634cc822151461017c57806375c0669c146101915780638b282947146101a45780638bbf68fe146101b757600080fd5b80630ff4c916146100ef57806330b67baa1461012257806331b933b914610167575b600080fd5b6101026100fd3660046112ec565b610294565b604080518251815260209283015192810192909252015b60405180910390f35b6000546101429073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610119565b61016f6102e1565b6040516101199190611305565b61018f61018a3660046112ec565b61039c565b005b61018f61019f366004611349565b610707565b61018f6101b236600461148b565b61088f565b61018f6101c53660046114ea565b610c92565b6001546101429073ffffffffffffffffffffffffffffffffffffffff1681565b6040517ff2b6dccd2b727ad73194b365dd7ad2c6b1e96e25269352f5a0a3b0fa694445e28152602001610119565b61016f610226366004611517565b610cd1565b61023e6102393660046112ec565b610e0f565b60405161011991906115ce565b61025e6102593660046112ec565b610eb1565b6040519015158152602001610119565b61018f61027c366004611349565b610f45565b61016f61028f3660046115e1565b61100d565b60408051808201909152600080825260208201526000806102b484610e0f565b8060200190518101906102c791906115fd565b604080518082019091529182526020820152949350505050565b600254604080517f410d59cc000000000000000000000000000000000000000000000000000000008152905160609273ffffffffffffffffffffffffffffffffffffffff169163410d59cc9160048083019260009291908290030181865afa158015610351573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526103979190810190611621565b905090565b60015473ffffffffffffffffffffffffffffffffffffffff163314610422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e45520000000000000000000000000060448201526064015b60405180910390fd5b600081815260046020526040808220905160039161043f91611714565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff16146107045760008181526004602052604090819020905160039161048891611714565b908152604051908190036020018120547f4cc8221500000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff1690634cc82215906104ea90849060040190815260200190565b600060405180830381600087803b15801561050457600080fd5b505af1158015610518573d6000803e3d6000fd5b50506002546040517f4cc822150000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff9091169250634cc822159150602401600060405180830381600087803b15801561058857600080fd5b505af115801561059c573d6000803e3d6000fd5b50505060008281526004602052604081206105b892509061120c565b60005b60055481101561067857600581815481106105d8576105d86117e6565b6000918252602090912001546040517f4cc822150000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690634cc8221590602401600060405180830381600087803b15801561064d57600080fd5b505af1158015610661573d6000803e3d6000fd5b50505050808061067090611815565b9150506105bb565b506000546040517fd803064a0000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff9091169063d803064a90604401600060405180830381600087803b1580156106eb57600080fd5b505af11580156106ff573d6000803e3d6000fd5b505050505b50565b60015473ffffffffffffffffffffffffffffffffffffffff163314610788576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b6107b2817f4ede9a2d00000000000000000000000000000000000000000000000000000000611049565b610818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f476976656e2061646472657373206973206e6f7420616e20696e64657865722e6044820152606401610419565b600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610910576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b6002546040517f1003e2d20000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690631003e2d290602401600060405180830381600087803b15801561097c57600080fd5b505af1158015610990573d6000803e3d6000fd5b505050600083815260046020908152604090912083516109b593509091840190611246565b50600073ffffffffffffffffffffffffffffffffffffffff166003826040516109de9190611874565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610a9757604051610a15906112ca565b604051809103906000f080158015610a31573d6000803e3d6000fd5b50600382604051610a429190611874565b908152604051908190036020019020805473ffffffffffffffffffffffffffffffffffffffff929092167fffffffffffffffffffffffff00000000000000000000000000000000000000009092169190911790555b600381604051610aa79190611874565b908152604051908190036020018120547f1003e2d200000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff1690631003e2d290610b0990859060040190815260200190565b600060405180830381600087803b158015610b2357600080fd5b505af1158015610b37573d6000803e3d6000fd5b5050505060005b600554811015610c015760058181548110610b5b57610b5b6117e6565b6000918252602090912001546040517f0216b83800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690630216b83890610bbc9086908690600401611890565b600060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050508080610bf990611815565b915050610b3e565b506000546040517faf104e4000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063af104e4090610c5c903090869086906004016118a9565b600060405180830381600087803b158015610c7657600080fd5b505af1158015610c8a573d6000803e3d6000fd5b505050505050565b610ccd8282604051602001610cb99190813581526020918201359181019190915260400190565b60405160208183030381529060405261088f565b5050565b6060600073ffffffffffffffffffffffffffffffffffffffff16600383604051610cfb9190611874565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610d3a57505060408051600081526020810190915290565b600382604051610d4a9190611874565b90815260408051918290036020018220547f410d59cc000000000000000000000000000000000000000000000000000000008352905173ffffffffffffffffffffffffffffffffffffffff9091169163410d59cc9160048083019260009291908290030181865afa158015610dc3573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610e099190810190611621565b92915050565b6000818152600460205260409020805460609190610e2c906116c7565b80601f0160208091040260200160405190810160405280929190818152602001828054610e58906116c7565b8015610ea55780601f10610e7a57610100808354040283529160200191610ea5565b820191906000526020600020905b815481529060010190602001808311610e8857829003601f168201915b50505050509050919050565b6002546040517fcccf7a8e0000000000000000000000000000000000000000000000000000000081526004810183905260009173ffffffffffffffffffffffffffffffffffffffff169063cccf7a8e90602401602060405180830381865afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0991906118e7565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060610e09826040516020016110359190813581526020918201359181019190915260400190565b604051602081830303815290604052610cd1565b60006110548361106c565b8015611065575061106583836110d0565b9392505050565b6000611098827f01ffc9a7000000000000000000000000000000000000000000000000000000006110d0565b8015610e0957506110c9827fffffffff000000000000000000000000000000000000000000000000000000006110d0565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790529051600091908290819073ffffffffffffffffffffffffffffffffffffffff8716906175309061118a908690611874565b6000604051808303818686fa925050503d80600081146111c6576040519150601f19603f3d011682016040523d82523d6000602084013e6111cb565b606091505b50915091506020815110156111e65760009350505050610e09565b81801561120257508080602001905181019061120291906118e7565b9695505050505050565b508054611218906116c7565b6000825580601f10611228575050565b601f01602090049060005260206000209081019061070491906112d7565b828054611252906116c7565b90600052602060002090601f01602090048101928261127457600085556112ba565b82601f1061128d57805160ff19168380011785556112ba565b828001600101855582156112ba579182015b828111156112ba57825182559160200191906001019061129f565b506112c69291506112d7565b5090565b61040f8061190a83390190565b5b808211156112c657600081556001016112d8565b6000602082840312156112fe57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561133d57835183529284019291840191600101611321565b50909695505050505050565b60006020828403121561135b57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461106557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156113f5576113f561137f565b604052919050565b600082601f83011261140e57600080fd5b813567ffffffffffffffff8111156114285761142861137f565b61145960207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016113ae565b81815284602083860101111561146e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561149e57600080fd5b82359150602083013567ffffffffffffffff8111156114bc57600080fd5b6114c8858286016113fd565b9150509250929050565b6000604082840312156114e457600080fd5b50919050565b600080606083850312156114fd57600080fd5b8235915061150e84602085016114d2565b90509250929050565b60006020828403121561152957600080fd5b813567ffffffffffffffff81111561154057600080fd5b61154c848285016113fd565b949350505050565b60005b8381101561156f578181015183820152602001611557565b8381111561157e576000848401525b50505050565b6000815180845261159c816020860160208601611554565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006110656020830184611584565b6000604082840312156115f357600080fd5b61106583836114d2565b6000806040838503121561161057600080fd5b505080516020909101519092909150565b6000602080838503121561163457600080fd5b825167ffffffffffffffff8082111561164c57600080fd5b818501915085601f83011261166057600080fd5b8151818111156116725761167261137f565b8060051b91506116838483016113ae565b818152918301840191848101908884111561169d57600080fd5b938501935b838510156116bb578451825293850193908501906116a2565b98975050505050505050565b600181811c908216806116db57607f821691505b6020821081036114e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080835481600182811c91508083168061173057607f831692505b60208084108203611768577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b81801561177c57600181146117ab576117d8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008616895284890196506117d8565b60008a81526020902060005b868110156117d05781548b8201529085019083016117b7565b505084890196505b509498975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361186d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60008251611886818460208701611554565b9190910192915050565b82815260406020820152600061154c6040830184611584565b73ffffffffffffffffffffffffffffffffffffffff841681528260208201526060604082015260006118de6060830184611584565b95945050505050565b6000602082840312156118f957600080fd5b8151801515811461106557600080fdfe608060405234801561001057600080fd5b506103ef806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634cc82215116100505780634cc822151461009f578063949d225d146100b2578063cccf7a8e146100c357600080fd5b80631003e2d21461006c578063410d59cc14610081575b600080fd5b61007f61007a3660046102e9565b6100e6565b005b610089610138565b6040516100969190610302565b60405180910390f35b61007f6100ad3660046102e9565b610190565b600054604051908152602001610096565b6100d66100d13660046102e9565b610286565b6040519015158152602001610096565b6100ef81610286565b156100f75750565b600080548282526001602081905260408320829055810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630155565b6060600080548060200260200160405190810160405280929190818152602001828054801561018657602002820191906000526020600020905b815481526020019060010190808311610172575b5050505050905090565b61019981610286565b6101a05750565b600080546101b090600190610346565b815481106101c0576101c0610384565b906000526020600020015460006001600084815260200190815260200160002054815481106101f1576101f1610384565b6000918252602080832090910192909255828152600191829052604081205481549092919081908490811061022857610228610384565b90600052602060002001548152602001908152602001600020819055506001600082815260200190815260200160002060009055600080548061026d5761026d6103b3565b6001900381819060005260206000200160009055905550565b60008054810361029857506000919050565b60008281526001602052604081205490036102d45781600080815481106102c1576102c1610384565b9060005260206000200154149050919050565b50600090815260016020526040902054151590565b6000602082840312156102fb57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561033a5783518352928401929184019160010161031e565b50909695505050505050565b60008282101561037f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea164736f6c634300080d000aa164736f6c634300080d000a608060405234801561001057600080fd5b506103ef806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634cc82215116100505780634cc822151461009f578063949d225d146100b2578063cccf7a8e146100c357600080fd5b80631003e2d21461006c578063410d59cc14610081575b600080fd5b61007f61007a3660046102e9565b6100e6565b005b610089610138565b6040516100969190610302565b60405180910390f35b61007f6100ad3660046102e9565b610190565b600054604051908152602001610096565b6100d66100d13660046102e9565b610286565b6040519015158152602001610096565b6100ef81610286565b156100f75750565b600080548282526001602081905260408320829055810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630155565b6060600080548060200260200160405190810160405280929190818152602001828054801561018657602002820191906000526020600020905b815481526020019060010190808311610172575b5050505050905090565b61019981610286565b6101a05750565b600080546101b090600190610346565b815481106101c0576101c0610384565b906000526020600020015460006001600084815260200190815260200160002054815481106101f1576101f1610384565b6000918252602080832090910192909255828152600191829052604081205481549092919081908490811061022857610228610384565b90600052602060002001548152602001908152602001600020819055506001600082815260200190815260200160002060009055600080548061026d5761026d6103b3565b6001900381819060005260206000200160009055905550565b60008054810361029857506000919050565b60008281526001602052604081205490036102d45781600080815481106102c1576102c1610384565b9060005260206000200154149050919050565b50600090815260016020526040902054151590565b6000602082840312156102fb57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561033a5783518352928401929184019160010161031e565b50909695505050505050565b60008282101561037f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea164736f6c634300080d000a", + "sourceMap": "222:629:42:-:0;;;266:46;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;557:5:16;:14;;-1:-1:-1;;;;;;557:14:16;-1:-1:-1;;;;;557:14:16;;;;;;;;;;577:31;617:4;624:7;172:46:42;;316:76;624:7:16;577:55;;-1:-1:-1;;;;;;577:55:16;;;;;;;-1:-1:-1;;;;;501:32:85;;;577:55:16;;;483:51:85;550:18;;;543:34;456:18;;577:55:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;649:9;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;638:8:16;:20;;-1:-1:-1;;;;;638:20:16;;;;-1:-1:-1;;;;;;638:20:16;;;;;;;664:18;;;;;672:10;664:18;;;-1:-1:-1;222:629:42;;-1:-1:-1;222:629:42;;;;;;;;;:::o;14:290:85:-;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:85;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:85:o;309:274::-;222:629:42;;;;;;", + "linkReferences": {} + }, + "deployedBytecode": { + "object": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063b8bc073d11610066578063b8bc073d1461022b578063cccf7a8e1461024b578063f2fde38b1461026e578063fd4ab6d81461028157600080fd5b80638da5cb5b146101ca578063ab9dbd07146101ea578063b361be461461021857600080fd5b80634cc82215116100c85780634cc822151461017c57806375c0669c146101915780638b282947146101a45780638bbf68fe146101b757600080fd5b80630ff4c916146100ef57806330b67baa1461012257806331b933b914610167575b600080fd5b6101026100fd3660046112ec565b610294565b604080518251815260209283015192810192909252015b60405180910390f35b6000546101429073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610119565b61016f6102e1565b6040516101199190611305565b61018f61018a3660046112ec565b61039c565b005b61018f61019f366004611349565b610707565b61018f6101b236600461148b565b61088f565b61018f6101c53660046114ea565b610c92565b6001546101429073ffffffffffffffffffffffffffffffffffffffff1681565b6040517ff2b6dccd2b727ad73194b365dd7ad2c6b1e96e25269352f5a0a3b0fa694445e28152602001610119565b61016f610226366004611517565b610cd1565b61023e6102393660046112ec565b610e0f565b60405161011991906115ce565b61025e6102593660046112ec565b610eb1565b6040519015158152602001610119565b61018f61027c366004611349565b610f45565b61016f61028f3660046115e1565b61100d565b60408051808201909152600080825260208201526000806102b484610e0f565b8060200190518101906102c791906115fd565b604080518082019091529182526020820152949350505050565b600254604080517f410d59cc000000000000000000000000000000000000000000000000000000008152905160609273ffffffffffffffffffffffffffffffffffffffff169163410d59cc9160048083019260009291908290030181865afa158015610351573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526103979190810190611621565b905090565b60015473ffffffffffffffffffffffffffffffffffffffff163314610422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e45520000000000000000000000000060448201526064015b60405180910390fd5b600081815260046020526040808220905160039161043f91611714565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff16146107045760008181526004602052604090819020905160039161048891611714565b908152604051908190036020018120547f4cc8221500000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff1690634cc82215906104ea90849060040190815260200190565b600060405180830381600087803b15801561050457600080fd5b505af1158015610518573d6000803e3d6000fd5b50506002546040517f4cc822150000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff9091169250634cc822159150602401600060405180830381600087803b15801561058857600080fd5b505af115801561059c573d6000803e3d6000fd5b50505060008281526004602052604081206105b892509061120c565b60005b60055481101561067857600581815481106105d8576105d86117e6565b6000918252602090912001546040517f4cc822150000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690634cc8221590602401600060405180830381600087803b15801561064d57600080fd5b505af1158015610661573d6000803e3d6000fd5b50505050808061067090611815565b9150506105bb565b506000546040517fd803064a0000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff9091169063d803064a90604401600060405180830381600087803b1580156106eb57600080fd5b505af11580156106ff573d6000803e3d6000fd5b505050505b50565b60015473ffffffffffffffffffffffffffffffffffffffff163314610788576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b6107b2817f4ede9a2d00000000000000000000000000000000000000000000000000000000611049565b610818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f476976656e2061646472657373206973206e6f7420616e20696e64657865722e6044820152606401610419565b600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610910576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b6002546040517f1003e2d20000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690631003e2d290602401600060405180830381600087803b15801561097c57600080fd5b505af1158015610990573d6000803e3d6000fd5b505050600083815260046020908152604090912083516109b593509091840190611246565b50600073ffffffffffffffffffffffffffffffffffffffff166003826040516109de9190611874565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610a9757604051610a15906112ca565b604051809103906000f080158015610a31573d6000803e3d6000fd5b50600382604051610a429190611874565b908152604051908190036020019020805473ffffffffffffffffffffffffffffffffffffffff929092167fffffffffffffffffffffffff00000000000000000000000000000000000000009092169190911790555b600381604051610aa79190611874565b908152604051908190036020018120547f1003e2d200000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff1690631003e2d290610b0990859060040190815260200190565b600060405180830381600087803b158015610b2357600080fd5b505af1158015610b37573d6000803e3d6000fd5b5050505060005b600554811015610c015760058181548110610b5b57610b5b6117e6565b6000918252602090912001546040517f0216b83800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690630216b83890610bbc9086908690600401611890565b600060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050508080610bf990611815565b915050610b3e565b506000546040517faf104e4000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063af104e4090610c5c903090869086906004016118a9565b600060405180830381600087803b158015610c7657600080fd5b505af1158015610c8a573d6000803e3d6000fd5b505050505050565b610ccd8282604051602001610cb99190813581526020918201359181019190915260400190565b60405160208183030381529060405261088f565b5050565b6060600073ffffffffffffffffffffffffffffffffffffffff16600383604051610cfb9190611874565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610d3a57505060408051600081526020810190915290565b600382604051610d4a9190611874565b90815260408051918290036020018220547f410d59cc000000000000000000000000000000000000000000000000000000008352905173ffffffffffffffffffffffffffffffffffffffff9091169163410d59cc9160048083019260009291908290030181865afa158015610dc3573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610e099190810190611621565b92915050565b6000818152600460205260409020805460609190610e2c906116c7565b80601f0160208091040260200160405190810160405280929190818152602001828054610e58906116c7565b8015610ea55780601f10610e7a57610100808354040283529160200191610ea5565b820191906000526020600020905b815481529060010190602001808311610e8857829003601f168201915b50505050509050919050565b6002546040517fcccf7a8e0000000000000000000000000000000000000000000000000000000081526004810183905260009173ffffffffffffffffffffffffffffffffffffffff169063cccf7a8e90602401602060405180830381865afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0991906118e7565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060610e09826040516020016110359190813581526020918201359181019190915260400190565b604051602081830303815290604052610cd1565b60006110548361106c565b8015611065575061106583836110d0565b9392505050565b6000611098827f01ffc9a7000000000000000000000000000000000000000000000000000000006110d0565b8015610e0957506110c9827fffffffff000000000000000000000000000000000000000000000000000000006110d0565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790529051600091908290819073ffffffffffffffffffffffffffffffffffffffff8716906175309061118a908690611874565b6000604051808303818686fa925050503d80600081146111c6576040519150601f19603f3d011682016040523d82523d6000602084013e6111cb565b606091505b50915091506020815110156111e65760009350505050610e09565b81801561120257508080602001905181019061120291906118e7565b9695505050505050565b508054611218906116c7565b6000825580601f10611228575050565b601f01602090049060005260206000209081019061070491906112d7565b828054611252906116c7565b90600052602060002090601f01602090048101928261127457600085556112ba565b82601f1061128d57805160ff19168380011785556112ba565b828001600101855582156112ba579182015b828111156112ba57825182559160200191906001019061129f565b506112c69291506112d7565b5090565b61040f8061190a83390190565b5b808211156112c657600081556001016112d8565b6000602082840312156112fe57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561133d57835183529284019291840191600101611321565b50909695505050505050565b60006020828403121561135b57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461106557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156113f5576113f561137f565b604052919050565b600082601f83011261140e57600080fd5b813567ffffffffffffffff8111156114285761142861137f565b61145960207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016113ae565b81815284602083860101111561146e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561149e57600080fd5b82359150602083013567ffffffffffffffff8111156114bc57600080fd5b6114c8858286016113fd565b9150509250929050565b6000604082840312156114e457600080fd5b50919050565b600080606083850312156114fd57600080fd5b8235915061150e84602085016114d2565b90509250929050565b60006020828403121561152957600080fd5b813567ffffffffffffffff81111561154057600080fd5b61154c848285016113fd565b949350505050565b60005b8381101561156f578181015183820152602001611557565b8381111561157e576000848401525b50505050565b6000815180845261159c816020860160208601611554565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006110656020830184611584565b6000604082840312156115f357600080fd5b61106583836114d2565b6000806040838503121561161057600080fd5b505080516020909101519092909150565b6000602080838503121561163457600080fd5b825167ffffffffffffffff8082111561164c57600080fd5b818501915085601f83011261166057600080fd5b8151818111156116725761167261137f565b8060051b91506116838483016113ae565b818152918301840191848101908884111561169d57600080fd5b938501935b838510156116bb578451825293850193908501906116a2565b98975050505050505050565b600181811c908216806116db57607f821691505b6020821081036114e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080835481600182811c91508083168061173057607f831692505b60208084108203611768577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b81801561177c57600181146117ab576117d8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008616895284890196506117d8565b60008a81526020902060005b868110156117d05781548b8201529085019083016117b7565b505084890196505b509498975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361186d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60008251611886818460208701611554565b9190910192915050565b82815260406020820152600061154c6040830184611584565b73ffffffffffffffffffffffffffffffffffffffff841681528260208201526060604082015260006118de6060830184611584565b95945050505050565b6000602082840312156118f957600080fd5b8151801515811461106557600080fdfe608060405234801561001057600080fd5b506103ef806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634cc82215116100505780634cc822151461009f578063949d225d146100b2578063cccf7a8e146100c357600080fd5b80631003e2d21461006c578063410d59cc14610081575b600080fd5b61007f61007a3660046102e9565b6100e6565b005b610089610138565b6040516100969190610302565b60405180910390f35b61007f6100ad3660046102e9565b610190565b600054604051908152602001610096565b6100d66100d13660046102e9565b610286565b6040519015158152602001610096565b6100ef81610286565b156100f75750565b600080548282526001602081905260408320829055810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630155565b6060600080548060200260200160405190810160405280929190818152602001828054801561018657602002820191906000526020600020905b815481526020019060010190808311610172575b5050505050905090565b61019981610286565b6101a05750565b600080546101b090600190610346565b815481106101c0576101c0610384565b906000526020600020015460006001600084815260200190815260200160002054815481106101f1576101f1610384565b6000918252602080832090910192909255828152600191829052604081205481549092919081908490811061022857610228610384565b90600052602060002001548152602001908152602001600020819055506001600082815260200190815260200160002060009055600080548061026d5761026d6103b3565b6001900381819060005260206000200160009055905550565b60008054810361029857506000919050565b60008281526001602052604081205490036102d45781600080815481106102c1576102c1610384565b9060005260206000200154149050919050565b50600090815260016020526040902054151590565b6000602082840312156102fb57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561033a5783518352928401929184019160010161031e565b50909695505050505050565b60008282101561037f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea164736f6c634300080d000aa164736f6c634300080d000a", + "sourceMap": "222:629:42:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;502:186;;;;;;:::i;:::-;;:::i;:::-;;;;417:13:85;;399:32;;487:4;475:17;;;469:24;447:20;;;440:54;;;;372:18;502:186:42;;;;;;;;307:20:16;;;;;;;;;;;;681:42:85;669:55;;;651:74;;639:2;624:18;307:20:16;505:226:85;2442:99:16;;;:::i;:::-;;;;;;;:::i;1539:643::-;;;;;;:::i;:::-;;:::i;:::-;;2833:261;;;;;;:::i;:::-;;:::i;953:582::-;;;;;;:::i;:::-;;:::i;396:102:42:-;;;;;;:::i;:::-;;:::i;331:20:16:-;;;;;;;;;316:76:42;;;172:46;3823:25:85;;3811:2;3796:18;316:76:42;3677:177:85;2545:284:16;;;;;;:::i;:::-;;:::i;2284:154::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;2186:94::-;;;;;;:::i;:::-;;:::i;:::-;;;5155:14:85;;5148:22;5130:41;;5118:2;5103:18;2186:94:16;4990:187:85;793:97:16;;;;;;:::i;:::-;;:::i;692:157:42:-;;;;;;:::i;:::-;;:::i;502:186::-;-1:-1:-1;;;;;;;;;;;;;;;;;581:9:42;592;616:19;628:6;616:11;:19::i;:::-;605:51;;;;;;;;;;;;:::i;:::-;669:14;;;;;;;;;;;;;;;;;502:186;-1:-1:-1;;;;502:186:42:o;2442:99:16:-;2517:8;;:19;;;;;;;;2486:16;;2517:8;;;:17;;:19;;;;;:8;;:19;;;;;;;:8;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2510:26;;2442:99;:::o;1539:643::-;748:5;;;;734:10;:19;726:51;;;;;;;6821:2:85;726:51:16;;;6803:21:85;6860:2;6840:18;;;6833:30;6899:21;6879:18;;;6872:49;6938:18;;726:51:16;;;;;;;;;1709:1:::1;1675:21:::0;;;:13:::1;:21;::::0;;;;;1659:38;;:15:::1;::::0;:38:::1;::::0;::::1;:::i;:::-;::::0;;;::::1;::::0;;;;;::::1;::::0;;;;::::1;;1655:65:::0;1713:7:::1;1655:65;1796:21;::::0;;;:13:::1;:21;::::0;;;;;;1780:38;;:15:::1;::::0;:38:::1;::::0;::::1;:::i;:::-;::::0;;;::::1;::::0;;;;;::::1;::::0;;;;1776:58;;;1780:38:::1;;::::0;1776:50:::1;::::0;:58:::1;::::0;1827:6;;1776:58:::1;;3823:25:85::0;;;3811:2;3796:18;;3677:177;1776:58:16::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;1887:8:16::1;::::0;:23:::1;::::0;;;;::::1;::::0;::::1;3823:25:85::0;;;1887:8:16::1;::::0;;::::1;::::0;-1:-1:-1;1887:15:16::1;::::0;-1:-1:-1;3796:18:85;;1887:23:16::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;;1966:21:16::1;::::0;;;:13:::1;:21;::::0;;;;1959:28:::1;::::0;-1:-1:-1;1966:21:16;1959:28:::1;:::i;:::-;1999:9;1994:87;2018:8;:15:::0;2014:19;::::1;1994:87;;;2048:8;2057:1;2048:11;;;;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;::::1;::::0;:26:::1;::::0;;;;::::1;::::0;::::1;3823:25:85::0;;;2048:11:16::1;::::0;;::::1;::::0;:18:::1;::::0;3796::85;;2048:26:16::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;2035:3;;;;;:::i;:::-;;;;1994:87;;;-1:-1:-1::0;2118:5:16::1;::::0;2112:65:::1;::::0;;;;2163:4:::1;2112:65;::::0;::::1;9467:74:85::0;9557:18;;;9550:34;;;2118:5:16::1;::::0;;::::1;::::0;2112:42:::1;::::0;9440:18:85;;2112:65:16::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;783:1;1539:643:::0;:::o;2833:261::-;748:5;;;;734:10;:19;726:51;;;;;;;6821:2:85;726:51:16;;;6803:21:85;6860:2;6840:18;;;6833:30;6899:21;6879:18;;;6872:49;6938:18;;726:51:16;6619:343:85;726:51:16;2923:74:::1;2955:7;2964:32;2923:31;:74::i;:::-;2908:137;;;::::0;::::1;::::0;;9797:2:85;2908:137:16::1;::::0;::::1;9779:21:85::0;;;9816:18;;;9809:30;9875:34;9855:18;;;9848:62;9927:18;;2908:137:16::1;9595:356:85::0;2908:137:16::1;3051:8;:38:::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;3051:38:16;;;;;::::1;::::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;2833:261::o;953:582::-;748:5;;;;734:10;:19;726:51;;;;;;;6821:2:85;726:51:16;;;6803:21:85;6860:2;6840:18;;;6833:30;6899:21;6879:18;;;6872:49;6938:18;;726:51:16;6619:343:85;726:51:16;1057:8:::1;::::0;:20:::1;::::0;;;;::::1;::::0;::::1;3823:25:85::0;;;1057:8:16::1;::::0;;::::1;::::0;:12:::1;::::0;3796:18:85;;1057:20:16::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;;1117:21:16::1;::::0;;;:13:::1;:21;::::0;;;;;;;:29;;::::1;::::0;-1:-1:-1;1117:21:16;;:29;::::1;::::0;::::1;:::i;:::-;;1224:1;1190:36;;:15;1206:5;1190:22;;;;;;:::i;:::-;::::0;;;::::1;::::0;;;;;::::1;::::0;;;;::::1;;:36:::0;1186:100:::1;;1269:9;;;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;1236:15;1252:5;1236:22;;;;;;:::i;:::-;::::0;;;::::1;::::0;;;;;::::1;::::0;;;:43;;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;1186:100:::1;1295:15;1311:5;1295:22;;;;;;:::i;:::-;::::0;;;::::1;::::0;;;;;::::1;::::0;;;;1291:39;;;1295:22:::1;;::::0;1291:31:::1;::::0;:39:::1;::::0;1323:6;;1291:39:::1;;3823:25:85::0;;;3811:2;3796:18;;3677:177;1291:39:16::1;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;1342:9;1337:94;1361:8;:15:::0;1357:19;::::1;1337:94;;;1391:8;1400:1;1391:11;;;;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;::::1;::::0;:33:::1;::::0;;;;:11:::1;::::0;;::::1;::::0;:18:::1;::::0;:33:::1;::::0;1410:6;;1418:5;;1391:33:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;1378:3;;;;;:::i;:::-;;;;1337:94;;;-1:-1:-1::0;1468:5:16::1;::::0;1462:68:::1;::::0;;;;1468:5:::1;::::0;;::::1;::::0;1462:38:::1;::::0;:68:::1;::::0;1509:4:::1;::::0;1516:6;;1524:5;;1462:68:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;953:582:::0;;:::o;396:102:42:-;463:30;467:6;486:5;475:17;;;;;;;11161:20:85;;11143:39;;11245:4;11233:17;;;11220:31;11198:20;;;11191:61;;;;11131:2;11116:18;;10941:317;475:17:42;;;;;;;;;;;;;463:3;:30::i;:::-;396:102;;:::o;2545:284:16:-;2616:16;2678:1;2644:36;;:15;2660:5;2644:22;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;:36;2640:80;;-1:-1:-1;;2697:16:16;;;2711:1;2697:16;;;;;;;;;2545:284::o;2640:80::-;2790:15;2806:5;2790:22;;;;;;:::i;:::-;;;;;;;;;;;;;;;;2786:38;;;;;2790:22;;;;;2786:36;;:38;;;;;2790:22;;2786:38;;;;;;;2790:22;2786:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2779:45;2545:284;-1:-1:-1;;2545:284:16:o;2284:154::-;2412:21;;;;:13;:21;;;;;2405:28;;2342:12;;2412:21;2405:28;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2284:154;;;:::o;2186:94::-;2255:8;;:20;;;;;;;;3823:25:85;;;2236:4:16;;2255:8;;;:12;;3796:18:85;;2255:20:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;793:97::-;748:5;;;;734:10;:19;726:51;;;;;;;6821:2:85;726:51:16;;;6803:21:85;6860:2;6840:18;;;6833:30;6899:21;6879:18;;;6872:49;6938:18;;726:51:16;6619:343:85;726:51:16;869:5:::1;:16:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;793:97::o;692:157:42:-;771:16;802:42;834:8;823:20;;;;;;;11161::85;;11143:39;;11245:4;11233:17;;;11220:31;11198:20;;;11191:61;;;;11131:2;11116:18;;10941:317;823:20:42;;;;;;;;;;;;;802;:42::i;1318:274:30:-;1405:4;1512:23;1527:7;1512:14;:23::i;:::-;:73;;;;;1539:46;1564:7;1573:11;1539:24;:46::i;:::-;1505:80;1318:274;-1:-1:-1;;;1318:274:30:o;689:411::-;753:4;960:60;985:7;994:25;960:24;:60::i;:::-;:133;;;;-1:-1:-1;1037:56:30;1062:7;1071:21;1037:24;:56::i;:::-;1036:57;941:152;689:411;-1:-1:-1;;689:411:30:o;4208:409::-;4346:71;;;11719:66:85;11707:79;;4346:71:30;;;;11689:98:85;;;;4346:71:30;;;;;;;;;;11662:18:85;;;;4346:71:30;;;;;;;;;4369:34;4346:71;;;4465:45;;4301:4;;4346:71;4301:4;;;;4465:18;;;;4489:5;;4465:45;;4346:71;;4465:45;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4427:83;;;;4540:2;4524:6;:13;:18;4520:36;;;4551:5;4544:12;;;;;;;4520:36;4573:7;:37;;;;;4595:6;4584:26;;;;;;;;;;;;:::i;:::-;4566:44;4208:409;-1:-1:-1;;;;;;4208:409:30:o;-1:-1:-1:-;;;;;;;:::i;:::-;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;14:180:85;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;-1:-1:-1;165:23:85;;14:180;-1:-1:-1;14:180:85:o;736:632::-;907:2;959:21;;;1029:13;;932:18;;;1051:22;;;878:4;;907:2;1130:15;;;;1104:2;1089:18;;;878:4;1173:169;1187:6;1184:1;1181:13;1173:169;;;1248:13;;1236:26;;1317:15;;;;1282:12;;;;1209:1;1202:9;1173:169;;;-1:-1:-1;1359:3:85;;736:632;-1:-1:-1;;;;;;736:632:85:o;1373:309::-;1432:6;1485:2;1473:9;1464:7;1460:23;1456:32;1453:52;;;1501:1;1498;1491:12;1453:52;1540:9;1527:23;1590:42;1583:5;1579:54;1572:5;1569:65;1559:93;;1648:1;1645;1638:12;1687:184;1739:77;1736:1;1729:88;1836:4;1833:1;1826:15;1860:4;1857:1;1850:15;1876:334;1947:2;1941:9;2003:2;1993:13;;2008:66;1989:86;1977:99;;2106:18;2091:34;;2127:22;;;2088:62;2085:88;;;2153:18;;:::i;:::-;2189:2;2182:22;1876:334;;-1:-1:-1;1876:334:85:o;2215:589::-;2257:5;2310:3;2303:4;2295:6;2291:17;2287:27;2277:55;;2328:1;2325;2318:12;2277:55;2364:6;2351:20;2390:18;2386:2;2383:26;2380:52;;;2412:18;;:::i;:::-;2456:114;2564:4;2495:66;2488:4;2484:2;2480:13;2476:86;2472:97;2456:114;:::i;:::-;2595:2;2586:7;2579:19;2641:3;2634:4;2629:2;2621:6;2617:15;2613:26;2610:35;2607:55;;;2658:1;2655;2648:12;2607:55;2723:2;2716:4;2708:6;2704:17;2697:4;2688:7;2684:18;2671:55;2771:1;2746:16;;;2764:4;2742:27;2735:38;;;;2750:7;2215:589;-1:-1:-1;;;2215:589:85:o;2809:388::-;2886:6;2894;2947:2;2935:9;2926:7;2922:23;2918:32;2915:52;;;2963:1;2960;2953:12;2915:52;2999:9;2986:23;2976:33;;3060:2;3049:9;3045:18;3032:32;3087:18;3079:6;3076:30;3073:50;;;3119:1;3116;3109:12;3073:50;3142:49;3183:7;3174:6;3163:9;3159:22;3142:49;:::i;:::-;3132:59;;;2809:388;;;;;:::o;3202:156::-;3263:5;3308:2;3299:6;3294:3;3290:16;3286:25;3283:45;;;3324:1;3321;3314:12;3283:45;-1:-1:-1;3346:6:85;3202:156;-1:-1:-1;3202:156:85:o;3363:309::-;3460:6;3468;3521:2;3509:9;3500:7;3496:23;3492:32;3489:52;;;3537:1;3534;3527:12;3489:52;3573:9;3560:23;3550:33;;3602:64;3658:7;3653:2;3642:9;3638:18;3602:64;:::i;:::-;3592:74;;3363:309;;;;;:::o;3859:320::-;3927:6;3980:2;3968:9;3959:7;3955:23;3951:32;3948:52;;;3996:1;3993;3986:12;3948:52;4036:9;4023:23;4069:18;4061:6;4058:30;4055:50;;;4101:1;4098;4091:12;4055:50;4124:49;4165:7;4156:6;4145:9;4141:22;4124:49;:::i;:::-;4114:59;3859:320;-1:-1:-1;;;;3859:320:85:o;4184:258::-;4256:1;4266:113;4280:6;4277:1;4274:13;4266:113;;;4356:11;;;4350:18;4337:11;;;4330:39;4302:2;4295:10;4266:113;;;4397:6;4394:1;4391:13;4388:48;;;4432:1;4423:6;4418:3;4414:16;4407:27;4388:48;;4184:258;;;:::o;4447:316::-;4488:3;4526:5;4520:12;4553:6;4548:3;4541:19;4569:63;4625:6;4618:4;4613:3;4609:14;4602:4;4595:5;4591:16;4569:63;:::i;:::-;4677:2;4665:15;4682:66;4661:88;4652:98;;;;4752:4;4648:109;;4447:316;-1:-1:-1;;4447:316:85:o;4768:217::-;4915:2;4904:9;4897:21;4878:4;4935:44;4975:2;4964:9;4960:18;4952:6;4935:44;:::i;5182:241::-;5270:6;5323:2;5311:9;5302:7;5298:23;5294:32;5291:52;;;5339:1;5336;5329:12;5291:52;5362:55;5409:7;5398:9;5362:55;:::i;5428:245::-;5507:6;5515;5568:2;5556:9;5547:7;5543:23;5539:32;5536:52;;;5584:1;5581;5574:12;5536:52;-1:-1:-1;;5607:16:85;;5663:2;5648:18;;;5642:25;5607:16;;5642:25;;-1:-1:-1;5428:245:85:o;5678:936::-;5773:6;5804:2;5847;5835:9;5826:7;5822:23;5818:32;5815:52;;;5863:1;5860;5853:12;5815:52;5896:9;5890:16;5925:18;5966:2;5958:6;5955:14;5952:34;;;5982:1;5979;5972:12;5952:34;6020:6;6009:9;6005:22;5995:32;;6065:7;6058:4;6054:2;6050:13;6046:27;6036:55;;6087:1;6084;6077:12;6036:55;6116:2;6110:9;6138:2;6134;6131:10;6128:36;;;6144:18;;:::i;:::-;6190:2;6187:1;6183:10;6173:20;;6213:28;6237:2;6233;6229:11;6213:28;:::i;:::-;6275:15;;;6345:11;;;6341:20;;;6306:12;;;;6373:19;;;6370:39;;;6405:1;6402;6395:12;6370:39;6429:11;;;;6449:135;6465:6;6460:3;6457:15;6449:135;;;6531:10;;6519:23;;6482:12;;;;6562;;;;6449:135;;;6603:5;5678:936;-1:-1:-1;;;;;;;;5678:936:85:o;6967:437::-;7046:1;7042:12;;;;7089;;;7110:61;;7164:4;7156:6;7152:17;7142:27;;7110:61;7217:2;7209:6;7206:14;7186:18;7183:38;7180:218;;7254:77;7251:1;7244:88;7355:4;7352:1;7345:15;7383:4;7380:1;7373:15;7534:1211;7660:3;7689:1;7722:6;7716:13;7752:3;7774:1;7802:9;7798:2;7794:18;7784:28;;7862:2;7851:9;7847:18;7884;7874:61;;7928:4;7920:6;7916:17;7906:27;;7874:61;7954:2;8002;7994:6;7991:14;7971:18;7968:38;7965:222;;8041:77;8036:3;8029:90;8142:4;8139:1;8132:15;8172:4;8167:3;8160:17;7965:222;8203:18;8230:162;;;;8406:1;8401:319;;;;8196:524;;8230:162;8278:66;8267:9;8263:82;8258:3;8251:95;8375:6;8370:3;8366:16;8359:23;;8230:162;;8401:319;7481:1;7474:14;;;7518:4;7505:18;;8495:1;8509:165;8523:6;8520:1;8517:13;8509:165;;;8601:14;;8588:11;;;8581:35;8644:16;;;;8538:10;;8509:165;;;8513:3;;8703:6;8698:3;8694:16;8687:23;;8196:524;-1:-1:-1;8736:3:85;;7534:1211;-1:-1:-1;;;;;;;;7534:1211:85:o;8750:184::-;8802:77;8799:1;8792:88;8899:4;8896:1;8889:15;8923:4;8920:1;8913:15;8939:349;8978:3;9009:66;9002:5;8999:77;8996:257;;9109:77;9106:1;9099:88;9210:4;9207:1;9200:15;9238:4;9235:1;9228:15;8996:257;-1:-1:-1;9280:1:85;9269:13;;8939:349::o;9956:274::-;10085:3;10123:6;10117:13;10139:53;10185:6;10180:3;10173:4;10165:6;10161:17;10139:53;:::i;:::-;10208:16;;;;;9956:274;-1:-1:-1;;9956:274:85:o;10235:288::-;10410:6;10399:9;10392:25;10453:2;10448;10437:9;10433:18;10426:30;10373:4;10473:44;10513:2;10502:9;10498:18;10490:6;10473:44;:::i;10528:408::-;10743:42;10735:6;10731:55;10720:9;10713:74;10823:6;10818:2;10807:9;10803:18;10796:34;10866:2;10861;10850:9;10846:18;10839:30;10694:4;10886:44;10926:2;10915:9;10911:18;10903:6;10886:44;:::i;:::-;10878:52;10528:408;-1:-1:-1;;;;;10528:408:85:o;11263:277::-;11330:6;11383:2;11371:9;11362:7;11358:23;11354:32;11351:52;;;11399:1;11396;11389:12;11351:52;11431:9;11425:16;11484:5;11477:13;11470:21;11463:5;11460:32;11450:60;;11506:1;11503;11496:12", + "linkReferences": {} + }, + "ast": { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/src/components/PositionComponent.sol", + "exportedSymbols": { + "Component": [ + 11026 + ], + "ERC165Checker": [ + 22341 + ], + "ID": [ + 23693 + ], + "IERC165": [ + 22353 + ], + "IEntityIndexer": [ + 38545 + ], + "Position": [ + 23685 + ], + "PositionComponent": [ + 23778 + ], + "Set": [ + 38526 + ], + "World": [ + 11262 + ] + }, + "id": 23779, + "license": "Unlicense", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 23679, + "literals": [ + "solidity", + ">=", + "0.8", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "38:24:42" + }, + { + "absolutePath": "/Users/flomllr/git/latticexyz/mud/packages/ri/contracts/../../../node_modules/@mud/solecs/src/Component.sol", + "file": "solecs/Component.sol", + "id": 23680, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 23779, + "sourceUnit": 11027, + "src": "63:30:42", + "symbolAliases": [], + "unitAlias": "" + }, + { + "canonicalName": "Position", + "id": 23685, + "members": [ + { + "constant": false, + "id": 23682, + "mutability": "mutable", + "name": "x", + "nameLocation": "123:1:42", + "nodeType": "VariableDeclaration", + "scope": 23685, + "src": "115:9:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23681, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "115:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 23684, + "mutability": "mutable", + "name": "y", + "nameLocation": "136:1:42", + "nodeType": "VariableDeclaration", + "scope": 23685, + "src": "128:9:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23683, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "128:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "name": "Position", + "nameLocation": "102:8:42", + "nodeType": "StructDefinition", + "scope": 23779, + "src": "95:45:42", + "visibility": "public" + }, + { + "constant": true, + "id": 23693, + "mutability": "constant", + "name": "ID", + "nameLocation": "159:2:42", + "nodeType": "VariableDeclaration", + "scope": 23779, + "src": "142:77:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23686, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "142:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "656d6265722e636f6d706f6e656e742e706f736974696f6e436f6d706f6e656e74", + "id": 23690, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "182:35:42", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f2b6dccd2b727ad73194b365dd7ad2c6b1e96e25269352f5a0a3b0fa694445e2", + "typeString": "literal_string \"ember.component.positionComponent\"" + }, + "value": "ember.component.positionComponent" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f2b6dccd2b727ad73194b365dd7ad2c6b1e96e25269352f5a0a3b0fa694445e2", + "typeString": "literal_string \"ember.component.positionComponent\"" + } + ], + "id": 23689, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "172:9:42", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 23691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "172:46:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 23688, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "164:7:42", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 23687, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "164:7:42", + "typeDescriptions": {} + } + }, + "id": 23692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "164:55:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 23694, + "name": "Component", + "nodeType": "IdentifierPath", + "referencedDeclaration": 11026, + "src": "252:9:42" + }, + "id": 23695, + "nodeType": "InheritanceSpecifier", + "src": "252:9:42" + } + ], + "canonicalName": "PositionComponent", + "contractDependencies": [ + 38526 + ], + "contractKind": "contract", + "fullyImplemented": true, + "id": 23778, + "linearizedBaseContracts": [ + 23778, + 11026 + ], + "name": "PositionComponent", + "nameLocation": "231:17:42", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 23703, + "nodeType": "Block", + "src": "310:2:42", + "statements": [] + }, + "id": 23704, + "implemented": true, + "kind": "constructor", + "modifiers": [ + { + "arguments": [ + { + "id": 23700, + "name": "world", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23697, + "src": "303:5:42", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 23701, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 23699, + "name": "Component", + "nodeType": "IdentifierPath", + "referencedDeclaration": 11026, + "src": "293:9:42" + }, + "nodeType": "ModifierInvocation", + "src": "293:16:42" + } + ], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 23698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 23697, + "mutability": "mutable", + "name": "world", + "nameLocation": "286:5:42", + "nodeType": "VariableDeclaration", + "scope": 23704, + "src": "278:13:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 23696, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "278:7:42", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "277:15:42" + }, + "returnParameters": { + "id": 23702, + "nodeType": "ParameterList", + "parameters": [], + "src": "310:0:42" + }, + "scope": 23778, + "src": "266:46:42", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 10769 + ], + "body": { + "id": 23712, + "nodeType": "Block", + "src": "372:20:42", + "statements": [ + { + "expression": { + "id": 23710, + "name": "ID", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23693, + "src": "385:2:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 23709, + "id": 23711, + "nodeType": "Return", + "src": "378:9:42" + } + ] + }, + "functionSelector": "ab9dbd07", + "id": 23713, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getID", + "nameLocation": "325:5:42", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 23706, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "345:8:42" + }, + "parameters": { + "id": 23705, + "nodeType": "ParameterList", + "parameters": [], + "src": "330:2:42" + }, + "returnParameters": { + "id": 23709, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 23708, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 23713, + "src": "363:7:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23707, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "363:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "362:9:42" + }, + "scope": 23778, + "src": "316:76:42", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 23729, + "nodeType": "Block", + "src": "457:41:42", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 23722, + "name": "entity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23715, + "src": "467:6:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [ + { + "id": 23725, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23718, + "src": "486:5:42", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_calldata_ptr", + "typeString": "struct Position calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_Position_$23685_calldata_ptr", + "typeString": "struct Position calldata" + } + ], + "expression": { + "id": 23723, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "475:3:42", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 23724, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "475:10:42", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 23726, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "475:17:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 23721, + "name": "set", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 23730, + 10855 + ], + "referencedDeclaration": 10855, + "src": "463:3:42", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$_t_bytes_memory_ptr_$returns$__$", + "typeString": "function (uint256,bytes memory)" + } + }, + "id": 23727, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "463:30:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 23728, + "nodeType": "ExpressionStatement", + "src": "463:30:42" + } + ] + }, + "functionSelector": "8bbf68fe", + "id": 23730, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "set", + "nameLocation": "405:3:42", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 23719, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 23715, + "mutability": "mutable", + "name": "entity", + "nameLocation": "417:6:42", + "nodeType": "VariableDeclaration", + "scope": 23730, + "src": "409:14:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23714, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "409:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 23718, + "mutability": "mutable", + "name": "value", + "nameLocation": "443:5:42", + "nodeType": "VariableDeclaration", + "scope": 23730, + "src": "425:23:42", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_calldata_ptr", + "typeString": "struct Position" + }, + "typeName": { + "id": 23717, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 23716, + "name": "Position", + "nodeType": "IdentifierPath", + "referencedDeclaration": 23685, + "src": "425:8:42" + }, + "referencedDeclaration": 23685, + "src": "425:8:42", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_storage_ptr", + "typeString": "struct Position" + } + }, + "visibility": "internal" + } + ], + "src": "408:41:42" + }, + "returnParameters": { + "id": 23720, + "nodeType": "ParameterList", + "parameters": [], + "src": "457:0:42" + }, + "scope": 23778, + "src": "396:102:42", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 23759, + "nodeType": "Block", + "src": "574:114:42", + "statements": [ + { + "assignments": [ + 23739, + 23741 + ], + "declarations": [ + { + "constant": false, + "id": 23739, + "mutability": "mutable", + "name": "x", + "nameLocation": "589:1:42", + "nodeType": "VariableDeclaration", + "scope": 23759, + "src": "581:9:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23738, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "581:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 23741, + "mutability": "mutable", + "name": "y", + "nameLocation": "600:1:42", + "nodeType": "VariableDeclaration", + "scope": 23759, + "src": "592:9:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23740, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "592:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 23753, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 23745, + "name": "entity", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23732, + "src": "628:6:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 23744, + "name": "getRawValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10953, + "src": "616:11:42", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) view returns (bytes memory)" + } + }, + "id": 23746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "616:19:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "components": [ + { + "id": 23748, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "638:7:42", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 23747, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "638:7:42", + "typeDescriptions": {} + } + }, + { + "id": 23750, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "647:7:42", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": { + "id": 23749, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "647:7:42", + "typeDescriptions": {} + } + } + ], + "id": 23751, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "637:18:42", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_type$_t_uint256_$_$_t_type$_t_uint256_$_$", + "typeString": "tuple(type(uint256),type(uint256))" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_tuple$_t_type$_t_uint256_$_$_t_type$_t_uint256_$_$", + "typeString": "tuple(type(uint256),type(uint256))" + } + ], + "expression": { + "id": 23742, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "605:3:42", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 23743, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "decode", + "nodeType": "MemberAccess", + "src": "605:10:42", + "typeDescriptions": { + "typeIdentifier": "t_function_abidecode_pure$__$returns$__$", + "typeString": "function () pure" + } + }, + "id": 23752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "605:51:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "580:76:42" + }, + { + "expression": { + "arguments": [ + { + "id": 23755, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23739, + "src": "678:1:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 23756, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23741, + "src": "681:1:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 23754, + "name": "Position", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23685, + "src": "669:8:42", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_Position_$23685_storage_ptr_$", + "typeString": "type(struct Position storage pointer)" + } + }, + "id": 23757, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "669:14:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_memory_ptr", + "typeString": "struct Position memory" + } + }, + "functionReturnParameters": 23737, + "id": 23758, + "nodeType": "Return", + "src": "662:21:42" + } + ] + }, + "functionSelector": "0ff4c916", + "id": 23760, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getValue", + "nameLocation": "511:8:42", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 23733, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 23732, + "mutability": "mutable", + "name": "entity", + "nameLocation": "528:6:42", + "nodeType": "VariableDeclaration", + "scope": 23760, + "src": "520:14:42", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 23731, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "520:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "519:16:42" + }, + "returnParameters": { + "id": 23737, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 23736, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 23760, + "src": "557:15:42", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_memory_ptr", + "typeString": "struct Position" + }, + "typeName": { + "id": 23735, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 23734, + "name": "Position", + "nodeType": "IdentifierPath", + "referencedDeclaration": 23685, + "src": "557:8:42" + }, + "referencedDeclaration": 23685, + "src": "557:8:42", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_storage_ptr", + "typeString": "struct Position" + } + }, + "visibility": "internal" + } + ], + "src": "556:17:42" + }, + "scope": 23778, + "src": "502:186:42", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 23776, + "nodeType": "Block", + "src": "789:60:42", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 23772, + "name": "position", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 23763, + "src": "834:8:42", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_calldata_ptr", + "typeString": "struct Position calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_Position_$23685_calldata_ptr", + "typeString": "struct Position calldata" + } + ], + "expression": { + "id": 23770, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "823:3:42", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 23771, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encode", + "nodeType": "MemberAccess", + "src": "823:10:42", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencode_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 23773, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "823:20:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 23769, + "name": "getEntitiesWithValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 23777, + 10997 + ], + "referencedDeclaration": 10997, + "src": "802:20:42", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (bytes memory) view returns (uint256[] memory)" + } + }, + "id": 23774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "802:42:42", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "functionReturnParameters": 23768, + "id": 23775, + "nodeType": "Return", + "src": "795:49:42" + } + ] + }, + "functionSelector": "fd4ab6d8", + "id": 23777, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getEntitiesWithValue", + "nameLocation": "701:20:42", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 23764, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 23763, + "mutability": "mutable", + "name": "position", + "nameLocation": "740:8:42", + "nodeType": "VariableDeclaration", + "scope": 23777, + "src": "722:26:42", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_calldata_ptr", + "typeString": "struct Position" + }, + "typeName": { + "id": 23762, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 23761, + "name": "Position", + "nodeType": "IdentifierPath", + "referencedDeclaration": 23685, + "src": "722:8:42" + }, + "referencedDeclaration": 23685, + "src": "722:8:42", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Position_$23685_storage_ptr", + "typeString": "struct Position" + } + }, + "visibility": "internal" + } + ], + "src": "721:28:42" + }, + "returnParameters": { + "id": 23768, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 23767, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 23777, + "src": "771:16:42", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 23765, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "771:7:42", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 23766, + "nodeType": "ArrayTypeName", + "src": "771:9:42", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "770:18:42" + }, + "scope": 23778, + "src": "692:157:42", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + } + ], + "scope": 23779, + "src": "222:629:42", + "usedErrors": [] + } + ], + "src": "38:814:42" + } +} \ No newline at end of file diff --git a/packages/ri/contracts/exports.txt b/packages/ri/contracts/exports.txt new file mode 100644 index 0000000000..3688b590aa --- /dev/null +++ b/packages/ri/contracts/exports.txt @@ -0,0 +1,4 @@ +Diamond +EmberFacet +PositionComponent +LibAppStorage \ No newline at end of file diff --git a/packages/ri/contracts/foundry.toml b/packages/ri/contracts/foundry.toml new file mode 100644 index 0000000000..90a6684ea6 --- /dev/null +++ b/packages/ri/contracts/foundry.toml @@ -0,0 +1,9 @@ +[default] +ffi = false +fuzz_runs = 256 +optimizer = true +optimizer_runs = 1000000 +verbosity = 1 +libs = ["../../../node_modules", "../../"] +src = "src" +out = "out" \ No newline at end of file diff --git a/packages/ri/contracts/git-install.sh b/packages/ri/contracts/git-install.sh new file mode 100755 index 0000000000..88044f626f --- /dev/null +++ b/packages/ri/contracts/git-install.sh @@ -0,0 +1,5 @@ +#! usr/bin/bash +giturl=https://github.com/$1.git +head=$(git ls-remote $giturl HEAD | head -n1 | awk '{print $1;}') +yarn add $giturl#$head $2 +echo "Installed $giturl#$head" \ No newline at end of file diff --git a/packages/ri/contracts/hardhat.config.ts b/packages/ri/contracts/hardhat.config.ts new file mode 100644 index 0000000000..ba24de433c --- /dev/null +++ b/packages/ri/contracts/hardhat.config.ts @@ -0,0 +1,38 @@ +import { HardhatUserConfig } from "hardhat/config"; +import "hardhat-abi-exporter"; +import "hardhat-diamond-abi"; +import "@typechain/hardhat"; + +import "./tasks/compile"; + +const config: HardhatUserConfig = { + paths: { + sources: "./src", + }, + solidity: { + version: "0.8.13", + settings: { + optimizer: { + enabled: true, + runs: 200, + }, + }, + }, + typechain: { + outDir: "./types/ethers-contracts", + target: "ethers-v5", + }, + diamondAbi: { + name: "Ember", + include: ["Facet"], + strict: true, + }, + abiExporter: { + path: "./abi", + runOnCompile: true, + flat: true, + only: [":Ember$", ":World", "Component"], + }, +}; + +export default config; diff --git a/packages/ri/contracts/package.json b/packages/ri/contracts/package.json new file mode 100644 index 0000000000..ccfd088d15 --- /dev/null +++ b/packages/ri/contracts/package.json @@ -0,0 +1,44 @@ +{ + "name": "ri-contracts", + "license": "MIT", + "version": "0.0.1", + "scripts": { + "prepare": "chmod u+x git-install.sh", + "git:install": "bash git-install.sh", + "lint": "yarn prettier && yarn solhint", + "prettier": "prettier --write 'src/**/*.sol'", + "solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix", + "test": "forge test", + "build": "rimraf out && forge build --force && yarn dist && yarn types", + "dist": "rimraf abi && mkdir abi && cat exports.txt | cut -d: -f7 | sort -n | uniq | xargs -n 1 sh -c 'cp out/\"$@\".sol/*.json abi/' sh", + "types": "rimraf types && typechain --target=ethers-v5 abi/*.json" + }, + "devDependencies": { + "@ethersproject/abi": "^5.6.0", + "@ethersproject/bytes": "^5.6.0", + "@rari-capital/solmate": "https://github.com/rari-capital/solmate.git#851ea3baa4327f453da723df75b1093b58b964dc", + "@typechain/ethers-v5": "^9.0.0", + "@typechain/hardhat": "^5.0.0", + "@types/node": "^17.0.21", + "copyfiles": "^2.4.1", + "ds-test": "https://github.com/dapphub/ds-test.git#c7a36fb236f298e04edf28e2fee385b80f53945f", + "ethers": "5.5.4", + "hardhat": "^2.9.1", + "hardhat-abi-exporter": "^2.8.0", + "hardhat-diamond-abi": "^2.0.0", + "prettier": "^2.6.2", + "prettier-plugin-solidity": "^1.0.0-beta.19", + "rimraf": "^3.0.2", + "solhint": "^3.3.7", + "ts-node": "^10.7.0", + "typechain": "^7.0.1", + "typescript": "^4.6.2", + "@latticexyz/persona": "https://github.com/latticexyz/persona.git#4b4634be26c20fe16e0c1c8b26938b26128f4f2f", + "@manifoldxyz/royalty-registry-solidity": "https://github.com/manifoldxyz/royalty-registry-solidity.git#c5ad6269d37e180fbf449a1f5ba2d2ff6c441efc", + "@opengsn/contracts": "^2.2.6", + "base64-sol": "https://github.com/Brechtpd/base64.git#4d85607b18d981acff392d2e99ba654305552a97", + "openzeppelin-solidity": "https://github.com/OpenZeppelin/openzeppelin-contracts.git#57725120581e27ec469e1c7e497a4008aafff818", + "@ethersproject/providers": "^5.5.3" + }, + "dependencies": {} +} diff --git a/packages/ri/contracts/remappings.txt b/packages/ri/contracts/remappings.txt new file mode 100644 index 0000000000..a959f35df3 --- /dev/null +++ b/packages/ri/contracts/remappings.txt @@ -0,0 +1,9 @@ +persona/=../../../node_modules/@latticexyz/persona/src/ +gsn=../../../node_modules/@opengsn/contracts/src/ +ds-test/=../../../node_modules/ds-test/src/ +solmate/=../../../node_modules/@rari-capital/solmate/src/ +forge-std/=../../../node_modules/forge-std/src/ +solecs/=../../../node_modules/@mud/solecs/src/ +royalty-registry/=../../../node_modules/@manifoldxyz/royalty-registry-solidity/contracts/ +@openzeppelin/=../../../node_modules/openzeppelin-solidity/ +base64/=../../../node_modules/base64-sol/ \ No newline at end of file diff --git a/packages/ri/contracts/src/access/IAccessController.sol b/packages/ri/contracts/src/access/IAccessController.sol new file mode 100644 index 0000000000..a492f8a6e1 --- /dev/null +++ b/packages/ri/contracts/src/access/IAccessController.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IAccessController { + function getEntityCallerIDFromAddress(address caller, bytes4 sig) external view returns (uint256); +} diff --git a/packages/ri/contracts/src/access/PersonaAccessController.sol b/packages/ri/contracts/src/access/PersonaAccessController.sol new file mode 100644 index 0000000000..0bcd13ed04 --- /dev/null +++ b/packages/ri/contracts/src/access/PersonaAccessController.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { IAccessController } from "./IAccessController.sol"; + +import { UsingAppStorage } from "../utils/UsingAppStorage.sol"; +import { AppStorage } from "../libraries/LibAppStorage.sol"; + +import { PersonaComponent, Persona, ID as PersonaComponentID } from "../components/PersonaComponent.sol"; +import { LibPersona } from "../libraries/LibPersona.sol"; + +contract PersonaAccessController is UsingAppStorage, IAccessController { + function getEntityCallerIDFromAddress(address caller, bytes4 sig) external view override returns (uint256) { + AppStorage storage s = getAppStorage(); + // Find the entity with a persona component value corresponding to the active persona of the caller + uint256 personaId = LibPersona.getActivePersonaFromAddress(caller, sig); + PersonaComponent personaComponent = PersonaComponent(s.world.getComponent(PersonaComponentID)); + uint256[] memory entities = personaComponent.getEntitiesWithValue(Persona(personaId)); + require(entities.length <= 1, "More than one Persona component with corresponding persona"); + if (entities.length == 0) { + return 0; + } + return entities[0]; + } +} diff --git a/packages/ri/contracts/src/access/UsingAccessControl.sol b/packages/ri/contracts/src/access/UsingAccessControl.sol new file mode 100644 index 0000000000..e7b4a0875a --- /dev/null +++ b/packages/ri/contracts/src/access/UsingAccessControl.sol @@ -0,0 +1,34 @@ +pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +import { AppStorage, LibAppStorage } from "../libraries/LibAppStorage.sol"; +import { UsingAppStorage } from "../utils/UsingAppStorage.sol"; +import { IAccessController } from "./IAccessController.sol"; +import { LibUtils } from "../libraries/LibUtils.sol"; + +contract UsingAccessControl is UsingAppStorage { + modifier populateCallerEntityID() { + bool found = false; + AppStorage storage appStorage = getAppStorage(); + // iterate through all access controller till one returns an non zero entity id + for (uint256 i = 0; i < appStorage.accessControllers.length; i++) { + address accessController = appStorage.accessControllers[i]; + bytes memory returnData = LibUtils.safeDelegateCall( + accessController, + abi.encodeWithSelector(IAccessController.getEntityCallerIDFromAddress.selector, msg.sender, msg.sig) + ); + uint256 callerEntityID = abi.decode(returnData, (uint256)); + if (callerEntityID > 0) { + appStorage._callerEntityID = callerEntityID; + found = true; + break; + } + } + if (!found) { + appStorage._callerEntityID = 0; + } + _; + if (appStorage.config.resetCallerEntityID) { + appStorage._callerEntityID = 0; + } + } +} diff --git a/packages/ri/contracts/src/components/EmbodiedSystemArgumentComponent.sol b/packages/ri/contracts/src/components/EmbodiedSystemArgumentComponent.sol new file mode 100644 index 0000000000..808a35584d --- /dev/null +++ b/packages/ri/contracts/src/components/EmbodiedSystemArgumentComponent.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +uint256 constant ID = uint256(keccak256("ember.component.embodiedSystemArgumentComponent")); + +contract EmbodiedSystemArgumentComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function getValue(uint256 entity) public view returns (bytes memory) { + return getRawValue(entity); + } +} diff --git a/packages/ri/contracts/src/components/EntityTypeComponent.sol b/packages/ri/contracts/src/components/EntityTypeComponent.sol new file mode 100644 index 0000000000..0dc173df5a --- /dev/null +++ b/packages/ri/contracts/src/components/EntityTypeComponent.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +struct EntityType { + uint256 entityType; +} + +uint256 constant ID = uint256(keccak256("ember.component.entityTypeComponent")); + +contract EntityTypeComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function set(uint256 entity, EntityType calldata value) public { + set(entity, abi.encode(value)); + } + + function getValue(uint256 entity) public view returns (EntityType memory) { + uint256 entityType = abi.decode(getRawValue(entity), (uint256)); + return EntityType(entityType); + } + + function getEntitiesWithValue(EntityType calldata position) public view returns (uint256[] memory) { + return getEntitiesWithValue(abi.encode(position)); + } +} diff --git a/packages/ri/contracts/src/components/LearnedSpellsComponent.sol b/packages/ri/contracts/src/components/LearnedSpellsComponent.sol new file mode 100644 index 0000000000..f04fff9aa9 --- /dev/null +++ b/packages/ri/contracts/src/components/LearnedSpellsComponent.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +uint256 constant ID = uint256(keccak256("ember.component.learnedSpellsComponent")); + +contract LearnedSpellsComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function set(uint256 entity, uint256[] calldata value) public { + set(entity, abi.encode(value)); + } + + function getValue(uint256 entity) public view returns (uint256[] memory) { + uint256[] memory learnedSpells = abi.decode(getRawValue(entity), (uint256[])); + return learnedSpells; + } + + function getEntitiesWithValue(uint256[] calldata learnedSpells) public view returns (uint256[] memory) { + return getEntitiesWithValue(abi.encode(learnedSpells)); + } +} diff --git a/packages/ri/contracts/src/components/MaxDistanceComponent.sol b/packages/ri/contracts/src/components/MaxDistanceComponent.sol new file mode 100644 index 0000000000..a7c105d2e3 --- /dev/null +++ b/packages/ri/contracts/src/components/MaxDistanceComponent.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +struct MaxDistance { + uint256 maxDistance; +} + +uint256 constant ID = uint256(keccak256("ember.component.maxDistanceComponent")); + +contract MaxDistanceComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function set(uint256 entity, MaxDistance calldata value) public { + set(entity, abi.encode(value)); + } + + function getValue(uint256 entity) public view returns (MaxDistance memory) { + uint256 maxDistance = abi.decode(getRawValue(entity), (uint256)); + return MaxDistance(maxDistance); + } + + function getEntitiesWithValue(MaxDistance calldata maxDistance) public view returns (uint256[] memory) { + return getEntitiesWithValue(abi.encode(maxDistance)); + } +} diff --git a/packages/ri/contracts/src/components/OwnedByComponent.sol b/packages/ri/contracts/src/components/OwnedByComponent.sol new file mode 100644 index 0000000000..fcc0642523 --- /dev/null +++ b/packages/ri/contracts/src/components/OwnedByComponent.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +struct OwnedBy { + uint256 ownedBy; +} + +uint256 constant ID = uint256(keccak256("ember.component.ownedBy")); + +contract OwnedByComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function set(uint256 entity, OwnedBy calldata value) public { + set(entity, abi.encode(value)); + } + + function getValue(uint256 entity) public view returns (OwnedBy memory) { + uint256 ownedBy = abi.decode(getRawValue(entity), (uint256)); + return OwnedBy(ownedBy); + } + + function getEntitiesWithValue(OwnedBy calldata ownedBy) public view returns (uint256[] memory) { + return getEntitiesWithValue(abi.encode(ownedBy)); + } +} diff --git a/packages/ri/contracts/src/components/PersonaComponent.sol b/packages/ri/contracts/src/components/PersonaComponent.sol new file mode 100644 index 0000000000..93492588ff --- /dev/null +++ b/packages/ri/contracts/src/components/PersonaComponent.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +struct Persona { + uint256 personaId; +} + +uint256 constant ID = uint256(keccak256("ember.component.personaComponent")); + +contract PersonaComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function set(uint256 entity, Persona calldata value) public { + set(entity, abi.encode(value)); + } + + function getValue(uint256 entity) public view returns (Persona memory) { + uint256 persona = abi.decode(getRawValue(entity), (uint256)); + return Persona(persona); + } + + function getEntitiesWithValue(Persona calldata persona) public view returns (uint256[] memory) { + return getEntitiesWithValue(abi.encode(persona)); + } +} diff --git a/packages/ri/contracts/src/components/PositionComponent.sol b/packages/ri/contracts/src/components/PositionComponent.sol new file mode 100644 index 0000000000..33e29af338 --- /dev/null +++ b/packages/ri/contracts/src/components/PositionComponent.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +struct Position { + uint256 x; + uint256 y; +} + +uint256 constant ID = uint256(keccak256("ember.component.positionComponent")); + +contract PositionComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function set(uint256 entity, Position calldata value) public { + set(entity, abi.encode(value)); + } + + function getValue(uint256 entity) public view returns (Position memory) { + (uint256 x, uint256 y) = abi.decode(getRawValue(entity), (uint256, uint256)); + return Position(x, y); + } + + function getEntitiesWithValue(Position calldata position) public view returns (uint256[] memory) { + return getEntitiesWithValue(abi.encode(position)); + } +} diff --git a/packages/ri/contracts/src/components/SpellComponent.sol b/packages/ri/contracts/src/components/SpellComponent.sol new file mode 100644 index 0000000000..12612571a6 --- /dev/null +++ b/packages/ri/contracts/src/components/SpellComponent.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import "solecs/Component.sol"; + +enum SpellTargetFilter { + SELF, + TILE +} + +struct Spell { + bytes4 embodiedSystemSelector; + SpellTargetFilter spellTargetFilter; +} + +uint256 constant ID = uint256(keccak256("ember.component.spellComponent")); + +contract SpellComponent is Component { + constructor(address world) Component(world) {} + + function getID() public pure override returns (uint256) { + return ID; + } + + function set(uint256 entity, Spell calldata value) public { + set(entity, abi.encode(value)); + } + + function getValue(uint256 entity) public view returns (Spell memory) { + (bytes4 embodiedSystemSelector, uint256 spellTargetFilter) = abi.decode(getRawValue(entity), (bytes4, uint256)); + return Spell(embodiedSystemSelector, SpellTargetFilter(spellTargetFilter)); + } + + function getEntitiesWithValue(Spell calldata spell) public view returns (uint256[] memory) { + return getEntitiesWithValue(abi.encode(spell)); + } +} diff --git a/packages/ri/contracts/src/diamond/Diamantaire.sol b/packages/ri/contracts/src/diamond/Diamantaire.sol new file mode 100644 index 0000000000..cb298f9fe8 --- /dev/null +++ b/packages/ri/contracts/src/diamond/Diamantaire.sol @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "./interfaces/IDiamondCut.sol"; +import "./Diamond.sol"; +import "./facets/DiamondCutFacet.sol"; +import "./facets/DiamondLoupeFacet.sol"; +import "./facets/OwnershipFacet.sol"; + +contract Diamantaire { + event DiamondCreated(Diamond diamond); + + IDiamondCut.FacetCut[] internal _builtinDiamondCut; + + constructor() { + bytes4[] memory functionSelectors; + + // ------------------------------------------------------------------------- + // adding diamondCut function + // ------------------------------------------------------------------------- + DiamondCutFacet diamondCutFacet = new DiamondCutFacet(); + + functionSelectors = new bytes4[](1); + functionSelectors[0] = DiamondCutFacet.diamondCut.selector; + _builtinDiamondCut.push( + IDiamondCut.FacetCut({ + facetAddress: address(diamondCutFacet), + action: IDiamondCut.FacetCutAction.Add, + functionSelectors: functionSelectors + }) + ); + + // ------------------------------------------------------------------------- + // adding diamond loupe functions + // ------------------------------------------------------------------------- + DiamondLoupeFacet diamondLoupeFacet = new DiamondLoupeFacet(); + + functionSelectors = new bytes4[](5); + functionSelectors[0] = DiamondLoupeFacet.facetFunctionSelectors.selector; + functionSelectors[1] = DiamondLoupeFacet.facets.selector; + functionSelectors[2] = DiamondLoupeFacet.facetAddress.selector; + functionSelectors[3] = DiamondLoupeFacet.facetAddresses.selector; + functionSelectors[4] = DiamondLoupeFacet.supportsInterface.selector; + _builtinDiamondCut.push( + IDiamondCut.FacetCut({ + facetAddress: address(diamondLoupeFacet), + action: IDiamondCut.FacetCutAction.Add, + functionSelectors: functionSelectors + }) + ); + + // ------------------------------------------------------------------------- + // adding ownership functions + // ------------------------------------------------------------------------- + OwnershipFacet ownershipFacet = new OwnershipFacet(); + + functionSelectors = new bytes4[](2); + functionSelectors[0] = OwnershipFacet.transferOwnership.selector; + functionSelectors[1] = OwnershipFacet.owner.selector; + _builtinDiamondCut.push( + IDiamondCut.FacetCut({ + facetAddress: address(ownershipFacet), + action: IDiamondCut.FacetCutAction.Add, + functionSelectors: functionSelectors + }) + ); + } + + function createDiamond( + address owner, + IDiamondCut.FacetCut[] calldata _diamondCut, + bytes calldata data, + bytes32 salt + ) external payable returns (Diamond diamond) { + if (salt != 0x0000000000000000000000000000000000000000000000000000000000000000) { + salt = keccak256(abi.encodePacked(salt, owner)); + diamond = new Diamond{ value: msg.value, salt: salt }(address(this), _builtinDiamondCut); + } else { + diamond = new Diamond{ value: msg.value }(address(this), _builtinDiamondCut); + } + emit DiamondCreated(diamond); + + IDiamondCut(address(diamond)).diamondCut(_diamondCut, data.length > 0 ? address(diamond) : address(0), data); + IERC173(address(diamond)).transferOwnership(owner); + } +} diff --git a/packages/ri/contracts/src/diamond/Diamond.sol b/packages/ri/contracts/src/diamond/Diamond.sol new file mode 100644 index 0000000000..c785e7ab5e --- /dev/null +++ b/packages/ri/contracts/src/diamond/Diamond.sol @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/******************************************************************************\ +* Author: Nick Mudge (https://twitter.com/mudgen) +* Modified by Ludens on the 5th of April 2022 +* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 +* +* Implementation of a diamond. +/******************************************************************************/ + +import { IERC165 } from "@openzeppelin/contracts/interfaces/IERC165.sol"; +import { LibDiamond, DiamondStorage } from "./libraries/LibDiamond.sol"; +import { IDiamondCut } from "./interfaces/IDiamondCut.sol"; +import { IDiamondLoupe } from "./interfaces/IDiamondLoupe.sol"; +import { IERC173 } from "./interfaces/IERC173.sol"; + +contract Diamond { + constructor(address _diamondOwner, IDiamondCut.FacetCut[] memory _diamondCut) payable { + LibDiamond.diamondCut(_diamondCut, address(0), new bytes(0)); + LibDiamond.setContractOwner(_diamondOwner); + + DiamondStorage storage ds = LibDiamond.diamondStorage(); + // register default supported interfaces. other interfaces need to be registered in their respective facets + ds.supportedInterfaces[type(IERC165).interfaceId] = true; + ds.supportedInterfaces[type(IDiamondCut).interfaceId] = true; + ds.supportedInterfaces[type(IDiamondLoupe).interfaceId] = true; + ds.supportedInterfaces[type(IERC173).interfaceId] = true; + // register address of diamond + ds.diamond = address(this); + } + + // Find facet for function that is called and execute the + // function if a facet is found and return any value. + fallback() external payable { + DiamondStorage storage ds; + bytes32 position = LibDiamond.DIAMOND_STORAGE_POSITION; + // get diamond storage + assembly { + ds.slot := position + } + // get facet from function selector + address facet = address(bytes20(ds.facets[msg.sig])); + require(facet != address(0), "Diamond: Function does not exist"); + // Execute external function from facet using delegatecall and return any value. + assembly { + // copy function selector and any arguments + calldatacopy(0, 0, calldatasize()) + // execute function call using the facet + let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0) + // get any return value + returndatacopy(0, 0, returndatasize()) + // return any return value or error back to the caller + switch result + case 0 { + revert(0, returndatasize()) + } + default { + return(0, returndatasize()) + } + } + } + + receive() external payable {} +} diff --git a/packages/ri/contracts/src/diamond/facets/DiamondCutFacet.sol b/packages/ri/contracts/src/diamond/facets/DiamondCutFacet.sol new file mode 100644 index 0000000000..a946408998 --- /dev/null +++ b/packages/ri/contracts/src/diamond/facets/DiamondCutFacet.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/******************************************************************************\ +* Author: Nick Mudge (https://twitter.com/mudgen) +* Modified by Ludens on the 5th of April 2022 +* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 +/******************************************************************************/ + +import { IDiamondCut } from "../interfaces/IDiamondCut.sol"; +import { LibDiamond, DiamondStorage } from "../libraries/LibDiamond.sol"; + +contract DiamondCutFacet is IDiamondCut { + /// @notice Add/replace/remove any number of functions and optionally execute + /// a function with delegatecall + /// @param _diamondCut Contains the facet addresses and function selectors + /// @param _init The address of the contract or facet to execute _calldata + /// @param _calldata A function call, including function selector and arguments + /// _calldata is executed with delegatecall on _init + function diamondCut( + FacetCut[] calldata _diamondCut, + address _init, + bytes calldata _calldata + ) external override { + LibDiamond.enforceIsContractOwner(); + DiamondStorage storage ds = LibDiamond.diamondStorage(); + uint256 originalSelectorCount = ds.selectorCount; + uint256 selectorCount = originalSelectorCount; + bytes32 selectorSlot; + // Check if last selector slot is not full + // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" + if (selectorCount & 7 > 0) { + // get last selectorSlot + // "selectorCount >> 3" is a gas efficient division by 8 "selectorCount / 8" + selectorSlot = ds.selectorSlots[selectorCount >> 3]; + } + // loop through diamond cut + for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { + (selectorCount, selectorSlot) = LibDiamond.addReplaceRemoveFacetSelectors( + selectorCount, + selectorSlot, + _diamondCut[facetIndex].facetAddress, + _diamondCut[facetIndex].action, + _diamondCut[facetIndex].functionSelectors + ); + } + if (selectorCount != originalSelectorCount) { + ds.selectorCount = uint16(selectorCount); + } + // If last selector slot is not full + // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" + if (selectorCount & 7 > 0) { + // "selectorCount >> 3" is a gas efficient division by 8 "selectorCount / 8" + ds.selectorSlots[selectorCount >> 3] = selectorSlot; + } + emit DiamondCut(_diamondCut, _init, _calldata); + LibDiamond.initializeDiamondCut(_init, _calldata); + } +} diff --git a/packages/ri/contracts/src/diamond/facets/DiamondLoupeFacet.sol b/packages/ri/contracts/src/diamond/facets/DiamondLoupeFacet.sol new file mode 100644 index 0000000000..def24fa1fa --- /dev/null +++ b/packages/ri/contracts/src/diamond/facets/DiamondLoupeFacet.sol @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +/******************************************************************************\ +* Author: Nick Mudge (https://twitter.com/mudgen) +* Modified by Ludens on the 5th of April 2022 +* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 +/******************************************************************************/ + +import { LibDiamond, DiamondStorage } from "../libraries/LibDiamond.sol"; +import { IDiamondLoupe } from "../interfaces/IDiamondLoupe.sol"; +import { IERC165 } from "@openzeppelin/contracts/interfaces/IERC165.sol"; + +contract DiamondLoupeFacet is IDiamondLoupe, IERC165 { + // Diamond Loupe Functions + //////////////////////////////////////////////////////////////////// + /// These functions are expected to be called frequently by tools. + // + // struct Facet { + // address facetAddress; + // bytes4[] functionSelectors; + // } + /// @notice Gets all facets and their selectors. + /// @return facets_ Facet + function facets() external view override returns (Facet[] memory facets_) { + DiamondStorage storage ds = LibDiamond.diamondStorage(); + facets_ = new Facet[](ds.selectorCount); + uint8[] memory numFacetSelectors = new uint8[](ds.selectorCount); + uint256 numFacets; + uint256 selectorIndex; + // loop through function selectors + for (uint256 slotIndex; selectorIndex < ds.selectorCount; slotIndex++) { + bytes32 slot = ds.selectorSlots[slotIndex]; + for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) { + selectorIndex++; + if (selectorIndex > ds.selectorCount) { + break; + } + bytes4 selector = bytes4(slot << (selectorSlotIndex << 5)); + address facetAddress_ = address(bytes20(ds.facets[selector])); + bool continueLoop; + for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { + if (facets_[facetIndex].facetAddress == facetAddress_) { + facets_[facetIndex].functionSelectors[numFacetSelectors[facetIndex]] = selector; + // probably will never have more than 256 functions from one facet contract + require(numFacetSelectors[facetIndex] < 255); + numFacetSelectors[facetIndex]++; + continueLoop = true; + break; + } + } + if (continueLoop) { + continue; + } + facets_[numFacets].facetAddress = facetAddress_; + facets_[numFacets].functionSelectors = new bytes4[](ds.selectorCount); + facets_[numFacets].functionSelectors[0] = selector; + numFacetSelectors[numFacets] = 1; + numFacets++; + } + } + for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { + uint256 numSelectors = numFacetSelectors[facetIndex]; + bytes4[] memory selectors = facets_[facetIndex].functionSelectors; + // setting the number of selectors + assembly { + mstore(selectors, numSelectors) + } + } + // setting the number of facets + assembly { + mstore(facets_, numFacets) + } + } + + /// @notice Gets all the function selectors supported by a specific facet. + /// @param _facet The facet address. + /// @return _facetFunctionSelectors The selectors associated with a facet address. + function facetFunctionSelectors(address _facet) + external + view + override + returns (bytes4[] memory _facetFunctionSelectors) + { + DiamondStorage storage ds = LibDiamond.diamondStorage(); + uint256 numSelectors; + _facetFunctionSelectors = new bytes4[](ds.selectorCount); + uint256 selectorIndex; + // loop through function selectors + for (uint256 slotIndex; selectorIndex < ds.selectorCount; slotIndex++) { + bytes32 slot = ds.selectorSlots[slotIndex]; + for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) { + selectorIndex++; + if (selectorIndex > ds.selectorCount) { + break; + } + bytes4 selector = bytes4(slot << (selectorSlotIndex << 5)); + address facet = address(bytes20(ds.facets[selector])); + if (_facet == facet) { + _facetFunctionSelectors[numSelectors] = selector; + numSelectors++; + } + } + } + // Set the number of selectors in the array + assembly { + mstore(_facetFunctionSelectors, numSelectors) + } + } + + /// @notice Get all the facet addresses used by a diamond. + /// @return facetAddresses_ + function facetAddresses() external view override returns (address[] memory facetAddresses_) { + DiamondStorage storage ds = LibDiamond.diamondStorage(); + facetAddresses_ = new address[](ds.selectorCount); + uint256 numFacets; + uint256 selectorIndex; + // loop through function selectors + for (uint256 slotIndex; selectorIndex < ds.selectorCount; slotIndex++) { + bytes32 slot = ds.selectorSlots[slotIndex]; + for (uint256 selectorSlotIndex; selectorSlotIndex < 8; selectorSlotIndex++) { + selectorIndex++; + if (selectorIndex > ds.selectorCount) { + break; + } + bytes4 selector = bytes4(slot << (selectorSlotIndex << 5)); + address facetAddress_ = address(bytes20(ds.facets[selector])); + bool continueLoop; + for (uint256 facetIndex; facetIndex < numFacets; facetIndex++) { + if (facetAddress_ == facetAddresses_[facetIndex]) { + continueLoop = true; + break; + } + } + if (continueLoop) { + continue; + } + facetAddresses_[numFacets] = facetAddress_; + numFacets++; + } + } + // Set the number of facet addresses in the array + assembly { + mstore(facetAddresses_, numFacets) + } + } + + /// @notice Gets the facet that supports the given selector. + /// @dev If facet is not found return address(0). + /// @param _functionSelector The function selector. + /// @return facetAddress_ The facet address. + function facetAddress(bytes4 _functionSelector) external view override returns (address facetAddress_) { + DiamondStorage storage ds = LibDiamond.diamondStorage(); + facetAddress_ = address(bytes20(ds.facets[_functionSelector])); + } + + // This implements ERC-165. + function supportsInterface(bytes4 _interfaceId) external view override returns (bool) { + DiamondStorage storage ds = LibDiamond.diamondStorage(); + return ds.supportedInterfaces[_interfaceId]; + } +} diff --git a/packages/ri/contracts/src/diamond/facets/OwnershipFacet.sol b/packages/ri/contracts/src/diamond/facets/OwnershipFacet.sol new file mode 100644 index 0000000000..4bdf984dbf --- /dev/null +++ b/packages/ri/contracts/src/diamond/facets/OwnershipFacet.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import { LibDiamond } from "../libraries/LibDiamond.sol"; +import { IERC173 } from "../interfaces/IERC173.sol"; + +contract OwnershipFacet is IERC173 { + function transferOwnership(address _newOwner) external override { + LibDiamond.enforceIsContractOwner(); + LibDiamond.setContractOwner(_newOwner); + } + + function owner() external view override returns (address owner_) { + owner_ = LibDiamond.contractOwner(); + } +} diff --git a/packages/ri/contracts/src/diamond/interfaces/IDiamondCut.sol b/packages/ri/contracts/src/diamond/interfaces/IDiamondCut.sol new file mode 100644 index 0000000000..3e302c9200 --- /dev/null +++ b/packages/ri/contracts/src/diamond/interfaces/IDiamondCut.sol @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/******************************************************************************\ +* Author: Nick Mudge (https://twitter.com/mudgen) +* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 +/******************************************************************************/ + +interface IDiamondCut { + enum FacetCutAction { + Add, + Replace, + Remove + } + // Add=0, Replace=1, Remove=2 + + struct FacetCut { + address facetAddress; + FacetCutAction action; + bytes4[] functionSelectors; + } + + /// @notice Add/replace/remove any number of functions and optionally execute + /// a function with delegatecall + /// @param _diamondCut Contains the facet addresses and function selectors + /// @param _init The address of the contract or facet to execute _calldata + /// @param _calldata A function call, including function selector and arguments + /// _calldata is executed with delegatecall on _init + function diamondCut( + FacetCut[] calldata _diamondCut, + address _init, + bytes calldata _calldata + ) external; + + event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata); +} diff --git a/packages/ri/contracts/src/diamond/interfaces/IDiamondLoupe.sol b/packages/ri/contracts/src/diamond/interfaces/IDiamondLoupe.sol new file mode 100644 index 0000000000..e8ee0722cd --- /dev/null +++ b/packages/ri/contracts/src/diamond/interfaces/IDiamondLoupe.sol @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/******************************************************************************\ +* Author: Nick Mudge (https://twitter.com/mudgen) +* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 +/******************************************************************************/ + +// A loupe is a small magnifying glass used to look at diamonds. +// These functions look at diamonds +interface IDiamondLoupe { + /// These functions are expected to be called frequently + /// by tools. + + struct Facet { + address facetAddress; + bytes4[] functionSelectors; + } + + /// @notice Gets all facet addresses and their four byte function selectors. + /// @return facets_ Facet + function facets() external view returns (Facet[] memory facets_); + + /// @notice Gets all the function selectors supported by a specific facet. + /// @param _facet The facet address. + /// @return facetFunctionSelectors_ + function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_); + + /// @notice Get all the facet addresses used by a diamond. + /// @return facetAddresses_ + function facetAddresses() external view returns (address[] memory facetAddresses_); + + /// @notice Gets the facet that supports the given selector. + /// @dev If facet is not found return address(0). + /// @param _functionSelector The function selector. + /// @return facetAddress_ The facet address. + function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_); +} diff --git a/packages/ri/contracts/src/diamond/interfaces/IERC173.sol b/packages/ri/contracts/src/diamond/interfaces/IERC173.sol new file mode 100644 index 0000000000..b5f023e5eb --- /dev/null +++ b/packages/ri/contracts/src/diamond/interfaces/IERC173.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/// @title ERC-173 Contract Ownership Standard +/// Note: the ERC-165 identifier for this interface is 0x7f5828d0 +/* is ERC165 */ +interface IERC173 { + /// @dev This emits when ownership of a contract changes. + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /// @notice Get the address of the owner + /// @return owner_ The address of the owner. + function owner() external view returns (address owner_); + + /// @notice Set the address of the new owner of the contract + /// @dev Set _newOwner to address(0) to renounce any ownership. + /// @param _newOwner The address of the new owner of the contract + function transferOwnership(address _newOwner) external; +} diff --git a/packages/ri/contracts/src/diamond/libraries/LibDiamond.sol b/packages/ri/contracts/src/diamond/libraries/LibDiamond.sol new file mode 100644 index 0000000000..cf13076be2 --- /dev/null +++ b/packages/ri/contracts/src/diamond/libraries/LibDiamond.sol @@ -0,0 +1,250 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/******************************************************************************\ +* Author: Nick Mudge (https://twitter.com/mudgen) +* Modified by Ludens on the 5th of April 2022 +* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535 +/******************************************************************************/ +import { IDiamondCut } from "../interfaces/IDiamondCut.sol"; + +struct DiamondStorage { + // maps function selectors to the facets that execute the functions. + // and maps the selectors to their position in the selectorSlots array. + // func selector => address facet, selector position + mapping(bytes4 => bytes32) facets; + // array of facet addresses + address[] facetAddresses; + // array of slots of function selectors. + // each slot holds 8 function selectors. + mapping(uint256 => bytes32) selectorSlots; + // The number of function selectors in selectorSlots + uint16 selectorCount; + // Used to query if a contract implements an interface. + // Used to implement ERC-165. + mapping(bytes4 => bool) supportedInterfaces; + // owner of the contract + address contractOwner; + // address of the diamond + address diamond; +} + +library LibDiamond { + bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); + + function diamondStorage() internal pure returns (DiamondStorage storage ds) { + bytes32 position = DIAMOND_STORAGE_POSITION; + assembly { + ds.slot := position + } + } + + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + function setContractOwner(address _newOwner) internal { + DiamondStorage storage ds = diamondStorage(); + address previousOwner = ds.contractOwner; + ds.contractOwner = _newOwner; + emit OwnershipTransferred(previousOwner, _newOwner); + } + + function contractOwner() internal view returns (address contractOwner_) { + contractOwner_ = diamondStorage().contractOwner; + } + + function enforceIsContractOwner() internal view { + require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner"); + } + + event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata); + + bytes32 constant CLEAR_ADDRESS_MASK = bytes32(uint256(0xffffffffffffffffffffffff)); + bytes32 constant CLEAR_SELECTOR_MASK = bytes32(uint256(0xffffffff << 224)); + + // Internal function version of diamondCut + // This code is almost the same as the external diamondCut, + // except it is using 'Facet[] memory _diamondCut' instead of + // 'Facet[] calldata _diamondCut'. + // The code is duplicated to prevent copying calldata to memory which + // causes an error for a two dimensional array. + function diamondCut( + IDiamondCut.FacetCut[] memory _diamondCut, + address _init, + bytes memory _calldata + ) internal { + DiamondStorage storage ds = diamondStorage(); + uint256 originalSelectorCount = ds.selectorCount; + uint256 selectorCount = originalSelectorCount; + bytes32 selectorSlot; + // Check if last selector slot is not full + // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" + if (selectorCount & 7 > 0) { + // get last selectorSlot + // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8" + selectorSlot = ds.selectorSlots[selectorCount >> 3]; + } + // loop through diamond cut + for (uint256 facetIndex; facetIndex < _diamondCut.length; facetIndex++) { + (selectorCount, selectorSlot) = addReplaceRemoveFacetSelectors( + selectorCount, + selectorSlot, + _diamondCut[facetIndex].facetAddress, + _diamondCut[facetIndex].action, + _diamondCut[facetIndex].functionSelectors + ); + } + if (selectorCount != originalSelectorCount) { + ds.selectorCount = uint16(selectorCount); + } + // If last selector slot is not full + // "selectorCount & 7" is a gas efficient modulo by eight "selectorCount % 8" + if (selectorCount & 7 > 0) { + // "selectorSlot >> 3" is a gas efficient division by 8 "selectorSlot / 8" + ds.selectorSlots[selectorCount >> 3] = selectorSlot; + } + emit DiamondCut(_diamondCut, _init, _calldata); + initializeDiamondCut(_init, _calldata); + } + + function addReplaceRemoveFacetSelectors( + uint256 _selectorCount, + bytes32 _selectorSlot, + address _newFacetAddress, + IDiamondCut.FacetCutAction _action, + bytes4[] memory _selectors + ) internal returns (uint256, bytes32) { + DiamondStorage storage ds = diamondStorage(); + require(_selectors.length > 0, "LibDiamondCut: No selectors in facet to cut"); + if (_action == IDiamondCut.FacetCutAction.Add) { + enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Add facet has no code"); + ds.facetAddresses.push(_newFacetAddress); + for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) { + bytes4 selector = _selectors[selectorIndex]; + bytes32 oldFacet = ds.facets[selector]; + require(address(bytes20(oldFacet)) == address(0), "LibDiamondCut: Can't add function that already exists"); + // add facet for selector + ds.facets[selector] = bytes20(_newFacetAddress) | bytes32(_selectorCount); + // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" + uint256 selectorInSlotPosition = (_selectorCount & 7) << 5; + // clear selector position in slot and add selector + _selectorSlot = + (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> selectorInSlotPosition)) | + (bytes32(selector) >> selectorInSlotPosition); + // if slot is full then write it to storage + if (selectorInSlotPosition == 224) { + // "_selectorSlot >> 3" is a gas efficient division by 8 "_selectorSlot / 8" + ds.selectorSlots[_selectorCount >> 3] = _selectorSlot; + _selectorSlot = 0; + } + _selectorCount++; + } + } else if (_action == IDiamondCut.FacetCutAction.Replace) { + enforceHasContractCode(_newFacetAddress, "LibDiamondCut: Replace facet has no code"); + // TODO: @ludens replace + // ds.facetAddresses.push(_newFacetAddress); + for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) { + bytes4 selector = _selectors[selectorIndex]; + bytes32 oldFacet = ds.facets[selector]; + address oldFacetAddress = address(bytes20(oldFacet)); + // only useful if immutable functions exist + require(oldFacetAddress != address(this), "LibDiamondCut: Can't replace immutable function"); + require(oldFacetAddress != _newFacetAddress, "LibDiamondCut: Can't replace function with same function"); + require(oldFacetAddress != address(0), "LibDiamondCut: Can't replace function that doesn't exist"); + // replace old facet address + ds.facets[selector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(_newFacetAddress); + } + } else if (_action == IDiamondCut.FacetCutAction.Remove) { + // TODO: @ludens remove + // ds.facetAddresses.push(_newFacetAddress); + require(_newFacetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)"); + // "_selectorCount >> 3" is a gas efficient division by 8 "_selectorCount / 8" + uint256 selectorSlotCount = _selectorCount >> 3; + // "_selectorCount & 7" is a gas efficient modulo by eight "_selectorCount % 8" + uint256 selectorInSlotIndex = _selectorCount & 7; + for (uint256 selectorIndex; selectorIndex < _selectors.length; selectorIndex++) { + if (_selectorSlot == 0) { + // get last selectorSlot + selectorSlotCount--; + _selectorSlot = ds.selectorSlots[selectorSlotCount]; + selectorInSlotIndex = 7; + } else { + selectorInSlotIndex--; + } + bytes4 lastSelector; + uint256 oldSelectorsSlotCount; + uint256 oldSelectorInSlotPosition; + // adding a block here prevents stack too deep error + { + bytes4 selector = _selectors[selectorIndex]; + bytes32 oldFacet = ds.facets[selector]; + require(address(bytes20(oldFacet)) != address(0), "LibDiamondCut: Can't remove function that doesn't exist"); + // only useful if immutable functions exist + require(address(bytes20(oldFacet)) != address(this), "LibDiamondCut: Can't remove immutable function"); + // replace selector with last selector in ds.facets + // gets the last selector + lastSelector = bytes4(_selectorSlot << (selectorInSlotIndex << 5)); + if (lastSelector != selector) { + // update last selector slot position info + ds.facets[lastSelector] = (oldFacet & CLEAR_ADDRESS_MASK) | bytes20(ds.facets[lastSelector]); + } + delete ds.facets[selector]; + uint256 oldSelectorCount = uint16(uint256(oldFacet)); + // "oldSelectorCount >> 3" is a gas efficient division by 8 "oldSelectorCount / 8" + oldSelectorsSlotCount = oldSelectorCount >> 3; + // "oldSelectorCount & 7" is a gas efficient modulo by eight "oldSelectorCount % 8" + oldSelectorInSlotPosition = (oldSelectorCount & 7) << 5; + } + if (oldSelectorsSlotCount != selectorSlotCount) { + bytes32 oldSelectorSlot = ds.selectorSlots[oldSelectorsSlotCount]; + // clears the selector we are deleting and puts the last selector in its place. + oldSelectorSlot = + (oldSelectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) | + (bytes32(lastSelector) >> oldSelectorInSlotPosition); + // update storage with the modified slot + ds.selectorSlots[oldSelectorsSlotCount] = oldSelectorSlot; + } else { + // clears the selector we are deleting and puts the last selector in its place. + _selectorSlot = + (_selectorSlot & ~(CLEAR_SELECTOR_MASK >> oldSelectorInSlotPosition)) | + (bytes32(lastSelector) >> oldSelectorInSlotPosition); + } + if (selectorInSlotIndex == 0) { + delete ds.selectorSlots[selectorSlotCount]; + _selectorSlot = 0; + } + } + _selectorCount = selectorSlotCount * 8 + selectorInSlotIndex; + } else { + revert("LibDiamondCut: Incorrect FacetCutAction"); + } + return (_selectorCount, _selectorSlot); + } + + function initializeDiamondCut(address _init, bytes memory _calldata) internal { + if (_init == address(0)) { + require(_calldata.length == 0, "LibDiamondCut: _init is address(0) but_calldata is not empty"); + } else { + require(_calldata.length > 0, "LibDiamondCut: _calldata is empty but _init is not address(0)"); + if (_init != address(this)) { + enforceHasContractCode(_init, "LibDiamondCut: _init address has no code"); + } + (bool success, bytes memory error) = _init.delegatecall(_calldata); + if (!success) { + if (error.length > 0) { + // bubble up the error + revert(string(error)); + } else { + revert("LibDiamondCut: _init function reverted"); + } + } + } + } + + function enforceHasContractCode(address _contract, string memory _errorMessage) internal view { + uint256 contractSize; + assembly { + contractSize := extcodesize(_contract) + } + require(contractSize > 0, _errorMessage); + } +} diff --git a/packages/ri/contracts/src/diamond/utils/UsingDiamondOwner.sol b/packages/ri/contracts/src/diamond/utils/UsingDiamondOwner.sol new file mode 100644 index 0000000000..e83c605052 --- /dev/null +++ b/packages/ri/contracts/src/diamond/utils/UsingDiamondOwner.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import { LibDiamond, DiamondStorage } from "../libraries/LibDiamond.sol"; + +contract UsingDiamondOwner { + modifier onlyOwner() { + DiamondStorage storage ds = LibDiamond.diamondStorage(); + require(msg.sender == ds.contractOwner, "Only owner is allowed to perform this action"); + _; + } +} diff --git a/packages/ri/contracts/src/diamond/utils/UsingDiamondStorage.sol b/packages/ri/contracts/src/diamond/utils/UsingDiamondStorage.sol new file mode 100644 index 0000000000..cd81c1ec6e --- /dev/null +++ b/packages/ri/contracts/src/diamond/utils/UsingDiamondStorage.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import { LibDiamond, DiamondStorage } from "../libraries/LibDiamond.sol"; + +contract UsingDiamondStorage { + function ds() internal pure returns (DiamondStorage storage) { + return LibDiamond.diamondStorage(); + } +} diff --git a/packages/ri/contracts/src/embodied/CreateEntityFromPrototypeEmbodiedSystem.sol b/packages/ri/contracts/src/embodied/CreateEntityFromPrototypeEmbodiedSystem.sol new file mode 100644 index 0000000000..c12cca5a87 --- /dev/null +++ b/packages/ri/contracts/src/embodied/CreateEntityFromPrototypeEmbodiedSystem.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import { console } from "forge-std/console.sol"; + +import { UsingAppStorage } from "../utils/UsingAppStorage.sol"; +import { AppStorage } from "../libraries/LibAppStorage.sol"; +import { LibUtils } from "../libraries/LibUtils.sol"; + +contract CreateEntityFromPrototypeEmbodiedSystem is UsingAppStorage { + function createEntityFromPrototype(bytes memory argument) external { + revert("Unimplemented"); + } +} diff --git a/packages/ri/contracts/src/embodied/README.md b/packages/ri/contracts/src/embodied/README.md new file mode 100644 index 0000000000..097fd9549f --- /dev/null +++ b/packages/ri/contracts/src/embodied/README.md @@ -0,0 +1,11 @@ +# Embodied Systems + +This folder is where one would register embodied systems. + +Embodied systems are systems that are not called from the outside, and that specifically target a target entity from a source entity. If the target entity and the source entity are different, a path check algorithm is executed. It takes into account `Traversable` and `Mined` components on each tile. Optionally, a `MaxDistance` as well as a `IgnoreTraversability` component can be applied to the spell to further control the path checker. + +## Architecture + +- Use `UsingAppStorage` to get access to the app storage, and the utils in `EmbodiedSystemLib` to register embodied systems . +- Import the contract in the content creator that utilises this embodied systems, and refer to the selector you need. +- Import the contract in the `InitializeFacet`, and register it as an embodied system using `EmbodiedSystemLib`. diff --git a/packages/ri/contracts/src/entities/IContentCreator.sol b/packages/ri/contracts/src/entities/IContentCreator.sol new file mode 100644 index 0000000000..edd9e0eb9e --- /dev/null +++ b/packages/ri/contracts/src/entities/IContentCreator.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +interface IContentCreator { + function createContent() external; +} diff --git a/packages/ri/contracts/src/entities/README.md b/packages/ri/contracts/src/entities/README.md new file mode 100644 index 0000000000..c94993cb61 --- /dev/null +++ b/packages/ri/contracts/src/entities/README.md @@ -0,0 +1,9 @@ +# Entities + +This folder is where one would register entities into the ECS system by calling library functions from ContentLib. + +## Architecture + +- Use `UsingAppStorage` to get access to the app storage, and the utils in ContentLib to register add entities to the World. +- Inherit `IContentCreator` and expose a `createContent` function. +- Import the contract in the deploy script, deploy it, and pass its address to `registerContentCreatorExternally` to instantiate the contents using a `delegatecall`. diff --git a/packages/ri/contracts/src/entities/SpellContentCreator.sol b/packages/ri/contracts/src/entities/SpellContentCreator.sol new file mode 100644 index 0000000000..84caf4be22 --- /dev/null +++ b/packages/ri/contracts/src/entities/SpellContentCreator.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { World } from "solecs/World.sol"; +import { console } from "forge-std/console.sol"; + +import { IContentCreator } from "./IContentCreator.sol"; + +import { UsingAppStorage } from "../utils/UsingAppStorage.sol"; +import { AppStorage } from "../libraries/LibAppStorage.sol"; +import { LibUtils } from "../libraries/LibUtils.sol"; + +import { SpellComponent, Spell, SpellTargetFilter, ID as SpellComponentID } from "../components/SpellComponent.sol"; +import { EmbodiedSystemArgumentComponent, ID as EmbodiedSystemArgumentComponentID } from "../components/EmbodiedSystemArgumentComponent.sol"; + +import { CreateEntityFromPrototypeEmbodiedSystem } from "../embodied/CreateEntityFromPrototypeEmbodiedSystem.sol"; + +uint256 constant SPELL_ONE = uint256(keccak256("ember.entities.spellOne")); + +contract SpellContentCreator is UsingAppStorage, IContentCreator { + function createContent() external override { + AppStorage storage s = getAppStorage(); + World world = s.world; + SpellComponent spellComponent = SpellComponent(world.getComponent(SpellComponentID)); + EmbodiedSystemArgumentComponent embodiedSystemArgument = EmbodiedSystemArgumentComponent( + world.getComponent(EmbodiedSystemArgumentComponentID) + ); + // Create spells + spellComponent.set( + SPELL_ONE, + Spell({ + embodiedSystemSelector: CreateEntityFromPrototypeEmbodiedSystem.createEntityFromPrototype.selector, + spellTargetFilter: SpellTargetFilter.TILE + }) + ); + bytes memory argument = abi.encode(uint256(42)); + embodiedSystemArgument.set(SPELL_ONE, argument); + } +} diff --git a/packages/ri/contracts/src/facets/EmberFacet.sol b/packages/ri/contracts/src/facets/EmberFacet.sol new file mode 100644 index 0000000000..98cea634bc --- /dev/null +++ b/packages/ri/contracts/src/facets/EmberFacet.sol @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { PositionComponent, Position } from "../components/PositionComponent.sol"; +import { EntityTypeComponent, EntityType } from "../components/EntityTypeComponent.sol"; +import { World } from "solecs/World.sol"; +import { Component } from "solecs/Component.sol"; +import { UsingDiamondOwner } from "../diamond/utils/UsingDiamondOwner.sol"; +import { UsingAccessControl } from "../access/UsingAccessControl.sol"; +import { AppStorage } from "../libraries/LibAppStorage.sol"; + +contract EmberFacet is UsingDiamondOwner, UsingAccessControl { + AppStorage internal s; + + function world() external view returns (address) { + return address(s.world); + } + + // Debugging + function callerEntityID() external view returns (uint256) { + return s._callerEntityID; + } + + // Debugging + function addComponentToEntityExternally( + uint256 entity, + address component, + bytes memory value + ) external { + Component c = Component(component); + c.set(entity, value); + } + + function removeComponentFromEntityExternally(uint256 entity, address component) external { + Component c = Component(component); + c.remove(entity); + } + + // Entry Points. Debugging only + function entryPoint() public populateCallerEntityID {} +} diff --git a/packages/ri/contracts/src/facets/InitializeFacet.sol b/packages/ri/contracts/src/facets/InitializeFacet.sol new file mode 100644 index 0000000000..3e28734563 --- /dev/null +++ b/packages/ri/contracts/src/facets/InitializeFacet.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { World } from "solecs/World.sol"; + +import { PersonaAccessController } from "../access/PersonaAccessController.sol"; + +import { UsingDiamondOwner } from "../diamond/utils/UsingDiamondOwner.sol"; +import { UsingAccessControl } from "../access/UsingAccessControl.sol"; +import { AppStorage, Config } from "../libraries/LibAppStorage.sol"; +import { LibContent } from "../libraries/LibContent.sol"; +import { LibAccessControl } from "../libraries/LibAccessControl.sol"; +import { LibEmbodiedSystem } from "../libraries/LibEmbodiedSystem.sol"; + +contract InitializeFacet is UsingDiamondOwner, UsingAccessControl { + AppStorage internal s; + + function initializeExternally(Config calldata config) external { + s.config = config; + s.world = new World(); + } + + function registerAccessControllerExternally(address accessControllerAddr) external { + LibAccessControl.registerAccessController(accessControllerAddr); + } + + function registerContentCreatorExternally(address contentCreatorAddr) external { + LibContent.registerContentCreator(contentCreatorAddr); + } + + function registerEmbodiedSystemExternally(address embodiedSystemAddr, bytes4 selector) external { + LibEmbodiedSystem.registerEmbodiedSystemAndSelector(embodiedSystemAddr, selector); + } +} diff --git a/packages/ri/contracts/src/facets/systems/CastSpellFacet.sol b/packages/ri/contracts/src/facets/systems/CastSpellFacet.sol new file mode 100644 index 0000000000..36e58bb440 --- /dev/null +++ b/packages/ri/contracts/src/facets/systems/CastSpellFacet.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { World } from "solecs/World.sol"; +import { Component } from "solecs/Component.sol"; + +import { LearnedSpellsComponent, ID as LearnedSpellsComponentID } from "../../components/LearnedSpellsComponent.sol"; +import { SpellComponent, Spell, ID as SpellComponentID } from "../../components/SpellComponent.sol"; +import { EmbodiedSystemArgumentComponent, ID as EmbodiedSystemArgumentComponentID } from "../../components/EmbodiedSystemArgumentComponent.sol"; + +import { UsingAccessControl } from "../../access/UsingAccessControl.sol"; + +import { AppStorage } from "../../libraries/LibAppStorage.sol"; +import { LibECS } from "../../libraries/LibECS.sol"; +import { LibEmbodiedSystem } from "../../libraries/LibEmbodiedSystem.sol"; +import { LibUtils } from "../../libraries/LibUtils.sol"; + +contract CastSpellFacet is UsingAccessControl { + AppStorage internal s; + + function castSpell( + uint256 spellEntityID, + uint256 sourceEntityID, + uint256 targetEntityID + ) public populateCallerEntityID { + SpellComponent spellComponent = SpellComponent(s.world.getComponent(SpellComponentID)); + LearnedSpellsComponent learnedSpellsComponent = LearnedSpellsComponent( + s.world.getComponent(LearnedSpellsComponentID) + ); + EmbodiedSystemArgumentComponent embodiedSystemArgumentComponent = EmbodiedSystemArgumentComponent( + s.world.getComponent(EmbodiedSystemArgumentComponentID) + ); + // Fetch the spell + require(spellComponent.has(spellEntityID), "Spell doesn't exist"); + Spell memory spell = spellComponent.getValue(spellEntityID); + // Check if callerEntityID can control the source entity + require(LibECS.doesCallerEntityIDOwnEntity(sourceEntityID), "You don't own the source entity"); + // Check if the source entity id has learned the spell + require(learnedSpellsComponent.has(sourceEntityID), "Source has no learned spells"); + uint256[] memory learnedSpells = learnedSpellsComponent.getValue(sourceEntityID); + require(LibUtils.arrayContains(learnedSpells, spellEntityID), "Source hasn't learned this spell"); + // Get argument if it exists on the spell + bytes memory argument = new bytes(0); + if (embodiedSystemArgumentComponent.has(spellEntityID)) { + argument = embodiedSystemArgumentComponent.getValue(spellEntityID); + } + // Call the embodied system + LibEmbodiedSystem.callEmbodiedSystem(spell.embodiedSystemSelector, argument); + } +} diff --git a/packages/ri/contracts/src/libraries/LibAccessControl.sol b/packages/ri/contracts/src/libraries/LibAccessControl.sol new file mode 100644 index 0000000000..8b7d53edd9 --- /dev/null +++ b/packages/ri/contracts/src/libraries/LibAccessControl.sol @@ -0,0 +1,22 @@ +pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +import { PersonaMirror } from "persona/L2/PersonaMirror.sol"; +import { LibAppStorage, AppStorage } from "./LibAppStorage.sol"; +import { LibDiamond, DiamondStorage } from "../diamond/libraries/LibDiamond.sol"; +import { LibUtils } from "./LibUtils.sol"; + +library LibAccessControl { + function getAppStorage() internal pure returns (AppStorage storage) { + return LibAppStorage.diamondStorage(); + } + + function registerAccessController(address addr) internal { + AppStorage storage appStorage = getAppStorage(); + for (uint256 i; i < appStorage.accessControllers.length; i++) { + if (appStorage.accessControllers[i] == addr) { + return; + } + } + appStorage.accessControllers.push(addr); + } +} diff --git a/packages/ri/contracts/src/libraries/LibAppStorage.sol b/packages/ri/contracts/src/libraries/LibAppStorage.sol new file mode 100644 index 0000000000..4b1a1a662f --- /dev/null +++ b/packages/ri/contracts/src/libraries/LibAppStorage.sol @@ -0,0 +1,24 @@ +import { World } from "solecs/World.sol"; + +pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT + +struct Config { + bool resetCallerEntityID; + address personaMirror; +} +struct AppStorage { + Config config; + World world; + uint256 _callerEntityID; // This is short lived and meant to be reset at the end of a function call + address[] accessControllers; + mapping(bytes4 => address) embodiedSystemSelectorToImplementation; +} + +library LibAppStorage { + function diamondStorage() internal pure returns (AppStorage storage ds) { + assembly { + ds.slot := 0 + } + } +} diff --git a/packages/ri/contracts/src/libraries/LibContent.sol b/packages/ri/contracts/src/libraries/LibContent.sol new file mode 100644 index 0000000000..7f1f4a5696 --- /dev/null +++ b/packages/ri/contracts/src/libraries/LibContent.sol @@ -0,0 +1,13 @@ +pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +import { PersonaMirror } from "persona/L2/PersonaMirror.sol"; +import { LibAppStorage, AppStorage } from "./LibAppStorage.sol"; +import { LibDiamond, DiamondStorage } from "../diamond/libraries/LibDiamond.sol"; +import { LibUtils } from "./LibUtils.sol"; +import { IContentCreator } from "../entities/IContentCreator.sol"; + +library LibContent { + function registerContentCreator(address contentCreatorAddr) internal { + LibUtils.safeDelegateCall(contentCreatorAddr, abi.encodeWithSelector(IContentCreator.createContent.selector)); + } +} diff --git a/packages/ri/contracts/src/libraries/LibECS.sol b/packages/ri/contracts/src/libraries/LibECS.sol new file mode 100644 index 0000000000..27e691ac2d --- /dev/null +++ b/packages/ri/contracts/src/libraries/LibECS.sol @@ -0,0 +1,41 @@ +pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +import { LibAppStorage, AppStorage } from "./LibAppStorage.sol"; +import { OwnedByComponent, OwnedBy, ID as OwnedByComponentID } from "../components/OwnedByComponent.sol"; + +library LibECS { + function getAppStorage() internal pure returns (AppStorage storage) { + return LibAppStorage.diamondStorage(); + } + + function resolveOwnedByChain(uint256 entityID) internal view returns (uint256) { + AppStorage storage s = getAppStorage(); + OwnedByComponent ownedByComponent = OwnedByComponent(s.world.getComponent(OwnedByComponentID)); + uint256 currentEntityID = entityID; + while (true) { + if (ownedByComponent.has(currentEntityID)) { + currentEntityID = ownedByComponent.getValue(currentEntityID).ownedBy; + } else { + return currentEntityID; + } + } + return currentEntityID; + } + + function doesCallerEntityIDOwnEntity(uint256 entityID) internal view returns (bool) { + AppStorage storage s = getAppStorage(); + OwnedByComponent ownedByComponent = OwnedByComponent(s.world.getComponent(OwnedByComponentID)); + uint256 currentEntityID = entityID; + while (true) { + if (currentEntityID == s._callerEntityID) { + return true; + } + if (ownedByComponent.has(currentEntityID)) { + currentEntityID = ownedByComponent.getValue(currentEntityID).ownedBy; + } else { + return false; + } + } + return false; + } +} diff --git a/packages/ri/contracts/src/libraries/LibEmbodiedSystem.sol b/packages/ri/contracts/src/libraries/LibEmbodiedSystem.sol new file mode 100644 index 0000000000..10283ff9c2 --- /dev/null +++ b/packages/ri/contracts/src/libraries/LibEmbodiedSystem.sol @@ -0,0 +1,24 @@ +pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +import { LibAppStorage, AppStorage } from "./LibAppStorage.sol"; +import { LibDiamond, DiamondStorage } from "../diamond/libraries/LibDiamond.sol"; +import { LibUtils } from "./LibUtils.sol"; + +library LibEmbodiedSystem { + function getAppStorage() internal pure returns (AppStorage storage) { + return LibAppStorage.diamondStorage(); + } + + function registerEmbodiedSystemAndSelector(address addr, bytes4 selector) internal { + AppStorage storage appStorage = getAppStorage(); + require(appStorage.embodiedSystemSelectorToImplementation[selector] == address(0), "Selector already registered"); + appStorage.embodiedSystemSelectorToImplementation[selector] = addr; + } + + function callEmbodiedSystem(bytes4 selector, bytes memory argument) internal { + AppStorage storage appStorage = getAppStorage(); + address embodiedSystemImplementation = appStorage.embodiedSystemSelectorToImplementation[selector]; + require(embodiedSystemImplementation != address(0), "Selector has not been registered"); + LibUtils.safeDelegateCall(embodiedSystemImplementation, abi.encodeWithSelector(selector, argument)); + } +} diff --git a/packages/ri/contracts/src/libraries/LibPersona.sol b/packages/ri/contracts/src/libraries/LibPersona.sol new file mode 100644 index 0000000000..7b14c49b91 --- /dev/null +++ b/packages/ri/contracts/src/libraries/LibPersona.sol @@ -0,0 +1,31 @@ +pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +import { PersonaMirror } from "persona/L2/PersonaMirror.sol"; +import { LibAppStorage, AppStorage } from "./LibAppStorage.sol"; +import { LibDiamond, DiamondStorage } from "../diamond/libraries/LibDiamond.sol"; + +library LibPersona { + function getAppStorage() internal pure returns (AppStorage storage) { + return LibAppStorage.diamondStorage(); + } + + function getDiamondStorage() internal pure returns (DiamondStorage storage) { + return LibDiamond.diamondStorage(); + } + + function getActivePersona() internal view returns (uint256) { + return getActivePersonaFromAddress(msg.sender, msg.sig); + } + + function getActivePersonaFromAddress(address addr, bytes4 sig) internal view returns (uint256) { + // TODO: make it gsn compatible + DiamondStorage storage diamondStorage = getDiamondStorage(); + PersonaMirror personaMirror = PersonaMirror(getAppStorage().config.personaMirror); + uint256 personaId = personaMirror.getActivePersona(addr, diamondStorage.diamond); + if (personaMirror.isAuthorized(personaId, addr, diamondStorage.diamond, sig)) { + return personaId; + } else { + return 0; + } + } +} diff --git a/packages/ri/contracts/src/libraries/LibUtils.sol b/packages/ri/contracts/src/libraries/LibUtils.sol new file mode 100644 index 0000000000..05fa7037d1 --- /dev/null +++ b/packages/ri/contracts/src/libraries/LibUtils.sol @@ -0,0 +1,41 @@ +pragma solidity ^0.8.0; + +// SPDX-License-Identifier: MIT + +library LibUtils { + function toHex(bytes memory data) internal pure returns (bytes memory res) { + res = new bytes(data.length * 2); + bytes memory alphabet = "0123456789abcdef"; + for (uint256 i = 0; i < data.length; i++) { + res[i * 2 + 0] = alphabet[uint256(uint8(data[i])) >> 4]; + res[i * 2 + 1] = alphabet[uint256(uint8(data[i])) & 15]; + } + } + + function arrayContains(uint256[] memory arr, uint256 value) internal pure returns (bool) { + for (uint256 i; i < arr.length; i++) { + if (arr[i] == value) { + return true; + } + } + return false; + } + + function safeDelegateCall(address addr, bytes memory callData) internal returns (bytes memory) { + (bool success, bytes memory returnData) = addr.delegatecall(callData); + // if the function call reverted + if (success == false) { + // if there is a return reason string + if (returnData.length > 0) { + // bubble up any reason for revert + assembly { + let returnDataSize := mload(returnData) + revert(add(32, returnData), returnDataSize) + } + } else { + revert("DelegateCall reverted"); + } + } + return returnData; + } +} diff --git a/packages/ri/contracts/src/test/AccessControl.t.sol b/packages/ri/contracts/src/test/AccessControl.t.sol new file mode 100644 index 0000000000..14a8cc5154 --- /dev/null +++ b/packages/ri/contracts/src/test/AccessControl.t.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { World } from "solecs/World.sol"; +import { EmberFacet } from "../facets/EmberFacet.sol"; +import { AppStorage } from "../libraries/LibAppStorage.sol"; +import { PersonaFixture } from "./fixtures/PersonaFixture.sol"; +import { EmberTest } from "./EmberTest.sol"; + +contract AccessControlTest is EmberTest { + function testAccessControlWithPersona() public { + uint256 PLAYER_ID = uint256(keccak256("alice")); + uint256 personaId = deploy.personaFixture().mintPersonaToAddressAndSetupImpersonator(alice, bob, PLAYER_ID); + // call the entry point and make sure the _callerEntityID is correct + vm.startPrank(bob); + emberFacet.entryPoint(); + uint256 callerEntityID = emberFacet.callerEntityID(); + assertEq(callerEntityID, PLAYER_ID); + vm.stopPrank(); + // call the entry point with alice and make sure the _callerEntityID is correct + vm.startPrank(alice); + deploy.personaMirror().impersonate(personaId, diamondAddress); + emberFacet.entryPoint(); + callerEntityID = emberFacet.callerEntityID(); + assertEq(callerEntityID, PLAYER_ID); + vm.stopPrank(); + // now call the entry point with a random address and make sure the _callerEntityID is 0 + vm.startPrank(eve); + emberFacet.entryPoint(); + callerEntityID = emberFacet.callerEntityID(); + assertEq(callerEntityID, 0); + vm.stopPrank(); + } +} diff --git a/packages/ri/contracts/src/test/Deploy.t.sol b/packages/ri/contracts/src/test/Deploy.t.sol new file mode 100644 index 0000000000..16651ba9fb --- /dev/null +++ b/packages/ri/contracts/src/test/Deploy.t.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { DSTest } from "ds-test/test.sol"; +import { Vm } from "forge-std/Vm.sol"; +import { World } from "solecs/World.sol"; +import { Utilities } from "./utils/Utilities.sol"; +import { Deploy } from "./utils/Deploy.sol"; +import { EmberFacet } from "../facets/EmberFacet.sol"; +import { AppStorage } from "../libraries/LibAppStorage.sol"; +import { PersonaFixture } from "./fixtures/PersonaFixture.sol"; + +contract DeployTest is DSTest { + Vm internal immutable vm = Vm(HEVM_ADDRESS); + Utilities internal immutable utils = new Utilities(); + + Deploy internal deploy = new Deploy(); + + function testDeploy() public { + deploy.deployEmber(); + } + + function testDeployAndSetupFixtures() public { + deploy.deployEmber(); + deploy.deployTestFixtures(); + } +} diff --git a/packages/ri/contracts/src/test/EmberTest.sol b/packages/ri/contracts/src/test/EmberTest.sol new file mode 100644 index 0000000000..e51b84906c --- /dev/null +++ b/packages/ri/contracts/src/test/EmberTest.sol @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { DSTest } from "ds-test/test.sol"; +import { Vm } from "forge-std/Vm.sol"; +import { World } from "solecs/World.sol"; +import { Utilities } from "./utils/Utilities.sol"; +import { Deploy } from "./utils/Deploy.sol"; +// Facets +import { EmberFacet } from "../facets/EmberFacet.sol"; +import { InitializeFacet } from "../facets/InitializeFacet.sol"; +import { CastSpellFacet } from "../facets/systems/CastSpellFacet.sol"; +// Components +import { EmbodiedSystemArgumentComponent, ID as EmbodiedSystemArgumentComponentID } from "../components/EmbodiedSystemArgumentComponent.sol"; +import { EntityTypeComponent, ID as EntityTypeComponentID } from "../components/EntityTypeComponent.sol"; +import { LearnedSpellsComponent, ID as LearnedSpellsComponentID } from "../components/LearnedSpellsComponent.sol"; +import { MaxDistanceComponent, ID as MaxDistanceComponentID } from "../components/MaxDistanceComponent.sol"; +import { OwnedByComponent, ID as OwnedByComponentID } from "../components/OwnedByComponent.sol"; +import { PersonaComponent, ID as PersonaComponentID } from "../components/PersonaComponent.sol"; +import { PositionComponent, ID as PositionComponentID } from "../components/PositionComponent.sol"; +import { SpellComponent, ID as SpellComponentID } from "../components/SpellComponent.sol"; + +contract EmberTest is DSTest { + Vm internal immutable vm = Vm(HEVM_ADDRESS); + Utilities internal immutable utils = new Utilities(); + + address payable internal alice; + address payable internal bob; + address payable internal eve; + address internal deployer; + address internal diamondAddress; + + Deploy internal deploy = new Deploy(); + + // Facets + EmberFacet internal emberFacet; + InitializeFacet internal initializeFacet; + CastSpellFacet internal castSpellFacet; + // Ecs + World internal world; + // Components + EmbodiedSystemArgumentComponent internal embodiedSystemArgumentComponent; + EntityTypeComponent internal entityTypeComponent; + LearnedSpellsComponent internal learnedSpellsComponent; + MaxDistanceComponent internal maxDistanceComponent; + OwnedByComponent internal ownedByComponent; + PersonaComponent internal personaComponent; + PositionComponent internal positionComponent; + SpellComponent internal spellComponent; + + function setUp() public { + deployer = deploy.deployer(); + diamondAddress = deploy.deployEmber(); + deploy.deployTestFixtures(); + + emberFacet = EmberFacet(diamondAddress); + initializeFacet = InitializeFacet(diamondAddress); + castSpellFacet = CastSpellFacet(diamondAddress); + + alice = utils.getNextUserAddress(); + bob = utils.getNextUserAddress(); + eve = utils.getNextUserAddress(); + world = deploy.world(); + + embodiedSystemArgumentComponent = EmbodiedSystemArgumentComponent( + world.getComponent(EmbodiedSystemArgumentComponentID) + ); + entityTypeComponent = EntityTypeComponent(world.getComponent(EntityTypeComponentID)); + learnedSpellsComponent = LearnedSpellsComponent(world.getComponent(LearnedSpellsComponentID)); + maxDistanceComponent = MaxDistanceComponent(world.getComponent(MaxDistanceComponentID)); + ownedByComponent = OwnedByComponent(world.getComponent(OwnedByComponentID)); + personaComponent = PersonaComponent(world.getComponent(PersonaComponentID)); + positionComponent = PositionComponent(world.getComponent(PositionComponentID)); + spellComponent = SpellComponent(world.getComponent(SpellComponentID)); + } +} diff --git a/packages/ri/contracts/src/test/components/PositionComponent.t.sol b/packages/ri/contracts/src/test/components/PositionComponent.t.sol new file mode 100644 index 0000000000..261a9d4738 --- /dev/null +++ b/packages/ri/contracts/src/test/components/PositionComponent.t.sol @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { DSTest } from "ds-test/test.sol"; +import { Vm } from "forge-std/Vm.sol"; +import { World } from "solecs/World.sol"; +import { Utilities } from "../utils/Utilities.sol"; +import { PositionComponent, Position } from "../../components/PositionComponent.sol"; + +contract PositionComponentTest is DSTest { + Vm internal immutable vm = Vm(HEVM_ADDRESS); + + Utilities internal utils; + address payable[] internal users; + + PositionComponent internal position; + + function setUp() public { + position = new PositionComponent(address(new World())); + } + + function testSetAndGetValue() public { + assertTrue(!position.has(1)); + position.set(1, Position({ x: 1, y: 2 })); + assertTrue(position.has(1)); + Position memory pos1 = position.getValue(1); + assertEq(pos1.x, 1); + assertEq(pos1.y, 2); + + position.set(1, Position({ x: 2, y: 2 })); + position.set(2, Position({ x: 2, y: 1 })); + assertTrue(position.has(1)); + assertTrue(position.has(2)); + + pos1 = position.getValue(1); + assertEq(pos1.x, 2); + assertEq(pos1.y, 2); + + Position memory pos2 = position.getValue(2); + assertEq(pos2.x, 2); + assertEq(pos2.y, 1); + } + + function testRemove() public { + assertTrue(!position.has(1)); + position.set(1, Position({ x: 2, y: 1 })); + assertTrue(position.has(1)); + position.remove(1); + assertTrue(!position.has(1)); + } + + function testGetEntities() public { + position.set(1, Position({ x: 1, y: 1 })); + position.set(2, Position({ x: 4, y: 7 })); + position.set(3, Position({ x: 7, y: 8 })); + + uint256[] memory entities = position.getEntities(); + assertEq(entities.length, 3); + assertEq(entities[0], 1); + assertEq(entities[1], 2); + assertEq(entities[2], 3); + } + + function testGetEntitiesWithValue() public { + position.set(1, Position({ x: 1, y: 1 })); + position.set(2, Position({ x: 1, y: 1 })); + position.set(3, Position({ x: 7, y: 8 })); + + uint256[] memory entities = position.getEntitiesWithValue(Position({ x: 1, y: 1 })); + assertEq(entities.length, 2); + assertEq(entities[0], 1); + assertEq(entities[1], 2); + + entities = position.getEntitiesWithValue(Position({ x: 7, y: 8 })); + assertEq(entities.length, 1); + assertEq(entities[0], 3); + + entities = position.getEntitiesWithValue(Position({ x: 7, y: 1 })); + assertEq(entities.length, 0); + } +} diff --git a/packages/ri/contracts/src/test/fixtures/PersonaFixture.sol b/packages/ri/contracts/src/test/fixtures/PersonaFixture.sol new file mode 100644 index 0000000000..01b0291ee3 --- /dev/null +++ b/packages/ri/contracts/src/test/fixtures/PersonaFixture.sol @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { DSTest } from "ds-test/test.sol"; +import { Vm } from "forge-std/Vm.sol"; +import { World } from "solecs/World.sol"; + +import { PersonaComponent, Persona, ID as PersonaComponentID } from "../../components/PersonaComponent.sol"; + +import { Deploy } from "../utils/Deploy.sol"; + +import { MockL2Bridge } from "persona/test/mocks/MockL2Bridge.sol"; +import { MockConsumer } from "persona/test/mocks/MockConsumer.sol"; +import { EmptyPersonaTokenURIGenerator } from "persona/L1/EmptyPersonaTokenURIGenerator.sol"; +import { PersonaMirror } from "persona/L2/PersonaMirror.sol"; +import { PersonaAllMinter } from "persona/L1/PersonaAllMinter.sol"; + +contract PersonaFixture is DSTest { + Vm internal immutable vm = Vm(HEVM_ADDRESS); + Deploy internal deploy; + + constructor(address deployAddr) { + deploy = Deploy(deployAddr); + } + + function mintPersonaToAddressAndSetupImpersonator( + address alice, + address bob, + uint256 playerEntityID + ) public returns (uint256) { + // mint a persona for alice + address deployer = deploy.deployer(); + address diamondAddress = address(deploy.diamond()); + World world = deploy.world(); + vm.startPrank(deployer); + PersonaAllMinter personaAllMinter = deploy.personaAllMinter(); + PersonaMirror personaMirror = deploy.personaMirror(); + personaAllMinter.mintPersona(alice); + uint256 personaId = 1; + vm.stopPrank(); + // give access to bob + vm.startPrank(alice); + personaMirror.authorize(personaId, bob, diamondAddress, new bytes4[](0)); + vm.stopPrank(); + // impersonate that persona with bob + vm.startPrank(bob); + personaMirror.impersonate(personaId, diamondAddress); + vm.stopPrank(); + // create an entity with a persona component inside the ECS system + vm.startPrank(diamondAddress); + PersonaComponent personaComponent = PersonaComponent(world.getComponent(PersonaComponentID)); + personaComponent.set(playerEntityID, Persona(personaId)); + vm.stopPrank(); + return personaId; + } +} diff --git a/packages/ri/contracts/src/test/fixtures/TestContentCreator.sol b/packages/ri/contracts/src/test/fixtures/TestContentCreator.sol new file mode 100644 index 0000000000..fece75afb7 --- /dev/null +++ b/packages/ri/contracts/src/test/fixtures/TestContentCreator.sol @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { World } from "solecs/World.sol"; +import { console } from "forge-std/console.sol"; + +import { IContentCreator } from "../../entities/IContentCreator.sol"; + +import { UsingAppStorage } from "../../utils/UsingAppStorage.sol"; +import { AppStorage } from "../../libraries/LibAppStorage.sol"; +import { LibUtils } from "../../libraries/LibUtils.sol"; + +import { OwnedByComponent, OwnedBy, ID as OwnedByComponentID } from "../../components/OwnedByComponent.sol"; +import { LearnedSpellsComponent, ID as LearnedSpellsComponentID } from "../../components/LearnedSpellsComponent.sol"; +import { SpellComponent, Spell, SpellTargetFilter, ID as SpellComponentID } from "../../components/SpellComponent.sol"; +import { EmbodiedSystemArgumentComponent, ID as EmbodiedSystemArgumentComponentID } from "../../components/EmbodiedSystemArgumentComponent.sol"; + +import { TestEmbodiedSystem } from "./TestEmbodiedSystem.sol"; + +uint256 constant TEST_SPELL_ID = uint256(keccak256("ember.entities.testSpell")); +uint256 constant UNLEARNED_TEST_SPELL_ID = uint256(keccak256("ember.entities.unlearnedTestSpell")); +uint256 constant SPELL_CASTER_1 = uint256(keccak256("ember.entities.spellCaster1")); +uint256 constant SPELL_CASTER_2 = uint256(keccak256("ember.entities.spellCaster2")); +uint256 constant PLAYER_1 = uint256(keccak256("ember.entities.player1")); +uint256 constant PLAYER_2 = uint256(keccak256("ember.entities.player2")); + +contract TestContentCreator is UsingAppStorage, IContentCreator { + function createContent() external override { + AppStorage storage s = getAppStorage(); + World world = s.world; + // Reference to components + OwnedByComponent ownedByComponent = OwnedByComponent(world.getComponent(OwnedByComponentID)); + SpellComponent spellComponent = SpellComponent(world.getComponent(SpellComponentID)); + LearnedSpellsComponent learnedSpellsComponent = LearnedSpellsComponent( + world.getComponent(LearnedSpellsComponentID) + ); + EmbodiedSystemArgumentComponent embodiedSystemArgument = EmbodiedSystemArgumentComponent( + world.getComponent(EmbodiedSystemArgumentComponentID) + ); + // Create test spells + // TEST_SPELL_ID + spellComponent.set( + TEST_SPELL_ID, + Spell({ + embodiedSystemSelector: TestEmbodiedSystem.dummyEmbodiedSystem.selector, + spellTargetFilter: SpellTargetFilter.TILE + }) + ); + bytes memory argument = abi.encode(uint256(42)); + embodiedSystemArgument.set(TEST_SPELL_ID, argument); + // UNLEARNED_TEST_SPELL_ID + spellComponent.set( + UNLEARNED_TEST_SPELL_ID, + Spell({ + embodiedSystemSelector: TestEmbodiedSystem.dummyEmbodiedSystem.selector, + spellTargetFilter: SpellTargetFilter.TILE + }) + ); + // Create spell casters + // SPELL_CASTER_1 + uint256[] memory spellCasterLearnedSpells = new uint256[](1); + spellCasterLearnedSpells[0] = TEST_SPELL_ID; + learnedSpellsComponent.set(SPELL_CASTER_1, spellCasterLearnedSpells); + ownedByComponent.set(SPELL_CASTER_1, OwnedBy(PLAYER_1)); + // SPELL_CASTER_2 + spellCasterLearnedSpells = new uint256[](1); + spellCasterLearnedSpells[0] = TEST_SPELL_ID; + learnedSpellsComponent.set(SPELL_CASTER_2, spellCasterLearnedSpells); + ownedByComponent.set(SPELL_CASTER_2, OwnedBy(PLAYER_2)); + } +} diff --git a/packages/ri/contracts/src/test/fixtures/TestEmbodiedSystem.sol b/packages/ri/contracts/src/test/fixtures/TestEmbodiedSystem.sol new file mode 100644 index 0000000000..49ec6b9a0b --- /dev/null +++ b/packages/ri/contracts/src/test/fixtures/TestEmbodiedSystem.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; +import { console } from "forge-std/console.sol"; +import { DSTest } from "ds-test/test.sol"; + +import { UsingAppStorage } from "../../utils/UsingAppStorage.sol"; +import { AppStorage } from "../../libraries/LibAppStorage.sol"; +import { LibUtils } from "../../libraries/LibUtils.sol"; + +contract TestEmbodiedSystem is UsingAppStorage, DSTest { + function dummyEmbodiedSystem(bytes memory argument) external { + assertEq(abi.decode(argument, (uint256)), 42); + } +} diff --git a/packages/ri/contracts/src/test/systems/Spells.t.sol b/packages/ri/contracts/src/test/systems/Spells.t.sol new file mode 100644 index 0000000000..02bd00d38c --- /dev/null +++ b/packages/ri/contracts/src/test/systems/Spells.t.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { EmberTest } from "../EmberTest.sol"; + +import { SpellComponent, Spell, ID as SpellComponentID } from "../../components/SpellComponent.sol"; +import { TEST_SPELL_ID, UNLEARNED_TEST_SPELL_ID, SPELL_CASTER_1, SPELL_CASTER_2, PLAYER_1 } from "../fixtures/TestContentCreator.sol"; +import { TestEmbodiedSystem } from "../fixtures/TestEmbodiedSystem.sol"; +import { PersonaFixture } from "../fixtures/PersonaFixture.sol"; + +contract SpellsTest is EmberTest { + function testSpellCreatedByContentCreator() public { + Spell memory spell = spellComponent.getValue(TEST_SPELL_ID); + assertEq(spell.embodiedSystemSelector, TestEmbodiedSystem.dummyEmbodiedSystem.selector); + } + + function testCastTestSpell() public { + deploy.personaFixture().mintPersonaToAddressAndSetupImpersonator(alice, bob, PLAYER_1); + vm.startPrank(bob); + castSpellFacet.castSpell(TEST_SPELL_ID, SPELL_CASTER_1, 0); + vm.stopPrank(); + } + + function testFailCastTestSpellOnUnownedSpellCaster() public { + deploy.personaFixture().mintPersonaToAddressAndSetupImpersonator(alice, bob, PLAYER_1); + vm.startPrank(bob); + castSpellFacet.castSpell(TEST_SPELL_ID, SPELL_CASTER_2, 0); + vm.stopPrank(); + } + + function testFailCastNonSpell() public { + deploy.personaFixture().mintPersonaToAddressAndSetupImpersonator(alice, bob, PLAYER_1); + vm.startPrank(bob); + castSpellFacet.castSpell(uint256(keccak256("ember.entities.fakeSpell")), SPELL_CASTER_1, 0); + vm.stopPrank(); + } + + function testFailCastNonLearnedSpell() public { + deploy.personaFixture().mintPersonaToAddressAndSetupImpersonator(alice, bob, PLAYER_1); + vm.startPrank(bob); + castSpellFacet.castSpell(UNLEARNED_TEST_SPELL_ID, SPELL_CASTER_1, 0); + vm.stopPrank(); + } +} diff --git a/packages/ri/contracts/src/test/utils/Deploy.sol b/packages/ri/contracts/src/test/utils/Deploy.sol new file mode 100644 index 0000000000..be64de404f --- /dev/null +++ b/packages/ri/contracts/src/test/utils/Deploy.sol @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +// Foundry +import { DSTest } from "ds-test/test.sol"; +import { Vm } from "forge-std/Vm.sol"; +import { console } from "forge-std/console.sol"; +import { Utilities } from "./Utilities.sol"; +// ECS +import { World } from "solecs/World.sol"; +// Diamonds +import { Diamantaire } from "../../diamond/Diamantaire.sol"; +import { Diamond } from "../../diamond/Diamond.sol"; +import { IDiamondCut } from "../../diamond/interfaces/IDiamondCut.sol"; +import { AppStorage, Config } from "../../libraries/LibAppStorage.sol"; +// Facets +import { EmberFacet } from "../../facets/EmberFacet.sol"; +import { InitializeFacet } from "../../facets/InitializeFacet.sol"; +// Facets: Systems +import { CastSpellFacet } from "../../facets/systems/CastSpellFacet.sol"; + +// Components +import { EmbodiedSystemArgumentComponent } from "../../components/EmbodiedSystemArgumentComponent.sol"; +import { EntityTypeComponent } from "../../components/EntityTypeComponent.sol"; +import { LearnedSpellsComponent } from "../../components/LearnedSpellsComponent.sol"; +import { MaxDistanceComponent } from "../../components/MaxDistanceComponent.sol"; +import { OwnedByComponent } from "../../components/OwnedByComponent.sol"; +import { PersonaComponent } from "../../components/PersonaComponent.sol"; +import { PositionComponent } from "../../components/PositionComponent.sol"; +import { SpellComponent } from "../../components/SpellComponent.sol"; + +// Access Controllers +import { PersonaAccessController } from "../../access/PersonaAccessController.sol"; + +// Content Creators +import { SpellContentCreator } from "../../entities/SpellContentCreator.sol"; + +// Embodied Systems +import { CreateEntityFromPrototypeEmbodiedSystem } from "../../embodied/CreateEntityFromPrototypeEmbodiedSystem.sol"; + +// Outside World +import { MockL2Bridge } from "persona/test/mocks/MockL2Bridge.sol"; +import { MockConsumer } from "persona/test/mocks/MockConsumer.sol"; +import { Persona } from "persona/L1/Persona.sol"; +import { EmptyPersonaTokenURIGenerator } from "persona/L1/EmptyPersonaTokenURIGenerator.sol"; +import { PersonaMirror } from "persona/L2/PersonaMirror.sol"; +import { PersonaAllMinter } from "persona/L1/PersonaAllMinter.sol"; + +// Fixtures +import { TestContentCreator } from "../fixtures/TestContentCreator.sol"; +import { TestEmbodiedSystem } from "../fixtures/TestEmbodiedSystem.sol"; +import { PersonaFixture } from "../fixtures/PersonaFixture.sol"; + +contract Deploy is DSTest { + Vm internal immutable vm = Vm(HEVM_ADDRESS); + Utilities internal immutable utils = new Utilities(); + + Diamantaire internal diamantaire; + address public deployer; + Diamond public diamond; + World public world; + InitializeFacet public initializeFacetOnDiamond; + EmberFacet public emberFacetOnDiamond; + + PersonaFixture public personaFixture; + + MockL2Bridge public bridge; + Persona public persona; + PersonaAllMinter public personaAllMinter; + EmptyPersonaTokenURIGenerator public tokenURIGenerator; + PersonaMirror public personaMirror; + MockConsumer public consumer; + + function deployEmber() public returns (address) { + deployer = utils.getNextUserAddress(); + vm.startPrank(deployer); + + // deploy persona, persona mirror, and the bridge + bridge = new MockL2Bridge(); + tokenURIGenerator = new EmptyPersonaTokenURIGenerator(); + persona = new Persona("L", "L", address(bridge), address(0)); + personaAllMinter = new PersonaAllMinter(); + personaAllMinter.setPersona(address(persona)); + persona.setMinter(address(personaAllMinter), true); + personaMirror = new PersonaMirror(address(persona), address(bridge)); + persona.setPersonaMirrorL2(address(personaMirror)); + consumer = new MockConsumer(address(personaMirror)); + + diamantaire = new Diamantaire(); + + bytes4[] memory functionSelectors; + + IDiamondCut.FacetCut[] memory diamondCut = new IDiamondCut.FacetCut[](3); + + // ------------------------------------------------------------------------- + // adding initialize facet (add function selectors here) + // ------------------------------------------------------------------------- + InitializeFacet initializeFacet = new InitializeFacet(); + + functionSelectors = new bytes4[](4); + functionSelectors[0] = InitializeFacet.initializeExternally.selector; + functionSelectors[1] = InitializeFacet.registerAccessControllerExternally.selector; + functionSelectors[2] = InitializeFacet.registerContentCreatorExternally.selector; + functionSelectors[3] = InitializeFacet.registerEmbodiedSystemExternally.selector; + + diamondCut[0] = IDiamondCut.FacetCut({ + facetAddress: address(initializeFacet), + action: IDiamondCut.FacetCutAction.Add, + functionSelectors: functionSelectors + }); + + // ------------------------------------------------------------------------- + // adding ember facet (add function selectors here) + // ------------------------------------------------------------------------- + EmberFacet emberFacet = new EmberFacet(); + + functionSelectors = new bytes4[](5); + functionSelectors[0] = EmberFacet.addComponentToEntityExternally.selector; + functionSelectors[1] = EmberFacet.removeComponentFromEntityExternally.selector; + functionSelectors[2] = EmberFacet.world.selector; + functionSelectors[3] = EmberFacet.callerEntityID.selector; + functionSelectors[4] = EmberFacet.entryPoint.selector; + + diamondCut[1] = IDiamondCut.FacetCut({ + facetAddress: address(emberFacet), + action: IDiamondCut.FacetCutAction.Add, + functionSelectors: functionSelectors + }); + + // ------------------------------------------------------------------------- + // adding cast spell facet + // ------------------------------------------------------------------------- + CastSpellFacet castSpellFacet = new CastSpellFacet(); + + functionSelectors = new bytes4[](1); + functionSelectors[0] = CastSpellFacet.castSpell.selector; + + diamondCut[2] = IDiamondCut.FacetCut({ + facetAddress: address(castSpellFacet), + action: IDiamondCut.FacetCutAction.Add, + functionSelectors: functionSelectors + }); + + // Call initialize on the initialize facet + bytes memory data = abi.encodeWithSignature( + "initializeExternally((bool,address))", + Config({ resetCallerEntityID: false, personaMirror: address(personaMirror) }) + ); + // Create the diamond + diamond = diamantaire.createDiamond(deployer, diamondCut, data, 0); + address diamondAddress = address(diamond); + // Create reference to facets and the World + emberFacetOnDiamond = EmberFacet(diamondAddress); + initializeFacetOnDiamond = InitializeFacet(diamondAddress); + address worldAddress = emberFacetOnDiamond.world(); + world = World(worldAddress); + // Create each component and transfer ownership to the ember contract + (new EmbodiedSystemArgumentComponent(worldAddress)).transferOwnership(diamondAddress); + (new EntityTypeComponent(worldAddress)).transferOwnership(diamondAddress); + (new LearnedSpellsComponent(worldAddress)).transferOwnership(diamondAddress); + (new MaxDistanceComponent(worldAddress)).transferOwnership(diamondAddress); + (new OwnedByComponent(worldAddress)).transferOwnership(diamondAddress); + (new PersonaComponent(worldAddress)).transferOwnership(diamondAddress); + (new PositionComponent(worldAddress)).transferOwnership(diamondAddress); + (new SpellComponent(worldAddress)).transferOwnership(diamondAddress); + // Register access controllers + initializeFacetOnDiamond.registerAccessControllerExternally(address(new PersonaAccessController())); + // Register content creators + initializeFacetOnDiamond.registerContentCreatorExternally(address(new SpellContentCreator())); + // Register embodied systems + address createEntityFromPrototypeEmbodiedSystem = address(new CreateEntityFromPrototypeEmbodiedSystem()); + initializeFacetOnDiamond.registerEmbodiedSystemExternally( + createEntityFromPrototypeEmbodiedSystem, + CreateEntityFromPrototypeEmbodiedSystem.createEntityFromPrototype.selector + ); + + vm.stopPrank(); + return address(diamond); + } + + function deployTestFixtures() public { + vm.startPrank(deployer); + require(address(diamond) != address(0), "Diamond not deployed yet"); + // Register content creators + initializeFacetOnDiamond.registerContentCreatorExternally(address(new TestContentCreator())); + // Register embodied systems + address testEmbodiedSystem = address(new TestEmbodiedSystem()); + initializeFacetOnDiamond.registerEmbodiedSystemExternally( + testEmbodiedSystem, + TestEmbodiedSystem.dummyEmbodiedSystem.selector + ); + personaFixture = new PersonaFixture(address(this)); + vm.stopPrank(); + } +} diff --git a/packages/ri/contracts/src/test/utils/Utilities.sol b/packages/ri/contracts/src/test/utils/Utilities.sol new file mode 100644 index 0000000000..fadcbca508 --- /dev/null +++ b/packages/ri/contracts/src/test/utils/Utilities.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity >=0.8.0; + +import { DSTest } from "ds-test/test.sol"; +import { Vm } from "forge-std/Vm.sol"; + +//common utilities for forge tests +contract Utilities is DSTest { + Vm internal immutable vm = Vm(HEVM_ADDRESS); + bytes32 internal nextUser = keccak256(abi.encodePacked("user address")); + + function getNextUserAddress() external returns (address payable) { + //bytes32 to address conversion + address payable user = payable(address(uint160(uint256(nextUser)))); + nextUser = keccak256(abi.encodePacked(nextUser)); + return user; + } + + //create users with 100 ether balance + function createUsers(uint256 userNum) external returns (address payable[] memory) { + address payable[] memory users = new address payable[](userNum); + for (uint256 i = 0; i < userNum; i++) { + address payable user = this.getNextUserAddress(); + vm.deal(user, 100 ether); + users[i] = user; + } + return users; + } + + //move block.number forward by a given number of blocks + function mineBlocks(uint256 numBlocks) external { + uint256 targetBlock = block.number + numBlocks; + vm.roll(targetBlock); + } +} diff --git a/packages/ri/contracts/src/utils/LocalLatticeGameLocator.sol b/packages/ri/contracts/src/utils/LocalLatticeGameLocator.sol new file mode 100644 index 0000000000..7b16401009 --- /dev/null +++ b/packages/ri/contracts/src/utils/LocalLatticeGameLocator.sol @@ -0,0 +1,9 @@ +pragma solidity ^0.8.0; + +contract LocalLatticeGameLocator { + address public localLatticeGameAddress; + + function setLocalLatticeGameAddress(address localLatticeGameAddr) public { + localLatticeGameAddress = localLatticeGameAddr; + } +} diff --git a/packages/ri/contracts/src/utils/UsingAppStorage.sol b/packages/ri/contracts/src/utils/UsingAppStorage.sol new file mode 100644 index 0000000000..edc0c16400 --- /dev/null +++ b/packages/ri/contracts/src/utils/UsingAppStorage.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; +import { LibAppStorage, AppStorage } from "../libraries/LibAppStorage.sol"; + +contract UsingAppStorage { + function getAppStorage() internal pure returns (AppStorage storage) { + return LibAppStorage.diamondStorage(); + } +} diff --git a/packages/ri/contracts/tasks/compile.ts b/packages/ri/contracts/tasks/compile.ts new file mode 100644 index 0000000000..115688b19c --- /dev/null +++ b/packages/ri/contracts/tasks/compile.ts @@ -0,0 +1,49 @@ +import { TASK_COMPILE_SOLIDITY } from "hardhat/builtin-tasks/task-names"; +import * as fs from "fs"; +import * as path from "path"; +import { subtask } from "hardhat/config"; + +// TODO: fix + +subtask(TASK_COMPILE_SOLIDITY).setAction( + async ( + { force, quiet }: { force: boolean; quiet: boolean }, + { artifacts, config, run, hardhatArguments }, + runSuper + ) => { + console.log("Symlinking forge-style libraries"); + const symlinks = []; + const libraries = [ + ["solmate", "solmate/src"], + ["solecs", "solecs/src"], + ["ds-test", "ds-test/src"], + ["forge-std", "forge-std/src"], + ["persona", "persona/src"], + ["base64", "persona/lib/base64"], + ["gsn", "persona/lib/gsn/packages/contracts/src"], + ["royalty-registry", "persona/lib/royalty-registry-solidity/contracts"], + ["@openzeppelin", "persona/lib/openzeppelin-contracts"], + ]; + for (const [library, libraryPath] of libraries) { + const symlinkPath = path.join(process.cwd(), library); + console.log("Adding symlink at path: " + symlinkPath); + if (fs.existsSync(symlinkPath)) { + console.warn("symlink already exists!"); + } else { + const libPath = path.join(config.paths.sources, "..", "lib", libraryPath); + fs.symlinkSync(libPath, symlinkPath, "dir"); + } + symlinks.push(symlinkPath); + } + try { + await runSuper(); + } catch (e) { + console.error(e); + } finally { + for (const symlink of symlinks) { + console.log("Removing symlink at path: " + symlink); + fs.unlinkSync(symlink); + } + } + } +); diff --git a/packages/ri/contracts/tsconfig.json b/packages/ri/contracts/tsconfig.json new file mode 100644 index 0000000000..486685aee5 --- /dev/null +++ b/packages/ri/contracts/tsconfig.json @@ -0,0 +1,12 @@ +// Visit https://aka.ms/tsconfig.json for all config options +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "strict": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/packages/ri/contracts/types/ethers-contracts/Diamond.ts b/packages/ri/contracts/types/ethers-contracts/Diamond.ts new file mode 100644 index 0000000000..a3eca3ce5b --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/Diamond.ts @@ -0,0 +1,62 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { BaseContract, BigNumberish, BytesLike, Signer, utils } from "ethers"; + +import { Listener, Provider } from "@ethersproject/providers"; +import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common"; + +export declare namespace IDiamondCut { + export type FacetCutStruct = { + facetAddress: string; + action: BigNumberish; + functionSelectors: BytesLike[]; + }; + + export type FacetCutStructOutput = [string, number, string[]] & { + facetAddress: string; + action: number; + functionSelectors: string[]; + }; +} + +export interface DiamondInterface extends utils.Interface { + contractName: "Diamond"; + functions: {}; + + events: {}; +} + +export interface Diamond extends BaseContract { + contractName: "Diamond"; + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: DiamondInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners(eventFilter?: TypedEventFilter): Array>; + listeners(eventName?: string): Array; + removeAllListeners(eventFilter: TypedEventFilter): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: {}; + + callStatic: {}; + + filters: {}; + + estimateGas: {}; + + populateTransaction: {}; +} diff --git a/packages/ri/contracts/types/ethers-contracts/EmberFacet.ts b/packages/ri/contracts/types/ethers-contracts/EmberFacet.ts new file mode 100644 index 0000000000..eb9afba9a0 --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/EmberFacet.ts @@ -0,0 +1,175 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import { FunctionFragment, Result } from "@ethersproject/abi"; +import { Listener, Provider } from "@ethersproject/providers"; +import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common"; + +export interface EmberFacetInterface extends utils.Interface { + contractName: "EmberFacet"; + functions: { + "addComponentToEntityExternally(uint256,address,bytes)": FunctionFragment; + "callerEntityID()": FunctionFragment; + "entryPoint()": FunctionFragment; + "removeComponentFromEntityExternally(uint256,address)": FunctionFragment; + "world()": FunctionFragment; + }; + + encodeFunctionData( + functionFragment: "addComponentToEntityExternally", + values: [BigNumberish, string, BytesLike] + ): string; + encodeFunctionData(functionFragment: "callerEntityID", values?: undefined): string; + encodeFunctionData(functionFragment: "entryPoint", values?: undefined): string; + encodeFunctionData(functionFragment: "removeComponentFromEntityExternally", values: [BigNumberish, string]): string; + encodeFunctionData(functionFragment: "world", values?: undefined): string; + + decodeFunctionResult(functionFragment: "addComponentToEntityExternally", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "callerEntityID", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "entryPoint", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "removeComponentFromEntityExternally", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "world", data: BytesLike): Result; + + events: {}; +} + +export interface EmberFacet extends BaseContract { + contractName: "EmberFacet"; + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: EmberFacetInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners(eventFilter?: TypedEventFilter): Array>; + listeners(eventName?: string): Array; + removeAllListeners(eventFilter: TypedEventFilter): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + addComponentToEntityExternally( + entity: BigNumberish, + component: string, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + callerEntityID(overrides?: CallOverrides): Promise<[BigNumber]>; + + entryPoint(overrides?: Overrides & { from?: string | Promise }): Promise; + + removeComponentFromEntityExternally( + entity: BigNumberish, + component: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise<[string]>; + }; + + addComponentToEntityExternally( + entity: BigNumberish, + component: string, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + callerEntityID(overrides?: CallOverrides): Promise; + + entryPoint(overrides?: Overrides & { from?: string | Promise }): Promise; + + removeComponentFromEntityExternally( + entity: BigNumberish, + component: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise; + + callStatic: { + addComponentToEntityExternally( + entity: BigNumberish, + component: string, + value: BytesLike, + overrides?: CallOverrides + ): Promise; + + callerEntityID(overrides?: CallOverrides): Promise; + + entryPoint(overrides?: CallOverrides): Promise; + + removeComponentFromEntityExternally( + entity: BigNumberish, + component: string, + overrides?: CallOverrides + ): Promise; + + world(overrides?: CallOverrides): Promise; + }; + + filters: {}; + + estimateGas: { + addComponentToEntityExternally( + entity: BigNumberish, + component: string, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + callerEntityID(overrides?: CallOverrides): Promise; + + entryPoint(overrides?: Overrides & { from?: string | Promise }): Promise; + + removeComponentFromEntityExternally( + entity: BigNumberish, + component: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + addComponentToEntityExternally( + entity: BigNumberish, + component: string, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + callerEntityID(overrides?: CallOverrides): Promise; + + entryPoint(overrides?: Overrides & { from?: string | Promise }): Promise; + + removeComponentFromEntityExternally( + entity: BigNumberish, + component: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise; + }; +} diff --git a/packages/ri/contracts/types/ethers-contracts/PositionComponent.ts b/packages/ri/contracts/types/ethers-contracts/PositionComponent.ts new file mode 100644 index 0000000000..865f74cf9c --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/PositionComponent.ts @@ -0,0 +1,320 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + BaseContract, + BigNumber, + BigNumberish, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import { FunctionFragment, Result } from "@ethersproject/abi"; +import { Listener, Provider } from "@ethersproject/providers"; +import { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "./common"; + +export type PositionStruct = { x: BigNumberish; y: BigNumberish }; + +export type PositionStructOutput = [BigNumber, BigNumber] & { + x: BigNumber; + y: BigNumber; +}; + +export interface PositionComponentInterface extends utils.Interface { + contractName: "PositionComponent"; + functions: { + "getEntities()": FunctionFragment; + "getEntitiesWithValue(bytes)": FunctionFragment; + "getID()": FunctionFragment; + "getRawValue(uint256)": FunctionFragment; + "getValue(uint256)": FunctionFragment; + "has(uint256)": FunctionFragment; + "owner()": FunctionFragment; + "registerIndexer(address)": FunctionFragment; + "remove(uint256)": FunctionFragment; + "set(uint256,bytes)": FunctionFragment; + "transferOwnership(address)": FunctionFragment; + "world()": FunctionFragment; + }; + + encodeFunctionData(functionFragment: "getEntities", values?: undefined): string; + encodeFunctionData(functionFragment: "getEntitiesWithValue", values: [BytesLike]): string; + encodeFunctionData(functionFragment: "getID", values?: undefined): string; + encodeFunctionData(functionFragment: "getRawValue", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "getValue", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "has", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "owner", values?: undefined): string; + encodeFunctionData(functionFragment: "registerIndexer", values: [string]): string; + encodeFunctionData(functionFragment: "remove", values: [BigNumberish]): string; + encodeFunctionData(functionFragment: "set", values: [BigNumberish, BytesLike]): string; + encodeFunctionData(functionFragment: "transferOwnership", values: [string]): string; + encodeFunctionData(functionFragment: "world", values?: undefined): string; + + decodeFunctionResult(functionFragment: "getEntities", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getEntitiesWithValue", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getID", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getRawValue", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getValue", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "has", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "registerIndexer", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "remove", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "set", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "transferOwnership", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "world", data: BytesLike): Result; + + events: {}; +} + +export interface PositionComponent extends BaseContract { + contractName: "PositionComponent"; + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: PositionComponentInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners(eventFilter?: TypedEventFilter): Array>; + listeners(eventName?: string): Array; + removeAllListeners(eventFilter: TypedEventFilter): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + getEntities(overrides?: CallOverrides): Promise<[BigNumber[]]>; + + "getEntitiesWithValue(bytes)"(value: BytesLike, overrides?: CallOverrides): Promise<[BigNumber[]]>; + + "getEntitiesWithValue((uint256,uint256))"( + position: PositionStruct, + overrides?: CallOverrides + ): Promise<[BigNumber[]]>; + + getID(overrides?: CallOverrides): Promise<[BigNumber]>; + + getRawValue(entity: BigNumberish, overrides?: CallOverrides): Promise<[string]>; + + getValue(entity: BigNumberish, overrides?: CallOverrides): Promise<[PositionStructOutput]>; + + has(entity: BigNumberish, overrides?: CallOverrides): Promise<[boolean]>; + + owner(overrides?: CallOverrides): Promise<[string]>; + + registerIndexer( + indexer: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + remove( + entity: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + "set(uint256,bytes)"( + entity: BigNumberish, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + "set(uint256,(uint256,uint256))"( + entity: BigNumberish, + value: PositionStruct, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise<[string]>; + }; + + getEntities(overrides?: CallOverrides): Promise; + + "getEntitiesWithValue(bytes)"(value: BytesLike, overrides?: CallOverrides): Promise; + + "getEntitiesWithValue((uint256,uint256))"(position: PositionStruct, overrides?: CallOverrides): Promise; + + getID(overrides?: CallOverrides): Promise; + + getRawValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + getValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + has(entity: BigNumberish, overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + registerIndexer( + indexer: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + remove( + entity: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + "set(uint256,bytes)"( + entity: BigNumberish, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + "set(uint256,(uint256,uint256))"( + entity: BigNumberish, + value: PositionStruct, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise; + + callStatic: { + getEntities(overrides?: CallOverrides): Promise; + + "getEntitiesWithValue(bytes)"(value: BytesLike, overrides?: CallOverrides): Promise; + + "getEntitiesWithValue((uint256,uint256))"( + position: PositionStruct, + overrides?: CallOverrides + ): Promise; + + getID(overrides?: CallOverrides): Promise; + + getRawValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + getValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + has(entity: BigNumberish, overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + registerIndexer(indexer: string, overrides?: CallOverrides): Promise; + + remove(entity: BigNumberish, overrides?: CallOverrides): Promise; + + "set(uint256,bytes)"(entity: BigNumberish, value: BytesLike, overrides?: CallOverrides): Promise; + + "set(uint256,(uint256,uint256))"( + entity: BigNumberish, + value: PositionStruct, + overrides?: CallOverrides + ): Promise; + + transferOwnership(newOwner: string, overrides?: CallOverrides): Promise; + + world(overrides?: CallOverrides): Promise; + }; + + filters: {}; + + estimateGas: { + getEntities(overrides?: CallOverrides): Promise; + + "getEntitiesWithValue(bytes)"(value: BytesLike, overrides?: CallOverrides): Promise; + + "getEntitiesWithValue((uint256,uint256))"(position: PositionStruct, overrides?: CallOverrides): Promise; + + getID(overrides?: CallOverrides): Promise; + + getRawValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + getValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + has(entity: BigNumberish, overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + registerIndexer(indexer: string, overrides?: Overrides & { from?: string | Promise }): Promise; + + remove(entity: BigNumberish, overrides?: Overrides & { from?: string | Promise }): Promise; + + "set(uint256,bytes)"( + entity: BigNumberish, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + "set(uint256,(uint256,uint256))"( + entity: BigNumberish, + value: PositionStruct, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise; + }; + + populateTransaction: { + getEntities(overrides?: CallOverrides): Promise; + + "getEntitiesWithValue(bytes)"(value: BytesLike, overrides?: CallOverrides): Promise; + + "getEntitiesWithValue((uint256,uint256))"( + position: PositionStruct, + overrides?: CallOverrides + ): Promise; + + getID(overrides?: CallOverrides): Promise; + + getRawValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + getValue(entity: BigNumberish, overrides?: CallOverrides): Promise; + + has(entity: BigNumberish, overrides?: CallOverrides): Promise; + + owner(overrides?: CallOverrides): Promise; + + registerIndexer( + indexer: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + remove( + entity: BigNumberish, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + "set(uint256,bytes)"( + entity: BigNumberish, + value: BytesLike, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + "set(uint256,(uint256,uint256))"( + entity: BigNumberish, + value: PositionStruct, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + transferOwnership( + newOwner: string, + overrides?: Overrides & { from?: string | Promise } + ): Promise; + + world(overrides?: CallOverrides): Promise; + }; +} diff --git a/packages/ri/contracts/types/ethers-contracts/common.ts b/packages/ri/contracts/types/ethers-contracts/common.ts new file mode 100644 index 0000000000..e070c605c9 --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/common.ts @@ -0,0 +1,30 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { Listener } from "@ethersproject/providers"; +import type { Event, EventFilter } from "ethers"; + +export interface TypedEvent = any, TArgsObject = any> extends Event { + args: TArgsArray & TArgsObject; +} + +export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {} + +export interface TypedListener { + (...listenerArg: [...__TypechainArgsArray, TEvent]): void; +} + +type __TypechainArgsArray = T extends TypedEvent ? U : never; + +export interface OnEvent { + (eventFilter: TypedEventFilter, listener: TypedListener): TRes; + (eventName: string, listener: Listener): TRes; +} + +export type MinEthersFactory = { + deploy(...a: ARGS[]): Promise; +}; + +export type GetContractTypeFromFactory = F extends MinEthersFactory ? C : never; + +export type GetARGsTypeFromFactory = F extends MinEthersFactory ? Parameters : never; diff --git a/packages/ri/contracts/types/ethers-contracts/factories/Diamond__factory.ts b/packages/ri/contracts/types/ethers-contracts/factories/Diamond__factory.ts new file mode 100644 index 0000000000..1477a91cee --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/factories/Diamond__factory.ts @@ -0,0 +1,100 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Signer, utils, Contract, ContractFactory, PayableOverrides } from "ethers"; +import { Provider, TransactionRequest } from "@ethersproject/providers"; +import type { Diamond, DiamondInterface, IDiamondCut } from "../Diamond"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "_diamondOwner", + type: "address", + }, + { + components: [ + { + internalType: "address", + name: "facetAddress", + type: "address", + }, + { + internalType: "enum IDiamondCut.FacetCutAction", + name: "action", + type: "uint8", + }, + { + internalType: "bytes4[]", + name: "functionSelectors", + type: "bytes4[]", + }, + ], + internalType: "struct IDiamondCut.FacetCut[]", + name: "_diamondCut", + type: "tuple[]", + }, + ], + stateMutability: "payable", + type: "constructor", + }, + { + stateMutability: "payable", + type: "fallback", + }, + { + stateMutability: "payable", + type: "receive", + }, +]; + +const _bytecode = + "0x60806040526040516200287238038062002872833981016040819052620000269162000e65565b604080516000808252602082019092526200004e9183916200010360201b620000f41760201c565b62000064826200029060201b620002931760201c565b60006200007b6200031460201b6200034d1760201c565b6301ffc9a760e01b6000908152600482016020526040808220805460ff1990811660019081179092556307e4c70760e21b845282842080548216831790556348e2b09360e01b845282842080548216831790556307f5828d60e41b8452919092208054909116909117905560060180546001600160a01b031916301790555062001264915050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f54600080516020620027de8339815191529061ffff811690819060009060071615620001625750600381901c60009081526002840160205260409020545b60005b8751811015620001fe57620001e483838a84815181106200018a576200018a62001011565b6020026020010151600001518b8581518110620001ab57620001ab62001011565b6020026020010151602001518c8681518110620001cc57620001cc62001011565b6020026020010151604001516200032760201b60201c565b909350915080620001f5816200103d565b91505062000165565b508282146200021b5760038401805461ffff191661ffff84161790555b60078216156200023e57600382901c600090815260028501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb6738787876040516200027393929190620010cc565b60405180910390a162000287868662000b65565b50505050505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132180546001600160a01b031981166001600160a01b03848116918217909355604051600080516020620027de833981519152939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600080516020620027de83398151915290565b60008080600080516020620027de83398151915290506000845111620003a85760405162461bcd60e51b815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201526a1858d95d081d1bc818dd5d60aa1b60648201526084015b60405180910390fd5b6000856002811115620003bf57620003bf62001059565b036200057457620003ea86604051806060016040528060248152602001620027fe6024913962000d8a565b60018181018054918201815560009081526020812090910180546001600160a01b0319166001600160a01b0389161790555b84518110156200056d5760008582815181106200043d576200043d62001011565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c15620004e05760405162461bcd60e51b815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016200039f565b6001600160e01b031980831660008181526020879052604090206001600160601b031960608d901b168e17905560e060058e901b811692831c199c909c1690821c179a819003620005455760038c901c600090815260028601602052604081209b909b555b8b62000551816200103d565b9c5050505050808062000564906200103d565b9150506200041c565b5062000b59565b60018560028111156200058b576200058b62001059565b03620007a457620005b6866040518060600160405280602881526020016200284a6028913962000d8a565b60005b84518110156200056d576000858281518110620005da57620005da62001011565b6020908102919091018101516001600160e01b03198116600090815291859052604090912054909150606081901c308103620006715760405162461bcd60e51b815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201526e3aba30b1363290333ab731ba34b7b760891b60648201526084016200039f565b896001600160a01b0316816001600160a01b031603620006e95760405162461bcd60e51b81526020600482015260386024820152600080516020620027be83398151915260448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016200039f565b6001600160a01b038116620007565760405162461bcd60e51b81526020600482015260386024820152600080516020620027be83398151915260448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016200039f565b506001600160e01b031990911660009081526020849052604090206001600160601b03919091166001600160601b031960608a901b16179055806200079b816200103d565b915050620005b9565b6002856002811115620007bb57620007bb62001059565b0362000b00576001600160a01b03861615620008405760405162461bcd60e51b815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016200039f565b600388901c6007891660005b865181101562000adb5760008a90036200088d57826200086c81620011d3565b60008181526002870160205260409020549b509350600792506200089d9050565b816200089981620011d3565b9250505b6000806000808a8581518110620008b857620008b862001011565b6020908102919091018101516001600160e01b031981166000908152918a9052604090912054909150606081901c6200095a5760405162461bcd60e51b815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016200039f565b30606082901c03620009c65760405162461bcd60e51b815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201526d3a30b1363290333ab731ba34b7b760911b60648201526084016200039f565b600587901b8f901b94506001600160e01b03198086169083161462000a18576001600160e01b03198516600090815260208a90526040902080546001600160601b0319166001600160601b0383161790555b6001600160e01b031991909116600090815260208990526040812055600381901c611fff16925060051b60e016905085821462000a7f576000828152600288016020526040902080546001600160e01b031980841c19909116908516831c17905562000aa3565b80836001600160e01b031916901c816001600160e01b031960001b901c198e16179c505b8460000362000ac257600086815260028801602052604081208190559c505b505050808062000ad2906200103d565b9150506200084c565b508062000aea836008620011ed565b62000af691906200120f565b9950505062000b59565b60405162461bcd60e51b815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f727265637420466163657443756044820152663a20b1ba34b7b760c91b60648201526084016200039f565b50959694955050505050565b6001600160a01b03821662000bef5780511562000beb5760405162461bcd60e51b815260206004820152603c60248201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860448201527f3029206275745f63616c6c64617461206973206e6f7420656d7074790000000060648201526084016200039f565b5050565b600081511162000c685760405162461bcd60e51b815260206004820152603d60248201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460448201527f7920627574205f696e6974206973206e6f74206164647265737328302900000060648201526084016200039f565b6001600160a01b038216301462000c9e5762000c9e82604051806060016040528060288152602001620028226028913962000d8a565b600080836001600160a01b03168360405162000cbb91906200122a565b600060405180830381855af49150503d806000811462000cf8576040519150601f19603f3d011682016040523d82523d6000602084013e62000cfd565b606091505b50915091508162000d845780511562000d2c578060405162461bcd60e51b81526004016200039f919062001248565b60405162461bcd60e51b815260206004820152602660248201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e2072656044820152651d995c9d195960d21b60648201526084016200039f565b50505050565b813b818162000d845760405162461bcd60e51b81526004016200039f919062001248565b80516001600160a01b038116811462000dc657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171562000e065762000e0662000dcb565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000e375762000e3762000dcb565b604052919050565b60006001600160401b0382111562000e5b5762000e5b62000dcb565b5060051b60200190565b6000806040838503121562000e7957600080fd5b62000e848362000dae565b602084810151919350906001600160401b038082111562000ea457600080fd5b818601915086601f83011262000eb957600080fd5b815162000ed062000eca8262000e3f565b62000e0c565b81815260059190911b8301840190848101908983111562000ef057600080fd5b8585015b83811015620010005780518581111562000f0d57600080fd5b86016060818d03601f1901121562000f2457600080fd5b62000f2e62000de1565b62000f3b89830162000dae565b815260408201516003811062000f5057600080fd5b818a015260608201518781111562000f6757600080fd5b8083019250508c603f83011262000f7d57600080fd5b8882015162000f9062000eca8262000e3f565b81815260059190911b8301604001908a8101908f83111562000fb157600080fd5b6040850194505b8285101562000fea5784516001600160e01b03198116811462000fda57600080fd5b8252938b0193908b019062000fb8565b6040840152505084525091860191860162000ef4565b508096505050505050509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162001052576200105262001027565b5060010190565b634e487b7160e01b600052602160045260246000fd5b60005b838110156200108c57818101518382015260200162001072565b8381111562000d845750506000910152565b60008151808452620010b88160208601602086016200106f565b601f01601f19169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b84811015620011a157898403607f19018652815180516001600160a01b031685528381015189860190600381106200113d57634e487b7160e01b600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b808310156200118b5783516001600160e01b03191682529286019260019290920191908601906200115f565b50978501979550505090820190600101620010f5565b50506001600160a01b038a16908801528681036040880152620011c581896200109e565b9a9950505050505050505050565b600081620011e557620011e562001027565b506000190190565b60008160001904831182151516156200120a576200120a62001027565b500290565b6000821982111562001225576200122562001027565b500190565b600082516200123e8184602087016200106f565b9190910192915050565b6020815260006200125d60208301846200109e565b9392505050565b61154a80620012746000396000f3fe60806040523661000b57005b600080357fffffffff000000000000000000000000000000000000000000000000000000001681527fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c6020819052604090912054819060601c806100d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4469616d6f6e643a2046756e6374696f6e20646f6573206e6f7420657869737460448201526064015b60405180910390fd5b3660008037600080366000845af43d6000803e8080156100ef573d6000f35b3d6000fd5b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131f547fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c9061ffff8116908190600090600716156101635750600381901c60009081526002840160205260409020545b60005b87518110156101ea576101d383838a848151811061018657610186611166565b6020026020010151600001518b85815181106101a4576101a4611166565b6020026020010151602001518c86815181106101c2576101c2611166565b602002602001015160400151610371565b9093509150806101e2816111c4565b915050610166565b50828214610223576003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff84161790555b600782161561024557600382901c600090815260028501602052604090208190555b7f8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673878787604051610278939291906112a1565b60405180910390a161028a8686610e72565b50505050505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c132180547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff8481169182179093556040517fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c939092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90565b600080807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90506000845111610429576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4c69624469616d6f6e644375743a204e6f2073656c6563746f727320696e206660448201527f6163657420746f2063757400000000000000000000000000000000000000000060648201526084016100c7565b600085600281111561043d5761043d6111fc565b0361066857610464866040518060600160405280602481526020016114ca6024913961112b565b60018181018054918201815560009081526020812090910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff89161790555b84518110156106625760008582815181106104d8576104d8611166565b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815291859052604090912054909150606081901c156105ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f4c69624469616d6f6e644375743a2043616e2774206164642066756e6374696f60448201527f6e207468617420616c726561647920657869737473000000000000000000000060648201526084016100c7565b7fffffffff0000000000000000000000000000000000000000000000000000000080831660008181526020879052604090207fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060608d901b168e17905560e060058e901b811692831c199c909c1690821c179a81900361063f5760038c901c600090815260028601602052604081209b909b555b8b610649816111c4565b9c5050505050808061065a906111c4565b9150506104bb565b50610e66565b600185600281111561067c5761067c6111fc565b03610976576106a3866040518060600160405280602881526020016115166028913961112b565b60005b84518110156106625760008582815181106106c3576106c3611166565b6020908102919091018101517fffffffff000000000000000000000000000000000000000000000000000000008116600090815291859052604090912054909150606081901c308103610798576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4c69624469616d6f6e644375743a2043616e2774207265706c61636520696d6d60448201527f757461626c652066756e6374696f6e000000000000000000000000000000000060648201526084016100c7565b8973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e20776974682073616d652066756e6374696f6e000000000000000060648201526084016100c7565b73ffffffffffffffffffffffffffffffffffffffff81166108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756e60448201527f6374696f6e207468617420646f65736e2774206578697374000000000000000060648201526084016100c7565b507fffffffff0000000000000000000000000000000000000000000000000000000090911660009081526020849052604090206bffffffffffffffffffffffff919091167fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060608a901b161790558061096e816111c4565b9150506106a6565b600285600281111561098a5761098a6111fc565b03610dde5773ffffffffffffffffffffffffffffffffffffffff861615610a33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f4c69624469616d6f6e644375743a2052656d6f7665206661636574206164647260448201527f657373206d75737420626520616464726573732830290000000000000000000060648201526084016100c7565b600388901c6007891660005b8651811015610dbe5760008a9003610a7b5782610a5b81611409565b60008181526002870160205260409020549b50935060079250610a899050565b81610a8581611409565b9250505b6000806000808a8581518110610aa157610aa1611166565b6020908102919091018101517fffffffff0000000000000000000000000000000000000000000000000000000081166000908152918a9052604090912054909150606081901c610b73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f76652066756e6360448201527f74696f6e207468617420646f65736e277420657869737400000000000000000060648201526084016100c7565b30606082901c03610c06576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4c69624469616d6f6e644375743a2043616e27742072656d6f766520696d6d7560448201527f7461626c652066756e6374696f6e00000000000000000000000000000000000060648201526084016100c7565b600587901b8f901b94507fffffffff0000000000000000000000000000000000000000000000000000000080861690831614610ca4577fffffffff000000000000000000000000000000000000000000000000000000008516600090815260208a90526040902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff83161790555b7fffffffff0000000000000000000000000000000000000000000000000000000091909116600090815260208990526040812055600381901c611fff16925060051b60e0169050858214610d39576000828152600288016020526040902080547fffffffff0000000000000000000000000000000000000000000000000000000080841c19909116908516831c179055610d8a565b80837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c817fffffffff0000000000000000000000000000000000000000000000000000000060001b901c198e16179c505b84600003610da857600086815260028801602052604081208190559c505b5050508080610db6906111c4565b915050610a3f565b5080610dcb83600861143e565b610dd5919061147b565b99505050610e66565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f4c69624469616d6f6e644375743a20496e636f7272656374204661636574437560448201527f74416374696f6e0000000000000000000000000000000000000000000000000060648201526084016100c7565b50959694955050505050565b73ffffffffffffffffffffffffffffffffffffffff8216610f2057805115610f1c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603c60248201527f4c69624469616d6f6e644375743a205f696e697420697320616464726573732860448201527f3029206275745f63616c6c64617461206973206e6f7420656d7074790000000060648201526084016100c7565b5050565b6000815111610fb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4c69624469616d6f6e644375743a205f63616c6c6461746120697320656d707460448201527f7920627574205f696e6974206973206e6f74206164647265737328302900000060648201526084016100c7565b73ffffffffffffffffffffffffffffffffffffffff82163014610ff057610ff0826040518060600160405280602881526020016114ee6028913961112b565b6000808373ffffffffffffffffffffffffffffffffffffffff16836040516110189190611493565b600060405180830381855af49150503d8060008114611053576040519150601f19603f3d011682016040523d82523d6000602084013e611058565b606091505b5091509150816111255780511561109d57806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c791906114af565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4c69624469616d6f6e644375743a205f696e69742066756e6374696f6e20726560448201527f766572746564000000000000000000000000000000000000000000000000000060648201526084016100c7565b50505050565b813b8181611125576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100c791906114af565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036111f5576111f5611195565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60005b8381101561124657818101518382015260200161122e565b838111156111255750506000910152565b6000815180845261126f81602086016020860161122b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60006060808301818452808751808352608092508286019150828160051b8701016020808b0160005b848110156113cc577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808a8503018652815188850173ffffffffffffffffffffffffffffffffffffffff82511686528482015160038110611353577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b868601526040918201519186018a905281519081905290840190600090898701905b808310156113b75783517fffffffff00000000000000000000000000000000000000000000000000000000168252928601926001929092019190860190611375565b509785019795505050908201906001016112ca565b505073ffffffffffffffffffffffffffffffffffffffff8a169088015286810360408801526113fb8189611257565b9a9950505050505050505050565b60008161141857611418611195565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561147657611476611195565b500290565b6000821982111561148e5761148e611195565b500190565b600082516114a581846020870161122b565b9190910192915050565b6020815260006114c26020830184611257565b939250505056fe4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465a164736f6c634300080d000a4c69624469616d6f6e644375743a2043616e2774207265706c6163652066756ec8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c4c69624469616d6f6e644375743a2041646420666163657420686173206e6f20636f64654c69624469616d6f6e644375743a205f696e6974206164647265737320686173206e6f20636f64654c69624469616d6f6e644375743a205265706c61636520666163657420686173206e6f20636f6465"; + +type DiamondConstructorParams = [signer?: Signer] | ConstructorParameters; + +const isSuperArgs = (xs: DiamondConstructorParams): xs is ConstructorParameters => + xs.length > 1; + +export class Diamond__factory extends ContractFactory { + constructor(...args: DiamondConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + this.contractName = "Diamond"; + } + + deploy( + _diamondOwner: string, + _diamondCut: IDiamondCut.FacetCutStruct[], + overrides?: PayableOverrides & { from?: string | Promise } + ): Promise { + return super.deploy(_diamondOwner, _diamondCut, overrides || {}) as Promise; + } + getDeployTransaction( + _diamondOwner: string, + _diamondCut: IDiamondCut.FacetCutStruct[], + overrides?: PayableOverrides & { from?: string | Promise } + ): TransactionRequest { + return super.getDeployTransaction(_diamondOwner, _diamondCut, overrides || {}); + } + attach(address: string): Diamond { + return super.attach(address) as Diamond; + } + connect(signer: Signer): Diamond__factory { + return super.connect(signer) as Diamond__factory; + } + static readonly contractName: "Diamond"; + public readonly contractName: "Diamond"; + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): DiamondInterface { + return new utils.Interface(_abi) as DiamondInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): Diamond { + return new Contract(address, _abi, signerOrProvider) as Diamond; + } +} diff --git a/packages/ri/contracts/types/ethers-contracts/factories/EmberFacet__factory.ts b/packages/ri/contracts/types/ethers-contracts/factories/EmberFacet__factory.ts new file mode 100644 index 0000000000..63221773e9 --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/factories/EmberFacet__factory.ts @@ -0,0 +1,125 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; +import { Provider, TransactionRequest } from "@ethersproject/providers"; +import type { EmberFacet, EmberFacetInterface } from "../EmberFacet"; + +const _abi = [ + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + { + internalType: "address", + name: "component", + type: "address", + }, + { + internalType: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "addComponentToEntityExternally", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "callerEntityID", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "entryPoint", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + { + internalType: "address", + name: "component", + type: "address", + }, + ], + name: "removeComponentFromEntityExternally", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "world", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +const _bytecode = + "0x608060405234801561001057600080fd5b50610744806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c806357e0cc421161005057806357e0cc42146100ae578063b0d691fe146100bf578063ceb44dd5146100c757600080fd5b806330b67baa1461006c57806344694faa14610099575b600080fd5b60015460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100ac6100a73660046104a8565b6100da565b005b600254604051908152602001610090565b6100ac610161565b6100ac6100d5366004610503565b6102f9565b6040517f4cc8221500000000000000000000000000000000000000000000000000000000815260048101839052819073ffffffffffffffffffffffffffffffffffffffff821690634cc8221590602401600060405180830381600087803b15801561014457600080fd5b505af1158015610158573d6000803e3d6000fd5b50505050505050565b60008060005b60038201548110156102d557600082600301828154811061018a5761018a6105ec565b600091825260208220015460405133602482015282357fffffffff0000000000000000000000000000000000000000000000000000000016604482015273ffffffffffffffffffffffffffffffffffffffff909116925061028e9083907fab0870370000000000000000000000000000000000000000000000000000000090606401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610387565b90506000818060200190518101906102a6919061061b565b905080156102bf57600285015550600193506102d59050565b50505080806102cd90610634565b915050610167565b50816102e357600060028201555b805460ff16156102f557600060028201555b5050565b6040517f8b282947000000000000000000000000000000000000000000000000000000008152829073ffffffffffffffffffffffffffffffffffffffff821690638b2829479061034f90879086906004016106c3565b600060405180830381600087803b15801561036957600080fd5b505af115801561037d573d6000803e3d6000fd5b5050505050505050565b60606000808473ffffffffffffffffffffffffffffffffffffffff16846040516103b1919061071b565b600060405180830381855af49150503d80600081146103ec576040519150601f19603f3d011682016040523d82523d6000602084013e6103f1565b606091505b509092509050811515600003610477578051156104115780518082602001fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f44656c656761746543616c6c2072657665727465640000000000000000000000604482015260640160405180910390fd5b949350505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146104a357600080fd5b919050565b600080604083850312156104bb57600080fd5b823591506104cb6020840161047f565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561051857600080fd5b833592506105286020850161047f565b9150604084013567ffffffffffffffff8082111561054557600080fd5b818601915086601f83011261055957600080fd5b81358181111561056b5761056b6104d4565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156105b1576105b16104d4565b816040528281528960208487010111156105ca57600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561062d57600080fd5b5051919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361068c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60005b838110156106ae578181015183820152602001610696565b838111156106bd576000848401525b50505050565b82815260406020820152600082518060408401526106e8816060850160208701610693565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016060019392505050565b6000825161072d818460208701610693565b919091019291505056fea164736f6c634300080d000a"; + +type EmberFacetConstructorParams = [signer?: Signer] | ConstructorParameters; + +const isSuperArgs = (xs: EmberFacetConstructorParams): xs is ConstructorParameters => + xs.length > 1; + +export class EmberFacet__factory extends ContractFactory { + constructor(...args: EmberFacetConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + this.contractName = "EmberFacet"; + } + + deploy(overrides?: Overrides & { from?: string | Promise }): Promise { + return super.deploy(overrides || {}) as Promise; + } + getDeployTransaction(overrides?: Overrides & { from?: string | Promise }): TransactionRequest { + return super.getDeployTransaction(overrides || {}); + } + attach(address: string): EmberFacet { + return super.attach(address) as EmberFacet; + } + connect(signer: Signer): EmberFacet__factory { + return super.connect(signer) as EmberFacet__factory; + } + static readonly contractName: "EmberFacet"; + public readonly contractName: "EmberFacet"; + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): EmberFacetInterface { + return new utils.Interface(_abi) as EmberFacetInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): EmberFacet { + return new Contract(address, _abi, signerOrProvider) as EmberFacet; + } +} diff --git a/packages/ri/contracts/types/ethers-contracts/factories/PositionComponent__factory.ts b/packages/ri/contracts/types/ethers-contracts/factories/PositionComponent__factory.ts new file mode 100644 index 0000000000..a79dbcacd7 --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/factories/PositionComponent__factory.ts @@ -0,0 +1,320 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; +import { Provider, TransactionRequest } from "@ethersproject/providers"; +import type { PositionComponent, PositionComponentInterface } from "../PositionComponent"; + +const _abi = [ + { + inputs: [ + { + internalType: "address", + name: "world", + type: "address", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { + inputs: [], + name: "getEntities", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "getEntitiesWithValue", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "x", + type: "uint256", + }, + { + internalType: "uint256", + name: "y", + type: "uint256", + }, + ], + internalType: "struct Position", + name: "position", + type: "tuple", + }, + ], + name: "getEntitiesWithValue", + outputs: [ + { + internalType: "uint256[]", + name: "", + type: "uint256[]", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "getID", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "pure", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + ], + name: "getRawValue", + outputs: [ + { + internalType: "bytes", + name: "", + type: "bytes", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + ], + name: "getValue", + outputs: [ + { + components: [ + { + internalType: "uint256", + name: "x", + type: "uint256", + }, + { + internalType: "uint256", + name: "y", + type: "uint256", + }, + ], + internalType: "struct Position", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + ], + name: "has", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "indexer", + type: "address", + }, + ], + name: "registerIndexer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + ], + name: "remove", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + { + internalType: "bytes", + name: "value", + type: "bytes", + }, + ], + name: "set", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "uint256", + name: "entity", + type: "uint256", + }, + { + components: [ + { + internalType: "uint256", + name: "x", + type: "uint256", + }, + { + internalType: "uint256", + name: "y", + type: "uint256", + }, + ], + internalType: "struct Position", + name: "value", + type: "tuple", + }, + ], + name: "set", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "newOwner", + type: "address", + }, + ], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "world", + outputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +const _bytecode = + "0x60806040523480156200001157600080fd5b50604051620022c5380380620022c583398101604081905262000034916200014f565b600080546001600160a01b0319166001600160a01b038316908117909155819063f303477030620000827ff2b6dccd2b727ad73194b365dd7ad2c6b1e96e25269352f5a0a3b0fa694445e290565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015620000c957600080fd5b505af1158015620000de573d6000803e3d6000fd5b50505050604051620000f09062000141565b604051809103906000f0801580156200010d573d6000803e3d6000fd5b50600280546001600160a01b03929092166001600160a01b0319928316179055600180549091163317905550620001819050565b61040f8062001eb683390190565b6000602082840312156200016257600080fd5b81516001600160a01b03811681146200017a57600080fd5b9392505050565b611d2580620001916000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063b8bc073d11610066578063b8bc073d1461022b578063cccf7a8e1461024b578063f2fde38b1461026e578063fd4ab6d81461028157600080fd5b80638da5cb5b146101ca578063ab9dbd07146101ea578063b361be461461021857600080fd5b80634cc82215116100c85780634cc822151461017c57806375c0669c146101915780638b282947146101a45780638bbf68fe146101b757600080fd5b80630ff4c916146100ef57806330b67baa1461012257806331b933b914610167575b600080fd5b6101026100fd3660046112ec565b610294565b604080518251815260209283015192810192909252015b60405180910390f35b6000546101429073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610119565b61016f6102e1565b6040516101199190611305565b61018f61018a3660046112ec565b61039c565b005b61018f61019f366004611349565b610707565b61018f6101b236600461148b565b61088f565b61018f6101c53660046114ea565b610c92565b6001546101429073ffffffffffffffffffffffffffffffffffffffff1681565b6040517ff2b6dccd2b727ad73194b365dd7ad2c6b1e96e25269352f5a0a3b0fa694445e28152602001610119565b61016f610226366004611517565b610cd1565b61023e6102393660046112ec565b610e0f565b60405161011991906115ce565b61025e6102593660046112ec565b610eb1565b6040519015158152602001610119565b61018f61027c366004611349565b610f45565b61016f61028f3660046115e1565b61100d565b60408051808201909152600080825260208201526000806102b484610e0f565b8060200190518101906102c791906115fd565b604080518082019091529182526020820152949350505050565b600254604080517f410d59cc000000000000000000000000000000000000000000000000000000008152905160609273ffffffffffffffffffffffffffffffffffffffff169163410d59cc9160048083019260009291908290030181865afa158015610351573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526103979190810190611621565b905090565b60015473ffffffffffffffffffffffffffffffffffffffff163314610422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e45520000000000000000000000000060448201526064015b60405180910390fd5b600081815260046020526040808220905160039161043f91611714565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff16146107045760008181526004602052604090819020905160039161048891611714565b908152604051908190036020018120547f4cc8221500000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff1690634cc82215906104ea90849060040190815260200190565b600060405180830381600087803b15801561050457600080fd5b505af1158015610518573d6000803e3d6000fd5b50506002546040517f4cc822150000000000000000000000000000000000000000000000000000000081526004810185905273ffffffffffffffffffffffffffffffffffffffff9091169250634cc822159150602401600060405180830381600087803b15801561058857600080fd5b505af115801561059c573d6000803e3d6000fd5b50505060008281526004602052604081206105b892509061120c565b60005b60055481101561067857600581815481106105d8576105d86117e6565b6000918252602090912001546040517f4cc822150000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690634cc8221590602401600060405180830381600087803b15801561064d57600080fd5b505af1158015610661573d6000803e3d6000fd5b50505050808061067090611815565b9150506105bb565b506000546040517fd803064a0000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff9091169063d803064a90604401600060405180830381600087803b1580156106eb57600080fd5b505af11580156106ff573d6000803e3d6000fd5b505050505b50565b60015473ffffffffffffffffffffffffffffffffffffffff163314610788576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b6107b2817f4ede9a2d00000000000000000000000000000000000000000000000000000000611049565b610818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f476976656e2061646472657373206973206e6f7420616e20696e64657865722e6044820152606401610419565b600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610910576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b6002546040517f1003e2d20000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff90911690631003e2d290602401600060405180830381600087803b15801561097c57600080fd5b505af1158015610990573d6000803e3d6000fd5b505050600083815260046020908152604090912083516109b593509091840190611246565b50600073ffffffffffffffffffffffffffffffffffffffff166003826040516109de9190611874565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610a9757604051610a15906112ca565b604051809103906000f080158015610a31573d6000803e3d6000fd5b50600382604051610a429190611874565b908152604051908190036020019020805473ffffffffffffffffffffffffffffffffffffffff929092167fffffffffffffffffffffffff00000000000000000000000000000000000000009092169190911790555b600381604051610aa79190611874565b908152604051908190036020018120547f1003e2d200000000000000000000000000000000000000000000000000000000825273ffffffffffffffffffffffffffffffffffffffff1690631003e2d290610b0990859060040190815260200190565b600060405180830381600087803b158015610b2357600080fd5b505af1158015610b37573d6000803e3d6000fd5b5050505060005b600554811015610c015760058181548110610b5b57610b5b6117e6565b6000918252602090912001546040517f0216b83800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690630216b83890610bbc9086908690600401611890565b600060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050508080610bf990611815565b915050610b3e565b506000546040517faf104e4000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063af104e4090610c5c903090869086906004016118a9565b600060405180830381600087803b158015610c7657600080fd5b505af1158015610c8a573d6000803e3d6000fd5b505050505050565b610ccd8282604051602001610cb99190813581526020918201359181019190915260400190565b60405160208183030381529060405261088f565b5050565b6060600073ffffffffffffffffffffffffffffffffffffffff16600383604051610cfb9190611874565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff1603610d3a57505060408051600081526020810190915290565b600382604051610d4a9190611874565b90815260408051918290036020018220547f410d59cc000000000000000000000000000000000000000000000000000000008352905173ffffffffffffffffffffffffffffffffffffffff9091169163410d59cc9160048083019260009291908290030181865afa158015610dc3573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610e099190810190611621565b92915050565b6000818152600460205260409020805460609190610e2c906116c7565b80601f0160208091040260200160405190810160405280929190818152602001828054610e58906116c7565b8015610ea55780601f10610e7a57610100808354040283529160200191610ea5565b820191906000526020600020905b815481529060010190602001808311610e8857829003601f168201915b50505050509050919050565b6002546040517fcccf7a8e0000000000000000000000000000000000000000000000000000000081526004810183905260009173ffffffffffffffffffffffffffffffffffffffff169063cccf7a8e90602401602060405180830381865afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0991906118e7565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fc6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e4552000000000000000000000000006044820152606401610419565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060610e09826040516020016110359190813581526020918201359181019190915260400190565b604051602081830303815290604052610cd1565b60006110548361106c565b8015611065575061106583836110d0565b9392505050565b6000611098827f01ffc9a7000000000000000000000000000000000000000000000000000000006110d0565b8015610e0957506110c9827fffffffff000000000000000000000000000000000000000000000000000000006110d0565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790529051600091908290819073ffffffffffffffffffffffffffffffffffffffff8716906175309061118a908690611874565b6000604051808303818686fa925050503d80600081146111c6576040519150601f19603f3d011682016040523d82523d6000602084013e6111cb565b606091505b50915091506020815110156111e65760009350505050610e09565b81801561120257508080602001905181019061120291906118e7565b9695505050505050565b508054611218906116c7565b6000825580601f10611228575050565b601f01602090049060005260206000209081019061070491906112d7565b828054611252906116c7565b90600052602060002090601f01602090048101928261127457600085556112ba565b82601f1061128d57805160ff19168380011785556112ba565b828001600101855582156112ba579182015b828111156112ba57825182559160200191906001019061129f565b506112c69291506112d7565b5090565b61040f8061190a83390190565b5b808211156112c657600081556001016112d8565b6000602082840312156112fe57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561133d57835183529284019291840191600101611321565b50909695505050505050565b60006020828403121561135b57600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461106557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156113f5576113f561137f565b604052919050565b600082601f83011261140e57600080fd5b813567ffffffffffffffff8111156114285761142861137f565b61145960207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016113ae565b81815284602083860101111561146e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561149e57600080fd5b82359150602083013567ffffffffffffffff8111156114bc57600080fd5b6114c8858286016113fd565b9150509250929050565b6000604082840312156114e457600080fd5b50919050565b600080606083850312156114fd57600080fd5b8235915061150e84602085016114d2565b90509250929050565b60006020828403121561152957600080fd5b813567ffffffffffffffff81111561154057600080fd5b61154c848285016113fd565b949350505050565b60005b8381101561156f578181015183820152602001611557565b8381111561157e576000848401525b50505050565b6000815180845261159c816020860160208601611554565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006110656020830184611584565b6000604082840312156115f357600080fd5b61106583836114d2565b6000806040838503121561161057600080fd5b505080516020909101519092909150565b6000602080838503121561163457600080fd5b825167ffffffffffffffff8082111561164c57600080fd5b818501915085601f83011261166057600080fd5b8151818111156116725761167261137f565b8060051b91506116838483016113ae565b818152918301840191848101908884111561169d57600080fd5b938501935b838510156116bb578451825293850193908501906116a2565b98975050505050505050565b600181811c908216806116db57607f821691505b6020821081036114e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080835481600182811c91508083168061173057607f831692505b60208084108203611768577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b81801561177c57600181146117ab576117d8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008616895284890196506117d8565b60008a81526020902060005b868110156117d05781548b8201529085019083016117b7565b505084890196505b509498975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361186d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b60008251611886818460208701611554565b9190910192915050565b82815260406020820152600061154c6040830184611584565b73ffffffffffffffffffffffffffffffffffffffff841681528260208201526060604082015260006118de6060830184611584565b95945050505050565b6000602082840312156118f957600080fd5b8151801515811461106557600080fdfe608060405234801561001057600080fd5b506103ef806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634cc82215116100505780634cc822151461009f578063949d225d146100b2578063cccf7a8e146100c357600080fd5b80631003e2d21461006c578063410d59cc14610081575b600080fd5b61007f61007a3660046102e9565b6100e6565b005b610089610138565b6040516100969190610302565b60405180910390f35b61007f6100ad3660046102e9565b610190565b600054604051908152602001610096565b6100d66100d13660046102e9565b610286565b6040519015158152602001610096565b6100ef81610286565b156100f75750565b600080548282526001602081905260408320829055810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630155565b6060600080548060200260200160405190810160405280929190818152602001828054801561018657602002820191906000526020600020905b815481526020019060010190808311610172575b5050505050905090565b61019981610286565b6101a05750565b600080546101b090600190610346565b815481106101c0576101c0610384565b906000526020600020015460006001600084815260200190815260200160002054815481106101f1576101f1610384565b6000918252602080832090910192909255828152600191829052604081205481549092919081908490811061022857610228610384565b90600052602060002001548152602001908152602001600020819055506001600082815260200190815260200160002060009055600080548061026d5761026d6103b3565b6001900381819060005260206000200160009055905550565b60008054810361029857506000919050565b60008281526001602052604081205490036102d45781600080815481106102c1576102c1610384565b9060005260206000200154149050919050565b50600090815260016020526040902054151590565b6000602082840312156102fb57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561033a5783518352928401929184019160010161031e565b50909695505050505050565b60008282101561037f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea164736f6c634300080d000aa164736f6c634300080d000a608060405234801561001057600080fd5b506103ef806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80634cc82215116100505780634cc822151461009f578063949d225d146100b2578063cccf7a8e146100c357600080fd5b80631003e2d21461006c578063410d59cc14610081575b600080fd5b61007f61007a3660046102e9565b6100e6565b005b610089610138565b6040516100969190610302565b60405180910390f35b61007f6100ad3660046102e9565b610190565b600054604051908152602001610096565b6100d66100d13660046102e9565b610286565b6040519015158152602001610096565b6100ef81610286565b156100f75750565b600080548282526001602081905260408320829055810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630155565b6060600080548060200260200160405190810160405280929190818152602001828054801561018657602002820191906000526020600020905b815481526020019060010190808311610172575b5050505050905090565b61019981610286565b6101a05750565b600080546101b090600190610346565b815481106101c0576101c0610384565b906000526020600020015460006001600084815260200190815260200160002054815481106101f1576101f1610384565b6000918252602080832090910192909255828152600191829052604081205481549092919081908490811061022857610228610384565b90600052602060002001548152602001908152602001600020819055506001600082815260200190815260200160002060009055600080548061026d5761026d6103b3565b6001900381819060005260206000200160009055905550565b60008054810361029857506000919050565b60008281526001602052604081205490036102d45781600080815481106102c1576102c1610384565b9060005260206000200154149050919050565b50600090815260016020526040902054151590565b6000602082840312156102fb57600080fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561033a5783518352928401929184019160010161031e565b50909695505050505050565b60008282101561037f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfea164736f6c634300080d000a"; + +type PositionComponentConstructorParams = [signer?: Signer] | ConstructorParameters; + +const isSuperArgs = (xs: PositionComponentConstructorParams): xs is ConstructorParameters => + xs.length > 1; + +export class PositionComponent__factory extends ContractFactory { + constructor(...args: PositionComponentConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + this.contractName = "PositionComponent"; + } + + deploy(world: string, overrides?: Overrides & { from?: string | Promise }): Promise { + return super.deploy(world, overrides || {}) as Promise; + } + getDeployTransaction(world: string, overrides?: Overrides & { from?: string | Promise }): TransactionRequest { + return super.getDeployTransaction(world, overrides || {}); + } + attach(address: string): PositionComponent { + return super.attach(address) as PositionComponent; + } + connect(signer: Signer): PositionComponent__factory { + return super.connect(signer) as PositionComponent__factory; + } + static readonly contractName: "PositionComponent"; + public readonly contractName: "PositionComponent"; + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): PositionComponentInterface { + return new utils.Interface(_abi) as PositionComponentInterface; + } + static connect(address: string, signerOrProvider: Signer | Provider): PositionComponent { + return new Contract(address, _abi, signerOrProvider) as PositionComponent; + } +} diff --git a/packages/ri/contracts/types/ethers-contracts/index.ts b/packages/ri/contracts/types/ethers-contracts/index.ts new file mode 100644 index 0000000000..d874caeef1 --- /dev/null +++ b/packages/ri/contracts/types/ethers-contracts/index.ts @@ -0,0 +1,10 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { Diamond } from "./Diamond"; +export type { EmberFacet } from "./EmberFacet"; +export type { PositionComponent } from "./PositionComponent"; + +export { Diamond__factory } from "./factories/Diamond__factory"; +export { EmberFacet__factory } from "./factories/EmberFacet__factory"; +export { PositionComponent__factory } from "./factories/PositionComponent__factory";