Address Contract Verified
Address
0x58D3C86dA030B232dE0ACd06FAd21b429A737C50
Balance
0 ETH
Nonce
1
Code Size
12792 bytes
Creator
0xd47e4431...bcCa at tx 0x5552e480...0c7742
Indexed Transactions
0
Contract Bytecode
12792 bytes
0x60806040526004361015610011575f80fd5b5f3560e01c806301d7a0a8146114c557806306fdde03146113b157806307f1ef9e1461147c578063127d532b1461143857806315a0d6b71461141b5780631711e9a0146113e057806317d7de7c146113b15780631ea5283e146111d6578063397639ed1461110d5780634e8b3d031461109857806361f2efaf146110765780636359a1c11461104f57806370e5d26914610e4c578063774de68014610e265780637d41c8ed14610d255780638d17ea3c14610cff57806392ab91e314610ce2578063959c428b14610c69578063b6632cb314610a49578063c47f0027146108bd578063c5c145a114610864578063d684b3c3146107fc578063dbf6e37a146106d7578063de29207d14610684578063e2095a53146105dd578063e9ec573a146105b5578063eaee5eaf14610510578063ec7760c41461027b578063f03cb7ff14610249578063f321b305146101975763f77c47911461016e575f80fd5b34610193575f6003193601126101935760206001600160a01b035f5416604051908152f35b5f80fd5b34610193576040600319360112610193576101b06117fa565b60243567ffffffffffffffff811161019357610223916101d761020b923690600401611aea565b92906101eb6101e4611b76565b329061268a565b8015610225575b6101fb90611edb565b610203611bf6565b933691611a96565b906040519261021b6020856118bf565b5f8452612c63565b005b506101fb610242610234611bf6565b60208151910120339061268a565b90506101f2565b346101935761027761026361025d36611bb3565b91612a47565b604051918291602083526020830190611b18565b0390f35b5f60031936011261019357610294600154341015611c31565b5f54604080517f127d532b0000000000000000000000000000000000000000000000000000000081526004810191909152600960448201527f5265676973747261720000000000000000000000000000000000000000000000606482015233602482015290602090829060849082906001600160a01b03165afa908115610505575f916104cb575b5061043b57335f52600360205260405f2060028154916001810161035761034582548096611c89565b8095610352821515611c96565b611ce1565b9055018054906001820180921161040e575561037534600254611ce1565b6002555f80808084335af1610388612a18565b50156103ca57604080519182525f6020830152349082015233907fde56ffc0c60216b5973605759f98b72b1ffddde8c6aa70ea1228275844b5dcab90606090a2005b606460405162461bcd60e51b815260206004820152601560248201527f4574686572207472616e73666572206661696c656400000000000000000000006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b60a460405162461bcd60e51b815260206004820152604a60248201527f526567697374726172732f6c61756e636870616473206d6179206e6f7420626560448201527f20616c6c6f77656420746f207265766572736520616e7920616d6f756e74732060648201527f746865792073656e642e000000000000000000000000000000000000000000006084820152fd5b90506020813d6020116104fd575b816104e6602093836118bf565b81010312610193576104f790611c7c565b8161031c565b3d91506104d9565b6040513d5f823e3d90fd5b346101935760806003193601126101935760043567ffffffffffffffff811161019357610541903690600401611acc565b610549611810565b9060443567ffffffffffffffff81116101935761056a903690600401611acc565b906064359167ffffffffffffffff8311610193576020936105926105ab943690600401611acc565b926105a66105a16101e4611b76565b612403565b612c63565b6040519015158152f35b34610193575f6003193601126101935760206105cf611bf6565b818151910120604051908152f35b346101935760e06003193601126101935760043567ffffffffffffffff81116101935761060e903690600401611aea565b90610617611810565b9060443567ffffffffffffffff811161019357610638903690600401611aea565b9390610642611826565b936084359467ffffffffffffffff86116101935760209661066a6105ab973690600401611aea565b94909361067561183c565b9661067e611a5c565b9861298c565b34610193575f600319360112610193576020600d816040516106a76040826118bf565b828152017f547265617375727941646d696e00000000000000000000000000000000000000815220604051908152f35b34610193576020600319360112610193576001600160a01b036106f86117fa565b6107036101e4611b76565b80156107e6575b61071390611edb565b16801515806107dc575b156107ac577fffffffffffffffffffffffff0000000000000000000000000000000000000000600a541617600a555b7f027c3e080ed9215f564a9455a666f7e459b3edc0bb6e02a1bf842fde4d0ccfc160206001600160a01b03600a5416807fffffffffffffffffffffffff00000000000000000000000000000000000000005f5416175f55604051908152a1005b50307fffffffffffffffffffffffff0000000000000000000000000000000000000000600a541617600a5561074c565b503081141561071d565b506107136107f5610234611bf6565b905061070a565b346101935761012060031936011261019357610816611810565b61081e611826565b9061082761183c565b9160e4356001600160a01b03811681036101935761010435918215158303610193576020946105ab9460c435926084359160443590600435612916565b34610193576020600319360112610193576001600160a01b036108856117fa565b165f52600360205260405f20805461027760026001840154930154604051938493846040919493926060820195825260208201520152565b346101935760206003193601126101935760043567ffffffffffffffff8111610193576108ee903690600401611acc565b6108fc6105a16101e4611b76565b805167ffffffffffffffff8111610a1c57610918600b54611852565b601f81116109b9575b50602091601f821160011461095c579181925f92610951575b50505f198260011b9260031b1c191617600b555f80f35b01519050828061093a565b601f19821692600b5f52805f20915f5b8581106109a157508360019510610989575b505050811b01600b55005b01515f1960f88460031b161c1916905582808061097e565b9192602060018192868501518155019401920161096c565b600b5f527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9601f830160051c81019160208410610a12575b601f0160051c01905b818110610a075750610921565b5f81556001016109fa565b90915081906109f1565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b34610193576020600319360112610193575f54604080517f127d532b000000000000000000000000000000000000000000000000000000008152600480820192909252600d60448201527f547265617375727941646d696e0000000000000000000000000000000000000060648201523360248201529035916001600160a01b0316602082608481845afa918215610505575f92610c2d575b508115610b24575b7f36a705a6c19db3ef2d8bf55ca55188c8499831bdf4fb8cd76fc1cf98b740bd27602084610b1785611edb565b80600155604051908152a1005b604080517f127d532b0000000000000000000000000000000000000000000000000000000081526004810191909152600d60448201527f536d617274436f6e74726163740000000000000000000000000000000000000060648201523360248201529150602090829060849082905afa908115610505575f91610bc9575b507f36a705a6c19db3ef2d8bf55ca55188c8499831bdf4fb8cd76fc1cf98b740bd27610aea565b90506020813d602011610c25575b81610be4602093836118bf565b81010312610193577f36a705a6c19db3ef2d8bf55ca55188c8499831bdf4fb8cd76fc1cf98b740bd2791610b17610c1c602093611c7c565b92505091610ba2565b3d9150610bd7565b9091506020813d602011610c61575b81610c49602093836118bf565b8101031261019357610c5a90611c7c565b9083610ae2565b3d9150610c3c565b346101935760a06003193601126101935760043567ffffffffffffffff811161019357610c9a903690600401611aea565b610ca2611810565b916044359167ffffffffffffffff831161019357602093610cca6105ab943690600401611aea565b91610cd3611826565b93610cdc611a6b565b956127b5565b34610193575f600319360112610193576020600154604051908152f35b346101935760406003193601126101935760206105ab610d1d611810565b60043561268a565b34610193575f60031936011261019357600854610d4181611f26565b90610d4f60405192836118bf565b80825260208201908160085f527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee35f915b838310610e0957848660405191829160208301906020845251809152604083019060408160051b85010192915f905b828210610dbe57505050500390f35b91936020610df9827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc060019597998495030186528851611a37565b9601920192018594939192610daf565b600160208192610e1885611999565b815201920192019190610d80565b34610193575f6003193601126101935760206001600160a01b03600a5416604051908152f35b3461019357606060031936011261019357610e656117fa565b6044356001600160a01b038116809103610193576001600160a01b035f54166040517f127d532b00000000000000000000000000000000000000000000000000000000815260208180610eff336004830191909160408152600d60408201527f547265617375727941646d696e00000000000000000000000000000000000000606082015260206001600160a01b03608083019416910152565b0381855afa908115610505575f91611015575b508015610f53575b610f249150611edb565b5f5260046020526001600160a01b0360405f2091165f5260205260405f20610f4f6024358254611ce1565b9055005b50604080517f127d532b0000000000000000000000000000000000000000000000000000000081526004810191909152600d60448201527f536d617274436f6e747261637400000000000000000000000000000000000000606482015233602482015290602090829060849082905afa8015610505575f90610fda575b610f249150610f1a565b506020813d60201161100d575b81610ff4602093836118bf565b8101031261019357611008610f2491611c7c565b610fd0565b3d9150610fe7565b90506020813d602011611047575b81611030602093836118bf565b810103126101935761104190611c7c565b84610f12565b3d9150611023565b346101935760206105ab61106236611bb3565b916110716105a16101e4611b76565b6124f8565b34610193575f600319360112610193576020611090611b76565b604051908152f35b34610193576040600319360112610193576110b16117fa565b6001600160a01b036110c1611810565b91165f5260046020526001600160a01b0360405f2091165f5260205260405f20805461027760026001840154930154604051938493846040919493926060820195825260208201520152565b346101935760406003193601126101935760043567ffffffffffffffff81116101935761113e903690600401611aea565b602435908115158203610193576111549261213e565b6040518091602082016020835281518091526040830190602060408260051b8601019301915f905b82821061118b57505050500390f35b919360206111c6827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc060019597998495030186528851611b18565b960192019201859493919261117c565b34610193576040600319360112610193576111ef6117fa565b5f54604080517f127d532b0000000000000000000000000000000000000000000000000000000081526004810191909152600d60448201527f547265617375727941646d696e00000000000000000000000000000000000000606482015233602482015291906001600160a01b0316602083608481845afa928315610505575f93611375575b5082156112a8575b5061128f6001600160a01b0392611edb565b165f52600360205260405f20610f4f6024358254611ce1565b604080517f127d532b0000000000000000000000000000000000000000000000000000000081526004810191909152600d60448201527f536d617274436f6e74726163740000000000000000000000000000000000000060648201523360248201529250602090839060849082905afa918215610505575f9261132f575b5061128f61127d565b91506020823d60201161136d575b8161134a602093836118bf565b810103126101935761128f6113666001600160a01b0393611c7c565b9250611326565b3d915061133d565b9092506020813d6020116113a9575b81611391602093836118bf565b81010312610193576113a290611c7c565b9183611275565b3d9150611384565b34610193575f600319360112610193576102776113cc6118e2565b604051918291602083526020830190611a37565b346101935760a06003193601126101935760206105ab6113fe611810565b611406611826565b61140e611a6b565b9160443590600435611eab565b34610193575f600319360112610193576020600254604051908152f35b346101935760406003193601126101935760043567ffffffffffffffff8111610193576105ab61146e6020923690600401611acc565b611476611810565b90611daa565b346101935760e06003193601126101935760206105ab61149a611810565b6114a2611826565b906114ab61183c565b906114b4611a5c565b926084359160443590600435611cee565b6020600319360112610193576114d96117fa565b6114e7600154341015611c31565b5f54604080517f127d532b0000000000000000000000000000000000000000000000000000000081526004810191909152600960448201527f5265676973747261720000000000000000000000000000000000000000000000606482015233602482015290602090829060849082906001600160a01b03165afa908115610505575f916117c0575b50611756576001600160a01b0316805f52600460205260405f206001600160a01b0333165f5260205260405f20906002825492600181016115c26115b582548097611c89565b8096610352821515611c96565b9055018054906001820180921161040e57556115e034600254611ce1565b6002556040519061167e60208301927fa9059cbb0000000000000000000000000000000000000000000000000000000084523360248201528460448201526044815261162d6064826118bf565b5f8060409586519361163f88866118bf565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65646020860152519082875af1611677612a18565b908461312a565b8051908115918215611734575b5050156116cb5781519283526020830152349082015233907fde56ffc0c60216b5973605759f98b72b1ffddde8c6aa70ea1228275844b5dcab90606090a2005b6084825162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b819250906020918101031261019357602061174f9101611c7c565b848061168b565b608460405162461bcd60e51b815260206004820152603c60248201527f526567697374726172732f6c61756e636870616473206d6179206e6f7420726560448201527f766572736520616e7920616d6f756e747320746865792073656e642e000000006064820152fd5b90506020813d6020116117f2575b816117db602093836118bf565b81010312610193576117ec90611c7c565b8261156f565b3d91506117ce565b600435906001600160a01b038216820361019357565b602435906001600160a01b038216820361019357565b606435906001600160a01b038216820361019357565b60a435906001600160a01b038216820361019357565b90600182811c92168015611899575b602083101461186c57565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b91607f1691611861565b60c0810190811067ffffffffffffffff821117610a1c57604052565b90601f601f19910116810190811067ffffffffffffffff821117610a1c57604052565b604051905f82600b54916118f583611852565b808352926001811690811561197a575060011461191b575b611919925003836118bf565b565b50600b5f90815290917f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db95b81831061195e5750509060206119199282010161190d565b6020919350806001915483858901015201910190918492611946565b6020925061191994915060ff191682840152151560051b82010161190d565b9060405191825f8254926119ac84611852565b8084529360018116908115611a1557506001146119d1575b50611919925003836118bf565b90505f9291925260205f20905f915b8183106119f9575050906020611919928201015f6119c4565b60209193508060019154838589010152019101909184926119e0565b6020935061191995925060ff1991501682840152151560051b8201015f6119c4565b90601f19601f602080948051918291828752018686015e5f8582860101520116010190565b60c43590811515820361019357565b60843590811515820361019357565b67ffffffffffffffff8111610a1c57601f01601f191660200190565b929192611aa282611a7a565b91611ab060405193846118bf565b829481845281830111610193578281602093845f960137010152565b9080601f8301121561019357816020611ae793359101611a96565b90565b9181601f840112156101935782359167ffffffffffffffff8311610193576020838186019501011161019357565b9060a080611b44611b32855160c0865260c0860190611a37565b60208601518582036020870152611a37565b936001600160a01b03604082015116604085015260608101516060850152608081015160808501520151151591015290565b60056020604051611b886040826118bf565b828152017f537570657200000000000000000000000000000000000000000000000000000081522090565b6040600319820112610193576004359067ffffffffffffffff821161019357611bde91600401611aea565b90916024356001600160a01b03811681036101935790565b60405190611c056040836118bf565b600d82527f536d617274436f6e7472616374000000000000000000000000000000000000006020830152565b15611c3857565b606460405162461bcd60e51b815260206004820152601660248201527f496e73756666696369656e742061646d696e20666565000000000000000000006044820152fd5b5190811515820361019357565b9190820391821161040e57565b15611c9d57565b606460405162461bcd60e51b815260206004820152601160248201527f4e6f7468696e6720746f20726566756e640000000000000000000000000000006044820152fd5b9190820180921161040e57565b919515611d2e57611cfe9161268a565b9384611d1b575b505082611d1157505090565b611ae7925061268a565b611d2692945061268a565b915f80611d05565b611d379161268a565b938415611d4c575b50508215611d1157505090565b611d5792945061268a565b915f80611d3f565b15611d6657565b606460405162461bcd60e51b815260206004820152601660248201527f496e76616c696420656e746974792061646472657373000000000000000000006044820152fd5b6001600160a01b035f54163003611e0a576020806001600160a01b0392611dd48486161515611d5f565b611ddd81612bdc565b604051928184925191829101835e8101600581520301902091165f5260205260ff600560405f2001541690565b6001600160a01b03602091611e5b825f541691604051958694859384937f127d532b000000000000000000000000000000000000000000000000000000008552604060048601526044850190611a37565b9116602483015203915afa908115610505575f91611e77575090565b90506020813d602011611ea3575b81611e92602093836118bf565b8101031261019357611ae790611c7c565b3d9150611e85565b919315611ec657611ebb9161268a565b9182611d1157505090565b611ecf9161268a565b918215611d1157505090565b15611ee257565b606460405162461bcd60e51b815260206004820152601360248201527f556e617574686f72697a656420616363657373000000000000000000000000006044820152fd5b67ffffffffffffffff8111610a1c5760051b60200190565b81601f8201121561019357805190611f5582611a7a565b92611f6360405194856118bf565b8284526020838301011161019357815f9260208093018386015e8301015290565b91909160c0818403126101935760405190611f9e826118a3565b8193815167ffffffffffffffff81116101935781611fbd918401611f3e565b835260208201519067ffffffffffffffff821161019357611fdf918301611f3e565b60208301526040810151906001600160a01b03821682036101935760a06120219181936040860152606081015160608601526080810151608086015201611c7c565b910152565b601f8260209493601f1993818652868601375f8582860101520116010190565b805482101561205b575f5260205f2001905f90565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f19811461040e5760010190565b604051906120a3826118a3565b5f60a08360608152606060208201528260408201528260608201528260808201520152565b805182101561205b5760209160051b010190565b906040516120e9816118a3565b60a060ff600583956120fa81611999565b855261210860018201611999565b60208601526001600160a01b03600282015416604086015260038101546060860152600481015460808601520154161515910152565b6001600160a01b035f541630036122e657602090612165612160368584611a96565b612bdc565b826040519384928337810160058152030190205f915f9160018101918254935b84811061227f5750601f196121b261219c87611f26565b966121aa60405198896118bf565b808852611f26565b015f5b8181106122685750505f925f5b8581106121d25750505050505090565b6001600160a01b036121e48284612046565b90549060031b1c16838415612247575b612202575b506001016121c2565b600191956001600160a01b0361224092165f528560205261222560405f206120dc565b61222f828b6120c8565b5261223a818a6120c8565b50612088565b94906121f9565b506001600160a01b0381165f528460205260ff600560405f200154166121f4565b602090612273612096565b82828a010152016121b5565b6001600160a01b036122918286612046565b90549060031b1c16829083156122c4575b506122b0575b600101612185565b946122bc600191612088565b9590506122a8565b6001600160a01b039150165f528260205260ff600560405f200154165f6122a2565b5f91612336916001600160a01b0384541691604051958694859384937f397639ed000000000000000000000000000000000000000000000000000000008552604060048601526044850191612026565b901515602483015203915afa908115610505575f91612353575090565b90503d805f833e61236481836118bf565b8101906020818303126101935780519067ffffffffffffffff821161019357019080601f8301121561019357815161239b81611f26565b926123a960405194856118bf565b81845260208085019260051b820101918383116101935760208201905b8382106123d557505050505090565b815167ffffffffffffffff8111610193576020916123f887848094880101611f84565b8152019101906123c6565b1561240a57565b606460405162461bcd60e51b815260206004820152601060248201527f63616c6c6572206e6f74205375706572000000000000000000000000000000006044820152fd5b9161246f6020926001600160a01b0392969596604086526040860191612026565b9416910152565b5f929181549161248583611852565b80835292600181169081156124da57506001146124a157505050565b5f9081526020812093945091925b8383106124c0575060209250010190565b6001816020929493945483858701015201910191906124af565b9050602094955060ff1991509291921683830152151560051b010190565b90916001600160a01b035f5416300361262b576001600160a01b031690612520821515611d5f565b61252e612160368584611a96565b60405183828237602081858101600581520301902090825f528160205260ff600560405f2001541615612623575f83815260209290925260409182902060058101805460ff19169055825160a080825290956125ee9492936001936125df938693919261259f92918b019190612026565b818982038060208c0152600683527f52656d6f76650000000000000000000000000000000000000000000000000000602084015201828a01520190612476565b91858303606087015201612476565b905f60808401527fc365ddbf26f8d334ca1e1fee1d3f7dfe85c7c88bd4273697a00c19c5fb1d484a42938033940390a4600190565b505050505f90565b602091612675935f6001600160a01b0381541692604051968795869485937f6359a1c10000000000000000000000000000000000000000000000000000000085526004850161244e565b03925af1908115610505575f91611e77575090565b6001600160a01b035f5416300361275a576126af6001600160a01b0383161515611d5f565b805f5260096020526126c360405f20611999565b905f52600760205260ff60405f205416156127105760405181516001600160a01b0392602091839181908401835e8101600581520301902091165f5260205260ff600560405f2001541690565b60405162461bcd60e51b815260206004820152601260248201527f496e76616c69642061646d696e20747970650000000000000000000000000000604482015280606481015b0390fd5b6001600160a01b03916044602092845f541660405195869485937f8d17ea3c00000000000000000000000000000000000000000000000000000000855260048501521660248301525afa908115610505575f91611e77575090565b9293955f146127f8576127d2926127cd913691611a96565b611daa565b92836127df575b50505090565b6127f09350906127cd913691611a96565b5f80806127d9565b612807926127cd913691611a96565b9283156127df5750505090565b919091825167ffffffffffffffff8111610a1c576128328254611852565b601f81116128d1575b506020601f821160011461287357819293945f92612868575b50505f198260011b9260031b1c1916179055565b015190505f80612854565b601f19821690835f52805f20915f5b8181106128b9575095836001959697106128a1575b505050811b019055565b01515f1960f88460031b161c191690555f8080612897565b9192602060018192868b015181550194019201612882565b825f5260205f20601f830160051c8101916020841061290c575b601f0160051c01905b818110612901575061283b565b5f81556001016128f4565b90915081906128eb565b919715612953576129269161268a565b9586612940575b505084611d1b57505082611d1157505090565b61294b92965061268a565b935f8061292d565b61295c9161268a565b958615612979575b50508415611d4c5750508215611d1157505090565b61298492965061268a565b935f80612964565b9293989695965f146129d7576129a7926127cd913691611a96565b95866129bc575b505050836127df5750505090565b6129ce939650906127cd913691611a96565b925f80806129ae565b6129e6926127cd913691611a96565b9586156129fd575b50505083156127df5750505090565b612a0f939650906127cd913691611a96565b925f80806129ee565b3d15612a42573d90612a2982611a7a565b91612a3760405193846118bf565b82523d5f602084013e565b606090565b90612a50612096565b506001600160a01b035f54163003612b46576001600160a01b03831615612b025760206001600160a01b0392612a8a612160368584611a96565b8260405193849283378101600581520301902091165f5260205260405f2060ff60058201541615612abe57611ae7906120dc565b606460405162461bcd60e51b815260206004820152601160248201527f4e6f20456e74206f7220696e61637476650000000000000000000000000000006044820152fd5b606460405162461bcd60e51b815260206004820152601560248201527f496e76616c696420656e746974792061646472737300000000000000000000006044820152fd5b915f91612b8f936001600160a01b0384541691604051958694859384937ff03cb7ff0000000000000000000000000000000000000000000000000000000085526004850161244e565b03915afa908115610505575f91612ba4575090565b90503d805f833e612bb581836118bf565b810160208282031261019357815167ffffffffffffffff811161019357611ae79201611f84565b604051815160ff92602091839181908401835e8101600681520301902054161561271057565b60405190612c116040836118bf565b600c82527f5343206e6f7420746f6b656e00000000000000000000000000000000000000006020830152565b9060208282031261019357815167ffffffffffffffff811161019357611ae79201611f3e565b929190916001600160a01b035f54163003612fcc576001600160a01b03831692612c8e841515611d5f565b825115612f3a575b815115612e6f575b50612ca884613051565b50604051602081865180838901835e81016005815203019020835f528060205260ff600560405f20015416612e6657600190604051612ce6816118a3565b8481526005602082019185835260408101888152606082014381526080830191428352612d3360a08501968988528c5f5288602052612d2a60405f20965187612814565b51898601612814565b6001600160a01b03600285019151167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055516003830155516004820155019051151560ff60ff198354169116179055019182549068010000000000000000821015610a1c57612db382612e30956001612e2295018155612046565b81549060031b906001600160a01b0388831b921b19161790556040612de281519760a0895260a0890190611a37565b818882038060208b0152600383527f4164640000000000000000000000000000000000000000000000000000000000602084015201828901520190611a37565b908482036060860152611a37565b90600160808401527fc365ddbf26f8d334ca1e1fee1d3f7dfe85c7c88bd4273697a00c19c5fb1d484a42938033940390a4600190565b50505050505f90565b3b159050612efd576040517f95d89b410000000000000000000000000000000000000000000000000000000081525f81600481865afa5f9181612ed9575b50612ec15750612ebb612c02565b5f612c9e565b805115155f03612ebb5750612ed4612c02565b612ebb565b612ef69192503d805f833e612eee81836118bf565b810190612c3d565b905f612ead565b604051612f0b6040826118bf565b601c81527f6e6f206c6162656c20616e64205343206e6f7420636f6e7472616374000000006020820152612ebb565b9150813b15612fc4576040517f06fdde030000000000000000000000000000000000000000000000000000000081525f81600481875afa5f9181612fa8575b50612f8d5750612f87612c02565b91612c96565b805115612f9a5791612c96565b50612fa3612c02565b612f87565b612fbd9192503d805f833e612eee81836118bf565b905f612f79565b612f87612c02565b916130275f6001600160a01b03939561267560209661303f87855416966040519a8b998a9889977feaee5eaf000000000000000000000000000000000000000000000000000000008952608060048a01526084890190611a37565b92166024870152600319868303016044870152611a37565b90600319848303016064850152611a37565b5f9060405160ff825191602081818601948086835e8101600681520301902054161561307c57505090565b908092505160208183209282604051938492835e81016006815203019020600160ff19825416179055805f52600760205260405f20600160ff198254161790555f5260096020526130d08160405f20612814565b6008549068010000000000000000821015610a1c576001820160085560085482101561205b5760085f52613125917ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301612814565b600190565b9192901561318b575081511561313e575090565b3b156131475790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b82519091501561319e5750805190602001fd5b6127569060405191829162461bcd60e51b8352602060048401526024830190611a3756fea2646970667358221220c8f99d4a2f42c8492033087e0acbc878dba9b1996acc6d968cf8d84c391c4b9964736f6c634300081d0033
Verified Source Code Full Match
Compiler: v0.8.29+commit.ab55807c
EVM: cancun
Optimization: Yes (10000 runs)
IERC20Permit.sol 90 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
SafeERC20.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
Controller.sol 398 lines
// SPDX-License-Identifier: UNLICENSED
// Copyright 2025 US Fintech LLC and DelNorte Holdings.
//
// Permission to use, copy, modify, or distribute this software is strictly prohibited
// without prior written consent from both copyright holders.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
// ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// OFFICIAL DEL NORTE NETWORK COMPONENT
// This component is minimally tested. Use at your own risk.
// Designed by Ken Silverman as part of his ElasticTreasury (HUB and SPOKE), PeerTreasury and Controller model.
// This deployment is for Trueviewchain Inc. a Panama entity and Del Norte El Salvador S.A a subsidiary of Del Norte Holdings, Delaware USA.
// Permission to change metadata stored on blockchain explorers and elsewheregranted to Del Norte Holdings, DE only.
// Compilation help from Tony Sparks and Maleeha Naveed. Deployed by Maleeha Naveed on behalf of Del Norte. May 5th,2025
pragma solidity 0.8.29;
import "./Recoverable.sol";
interface IERC20SymbolAndName {
function symbol() external view returns (string memory);
function name() external view returns (string memory);
}
contract Controller is Recoverable {
event TreasuryCreated(address treasuryAddress, string label);
event UpdateOfficials(
address indexed entityAddress,
address indexed updater,
string entityType, // "SC,SystemUser,SystemAdmin,BTADmin, etc ..."
string action, // Add,Remove (nothing is actually removed, only active boolean changed)
string fullNameOfEntityOrLabel, // person's full name or "SC"
string nationalIdOfEntity, // registered to entity or SC address if entity is SC
uint256 indexed blockTimeStamp, // block number of the event
bool remainsActive
);
struct OfficialEntityStruct {
string fullNameOfEntityOrLabel;
string nationalIdOfEntity; // (if entity is a smart contract, leave empty or provide some other detail here.)
address pubAddress; // registered to entity or SC address if entity is SC
uint256 blockNumber;
uint256 blockTimestamp;
bool active;
}
struct OfficialEntityGroup {
mapping(address => OfficialEntityStruct) entitiesByAddress; // Maps entity address to its details
address[] entityList; // List of entity addresses for iteration
}
struct AdminTypeRegistry {
mapping(string => bool) isRegistered; // internally a hash key but requires string for lookup
mapping(bytes32 => bool) isHashRegistered; // slightly faster pre-hahsed lookup
string[] registeredAdminTypes;
mapping(bytes32 => string) nameByHash; // Reverse lookup from hash to original string
}
mapping(string => OfficialEntityGroup) private officialEntityGroupsByType;
// NEW structure to SUPPORT validateAdminType
AdminTypeRegistry private adminTypeRegistry;
address public remoteController; // Hub address for admin verification - ALWAYS “this” for now
string public name;
bytes32 public constant KECCAK_TREASURY_ADMIN = keccak256(bytes("TreasuryAdmin"));
bytes32 public constant KECCAK_SMART_CONTRACT = keccak256(bytes("SmartContract"));
bytes32 public constant KECCAK_SUPER_ADMIN = keccak256(bytes("Super"));
modifier onlySuper() {
require(isOfficialEntityFast(KECCAK_SUPER_ADMIN, tx.origin), "caller not Super");
_;
}
// Warning! Any official "Super" can call addEntity directly. This is NOT a first line of defense against that.
// The only defense there is to make sure your official SCs have their own calls to this controller’s
// isOfficialEntity(“Super”) for example BEFORE calling addEntity() or removeEntity()
// init() LOCKS this Controller to only allowing TreasAdmins to adding official SCs to begin with.
// REMOTE case now allows a smartContract caller unless tx.origin is used
// use case of checking that the original human sender is authorized (even through non-official contract calls)
// may be one of the few legitimate uses of tx.origin
// ✓ To register as official smartContract → You need to be called by an official entity
// ✗ because you can't be an official entity smartContract → Until that smatcontract calls init() via its own constructor
// therefore we must USE tx.origin for initial registration of smartContracts as a bootstrap
modifier onlySuperOrSCExecutives() {
bool temp = isOfficialEntityFast(KECCAK_SUPER_ADMIN, tx.origin) ||
isOfficialEntityFast(KECCAK_SMART_CONTRACT, msg.sender);
require(temp, "Unauthorized access");
_; // run the code block referencing this modifier
}
// to meet the 24K limit, BaseTreasury is now instantiated FIRST - however its concept remains the same - as a BASE class
// for ElasticTreasuryHUB and ElasticTreasurySPOKE MasterHub is now an optional, later passed “controller” that must be
// a separate instantiatedController. This will NOT be used for our needs yet. In other words, controller is ALWAYS
// this for now.
constructor(address initialControllerAdmin, string memory _name) Recoverable(address(this)) {
name = _name;
remoteController = address(this); // formerly masterHub, controller is ALWAYS this for now. (see remotelyManage)
// **Reject if initialControllerAdmin is 0x0000 (formerly as parent, if has no TreasuryAdmin**
if (initialControllerAdmin == address(0)) {
revert("Controller: needs at least one TreasuryAdmin");
}
// Next line not needed, will be added dynamically. NTL its a kickstart for what we are doing specifically
string[3] memory defaultTypes = ["TreasuryAdmin", "SmartContract","Super"]; // Registrars/TokenAdmins added in Token SystemAdmins/SystemUsers/SystemEmployees added in 721
for (uint256 i = 0; i < defaultTypes.length; i++) {
addAdminType(defaultTypes[i]);
}
addOfficialEntityNow("Super", initialControllerAdmin, "Presumed Multi-Sig platform exec", "Initial Execs");
addOfficialEntityNow("TreasuryAdmin", initialControllerAdmin, "Presumed Multi-Sig platform exec", "Initial Execs");
// SEE ElasticTreasuryHub transferTreasury() no longer adds SPOKE as SC official - now added here …
// NO LONGER adding self as Official SC, because SELF is now standalone controller NOT parent due to 24K max mem.
emit TreasuryCreated(address(this), "Controller");
}
// caller MUST be a HUB or SPOKE because Controller is now deployed separately.
// HUB and spoke are no longer Controllers themselves. addedBTAdmin is optional, HUB and SPOKE pass address(0)
function init(address officialSmartContractAddress, string calldata contractName) external onlySuperOrSCExecutives {
addOfficialEntityNow("SmartContract",officialSmartContractAddress, contractName,""); // may exist, if token, symbol will be added.
}
// do not use except for use case as of yet not imagined would need to be called immediately via child constructor
function remotelyManage(address _controller) external onlySuperOrSCExecutives {
bool isRemotelyManaged = (_controller != address(0) && _controller != address(this));
if (isRemotelyManaged) {
remoteController = _controller;
}
else {
remoteController = address(this); // not used if isRemotelyManaged is false
}
changeController(remoteController);
}
// if master is self, it is the same as passing false, because SELF (local) WILL manage in that case.
// Any controller that is not self must be another instance of BaseTreasury
// just a formality, if not here, controller can always be cast to BaseTreasury, even if self.
// Ex: BaseTreasury(controller).someFunction … will always work whether self or another BaseTreasury instance.
function doesRemoteControllerManageAllOfficials() internal view returns (bool) {
return controller != address(this);
}
///
// OFFICIAL ENTITIES
//
//
// Dynamically validate an admin type, and optionally register new ones
function validateAdminType(string memory adminType) internal view {
if (!adminTypeRegistry.isRegistered[adminType]) {
revert("Invalid admin type");
}
}
function addAdminType(string memory adminType) internal returns (bool) {
if (!adminTypeRegistry.isRegistered[adminType]) {
// to support remote case, let a TreasuryAdmin add too, since “SmartContract” is not sensed for remote
// chained transaction caller: EOA ⇒ contract A == > contract B (here) ⇒ remote controller (A not sensed)
// require(isOfficialEntity(“SmartContract”,msg.sender),”Only official SC can add new Officl type”);
bytes32 hash = keccak256(bytes(adminType));
adminTypeRegistry.isRegistered[adminType] = true;
adminTypeRegistry.isHashRegistered[hash] = true;
adminTypeRegistry.nameByHash[hash] = adminType;
adminTypeRegistry.registeredAdminTypes.push(adminType);
return true;
}
return false;
}
// Retrieve all registered admin types
function getRegisteredAdminTypes() external view returns (string[] memory) {
return adminTypeRegistry.registeredAdminTypes;
}
// "TreasuryAdmin", initialControllerAdmin, "Presumed Multi-Sig platform exec", "Initial Execs"
function addOfficialEntity(string memory adminType, address entityAddr, string memory label,string memory nationalIdOrSC) public onlySuper returns (bool) {
return addOfficialEntityNow(adminType, entityAddr, label, nationalIdOrSC);
}
function addOfficialEntityNow(string memory adminType, address entityAddr, string memory label, string memory nationalIdOrSCSymbol) internal returns (bool) {
if (doesRemoteControllerManageAllOfficials()) {
return Controller(controller).addOfficialEntity(adminType, entityAddr, label, nationalIdOrSCSymbol);
}
require(entityAddr != address(0), "Invalid entity address");
if (bytes(label).length == 0) {
if (entityAddr.code.length > 0) {
try IERC20SymbolAndName(entityAddr).name() returns (string memory s) {
label = bytes(s).length > 0 ? s : "SC not token";
} catch {
label = "SC not token";
}
}
else {
label = "SC not token";
}
}
if (bytes(nationalIdOrSCSymbol).length == 0) {
if (entityAddr.code.length > 0) {
try IERC20SymbolAndName(entityAddr).symbol() returns (string memory s) {
nationalIdOrSCSymbol = bytes(s).length > 0 ? s : "SC not token";
} catch {
nationalIdOrSCSymbol = "SC not token";
}
} else {
nationalIdOrSCSymbol = "no label and SC not contract";
}
}
addAdminType(adminType);
OfficialEntityGroup storage group = officialEntityGroupsByType[adminType];
if (group.entitiesByAddress[entityAddr].active) {
return false;
}
group.entitiesByAddress[entityAddr] = OfficialEntityStruct(label, nationalIdOrSCSymbol, entityAddr, block.number, block.timestamp, true);
group.entityList.push(entityAddr);
emit UpdateOfficials(entityAddr, msg.sender, adminType, "Add", label, nationalIdOrSCSymbol, block.timestamp, true);
return true;
}
function removeOfficialEntity(string calldata adminType, address entityAddr) external onlySuper returns (bool) {
if (doesRemoteControllerManageAllOfficials()) {
return Controller(controller).removeOfficialEntity(adminType, entityAddr);
}
require(entityAddr != address(0), "Invalid entity address");
validateAdminType(adminType); // 🔹 Ensure valid type
OfficialEntityGroup storage group = officialEntityGroupsByType[adminType];
if (!group.entitiesByAddress[entityAddr].active) {
return false;
}
// Soft-delete by marking inactive, but retain in list for history
group.entitiesByAddress[entityAddr].active = false;
emit UpdateOfficials(entityAddr, msg.sender, adminType, "Remove",group.entitiesByAddress[entityAddr].fullNameOfEntityOrLabel,group.entitiesByAddress[entityAddr].nationalIdOfEntity,block.timestamp,false);
return true;
}
function isOfficialEntityFast(bytes32 hashedAdminType, address entityAddr) public view returns (bool) {
if (doesRemoteControllerManageAllOfficials()) {
return Controller(controller).isOfficialEntityFast(hashedAdminType, entityAddr);
}
require(entityAddr != address(0), "Invalid entity address");
string memory adminType = adminTypeRegistry.nameByHash[hashedAdminType];
if (!adminTypeRegistry.isHashRegistered[hashedAdminType]) {
revert("Invalid admin type");
}
return officialEntityGroupsByType[adminType].entitiesByAddress[entityAddr].active;
}
function isOfficialEntity(string memory adminType, address entityAddr) public view returns (bool) {
if (doesRemoteControllerManageAllOfficials()) {
return Controller(controller).isOfficialEntity(adminType, entityAddr);
}
require(entityAddr != address(0), "Invalid entity address");
validateAdminType(adminType); // 🔹 Ensure valid type
return officialEntityGroupsByType[adminType].entitiesByAddress[entityAddr].active;
}
function getOfficialEntity(string calldata adminType, address entityAddr) external view returns (OfficialEntityStruct memory) {
if (doesRemoteControllerManageAllOfficials()) {
return Controller(controller).getOfficialEntity(adminType, entityAddr);
}
require(entityAddr != address(0), "Invalid entity addrss");
validateAdminType(adminType); // 🔹 Ensure valid type
OfficialEntityStruct storage entity = officialEntityGroupsByType[adminType].entitiesByAddress[entityAddr];
require(entity.active, "No Ent or inactve");
return entity;
}
function getAllOfficialEntities(string calldata adminType, bool includeInactive) external view returns (OfficialEntityStruct[] memory) {
if (doesRemoteControllerManageAllOfficials()) {
return Controller(controller).getAllOfficialEntities(adminType, includeInactive);
}
validateAdminType(adminType); // 🔹 Ensure valid type
OfficialEntityGroup storage group = officialEntityGroupsByType[adminType];
// First count entities based on the includeInactive parameter
uint256 entityCount = 0;
for (uint256 i = 0; i < group.entityList.length; i++) {
address entityAddr = group.entityList[i];
if (includeInactive || group.entitiesByAddress[entityAddr].active) {
entityCount++;
}
}
// Then create array of exactly the right size and fill it
OfficialEntityStruct[] memory filteredEntities = new OfficialEntityStruct[](entityCount);
uint256 counter = 0;
for (uint256 i = 0; i < group.entityList.length; i++) {
address entityAddr = group.entityList[i];
if (includeInactive || group.entitiesByAddress[entityAddr].active) {
filteredEntities[counter] = group.entitiesByAddress[entityAddr];
counter++;
}
}
return filteredEntities;
}
// saves a double call
function isOfficialDoubleEntity(string calldata adminType1, address entityAddr1,
string calldata adminType2, address entityAddr2, bool isAnd) public view returns (bool) {
if (isAnd) {
return isOfficialEntity(adminType1,entityAddr1) && isOfficialEntity(adminType2, entityAddr2);
}
else {
return isOfficialEntity(adminType1,entityAddr1) || isOfficialEntity(adminType2, entityAddr2);
}
}
function isOfficialDoubleEntityFast(bytes32 adminType1, address entityAddr1,bytes32 adminType2, address entityAddr2, bool isAnd) external view returns (bool) {
if (isAnd) {
return isOfficialEntityFast(adminType1, entityAddr1) && isOfficialEntityFast(adminType2, entityAddr2);
} else {
return isOfficialEntityFast(adminType1, entityAddr1) || isOfficialEntityFast(adminType2, entityAddr2);
}
}
// Fast triple entity check with bytes32
function isOfficialTripleEntityFast(bytes32 adminType1, address entityAddr1, bytes32 adminType2, address entityAddr2,
bytes32 adminType3, address entityAddr3, bool isAnd) external view returns (bool) {
if (isAnd) {
return isOfficialEntityFast(adminType1, entityAddr1)
&& isOfficialEntityFast(adminType2, entityAddr2)
&& isOfficialEntityFast(adminType3, entityAddr3);
} else {
return isOfficialEntityFast(adminType1, entityAddr1)
|| isOfficialEntityFast(adminType2, entityAddr2)
|| isOfficialEntityFast(adminType3, entityAddr3);
}
}
function isOfficialTripleEntity(string calldata adminType1, address entityAddr1, string calldata adminType2, address entityAddr2,
string calldata adminType3, address entityAddr3, bool isAnd) external view returns (bool) {
if (isAnd) {
return isOfficialEntity(adminType1, entityAddr1) && isOfficialEntity(adminType2, entityAddr2) && isOfficialEntity(adminType3, entityAddr3);
}
else {
return isOfficialEntity(adminType1, entityAddr1) || isOfficialEntity(adminType2, entityAddr2) || isOfficialEntity(adminType3, entityAddr3);
}
}
function isOfficialQuadrupleEntityFast(bytes32 adminType1, address entityAddr1,bytes32 adminType2, address entityAddr2,bytes32 adminType3, address entityAddr3,
bytes32 adminType4, address entityAddr4,bool isAnd) external view returns (bool) {
if (isAnd) {
return isOfficialEntityFast(adminType1, entityAddr1)
&& isOfficialEntityFast(adminType2, entityAddr2)
&& isOfficialEntityFast(adminType3, entityAddr3)
&& isOfficialEntityFast(adminType4, entityAddr4);
} else {
return isOfficialEntityFast(adminType1, entityAddr1)
|| isOfficialEntityFast(adminType2, entityAddr2)
|| isOfficialEntityFast(adminType3, entityAddr3)
|| isOfficialEntityFast(adminType4, entityAddr4);
}
}
//
// END OFFICIAL ENTITIES
//
// Returns the name of the controller
function getName() external view returns (string memory) {
return name;
}
function setName(string memory newName) external onlySuper {
name = newName;
}
// No receiving of accidental or unsolicited eth here
// See below for a payable method for SALES purposes and OTHER purposes (see BELOW).
// receive() external payable { // <== DO NOT IMPLEMENT, LEAVE COMMENTED
// ethBalances[msg.sender].totalReceivedThatIsReversible += msg.value;
//}
}
Recoverable.sol 131 lines
// SPDX-License-Identifier: CLOSED LICENSE COPYRIGHT 2025
// OFFICAL DEL NORTE NETWORK COMPONENT
// Designed By Ken Silverman for Del Norte. Implementation help from Tony Sparks
// Compilation help from Maleeha Naveed. May 5th, 2025
pragma solidity 0.8.29;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IController.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/// @title ReversibleRecoveryBase
/// @notice Base contract tracking / reversing accidental ETH/ERC20 transfers with admin authorization
abstract contract Recoverable {
using SafeERC20 for IERC20;
// STRUCTS
struct ReversibleUserBalance {
uint256 totalReceivedThatIsReversible;
uint256 totalReversed;
uint256 totalReversals;
}
// -----------------------------
// STORAGE
// -----------------------------
address public controller; // Address of the Controller contract (must implement IController)
uint256 public ADMIN_FEE_FIXED = 10 ** 17; // 0.1 ETH
uint256 public totalAdminFeesCollected;
mapping(address => ReversibleUserBalance) public reversibleEthBalances;
mapping(address => mapping(address => ReversibleUserBalance)) public reversibleTokenBalances;
// -----------------------------
// EVENTS
// -----------------------------
event TransferReversed(address indexed user, uint256 refundAmount, address tokenSC, uint256 adminFee);
event AdminFeeUpdated(uint256 newFee);
event ControllerChanged(address newController);
modifier onlyBTExecutives() {
bool temp = IController(controller).isOfficialEntity("TreasuryAdmin", msg.sender) ||
IController(controller).isOfficialEntity("SmartContract", msg.sender);
require(temp, "Unauthorized access");
_; // run the code block referencing this modifier
}
// -----------------------------
// CONSTRUCTOR
// -----------------------------
constructor(address _controller) {
require(_controller != address(0), "Controller address cannot be zero");
controller = _controller;
}
// -----------------------------
// EXTERNAL METHODS
// -----------------------------
function manualUpdateReversibleBalanceETH(address userAddress, uint256 amount)
external onlyBTExecutives {
reversibleEthBalances[userAddress].totalReceivedThatIsReversible += amount;
}
function manualUpdateReversibleBalanceERC20(address userAddress, uint256 amount, address tokenSC)
external onlyBTExecutives {
reversibleTokenBalances[tokenSC][userAddress].totalReceivedThatIsReversible += amount;
}
function reverseAccidentalETH() external payable {
require(msg.value >= ADMIN_FEE_FIXED, "Insufficient admin fee");
require(!IController(controller).isOfficialEntity("Registrar", msg.sender),
"Registrars/launchpads may not be allowed to reverse any amounts they send.");
ReversibleUserBalance storage balance = reversibleEthBalances[msg.sender];
uint256 refundAmount = balance.totalReceivedThatIsReversible - balance.totalReversed;
require(refundAmount > 0, "Nothing to refund");
// Update state before external call
balance.totalReversed += refundAmount;
balance.totalReversals += 1;
totalAdminFeesCollected += msg.value;
// Perform the external call
(bool success, ) = msg.sender.call{value: refundAmount}("");
require(success, "Ether transfer failed");
emit TransferReversed(msg.sender, refundAmount, address(0), msg.value);
}
function reverseAccidentalERC20(address tokenSC) external payable {
require(msg.value >= ADMIN_FEE_FIXED, "Insufficient admin fee");
require(!IController(controller).isOfficialEntity("Registrar", msg.sender), "Registrars/launchpads may not reverse any amounts they send.");
ReversibleUserBalance storage balance = reversibleTokenBalances[tokenSC][msg.sender];
uint256 refundAmount = balance.totalReceivedThatIsReversible - balance.totalReversed;
require(refundAmount > 0, "Nothing to refund");
// Update state before external call
balance.totalReversed += refundAmount;
balance.totalReversals += 1;
totalAdminFeesCollected += msg.value;
// Perform the external call
IERC20(tokenSC).safeTransfer(msg.sender, refundAmount);
emit TransferReversed(msg.sender, refundAmount, tokenSC, msg.value);
}
function changeAdminFee(uint256 newFee) external onlyBTExecutives {
ADMIN_FEE_FIXED = newFee;
emit AdminFeeUpdated(newFee);
}
function changeController(address remote) internal {
controller = remote;
emit ControllerChanged(remote);
}
}
IController.sol 45 lines
// SPDX-License-Identifier: UNLICENSED
// Copyright 2025 US Fintech LLC and DelNorte Holdings.
//
// Permission to use, copy, modify, or distribute this software is strictly prohibited
// without prior written consent from both copyright holders.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
// ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// OFFICIAL DEL NORTE NETWORK COMPONENT
// Provides immediate membership access to platform at different levels.
// Required Non US or accredited US registration to swap for DTV token. Registration available within 180 days per terms.delnorte.io .
// Minimally tesed Conroller Tree for world-wide government administration of, well, anything, including property ownership.
// Designed by Ken Silverman as part of his ElasticTreasury (HUB and SPOKE), PeerTreasury and Controller model.
// @author Ken Silverman
// This deployment is for Del Norte Holdings, Delaware and US Fintech, LLC NY.
// Permission to change metadata stored on blockchain explorers and elsewhere granted to:
// Del Norte Holdings, DE only and/or US Fintech, LLC NY independently
pragma solidity 0.8.29;
interface IController {
struct OfficialEntityStruct {
string fullNameOfEntityOrLabel;
string nationalIdOfEntity;
address pubAddress;
uint256 blockNumber;
uint256 blockTimestamp;
bool active;
}
function addOfficialEntity(string memory, address, string memory, string memory) external returns (bool);
function removeOfficialEntity(string memory, address) external returns (bool);
function isOfficialEntity(string memory, address) external view returns (bool);
function isOfficialEntityFast(bytes32, address) external view returns (bool);
function isOfficialDoubleEntity(string calldata, address, string calldata, address, bool) external view returns (bool);
function isOfficialDoubleEntityFast(bytes32, address, bytes32, address, bool) external view returns (bool);
function isOfficialTripleEntityFast(bytes32, address, bytes32, address, bytes32, address, bool) external view returns (bool);
function isOfficialTripleEntity(string calldata, address, string calldata, address, string calldata, address, bool) external view returns (bool);
function isOfficialQuadrupleEntityFast(bytes32, address, bytes32, address, bytes32, address, bytes32, address, bool) external view returns (bool);
function getOfficialEntity(string calldata, address) external view returns (OfficialEntityStruct memory);
function getAllOfficialEntities(string calldata) external view returns (OfficialEntityStruct[] memory);
function init(address, string calldata) external;
}
Read Contract
ADMIN_FEE_FIXED 0x92ab91e3 → uint256
KECCAK_SMART_CONTRACT 0xe9ec573a → bytes32
KECCAK_SUPER_ADMIN 0x61f2efaf → bytes32
KECCAK_TREASURY_ADMIN 0xde29207d → bytes32
controller 0xf77c4791 → address
getAllOfficialEntities 0x397639ed → tuple[]
getName 0x17d7de7c → string
getOfficialEntity 0xf03cb7ff → tuple
getRegisteredAdminTypes 0x7d41c8ed → string[]
isOfficialDoubleEntity 0x959c428b → bool
isOfficialDoubleEntityFast 0x1711e9a0 → bool
isOfficialEntity 0x127d532b → bool
isOfficialEntityFast 0x8d17ea3c → bool
isOfficialQuadrupleEntityFast 0xd684b3c3 → bool
isOfficialTripleEntity 0xe2095a53 → bool
isOfficialTripleEntityFast 0x07f1ef9e → bool
name 0x06fdde03 → string
remoteController 0x774de680 → address
reversibleEthBalances 0xc5c145a1 → uint256, uint256, uint256
reversibleTokenBalances 0x4e8b3d03 → uint256, uint256, uint256
totalAdminFeesCollected 0x15a0d6b7 → uint256
Write Contract 10 functions
These functions modify contract state and require a wallet transaction to execute.
addOfficialEntity 0xeaee5eaf
string adminType
address entityAddr
string label
string nationalIdOrSC
returns: bool
changeAdminFee 0xb6632cb3
uint256 newFee
init 0xf321b305
address officialSmartContractAddress
string contractName
manualUpdateReversibleBalanceERC20 0x70e5d269
address userAddress
uint256 amount
address tokenSC
manualUpdateReversibleBalanceETH 0x1ea5283e
address userAddress
uint256 amount
remotelyManage 0xdbf6e37a
address _controller
removeOfficialEntity 0x6359a1c1
string adminType
address entityAddr
returns: bool
reverseAccidentalERC20 0x01d7a0a8
address tokenSC
reverseAccidentalETH 0xec7760c4
No parameters
setName 0xc47f0027
string newName
Recent Transactions
No transactions found for this address