-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(uniswapx-sdk): PermissionedTokenValidator #315
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1 @@ | |||
{"abi":[{"type":"constructor","inputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"allowance","inputs":[{"name":"owner","type":"address"},{"name":"spender","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"stateMutability":"view"},{"type":"function","name":"approve","inputs":[{"name":"spender","type":"address"},{"name":"value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"balanceOf","inputs":[{"name":"who","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"stateMutability":"view"},{"type":"function","name":"balanceOfInvestor","inputs":[{"name":"_id","type":"string"}],"outputs":[{"name":"","type":"uint256"}],"stateMutability":"view"},{"type":"function","name":"burn","inputs":[{"name":"_who","type":"address"},{"name":"_value","type":"uint256"},{"name":"_reason","type":"string"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"getVersion","inputs":[],"outputs":[{"name":"","type":"uint256[]"}],"stateMutability":"view"},{"type":"function","name":"getWalletAt","inputs":[{"name":"_index","type":"uint256"}],"outputs":[{"name":"","type":"address"}],"stateMutability":"view"},{"type":"function","name":"isPaused","inputs":[],"outputs":[{"name":"","type":"bool"}],"stateMutability":"view"},{"type":"function","name":"issueTokens","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"issueTokensCustom","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_issuanceTime","type":"uint256"},{"name":"_valueLocked","type":"uint256"},{"name":"_reason","type":"string"},{"name":"_releaseTime","type":"uint64"}],"outputs":[{"name":"","type":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"preTransferCheck","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"code","type":"uint256"},{"name":"reason","type":"string"}],"stateMutability":"view"},{"type":"function","name":"seize","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"},{"name":"_reason","type":"string"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setCap","inputs":[{"name":"_cap","type":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"totalIssued","inputs":[],"outputs":[{"name":"","type":"uint256"}],"stateMutability":"view"},{"type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}],"stateMutability":"view"},{"type":"function","name":"transfer","inputs":[{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"transferFrom","inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},{"name":"value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"walletCount","inputs":[],"outputs":[{"name":"","type":"uint256"}],"stateMutability":"view"},{"type":"event","name":"Approval","inputs":[{"name":"owner","type":"address","indexed":true},{"name":"spender","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Burn","inputs":[{"name":"burner","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false},{"name":"reason","type":"string","indexed":false}],"anonymous":false},{"type":"event","name":"Issue","inputs":[{"name":"to","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false},{"name":"valueLocked","type":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Seize","inputs":[{"name":"from","type":"address","indexed":true},{"name":"to","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false},{"name":"reason","type":"string","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"name":"from","type":"address","indexed":true},{"name":"to","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"WalletAdded","inputs":[{"name":"wallet","type":"address","indexed":false}],"anonymous":false},{"type":"event","name":"WalletRemoved","inputs":[{"name":"wallet","type":"address","indexed":false}],"anonymous":false}],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{"allowance(address,address)":"dd62ed3e","approve(address,uint256)":"095ea7b3","balanceOf(address)":"70a08231","balanceOfInvestor(string)":"6f296898","burn(address,uint256,string)":"15f570dc","getVersion()":"0d8e6e2c","getWalletAt(uint256)":"023f8fd1","isPaused()":"b187bd26","issueTokens(address,uint256)":"475a9fa9","issueTokensCustom(address,uint256,uint256,uint256,string,uint64)":"712d5fa2","preTransferCheck(address,address,uint256)":"1f227b43","seize(address,address,uint256,string)":"3ce5aae9","setCap(uint256)":"47786d37","totalIssued()":"f5be3193","totalSupply()":"18160ddd","transfer(address,uint256)":"a9059cbb","transferFrom(address,address,uint256)":"23b872dd","walletCount()":"29b57c69"},"id":8} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1 @@ | |||
{"abi":[{"type":"constructor","inputs":[],"stateMutability":"nonpayable"},{"type":"fallback","stateMutability":"nonpayable"},{"type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"setOwner","inputs":[{"name":"_owner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setTarget","inputs":[{"name":"_target","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"target","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"event","name":"ProxyOwnerChanged","inputs":[{"name":"owner","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"ProxyTargetSet","inputs":[{"name":"target","type":"address","indexed":false,"internalType":"address"}],"anonymous":false}],"bytecode":{"object":"0x6080604052348015600e575f80fd5b505f80546001600160a01b031916331790556102b38061002d5f395ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c806313af4035146100bd578063776d1a01146100d05780638da5cb5b146100e3578063d4b8399214610111575b6001546001600160a01b0316806100995760405162461bcd60e51b815260206004820152600e60248201526d15185c99d95d081b9bdd081cd95d60921b60448201526064015b60405180910390fd5b604051365f82375f803683855af43d805f843e8180156100b7578184f35b8184fd5b005b6100bb6100cb366004610250565b610124565b6100bb6100de366004610250565b6101bd565b5f546100f5906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6001546100f5906001600160a01b031681565b5f546001600160a01b031633146101695760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610090565b5f80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe543d3a077035cec99b732bad2c4cf1c0fdee02ddf561ae543106ccc31cf35a3906020015b60405180910390a150565b5f546001600160a01b031633146102025760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610090565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527ff1b1e874978309afba903baec19abf568b0337fcedc05dde58cfea25ec25b94d906020016101b2565b5f60208284031215610260575f80fd5b81356001600160a01b0381168114610276575f80fd5b939250505056fea26469706673582212209927617c4c48e469a09ba0687a3588e871b87639ce58ca1e9834cfa89ff06e5464736f6c634300081a0033","sourceMap":"131:1232:0:-:0;;;293:49;;;;;;;;;-1:-1:-1;317:5:0;:18;;-1:-1:-1;;;;;;317:18:0;325:10;317:18;;;131:1232;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f80fd5b506004361061004a575f3560e01c806313af4035146100bd578063776d1a01146100d05780638da5cb5b146100e3578063d4b8399214610111575b6001546001600160a01b0316806100995760405162461bcd60e51b815260206004820152600e60248201526d15185c99d95d081b9bdd081cd95d60921b60448201526064015b60405180910390fd5b604051365f82375f803683855af43d805f843e8180156100b7578184f35b8184fd5b005b6100bb6100cb366004610250565b610124565b6100bb6100de366004610250565b6101bd565b5f546100f5906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6001546100f5906001600160a01b031681565b5f546001600160a01b031633146101695760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610090565b5f80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe543d3a077035cec99b732bad2c4cf1c0fdee02ddf561ae543106ccc31cf35a3906020015b60405180910390a150565b5f546001600160a01b031633146102025760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610090565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527ff1b1e874978309afba903baec19abf568b0337fcedc05dde58cfea25ec25b94d906020016101b2565b5f60208284031215610260575f80fd5b81356001600160a01b0381168114610276575f80fd5b939250505056fea26469706673582212209927617c4c48e469a09ba0687a3588e871b87639ce58ca1e9834cfa89ff06e5464736f6c634300081a0033","sourceMap":"131:1232:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;826:6;;-1:-1:-1;;;;;826:6:0;;842:46;;;;-1:-1:-1;;;842:46:0;;216:2:1;842:46:0;;;198:21:1;255:2;235:18;;;228:30;-1:-1:-1;;;274:18:1;;;267:44;328:18;;842:46:0;;;;;;;;;939:4;933:11;978:14;975:1;970:3;957:36;1071:1;1068;1052:14;1047:3;1040:5;1033;1020:53;1098:16;1150:4;1147:1;1142:3;1127:28;1176:6;1199:64;;;;1322:4;1317:3;1310:17;1199:64;1240:4;1235:3;1228:17;1169:176;;652:122;;;;;;:::i;:::-;;:::i;522:124::-;;;;;;:::i;:::-;;:::i;152:20::-;;;;;-1:-1:-1;;;;;152:20:0;;;;;;-1:-1:-1;;;;;812:32:1;;;794:51;;782:2;767:18;152:20:0;;;;;;;178:21;;;;;-1:-1:-1;;;;;178:21:0;;;652:122;479:5;;-1:-1:-1;;;;;479:5:0;465:10;:19;457:41;;;;-1:-1:-1;;;457:41:0;;1058:2:1;457:41:0;;;1040:21:1;1097:1;1077:18;;;1070:29;-1:-1:-1;;;1115:18:1;;;1108:39;1164:18;;457:41:0;856:332:1;457:41:0;713:5:::1;:14:::0;;-1:-1:-1;;;;;;713:14:0::1;-1:-1:-1::0;;;;;713:14:0;::::1;::::0;;::::1;::::0;;;742:25:::1;::::0;794:51:1;;;742:25:0::1;::::0;782:2:1;767:18;742:25:0::1;;;;;;;;652:122:::0;:::o;522:124::-;479:5;;-1:-1:-1;;;;;479:5:0;465:10;:19;457:41;;;;-1:-1:-1;;;457:41:0;;1058:2:1;457:41:0;;;1040:21:1;1097:1;1077:18;;;1070:29;-1:-1:-1;;;1115:18:1;;;1108:39;1164:18;;457:41:0;856:332:1;457:41:0;585:6:::1;:16:::0;;-1:-1:-1;;;;;;585:16:0::1;-1:-1:-1::0;;;;;585:16:0;::::1;::::0;;::::1;::::0;;;616:23:::1;::::0;794:51:1;;;616:23:0::1;::::0;782:2:1;767:18;616:23:0::1;648:203:1::0;357:286;416:6;469:2;457:9;448:7;444:23;440:32;437:52;;;485:1;482;475:12;437:52;511:23;;-1:-1:-1;;;;;563:31:1;;553:42;;543:70;;609:1;606;599:12;543:70;632:5;357:286;-1:-1:-1;;;357:286:1:o","linkReferences":{}},"methodIdentifiers":{"owner()":"8da5cb5b","setOwner(address)":"13af4035","setTarget(address)":"776d1a01","target()":"d4b83992"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.26+commit.8a97fa7a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"ProxyOwnerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"ProxyTargetSet\",\"type\":\"event\"},{\"stateMutability\":\"nonpayable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"}],\"name\":\"setTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"target\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Proxy.sol\":\"Proxy\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/Proxy.sol\":{\"keccak256\":\"0x555c41a45e79c79fc04e3685f609b1727dfd2eab25d1bd4b25655639a53f3fc9\",\"license\":\"UNLICENSED\",\"urls\":[\"bzz-raw://079c516b5a9bcdadcfbc5a70ec0c39f5d0d69bec85ab939329e9c4ec96470471\",\"dweb:/ipfs/QmXEz2V5XHixESaY8nuFVigb41neWzZe2ZvabGYsNusHej\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.26+commit.8a97fa7a"},"language":"Solidity","output":{"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address","indexed":false}],"type":"event","name":"ProxyOwnerChanged","anonymous":false},{"inputs":[{"internalType":"address","name":"target","type":"address","indexed":false}],"type":"event","name":"ProxyTargetSet","anonymous":false},{"inputs":[],"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"stateMutability":"view","type":"function","name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}]},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"setOwner"},{"inputs":[{"internalType":"address","name":"_target","type":"address"}],"stateMutability":"nonpayable","type":"function","name":"setTarget"},{"inputs":[],"stateMutability":"view","type":"function","name":"target","outputs":[{"internalType":"address","name":"","type":"address"}]}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":[],"optimizer":{"enabled":true,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"contracts/Proxy.sol":"Proxy"},"evmVersion":"cancun","libraries":{}},"sources":{"contracts/Proxy.sol":{"keccak256":"0x555c41a45e79c79fc04e3685f609b1727dfd2eab25d1bd4b25655639a53f3fc9","urls":["bzz-raw://079c516b5a9bcdadcfbc5a70ec0c39f5d0d69bec85ab939329e9c4ec96470471","dweb:/ipfs/QmXEz2V5XHixESaY8nuFVigb41neWzZe2ZvabGYsNusHej"],"license":"UNLICENSED"}},"version":1},"id":0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,20 @@ | |||
// SPDX-License-Identifier: MIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed for testing so we can mock the response
address: string; | ||
symbol: string; | ||
usesProxy: boolean; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted not to include chainId as I couldn't imagine the same contract address on different chains having different implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ie. If BUIDL is at a different address on Unichain, then we would just add the Unichain address here as another entry.
Description
Util class for checking:
Permissioned tokens must follow the DSTokenInterface. In the future we may expand this to other interfaces.
You can learn more about the DSTokenInterface here:
https://medium.com/securitize/understanding-transfer-restrictions-for-digital-securities-4652ef97813f
https://github.com/securitize-io/DSTokenInterfaces/blob/master/contracts/dsprotocol/token/DSTokenInterface.sol
How Has This Been Tested?
Included integration tests
Are there any breaking changes?
No
(Optional) Feedback Focus
sdks/uniswapx-sdk/src/utils/PermissionedTokenValidator.ts