Skip to content
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

Bridge metadata trustlessly #47

Open
mfornet opened this issue Mar 17, 2021 · 0 comments
Open

Bridge metadata trustlessly #47

mfornet opened this issue Mar 17, 2021 · 0 comments
Labels
enhancement New feature or request P2

Comments

@mfornet
Copy link
Contributor

mfornet commented Mar 17, 2021

Bridge metadata of ERC20 tokens in a trustless way, so anyone can set metadata of bridged tokens.

Proposal:

Create a contract on Ethereum that implements:

struct Metadata {
        token: String,
        name: String,
        symbol: String,
        decimals: u8,
}

contract TellMetadata {
    fn get_metadata(token: address) {
        // fetch metadata from the token
        emit Metadata { .. }
    }
}

On NEAR side, the factory contains the address of this contract. This address is passed to each bridged token when it is deployed. BridgeToken should look like:

struct BridgeToken {
    ...,
    tell_metadata_address: EthereumAddress,
}

impl BridgeToken {
    ...,
    fn set_metadata(event: Vec<u8>, proof: Proof) {
        // Deserialize Metadata event
        // Check that it was emited by `TellMetadata`
        // Check that proof is valid
        // set metadata
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2
Projects
None yet
Development

No branches or pull requests

1 participant