{"id":19952950,"url":"https://github.com/ethersphere/swarm-oracles","last_synced_at":"2025-08-24T03:34:25.635Z","repository":{"id":44056443,"uuid":"216832112","full_name":"ethersphere/swarm-oracles","owner":"ethersphere","description":"obsolete - This repository holds the smart-contracts for on-chain oracles, used for updating global variables in the Swarm network","archived":false,"fork":false,"pushed_at":"2023-01-24T00:43:12.000Z","size":482,"stargazers_count":4,"open_issues_count":20,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-03T19:39:25.978Z","etag":null,"topics":["obsolete"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethersphere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-22T14:18:42.000Z","updated_at":"2022-12-28T21:03:28.000Z","dependencies_parsed_at":"2023-02-13T06:00:36.371Z","dependency_job_id":null,"html_url":"https://github.com/ethersphere/swarm-oracles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ethersphere/swarm-oracles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Fswarm-oracles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Fswarm-oracles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Fswarm-oracles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Fswarm-oracles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethersphere","download_url":"https://codeload.github.com/ethersphere/swarm-oracles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethersphere%2Fswarm-oracles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271786014,"owners_count":24820581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["obsolete"],"created_at":"2024-11-13T01:14:52.554Z","updated_at":"2025-08-24T03:34:25.597Z","avatar_url":"https://github.com/ethersphere.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\nThe msgOracle smart-contracts are intended to be the on-chain component (`messageToHoneyContract`) of [SWIP 21](https://github.com/ethersphere/SWIPs/blob/bddd78a24ae4c036cb63f79578cf26c2ec9195a9/SWIPs/swip-21-message_to_honey.md).\n\n# MsgOracle\nThe MsgOracle is a smart-contract which inherits functionalities from [openzeppelin-solidity/ownable](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/ownership/Ownable.sol). As such, it can define an owner and limit access to certain function to be only performed by the owner. \nBy reading the events emitted by this smart-contract (in particular: `LogNewTTL`, `LogSetMsgPrice` and `LogRevertMsgPrice`), nodes know the latest value of all message prices in Swarm and be guaranteed that their peers apply the same prices.\n\n## Tests\n\nThis is a regular truffle project. You can either use `truffle test` (if installed) or `npm test` which will use a locally installed truffle.\n\n```sh\nnpm install\nnpm test\n```\n\n## Go-bindings\n\nTo generate go bindings use\n```sh\nnpm run abigen\n```\n\nThis will generate the bindings in the `bindings/` directory. Suitable versions of `solc` and `abigen` have to be installed for this to work.\nAlternatively this can also be done through docker:\n\n```sh\ndocker build -t swarm-oracles .\ndocker run -v $(pwd)/bindings:/oracles/bindings swarm-oracles npm run abigen\n```\n\nIn addition to the file from `abigen` this will also generate a go file that includes the runtime bytecode.\n\n## Description of public functions\nThe `msgOracle` exposes the following functions:\n\n### TTL\n- Getter function, which returns the Time To Live (`TTL`) for the contract. `TTL` signals to the nodes how long a response from the oracle is guaranteed valid; if a node uses an oracle response which is older than `TTL` seconds, it is not guaranteed to be correct anymore.\n\n### owner\n- Getter function, which return the current owner of the contract.\n\n### newTTL \n- Sets a new Time To Live (`TTL`). `TTL` can only be updated after `TTL` seconds after it was set. \n- Stores the previous value of `TTL` .\n- Stores when the function was called.\n- Emits a `LogNewTTL(uint256 TTL)` event on which nodes can listen to be informed on changes in `TTL`.\n- only callable by `owner`\n\n### setMsgPrice \n- informs the node about a new `price` for a particular `swarmMsg`, in effect from a certain date (`validFrom`)\n- requires validFrom to be at least `TTL` seconds in the future. If `TTL` has been recently updated (not longer than the old value of `TTL` seconds ago), we use the old value of `TTL`.\n- Emits a `LogSetMsgPrice(bytes32 indexed swarmMsg, uint256 price, uint256 validFrom)` event.\n- only callable by `owner`\n\n### revertMsgPrice\n- informs the node to ignore a previous emitted `LogSetMsgPrice` event with the same arguments as the `LogRevertMsgPrice(bytes32 indexed swarmMsg, uint256 price, uint256 validFrom)` event, emitted by this function. \n- only callable by `owner`\n\n### renounceOwnership\n- Set's the ownership of this smart-contract to the 0 address, which will render all functionalities of this smart-contract forever useless. \n- emits an `OwnershipTransferred(address indexed previousOwner, address indexed newOwner)` event.\n- only callable by `owner`\n\n### transferOwnership\n- Set's the ownership of this smart-contract to another address. Meant for updating the governance around the oracle.\n- emits an `OwnershipTransferred(address indexed previousOwner, address indexed newOwner)` event.\n- only callable by `owner`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethersphere%2Fswarm-oracles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethersphere%2Fswarm-oracles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethersphere%2Fswarm-oracles/lists"}