-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maciej Wójcik
committed
Feb 27, 2024
1 parent
dae2bf6
commit 1ea90ac
Showing
16 changed files
with
113 additions
and
114 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...acts/client/transfer_validator/Cargo.toml → ...s/client/change_bid_public_key/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
[package] | ||
name = "transfer_validator" | ||
name = "change_bid_public_key" | ||
version = "0.1.0" | ||
authors = ["Maciej Wójcik <[email protected]>"] | ||
edition = "2018" | ||
|
||
[[bin]] | ||
name = "transfer_validator" | ||
name = "change_bid_public_key" | ||
bench = false | ||
doctest = false | ||
test = false | ||
|
32 changes: 32 additions & 0 deletions
32
smart_contracts/contracts/client/change_bid_public_key/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
extern crate alloc; | ||
|
||
use casper_contract::contract_api::{runtime, system}; | ||
use casper_types::{ | ||
runtime_args, | ||
system::auction::{ARG_NEW_PUBLIC_KEY, ARG_PUBLIC_KEY, METHOD_CHANGE_BID_PUBLIC_KEY}, | ||
PublicKey, | ||
}; | ||
|
||
fn change_bid_public_key(public_key: PublicKey, new_public_key: PublicKey) { | ||
let contract_hash = system::get_auction(); | ||
let args = runtime_args! { | ||
ARG_PUBLIC_KEY => public_key, | ||
ARG_NEW_PUBLIC_KEY => new_public_key | ||
}; | ||
runtime::call_contract::<()>(contract_hash, METHOD_CHANGE_BID_PUBLIC_KEY, args); | ||
} | ||
|
||
// Change validator bid public key. | ||
// | ||
// Accepts current bid's public key and new public key. | ||
// Updates existing validator bid and all related delegator bids with | ||
// the new public key. | ||
#[no_mangle] | ||
pub extern "C" fn call() { | ||
let public_key = runtime::get_named_arg(ARG_PUBLIC_KEY); | ||
let new_public_key = runtime::get_named_arg(ARG_NEW_PUBLIC_KEY); | ||
change_bid_public_key(public_key, new_public_key); | ||
} |
32 changes: 0 additions & 32 deletions
32
smart_contracts/contracts/client/transfer_validator/src/main.rs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.