Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #39 from near/bridged-erc20-back
Browse files Browse the repository at this point in the history
feat: almost send a Bridged NEP21 back to Ethereum
  • Loading branch information
chadoh authored Dec 17, 2020
2 parents db4f882 + 07166a9 commit 2396d32
Show file tree
Hide file tree
Showing 18 changed files with 1,146 additions and 550 deletions.
2 changes: 2 additions & 0 deletions .config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
},
development: {
ethClientAddress: '0xF721c979db97413AA9D0F91ad531FaBF769bb09C',
ethNearOnEthClientAbiText: readFileSync('./nearOnEthClient.abi'),
ethEd25519Address: '0x9003342d15B21b4C42e1702447fE2f39FfAF55C2',
ethErc20AbiText: readFileSync('./erc20.abi'),
featuredErc20s:
Expand All @@ -40,6 +41,7 @@ module.exports = {
ethNetwork: 'rinkeby',
ethNodeUrl: 'https://rinkeby.infura.io/v3/TODO',
ethProverAddress: '0xc5D62d66B8650E6242D9936c7e50E959BA0F9E37',
ethProverAbiText: readFileSync('./prover.abi'),
nearClientAccount: 'ethonnearclient10',
nearHelperUrl: 'https://helper.testnet.near.org/',
nearNetworkId: 'testnet',
Expand Down
1 change: 1 addition & 0 deletions nearOnEthClient.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract Ed25519","name":"ed","type":"address"},{"internalType":"uint256","name":"lockEthAmount_","type":"uint256"},{"internalType":"uint256","name":"lockDuration_","type":"uint256"},{"internalType":"uint256","name":"replaceDuration_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"height","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"name":"BlockHashAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"height","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"blockHash","type":"bytes32"}],"name":"BlockHashReverted","type":"event"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"addLightClientBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"height","type":"uint64"}],"name":"blockHashes","outputs":[{"internalType":"bytes32","name":"res","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"height","type":"uint64"}],"name":"blockMerkleRoots","outputs":[{"internalType":"bytes32","name":"res","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeState","outputs":[{"components":[{"internalType":"uint256","name":"currentHeight","type":"uint256"},{"internalType":"uint256","name":"nextTimestamp","type":"uint256"},{"internalType":"uint256","name":"nextValidAt","type":"uint256"},{"internalType":"uint256","name":"numBlockProducers","type":"uint256"}],"internalType":"struct NearBridge.BridgeState","name":"res","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"signatureIndex","type":"uint256"}],"name":"challenge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"signatureIndex","type":"uint256"}],"name":"checkBlockProducerSignatureInHead","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"initWithBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"initialValidators_","type":"bytes"}],"name":"initWithValidators","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockEthAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"replaceDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"dependencies": {
"@walletconnect/web3-provider": "^1.2.1",
"bs58": "^4.0.1",
"eth-object": "near/eth-object#54e03b8aac8208cf724e206d49ffb8bdd30451d7",
"eth-revert-reason": "^1.0.3",
"eth-util-lite": "near/eth-util-lite#master",
Expand Down
1 change: 1 addition & 0 deletions prover.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"contract INearBridge","name":"_bridge","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"contract INearBridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"proofData","type":"bytes"},{"internalType":"uint64","name":"blockHeight","type":"uint64"}],"name":"proveOutcome","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
1 change: 1 addition & 0 deletions src/css/a11y.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.visually-hidden {
position: absolute;
text-indent: -9999em;
width: 0;
}
1 change: 0 additions & 1 deletion src/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ fieldset {
input, select {
background-color: var(--shadow);
border: none;
border-radius: 5px 0 0 5px;
caret-color: var(--primary);
color: inherit;
padding: 0.25em 0.5em;
Expand Down
9 changes: 7 additions & 2 deletions src/html/select-erc20.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<form data-behavior="select-erc20" class="select-erc20" method="get">
<label for="erc20">
Select an ERC20 token to send to NEAR
Select an ERC20 token
</label>
<div style="display: flex">
<select id="erc20" name="erc20" data-behavior="erc20Selector">
<select
data-behavior="erc20Selector"
id="erc20"
name="erc20"
style="border-radius: 5px 0 0 5px"
>
</select>
<button id="submit" style="border-radius: 0 5px 5px 0">
Go
Expand Down
Loading

0 comments on commit 2396d32

Please sign in to comment.