Skip to content

Commit

Permalink
feat(evm-oracle): add Solidity contract that we can use to expose the…
Browse files Browse the repository at this point in the history
… Nibiru Oracle in the ChainLink interface (#2149)

* feat(evm-oracle): add Solidity contract that we can use to expose the Nibiru Oracle in the ChainLink interface

* chore: change log

* feat(evm-oracle): add decimals to the consturctor for NibiruOracleChainLinkLike

* feat: make solidity available on npm (@nibiruchain/solidity)

* chore: formatter and linter

* (evm-contracts): add require statement  for pair to constructor
  • Loading branch information
Unique-Divine authored Jan 9, 2025
1 parent 8e477cb commit c9c56a9
Show file tree
Hide file tree
Showing 22 changed files with 2,204 additions and 358 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#2144](https://github.com/NibiruChain/nibiru/pull/2144) - feat(token-registry): Implement strongly typed Nibiru Token Registry and generation command
- [#2145](https://github.com/NibiruChain/nibiru/pull/2145) - chore(token-registry): add xNIBI Astrovault LST to registry
- [#2147](https://github.com/NibiruChain/nibiru/pull/2147) - fix(simapp): manually add x/vesting Cosmos-SDK module types to the codec in simulation tests since they are expected by default
- [#2149](https://github.com/NibiruChain/nibiru/pull/2149) - feat(evm-oracle):
add Solidity contract that we can use to expose the Nibiru Oracle in the
ChainLink interface. Publish all precompiled contracts and ABIs on npm under
the `@nibiruchain/solidity` package.
- [#2151](https://github.com/NibiruChain/nibiru/pull/2151) - feat(evm): randao support for evm
- [#2152](https://github.com/NibiruChain/nibiru/pull/2152) - fix(precompile): consume gas for precompile calls regardless of error

Expand Down
41 changes: 31 additions & 10 deletions evm-e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions evm-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"typechain": "^8.3.2",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@openzeppelin/contracts": "^5.1.0",
"@nibiruchain/solidity": "^0.0.2",
"hardhat": "^2.22.15"
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ gen-embeds:
npx hardhat compile
log_success "Compiled Solidity in $embeds_dir"

go run "gen-abi/main.go"
log_success "Saved ABI JSON files to $embeds_dir/abi for npm publishing"

alias gen-proto := proto-gen

# Generate the Nibiru Token Registry files
Expand Down
17 changes: 15 additions & 2 deletions x/evm/embeds/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# Nibiru Contract Embeds
# @nibiruchain/solidity

Nibiru EVM solidity contracts and ABIs for Nibiru-specific precompiles and core protocol functionality.

## Install

```bash
yarn add @nibiruchain/solidity

# OR npm install OR bun install
```

Solidity code is in "@nibiruchain/solidity/contracts/*", and
ABI JSON files are in "@nibiruchain/solidity/abi/*".

## Hacking

```shell
```bash
npm install
npx hardhat compile
```
Expand Down
113 changes: 113 additions & 0 deletions x/evm/embeds/abi/ChainLinkAggregatorV3Interface.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
[
{
"inputs": [],
"name": "decimals",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "description",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint80",
"name": "_roundId",
"type": "uint80"
}
],
"name": "getRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "latestRoundData",
"outputs": [
{
"internalType": "uint80",
"name": "roundId",
"type": "uint80"
},
{
"internalType": "int256",
"name": "answer",
"type": "int256"
},
{
"internalType": "uint256",
"name": "startedAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "updatedAt",
"type": "uint256"
},
{
"internalType": "uint80",
"name": "answeredInRound",
"type": "uint80"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]
Loading

0 comments on commit c9c56a9

Please sign in to comment.