filecoin-saturn / contracts

contracts
6 stars 0 forks source link

feat: filecoin to eth address conversion #19

Closed alexander-camuto closed 1 year ago

alexander-camuto commented 1 year ago

There are currently no (that we know of) implementations of filecoin address to eth equivalent converters. To aid in the deployment of payouts from Filecoin addresses this PR:

Example usage:

use cli::utils::filecoin_to_eth_address;

// test ID type addresses
let addr = "t01";
assert_eq!(filecoin_to_eth_address(addr).unwrap(), "0xff00000000000000000000000000000000000001");
let addr = "t0100";
assert_eq!(filecoin_to_eth_address(addr).unwrap(), "0xff00000000000000000000000000000000000064");
let addr = "t05088";
assert_eq!(filecoin_to_eth_address(addr).unwrap(), "0xff000000000000000000000000000000000013e0");

// test delegated addresses
let addr = "t410fkkld55ioe7qg24wvt7fu6pbknb56ht7pt4zamxa";  
assert_eq!(filecoin_to_eth_address(addr).unwrap(), "0x52963ef50e27e06d72d59fcb4f3c2a687be3cfef");