Skip to content

Commit 9bf3af6

Browse files
author
Mike-CZ
committed
Remove hardcoded redirections
1 parent f216130 commit 9bf3af6

File tree

1 file changed

+1
-82
lines changed

1 file changed

+1
-82
lines changed

contracts/sfc/SFCLib.sol

+1-82
Original file line numberDiff line numberDiff line change
@@ -727,93 +727,12 @@ contract SFCLib is SFCBase {
727727
}
728728
}
729729

730-
function redirectedAccs() private pure returns (address[] memory, address[] memory) {
731-
// the addresses below were reported as stolen by their owners via the signatures below:
732-
// I redirect SFC withdrawals to account 0x80f93310709624636852d0111fd6c4A6e02ED0aA due to a potential attacker gaining access to my account.
733-
// {
734-
// "address": "0x93419fcb5d9dc7989439f0512d4f737421ed48d9",
735-
// "msg": "0x4920726564697265637420534643207769746864726177616c7320746f206163636f756e74203078383066393333313037303936323436333638353264303131316664366334413665303245443061412064756520746f206120706f74656e7469616c2061747461636b6572206761696e696e672061636365737320746f206d79206163636f756e742e",
736-
// "sig": "1c4f3168e01d499a657f0d1cd453b26e5f69aaf14372983ff62e54a1d53959e55edb0746f4aea0959899b06bf31dc6a0160f6ac428cd75d4657184ab2337e46e1c",
737-
// "version": "3",
738-
// "signer": "MEW"
739-
// }
740-
// --
741-
// I redirect SFC withdrawals to account 0x91B20102Dfd2ff1b00D0915266584009d0b1Ae39 due to a potential attacker gaining access to my account.
742-
// {
743-
// "address": "0xfbcae1b28ca5039dafec4f10a89e022bc8118394",
744-
// "msg": "0x4920726564697265637420534643207769746864726177616c7320746f206163636f756e74203078393142323031303244666432666631623030443039313532363635383430303964306231416533392064756520746f206120706f74656e7469616c2061747461636b6572206761696e696e672061636365737320746f206d79206163636f756e742e",
745-
// "sig": "c98431cc1b6f26b8248ca83f860721f31ec79097831e69c28d352512182bbfa93911564ed46ba11547b544c4d65380781a4f3cc6afe9f075d43a24e0947853151c",
746-
// "version": "3",
747-
// "signer": "MEW"
748-
// }
749-
// --
750-
// I redirect SFC withdrawals to account 0xCA3C54c11172A7263300a801E9937780b5143c08 due to a potential attacker gaining access to my account.
751-
// {
752-
// "address": "0x15c2ec517905fb3282f26f3ac3e12889755a2ed7",
753-
// "msg": "0x4920726564697265637420534643207769746864726177616c7320746f206163636f756e74203078434133433534633131313732413732363333303061383031453939333737383062353134336330382064756520746f206120706f74656e7469616c2061747461636b6572206761696e696e672061636365737320746f206d79206163636f756e742e",
754-
// "sig": "8d933ea6b1dfaa70c92d7dd8f68e9c821934eabd9c454dc792a90c9c58d0c4ec5c60d7737e7b8ed38cfdfe3bd7fce9a2c38133b9a98d6699088d79edb09ec3c21b",
755-
// "version": "3",
756-
// "signer": "MEW"
757-
// }
758-
// --
759-
// I redirect SFC withdrawals to account 0x5A1CAd027EACE4C052f5DEE0f42Da6c62E39b779 due to a potential attacker gaining access to my account.
760-
// {
761-
// "address": "0xbdAaEC5f9317cC63D26FD7d79aD17372Ccd7d763",
762-
// "msg": "0x4920726564697265637420534643207769746864726177616c7320746f206163636f756e74203078354131434164303237454143453443303532663544454530663432446136633632453339623737392064756520746f206120706f74656e7469616c2061747461636b6572206761696e696e672061636365737320746f206d79206163636f756e742e",
763-
// "sig": "0e9b3ce37f665ab03bdfd3095671249e1b2842b1dd314fd4281bbed527ea69014ca510227e57f973b35ef175c1214fb1a842be70ff5a9290cb260799c544eed900",
764-
// "version": "3",
765-
// "signer": "MEW"
766-
// }
767-
// --
768-
// I redirect SFC withdrawals to account 0x4A15B527475977D9B0CB3fcfE825d6Aa7428fAFC due to a potential attacker gaining access to my account.
769-
// {
770-
// "address": "0xf72148504819A1D1B038694B02d299F65BfA312d",
771-
// "msg": "0x4920726564697265637420534643207769746864726177616c7320746f206163636f756e74203078344131354235323734373539373744394230434233666366453832356436416137343238664146432064756520746f206120706f74656e7469616c2061747461636b6572206761696e696e672061636365737320746f206d79206163636f756e742e",
772-
// "sig": "cf6386edbbee504c07ae95cb7c5ef06e7e0f57b34d51ab4e4047b5cb326af9bc236f544a3ced994cd20601047966e683aaaf329772fbb6bf37f0bd12200d1e6100",
773-
// "version": "3",
774-
// "signer": "MEW"
775-
// }
776-
// The contract does not lock these positions; instead, it restricts withdrawals exclusively to the account designated in the signature.
777-
// This measure prevents an attacker from transferring FTM following a withdrawal.
778-
779-
address[] memory froms = new address[](5);
780-
address[] memory tos = new address[](5);
781-
assert(froms.length == tos.length);
782-
froms[0] = 0x93419FcB5d9DC7989439f0512d4F737421ed48D9;
783-
tos[0] = 0x80f93310709624636852d0111fd6c4A6e02ED0aA;
784-
froms[1] = 0xFbCAe1B28ca5039DAFec4f10A89e022Bc8118394;
785-
tos[1] = 0x91B20102Dfd2ff1b00D0915266584009d0b1Ae39;
786-
froms[2] = 0x15C2EC517905fB3282f26F3aC3e12889755a2ed7;
787-
tos[2] = 0xCA3C54c11172A7263300a801E9937780b5143c08;
788-
froms[3] = 0xbdAaEC5f9317cC63D26FD7d79aD17372Ccd7d763;
789-
tos[3] = 0x5A1CAd027EACE4C052f5DEE0f42Da6c62E39b779;
790-
froms[4] = 0xf72148504819A1D1B038694B02d299F65BfA312d;
791-
tos[4] = 0x4A15B527475977D9B0CB3fcfE825d6Aa7428fAFC;
792-
return (froms, tos);
793-
}
794-
795730
function _redirected(address addr) internal view returns (bool) {
796-
(address[] memory froms, ) = redirectedAccs();
797-
for (uint256 i = 0; i < froms.length; i++) {
798-
if (addr == froms[i]) {
799-
return true;
800-
}
801-
}
802731
return getRedirection[addr] != address(0);
803732
}
804733

805-
function _redirectedTo(address addr) internal view returns (address) {
806-
(address[] memory froms, address[] memory tos) = redirectedAccs();
807-
for (uint256 i = 0; i < froms.length; i++) {
808-
if (addr == froms[i]) {
809-
return tos[i];
810-
}
811-
}
812-
return getRedirection[addr];
813-
}
814-
815734
function _receiverOf(address addr) internal view returns (address payable) {
816-
address to = _redirectedTo(addr);
735+
address to = getRedirection[addr];
817736
if (to == address(0)) {
818737
return payable(address(uint160(addr)));
819738
}

0 commit comments

Comments
 (0)